google_iap1/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 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudIAP related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_iap1 as iap1;
49/// use iap1::api::IdentityAwareProxyClient;
50/// use iap1::{Result, Error};
51/// # async fn dox() {
52/// use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = CloudIAP::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = IdentityAwareProxyClient::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().brands_identity_aware_proxy_clients_create(req, "parent")
99/// .doit().await;
100///
101/// match result {
102/// Err(e) => match e {
103/// // The Error enum provides details about what exactly happened.
104/// // You can also just use its `Debug`, `Display` or `Error` traits
105/// Error::HttpError(_)
106/// |Error::Io(_)
107/// |Error::MissingAPIKey
108/// |Error::MissingToken(_)
109/// |Error::Cancelled
110/// |Error::UploadSizeLimitExceeded(_, _)
111/// |Error::Failure(_)
112/// |Error::BadRequest(_)
113/// |Error::FieldClash(_)
114/// |Error::JsonDecodeError(_, _) => println!("{}", e),
115/// },
116/// Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct CloudIAP<C> {
122 pub client: common::Client<C>,
123 pub auth: Box<dyn common::GetToken>,
124 _user_agent: String,
125 _base_url: String,
126 _root_url: String,
127}
128
129impl<C> common::Hub for CloudIAP<C> {}
130
131impl<'a, C> CloudIAP<C> {
132 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudIAP<C> {
133 CloudIAP {
134 client,
135 auth: Box::new(auth),
136 _user_agent: "google-api-rust-client/7.0.0".to_string(),
137 _base_url: "https://iap.googleapis.com/".to_string(),
138 _root_url: "https://iap.googleapis.com/".to_string(),
139 }
140 }
141
142 pub fn methods(&'a self) -> MethodMethods<'a, C> {
143 MethodMethods { hub: self }
144 }
145 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
146 ProjectMethods { hub: self }
147 }
148
149 /// Set the user-agent header field to use in all requests to the server.
150 /// It defaults to `google-api-rust-client/7.0.0`.
151 ///
152 /// Returns the previously set user-agent.
153 pub fn user_agent(&mut self, agent_name: String) -> String {
154 std::mem::replace(&mut self._user_agent, agent_name)
155 }
156
157 /// Set the base url to use in all requests to the server.
158 /// It defaults to `https://iap.googleapis.com/`.
159 ///
160 /// Returns the previously set base url.
161 pub fn base_url(&mut self, new_base_url: String) -> String {
162 std::mem::replace(&mut self._base_url, new_base_url)
163 }
164
165 /// Set the root url to use in all requests to the server.
166 /// It defaults to `https://iap.googleapis.com/`.
167 ///
168 /// Returns the previously set root url.
169 pub fn root_url(&mut self, new_root_url: String) -> String {
170 std::mem::replace(&mut self._root_url, new_root_url)
171 }
172}
173
174// ############
175// SCHEMAS ###
176// ##########
177/// Custom content configuration for access denied page. IAP allows customers to define a custom URI to use as the error page when access is denied to users. If IAP prevents access to this page, the default IAP error page will be displayed instead.
178///
179/// This type is not used in any activity, and only used as *part* of another schema.
180///
181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
182#[serde_with::serde_as]
183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
184pub struct AccessDeniedPageSettings {
185 /// The URI to be redirected to when access is denied.
186 #[serde(rename = "accessDeniedPageUri")]
187 pub access_denied_page_uri: Option<String>,
188 /// Whether to generate a troubleshooting URL on access denied events to this application.
189 #[serde(rename = "generateTroubleshootingUri")]
190 pub generate_troubleshooting_uri: Option<bool>,
191 /// Whether to generate remediation token on access denied events to this application.
192 #[serde(rename = "remediationTokenGenerationEnabled")]
193 pub remediation_token_generation_enabled: Option<bool>,
194}
195
196impl common::Part for AccessDeniedPageSettings {}
197
198/// Access related settings for IAP protected apps.
199///
200/// This type is not used in any activity, and only used as *part* of another schema.
201///
202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
203#[serde_with::serde_as]
204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
205pub struct AccessSettings {
206 /// Optional. Settings to configure and enable allowed domains.
207 #[serde(rename = "allowedDomainsSettings")]
208 pub allowed_domains_settings: Option<AllowedDomainsSettings>,
209 /// Optional. Configuration to allow cross-origin requests via IAP.
210 #[serde(rename = "corsSettings")]
211 pub cors_settings: Option<CorsSettings>,
212 /// Optional. GCIP claims and endpoint configurations for 3p identity providers.
213 #[serde(rename = "gcipSettings")]
214 pub gcip_settings: Option<GcipSettings>,
215 /// Optional. Identity sources that IAP can use to authenticate the end user. Only one identity source can be configured.
216 #[serde(rename = "identitySources")]
217 pub identity_sources: Option<Vec<String>>,
218 /// Optional. Settings to configure IAP's OAuth behavior.
219 #[serde(rename = "oauthSettings")]
220 pub oauth_settings: Option<OAuthSettings>,
221 /// Optional. Settings to allow google-internal teams to use IAP for apps hosted in a tenant project.
222 #[serde(rename = "policyDelegationSettings")]
223 pub policy_delegation_settings: Option<PolicyDelegationSettings>,
224 /// Optional. Settings to configure reauthentication policies in IAP.
225 #[serde(rename = "reauthSettings")]
226 pub reauth_settings: Option<ReauthSettings>,
227 /// Optional. Settings to configure the workforce identity federation, including workforce pools and OAuth 2.0 settings.
228 #[serde(rename = "workforceIdentitySettings")]
229 pub workforce_identity_settings: Option<WorkforceIdentitySettings>,
230}
231
232impl common::Part for AccessSettings {}
233
234/// Configuration for IAP allowed domains. Lets you to restrict access to an app and allow access to only the domains that you list.
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct AllowedDomainsSettings {
242 /// Optional. List of trusted domains.
243 pub domains: Option<Vec<String>>,
244 /// Optional. Configuration for customers to opt in for the feature.
245 pub enable: Option<bool>,
246}
247
248impl common::Part for AllowedDomainsSettings {}
249
250/// Wrapper over application specific settings for IAP.
251///
252/// This type is not used in any activity, and only used as *part* of another schema.
253///
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct ApplicationSettings {
258 /// Optional. Customization for Access Denied page.
259 #[serde(rename = "accessDeniedPageSettings")]
260 pub access_denied_page_settings: Option<AccessDeniedPageSettings>,
261 /// Optional. Settings to configure attribute propagation.
262 #[serde(rename = "attributePropagationSettings")]
263 pub attribute_propagation_settings: Option<AttributePropagationSettings>,
264 /// The Domain value to set for cookies generated by IAP. This value is not validated by the API, but will be ignored at runtime if invalid.
265 #[serde(rename = "cookieDomain")]
266 pub cookie_domain: Option<String>,
267 /// Optional. Settings to configure IAP's behavior for a service mesh.
268 #[serde(rename = "csmSettings")]
269 pub csm_settings: Option<CsmSettings>,
270}
271
272impl common::Part for ApplicationSettings {}
273
274/// Configuration for propagating attributes to applications protected by IAP.
275///
276/// This type is not used in any activity, and only used as *part* of another schema.
277///
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct AttributePropagationSettings {
282 /// Optional. Whether the provided attribute propagation settings should be evaluated on user requests. If set to true, attributes returned from the expression will be propagated in the set output credentials.
283 pub enable: Option<bool>,
284 /// Optional. Raw string CEL expression. Must return a list of attributes. A maximum of 45 attributes can be selected. Expressions can select different attribute types from `attributes`: `attributes.saml_attributes`, `attributes.iap_attributes`. The following functions are supported: - filter `.filter(, )`: Returns a subset of `` where `` is true for every item. - in ` in `: Returns true if `` contains ``. - selectByName `.selectByName()`: Returns the attribute in `` with the given `` name, otherwise returns empty. - emitAs `.emitAs()`: Sets the `` name field to the given `` for propagation in selected output credentials. - strict `.strict()`: Ignores the `x-goog-iap-attr-` prefix for the provided `` when propagating with the `HEADER` output credential, such as request headers. - append `.append()` OR `.append()`: Appends the provided `` or `` to the end of ``. Example expression: `attributes.saml_attributes.filter(x, x.name in ['test']).append(attributes.iap_attributes.selectByName('exact').emitAs('custom').strict())`
285 pub expression: Option<String>,
286 /// Optional. Which output credentials attributes selected by the CEL expression should be propagated in. All attributes will be fully duplicated in each selected output credential.
287 #[serde(rename = "outputCredentials")]
288 pub output_credentials: Option<Vec<String>>,
289}
290
291impl common::Part for AttributePropagationSettings {}
292
293/// Associates `members`, or principals, with a `role`.
294///
295/// This type is not used in any activity, and only used as *part* of another schema.
296///
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct Binding {
301 /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
302 pub condition: Option<Expr>,
303 /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
304 pub members: Option<Vec<String>>,
305 /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
306 pub role: Option<String>,
307}
308
309impl common::Part for Binding {}
310
311/// OAuth brand data. NOTE: Only contains a portion of the data that describes a brand.
312///
313/// # Activities
314///
315/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
316/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
317///
318/// * [brands create projects](ProjectBrandCreateCall) (request|response)
319/// * [brands get projects](ProjectBrandGetCall) (response)
320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
321#[serde_with::serde_as]
322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
323pub struct Brand {
324 /// Application name displayed on OAuth consent screen.
325 #[serde(rename = "applicationTitle")]
326 pub application_title: Option<String>,
327 /// Output only. Identifier of the brand. NOTE: GCP project number achieves the same brand identification purpose as only one brand per project can be created.
328 pub name: Option<String>,
329 /// Output only. Whether the brand is only intended for usage inside the G Suite organization only.
330 #[serde(rename = "orgInternalOnly")]
331 pub org_internal_only: Option<bool>,
332 /// Support email displayed on the OAuth consent screen.
333 #[serde(rename = "supportEmail")]
334 pub support_email: Option<String>,
335}
336
337impl common::RequestValue for Brand {}
338impl common::ResponseResult for Brand {}
339
340/// Allows customers to configure HTTP request paths that'll allow HTTP `OPTIONS` call to bypass authentication and authorization.
341///
342/// This type is not used in any activity, and only used as *part* of another schema.
343///
344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
345#[serde_with::serde_as]
346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
347pub struct CorsSettings {
348 /// Configuration to allow HTTP `OPTIONS` calls to skip authentication and authorization. If undefined, IAP will not apply any special logic to `OPTIONS` requests.
349 #[serde(rename = "allowHttpOptions")]
350 pub allow_http_options: Option<bool>,
351}
352
353impl common::Part for CorsSettings {}
354
355/// Configuration for RCToken generated for service mesh workloads protected by IAP. RCToken are IAP generated JWTs that can be verified at the application. The RCToken is primarily used for service mesh deployments, and can be scoped to a single mesh by configuring the audience field accordingly.
356///
357/// This type is not used in any activity, and only used as *part* of another schema.
358///
359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
360#[serde_with::serde_as]
361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
362pub struct CsmSettings {
363 /// Audience claim set in the generated RCToken. This value is not validated by IAP.
364 #[serde(rename = "rctokenAud")]
365 pub rctoken_aud: Option<String>,
366}
367
368impl common::Part for CsmSettings {}
369
370/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
371///
372/// # Activities
373///
374/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
375/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
376///
377/// * [brands identity aware proxy clients delete projects](ProjectBrandIdentityAwareProxyClientDeleteCall) (response)
378/// * [iap_tunnel locations dest groups delete projects](ProjectIapTunnelLocationDestGroupDeleteCall) (response)
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct Empty {
383 _never_set: Option<bool>,
384}
385
386impl common::ResponseResult for Empty {}
387
388/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
389///
390/// This type is not used in any activity, and only used as *part* of another schema.
391///
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct Expr {
396 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
397 pub description: Option<String>,
398 /// Textual representation of an expression in Common Expression Language syntax.
399 pub expression: Option<String>,
400 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
401 pub location: Option<String>,
402 /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
403 pub title: Option<String>,
404}
405
406impl common::Part for Expr {}
407
408/// Allows customers to configure tenant IDs for a Cloud Identity Platform (GCIP) instance for each application.
409///
410/// This type is not used in any activity, and only used as *part* of another schema.
411///
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct GcipSettings {
416 /// Login page URI associated with the GCIP tenants. Typically, all resources within the same project share the same login page, though it could be overridden at the sub resource level.
417 #[serde(rename = "loginPageUri")]
418 pub login_page_uri: Option<String>,
419 /// Optional. GCIP tenant IDs that are linked to the IAP resource. `tenant_ids` could be a string beginning with a number character to indicate authenticating with GCIP tenant flow, or in the format of `_` to indicate authenticating with GCIP agent flow. If agent flow is used, `tenant_ids` should only contain one single element, while for tenant flow, `tenant_ids` can contain multiple elements.
420 #[serde(rename = "tenantIds")]
421 pub tenant_ids: Option<Vec<String>>,
422}
423
424impl common::Part for GcipSettings {}
425
426/// Request message for `GetIamPolicy` method.
427///
428/// # Activities
429///
430/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
431/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
432///
433/// * [get iam policy](MethodGetIamPolicyCall) (request)
434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
435#[serde_with::serde_as]
436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
437pub struct GetIamPolicyRequest {
438 /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
439 pub options: Option<GetPolicyOptions>,
440}
441
442impl common::RequestValue for GetIamPolicyRequest {}
443
444/// Encapsulates settings provided to GetIamPolicy.
445///
446/// This type is not used in any activity, and only used as *part* of another schema.
447///
448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
449#[serde_with::serde_as]
450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
451pub struct GetPolicyOptions {
452 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
453 #[serde(rename = "requestedPolicyVersion")]
454 pub requested_policy_version: Option<i32>,
455}
456
457impl common::Part for GetPolicyOptions {}
458
459/// The IAP configurable settings.
460///
461/// # Activities
462///
463/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
464/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
465///
466/// * [get iap settings](MethodGetIapSettingCall) (response)
467/// * [update iap settings](MethodUpdateIapSettingCall) (request|response)
468#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
469#[serde_with::serde_as]
470#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
471pub struct IapSettings {
472 /// Optional. Top level wrapper for all access related setting in IAP
473 #[serde(rename = "accessSettings")]
474 pub access_settings: Option<AccessSettings>,
475 /// Optional. Top level wrapper for all application related settings in IAP
476 #[serde(rename = "applicationSettings")]
477 pub application_settings: Option<ApplicationSettings>,
478 /// Required. The resource name of the IAP protected resource.
479 pub name: Option<String>,
480}
481
482impl common::RequestValue for IapSettings {}
483impl common::ResponseResult for IapSettings {}
484
485/// Contains the data that describes an Identity Aware Proxy owned client.
486///
487/// # Activities
488///
489/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
490/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
491///
492/// * [brands identity aware proxy clients create projects](ProjectBrandIdentityAwareProxyClientCreateCall) (request|response)
493/// * [brands identity aware proxy clients get projects](ProjectBrandIdentityAwareProxyClientGetCall) (response)
494/// * [brands identity aware proxy clients reset secret projects](ProjectBrandIdentityAwareProxyClientResetSecretCall) (response)
495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
496#[serde_with::serde_as]
497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
498pub struct IdentityAwareProxyClient {
499 /// Human-friendly name given to the OAuth client.
500 #[serde(rename = "displayName")]
501 pub display_name: Option<String>,
502 /// Output only. Unique identifier of the OAuth client.
503 pub name: Option<String>,
504 /// Output only. Client secret of the OAuth client.
505 pub secret: Option<String>,
506}
507
508impl common::RequestValue for IdentityAwareProxyClient {}
509impl common::ResponseResult for IdentityAwareProxyClient {}
510
511/// Response message for ListBrands.
512///
513/// # Activities
514///
515/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
516/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
517///
518/// * [brands list projects](ProjectBrandListCall) (response)
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct ListBrandsResponse {
523 /// Brands existing in the project.
524 pub brands: Option<Vec<Brand>>,
525}
526
527impl common::ResponseResult for ListBrandsResponse {}
528
529/// Response message for ListIdentityAwareProxyClients.
530///
531/// # Activities
532///
533/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
534/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
535///
536/// * [brands identity aware proxy clients list projects](ProjectBrandIdentityAwareProxyClientListCall) (response)
537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
538#[serde_with::serde_as]
539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
540pub struct ListIdentityAwareProxyClientsResponse {
541 /// Clients existing in the brand.
542 #[serde(rename = "identityAwareProxyClients")]
543 pub identity_aware_proxy_clients: Option<Vec<IdentityAwareProxyClient>>,
544 /// A token, which can be send as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
545 #[serde(rename = "nextPageToken")]
546 pub next_page_token: Option<String>,
547}
548
549impl common::ResponseResult for ListIdentityAwareProxyClientsResponse {}
550
551/// The response from ListTunnelDestGroups.
552///
553/// # Activities
554///
555/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
556/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
557///
558/// * [iap_tunnel locations dest groups list projects](ProjectIapTunnelLocationDestGroupListCall) (response)
559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
560#[serde_with::serde_as]
561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
562pub struct ListTunnelDestGroupsResponse {
563 /// A token that you can send as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
564 #[serde(rename = "nextPageToken")]
565 pub next_page_token: Option<String>,
566 /// TunnelDestGroup existing in the project.
567 #[serde(rename = "tunnelDestGroups")]
568 pub tunnel_dest_groups: Option<Vec<TunnelDestGroup>>,
569}
570
571impl common::ResponseResult for ListTunnelDestGroupsResponse {}
572
573/// Used for calculating the next state of tags on the resource being passed for the CheckCustomConstraints RPC call. The detail evaluation of each field is described in go/op-create-update-time-tags and go/tags-in-orgpolicy-requests.
574///
575/// This type is not used in any activity, and only used as *part* of another schema.
576///
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct NextStateOfTags {
581 /// no description provided
582 #[serde(rename = "tagsFullState")]
583 pub tags_full_state: Option<TagsFullState>,
584 /// no description provided
585 #[serde(rename = "tagsFullStateForChildResource")]
586 pub tags_full_state_for_child_resource: Option<TagsFullStateForChildResource>,
587 /// no description provided
588 #[serde(rename = "tagsPartialState")]
589 pub tags_partial_state: Option<TagsPartialState>,
590}
591
592impl common::Part for NextStateOfTags {}
593
594/// The OAuth 2.0 Settings
595///
596/// This type is not used in any activity, and only used as *part* of another schema.
597///
598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
599#[serde_with::serde_as]
600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
601pub struct OAuth2 {
602 /// The OAuth 2.0 client ID registered in the workforce identity federation OAuth 2.0 Server.
603 #[serde(rename = "clientId")]
604 pub client_id: Option<String>,
605 /// Input only. The OAuth 2.0 client secret created while registering the client ID.
606 #[serde(rename = "clientSecret")]
607 pub client_secret: Option<String>,
608 /// Output only. SHA256 hash value for the client secret. This field is returned by IAP when the settings are retrieved.
609 #[serde(rename = "clientSecretSha256")]
610 pub client_secret_sha256: Option<String>,
611}
612
613impl common::Part for OAuth2 {}
614
615/// Configuration for OAuth login&consent flow behavior as well as for OAuth Credentials.
616///
617/// This type is not used in any activity, and only used as *part* of another schema.
618///
619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
620#[serde_with::serde_as]
621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
622pub struct OAuthSettings {
623 /// Domain hint to send as hd=? parameter in OAuth request flow. Enables redirect to primary IDP by skipping Google's login screen. https://developers.google.com/identity/protocols/OpenIDConnect#hd-param Note: IAP does not verify that the id token's hd claim matches this value since access behavior is managed by IAM policies.
624 #[serde(rename = "loginHint")]
625 pub login_hint: Option<String>,
626 /// Optional. List of client ids allowed to use IAP programmatically.
627 #[serde(rename = "programmaticClients")]
628 pub programmatic_clients: Option<Vec<String>>,
629}
630
631impl common::Part for OAuthSettings {}
632
633/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
634///
635/// # Activities
636///
637/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
638/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
639///
640/// * [get iam policy](MethodGetIamPolicyCall) (response)
641/// * [set iam policy](MethodSetIamPolicyCall) (response)
642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
643#[serde_with::serde_as]
644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
645pub struct Policy {
646 /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
647 pub bindings: Option<Vec<Binding>>,
648 /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
649 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
650 pub etag: Option<Vec<u8>>,
651 /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
652 pub version: Option<i32>,
653}
654
655impl common::ResponseResult for Policy {}
656
657/// PolicyDelegationConfig allows google-internal teams to use IAP for apps hosted in a tenant project. Using these settings, the app can delegate permission check to happen against the linked customer project. This is only ever supposed to be used by google internal teams, hence the restriction on the proto.
658///
659/// This type is not used in any activity, and only used as *part* of another schema.
660///
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct PolicyDelegationSettings {
665 /// Permission to check in IAM.
666 #[serde(rename = "iamPermission")]
667 pub iam_permission: Option<String>,
668 /// The DNS name of the service (e.g. "resourcemanager.googleapis.com"). This should be the domain name part of the full resource names (see https://aip.dev/122#full-resource-names), which is usually the same as IamServiceSpec.service of the service where the resource type is defined.
669 #[serde(rename = "iamServiceName")]
670 pub iam_service_name: Option<String>,
671 /// Policy name to be checked
672 #[serde(rename = "policyName")]
673 pub policy_name: Option<PolicyName>,
674 /// IAM resource to check permission on
675 pub resource: Option<Resource>,
676}
677
678impl common::Part for PolicyDelegationSettings {}
679
680/// An internal name for an IAM policy, based on the resource to which the policy applies. Not to be confused with a resource's external full resource name. For more information on this distinction, see go/iam-full-resource-names.
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct PolicyName {
688 /// Identifies an instance of the type. ID format varies by type. The ID format is defined in the IAM .service file that defines the type, either in path_mapping or in a comment.
689 pub id: Option<String>,
690 /// For Cloud IAM: The location of the Policy. Must be empty or "global" for Policies owned by global IAM. Must name a region from prodspec/cloud-iam-cloudspec for Regional IAM Policies, see go/iam-faq#where-is-iam-currently-deployed. For Local IAM: This field should be set to "local".
691 pub region: Option<String>,
692 /// Resource type. Types are defined in IAM's .service files. Valid values for type might be 'storage_buckets', 'compute_instances', 'resourcemanager_customers', 'billing_accounts', etc.
693 #[serde(rename = "type")]
694 pub type_: Option<String>,
695}
696
697impl common::Part for PolicyName {}
698
699/// Configuration for IAP reauthentication policies.
700///
701/// This type is not used in any activity, and only used as *part* of another schema.
702///
703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
704#[serde_with::serde_as]
705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
706pub struct ReauthSettings {
707 /// Optional. Reauth session lifetime, how long before a user has to reauthenticate again.
708 #[serde(rename = "maxAge")]
709 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
710 pub max_age: Option<chrono::Duration>,
711 /// Optional. Reauth method requested.
712 pub method: Option<String>,
713 /// Optional. How IAP determines the effective policy in cases of hierarchical policies. Policies are merged from higher in the hierarchy to lower in the hierarchy.
714 #[serde(rename = "policyType")]
715 pub policy_type: Option<String>,
716}
717
718impl common::Part for ReauthSettings {}
719
720/// The request sent to ResetIdentityAwareProxyClientSecret.
721///
722/// # Activities
723///
724/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
725/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
726///
727/// * [brands identity aware proxy clients reset secret projects](ProjectBrandIdentityAwareProxyClientResetSecretCall) (request)
728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
729#[serde_with::serde_as]
730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
731pub struct ResetIdentityAwareProxyClientSecretRequest {
732 _never_set: Option<bool>,
733}
734
735impl common::RequestValue for ResetIdentityAwareProxyClientSecretRequest {}
736
737/// There is no detailed description.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct Resource {
745 /// The proto or JSON formatted expected next state of the resource, wrapped in a google.protobuf.Any proto, against which the policy rules are evaluated. Services not integrated with custom org policy can omit this field. Services integrated with custom org policy must populate this field for all requests where the API call changes the state of the resource. Custom org policy backend uses these attributes to enforce custom org policies. For create operations, GCP service is expected to pass resource from customer request as is. For update/patch operations, GCP service is expected to compute the next state with the patch provided by the user. See go/federated-custom-org-policy-integration-guide for additional details.
746 #[serde(rename = "expectedNextState")]
747 pub expected_next_state: Option<HashMap<String, serde_json::Value>>,
748 /// The service defined labels of the resource on which the conditions will be evaluated. The semantics - including the key names - are vague to IAM. If the effective condition has a reference to a `resource.labels[foo]` construct, IAM consults with this map to retrieve the values associated with `foo` key for Conditions evaluation. If the provided key is not found in the labels map, the condition would evaluate to false. This field is in limited use. If your intended use case is not expected to express resource.labels attribute in IAM Conditions, leave this field empty. Before planning on using this attribute please: * Read go/iam-conditions-labels-comm and ensure your service can meet the data availability and management requirements. * Talk to iam-conditions-eng@ about your use case.
749 pub labels: Option<HashMap<String, String>>,
750 /// The locations of the resource. This field is used to determine whether the request is compliant with Trust Boundaries. Usage: - Must not be empty for services in-scope for Trust Boundaries. Once Trust Boundaries is GA, empty values will cause the request to be rejected if customers enforce Trust Boundaries on the parent CRM nodes. - For global resources: use a single value of "global". - For regional/multi-regional resources: use name of the GCP region(s) where the resource exists (e.g., ["us-east1", "us-west1"]). For multi-regional resources specify the name of each GCP region in the resource's multi-region. NOTE: Only GCP cloud region names are supported - go/cloud-region-names.
751 pub locations: Option<Vec<String>>,
752 /// The **relative** name of the resource, which is the URI path of the resource without the leading "/". See https://cloud.google.com/iam/docs/conditions-resource-attributes#resource-name for examples used by other GCP Services. This field is **required** for services integrated with resource-attribute-based IAM conditions and/or CustomOrgPolicy. This field requires special handling for parents-only permissions such as `create` and `list`. See the document linked below for further details. See go/iam-conditions-sig-g3#populate-resource-attributes for specific details on populating this field.
753 pub name: Option<String>,
754 /// Used for calculating the next state of tags on the resource being passed for Custom Org Policy enforcement. NOTE: Only one of the tags representations (i.e. numeric or namespaced) should be populated. The input tags will be converted to the same representation before the calculation. This behavior intentionally may differ from other tags related fields in CheckPolicy request, which may require both formats to be passed in. IMPORTANT: If tags are unchanged, this field should not be set.
755 #[serde(rename = "nextStateOfTags")]
756 pub next_state_of_tags: Option<NextStateOfTags>,
757 /// The name of the service this resource belongs to. It is configured using the official_service_name of the Service as defined in service configurations under //configs/cloud/resourcetypes. For example, the official_service_name of cloud resource manager service is set as 'cloudresourcemanager.googleapis.com' according to //configs/cloud/resourcetypes/google/cloud/resourcemanager/prod.yaml This field is **required** for services integrated with resource-attribute-based IAM conditions and/or CustomOrgPolicy. This field requires special handling for parents-only permissions such as `create` and `list`. See the document linked below for further details. See go/iam-conditions-sig-g3#populate-resource-attributes for specific details on populating this field.
758 pub service: Option<String>,
759 /// The public resource type name of the resource. It is configured using the official_name of the ResourceType as defined in service configurations under //configs/cloud/resourcetypes. For example, the official_name for GCP projects is set as 'cloudresourcemanager.googleapis.com/Project' according to //configs/cloud/resourcetypes/google/cloud/resourcemanager/prod.yaml This field is **required** for services integrated with resource-attribute-based IAM conditions and/or CustomOrgPolicy. This field requires special handling for parents-only permissions such as `create` and `list`. See the document linked below for further details. See go/iam-conditions-sig-g3#populate-resource-attributes for specific details on populating this field.
760 #[serde(rename = "type")]
761 pub type_: Option<String>,
762}
763
764impl common::Part for Resource {}
765
766/// Request message for `SetIamPolicy` method.
767///
768/// # Activities
769///
770/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
771/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
772///
773/// * [set iam policy](MethodSetIamPolicyCall) (request)
774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
775#[serde_with::serde_as]
776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
777pub struct SetIamPolicyRequest {
778 /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
779 pub policy: Option<Policy>,
780}
781
782impl common::RequestValue for SetIamPolicyRequest {}
783
784/// There is no detailed description.
785///
786/// This type is not used in any activity, and only used as *part* of another schema.
787///
788#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
789#[serde_with::serde_as]
790#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
791pub struct TagsFullState {
792 /// If TagsFullState is initialized, the values in this field fully represent all the tags in the next state (the current tag values are not used). If tags.size() == 0, the next state of tags would be no tags for evaluation purposes. Only one type of tags reference (numeric or namespace) is required to be passed.
793 pub tags: Option<HashMap<String, String>>,
794}
795
796impl common::Part for TagsFullState {}
797
798/// There is no detailed description.
799///
800/// This type is not used in any activity, and only used as *part* of another schema.
801///
802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
803#[serde_with::serde_as]
804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
805pub struct TagsFullStateForChildResource {
806 /// If TagsFullStateForChildResource is initialized, the values in this field represent all the tags in the next state for the child resource. Only one type of tags reference (numeric or namespace) is required to be passed. IMPORTANT: This field should only be used when the target resource IAM policy name is UNKNOWN and the resource's parent IAM policy name is being passed in the request.
807 pub tags: Option<HashMap<String, String>>,
808}
809
810impl common::Part for TagsFullStateForChildResource {}
811
812/// There is no detailed description.
813///
814/// This type is not used in any activity, and only used as *part* of another schema.
815///
816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
817#[serde_with::serde_as]
818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
819pub struct TagsPartialState {
820 /// Keys of the tags that should be removed for evaluation purposes. IMPORTANT: Currently only numeric references are supported. Once support for namespace references is added, both the tag references (numeric and namespace) will be removed.
821 #[serde(rename = "tagKeysToRemove")]
822 pub tag_keys_to_remove: Option<Vec<String>>,
823 /// Tags that’ll be updated or added to the current state of tags for evaluation purposes. If a key exists in both "tags_to_upsert" and "tag_keys_to_remove", the one in "tag_keys_to_remove" is ignored. Only one type of tags reference (numeric or namespace) is required to be passed.
824 #[serde(rename = "tagsToUpsert")]
825 pub tags_to_upsert: Option<HashMap<String, String>>,
826}
827
828impl common::Part for TagsPartialState {}
829
830/// Request message for `TestIamPermissions` method.
831///
832/// # Activities
833///
834/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
835/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
836///
837/// * [test iam permissions](MethodTestIamPermissionCall) (request)
838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
839#[serde_with::serde_as]
840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
841pub struct TestIamPermissionsRequest {
842 /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
843 pub permissions: Option<Vec<String>>,
844}
845
846impl common::RequestValue for TestIamPermissionsRequest {}
847
848/// Response message for `TestIamPermissions` method.
849///
850/// # Activities
851///
852/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
853/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
854///
855/// * [test iam permissions](MethodTestIamPermissionCall) (response)
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct TestIamPermissionsResponse {
860 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
861 pub permissions: Option<Vec<String>>,
862}
863
864impl common::ResponseResult for TestIamPermissionsResponse {}
865
866/// A TunnelDestGroup.
867///
868/// # Activities
869///
870/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
871/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
872///
873/// * [iap_tunnel locations dest groups create projects](ProjectIapTunnelLocationDestGroupCreateCall) (request|response)
874/// * [iap_tunnel locations dest groups get projects](ProjectIapTunnelLocationDestGroupGetCall) (response)
875/// * [iap_tunnel locations dest groups patch projects](ProjectIapTunnelLocationDestGroupPatchCall) (request|response)
876#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
877#[serde_with::serde_as]
878#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
879pub struct TunnelDestGroup {
880 /// Optional. Unordered list. List of CIDRs that this group applies to.
881 pub cidrs: Option<Vec<String>>,
882 /// Optional. Unordered list. List of FQDNs that this group applies to.
883 pub fqdns: Option<Vec<String>>,
884 /// Identifier. Identifier for the TunnelDestGroup. Must be unique within the project and contain only lower case letters (a-z) and dashes (-).
885 pub name: Option<String>,
886}
887
888impl common::RequestValue for TunnelDestGroup {}
889impl common::ResponseResult for TunnelDestGroup {}
890
891/// IAP Expression Linter endpoint returns empty response body.
892///
893/// # Activities
894///
895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
897///
898/// * [validate attribute expression](MethodValidateAttributeExpressionCall) (response)
899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
900#[serde_with::serde_as]
901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct ValidateIapAttributeExpressionResponse {
903 _never_set: Option<bool>,
904}
905
906impl common::ResponseResult for ValidateIapAttributeExpressionResponse {}
907
908/// WorkforceIdentitySettings allows customers to configure workforce pools and OAuth 2.0 settings to gate their applications using a third-party IdP with access control.
909///
910/// This type is not used in any activity, and only used as *part* of another schema.
911///
912#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
913#[serde_with::serde_as]
914#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
915pub struct WorkforceIdentitySettings {
916 /// OAuth 2.0 settings for IAP to perform OIDC flow with workforce identity federation services.
917 pub oauth2: Option<OAuth2>,
918 /// The workforce pool resources. Only one workforce pool is accepted.
919 #[serde(rename = "workforcePools")]
920 pub workforce_pools: Option<Vec<String>>,
921}
922
923impl common::Part for WorkforceIdentitySettings {}
924
925// ###################
926// MethodBuilders ###
927// #################
928
929/// A builder providing access to all methods supported on *project* resources.
930/// It is not used directly, but through the [`CloudIAP`] hub.
931///
932/// # Example
933///
934/// Instantiate a resource builder
935///
936/// ```test_harness,no_run
937/// extern crate hyper;
938/// extern crate hyper_rustls;
939/// extern crate google_iap1 as iap1;
940///
941/// # async fn dox() {
942/// use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
943///
944/// let secret: yup_oauth2::ApplicationSecret = Default::default();
945/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
946/// .with_native_roots()
947/// .unwrap()
948/// .https_only()
949/// .enable_http2()
950/// .build();
951///
952/// let executor = hyper_util::rt::TokioExecutor::new();
953/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
954/// secret,
955/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
956/// yup_oauth2::client::CustomHyperClientBuilder::from(
957/// hyper_util::client::legacy::Client::builder(executor).build(connector),
958/// ),
959/// ).build().await.unwrap();
960///
961/// let client = hyper_util::client::legacy::Client::builder(
962/// hyper_util::rt::TokioExecutor::new()
963/// )
964/// .build(
965/// hyper_rustls::HttpsConnectorBuilder::new()
966/// .with_native_roots()
967/// .unwrap()
968/// .https_or_http()
969/// .enable_http2()
970/// .build()
971/// );
972/// let mut hub = CloudIAP::new(client, auth);
973/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
974/// // like `brands_create(...)`, `brands_get(...)`, `brands_identity_aware_proxy_clients_create(...)`, `brands_identity_aware_proxy_clients_delete(...)`, `brands_identity_aware_proxy_clients_get(...)`, `brands_identity_aware_proxy_clients_list(...)`, `brands_identity_aware_proxy_clients_reset_secret(...)`, `brands_list(...)`, `iap_tunnel_locations_dest_groups_create(...)`, `iap_tunnel_locations_dest_groups_delete(...)`, `iap_tunnel_locations_dest_groups_get(...)`, `iap_tunnel_locations_dest_groups_list(...)` and `iap_tunnel_locations_dest_groups_patch(...)`
975/// // to build up your call.
976/// let rb = hub.projects();
977/// # }
978/// ```
979pub struct ProjectMethods<'a, C>
980where
981 C: 'a,
982{
983 hub: &'a CloudIAP<C>,
984}
985
986impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
987
988impl<'a, C> ProjectMethods<'a, C> {
989 /// Create a builder to help you perform the following task:
990 ///
991 /// Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.
992 ///
993 /// # Arguments
994 ///
995 /// * `request` - No description provided.
996 /// * `parent` - Required. Path to create the client in. In the following format: projects/{project_number/id}/brands/{brand}. The project must belong to a G Suite account.
997 pub fn brands_identity_aware_proxy_clients_create(
998 &self,
999 request: IdentityAwareProxyClient,
1000 parent: &str,
1001 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {
1002 ProjectBrandIdentityAwareProxyClientCreateCall {
1003 hub: self.hub,
1004 _request: request,
1005 _parent: parent.to_string(),
1006 _delegate: Default::default(),
1007 _additional_params: Default::default(),
1008 _scopes: Default::default(),
1009 }
1010 }
1011
1012 /// Create a builder to help you perform the following task:
1013 ///
1014 /// Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.
1015 ///
1016 /// # Arguments
1017 ///
1018 /// * `name` - Required. Name of the Identity Aware Proxy client to be deleted. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
1019 pub fn brands_identity_aware_proxy_clients_delete(
1020 &self,
1021 name: &str,
1022 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C> {
1023 ProjectBrandIdentityAwareProxyClientDeleteCall {
1024 hub: self.hub,
1025 _name: name.to_string(),
1026 _delegate: Default::default(),
1027 _additional_params: Default::default(),
1028 _scopes: Default::default(),
1029 }
1030 }
1031
1032 /// Create a builder to help you perform the following task:
1033 ///
1034 /// Retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.
1035 ///
1036 /// # Arguments
1037 ///
1038 /// * `name` - Required. Name of the Identity Aware Proxy client to be fetched. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
1039 pub fn brands_identity_aware_proxy_clients_get(
1040 &self,
1041 name: &str,
1042 ) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C> {
1043 ProjectBrandIdentityAwareProxyClientGetCall {
1044 hub: self.hub,
1045 _name: name.to_string(),
1046 _delegate: Default::default(),
1047 _additional_params: Default::default(),
1048 _scopes: Default::default(),
1049 }
1050 }
1051
1052 /// Create a builder to help you perform the following task:
1053 ///
1054 /// Lists the existing clients for the brand.
1055 ///
1056 /// # Arguments
1057 ///
1058 /// * `parent` - Required. Full brand path. In the following format: projects/{project_number/id}/brands/{brand}.
1059 pub fn brands_identity_aware_proxy_clients_list(
1060 &self,
1061 parent: &str,
1062 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
1063 ProjectBrandIdentityAwareProxyClientListCall {
1064 hub: self.hub,
1065 _parent: parent.to_string(),
1066 _page_token: Default::default(),
1067 _page_size: Default::default(),
1068 _delegate: Default::default(),
1069 _additional_params: Default::default(),
1070 _scopes: Default::default(),
1071 }
1072 }
1073
1074 /// Create a builder to help you perform the following task:
1075 ///
1076 /// Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.
1077 ///
1078 /// # Arguments
1079 ///
1080 /// * `request` - No description provided.
1081 /// * `name` - Required. Name of the Identity Aware Proxy client to that will have its secret reset. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
1082 pub fn brands_identity_aware_proxy_clients_reset_secret(
1083 &self,
1084 request: ResetIdentityAwareProxyClientSecretRequest,
1085 name: &str,
1086 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {
1087 ProjectBrandIdentityAwareProxyClientResetSecretCall {
1088 hub: self.hub,
1089 _request: request,
1090 _name: name.to_string(),
1091 _delegate: Default::default(),
1092 _additional_params: Default::default(),
1093 _scopes: Default::default(),
1094 }
1095 }
1096
1097 /// Create a builder to help you perform the following task:
1098 ///
1099 /// Constructs a new OAuth brand for the project if one does not exist. The created brand is "internal only", meaning that OAuth clients created under it only accept requests from users who belong to the same Google Workspace organization as the project. The brand is created in an un-reviewed status. NOTE: The "internal only" status can be manually changed in the Google Cloud Console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.
1100 ///
1101 /// # Arguments
1102 ///
1103 /// * `request` - No description provided.
1104 /// * `parent` - Required. GCP Project number/id under which the brand is to be created. In the following format: projects/{project_number/id}.
1105 pub fn brands_create(&self, request: Brand, parent: &str) -> ProjectBrandCreateCall<'a, C> {
1106 ProjectBrandCreateCall {
1107 hub: self.hub,
1108 _request: request,
1109 _parent: parent.to_string(),
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 the OAuth brand of the project.
1119 ///
1120 /// # Arguments
1121 ///
1122 /// * `name` - Required. Name of the brand to be fetched. In the following format: projects/{project_number/id}/brands/{brand}.
1123 pub fn brands_get(&self, name: &str) -> ProjectBrandGetCall<'a, C> {
1124 ProjectBrandGetCall {
1125 hub: self.hub,
1126 _name: name.to_string(),
1127 _delegate: Default::default(),
1128 _additional_params: Default::default(),
1129 _scopes: Default::default(),
1130 }
1131 }
1132
1133 /// Create a builder to help you perform the following task:
1134 ///
1135 /// Lists the existing brands for the project.
1136 ///
1137 /// # Arguments
1138 ///
1139 /// * `parent` - Required. GCP Project number/id. In the following format: projects/{project_number/id}.
1140 pub fn brands_list(&self, parent: &str) -> ProjectBrandListCall<'a, C> {
1141 ProjectBrandListCall {
1142 hub: self.hub,
1143 _parent: parent.to_string(),
1144 _delegate: Default::default(),
1145 _additional_params: Default::default(),
1146 _scopes: Default::default(),
1147 }
1148 }
1149
1150 /// Create a builder to help you perform the following task:
1151 ///
1152 /// Creates a new TunnelDestGroup.
1153 ///
1154 /// # Arguments
1155 ///
1156 /// * `request` - No description provided.
1157 /// * `parent` - Required. Google Cloud Project ID and location. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}`.
1158 pub fn iap_tunnel_locations_dest_groups_create(
1159 &self,
1160 request: TunnelDestGroup,
1161 parent: &str,
1162 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
1163 ProjectIapTunnelLocationDestGroupCreateCall {
1164 hub: self.hub,
1165 _request: request,
1166 _parent: parent.to_string(),
1167 _tunnel_dest_group_id: Default::default(),
1168 _delegate: Default::default(),
1169 _additional_params: Default::default(),
1170 _scopes: Default::default(),
1171 }
1172 }
1173
1174 /// Create a builder to help you perform the following task:
1175 ///
1176 /// Deletes a TunnelDestGroup.
1177 ///
1178 /// # Arguments
1179 ///
1180 /// * `name` - Required. Name of the TunnelDestGroup to delete. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`.
1181 pub fn iap_tunnel_locations_dest_groups_delete(
1182 &self,
1183 name: &str,
1184 ) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C> {
1185 ProjectIapTunnelLocationDestGroupDeleteCall {
1186 hub: self.hub,
1187 _name: name.to_string(),
1188 _delegate: Default::default(),
1189 _additional_params: Default::default(),
1190 _scopes: Default::default(),
1191 }
1192 }
1193
1194 /// Create a builder to help you perform the following task:
1195 ///
1196 /// Retrieves an existing TunnelDestGroup.
1197 ///
1198 /// # Arguments
1199 ///
1200 /// * `name` - Required. Name of the TunnelDestGroup to be fetched. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`.
1201 pub fn iap_tunnel_locations_dest_groups_get(
1202 &self,
1203 name: &str,
1204 ) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C> {
1205 ProjectIapTunnelLocationDestGroupGetCall {
1206 hub: self.hub,
1207 _name: name.to_string(),
1208 _delegate: Default::default(),
1209 _additional_params: Default::default(),
1210 _scopes: Default::default(),
1211 }
1212 }
1213
1214 /// Create a builder to help you perform the following task:
1215 ///
1216 /// Lists the existing TunnelDestGroups. To group across all locations, use a `-` as the location ID. For example: `/v1/projects/123/iap_tunnel/locations/-/destGroups`
1217 ///
1218 /// # Arguments
1219 ///
1220 /// * `parent` - Required. Google Cloud Project ID and location. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}`. A `-` can be used for the location to group across all locations.
1221 pub fn iap_tunnel_locations_dest_groups_list(
1222 &self,
1223 parent: &str,
1224 ) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
1225 ProjectIapTunnelLocationDestGroupListCall {
1226 hub: self.hub,
1227 _parent: parent.to_string(),
1228 _page_token: Default::default(),
1229 _page_size: Default::default(),
1230 _delegate: Default::default(),
1231 _additional_params: Default::default(),
1232 _scopes: Default::default(),
1233 }
1234 }
1235
1236 /// Create a builder to help you perform the following task:
1237 ///
1238 /// Updates a TunnelDestGroup.
1239 ///
1240 /// # Arguments
1241 ///
1242 /// * `request` - No description provided.
1243 /// * `name` - Identifier. Identifier for the TunnelDestGroup. Must be unique within the project and contain only lower case letters (a-z) and dashes (-).
1244 pub fn iap_tunnel_locations_dest_groups_patch(
1245 &self,
1246 request: TunnelDestGroup,
1247 name: &str,
1248 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
1249 ProjectIapTunnelLocationDestGroupPatchCall {
1250 hub: self.hub,
1251 _request: request,
1252 _name: name.to_string(),
1253 _update_mask: Default::default(),
1254 _delegate: Default::default(),
1255 _additional_params: Default::default(),
1256 _scopes: Default::default(),
1257 }
1258 }
1259}
1260
1261/// A builder providing access to all free methods, which are not associated with a particular resource.
1262/// It is not used directly, but through the [`CloudIAP`] hub.
1263///
1264/// # Example
1265///
1266/// Instantiate a resource builder
1267///
1268/// ```test_harness,no_run
1269/// extern crate hyper;
1270/// extern crate hyper_rustls;
1271/// extern crate google_iap1 as iap1;
1272///
1273/// # async fn dox() {
1274/// use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1275///
1276/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1277/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1278/// .with_native_roots()
1279/// .unwrap()
1280/// .https_only()
1281/// .enable_http2()
1282/// .build();
1283///
1284/// let executor = hyper_util::rt::TokioExecutor::new();
1285/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1286/// secret,
1287/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1288/// yup_oauth2::client::CustomHyperClientBuilder::from(
1289/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1290/// ),
1291/// ).build().await.unwrap();
1292///
1293/// let client = hyper_util::client::legacy::Client::builder(
1294/// hyper_util::rt::TokioExecutor::new()
1295/// )
1296/// .build(
1297/// hyper_rustls::HttpsConnectorBuilder::new()
1298/// .with_native_roots()
1299/// .unwrap()
1300/// .https_or_http()
1301/// .enable_http2()
1302/// .build()
1303/// );
1304/// let mut hub = CloudIAP::new(client, auth);
1305/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1306/// // like `get_iam_policy(...)`, `get_iap_settings(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)`, `update_iap_settings(...)` and `validate_attribute_expression(...)`
1307/// // to build up your call.
1308/// let rb = hub.methods();
1309/// # }
1310/// ```
1311pub struct MethodMethods<'a, C>
1312where
1313 C: 'a,
1314{
1315 hub: &'a CloudIAP<C>,
1316}
1317
1318impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
1319
1320impl<'a, C> MethodMethods<'a, C> {
1321 /// Create a builder to help you perform the following task:
1322 ///
1323 /// Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
1324 ///
1325 /// # Arguments
1326 ///
1327 /// * `request` - No description provided.
1328 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1329 pub fn get_iam_policy(
1330 &self,
1331 request: GetIamPolicyRequest,
1332 resource: &str,
1333 ) -> MethodGetIamPolicyCall<'a, C> {
1334 MethodGetIamPolicyCall {
1335 hub: self.hub,
1336 _request: request,
1337 _resource: resource.to_string(),
1338 _delegate: Default::default(),
1339 _additional_params: Default::default(),
1340 _scopes: Default::default(),
1341 }
1342 }
1343
1344 /// Create a builder to help you perform the following task:
1345 ///
1346 /// Gets the IAP settings on a particular IAP protected resource.
1347 ///
1348 /// # Arguments
1349 ///
1350 /// * `name` - Required. The resource name for which to retrieve the settings. Authorization: Requires the `getSettings` permission for the associated resource.
1351 pub fn get_iap_settings(&self, name: &str) -> MethodGetIapSettingCall<'a, C> {
1352 MethodGetIapSettingCall {
1353 hub: self.hub,
1354 _name: name.to_string(),
1355 _delegate: Default::default(),
1356 _additional_params: Default::default(),
1357 _scopes: Default::default(),
1358 }
1359 }
1360
1361 /// Create a builder to help you perform the following task:
1362 ///
1363 /// Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
1364 ///
1365 /// # Arguments
1366 ///
1367 /// * `request` - No description provided.
1368 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1369 pub fn set_iam_policy(
1370 &self,
1371 request: SetIamPolicyRequest,
1372 resource: &str,
1373 ) -> MethodSetIamPolicyCall<'a, C> {
1374 MethodSetIamPolicyCall {
1375 hub: self.hub,
1376 _request: request,
1377 _resource: resource.to_string(),
1378 _delegate: Default::default(),
1379 _additional_params: Default::default(),
1380 _scopes: Default::default(),
1381 }
1382 }
1383
1384 /// Create a builder to help you perform the following task:
1385 ///
1386 /// Returns permissions that a caller has on the Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
1387 ///
1388 /// # Arguments
1389 ///
1390 /// * `request` - No description provided.
1391 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
1392 pub fn test_iam_permissions(
1393 &self,
1394 request: TestIamPermissionsRequest,
1395 resource: &str,
1396 ) -> MethodTestIamPermissionCall<'a, C> {
1397 MethodTestIamPermissionCall {
1398 hub: self.hub,
1399 _request: request,
1400 _resource: resource.to_string(),
1401 _delegate: Default::default(),
1402 _additional_params: Default::default(),
1403 _scopes: Default::default(),
1404 }
1405 }
1406
1407 /// Create a builder to help you perform the following task:
1408 ///
1409 /// Updates the IAP settings on a particular IAP protected resource. It replaces all fields unless the `update_mask` is set.
1410 ///
1411 /// # Arguments
1412 ///
1413 /// * `request` - No description provided.
1414 /// * `name` - Required. The resource name of the IAP protected resource.
1415 pub fn update_iap_settings(
1416 &self,
1417 request: IapSettings,
1418 name: &str,
1419 ) -> MethodUpdateIapSettingCall<'a, C> {
1420 MethodUpdateIapSettingCall {
1421 hub: self.hub,
1422 _request: request,
1423 _name: name.to_string(),
1424 _update_mask: Default::default(),
1425 _delegate: Default::default(),
1426 _additional_params: Default::default(),
1427 _scopes: Default::default(),
1428 }
1429 }
1430
1431 /// Create a builder to help you perform the following task:
1432 ///
1433 /// Validates that a given CEL expression conforms to IAP restrictions.
1434 ///
1435 /// # Arguments
1436 ///
1437 /// * `name` - Required. The resource name of the IAP protected resource.
1438 pub fn validate_attribute_expression(
1439 &self,
1440 name: &str,
1441 ) -> MethodValidateAttributeExpressionCall<'a, C> {
1442 MethodValidateAttributeExpressionCall {
1443 hub: self.hub,
1444 _name: name.to_string(),
1445 _expression: Default::default(),
1446 _delegate: Default::default(),
1447 _additional_params: Default::default(),
1448 _scopes: Default::default(),
1449 }
1450 }
1451}
1452
1453// ###################
1454// CallBuilders ###
1455// #################
1456
1457/// Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.
1458///
1459/// A builder for the *brands.identityAwareProxyClients.create* method supported by a *project* resource.
1460/// It is not used directly, but through a [`ProjectMethods`] instance.
1461///
1462/// # Example
1463///
1464/// Instantiate a resource method builder
1465///
1466/// ```test_harness,no_run
1467/// # extern crate hyper;
1468/// # extern crate hyper_rustls;
1469/// # extern crate google_iap1 as iap1;
1470/// use iap1::api::IdentityAwareProxyClient;
1471/// # async fn dox() {
1472/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1473///
1474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1475/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1476/// # .with_native_roots()
1477/// # .unwrap()
1478/// # .https_only()
1479/// # .enable_http2()
1480/// # .build();
1481///
1482/// # let executor = hyper_util::rt::TokioExecutor::new();
1483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1484/// # secret,
1485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1486/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1487/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1488/// # ),
1489/// # ).build().await.unwrap();
1490///
1491/// # let client = hyper_util::client::legacy::Client::builder(
1492/// # hyper_util::rt::TokioExecutor::new()
1493/// # )
1494/// # .build(
1495/// # hyper_rustls::HttpsConnectorBuilder::new()
1496/// # .with_native_roots()
1497/// # .unwrap()
1498/// # .https_or_http()
1499/// # .enable_http2()
1500/// # .build()
1501/// # );
1502/// # let mut hub = CloudIAP::new(client, auth);
1503/// // As the method needs a request, you would usually fill it with the desired information
1504/// // into the respective structure. Some of the parts shown here might not be applicable !
1505/// // Values shown here are possibly random and not representative !
1506/// let mut req = IdentityAwareProxyClient::default();
1507///
1508/// // You can configure optional parameters by calling the respective setters at will, and
1509/// // execute the final call using `doit()`.
1510/// // Values shown here are possibly random and not representative !
1511/// let result = hub.projects().brands_identity_aware_proxy_clients_create(req, "parent")
1512/// .doit().await;
1513/// # }
1514/// ```
1515pub struct ProjectBrandIdentityAwareProxyClientCreateCall<'a, C>
1516where
1517 C: 'a,
1518{
1519 hub: &'a CloudIAP<C>,
1520 _request: IdentityAwareProxyClient,
1521 _parent: String,
1522 _delegate: Option<&'a mut dyn common::Delegate>,
1523 _additional_params: HashMap<String, String>,
1524 _scopes: BTreeSet<String>,
1525}
1526
1527impl<'a, C> common::CallBuilder for ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {}
1528
1529impl<'a, C> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C>
1530where
1531 C: common::Connector,
1532{
1533 /// Perform the operation you have build so far.
1534 pub async fn doit(mut self) -> common::Result<(common::Response, IdentityAwareProxyClient)> {
1535 use std::borrow::Cow;
1536 use std::io::{Read, Seek};
1537
1538 use common::{url::Params, ToParts};
1539 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1540
1541 let mut dd = common::DefaultDelegate;
1542 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1543 dlg.begin(common::MethodInfo {
1544 id: "iap.projects.brands.identityAwareProxyClients.create",
1545 http_method: hyper::Method::POST,
1546 });
1547
1548 for &field in ["alt", "parent"].iter() {
1549 if self._additional_params.contains_key(field) {
1550 dlg.finished(false);
1551 return Err(common::Error::FieldClash(field));
1552 }
1553 }
1554
1555 let mut params = Params::with_capacity(4 + self._additional_params.len());
1556 params.push("parent", self._parent);
1557
1558 params.extend(self._additional_params.iter());
1559
1560 params.push("alt", "json");
1561 let mut url = self.hub._base_url.clone() + "v1/{+parent}/identityAwareProxyClients";
1562 if self._scopes.is_empty() {
1563 self._scopes
1564 .insert(Scope::CloudPlatform.as_ref().to_string());
1565 }
1566
1567 #[allow(clippy::single_element_loop)]
1568 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1569 url = params.uri_replacement(url, param_name, find_this, true);
1570 }
1571 {
1572 let to_remove = ["parent"];
1573 params.remove_params(&to_remove);
1574 }
1575
1576 let url = params.parse_with_url(&url);
1577
1578 let mut json_mime_type = mime::APPLICATION_JSON;
1579 let mut request_value_reader = {
1580 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1581 common::remove_json_null_values(&mut value);
1582 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1583 serde_json::to_writer(&mut dst, &value).unwrap();
1584 dst
1585 };
1586 let request_size = request_value_reader
1587 .seek(std::io::SeekFrom::End(0))
1588 .unwrap();
1589 request_value_reader
1590 .seek(std::io::SeekFrom::Start(0))
1591 .unwrap();
1592
1593 loop {
1594 let token = match self
1595 .hub
1596 .auth
1597 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1598 .await
1599 {
1600 Ok(token) => token,
1601 Err(e) => match dlg.token(e) {
1602 Ok(token) => token,
1603 Err(e) => {
1604 dlg.finished(false);
1605 return Err(common::Error::MissingToken(e));
1606 }
1607 },
1608 };
1609 request_value_reader
1610 .seek(std::io::SeekFrom::Start(0))
1611 .unwrap();
1612 let mut req_result = {
1613 let client = &self.hub.client;
1614 dlg.pre_request();
1615 let mut req_builder = hyper::Request::builder()
1616 .method(hyper::Method::POST)
1617 .uri(url.as_str())
1618 .header(USER_AGENT, self.hub._user_agent.clone());
1619
1620 if let Some(token) = token.as_ref() {
1621 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1622 }
1623
1624 let request = req_builder
1625 .header(CONTENT_TYPE, json_mime_type.to_string())
1626 .header(CONTENT_LENGTH, request_size as u64)
1627 .body(common::to_body(
1628 request_value_reader.get_ref().clone().into(),
1629 ));
1630
1631 client.request(request.unwrap()).await
1632 };
1633
1634 match req_result {
1635 Err(err) => {
1636 if let common::Retry::After(d) = dlg.http_error(&err) {
1637 sleep(d).await;
1638 continue;
1639 }
1640 dlg.finished(false);
1641 return Err(common::Error::HttpError(err));
1642 }
1643 Ok(res) => {
1644 let (mut parts, body) = res.into_parts();
1645 let mut body = common::Body::new(body);
1646 if !parts.status.is_success() {
1647 let bytes = common::to_bytes(body).await.unwrap_or_default();
1648 let error = serde_json::from_str(&common::to_string(&bytes));
1649 let response = common::to_response(parts, bytes.into());
1650
1651 if let common::Retry::After(d) =
1652 dlg.http_failure(&response, error.as_ref().ok())
1653 {
1654 sleep(d).await;
1655 continue;
1656 }
1657
1658 dlg.finished(false);
1659
1660 return Err(match error {
1661 Ok(value) => common::Error::BadRequest(value),
1662 _ => common::Error::Failure(response),
1663 });
1664 }
1665 let response = {
1666 let bytes = common::to_bytes(body).await.unwrap_or_default();
1667 let encoded = common::to_string(&bytes);
1668 match serde_json::from_str(&encoded) {
1669 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1670 Err(error) => {
1671 dlg.response_json_decode_error(&encoded, &error);
1672 return Err(common::Error::JsonDecodeError(
1673 encoded.to_string(),
1674 error,
1675 ));
1676 }
1677 }
1678 };
1679
1680 dlg.finished(true);
1681 return Ok(response);
1682 }
1683 }
1684 }
1685 }
1686
1687 ///
1688 /// Sets the *request* property to the given value.
1689 ///
1690 /// Even though the property as already been set when instantiating this call,
1691 /// we provide this method for API completeness.
1692 pub fn request(
1693 mut self,
1694 new_value: IdentityAwareProxyClient,
1695 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {
1696 self._request = new_value;
1697 self
1698 }
1699 /// Required. Path to create the client in. In the following format: projects/{project_number/id}/brands/{brand}. The project must belong to a G Suite account.
1700 ///
1701 /// Sets the *parent* path property to the given value.
1702 ///
1703 /// Even though the property as already been set when instantiating this call,
1704 /// we provide this method for API completeness.
1705 pub fn parent(
1706 mut self,
1707 new_value: &str,
1708 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {
1709 self._parent = new_value.to_string();
1710 self
1711 }
1712 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1713 /// while executing the actual API request.
1714 ///
1715 /// ````text
1716 /// It should be used to handle progress information, and to implement a certain level of resilience.
1717 /// ````
1718 ///
1719 /// Sets the *delegate* property to the given value.
1720 pub fn delegate(
1721 mut self,
1722 new_value: &'a mut dyn common::Delegate,
1723 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {
1724 self._delegate = Some(new_value);
1725 self
1726 }
1727
1728 /// Set any additional parameter of the query string used in the request.
1729 /// It should be used to set parameters which are not yet available through their own
1730 /// setters.
1731 ///
1732 /// Please note that this method must not be used to set any of the known parameters
1733 /// which have their own setter method. If done anyway, the request will fail.
1734 ///
1735 /// # Additional Parameters
1736 ///
1737 /// * *$.xgafv* (query-string) - V1 error format.
1738 /// * *access_token* (query-string) - OAuth access token.
1739 /// * *alt* (query-string) - Data format for response.
1740 /// * *callback* (query-string) - JSONP
1741 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1742 /// * *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.
1743 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1744 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1745 /// * *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.
1746 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1747 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1748 pub fn param<T>(
1749 mut self,
1750 name: T,
1751 value: T,
1752 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C>
1753 where
1754 T: AsRef<str>,
1755 {
1756 self._additional_params
1757 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1758 self
1759 }
1760
1761 /// Identifies the authorization scope for the method you are building.
1762 ///
1763 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1764 /// [`Scope::CloudPlatform`].
1765 ///
1766 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1767 /// tokens for more than one scope.
1768 ///
1769 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1770 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1771 /// sufficient, a read-write scope will do as well.
1772 pub fn add_scope<St>(
1773 mut self,
1774 scope: St,
1775 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C>
1776 where
1777 St: AsRef<str>,
1778 {
1779 self._scopes.insert(String::from(scope.as_ref()));
1780 self
1781 }
1782 /// Identifies the authorization scope(s) for the method you are building.
1783 ///
1784 /// See [`Self::add_scope()`] for details.
1785 pub fn add_scopes<I, St>(
1786 mut self,
1787 scopes: I,
1788 ) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C>
1789 where
1790 I: IntoIterator<Item = St>,
1791 St: AsRef<str>,
1792 {
1793 self._scopes
1794 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1795 self
1796 }
1797
1798 /// Removes all scopes, and no default scope will be used either.
1799 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1800 /// for details).
1801 pub fn clear_scopes(mut self) -> ProjectBrandIdentityAwareProxyClientCreateCall<'a, C> {
1802 self._scopes.clear();
1803 self
1804 }
1805}
1806
1807/// Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.
1808///
1809/// A builder for the *brands.identityAwareProxyClients.delete* method supported by a *project* resource.
1810/// It is not used directly, but through a [`ProjectMethods`] instance.
1811///
1812/// # Example
1813///
1814/// Instantiate a resource method builder
1815///
1816/// ```test_harness,no_run
1817/// # extern crate hyper;
1818/// # extern crate hyper_rustls;
1819/// # extern crate google_iap1 as iap1;
1820/// # async fn dox() {
1821/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1822///
1823/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1824/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1825/// # .with_native_roots()
1826/// # .unwrap()
1827/// # .https_only()
1828/// # .enable_http2()
1829/// # .build();
1830///
1831/// # let executor = hyper_util::rt::TokioExecutor::new();
1832/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1833/// # secret,
1834/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1835/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1836/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1837/// # ),
1838/// # ).build().await.unwrap();
1839///
1840/// # let client = hyper_util::client::legacy::Client::builder(
1841/// # hyper_util::rt::TokioExecutor::new()
1842/// # )
1843/// # .build(
1844/// # hyper_rustls::HttpsConnectorBuilder::new()
1845/// # .with_native_roots()
1846/// # .unwrap()
1847/// # .https_or_http()
1848/// # .enable_http2()
1849/// # .build()
1850/// # );
1851/// # let mut hub = CloudIAP::new(client, auth);
1852/// // You can configure optional parameters by calling the respective setters at will, and
1853/// // execute the final call using `doit()`.
1854/// // Values shown here are possibly random and not representative !
1855/// let result = hub.projects().brands_identity_aware_proxy_clients_delete("name")
1856/// .doit().await;
1857/// # }
1858/// ```
1859pub struct ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C>
1860where
1861 C: 'a,
1862{
1863 hub: &'a CloudIAP<C>,
1864 _name: String,
1865 _delegate: Option<&'a mut dyn common::Delegate>,
1866 _additional_params: HashMap<String, String>,
1867 _scopes: BTreeSet<String>,
1868}
1869
1870impl<'a, C> common::CallBuilder for ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C> {}
1871
1872impl<'a, C> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C>
1873where
1874 C: common::Connector,
1875{
1876 /// Perform the operation you have build so far.
1877 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
1878 use std::borrow::Cow;
1879 use std::io::{Read, Seek};
1880
1881 use common::{url::Params, ToParts};
1882 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1883
1884 let mut dd = common::DefaultDelegate;
1885 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1886 dlg.begin(common::MethodInfo {
1887 id: "iap.projects.brands.identityAwareProxyClients.delete",
1888 http_method: hyper::Method::DELETE,
1889 });
1890
1891 for &field in ["alt", "name"].iter() {
1892 if self._additional_params.contains_key(field) {
1893 dlg.finished(false);
1894 return Err(common::Error::FieldClash(field));
1895 }
1896 }
1897
1898 let mut params = Params::with_capacity(3 + self._additional_params.len());
1899 params.push("name", self._name);
1900
1901 params.extend(self._additional_params.iter());
1902
1903 params.push("alt", "json");
1904 let mut url = self.hub._base_url.clone() + "v1/{+name}";
1905 if self._scopes.is_empty() {
1906 self._scopes
1907 .insert(Scope::CloudPlatform.as_ref().to_string());
1908 }
1909
1910 #[allow(clippy::single_element_loop)]
1911 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1912 url = params.uri_replacement(url, param_name, find_this, true);
1913 }
1914 {
1915 let to_remove = ["name"];
1916 params.remove_params(&to_remove);
1917 }
1918
1919 let url = params.parse_with_url(&url);
1920
1921 loop {
1922 let token = match self
1923 .hub
1924 .auth
1925 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1926 .await
1927 {
1928 Ok(token) => token,
1929 Err(e) => match dlg.token(e) {
1930 Ok(token) => token,
1931 Err(e) => {
1932 dlg.finished(false);
1933 return Err(common::Error::MissingToken(e));
1934 }
1935 },
1936 };
1937 let mut req_result = {
1938 let client = &self.hub.client;
1939 dlg.pre_request();
1940 let mut req_builder = hyper::Request::builder()
1941 .method(hyper::Method::DELETE)
1942 .uri(url.as_str())
1943 .header(USER_AGENT, self.hub._user_agent.clone());
1944
1945 if let Some(token) = token.as_ref() {
1946 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1947 }
1948
1949 let request = req_builder
1950 .header(CONTENT_LENGTH, 0_u64)
1951 .body(common::to_body::<String>(None));
1952
1953 client.request(request.unwrap()).await
1954 };
1955
1956 match req_result {
1957 Err(err) => {
1958 if let common::Retry::After(d) = dlg.http_error(&err) {
1959 sleep(d).await;
1960 continue;
1961 }
1962 dlg.finished(false);
1963 return Err(common::Error::HttpError(err));
1964 }
1965 Ok(res) => {
1966 let (mut parts, body) = res.into_parts();
1967 let mut body = common::Body::new(body);
1968 if !parts.status.is_success() {
1969 let bytes = common::to_bytes(body).await.unwrap_or_default();
1970 let error = serde_json::from_str(&common::to_string(&bytes));
1971 let response = common::to_response(parts, bytes.into());
1972
1973 if let common::Retry::After(d) =
1974 dlg.http_failure(&response, error.as_ref().ok())
1975 {
1976 sleep(d).await;
1977 continue;
1978 }
1979
1980 dlg.finished(false);
1981
1982 return Err(match error {
1983 Ok(value) => common::Error::BadRequest(value),
1984 _ => common::Error::Failure(response),
1985 });
1986 }
1987 let response = {
1988 let bytes = common::to_bytes(body).await.unwrap_or_default();
1989 let encoded = common::to_string(&bytes);
1990 match serde_json::from_str(&encoded) {
1991 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1992 Err(error) => {
1993 dlg.response_json_decode_error(&encoded, &error);
1994 return Err(common::Error::JsonDecodeError(
1995 encoded.to_string(),
1996 error,
1997 ));
1998 }
1999 }
2000 };
2001
2002 dlg.finished(true);
2003 return Ok(response);
2004 }
2005 }
2006 }
2007 }
2008
2009 /// Required. Name of the Identity Aware Proxy client to be deleted. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
2010 ///
2011 /// Sets the *name* path property to the given value.
2012 ///
2013 /// Even though the property as already been set when instantiating this call,
2014 /// we provide this method for API completeness.
2015 pub fn name(
2016 mut self,
2017 new_value: &str,
2018 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C> {
2019 self._name = new_value.to_string();
2020 self
2021 }
2022 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2023 /// while executing the actual API request.
2024 ///
2025 /// ````text
2026 /// It should be used to handle progress information, and to implement a certain level of resilience.
2027 /// ````
2028 ///
2029 /// Sets the *delegate* property to the given value.
2030 pub fn delegate(
2031 mut self,
2032 new_value: &'a mut dyn common::Delegate,
2033 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C> {
2034 self._delegate = Some(new_value);
2035 self
2036 }
2037
2038 /// Set any additional parameter of the query string used in the request.
2039 /// It should be used to set parameters which are not yet available through their own
2040 /// setters.
2041 ///
2042 /// Please note that this method must not be used to set any of the known parameters
2043 /// which have their own setter method. If done anyway, the request will fail.
2044 ///
2045 /// # Additional Parameters
2046 ///
2047 /// * *$.xgafv* (query-string) - V1 error format.
2048 /// * *access_token* (query-string) - OAuth access token.
2049 /// * *alt* (query-string) - Data format for response.
2050 /// * *callback* (query-string) - JSONP
2051 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2052 /// * *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.
2053 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2054 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2055 /// * *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.
2056 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2057 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2058 pub fn param<T>(
2059 mut self,
2060 name: T,
2061 value: T,
2062 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C>
2063 where
2064 T: AsRef<str>,
2065 {
2066 self._additional_params
2067 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2068 self
2069 }
2070
2071 /// Identifies the authorization scope for the method you are building.
2072 ///
2073 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2074 /// [`Scope::CloudPlatform`].
2075 ///
2076 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2077 /// tokens for more than one scope.
2078 ///
2079 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2080 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2081 /// sufficient, a read-write scope will do as well.
2082 pub fn add_scope<St>(
2083 mut self,
2084 scope: St,
2085 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C>
2086 where
2087 St: AsRef<str>,
2088 {
2089 self._scopes.insert(String::from(scope.as_ref()));
2090 self
2091 }
2092 /// Identifies the authorization scope(s) for the method you are building.
2093 ///
2094 /// See [`Self::add_scope()`] for details.
2095 pub fn add_scopes<I, St>(
2096 mut self,
2097 scopes: I,
2098 ) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C>
2099 where
2100 I: IntoIterator<Item = St>,
2101 St: AsRef<str>,
2102 {
2103 self._scopes
2104 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2105 self
2106 }
2107
2108 /// Removes all scopes, and no default scope will be used either.
2109 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2110 /// for details).
2111 pub fn clear_scopes(mut self) -> ProjectBrandIdentityAwareProxyClientDeleteCall<'a, C> {
2112 self._scopes.clear();
2113 self
2114 }
2115}
2116
2117/// Retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.
2118///
2119/// A builder for the *brands.identityAwareProxyClients.get* method supported by a *project* resource.
2120/// It is not used directly, but through a [`ProjectMethods`] instance.
2121///
2122/// # Example
2123///
2124/// Instantiate a resource method builder
2125///
2126/// ```test_harness,no_run
2127/// # extern crate hyper;
2128/// # extern crate hyper_rustls;
2129/// # extern crate google_iap1 as iap1;
2130/// # async fn dox() {
2131/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2132///
2133/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2134/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2135/// # .with_native_roots()
2136/// # .unwrap()
2137/// # .https_only()
2138/// # .enable_http2()
2139/// # .build();
2140///
2141/// # let executor = hyper_util::rt::TokioExecutor::new();
2142/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2143/// # secret,
2144/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2145/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2146/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2147/// # ),
2148/// # ).build().await.unwrap();
2149///
2150/// # let client = hyper_util::client::legacy::Client::builder(
2151/// # hyper_util::rt::TokioExecutor::new()
2152/// # )
2153/// # .build(
2154/// # hyper_rustls::HttpsConnectorBuilder::new()
2155/// # .with_native_roots()
2156/// # .unwrap()
2157/// # .https_or_http()
2158/// # .enable_http2()
2159/// # .build()
2160/// # );
2161/// # let mut hub = CloudIAP::new(client, auth);
2162/// // You can configure optional parameters by calling the respective setters at will, and
2163/// // execute the final call using `doit()`.
2164/// // Values shown here are possibly random and not representative !
2165/// let result = hub.projects().brands_identity_aware_proxy_clients_get("name")
2166/// .doit().await;
2167/// # }
2168/// ```
2169pub struct ProjectBrandIdentityAwareProxyClientGetCall<'a, C>
2170where
2171 C: 'a,
2172{
2173 hub: &'a CloudIAP<C>,
2174 _name: String,
2175 _delegate: Option<&'a mut dyn common::Delegate>,
2176 _additional_params: HashMap<String, String>,
2177 _scopes: BTreeSet<String>,
2178}
2179
2180impl<'a, C> common::CallBuilder for ProjectBrandIdentityAwareProxyClientGetCall<'a, C> {}
2181
2182impl<'a, C> ProjectBrandIdentityAwareProxyClientGetCall<'a, C>
2183where
2184 C: common::Connector,
2185{
2186 /// Perform the operation you have build so far.
2187 pub async fn doit(mut self) -> common::Result<(common::Response, IdentityAwareProxyClient)> {
2188 use std::borrow::Cow;
2189 use std::io::{Read, Seek};
2190
2191 use common::{url::Params, ToParts};
2192 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2193
2194 let mut dd = common::DefaultDelegate;
2195 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2196 dlg.begin(common::MethodInfo {
2197 id: "iap.projects.brands.identityAwareProxyClients.get",
2198 http_method: hyper::Method::GET,
2199 });
2200
2201 for &field in ["alt", "name"].iter() {
2202 if self._additional_params.contains_key(field) {
2203 dlg.finished(false);
2204 return Err(common::Error::FieldClash(field));
2205 }
2206 }
2207
2208 let mut params = Params::with_capacity(3 + self._additional_params.len());
2209 params.push("name", self._name);
2210
2211 params.extend(self._additional_params.iter());
2212
2213 params.push("alt", "json");
2214 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2215 if self._scopes.is_empty() {
2216 self._scopes
2217 .insert(Scope::CloudPlatform.as_ref().to_string());
2218 }
2219
2220 #[allow(clippy::single_element_loop)]
2221 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2222 url = params.uri_replacement(url, param_name, find_this, true);
2223 }
2224 {
2225 let to_remove = ["name"];
2226 params.remove_params(&to_remove);
2227 }
2228
2229 let url = params.parse_with_url(&url);
2230
2231 loop {
2232 let token = match self
2233 .hub
2234 .auth
2235 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2236 .await
2237 {
2238 Ok(token) => token,
2239 Err(e) => match dlg.token(e) {
2240 Ok(token) => token,
2241 Err(e) => {
2242 dlg.finished(false);
2243 return Err(common::Error::MissingToken(e));
2244 }
2245 },
2246 };
2247 let mut req_result = {
2248 let client = &self.hub.client;
2249 dlg.pre_request();
2250 let mut req_builder = hyper::Request::builder()
2251 .method(hyper::Method::GET)
2252 .uri(url.as_str())
2253 .header(USER_AGENT, self.hub._user_agent.clone());
2254
2255 if let Some(token) = token.as_ref() {
2256 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2257 }
2258
2259 let request = req_builder
2260 .header(CONTENT_LENGTH, 0_u64)
2261 .body(common::to_body::<String>(None));
2262
2263 client.request(request.unwrap()).await
2264 };
2265
2266 match req_result {
2267 Err(err) => {
2268 if let common::Retry::After(d) = dlg.http_error(&err) {
2269 sleep(d).await;
2270 continue;
2271 }
2272 dlg.finished(false);
2273 return Err(common::Error::HttpError(err));
2274 }
2275 Ok(res) => {
2276 let (mut parts, body) = res.into_parts();
2277 let mut body = common::Body::new(body);
2278 if !parts.status.is_success() {
2279 let bytes = common::to_bytes(body).await.unwrap_or_default();
2280 let error = serde_json::from_str(&common::to_string(&bytes));
2281 let response = common::to_response(parts, bytes.into());
2282
2283 if let common::Retry::After(d) =
2284 dlg.http_failure(&response, error.as_ref().ok())
2285 {
2286 sleep(d).await;
2287 continue;
2288 }
2289
2290 dlg.finished(false);
2291
2292 return Err(match error {
2293 Ok(value) => common::Error::BadRequest(value),
2294 _ => common::Error::Failure(response),
2295 });
2296 }
2297 let response = {
2298 let bytes = common::to_bytes(body).await.unwrap_or_default();
2299 let encoded = common::to_string(&bytes);
2300 match serde_json::from_str(&encoded) {
2301 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2302 Err(error) => {
2303 dlg.response_json_decode_error(&encoded, &error);
2304 return Err(common::Error::JsonDecodeError(
2305 encoded.to_string(),
2306 error,
2307 ));
2308 }
2309 }
2310 };
2311
2312 dlg.finished(true);
2313 return Ok(response);
2314 }
2315 }
2316 }
2317 }
2318
2319 /// Required. Name of the Identity Aware Proxy client to be fetched. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
2320 ///
2321 /// Sets the *name* path property to the given value.
2322 ///
2323 /// Even though the property as already been set when instantiating this call,
2324 /// we provide this method for API completeness.
2325 pub fn name(mut self, new_value: &str) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C> {
2326 self._name = new_value.to_string();
2327 self
2328 }
2329 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2330 /// while executing the actual API request.
2331 ///
2332 /// ````text
2333 /// It should be used to handle progress information, and to implement a certain level of resilience.
2334 /// ````
2335 ///
2336 /// Sets the *delegate* property to the given value.
2337 pub fn delegate(
2338 mut self,
2339 new_value: &'a mut dyn common::Delegate,
2340 ) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C> {
2341 self._delegate = Some(new_value);
2342 self
2343 }
2344
2345 /// Set any additional parameter of the query string used in the request.
2346 /// It should be used to set parameters which are not yet available through their own
2347 /// setters.
2348 ///
2349 /// Please note that this method must not be used to set any of the known parameters
2350 /// which have their own setter method. If done anyway, the request will fail.
2351 ///
2352 /// # Additional Parameters
2353 ///
2354 /// * *$.xgafv* (query-string) - V1 error format.
2355 /// * *access_token* (query-string) - OAuth access token.
2356 /// * *alt* (query-string) - Data format for response.
2357 /// * *callback* (query-string) - JSONP
2358 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2359 /// * *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.
2360 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2361 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2362 /// * *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.
2363 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2364 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2365 pub fn param<T>(
2366 mut self,
2367 name: T,
2368 value: T,
2369 ) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C>
2370 where
2371 T: AsRef<str>,
2372 {
2373 self._additional_params
2374 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2375 self
2376 }
2377
2378 /// Identifies the authorization scope for the method you are building.
2379 ///
2380 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2381 /// [`Scope::CloudPlatform`].
2382 ///
2383 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2384 /// tokens for more than one scope.
2385 ///
2386 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2387 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2388 /// sufficient, a read-write scope will do as well.
2389 pub fn add_scope<St>(mut self, scope: St) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C>
2390 where
2391 St: AsRef<str>,
2392 {
2393 self._scopes.insert(String::from(scope.as_ref()));
2394 self
2395 }
2396 /// Identifies the authorization scope(s) for the method you are building.
2397 ///
2398 /// See [`Self::add_scope()`] for details.
2399 pub fn add_scopes<I, St>(
2400 mut self,
2401 scopes: I,
2402 ) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C>
2403 where
2404 I: IntoIterator<Item = St>,
2405 St: AsRef<str>,
2406 {
2407 self._scopes
2408 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2409 self
2410 }
2411
2412 /// Removes all scopes, and no default scope will be used either.
2413 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2414 /// for details).
2415 pub fn clear_scopes(mut self) -> ProjectBrandIdentityAwareProxyClientGetCall<'a, C> {
2416 self._scopes.clear();
2417 self
2418 }
2419}
2420
2421/// Lists the existing clients for the brand.
2422///
2423/// A builder for the *brands.identityAwareProxyClients.list* method supported by a *project* resource.
2424/// It is not used directly, but through a [`ProjectMethods`] instance.
2425///
2426/// # Example
2427///
2428/// Instantiate a resource method builder
2429///
2430/// ```test_harness,no_run
2431/// # extern crate hyper;
2432/// # extern crate hyper_rustls;
2433/// # extern crate google_iap1 as iap1;
2434/// # async fn dox() {
2435/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2436///
2437/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2438/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2439/// # .with_native_roots()
2440/// # .unwrap()
2441/// # .https_only()
2442/// # .enable_http2()
2443/// # .build();
2444///
2445/// # let executor = hyper_util::rt::TokioExecutor::new();
2446/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2447/// # secret,
2448/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2449/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2450/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2451/// # ),
2452/// # ).build().await.unwrap();
2453///
2454/// # let client = hyper_util::client::legacy::Client::builder(
2455/// # hyper_util::rt::TokioExecutor::new()
2456/// # )
2457/// # .build(
2458/// # hyper_rustls::HttpsConnectorBuilder::new()
2459/// # .with_native_roots()
2460/// # .unwrap()
2461/// # .https_or_http()
2462/// # .enable_http2()
2463/// # .build()
2464/// # );
2465/// # let mut hub = CloudIAP::new(client, auth);
2466/// // You can configure optional parameters by calling the respective setters at will, and
2467/// // execute the final call using `doit()`.
2468/// // Values shown here are possibly random and not representative !
2469/// let result = hub.projects().brands_identity_aware_proxy_clients_list("parent")
2470/// .page_token("sed")
2471/// .page_size(-2)
2472/// .doit().await;
2473/// # }
2474/// ```
2475pub struct ProjectBrandIdentityAwareProxyClientListCall<'a, C>
2476where
2477 C: 'a,
2478{
2479 hub: &'a CloudIAP<C>,
2480 _parent: String,
2481 _page_token: Option<String>,
2482 _page_size: Option<i32>,
2483 _delegate: Option<&'a mut dyn common::Delegate>,
2484 _additional_params: HashMap<String, String>,
2485 _scopes: BTreeSet<String>,
2486}
2487
2488impl<'a, C> common::CallBuilder for ProjectBrandIdentityAwareProxyClientListCall<'a, C> {}
2489
2490impl<'a, C> ProjectBrandIdentityAwareProxyClientListCall<'a, C>
2491where
2492 C: common::Connector,
2493{
2494 /// Perform the operation you have build so far.
2495 pub async fn doit(
2496 mut self,
2497 ) -> common::Result<(common::Response, ListIdentityAwareProxyClientsResponse)> {
2498 use std::borrow::Cow;
2499 use std::io::{Read, Seek};
2500
2501 use common::{url::Params, ToParts};
2502 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2503
2504 let mut dd = common::DefaultDelegate;
2505 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2506 dlg.begin(common::MethodInfo {
2507 id: "iap.projects.brands.identityAwareProxyClients.list",
2508 http_method: hyper::Method::GET,
2509 });
2510
2511 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2512 if self._additional_params.contains_key(field) {
2513 dlg.finished(false);
2514 return Err(common::Error::FieldClash(field));
2515 }
2516 }
2517
2518 let mut params = Params::with_capacity(5 + self._additional_params.len());
2519 params.push("parent", self._parent);
2520 if let Some(value) = self._page_token.as_ref() {
2521 params.push("pageToken", value);
2522 }
2523 if let Some(value) = self._page_size.as_ref() {
2524 params.push("pageSize", value.to_string());
2525 }
2526
2527 params.extend(self._additional_params.iter());
2528
2529 params.push("alt", "json");
2530 let mut url = self.hub._base_url.clone() + "v1/{+parent}/identityAwareProxyClients";
2531 if self._scopes.is_empty() {
2532 self._scopes
2533 .insert(Scope::CloudPlatform.as_ref().to_string());
2534 }
2535
2536 #[allow(clippy::single_element_loop)]
2537 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2538 url = params.uri_replacement(url, param_name, find_this, true);
2539 }
2540 {
2541 let to_remove = ["parent"];
2542 params.remove_params(&to_remove);
2543 }
2544
2545 let url = params.parse_with_url(&url);
2546
2547 loop {
2548 let token = match self
2549 .hub
2550 .auth
2551 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2552 .await
2553 {
2554 Ok(token) => token,
2555 Err(e) => match dlg.token(e) {
2556 Ok(token) => token,
2557 Err(e) => {
2558 dlg.finished(false);
2559 return Err(common::Error::MissingToken(e));
2560 }
2561 },
2562 };
2563 let mut req_result = {
2564 let client = &self.hub.client;
2565 dlg.pre_request();
2566 let mut req_builder = hyper::Request::builder()
2567 .method(hyper::Method::GET)
2568 .uri(url.as_str())
2569 .header(USER_AGENT, self.hub._user_agent.clone());
2570
2571 if let Some(token) = token.as_ref() {
2572 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2573 }
2574
2575 let request = req_builder
2576 .header(CONTENT_LENGTH, 0_u64)
2577 .body(common::to_body::<String>(None));
2578
2579 client.request(request.unwrap()).await
2580 };
2581
2582 match req_result {
2583 Err(err) => {
2584 if let common::Retry::After(d) = dlg.http_error(&err) {
2585 sleep(d).await;
2586 continue;
2587 }
2588 dlg.finished(false);
2589 return Err(common::Error::HttpError(err));
2590 }
2591 Ok(res) => {
2592 let (mut parts, body) = res.into_parts();
2593 let mut body = common::Body::new(body);
2594 if !parts.status.is_success() {
2595 let bytes = common::to_bytes(body).await.unwrap_or_default();
2596 let error = serde_json::from_str(&common::to_string(&bytes));
2597 let response = common::to_response(parts, bytes.into());
2598
2599 if let common::Retry::After(d) =
2600 dlg.http_failure(&response, error.as_ref().ok())
2601 {
2602 sleep(d).await;
2603 continue;
2604 }
2605
2606 dlg.finished(false);
2607
2608 return Err(match error {
2609 Ok(value) => common::Error::BadRequest(value),
2610 _ => common::Error::Failure(response),
2611 });
2612 }
2613 let response = {
2614 let bytes = common::to_bytes(body).await.unwrap_or_default();
2615 let encoded = common::to_string(&bytes);
2616 match serde_json::from_str(&encoded) {
2617 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2618 Err(error) => {
2619 dlg.response_json_decode_error(&encoded, &error);
2620 return Err(common::Error::JsonDecodeError(
2621 encoded.to_string(),
2622 error,
2623 ));
2624 }
2625 }
2626 };
2627
2628 dlg.finished(true);
2629 return Ok(response);
2630 }
2631 }
2632 }
2633 }
2634
2635 /// Required. Full brand path. In the following format: projects/{project_number/id}/brands/{brand}.
2636 ///
2637 /// Sets the *parent* path property to the given value.
2638 ///
2639 /// Even though the property as already been set when instantiating this call,
2640 /// we provide this method for API completeness.
2641 pub fn parent(
2642 mut self,
2643 new_value: &str,
2644 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
2645 self._parent = new_value.to_string();
2646 self
2647 }
2648 /// A page token, received from a previous `ListIdentityAwareProxyClients` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListIdentityAwareProxyClients` must match the call that provided the page token.
2649 ///
2650 /// Sets the *page token* query property to the given value.
2651 pub fn page_token(
2652 mut self,
2653 new_value: &str,
2654 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
2655 self._page_token = Some(new_value.to_string());
2656 self
2657 }
2658 /// The maximum number of clients to return. The service may return fewer than this value. If unspecified, at most 100 clients will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
2659 ///
2660 /// Sets the *page size* query property to the given value.
2661 pub fn page_size(
2662 mut self,
2663 new_value: i32,
2664 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
2665 self._page_size = Some(new_value);
2666 self
2667 }
2668 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2669 /// while executing the actual API request.
2670 ///
2671 /// ````text
2672 /// It should be used to handle progress information, and to implement a certain level of resilience.
2673 /// ````
2674 ///
2675 /// Sets the *delegate* property to the given value.
2676 pub fn delegate(
2677 mut self,
2678 new_value: &'a mut dyn common::Delegate,
2679 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
2680 self._delegate = Some(new_value);
2681 self
2682 }
2683
2684 /// Set any additional parameter of the query string used in the request.
2685 /// It should be used to set parameters which are not yet available through their own
2686 /// setters.
2687 ///
2688 /// Please note that this method must not be used to set any of the known parameters
2689 /// which have their own setter method. If done anyway, the request will fail.
2690 ///
2691 /// # Additional Parameters
2692 ///
2693 /// * *$.xgafv* (query-string) - V1 error format.
2694 /// * *access_token* (query-string) - OAuth access token.
2695 /// * *alt* (query-string) - Data format for response.
2696 /// * *callback* (query-string) - JSONP
2697 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2698 /// * *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.
2699 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2700 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2701 /// * *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.
2702 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2703 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2704 pub fn param<T>(
2705 mut self,
2706 name: T,
2707 value: T,
2708 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C>
2709 where
2710 T: AsRef<str>,
2711 {
2712 self._additional_params
2713 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2714 self
2715 }
2716
2717 /// Identifies the authorization scope for the method you are building.
2718 ///
2719 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2720 /// [`Scope::CloudPlatform`].
2721 ///
2722 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2723 /// tokens for more than one scope.
2724 ///
2725 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2726 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2727 /// sufficient, a read-write scope will do as well.
2728 pub fn add_scope<St>(mut self, scope: St) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C>
2729 where
2730 St: AsRef<str>,
2731 {
2732 self._scopes.insert(String::from(scope.as_ref()));
2733 self
2734 }
2735 /// Identifies the authorization scope(s) for the method you are building.
2736 ///
2737 /// See [`Self::add_scope()`] for details.
2738 pub fn add_scopes<I, St>(
2739 mut self,
2740 scopes: I,
2741 ) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C>
2742 where
2743 I: IntoIterator<Item = St>,
2744 St: AsRef<str>,
2745 {
2746 self._scopes
2747 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2748 self
2749 }
2750
2751 /// Removes all scopes, and no default scope will be used either.
2752 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2753 /// for details).
2754 pub fn clear_scopes(mut self) -> ProjectBrandIdentityAwareProxyClientListCall<'a, C> {
2755 self._scopes.clear();
2756 self
2757 }
2758}
2759
2760/// Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.
2761///
2762/// A builder for the *brands.identityAwareProxyClients.resetSecret* method supported by a *project* resource.
2763/// It is not used directly, but through a [`ProjectMethods`] instance.
2764///
2765/// # Example
2766///
2767/// Instantiate a resource method builder
2768///
2769/// ```test_harness,no_run
2770/// # extern crate hyper;
2771/// # extern crate hyper_rustls;
2772/// # extern crate google_iap1 as iap1;
2773/// use iap1::api::ResetIdentityAwareProxyClientSecretRequest;
2774/// # async fn dox() {
2775/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2776///
2777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2778/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2779/// # .with_native_roots()
2780/// # .unwrap()
2781/// # .https_only()
2782/// # .enable_http2()
2783/// # .build();
2784///
2785/// # let executor = hyper_util::rt::TokioExecutor::new();
2786/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2787/// # secret,
2788/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2789/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2790/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2791/// # ),
2792/// # ).build().await.unwrap();
2793///
2794/// # let client = hyper_util::client::legacy::Client::builder(
2795/// # hyper_util::rt::TokioExecutor::new()
2796/// # )
2797/// # .build(
2798/// # hyper_rustls::HttpsConnectorBuilder::new()
2799/// # .with_native_roots()
2800/// # .unwrap()
2801/// # .https_or_http()
2802/// # .enable_http2()
2803/// # .build()
2804/// # );
2805/// # let mut hub = CloudIAP::new(client, auth);
2806/// // As the method needs a request, you would usually fill it with the desired information
2807/// // into the respective structure. Some of the parts shown here might not be applicable !
2808/// // Values shown here are possibly random and not representative !
2809/// let mut req = ResetIdentityAwareProxyClientSecretRequest::default();
2810///
2811/// // You can configure optional parameters by calling the respective setters at will, and
2812/// // execute the final call using `doit()`.
2813/// // Values shown here are possibly random and not representative !
2814/// let result = hub.projects().brands_identity_aware_proxy_clients_reset_secret(req, "name")
2815/// .doit().await;
2816/// # }
2817/// ```
2818pub struct ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C>
2819where
2820 C: 'a,
2821{
2822 hub: &'a CloudIAP<C>,
2823 _request: ResetIdentityAwareProxyClientSecretRequest,
2824 _name: String,
2825 _delegate: Option<&'a mut dyn common::Delegate>,
2826 _additional_params: HashMap<String, String>,
2827 _scopes: BTreeSet<String>,
2828}
2829
2830impl<'a, C> common::CallBuilder for ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {}
2831
2832impl<'a, C> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C>
2833where
2834 C: common::Connector,
2835{
2836 /// Perform the operation you have build so far.
2837 pub async fn doit(mut self) -> common::Result<(common::Response, IdentityAwareProxyClient)> {
2838 use std::borrow::Cow;
2839 use std::io::{Read, Seek};
2840
2841 use common::{url::Params, ToParts};
2842 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2843
2844 let mut dd = common::DefaultDelegate;
2845 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2846 dlg.begin(common::MethodInfo {
2847 id: "iap.projects.brands.identityAwareProxyClients.resetSecret",
2848 http_method: hyper::Method::POST,
2849 });
2850
2851 for &field in ["alt", "name"].iter() {
2852 if self._additional_params.contains_key(field) {
2853 dlg.finished(false);
2854 return Err(common::Error::FieldClash(field));
2855 }
2856 }
2857
2858 let mut params = Params::with_capacity(4 + self._additional_params.len());
2859 params.push("name", self._name);
2860
2861 params.extend(self._additional_params.iter());
2862
2863 params.push("alt", "json");
2864 let mut url = self.hub._base_url.clone() + "v1/{+name}:resetSecret";
2865 if self._scopes.is_empty() {
2866 self._scopes
2867 .insert(Scope::CloudPlatform.as_ref().to_string());
2868 }
2869
2870 #[allow(clippy::single_element_loop)]
2871 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2872 url = params.uri_replacement(url, param_name, find_this, true);
2873 }
2874 {
2875 let to_remove = ["name"];
2876 params.remove_params(&to_remove);
2877 }
2878
2879 let url = params.parse_with_url(&url);
2880
2881 let mut json_mime_type = mime::APPLICATION_JSON;
2882 let mut request_value_reader = {
2883 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2884 common::remove_json_null_values(&mut value);
2885 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2886 serde_json::to_writer(&mut dst, &value).unwrap();
2887 dst
2888 };
2889 let request_size = request_value_reader
2890 .seek(std::io::SeekFrom::End(0))
2891 .unwrap();
2892 request_value_reader
2893 .seek(std::io::SeekFrom::Start(0))
2894 .unwrap();
2895
2896 loop {
2897 let token = match self
2898 .hub
2899 .auth
2900 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2901 .await
2902 {
2903 Ok(token) => token,
2904 Err(e) => match dlg.token(e) {
2905 Ok(token) => token,
2906 Err(e) => {
2907 dlg.finished(false);
2908 return Err(common::Error::MissingToken(e));
2909 }
2910 },
2911 };
2912 request_value_reader
2913 .seek(std::io::SeekFrom::Start(0))
2914 .unwrap();
2915 let mut req_result = {
2916 let client = &self.hub.client;
2917 dlg.pre_request();
2918 let mut req_builder = hyper::Request::builder()
2919 .method(hyper::Method::POST)
2920 .uri(url.as_str())
2921 .header(USER_AGENT, self.hub._user_agent.clone());
2922
2923 if let Some(token) = token.as_ref() {
2924 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2925 }
2926
2927 let request = req_builder
2928 .header(CONTENT_TYPE, json_mime_type.to_string())
2929 .header(CONTENT_LENGTH, request_size as u64)
2930 .body(common::to_body(
2931 request_value_reader.get_ref().clone().into(),
2932 ));
2933
2934 client.request(request.unwrap()).await
2935 };
2936
2937 match req_result {
2938 Err(err) => {
2939 if let common::Retry::After(d) = dlg.http_error(&err) {
2940 sleep(d).await;
2941 continue;
2942 }
2943 dlg.finished(false);
2944 return Err(common::Error::HttpError(err));
2945 }
2946 Ok(res) => {
2947 let (mut parts, body) = res.into_parts();
2948 let mut body = common::Body::new(body);
2949 if !parts.status.is_success() {
2950 let bytes = common::to_bytes(body).await.unwrap_or_default();
2951 let error = serde_json::from_str(&common::to_string(&bytes));
2952 let response = common::to_response(parts, bytes.into());
2953
2954 if let common::Retry::After(d) =
2955 dlg.http_failure(&response, error.as_ref().ok())
2956 {
2957 sleep(d).await;
2958 continue;
2959 }
2960
2961 dlg.finished(false);
2962
2963 return Err(match error {
2964 Ok(value) => common::Error::BadRequest(value),
2965 _ => common::Error::Failure(response),
2966 });
2967 }
2968 let response = {
2969 let bytes = common::to_bytes(body).await.unwrap_or_default();
2970 let encoded = common::to_string(&bytes);
2971 match serde_json::from_str(&encoded) {
2972 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2973 Err(error) => {
2974 dlg.response_json_decode_error(&encoded, &error);
2975 return Err(common::Error::JsonDecodeError(
2976 encoded.to_string(),
2977 error,
2978 ));
2979 }
2980 }
2981 };
2982
2983 dlg.finished(true);
2984 return Ok(response);
2985 }
2986 }
2987 }
2988 }
2989
2990 ///
2991 /// Sets the *request* property to the given value.
2992 ///
2993 /// Even though the property as already been set when instantiating this call,
2994 /// we provide this method for API completeness.
2995 pub fn request(
2996 mut self,
2997 new_value: ResetIdentityAwareProxyClientSecretRequest,
2998 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {
2999 self._request = new_value;
3000 self
3001 }
3002 /// Required. Name of the Identity Aware Proxy client to that will have its secret reset. In the following format: projects/{project_number/id}/brands/{brand}/identityAwareProxyClients/{client_id}.
3003 ///
3004 /// Sets the *name* path property to the given value.
3005 ///
3006 /// Even though the property as already been set when instantiating this call,
3007 /// we provide this method for API completeness.
3008 pub fn name(
3009 mut self,
3010 new_value: &str,
3011 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {
3012 self._name = new_value.to_string();
3013 self
3014 }
3015 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3016 /// while executing the actual API request.
3017 ///
3018 /// ````text
3019 /// It should be used to handle progress information, and to implement a certain level of resilience.
3020 /// ````
3021 ///
3022 /// Sets the *delegate* property to the given value.
3023 pub fn delegate(
3024 mut self,
3025 new_value: &'a mut dyn common::Delegate,
3026 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {
3027 self._delegate = Some(new_value);
3028 self
3029 }
3030
3031 /// Set any additional parameter of the query string used in the request.
3032 /// It should be used to set parameters which are not yet available through their own
3033 /// setters.
3034 ///
3035 /// Please note that this method must not be used to set any of the known parameters
3036 /// which have their own setter method. If done anyway, the request will fail.
3037 ///
3038 /// # Additional Parameters
3039 ///
3040 /// * *$.xgafv* (query-string) - V1 error format.
3041 /// * *access_token* (query-string) - OAuth access token.
3042 /// * *alt* (query-string) - Data format for response.
3043 /// * *callback* (query-string) - JSONP
3044 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3045 /// * *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.
3046 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3047 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3048 /// * *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.
3049 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3050 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3051 pub fn param<T>(
3052 mut self,
3053 name: T,
3054 value: T,
3055 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C>
3056 where
3057 T: AsRef<str>,
3058 {
3059 self._additional_params
3060 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3061 self
3062 }
3063
3064 /// Identifies the authorization scope for the method you are building.
3065 ///
3066 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3067 /// [`Scope::CloudPlatform`].
3068 ///
3069 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3070 /// tokens for more than one scope.
3071 ///
3072 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3073 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3074 /// sufficient, a read-write scope will do as well.
3075 pub fn add_scope<St>(
3076 mut self,
3077 scope: St,
3078 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C>
3079 where
3080 St: AsRef<str>,
3081 {
3082 self._scopes.insert(String::from(scope.as_ref()));
3083 self
3084 }
3085 /// Identifies the authorization scope(s) for the method you are building.
3086 ///
3087 /// See [`Self::add_scope()`] for details.
3088 pub fn add_scopes<I, St>(
3089 mut self,
3090 scopes: I,
3091 ) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C>
3092 where
3093 I: IntoIterator<Item = St>,
3094 St: AsRef<str>,
3095 {
3096 self._scopes
3097 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3098 self
3099 }
3100
3101 /// Removes all scopes, and no default scope will be used either.
3102 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3103 /// for details).
3104 pub fn clear_scopes(mut self) -> ProjectBrandIdentityAwareProxyClientResetSecretCall<'a, C> {
3105 self._scopes.clear();
3106 self
3107 }
3108}
3109
3110/// Constructs a new OAuth brand for the project if one does not exist. The created brand is "internal only", meaning that OAuth clients created under it only accept requests from users who belong to the same Google Workspace organization as the project. The brand is created in an un-reviewed status. NOTE: The "internal only" status can be manually changed in the Google Cloud Console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.
3111///
3112/// A builder for the *brands.create* method supported by a *project* resource.
3113/// It is not used directly, but through a [`ProjectMethods`] instance.
3114///
3115/// # Example
3116///
3117/// Instantiate a resource method builder
3118///
3119/// ```test_harness,no_run
3120/// # extern crate hyper;
3121/// # extern crate hyper_rustls;
3122/// # extern crate google_iap1 as iap1;
3123/// use iap1::api::Brand;
3124/// # async fn dox() {
3125/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3126///
3127/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3128/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3129/// # .with_native_roots()
3130/// # .unwrap()
3131/// # .https_only()
3132/// # .enable_http2()
3133/// # .build();
3134///
3135/// # let executor = hyper_util::rt::TokioExecutor::new();
3136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3137/// # secret,
3138/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3139/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3140/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3141/// # ),
3142/// # ).build().await.unwrap();
3143///
3144/// # let client = hyper_util::client::legacy::Client::builder(
3145/// # hyper_util::rt::TokioExecutor::new()
3146/// # )
3147/// # .build(
3148/// # hyper_rustls::HttpsConnectorBuilder::new()
3149/// # .with_native_roots()
3150/// # .unwrap()
3151/// # .https_or_http()
3152/// # .enable_http2()
3153/// # .build()
3154/// # );
3155/// # let mut hub = CloudIAP::new(client, auth);
3156/// // As the method needs a request, you would usually fill it with the desired information
3157/// // into the respective structure. Some of the parts shown here might not be applicable !
3158/// // Values shown here are possibly random and not representative !
3159/// let mut req = Brand::default();
3160///
3161/// // You can configure optional parameters by calling the respective setters at will, and
3162/// // execute the final call using `doit()`.
3163/// // Values shown here are possibly random and not representative !
3164/// let result = hub.projects().brands_create(req, "parent")
3165/// .doit().await;
3166/// # }
3167/// ```
3168pub struct ProjectBrandCreateCall<'a, C>
3169where
3170 C: 'a,
3171{
3172 hub: &'a CloudIAP<C>,
3173 _request: Brand,
3174 _parent: String,
3175 _delegate: Option<&'a mut dyn common::Delegate>,
3176 _additional_params: HashMap<String, String>,
3177 _scopes: BTreeSet<String>,
3178}
3179
3180impl<'a, C> common::CallBuilder for ProjectBrandCreateCall<'a, C> {}
3181
3182impl<'a, C> ProjectBrandCreateCall<'a, C>
3183where
3184 C: common::Connector,
3185{
3186 /// Perform the operation you have build so far.
3187 pub async fn doit(mut self) -> common::Result<(common::Response, Brand)> {
3188 use std::borrow::Cow;
3189 use std::io::{Read, Seek};
3190
3191 use common::{url::Params, ToParts};
3192 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3193
3194 let mut dd = common::DefaultDelegate;
3195 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3196 dlg.begin(common::MethodInfo {
3197 id: "iap.projects.brands.create",
3198 http_method: hyper::Method::POST,
3199 });
3200
3201 for &field in ["alt", "parent"].iter() {
3202 if self._additional_params.contains_key(field) {
3203 dlg.finished(false);
3204 return Err(common::Error::FieldClash(field));
3205 }
3206 }
3207
3208 let mut params = Params::with_capacity(4 + self._additional_params.len());
3209 params.push("parent", self._parent);
3210
3211 params.extend(self._additional_params.iter());
3212
3213 params.push("alt", "json");
3214 let mut url = self.hub._base_url.clone() + "v1/{+parent}/brands";
3215 if self._scopes.is_empty() {
3216 self._scopes
3217 .insert(Scope::CloudPlatform.as_ref().to_string());
3218 }
3219
3220 #[allow(clippy::single_element_loop)]
3221 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3222 url = params.uri_replacement(url, param_name, find_this, true);
3223 }
3224 {
3225 let to_remove = ["parent"];
3226 params.remove_params(&to_remove);
3227 }
3228
3229 let url = params.parse_with_url(&url);
3230
3231 let mut json_mime_type = mime::APPLICATION_JSON;
3232 let mut request_value_reader = {
3233 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3234 common::remove_json_null_values(&mut value);
3235 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3236 serde_json::to_writer(&mut dst, &value).unwrap();
3237 dst
3238 };
3239 let request_size = request_value_reader
3240 .seek(std::io::SeekFrom::End(0))
3241 .unwrap();
3242 request_value_reader
3243 .seek(std::io::SeekFrom::Start(0))
3244 .unwrap();
3245
3246 loop {
3247 let token = match self
3248 .hub
3249 .auth
3250 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3251 .await
3252 {
3253 Ok(token) => token,
3254 Err(e) => match dlg.token(e) {
3255 Ok(token) => token,
3256 Err(e) => {
3257 dlg.finished(false);
3258 return Err(common::Error::MissingToken(e));
3259 }
3260 },
3261 };
3262 request_value_reader
3263 .seek(std::io::SeekFrom::Start(0))
3264 .unwrap();
3265 let mut req_result = {
3266 let client = &self.hub.client;
3267 dlg.pre_request();
3268 let mut req_builder = hyper::Request::builder()
3269 .method(hyper::Method::POST)
3270 .uri(url.as_str())
3271 .header(USER_AGENT, self.hub._user_agent.clone());
3272
3273 if let Some(token) = token.as_ref() {
3274 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3275 }
3276
3277 let request = req_builder
3278 .header(CONTENT_TYPE, json_mime_type.to_string())
3279 .header(CONTENT_LENGTH, request_size as u64)
3280 .body(common::to_body(
3281 request_value_reader.get_ref().clone().into(),
3282 ));
3283
3284 client.request(request.unwrap()).await
3285 };
3286
3287 match req_result {
3288 Err(err) => {
3289 if let common::Retry::After(d) = dlg.http_error(&err) {
3290 sleep(d).await;
3291 continue;
3292 }
3293 dlg.finished(false);
3294 return Err(common::Error::HttpError(err));
3295 }
3296 Ok(res) => {
3297 let (mut parts, body) = res.into_parts();
3298 let mut body = common::Body::new(body);
3299 if !parts.status.is_success() {
3300 let bytes = common::to_bytes(body).await.unwrap_or_default();
3301 let error = serde_json::from_str(&common::to_string(&bytes));
3302 let response = common::to_response(parts, bytes.into());
3303
3304 if let common::Retry::After(d) =
3305 dlg.http_failure(&response, error.as_ref().ok())
3306 {
3307 sleep(d).await;
3308 continue;
3309 }
3310
3311 dlg.finished(false);
3312
3313 return Err(match error {
3314 Ok(value) => common::Error::BadRequest(value),
3315 _ => common::Error::Failure(response),
3316 });
3317 }
3318 let response = {
3319 let bytes = common::to_bytes(body).await.unwrap_or_default();
3320 let encoded = common::to_string(&bytes);
3321 match serde_json::from_str(&encoded) {
3322 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3323 Err(error) => {
3324 dlg.response_json_decode_error(&encoded, &error);
3325 return Err(common::Error::JsonDecodeError(
3326 encoded.to_string(),
3327 error,
3328 ));
3329 }
3330 }
3331 };
3332
3333 dlg.finished(true);
3334 return Ok(response);
3335 }
3336 }
3337 }
3338 }
3339
3340 ///
3341 /// Sets the *request* property to the given value.
3342 ///
3343 /// Even though the property as already been set when instantiating this call,
3344 /// we provide this method for API completeness.
3345 pub fn request(mut self, new_value: Brand) -> ProjectBrandCreateCall<'a, C> {
3346 self._request = new_value;
3347 self
3348 }
3349 /// Required. GCP Project number/id under which the brand is to be created. In the following format: projects/{project_number/id}.
3350 ///
3351 /// Sets the *parent* path property to the given value.
3352 ///
3353 /// Even though the property as already been set when instantiating this call,
3354 /// we provide this method for API completeness.
3355 pub fn parent(mut self, new_value: &str) -> ProjectBrandCreateCall<'a, C> {
3356 self._parent = new_value.to_string();
3357 self
3358 }
3359 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3360 /// while executing the actual API request.
3361 ///
3362 /// ````text
3363 /// It should be used to handle progress information, and to implement a certain level of resilience.
3364 /// ````
3365 ///
3366 /// Sets the *delegate* property to the given value.
3367 pub fn delegate(
3368 mut self,
3369 new_value: &'a mut dyn common::Delegate,
3370 ) -> ProjectBrandCreateCall<'a, C> {
3371 self._delegate = Some(new_value);
3372 self
3373 }
3374
3375 /// Set any additional parameter of the query string used in the request.
3376 /// It should be used to set parameters which are not yet available through their own
3377 /// setters.
3378 ///
3379 /// Please note that this method must not be used to set any of the known parameters
3380 /// which have their own setter method. If done anyway, the request will fail.
3381 ///
3382 /// # Additional Parameters
3383 ///
3384 /// * *$.xgafv* (query-string) - V1 error format.
3385 /// * *access_token* (query-string) - OAuth access token.
3386 /// * *alt* (query-string) - Data format for response.
3387 /// * *callback* (query-string) - JSONP
3388 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3389 /// * *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.
3390 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3391 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3392 /// * *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.
3393 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3394 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3395 pub fn param<T>(mut self, name: T, value: T) -> ProjectBrandCreateCall<'a, C>
3396 where
3397 T: AsRef<str>,
3398 {
3399 self._additional_params
3400 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3401 self
3402 }
3403
3404 /// Identifies the authorization scope for the method you are building.
3405 ///
3406 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3407 /// [`Scope::CloudPlatform`].
3408 ///
3409 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3410 /// tokens for more than one scope.
3411 ///
3412 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3413 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3414 /// sufficient, a read-write scope will do as well.
3415 pub fn add_scope<St>(mut self, scope: St) -> ProjectBrandCreateCall<'a, C>
3416 where
3417 St: AsRef<str>,
3418 {
3419 self._scopes.insert(String::from(scope.as_ref()));
3420 self
3421 }
3422 /// Identifies the authorization scope(s) for the method you are building.
3423 ///
3424 /// See [`Self::add_scope()`] for details.
3425 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectBrandCreateCall<'a, C>
3426 where
3427 I: IntoIterator<Item = St>,
3428 St: AsRef<str>,
3429 {
3430 self._scopes
3431 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3432 self
3433 }
3434
3435 /// Removes all scopes, and no default scope will be used either.
3436 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3437 /// for details).
3438 pub fn clear_scopes(mut self) -> ProjectBrandCreateCall<'a, C> {
3439 self._scopes.clear();
3440 self
3441 }
3442}
3443
3444/// Retrieves the OAuth brand of the project.
3445///
3446/// A builder for the *brands.get* method supported by a *project* resource.
3447/// It is not used directly, but through a [`ProjectMethods`] instance.
3448///
3449/// # Example
3450///
3451/// Instantiate a resource method builder
3452///
3453/// ```test_harness,no_run
3454/// # extern crate hyper;
3455/// # extern crate hyper_rustls;
3456/// # extern crate google_iap1 as iap1;
3457/// # async fn dox() {
3458/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3459///
3460/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3461/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3462/// # .with_native_roots()
3463/// # .unwrap()
3464/// # .https_only()
3465/// # .enable_http2()
3466/// # .build();
3467///
3468/// # let executor = hyper_util::rt::TokioExecutor::new();
3469/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3470/// # secret,
3471/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3472/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3473/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3474/// # ),
3475/// # ).build().await.unwrap();
3476///
3477/// # let client = hyper_util::client::legacy::Client::builder(
3478/// # hyper_util::rt::TokioExecutor::new()
3479/// # )
3480/// # .build(
3481/// # hyper_rustls::HttpsConnectorBuilder::new()
3482/// # .with_native_roots()
3483/// # .unwrap()
3484/// # .https_or_http()
3485/// # .enable_http2()
3486/// # .build()
3487/// # );
3488/// # let mut hub = CloudIAP::new(client, auth);
3489/// // You can configure optional parameters by calling the respective setters at will, and
3490/// // execute the final call using `doit()`.
3491/// // Values shown here are possibly random and not representative !
3492/// let result = hub.projects().brands_get("name")
3493/// .doit().await;
3494/// # }
3495/// ```
3496pub struct ProjectBrandGetCall<'a, C>
3497where
3498 C: 'a,
3499{
3500 hub: &'a CloudIAP<C>,
3501 _name: String,
3502 _delegate: Option<&'a mut dyn common::Delegate>,
3503 _additional_params: HashMap<String, String>,
3504 _scopes: BTreeSet<String>,
3505}
3506
3507impl<'a, C> common::CallBuilder for ProjectBrandGetCall<'a, C> {}
3508
3509impl<'a, C> ProjectBrandGetCall<'a, C>
3510where
3511 C: common::Connector,
3512{
3513 /// Perform the operation you have build so far.
3514 pub async fn doit(mut self) -> common::Result<(common::Response, Brand)> {
3515 use std::borrow::Cow;
3516 use std::io::{Read, Seek};
3517
3518 use common::{url::Params, ToParts};
3519 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3520
3521 let mut dd = common::DefaultDelegate;
3522 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3523 dlg.begin(common::MethodInfo {
3524 id: "iap.projects.brands.get",
3525 http_method: hyper::Method::GET,
3526 });
3527
3528 for &field in ["alt", "name"].iter() {
3529 if self._additional_params.contains_key(field) {
3530 dlg.finished(false);
3531 return Err(common::Error::FieldClash(field));
3532 }
3533 }
3534
3535 let mut params = Params::with_capacity(3 + self._additional_params.len());
3536 params.push("name", self._name);
3537
3538 params.extend(self._additional_params.iter());
3539
3540 params.push("alt", "json");
3541 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3542 if self._scopes.is_empty() {
3543 self._scopes
3544 .insert(Scope::CloudPlatform.as_ref().to_string());
3545 }
3546
3547 #[allow(clippy::single_element_loop)]
3548 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3549 url = params.uri_replacement(url, param_name, find_this, true);
3550 }
3551 {
3552 let to_remove = ["name"];
3553 params.remove_params(&to_remove);
3554 }
3555
3556 let url = params.parse_with_url(&url);
3557
3558 loop {
3559 let token = match self
3560 .hub
3561 .auth
3562 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3563 .await
3564 {
3565 Ok(token) => token,
3566 Err(e) => match dlg.token(e) {
3567 Ok(token) => token,
3568 Err(e) => {
3569 dlg.finished(false);
3570 return Err(common::Error::MissingToken(e));
3571 }
3572 },
3573 };
3574 let mut req_result = {
3575 let client = &self.hub.client;
3576 dlg.pre_request();
3577 let mut req_builder = hyper::Request::builder()
3578 .method(hyper::Method::GET)
3579 .uri(url.as_str())
3580 .header(USER_AGENT, self.hub._user_agent.clone());
3581
3582 if let Some(token) = token.as_ref() {
3583 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3584 }
3585
3586 let request = req_builder
3587 .header(CONTENT_LENGTH, 0_u64)
3588 .body(common::to_body::<String>(None));
3589
3590 client.request(request.unwrap()).await
3591 };
3592
3593 match req_result {
3594 Err(err) => {
3595 if let common::Retry::After(d) = dlg.http_error(&err) {
3596 sleep(d).await;
3597 continue;
3598 }
3599 dlg.finished(false);
3600 return Err(common::Error::HttpError(err));
3601 }
3602 Ok(res) => {
3603 let (mut parts, body) = res.into_parts();
3604 let mut body = common::Body::new(body);
3605 if !parts.status.is_success() {
3606 let bytes = common::to_bytes(body).await.unwrap_or_default();
3607 let error = serde_json::from_str(&common::to_string(&bytes));
3608 let response = common::to_response(parts, bytes.into());
3609
3610 if let common::Retry::After(d) =
3611 dlg.http_failure(&response, error.as_ref().ok())
3612 {
3613 sleep(d).await;
3614 continue;
3615 }
3616
3617 dlg.finished(false);
3618
3619 return Err(match error {
3620 Ok(value) => common::Error::BadRequest(value),
3621 _ => common::Error::Failure(response),
3622 });
3623 }
3624 let response = {
3625 let bytes = common::to_bytes(body).await.unwrap_or_default();
3626 let encoded = common::to_string(&bytes);
3627 match serde_json::from_str(&encoded) {
3628 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3629 Err(error) => {
3630 dlg.response_json_decode_error(&encoded, &error);
3631 return Err(common::Error::JsonDecodeError(
3632 encoded.to_string(),
3633 error,
3634 ));
3635 }
3636 }
3637 };
3638
3639 dlg.finished(true);
3640 return Ok(response);
3641 }
3642 }
3643 }
3644 }
3645
3646 /// Required. Name of the brand to be fetched. In the following format: projects/{project_number/id}/brands/{brand}.
3647 ///
3648 /// Sets the *name* path property to the given value.
3649 ///
3650 /// Even though the property as already been set when instantiating this call,
3651 /// we provide this method for API completeness.
3652 pub fn name(mut self, new_value: &str) -> ProjectBrandGetCall<'a, C> {
3653 self._name = new_value.to_string();
3654 self
3655 }
3656 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3657 /// while executing the actual API request.
3658 ///
3659 /// ````text
3660 /// It should be used to handle progress information, and to implement a certain level of resilience.
3661 /// ````
3662 ///
3663 /// Sets the *delegate* property to the given value.
3664 pub fn delegate(
3665 mut self,
3666 new_value: &'a mut dyn common::Delegate,
3667 ) -> ProjectBrandGetCall<'a, C> {
3668 self._delegate = Some(new_value);
3669 self
3670 }
3671
3672 /// Set any additional parameter of the query string used in the request.
3673 /// It should be used to set parameters which are not yet available through their own
3674 /// setters.
3675 ///
3676 /// Please note that this method must not be used to set any of the known parameters
3677 /// which have their own setter method. If done anyway, the request will fail.
3678 ///
3679 /// # Additional Parameters
3680 ///
3681 /// * *$.xgafv* (query-string) - V1 error format.
3682 /// * *access_token* (query-string) - OAuth access token.
3683 /// * *alt* (query-string) - Data format for response.
3684 /// * *callback* (query-string) - JSONP
3685 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3686 /// * *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.
3687 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3688 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3689 /// * *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.
3690 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3691 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3692 pub fn param<T>(mut self, name: T, value: T) -> ProjectBrandGetCall<'a, C>
3693 where
3694 T: AsRef<str>,
3695 {
3696 self._additional_params
3697 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3698 self
3699 }
3700
3701 /// Identifies the authorization scope for the method you are building.
3702 ///
3703 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3704 /// [`Scope::CloudPlatform`].
3705 ///
3706 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3707 /// tokens for more than one scope.
3708 ///
3709 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3710 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3711 /// sufficient, a read-write scope will do as well.
3712 pub fn add_scope<St>(mut self, scope: St) -> ProjectBrandGetCall<'a, C>
3713 where
3714 St: AsRef<str>,
3715 {
3716 self._scopes.insert(String::from(scope.as_ref()));
3717 self
3718 }
3719 /// Identifies the authorization scope(s) for the method you are building.
3720 ///
3721 /// See [`Self::add_scope()`] for details.
3722 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectBrandGetCall<'a, C>
3723 where
3724 I: IntoIterator<Item = St>,
3725 St: AsRef<str>,
3726 {
3727 self._scopes
3728 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3729 self
3730 }
3731
3732 /// Removes all scopes, and no default scope will be used either.
3733 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3734 /// for details).
3735 pub fn clear_scopes(mut self) -> ProjectBrandGetCall<'a, C> {
3736 self._scopes.clear();
3737 self
3738 }
3739}
3740
3741/// Lists the existing brands for the project.
3742///
3743/// A builder for the *brands.list* method supported by a *project* resource.
3744/// It is not used directly, but through a [`ProjectMethods`] instance.
3745///
3746/// # Example
3747///
3748/// Instantiate a resource method builder
3749///
3750/// ```test_harness,no_run
3751/// # extern crate hyper;
3752/// # extern crate hyper_rustls;
3753/// # extern crate google_iap1 as iap1;
3754/// # async fn dox() {
3755/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3756///
3757/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3758/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3759/// # .with_native_roots()
3760/// # .unwrap()
3761/// # .https_only()
3762/// # .enable_http2()
3763/// # .build();
3764///
3765/// # let executor = hyper_util::rt::TokioExecutor::new();
3766/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3767/// # secret,
3768/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3769/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3770/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3771/// # ),
3772/// # ).build().await.unwrap();
3773///
3774/// # let client = hyper_util::client::legacy::Client::builder(
3775/// # hyper_util::rt::TokioExecutor::new()
3776/// # )
3777/// # .build(
3778/// # hyper_rustls::HttpsConnectorBuilder::new()
3779/// # .with_native_roots()
3780/// # .unwrap()
3781/// # .https_or_http()
3782/// # .enable_http2()
3783/// # .build()
3784/// # );
3785/// # let mut hub = CloudIAP::new(client, auth);
3786/// // You can configure optional parameters by calling the respective setters at will, and
3787/// // execute the final call using `doit()`.
3788/// // Values shown here are possibly random and not representative !
3789/// let result = hub.projects().brands_list("parent")
3790/// .doit().await;
3791/// # }
3792/// ```
3793pub struct ProjectBrandListCall<'a, C>
3794where
3795 C: 'a,
3796{
3797 hub: &'a CloudIAP<C>,
3798 _parent: String,
3799 _delegate: Option<&'a mut dyn common::Delegate>,
3800 _additional_params: HashMap<String, String>,
3801 _scopes: BTreeSet<String>,
3802}
3803
3804impl<'a, C> common::CallBuilder for ProjectBrandListCall<'a, C> {}
3805
3806impl<'a, C> ProjectBrandListCall<'a, C>
3807where
3808 C: common::Connector,
3809{
3810 /// Perform the operation you have build so far.
3811 pub async fn doit(mut self) -> common::Result<(common::Response, ListBrandsResponse)> {
3812 use std::borrow::Cow;
3813 use std::io::{Read, Seek};
3814
3815 use common::{url::Params, ToParts};
3816 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3817
3818 let mut dd = common::DefaultDelegate;
3819 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3820 dlg.begin(common::MethodInfo {
3821 id: "iap.projects.brands.list",
3822 http_method: hyper::Method::GET,
3823 });
3824
3825 for &field in ["alt", "parent"].iter() {
3826 if self._additional_params.contains_key(field) {
3827 dlg.finished(false);
3828 return Err(common::Error::FieldClash(field));
3829 }
3830 }
3831
3832 let mut params = Params::with_capacity(3 + self._additional_params.len());
3833 params.push("parent", self._parent);
3834
3835 params.extend(self._additional_params.iter());
3836
3837 params.push("alt", "json");
3838 let mut url = self.hub._base_url.clone() + "v1/{+parent}/brands";
3839 if self._scopes.is_empty() {
3840 self._scopes
3841 .insert(Scope::CloudPlatform.as_ref().to_string());
3842 }
3843
3844 #[allow(clippy::single_element_loop)]
3845 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3846 url = params.uri_replacement(url, param_name, find_this, true);
3847 }
3848 {
3849 let to_remove = ["parent"];
3850 params.remove_params(&to_remove);
3851 }
3852
3853 let url = params.parse_with_url(&url);
3854
3855 loop {
3856 let token = match self
3857 .hub
3858 .auth
3859 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3860 .await
3861 {
3862 Ok(token) => token,
3863 Err(e) => match dlg.token(e) {
3864 Ok(token) => token,
3865 Err(e) => {
3866 dlg.finished(false);
3867 return Err(common::Error::MissingToken(e));
3868 }
3869 },
3870 };
3871 let mut req_result = {
3872 let client = &self.hub.client;
3873 dlg.pre_request();
3874 let mut req_builder = hyper::Request::builder()
3875 .method(hyper::Method::GET)
3876 .uri(url.as_str())
3877 .header(USER_AGENT, self.hub._user_agent.clone());
3878
3879 if let Some(token) = token.as_ref() {
3880 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3881 }
3882
3883 let request = req_builder
3884 .header(CONTENT_LENGTH, 0_u64)
3885 .body(common::to_body::<String>(None));
3886
3887 client.request(request.unwrap()).await
3888 };
3889
3890 match req_result {
3891 Err(err) => {
3892 if let common::Retry::After(d) = dlg.http_error(&err) {
3893 sleep(d).await;
3894 continue;
3895 }
3896 dlg.finished(false);
3897 return Err(common::Error::HttpError(err));
3898 }
3899 Ok(res) => {
3900 let (mut parts, body) = res.into_parts();
3901 let mut body = common::Body::new(body);
3902 if !parts.status.is_success() {
3903 let bytes = common::to_bytes(body).await.unwrap_or_default();
3904 let error = serde_json::from_str(&common::to_string(&bytes));
3905 let response = common::to_response(parts, bytes.into());
3906
3907 if let common::Retry::After(d) =
3908 dlg.http_failure(&response, error.as_ref().ok())
3909 {
3910 sleep(d).await;
3911 continue;
3912 }
3913
3914 dlg.finished(false);
3915
3916 return Err(match error {
3917 Ok(value) => common::Error::BadRequest(value),
3918 _ => common::Error::Failure(response),
3919 });
3920 }
3921 let response = {
3922 let bytes = common::to_bytes(body).await.unwrap_or_default();
3923 let encoded = common::to_string(&bytes);
3924 match serde_json::from_str(&encoded) {
3925 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3926 Err(error) => {
3927 dlg.response_json_decode_error(&encoded, &error);
3928 return Err(common::Error::JsonDecodeError(
3929 encoded.to_string(),
3930 error,
3931 ));
3932 }
3933 }
3934 };
3935
3936 dlg.finished(true);
3937 return Ok(response);
3938 }
3939 }
3940 }
3941 }
3942
3943 /// Required. GCP Project number/id. In the following format: projects/{project_number/id}.
3944 ///
3945 /// Sets the *parent* path property to the given value.
3946 ///
3947 /// Even though the property as already been set when instantiating this call,
3948 /// we provide this method for API completeness.
3949 pub fn parent(mut self, new_value: &str) -> ProjectBrandListCall<'a, C> {
3950 self._parent = new_value.to_string();
3951 self
3952 }
3953 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3954 /// while executing the actual API request.
3955 ///
3956 /// ````text
3957 /// It should be used to handle progress information, and to implement a certain level of resilience.
3958 /// ````
3959 ///
3960 /// Sets the *delegate* property to the given value.
3961 pub fn delegate(
3962 mut self,
3963 new_value: &'a mut dyn common::Delegate,
3964 ) -> ProjectBrandListCall<'a, C> {
3965 self._delegate = Some(new_value);
3966 self
3967 }
3968
3969 /// Set any additional parameter of the query string used in the request.
3970 /// It should be used to set parameters which are not yet available through their own
3971 /// setters.
3972 ///
3973 /// Please note that this method must not be used to set any of the known parameters
3974 /// which have their own setter method. If done anyway, the request will fail.
3975 ///
3976 /// # Additional Parameters
3977 ///
3978 /// * *$.xgafv* (query-string) - V1 error format.
3979 /// * *access_token* (query-string) - OAuth access token.
3980 /// * *alt* (query-string) - Data format for response.
3981 /// * *callback* (query-string) - JSONP
3982 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3983 /// * *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.
3984 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3985 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3986 /// * *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.
3987 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3988 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3989 pub fn param<T>(mut self, name: T, value: T) -> ProjectBrandListCall<'a, C>
3990 where
3991 T: AsRef<str>,
3992 {
3993 self._additional_params
3994 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3995 self
3996 }
3997
3998 /// Identifies the authorization scope for the method you are building.
3999 ///
4000 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4001 /// [`Scope::CloudPlatform`].
4002 ///
4003 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4004 /// tokens for more than one scope.
4005 ///
4006 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4007 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4008 /// sufficient, a read-write scope will do as well.
4009 pub fn add_scope<St>(mut self, scope: St) -> ProjectBrandListCall<'a, C>
4010 where
4011 St: AsRef<str>,
4012 {
4013 self._scopes.insert(String::from(scope.as_ref()));
4014 self
4015 }
4016 /// Identifies the authorization scope(s) for the method you are building.
4017 ///
4018 /// See [`Self::add_scope()`] for details.
4019 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectBrandListCall<'a, C>
4020 where
4021 I: IntoIterator<Item = St>,
4022 St: AsRef<str>,
4023 {
4024 self._scopes
4025 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4026 self
4027 }
4028
4029 /// Removes all scopes, and no default scope will be used either.
4030 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4031 /// for details).
4032 pub fn clear_scopes(mut self) -> ProjectBrandListCall<'a, C> {
4033 self._scopes.clear();
4034 self
4035 }
4036}
4037
4038/// Creates a new TunnelDestGroup.
4039///
4040/// A builder for the *iap_tunnel.locations.destGroups.create* method supported by a *project* resource.
4041/// It is not used directly, but through a [`ProjectMethods`] instance.
4042///
4043/// # Example
4044///
4045/// Instantiate a resource method builder
4046///
4047/// ```test_harness,no_run
4048/// # extern crate hyper;
4049/// # extern crate hyper_rustls;
4050/// # extern crate google_iap1 as iap1;
4051/// use iap1::api::TunnelDestGroup;
4052/// # async fn dox() {
4053/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4054///
4055/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4056/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4057/// # .with_native_roots()
4058/// # .unwrap()
4059/// # .https_only()
4060/// # .enable_http2()
4061/// # .build();
4062///
4063/// # let executor = hyper_util::rt::TokioExecutor::new();
4064/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4065/// # secret,
4066/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4067/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4068/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4069/// # ),
4070/// # ).build().await.unwrap();
4071///
4072/// # let client = hyper_util::client::legacy::Client::builder(
4073/// # hyper_util::rt::TokioExecutor::new()
4074/// # )
4075/// # .build(
4076/// # hyper_rustls::HttpsConnectorBuilder::new()
4077/// # .with_native_roots()
4078/// # .unwrap()
4079/// # .https_or_http()
4080/// # .enable_http2()
4081/// # .build()
4082/// # );
4083/// # let mut hub = CloudIAP::new(client, auth);
4084/// // As the method needs a request, you would usually fill it with the desired information
4085/// // into the respective structure. Some of the parts shown here might not be applicable !
4086/// // Values shown here are possibly random and not representative !
4087/// let mut req = TunnelDestGroup::default();
4088///
4089/// // You can configure optional parameters by calling the respective setters at will, and
4090/// // execute the final call using `doit()`.
4091/// // Values shown here are possibly random and not representative !
4092/// let result = hub.projects().iap_tunnel_locations_dest_groups_create(req, "parent")
4093/// .tunnel_dest_group_id("Lorem")
4094/// .doit().await;
4095/// # }
4096/// ```
4097pub struct ProjectIapTunnelLocationDestGroupCreateCall<'a, C>
4098where
4099 C: 'a,
4100{
4101 hub: &'a CloudIAP<C>,
4102 _request: TunnelDestGroup,
4103 _parent: String,
4104 _tunnel_dest_group_id: Option<String>,
4105 _delegate: Option<&'a mut dyn common::Delegate>,
4106 _additional_params: HashMap<String, String>,
4107 _scopes: BTreeSet<String>,
4108}
4109
4110impl<'a, C> common::CallBuilder for ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {}
4111
4112impl<'a, C> ProjectIapTunnelLocationDestGroupCreateCall<'a, C>
4113where
4114 C: common::Connector,
4115{
4116 /// Perform the operation you have build so far.
4117 pub async fn doit(mut self) -> common::Result<(common::Response, TunnelDestGroup)> {
4118 use std::borrow::Cow;
4119 use std::io::{Read, Seek};
4120
4121 use common::{url::Params, ToParts};
4122 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4123
4124 let mut dd = common::DefaultDelegate;
4125 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4126 dlg.begin(common::MethodInfo {
4127 id: "iap.projects.iap_tunnel.locations.destGroups.create",
4128 http_method: hyper::Method::POST,
4129 });
4130
4131 for &field in ["alt", "parent", "tunnelDestGroupId"].iter() {
4132 if self._additional_params.contains_key(field) {
4133 dlg.finished(false);
4134 return Err(common::Error::FieldClash(field));
4135 }
4136 }
4137
4138 let mut params = Params::with_capacity(5 + self._additional_params.len());
4139 params.push("parent", self._parent);
4140 if let Some(value) = self._tunnel_dest_group_id.as_ref() {
4141 params.push("tunnelDestGroupId", value);
4142 }
4143
4144 params.extend(self._additional_params.iter());
4145
4146 params.push("alt", "json");
4147 let mut url = self.hub._base_url.clone() + "v1/{+parent}/destGroups";
4148 if self._scopes.is_empty() {
4149 self._scopes
4150 .insert(Scope::CloudPlatform.as_ref().to_string());
4151 }
4152
4153 #[allow(clippy::single_element_loop)]
4154 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4155 url = params.uri_replacement(url, param_name, find_this, true);
4156 }
4157 {
4158 let to_remove = ["parent"];
4159 params.remove_params(&to_remove);
4160 }
4161
4162 let url = params.parse_with_url(&url);
4163
4164 let mut json_mime_type = mime::APPLICATION_JSON;
4165 let mut request_value_reader = {
4166 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4167 common::remove_json_null_values(&mut value);
4168 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4169 serde_json::to_writer(&mut dst, &value).unwrap();
4170 dst
4171 };
4172 let request_size = request_value_reader
4173 .seek(std::io::SeekFrom::End(0))
4174 .unwrap();
4175 request_value_reader
4176 .seek(std::io::SeekFrom::Start(0))
4177 .unwrap();
4178
4179 loop {
4180 let token = match self
4181 .hub
4182 .auth
4183 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4184 .await
4185 {
4186 Ok(token) => token,
4187 Err(e) => match dlg.token(e) {
4188 Ok(token) => token,
4189 Err(e) => {
4190 dlg.finished(false);
4191 return Err(common::Error::MissingToken(e));
4192 }
4193 },
4194 };
4195 request_value_reader
4196 .seek(std::io::SeekFrom::Start(0))
4197 .unwrap();
4198 let mut req_result = {
4199 let client = &self.hub.client;
4200 dlg.pre_request();
4201 let mut req_builder = hyper::Request::builder()
4202 .method(hyper::Method::POST)
4203 .uri(url.as_str())
4204 .header(USER_AGENT, self.hub._user_agent.clone());
4205
4206 if let Some(token) = token.as_ref() {
4207 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4208 }
4209
4210 let request = req_builder
4211 .header(CONTENT_TYPE, json_mime_type.to_string())
4212 .header(CONTENT_LENGTH, request_size as u64)
4213 .body(common::to_body(
4214 request_value_reader.get_ref().clone().into(),
4215 ));
4216
4217 client.request(request.unwrap()).await
4218 };
4219
4220 match req_result {
4221 Err(err) => {
4222 if let common::Retry::After(d) = dlg.http_error(&err) {
4223 sleep(d).await;
4224 continue;
4225 }
4226 dlg.finished(false);
4227 return Err(common::Error::HttpError(err));
4228 }
4229 Ok(res) => {
4230 let (mut parts, body) = res.into_parts();
4231 let mut body = common::Body::new(body);
4232 if !parts.status.is_success() {
4233 let bytes = common::to_bytes(body).await.unwrap_or_default();
4234 let error = serde_json::from_str(&common::to_string(&bytes));
4235 let response = common::to_response(parts, bytes.into());
4236
4237 if let common::Retry::After(d) =
4238 dlg.http_failure(&response, error.as_ref().ok())
4239 {
4240 sleep(d).await;
4241 continue;
4242 }
4243
4244 dlg.finished(false);
4245
4246 return Err(match error {
4247 Ok(value) => common::Error::BadRequest(value),
4248 _ => common::Error::Failure(response),
4249 });
4250 }
4251 let response = {
4252 let bytes = common::to_bytes(body).await.unwrap_or_default();
4253 let encoded = common::to_string(&bytes);
4254 match serde_json::from_str(&encoded) {
4255 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4256 Err(error) => {
4257 dlg.response_json_decode_error(&encoded, &error);
4258 return Err(common::Error::JsonDecodeError(
4259 encoded.to_string(),
4260 error,
4261 ));
4262 }
4263 }
4264 };
4265
4266 dlg.finished(true);
4267 return Ok(response);
4268 }
4269 }
4270 }
4271 }
4272
4273 ///
4274 /// Sets the *request* property to the given value.
4275 ///
4276 /// Even though the property as already been set when instantiating this call,
4277 /// we provide this method for API completeness.
4278 pub fn request(
4279 mut self,
4280 new_value: TunnelDestGroup,
4281 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
4282 self._request = new_value;
4283 self
4284 }
4285 /// Required. Google Cloud Project ID and location. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}`.
4286 ///
4287 /// Sets the *parent* path property to the given value.
4288 ///
4289 /// Even though the property as already been set when instantiating this call,
4290 /// we provide this method for API completeness.
4291 pub fn parent(mut self, new_value: &str) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
4292 self._parent = new_value.to_string();
4293 self
4294 }
4295 /// Required. The ID to use for the TunnelDestGroup, which becomes the final component of the resource name. This value must be 4-63 characters, and valid characters are `[a-z]-`.
4296 ///
4297 /// Sets the *tunnel dest group id* query property to the given value.
4298 pub fn tunnel_dest_group_id(
4299 mut self,
4300 new_value: &str,
4301 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
4302 self._tunnel_dest_group_id = Some(new_value.to_string());
4303 self
4304 }
4305 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4306 /// while executing the actual API request.
4307 ///
4308 /// ````text
4309 /// It should be used to handle progress information, and to implement a certain level of resilience.
4310 /// ````
4311 ///
4312 /// Sets the *delegate* property to the given value.
4313 pub fn delegate(
4314 mut self,
4315 new_value: &'a mut dyn common::Delegate,
4316 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
4317 self._delegate = Some(new_value);
4318 self
4319 }
4320
4321 /// Set any additional parameter of the query string used in the request.
4322 /// It should be used to set parameters which are not yet available through their own
4323 /// setters.
4324 ///
4325 /// Please note that this method must not be used to set any of the known parameters
4326 /// which have their own setter method. If done anyway, the request will fail.
4327 ///
4328 /// # Additional Parameters
4329 ///
4330 /// * *$.xgafv* (query-string) - V1 error format.
4331 /// * *access_token* (query-string) - OAuth access token.
4332 /// * *alt* (query-string) - Data format for response.
4333 /// * *callback* (query-string) - JSONP
4334 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4335 /// * *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.
4336 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4337 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4338 /// * *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.
4339 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4340 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4341 pub fn param<T>(
4342 mut self,
4343 name: T,
4344 value: T,
4345 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C>
4346 where
4347 T: AsRef<str>,
4348 {
4349 self._additional_params
4350 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4351 self
4352 }
4353
4354 /// Identifies the authorization scope for the method you are building.
4355 ///
4356 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4357 /// [`Scope::CloudPlatform`].
4358 ///
4359 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4360 /// tokens for more than one scope.
4361 ///
4362 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4363 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4364 /// sufficient, a read-write scope will do as well.
4365 pub fn add_scope<St>(mut self, scope: St) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C>
4366 where
4367 St: AsRef<str>,
4368 {
4369 self._scopes.insert(String::from(scope.as_ref()));
4370 self
4371 }
4372 /// Identifies the authorization scope(s) for the method you are building.
4373 ///
4374 /// See [`Self::add_scope()`] for details.
4375 pub fn add_scopes<I, St>(
4376 mut self,
4377 scopes: I,
4378 ) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C>
4379 where
4380 I: IntoIterator<Item = St>,
4381 St: AsRef<str>,
4382 {
4383 self._scopes
4384 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4385 self
4386 }
4387
4388 /// Removes all scopes, and no default scope will be used either.
4389 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4390 /// for details).
4391 pub fn clear_scopes(mut self) -> ProjectIapTunnelLocationDestGroupCreateCall<'a, C> {
4392 self._scopes.clear();
4393 self
4394 }
4395}
4396
4397/// Deletes a TunnelDestGroup.
4398///
4399/// A builder for the *iap_tunnel.locations.destGroups.delete* method supported by a *project* resource.
4400/// It is not used directly, but through a [`ProjectMethods`] instance.
4401///
4402/// # Example
4403///
4404/// Instantiate a resource method builder
4405///
4406/// ```test_harness,no_run
4407/// # extern crate hyper;
4408/// # extern crate hyper_rustls;
4409/// # extern crate google_iap1 as iap1;
4410/// # async fn dox() {
4411/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4412///
4413/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4414/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4415/// # .with_native_roots()
4416/// # .unwrap()
4417/// # .https_only()
4418/// # .enable_http2()
4419/// # .build();
4420///
4421/// # let executor = hyper_util::rt::TokioExecutor::new();
4422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4423/// # secret,
4424/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4425/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4426/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4427/// # ),
4428/// # ).build().await.unwrap();
4429///
4430/// # let client = hyper_util::client::legacy::Client::builder(
4431/// # hyper_util::rt::TokioExecutor::new()
4432/// # )
4433/// # .build(
4434/// # hyper_rustls::HttpsConnectorBuilder::new()
4435/// # .with_native_roots()
4436/// # .unwrap()
4437/// # .https_or_http()
4438/// # .enable_http2()
4439/// # .build()
4440/// # );
4441/// # let mut hub = CloudIAP::new(client, auth);
4442/// // You can configure optional parameters by calling the respective setters at will, and
4443/// // execute the final call using `doit()`.
4444/// // Values shown here are possibly random and not representative !
4445/// let result = hub.projects().iap_tunnel_locations_dest_groups_delete("name")
4446/// .doit().await;
4447/// # }
4448/// ```
4449pub struct ProjectIapTunnelLocationDestGroupDeleteCall<'a, C>
4450where
4451 C: 'a,
4452{
4453 hub: &'a CloudIAP<C>,
4454 _name: String,
4455 _delegate: Option<&'a mut dyn common::Delegate>,
4456 _additional_params: HashMap<String, String>,
4457 _scopes: BTreeSet<String>,
4458}
4459
4460impl<'a, C> common::CallBuilder for ProjectIapTunnelLocationDestGroupDeleteCall<'a, C> {}
4461
4462impl<'a, C> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C>
4463where
4464 C: common::Connector,
4465{
4466 /// Perform the operation you have build so far.
4467 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4468 use std::borrow::Cow;
4469 use std::io::{Read, Seek};
4470
4471 use common::{url::Params, ToParts};
4472 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4473
4474 let mut dd = common::DefaultDelegate;
4475 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4476 dlg.begin(common::MethodInfo {
4477 id: "iap.projects.iap_tunnel.locations.destGroups.delete",
4478 http_method: hyper::Method::DELETE,
4479 });
4480
4481 for &field in ["alt", "name"].iter() {
4482 if self._additional_params.contains_key(field) {
4483 dlg.finished(false);
4484 return Err(common::Error::FieldClash(field));
4485 }
4486 }
4487
4488 let mut params = Params::with_capacity(3 + self._additional_params.len());
4489 params.push("name", self._name);
4490
4491 params.extend(self._additional_params.iter());
4492
4493 params.push("alt", "json");
4494 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4495 if self._scopes.is_empty() {
4496 self._scopes
4497 .insert(Scope::CloudPlatform.as_ref().to_string());
4498 }
4499
4500 #[allow(clippy::single_element_loop)]
4501 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4502 url = params.uri_replacement(url, param_name, find_this, true);
4503 }
4504 {
4505 let to_remove = ["name"];
4506 params.remove_params(&to_remove);
4507 }
4508
4509 let url = params.parse_with_url(&url);
4510
4511 loop {
4512 let token = match self
4513 .hub
4514 .auth
4515 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4516 .await
4517 {
4518 Ok(token) => token,
4519 Err(e) => match dlg.token(e) {
4520 Ok(token) => token,
4521 Err(e) => {
4522 dlg.finished(false);
4523 return Err(common::Error::MissingToken(e));
4524 }
4525 },
4526 };
4527 let mut req_result = {
4528 let client = &self.hub.client;
4529 dlg.pre_request();
4530 let mut req_builder = hyper::Request::builder()
4531 .method(hyper::Method::DELETE)
4532 .uri(url.as_str())
4533 .header(USER_AGENT, self.hub._user_agent.clone());
4534
4535 if let Some(token) = token.as_ref() {
4536 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4537 }
4538
4539 let request = req_builder
4540 .header(CONTENT_LENGTH, 0_u64)
4541 .body(common::to_body::<String>(None));
4542
4543 client.request(request.unwrap()).await
4544 };
4545
4546 match req_result {
4547 Err(err) => {
4548 if let common::Retry::After(d) = dlg.http_error(&err) {
4549 sleep(d).await;
4550 continue;
4551 }
4552 dlg.finished(false);
4553 return Err(common::Error::HttpError(err));
4554 }
4555 Ok(res) => {
4556 let (mut parts, body) = res.into_parts();
4557 let mut body = common::Body::new(body);
4558 if !parts.status.is_success() {
4559 let bytes = common::to_bytes(body).await.unwrap_or_default();
4560 let error = serde_json::from_str(&common::to_string(&bytes));
4561 let response = common::to_response(parts, bytes.into());
4562
4563 if let common::Retry::After(d) =
4564 dlg.http_failure(&response, error.as_ref().ok())
4565 {
4566 sleep(d).await;
4567 continue;
4568 }
4569
4570 dlg.finished(false);
4571
4572 return Err(match error {
4573 Ok(value) => common::Error::BadRequest(value),
4574 _ => common::Error::Failure(response),
4575 });
4576 }
4577 let response = {
4578 let bytes = common::to_bytes(body).await.unwrap_or_default();
4579 let encoded = common::to_string(&bytes);
4580 match serde_json::from_str(&encoded) {
4581 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4582 Err(error) => {
4583 dlg.response_json_decode_error(&encoded, &error);
4584 return Err(common::Error::JsonDecodeError(
4585 encoded.to_string(),
4586 error,
4587 ));
4588 }
4589 }
4590 };
4591
4592 dlg.finished(true);
4593 return Ok(response);
4594 }
4595 }
4596 }
4597 }
4598
4599 /// Required. Name of the TunnelDestGroup to delete. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`.
4600 ///
4601 /// Sets the *name* path property to the given value.
4602 ///
4603 /// Even though the property as already been set when instantiating this call,
4604 /// we provide this method for API completeness.
4605 pub fn name(mut self, new_value: &str) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C> {
4606 self._name = new_value.to_string();
4607 self
4608 }
4609 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4610 /// while executing the actual API request.
4611 ///
4612 /// ````text
4613 /// It should be used to handle progress information, and to implement a certain level of resilience.
4614 /// ````
4615 ///
4616 /// Sets the *delegate* property to the given value.
4617 pub fn delegate(
4618 mut self,
4619 new_value: &'a mut dyn common::Delegate,
4620 ) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C> {
4621 self._delegate = Some(new_value);
4622 self
4623 }
4624
4625 /// Set any additional parameter of the query string used in the request.
4626 /// It should be used to set parameters which are not yet available through their own
4627 /// setters.
4628 ///
4629 /// Please note that this method must not be used to set any of the known parameters
4630 /// which have their own setter method. If done anyway, the request will fail.
4631 ///
4632 /// # Additional Parameters
4633 ///
4634 /// * *$.xgafv* (query-string) - V1 error format.
4635 /// * *access_token* (query-string) - OAuth access token.
4636 /// * *alt* (query-string) - Data format for response.
4637 /// * *callback* (query-string) - JSONP
4638 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4639 /// * *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.
4640 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4641 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4642 /// * *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.
4643 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4644 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4645 pub fn param<T>(
4646 mut self,
4647 name: T,
4648 value: T,
4649 ) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C>
4650 where
4651 T: AsRef<str>,
4652 {
4653 self._additional_params
4654 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4655 self
4656 }
4657
4658 /// Identifies the authorization scope for the method you are building.
4659 ///
4660 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4661 /// [`Scope::CloudPlatform`].
4662 ///
4663 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4664 /// tokens for more than one scope.
4665 ///
4666 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4667 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4668 /// sufficient, a read-write scope will do as well.
4669 pub fn add_scope<St>(mut self, scope: St) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C>
4670 where
4671 St: AsRef<str>,
4672 {
4673 self._scopes.insert(String::from(scope.as_ref()));
4674 self
4675 }
4676 /// Identifies the authorization scope(s) for the method you are building.
4677 ///
4678 /// See [`Self::add_scope()`] for details.
4679 pub fn add_scopes<I, St>(
4680 mut self,
4681 scopes: I,
4682 ) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C>
4683 where
4684 I: IntoIterator<Item = St>,
4685 St: AsRef<str>,
4686 {
4687 self._scopes
4688 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4689 self
4690 }
4691
4692 /// Removes all scopes, and no default scope will be used either.
4693 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4694 /// for details).
4695 pub fn clear_scopes(mut self) -> ProjectIapTunnelLocationDestGroupDeleteCall<'a, C> {
4696 self._scopes.clear();
4697 self
4698 }
4699}
4700
4701/// Retrieves an existing TunnelDestGroup.
4702///
4703/// A builder for the *iap_tunnel.locations.destGroups.get* method supported by a *project* resource.
4704/// It is not used directly, but through a [`ProjectMethods`] instance.
4705///
4706/// # Example
4707///
4708/// Instantiate a resource method builder
4709///
4710/// ```test_harness,no_run
4711/// # extern crate hyper;
4712/// # extern crate hyper_rustls;
4713/// # extern crate google_iap1 as iap1;
4714/// # async fn dox() {
4715/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4716///
4717/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4718/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4719/// # .with_native_roots()
4720/// # .unwrap()
4721/// # .https_only()
4722/// # .enable_http2()
4723/// # .build();
4724///
4725/// # let executor = hyper_util::rt::TokioExecutor::new();
4726/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4727/// # secret,
4728/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4729/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4730/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4731/// # ),
4732/// # ).build().await.unwrap();
4733///
4734/// # let client = hyper_util::client::legacy::Client::builder(
4735/// # hyper_util::rt::TokioExecutor::new()
4736/// # )
4737/// # .build(
4738/// # hyper_rustls::HttpsConnectorBuilder::new()
4739/// # .with_native_roots()
4740/// # .unwrap()
4741/// # .https_or_http()
4742/// # .enable_http2()
4743/// # .build()
4744/// # );
4745/// # let mut hub = CloudIAP::new(client, auth);
4746/// // You can configure optional parameters by calling the respective setters at will, and
4747/// // execute the final call using `doit()`.
4748/// // Values shown here are possibly random and not representative !
4749/// let result = hub.projects().iap_tunnel_locations_dest_groups_get("name")
4750/// .doit().await;
4751/// # }
4752/// ```
4753pub struct ProjectIapTunnelLocationDestGroupGetCall<'a, C>
4754where
4755 C: 'a,
4756{
4757 hub: &'a CloudIAP<C>,
4758 _name: String,
4759 _delegate: Option<&'a mut dyn common::Delegate>,
4760 _additional_params: HashMap<String, String>,
4761 _scopes: BTreeSet<String>,
4762}
4763
4764impl<'a, C> common::CallBuilder for ProjectIapTunnelLocationDestGroupGetCall<'a, C> {}
4765
4766impl<'a, C> ProjectIapTunnelLocationDestGroupGetCall<'a, C>
4767where
4768 C: common::Connector,
4769{
4770 /// Perform the operation you have build so far.
4771 pub async fn doit(mut self) -> common::Result<(common::Response, TunnelDestGroup)> {
4772 use std::borrow::Cow;
4773 use std::io::{Read, Seek};
4774
4775 use common::{url::Params, ToParts};
4776 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4777
4778 let mut dd = common::DefaultDelegate;
4779 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4780 dlg.begin(common::MethodInfo {
4781 id: "iap.projects.iap_tunnel.locations.destGroups.get",
4782 http_method: hyper::Method::GET,
4783 });
4784
4785 for &field in ["alt", "name"].iter() {
4786 if self._additional_params.contains_key(field) {
4787 dlg.finished(false);
4788 return Err(common::Error::FieldClash(field));
4789 }
4790 }
4791
4792 let mut params = Params::with_capacity(3 + self._additional_params.len());
4793 params.push("name", self._name);
4794
4795 params.extend(self._additional_params.iter());
4796
4797 params.push("alt", "json");
4798 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4799 if self._scopes.is_empty() {
4800 self._scopes
4801 .insert(Scope::CloudPlatform.as_ref().to_string());
4802 }
4803
4804 #[allow(clippy::single_element_loop)]
4805 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4806 url = params.uri_replacement(url, param_name, find_this, true);
4807 }
4808 {
4809 let to_remove = ["name"];
4810 params.remove_params(&to_remove);
4811 }
4812
4813 let url = params.parse_with_url(&url);
4814
4815 loop {
4816 let token = match self
4817 .hub
4818 .auth
4819 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4820 .await
4821 {
4822 Ok(token) => token,
4823 Err(e) => match dlg.token(e) {
4824 Ok(token) => token,
4825 Err(e) => {
4826 dlg.finished(false);
4827 return Err(common::Error::MissingToken(e));
4828 }
4829 },
4830 };
4831 let mut req_result = {
4832 let client = &self.hub.client;
4833 dlg.pre_request();
4834 let mut req_builder = hyper::Request::builder()
4835 .method(hyper::Method::GET)
4836 .uri(url.as_str())
4837 .header(USER_AGENT, self.hub._user_agent.clone());
4838
4839 if let Some(token) = token.as_ref() {
4840 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4841 }
4842
4843 let request = req_builder
4844 .header(CONTENT_LENGTH, 0_u64)
4845 .body(common::to_body::<String>(None));
4846
4847 client.request(request.unwrap()).await
4848 };
4849
4850 match req_result {
4851 Err(err) => {
4852 if let common::Retry::After(d) = dlg.http_error(&err) {
4853 sleep(d).await;
4854 continue;
4855 }
4856 dlg.finished(false);
4857 return Err(common::Error::HttpError(err));
4858 }
4859 Ok(res) => {
4860 let (mut parts, body) = res.into_parts();
4861 let mut body = common::Body::new(body);
4862 if !parts.status.is_success() {
4863 let bytes = common::to_bytes(body).await.unwrap_or_default();
4864 let error = serde_json::from_str(&common::to_string(&bytes));
4865 let response = common::to_response(parts, bytes.into());
4866
4867 if let common::Retry::After(d) =
4868 dlg.http_failure(&response, error.as_ref().ok())
4869 {
4870 sleep(d).await;
4871 continue;
4872 }
4873
4874 dlg.finished(false);
4875
4876 return Err(match error {
4877 Ok(value) => common::Error::BadRequest(value),
4878 _ => common::Error::Failure(response),
4879 });
4880 }
4881 let response = {
4882 let bytes = common::to_bytes(body).await.unwrap_or_default();
4883 let encoded = common::to_string(&bytes);
4884 match serde_json::from_str(&encoded) {
4885 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4886 Err(error) => {
4887 dlg.response_json_decode_error(&encoded, &error);
4888 return Err(common::Error::JsonDecodeError(
4889 encoded.to_string(),
4890 error,
4891 ));
4892 }
4893 }
4894 };
4895
4896 dlg.finished(true);
4897 return Ok(response);
4898 }
4899 }
4900 }
4901 }
4902
4903 /// Required. Name of the TunnelDestGroup to be fetched. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}/destGroups/{dest_group}`.
4904 ///
4905 /// Sets the *name* path property to the given value.
4906 ///
4907 /// Even though the property as already been set when instantiating this call,
4908 /// we provide this method for API completeness.
4909 pub fn name(mut self, new_value: &str) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C> {
4910 self._name = new_value.to_string();
4911 self
4912 }
4913 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4914 /// while executing the actual API request.
4915 ///
4916 /// ````text
4917 /// It should be used to handle progress information, and to implement a certain level of resilience.
4918 /// ````
4919 ///
4920 /// Sets the *delegate* property to the given value.
4921 pub fn delegate(
4922 mut self,
4923 new_value: &'a mut dyn common::Delegate,
4924 ) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C> {
4925 self._delegate = Some(new_value);
4926 self
4927 }
4928
4929 /// Set any additional parameter of the query string used in the request.
4930 /// It should be used to set parameters which are not yet available through their own
4931 /// setters.
4932 ///
4933 /// Please note that this method must not be used to set any of the known parameters
4934 /// which have their own setter method. If done anyway, the request will fail.
4935 ///
4936 /// # Additional Parameters
4937 ///
4938 /// * *$.xgafv* (query-string) - V1 error format.
4939 /// * *access_token* (query-string) - OAuth access token.
4940 /// * *alt* (query-string) - Data format for response.
4941 /// * *callback* (query-string) - JSONP
4942 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4943 /// * *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.
4944 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4945 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4946 /// * *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.
4947 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4948 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4949 pub fn param<T>(mut self, name: T, value: T) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C>
4950 where
4951 T: AsRef<str>,
4952 {
4953 self._additional_params
4954 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4955 self
4956 }
4957
4958 /// Identifies the authorization scope for the method you are building.
4959 ///
4960 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4961 /// [`Scope::CloudPlatform`].
4962 ///
4963 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4964 /// tokens for more than one scope.
4965 ///
4966 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4967 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4968 /// sufficient, a read-write scope will do as well.
4969 pub fn add_scope<St>(mut self, scope: St) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C>
4970 where
4971 St: AsRef<str>,
4972 {
4973 self._scopes.insert(String::from(scope.as_ref()));
4974 self
4975 }
4976 /// Identifies the authorization scope(s) for the method you are building.
4977 ///
4978 /// See [`Self::add_scope()`] for details.
4979 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C>
4980 where
4981 I: IntoIterator<Item = St>,
4982 St: AsRef<str>,
4983 {
4984 self._scopes
4985 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4986 self
4987 }
4988
4989 /// Removes all scopes, and no default scope will be used either.
4990 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4991 /// for details).
4992 pub fn clear_scopes(mut self) -> ProjectIapTunnelLocationDestGroupGetCall<'a, C> {
4993 self._scopes.clear();
4994 self
4995 }
4996}
4997
4998/// Lists the existing TunnelDestGroups. To group across all locations, use a `-` as the location ID. For example: `/v1/projects/123/iap_tunnel/locations/-/destGroups`
4999///
5000/// A builder for the *iap_tunnel.locations.destGroups.list* method supported by a *project* resource.
5001/// It is not used directly, but through a [`ProjectMethods`] instance.
5002///
5003/// # Example
5004///
5005/// Instantiate a resource method builder
5006///
5007/// ```test_harness,no_run
5008/// # extern crate hyper;
5009/// # extern crate hyper_rustls;
5010/// # extern crate google_iap1 as iap1;
5011/// # async fn dox() {
5012/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5013///
5014/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5015/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5016/// # .with_native_roots()
5017/// # .unwrap()
5018/// # .https_only()
5019/// # .enable_http2()
5020/// # .build();
5021///
5022/// # let executor = hyper_util::rt::TokioExecutor::new();
5023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5024/// # secret,
5025/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5026/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5027/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5028/// # ),
5029/// # ).build().await.unwrap();
5030///
5031/// # let client = hyper_util::client::legacy::Client::builder(
5032/// # hyper_util::rt::TokioExecutor::new()
5033/// # )
5034/// # .build(
5035/// # hyper_rustls::HttpsConnectorBuilder::new()
5036/// # .with_native_roots()
5037/// # .unwrap()
5038/// # .https_or_http()
5039/// # .enable_http2()
5040/// # .build()
5041/// # );
5042/// # let mut hub = CloudIAP::new(client, auth);
5043/// // You can configure optional parameters by calling the respective setters at will, and
5044/// // execute the final call using `doit()`.
5045/// // Values shown here are possibly random and not representative !
5046/// let result = hub.projects().iap_tunnel_locations_dest_groups_list("parent")
5047/// .page_token("ea")
5048/// .page_size(-55)
5049/// .doit().await;
5050/// # }
5051/// ```
5052pub struct ProjectIapTunnelLocationDestGroupListCall<'a, C>
5053where
5054 C: 'a,
5055{
5056 hub: &'a CloudIAP<C>,
5057 _parent: String,
5058 _page_token: Option<String>,
5059 _page_size: Option<i32>,
5060 _delegate: Option<&'a mut dyn common::Delegate>,
5061 _additional_params: HashMap<String, String>,
5062 _scopes: BTreeSet<String>,
5063}
5064
5065impl<'a, C> common::CallBuilder for ProjectIapTunnelLocationDestGroupListCall<'a, C> {}
5066
5067impl<'a, C> ProjectIapTunnelLocationDestGroupListCall<'a, C>
5068where
5069 C: common::Connector,
5070{
5071 /// Perform the operation you have build so far.
5072 pub async fn doit(
5073 mut self,
5074 ) -> common::Result<(common::Response, ListTunnelDestGroupsResponse)> {
5075 use std::borrow::Cow;
5076 use std::io::{Read, Seek};
5077
5078 use common::{url::Params, ToParts};
5079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5080
5081 let mut dd = common::DefaultDelegate;
5082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5083 dlg.begin(common::MethodInfo {
5084 id: "iap.projects.iap_tunnel.locations.destGroups.list",
5085 http_method: hyper::Method::GET,
5086 });
5087
5088 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
5089 if self._additional_params.contains_key(field) {
5090 dlg.finished(false);
5091 return Err(common::Error::FieldClash(field));
5092 }
5093 }
5094
5095 let mut params = Params::with_capacity(5 + self._additional_params.len());
5096 params.push("parent", self._parent);
5097 if let Some(value) = self._page_token.as_ref() {
5098 params.push("pageToken", value);
5099 }
5100 if let Some(value) = self._page_size.as_ref() {
5101 params.push("pageSize", value.to_string());
5102 }
5103
5104 params.extend(self._additional_params.iter());
5105
5106 params.push("alt", "json");
5107 let mut url = self.hub._base_url.clone() + "v1/{+parent}/destGroups";
5108 if self._scopes.is_empty() {
5109 self._scopes
5110 .insert(Scope::CloudPlatform.as_ref().to_string());
5111 }
5112
5113 #[allow(clippy::single_element_loop)]
5114 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5115 url = params.uri_replacement(url, param_name, find_this, true);
5116 }
5117 {
5118 let to_remove = ["parent"];
5119 params.remove_params(&to_remove);
5120 }
5121
5122 let url = params.parse_with_url(&url);
5123
5124 loop {
5125 let token = match self
5126 .hub
5127 .auth
5128 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5129 .await
5130 {
5131 Ok(token) => token,
5132 Err(e) => match dlg.token(e) {
5133 Ok(token) => token,
5134 Err(e) => {
5135 dlg.finished(false);
5136 return Err(common::Error::MissingToken(e));
5137 }
5138 },
5139 };
5140 let mut req_result = {
5141 let client = &self.hub.client;
5142 dlg.pre_request();
5143 let mut req_builder = hyper::Request::builder()
5144 .method(hyper::Method::GET)
5145 .uri(url.as_str())
5146 .header(USER_AGENT, self.hub._user_agent.clone());
5147
5148 if let Some(token) = token.as_ref() {
5149 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5150 }
5151
5152 let request = req_builder
5153 .header(CONTENT_LENGTH, 0_u64)
5154 .body(common::to_body::<String>(None));
5155
5156 client.request(request.unwrap()).await
5157 };
5158
5159 match req_result {
5160 Err(err) => {
5161 if let common::Retry::After(d) = dlg.http_error(&err) {
5162 sleep(d).await;
5163 continue;
5164 }
5165 dlg.finished(false);
5166 return Err(common::Error::HttpError(err));
5167 }
5168 Ok(res) => {
5169 let (mut parts, body) = res.into_parts();
5170 let mut body = common::Body::new(body);
5171 if !parts.status.is_success() {
5172 let bytes = common::to_bytes(body).await.unwrap_or_default();
5173 let error = serde_json::from_str(&common::to_string(&bytes));
5174 let response = common::to_response(parts, bytes.into());
5175
5176 if let common::Retry::After(d) =
5177 dlg.http_failure(&response, error.as_ref().ok())
5178 {
5179 sleep(d).await;
5180 continue;
5181 }
5182
5183 dlg.finished(false);
5184
5185 return Err(match error {
5186 Ok(value) => common::Error::BadRequest(value),
5187 _ => common::Error::Failure(response),
5188 });
5189 }
5190 let response = {
5191 let bytes = common::to_bytes(body).await.unwrap_or_default();
5192 let encoded = common::to_string(&bytes);
5193 match serde_json::from_str(&encoded) {
5194 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5195 Err(error) => {
5196 dlg.response_json_decode_error(&encoded, &error);
5197 return Err(common::Error::JsonDecodeError(
5198 encoded.to_string(),
5199 error,
5200 ));
5201 }
5202 }
5203 };
5204
5205 dlg.finished(true);
5206 return Ok(response);
5207 }
5208 }
5209 }
5210 }
5211
5212 /// Required. Google Cloud Project ID and location. In the following format: `projects/{project_number/id}/iap_tunnel/locations/{location}`. A `-` can be used for the location to group across all locations.
5213 ///
5214 /// Sets the *parent* path property to the given value.
5215 ///
5216 /// Even though the property as already been set when instantiating this call,
5217 /// we provide this method for API completeness.
5218 pub fn parent(mut self, new_value: &str) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
5219 self._parent = new_value.to_string();
5220 self
5221 }
5222 /// A page token, received from a previous `ListTunnelDestGroups` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListTunnelDestGroups` must match the call that provided the page token.
5223 ///
5224 /// Sets the *page token* query property to the given value.
5225 pub fn page_token(
5226 mut self,
5227 new_value: &str,
5228 ) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
5229 self._page_token = Some(new_value.to_string());
5230 self
5231 }
5232 /// The maximum number of groups to return. The service might return fewer than this value. If unspecified, at most 100 groups are returned. The maximum value is 1000; values above 1000 are coerced to 1000.
5233 ///
5234 /// Sets the *page size* query property to the given value.
5235 pub fn page_size(mut self, new_value: i32) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
5236 self._page_size = Some(new_value);
5237 self
5238 }
5239 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5240 /// while executing the actual API request.
5241 ///
5242 /// ````text
5243 /// It should be used to handle progress information, and to implement a certain level of resilience.
5244 /// ````
5245 ///
5246 /// Sets the *delegate* property to the given value.
5247 pub fn delegate(
5248 mut self,
5249 new_value: &'a mut dyn common::Delegate,
5250 ) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
5251 self._delegate = Some(new_value);
5252 self
5253 }
5254
5255 /// Set any additional parameter of the query string used in the request.
5256 /// It should be used to set parameters which are not yet available through their own
5257 /// setters.
5258 ///
5259 /// Please note that this method must not be used to set any of the known parameters
5260 /// which have their own setter method. If done anyway, the request will fail.
5261 ///
5262 /// # Additional Parameters
5263 ///
5264 /// * *$.xgafv* (query-string) - V1 error format.
5265 /// * *access_token* (query-string) - OAuth access token.
5266 /// * *alt* (query-string) - Data format for response.
5267 /// * *callback* (query-string) - JSONP
5268 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5269 /// * *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.
5270 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5271 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5272 /// * *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.
5273 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5274 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5275 pub fn param<T>(mut self, name: T, value: T) -> ProjectIapTunnelLocationDestGroupListCall<'a, C>
5276 where
5277 T: AsRef<str>,
5278 {
5279 self._additional_params
5280 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5281 self
5282 }
5283
5284 /// Identifies the authorization scope for the method you are building.
5285 ///
5286 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5287 /// [`Scope::CloudPlatform`].
5288 ///
5289 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5290 /// tokens for more than one scope.
5291 ///
5292 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5293 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5294 /// sufficient, a read-write scope will do as well.
5295 pub fn add_scope<St>(mut self, scope: St) -> ProjectIapTunnelLocationDestGroupListCall<'a, C>
5296 where
5297 St: AsRef<str>,
5298 {
5299 self._scopes.insert(String::from(scope.as_ref()));
5300 self
5301 }
5302 /// Identifies the authorization scope(s) for the method you are building.
5303 ///
5304 /// See [`Self::add_scope()`] for details.
5305 pub fn add_scopes<I, St>(
5306 mut self,
5307 scopes: I,
5308 ) -> ProjectIapTunnelLocationDestGroupListCall<'a, C>
5309 where
5310 I: IntoIterator<Item = St>,
5311 St: AsRef<str>,
5312 {
5313 self._scopes
5314 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5315 self
5316 }
5317
5318 /// Removes all scopes, and no default scope will be used either.
5319 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5320 /// for details).
5321 pub fn clear_scopes(mut self) -> ProjectIapTunnelLocationDestGroupListCall<'a, C> {
5322 self._scopes.clear();
5323 self
5324 }
5325}
5326
5327/// Updates a TunnelDestGroup.
5328///
5329/// A builder for the *iap_tunnel.locations.destGroups.patch* method supported by a *project* resource.
5330/// It is not used directly, but through a [`ProjectMethods`] instance.
5331///
5332/// # Example
5333///
5334/// Instantiate a resource method builder
5335///
5336/// ```test_harness,no_run
5337/// # extern crate hyper;
5338/// # extern crate hyper_rustls;
5339/// # extern crate google_iap1 as iap1;
5340/// use iap1::api::TunnelDestGroup;
5341/// # async fn dox() {
5342/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5343///
5344/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5345/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5346/// # .with_native_roots()
5347/// # .unwrap()
5348/// # .https_only()
5349/// # .enable_http2()
5350/// # .build();
5351///
5352/// # let executor = hyper_util::rt::TokioExecutor::new();
5353/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5354/// # secret,
5355/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5356/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5357/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5358/// # ),
5359/// # ).build().await.unwrap();
5360///
5361/// # let client = hyper_util::client::legacy::Client::builder(
5362/// # hyper_util::rt::TokioExecutor::new()
5363/// # )
5364/// # .build(
5365/// # hyper_rustls::HttpsConnectorBuilder::new()
5366/// # .with_native_roots()
5367/// # .unwrap()
5368/// # .https_or_http()
5369/// # .enable_http2()
5370/// # .build()
5371/// # );
5372/// # let mut hub = CloudIAP::new(client, auth);
5373/// // As the method needs a request, you would usually fill it with the desired information
5374/// // into the respective structure. Some of the parts shown here might not be applicable !
5375/// // Values shown here are possibly random and not representative !
5376/// let mut req = TunnelDestGroup::default();
5377///
5378/// // You can configure optional parameters by calling the respective setters at will, and
5379/// // execute the final call using `doit()`.
5380/// // Values shown here are possibly random and not representative !
5381/// let result = hub.projects().iap_tunnel_locations_dest_groups_patch(req, "name")
5382/// .update_mask(FieldMask::new::<&str>(&[]))
5383/// .doit().await;
5384/// # }
5385/// ```
5386pub struct ProjectIapTunnelLocationDestGroupPatchCall<'a, C>
5387where
5388 C: 'a,
5389{
5390 hub: &'a CloudIAP<C>,
5391 _request: TunnelDestGroup,
5392 _name: String,
5393 _update_mask: Option<common::FieldMask>,
5394 _delegate: Option<&'a mut dyn common::Delegate>,
5395 _additional_params: HashMap<String, String>,
5396 _scopes: BTreeSet<String>,
5397}
5398
5399impl<'a, C> common::CallBuilder for ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {}
5400
5401impl<'a, C> ProjectIapTunnelLocationDestGroupPatchCall<'a, C>
5402where
5403 C: common::Connector,
5404{
5405 /// Perform the operation you have build so far.
5406 pub async fn doit(mut self) -> common::Result<(common::Response, TunnelDestGroup)> {
5407 use std::borrow::Cow;
5408 use std::io::{Read, Seek};
5409
5410 use common::{url::Params, ToParts};
5411 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5412
5413 let mut dd = common::DefaultDelegate;
5414 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5415 dlg.begin(common::MethodInfo {
5416 id: "iap.projects.iap_tunnel.locations.destGroups.patch",
5417 http_method: hyper::Method::PATCH,
5418 });
5419
5420 for &field in ["alt", "name", "updateMask"].iter() {
5421 if self._additional_params.contains_key(field) {
5422 dlg.finished(false);
5423 return Err(common::Error::FieldClash(field));
5424 }
5425 }
5426
5427 let mut params = Params::with_capacity(5 + self._additional_params.len());
5428 params.push("name", self._name);
5429 if let Some(value) = self._update_mask.as_ref() {
5430 params.push("updateMask", value.to_string());
5431 }
5432
5433 params.extend(self._additional_params.iter());
5434
5435 params.push("alt", "json");
5436 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5437 if self._scopes.is_empty() {
5438 self._scopes
5439 .insert(Scope::CloudPlatform.as_ref().to_string());
5440 }
5441
5442 #[allow(clippy::single_element_loop)]
5443 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5444 url = params.uri_replacement(url, param_name, find_this, true);
5445 }
5446 {
5447 let to_remove = ["name"];
5448 params.remove_params(&to_remove);
5449 }
5450
5451 let url = params.parse_with_url(&url);
5452
5453 let mut json_mime_type = mime::APPLICATION_JSON;
5454 let mut request_value_reader = {
5455 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5456 common::remove_json_null_values(&mut value);
5457 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5458 serde_json::to_writer(&mut dst, &value).unwrap();
5459 dst
5460 };
5461 let request_size = request_value_reader
5462 .seek(std::io::SeekFrom::End(0))
5463 .unwrap();
5464 request_value_reader
5465 .seek(std::io::SeekFrom::Start(0))
5466 .unwrap();
5467
5468 loop {
5469 let token = match self
5470 .hub
5471 .auth
5472 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5473 .await
5474 {
5475 Ok(token) => token,
5476 Err(e) => match dlg.token(e) {
5477 Ok(token) => token,
5478 Err(e) => {
5479 dlg.finished(false);
5480 return Err(common::Error::MissingToken(e));
5481 }
5482 },
5483 };
5484 request_value_reader
5485 .seek(std::io::SeekFrom::Start(0))
5486 .unwrap();
5487 let mut req_result = {
5488 let client = &self.hub.client;
5489 dlg.pre_request();
5490 let mut req_builder = hyper::Request::builder()
5491 .method(hyper::Method::PATCH)
5492 .uri(url.as_str())
5493 .header(USER_AGENT, self.hub._user_agent.clone());
5494
5495 if let Some(token) = token.as_ref() {
5496 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5497 }
5498
5499 let request = req_builder
5500 .header(CONTENT_TYPE, json_mime_type.to_string())
5501 .header(CONTENT_LENGTH, request_size as u64)
5502 .body(common::to_body(
5503 request_value_reader.get_ref().clone().into(),
5504 ));
5505
5506 client.request(request.unwrap()).await
5507 };
5508
5509 match req_result {
5510 Err(err) => {
5511 if let common::Retry::After(d) = dlg.http_error(&err) {
5512 sleep(d).await;
5513 continue;
5514 }
5515 dlg.finished(false);
5516 return Err(common::Error::HttpError(err));
5517 }
5518 Ok(res) => {
5519 let (mut parts, body) = res.into_parts();
5520 let mut body = common::Body::new(body);
5521 if !parts.status.is_success() {
5522 let bytes = common::to_bytes(body).await.unwrap_or_default();
5523 let error = serde_json::from_str(&common::to_string(&bytes));
5524 let response = common::to_response(parts, bytes.into());
5525
5526 if let common::Retry::After(d) =
5527 dlg.http_failure(&response, error.as_ref().ok())
5528 {
5529 sleep(d).await;
5530 continue;
5531 }
5532
5533 dlg.finished(false);
5534
5535 return Err(match error {
5536 Ok(value) => common::Error::BadRequest(value),
5537 _ => common::Error::Failure(response),
5538 });
5539 }
5540 let response = {
5541 let bytes = common::to_bytes(body).await.unwrap_or_default();
5542 let encoded = common::to_string(&bytes);
5543 match serde_json::from_str(&encoded) {
5544 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5545 Err(error) => {
5546 dlg.response_json_decode_error(&encoded, &error);
5547 return Err(common::Error::JsonDecodeError(
5548 encoded.to_string(),
5549 error,
5550 ));
5551 }
5552 }
5553 };
5554
5555 dlg.finished(true);
5556 return Ok(response);
5557 }
5558 }
5559 }
5560 }
5561
5562 ///
5563 /// Sets the *request* property to the given value.
5564 ///
5565 /// Even though the property as already been set when instantiating this call,
5566 /// we provide this method for API completeness.
5567 pub fn request(
5568 mut self,
5569 new_value: TunnelDestGroup,
5570 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
5571 self._request = new_value;
5572 self
5573 }
5574 /// Identifier. Identifier for the TunnelDestGroup. Must be unique within the project and contain only lower case letters (a-z) and dashes (-).
5575 ///
5576 /// Sets the *name* path property to the given value.
5577 ///
5578 /// Even though the property as already been set when instantiating this call,
5579 /// we provide this method for API completeness.
5580 pub fn name(mut self, new_value: &str) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
5581 self._name = new_value.to_string();
5582 self
5583 }
5584 /// A field mask that specifies which IAP settings to update. If omitted, then all of the settings are updated. See https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
5585 ///
5586 /// Sets the *update mask* query property to the given value.
5587 pub fn update_mask(
5588 mut self,
5589 new_value: common::FieldMask,
5590 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
5591 self._update_mask = Some(new_value);
5592 self
5593 }
5594 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5595 /// while executing the actual API request.
5596 ///
5597 /// ````text
5598 /// It should be used to handle progress information, and to implement a certain level of resilience.
5599 /// ````
5600 ///
5601 /// Sets the *delegate* property to the given value.
5602 pub fn delegate(
5603 mut self,
5604 new_value: &'a mut dyn common::Delegate,
5605 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
5606 self._delegate = Some(new_value);
5607 self
5608 }
5609
5610 /// Set any additional parameter of the query string used in the request.
5611 /// It should be used to set parameters which are not yet available through their own
5612 /// setters.
5613 ///
5614 /// Please note that this method must not be used to set any of the known parameters
5615 /// which have their own setter method. If done anyway, the request will fail.
5616 ///
5617 /// # Additional Parameters
5618 ///
5619 /// * *$.xgafv* (query-string) - V1 error format.
5620 /// * *access_token* (query-string) - OAuth access token.
5621 /// * *alt* (query-string) - Data format for response.
5622 /// * *callback* (query-string) - JSONP
5623 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5624 /// * *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.
5625 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5626 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5627 /// * *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.
5628 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5629 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5630 pub fn param<T>(
5631 mut self,
5632 name: T,
5633 value: T,
5634 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C>
5635 where
5636 T: AsRef<str>,
5637 {
5638 self._additional_params
5639 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5640 self
5641 }
5642
5643 /// Identifies the authorization scope for the method you are building.
5644 ///
5645 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5646 /// [`Scope::CloudPlatform`].
5647 ///
5648 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5649 /// tokens for more than one scope.
5650 ///
5651 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5652 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5653 /// sufficient, a read-write scope will do as well.
5654 pub fn add_scope<St>(mut self, scope: St) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C>
5655 where
5656 St: AsRef<str>,
5657 {
5658 self._scopes.insert(String::from(scope.as_ref()));
5659 self
5660 }
5661 /// Identifies the authorization scope(s) for the method you are building.
5662 ///
5663 /// See [`Self::add_scope()`] for details.
5664 pub fn add_scopes<I, St>(
5665 mut self,
5666 scopes: I,
5667 ) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C>
5668 where
5669 I: IntoIterator<Item = St>,
5670 St: AsRef<str>,
5671 {
5672 self._scopes
5673 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5674 self
5675 }
5676
5677 /// Removes all scopes, and no default scope will be used either.
5678 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5679 /// for details).
5680 pub fn clear_scopes(mut self) -> ProjectIapTunnelLocationDestGroupPatchCall<'a, C> {
5681 self._scopes.clear();
5682 self
5683 }
5684}
5685
5686/// Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
5687///
5688/// A builder for the *getIamPolicy* method.
5689/// It is not used directly, but through a [`MethodMethods`] instance.
5690///
5691/// # Example
5692///
5693/// Instantiate a resource method builder
5694///
5695/// ```test_harness,no_run
5696/// # extern crate hyper;
5697/// # extern crate hyper_rustls;
5698/// # extern crate google_iap1 as iap1;
5699/// use iap1::api::GetIamPolicyRequest;
5700/// # async fn dox() {
5701/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5702///
5703/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5704/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5705/// # .with_native_roots()
5706/// # .unwrap()
5707/// # .https_only()
5708/// # .enable_http2()
5709/// # .build();
5710///
5711/// # let executor = hyper_util::rt::TokioExecutor::new();
5712/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5713/// # secret,
5714/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5715/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5716/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5717/// # ),
5718/// # ).build().await.unwrap();
5719///
5720/// # let client = hyper_util::client::legacy::Client::builder(
5721/// # hyper_util::rt::TokioExecutor::new()
5722/// # )
5723/// # .build(
5724/// # hyper_rustls::HttpsConnectorBuilder::new()
5725/// # .with_native_roots()
5726/// # .unwrap()
5727/// # .https_or_http()
5728/// # .enable_http2()
5729/// # .build()
5730/// # );
5731/// # let mut hub = CloudIAP::new(client, auth);
5732/// // As the method needs a request, you would usually fill it with the desired information
5733/// // into the respective structure. Some of the parts shown here might not be applicable !
5734/// // Values shown here are possibly random and not representative !
5735/// let mut req = GetIamPolicyRequest::default();
5736///
5737/// // You can configure optional parameters by calling the respective setters at will, and
5738/// // execute the final call using `doit()`.
5739/// // Values shown here are possibly random and not representative !
5740/// let result = hub.methods().get_iam_policy(req, "resource")
5741/// .doit().await;
5742/// # }
5743/// ```
5744pub struct MethodGetIamPolicyCall<'a, C>
5745where
5746 C: 'a,
5747{
5748 hub: &'a CloudIAP<C>,
5749 _request: GetIamPolicyRequest,
5750 _resource: String,
5751 _delegate: Option<&'a mut dyn common::Delegate>,
5752 _additional_params: HashMap<String, String>,
5753 _scopes: BTreeSet<String>,
5754}
5755
5756impl<'a, C> common::CallBuilder for MethodGetIamPolicyCall<'a, C> {}
5757
5758impl<'a, C> MethodGetIamPolicyCall<'a, C>
5759where
5760 C: common::Connector,
5761{
5762 /// Perform the operation you have build so far.
5763 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5764 use std::borrow::Cow;
5765 use std::io::{Read, Seek};
5766
5767 use common::{url::Params, ToParts};
5768 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5769
5770 let mut dd = common::DefaultDelegate;
5771 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5772 dlg.begin(common::MethodInfo {
5773 id: "iap.getIamPolicy",
5774 http_method: hyper::Method::POST,
5775 });
5776
5777 for &field in ["alt", "resource"].iter() {
5778 if self._additional_params.contains_key(field) {
5779 dlg.finished(false);
5780 return Err(common::Error::FieldClash(field));
5781 }
5782 }
5783
5784 let mut params = Params::with_capacity(4 + self._additional_params.len());
5785 params.push("resource", self._resource);
5786
5787 params.extend(self._additional_params.iter());
5788
5789 params.push("alt", "json");
5790 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
5791 if self._scopes.is_empty() {
5792 self._scopes
5793 .insert(Scope::CloudPlatform.as_ref().to_string());
5794 }
5795
5796 #[allow(clippy::single_element_loop)]
5797 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5798 url = params.uri_replacement(url, param_name, find_this, true);
5799 }
5800 {
5801 let to_remove = ["resource"];
5802 params.remove_params(&to_remove);
5803 }
5804
5805 let url = params.parse_with_url(&url);
5806
5807 let mut json_mime_type = mime::APPLICATION_JSON;
5808 let mut request_value_reader = {
5809 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5810 common::remove_json_null_values(&mut value);
5811 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5812 serde_json::to_writer(&mut dst, &value).unwrap();
5813 dst
5814 };
5815 let request_size = request_value_reader
5816 .seek(std::io::SeekFrom::End(0))
5817 .unwrap();
5818 request_value_reader
5819 .seek(std::io::SeekFrom::Start(0))
5820 .unwrap();
5821
5822 loop {
5823 let token = match self
5824 .hub
5825 .auth
5826 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5827 .await
5828 {
5829 Ok(token) => token,
5830 Err(e) => match dlg.token(e) {
5831 Ok(token) => token,
5832 Err(e) => {
5833 dlg.finished(false);
5834 return Err(common::Error::MissingToken(e));
5835 }
5836 },
5837 };
5838 request_value_reader
5839 .seek(std::io::SeekFrom::Start(0))
5840 .unwrap();
5841 let mut req_result = {
5842 let client = &self.hub.client;
5843 dlg.pre_request();
5844 let mut req_builder = hyper::Request::builder()
5845 .method(hyper::Method::POST)
5846 .uri(url.as_str())
5847 .header(USER_AGENT, self.hub._user_agent.clone());
5848
5849 if let Some(token) = token.as_ref() {
5850 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5851 }
5852
5853 let request = req_builder
5854 .header(CONTENT_TYPE, json_mime_type.to_string())
5855 .header(CONTENT_LENGTH, request_size as u64)
5856 .body(common::to_body(
5857 request_value_reader.get_ref().clone().into(),
5858 ));
5859
5860 client.request(request.unwrap()).await
5861 };
5862
5863 match req_result {
5864 Err(err) => {
5865 if let common::Retry::After(d) = dlg.http_error(&err) {
5866 sleep(d).await;
5867 continue;
5868 }
5869 dlg.finished(false);
5870 return Err(common::Error::HttpError(err));
5871 }
5872 Ok(res) => {
5873 let (mut parts, body) = res.into_parts();
5874 let mut body = common::Body::new(body);
5875 if !parts.status.is_success() {
5876 let bytes = common::to_bytes(body).await.unwrap_or_default();
5877 let error = serde_json::from_str(&common::to_string(&bytes));
5878 let response = common::to_response(parts, bytes.into());
5879
5880 if let common::Retry::After(d) =
5881 dlg.http_failure(&response, error.as_ref().ok())
5882 {
5883 sleep(d).await;
5884 continue;
5885 }
5886
5887 dlg.finished(false);
5888
5889 return Err(match error {
5890 Ok(value) => common::Error::BadRequest(value),
5891 _ => common::Error::Failure(response),
5892 });
5893 }
5894 let response = {
5895 let bytes = common::to_bytes(body).await.unwrap_or_default();
5896 let encoded = common::to_string(&bytes);
5897 match serde_json::from_str(&encoded) {
5898 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5899 Err(error) => {
5900 dlg.response_json_decode_error(&encoded, &error);
5901 return Err(common::Error::JsonDecodeError(
5902 encoded.to_string(),
5903 error,
5904 ));
5905 }
5906 }
5907 };
5908
5909 dlg.finished(true);
5910 return Ok(response);
5911 }
5912 }
5913 }
5914 }
5915
5916 ///
5917 /// Sets the *request* property to the given value.
5918 ///
5919 /// Even though the property as already been set when instantiating this call,
5920 /// we provide this method for API completeness.
5921 pub fn request(mut self, new_value: GetIamPolicyRequest) -> MethodGetIamPolicyCall<'a, C> {
5922 self._request = new_value;
5923 self
5924 }
5925 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5926 ///
5927 /// Sets the *resource* path property to the given value.
5928 ///
5929 /// Even though the property as already been set when instantiating this call,
5930 /// we provide this method for API completeness.
5931 pub fn resource(mut self, new_value: &str) -> MethodGetIamPolicyCall<'a, C> {
5932 self._resource = new_value.to_string();
5933 self
5934 }
5935 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5936 /// while executing the actual API request.
5937 ///
5938 /// ````text
5939 /// It should be used to handle progress information, and to implement a certain level of resilience.
5940 /// ````
5941 ///
5942 /// Sets the *delegate* property to the given value.
5943 pub fn delegate(
5944 mut self,
5945 new_value: &'a mut dyn common::Delegate,
5946 ) -> MethodGetIamPolicyCall<'a, C> {
5947 self._delegate = Some(new_value);
5948 self
5949 }
5950
5951 /// Set any additional parameter of the query string used in the request.
5952 /// It should be used to set parameters which are not yet available through their own
5953 /// setters.
5954 ///
5955 /// Please note that this method must not be used to set any of the known parameters
5956 /// which have their own setter method. If done anyway, the request will fail.
5957 ///
5958 /// # Additional Parameters
5959 ///
5960 /// * *$.xgafv* (query-string) - V1 error format.
5961 /// * *access_token* (query-string) - OAuth access token.
5962 /// * *alt* (query-string) - Data format for response.
5963 /// * *callback* (query-string) - JSONP
5964 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5965 /// * *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.
5966 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5967 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5968 /// * *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.
5969 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5970 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5971 pub fn param<T>(mut self, name: T, value: T) -> MethodGetIamPolicyCall<'a, C>
5972 where
5973 T: AsRef<str>,
5974 {
5975 self._additional_params
5976 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5977 self
5978 }
5979
5980 /// Identifies the authorization scope for the method you are building.
5981 ///
5982 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5983 /// [`Scope::CloudPlatform`].
5984 ///
5985 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5986 /// tokens for more than one scope.
5987 ///
5988 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5989 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5990 /// sufficient, a read-write scope will do as well.
5991 pub fn add_scope<St>(mut self, scope: St) -> MethodGetIamPolicyCall<'a, C>
5992 where
5993 St: AsRef<str>,
5994 {
5995 self._scopes.insert(String::from(scope.as_ref()));
5996 self
5997 }
5998 /// Identifies the authorization scope(s) for the method you are building.
5999 ///
6000 /// See [`Self::add_scope()`] for details.
6001 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodGetIamPolicyCall<'a, C>
6002 where
6003 I: IntoIterator<Item = St>,
6004 St: AsRef<str>,
6005 {
6006 self._scopes
6007 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6008 self
6009 }
6010
6011 /// Removes all scopes, and no default scope will be used either.
6012 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6013 /// for details).
6014 pub fn clear_scopes(mut self) -> MethodGetIamPolicyCall<'a, C> {
6015 self._scopes.clear();
6016 self
6017 }
6018}
6019
6020/// Gets the IAP settings on a particular IAP protected resource.
6021///
6022/// A builder for the *getIapSettings* method.
6023/// It is not used directly, but through a [`MethodMethods`] instance.
6024///
6025/// # Example
6026///
6027/// Instantiate a resource method builder
6028///
6029/// ```test_harness,no_run
6030/// # extern crate hyper;
6031/// # extern crate hyper_rustls;
6032/// # extern crate google_iap1 as iap1;
6033/// # async fn dox() {
6034/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6035///
6036/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6037/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6038/// # .with_native_roots()
6039/// # .unwrap()
6040/// # .https_only()
6041/// # .enable_http2()
6042/// # .build();
6043///
6044/// # let executor = hyper_util::rt::TokioExecutor::new();
6045/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6046/// # secret,
6047/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6048/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6049/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6050/// # ),
6051/// # ).build().await.unwrap();
6052///
6053/// # let client = hyper_util::client::legacy::Client::builder(
6054/// # hyper_util::rt::TokioExecutor::new()
6055/// # )
6056/// # .build(
6057/// # hyper_rustls::HttpsConnectorBuilder::new()
6058/// # .with_native_roots()
6059/// # .unwrap()
6060/// # .https_or_http()
6061/// # .enable_http2()
6062/// # .build()
6063/// # );
6064/// # let mut hub = CloudIAP::new(client, auth);
6065/// // You can configure optional parameters by calling the respective setters at will, and
6066/// // execute the final call using `doit()`.
6067/// // Values shown here are possibly random and not representative !
6068/// let result = hub.methods().get_iap_settings("name")
6069/// .doit().await;
6070/// # }
6071/// ```
6072pub struct MethodGetIapSettingCall<'a, C>
6073where
6074 C: 'a,
6075{
6076 hub: &'a CloudIAP<C>,
6077 _name: String,
6078 _delegate: Option<&'a mut dyn common::Delegate>,
6079 _additional_params: HashMap<String, String>,
6080 _scopes: BTreeSet<String>,
6081}
6082
6083impl<'a, C> common::CallBuilder for MethodGetIapSettingCall<'a, C> {}
6084
6085impl<'a, C> MethodGetIapSettingCall<'a, C>
6086where
6087 C: common::Connector,
6088{
6089 /// Perform the operation you have build so far.
6090 pub async fn doit(mut self) -> common::Result<(common::Response, IapSettings)> {
6091 use std::borrow::Cow;
6092 use std::io::{Read, Seek};
6093
6094 use common::{url::Params, ToParts};
6095 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6096
6097 let mut dd = common::DefaultDelegate;
6098 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6099 dlg.begin(common::MethodInfo {
6100 id: "iap.getIapSettings",
6101 http_method: hyper::Method::GET,
6102 });
6103
6104 for &field in ["alt", "name"].iter() {
6105 if self._additional_params.contains_key(field) {
6106 dlg.finished(false);
6107 return Err(common::Error::FieldClash(field));
6108 }
6109 }
6110
6111 let mut params = Params::with_capacity(3 + self._additional_params.len());
6112 params.push("name", self._name);
6113
6114 params.extend(self._additional_params.iter());
6115
6116 params.push("alt", "json");
6117 let mut url = self.hub._base_url.clone() + "v1/{+name}:iapSettings";
6118 if self._scopes.is_empty() {
6119 self._scopes
6120 .insert(Scope::CloudPlatform.as_ref().to_string());
6121 }
6122
6123 #[allow(clippy::single_element_loop)]
6124 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6125 url = params.uri_replacement(url, param_name, find_this, true);
6126 }
6127 {
6128 let to_remove = ["name"];
6129 params.remove_params(&to_remove);
6130 }
6131
6132 let url = params.parse_with_url(&url);
6133
6134 loop {
6135 let token = match self
6136 .hub
6137 .auth
6138 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6139 .await
6140 {
6141 Ok(token) => token,
6142 Err(e) => match dlg.token(e) {
6143 Ok(token) => token,
6144 Err(e) => {
6145 dlg.finished(false);
6146 return Err(common::Error::MissingToken(e));
6147 }
6148 },
6149 };
6150 let mut req_result = {
6151 let client = &self.hub.client;
6152 dlg.pre_request();
6153 let mut req_builder = hyper::Request::builder()
6154 .method(hyper::Method::GET)
6155 .uri(url.as_str())
6156 .header(USER_AGENT, self.hub._user_agent.clone());
6157
6158 if let Some(token) = token.as_ref() {
6159 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6160 }
6161
6162 let request = req_builder
6163 .header(CONTENT_LENGTH, 0_u64)
6164 .body(common::to_body::<String>(None));
6165
6166 client.request(request.unwrap()).await
6167 };
6168
6169 match req_result {
6170 Err(err) => {
6171 if let common::Retry::After(d) = dlg.http_error(&err) {
6172 sleep(d).await;
6173 continue;
6174 }
6175 dlg.finished(false);
6176 return Err(common::Error::HttpError(err));
6177 }
6178 Ok(res) => {
6179 let (mut parts, body) = res.into_parts();
6180 let mut body = common::Body::new(body);
6181 if !parts.status.is_success() {
6182 let bytes = common::to_bytes(body).await.unwrap_or_default();
6183 let error = serde_json::from_str(&common::to_string(&bytes));
6184 let response = common::to_response(parts, bytes.into());
6185
6186 if let common::Retry::After(d) =
6187 dlg.http_failure(&response, error.as_ref().ok())
6188 {
6189 sleep(d).await;
6190 continue;
6191 }
6192
6193 dlg.finished(false);
6194
6195 return Err(match error {
6196 Ok(value) => common::Error::BadRequest(value),
6197 _ => common::Error::Failure(response),
6198 });
6199 }
6200 let response = {
6201 let bytes = common::to_bytes(body).await.unwrap_or_default();
6202 let encoded = common::to_string(&bytes);
6203 match serde_json::from_str(&encoded) {
6204 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6205 Err(error) => {
6206 dlg.response_json_decode_error(&encoded, &error);
6207 return Err(common::Error::JsonDecodeError(
6208 encoded.to_string(),
6209 error,
6210 ));
6211 }
6212 }
6213 };
6214
6215 dlg.finished(true);
6216 return Ok(response);
6217 }
6218 }
6219 }
6220 }
6221
6222 /// Required. The resource name for which to retrieve the settings. Authorization: Requires the `getSettings` permission for the associated resource.
6223 ///
6224 /// Sets the *name* path property to the given value.
6225 ///
6226 /// Even though the property as already been set when instantiating this call,
6227 /// we provide this method for API completeness.
6228 pub fn name(mut self, new_value: &str) -> MethodGetIapSettingCall<'a, C> {
6229 self._name = new_value.to_string();
6230 self
6231 }
6232 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6233 /// while executing the actual API request.
6234 ///
6235 /// ````text
6236 /// It should be used to handle progress information, and to implement a certain level of resilience.
6237 /// ````
6238 ///
6239 /// Sets the *delegate* property to the given value.
6240 pub fn delegate(
6241 mut self,
6242 new_value: &'a mut dyn common::Delegate,
6243 ) -> MethodGetIapSettingCall<'a, C> {
6244 self._delegate = Some(new_value);
6245 self
6246 }
6247
6248 /// Set any additional parameter of the query string used in the request.
6249 /// It should be used to set parameters which are not yet available through their own
6250 /// setters.
6251 ///
6252 /// Please note that this method must not be used to set any of the known parameters
6253 /// which have their own setter method. If done anyway, the request will fail.
6254 ///
6255 /// # Additional Parameters
6256 ///
6257 /// * *$.xgafv* (query-string) - V1 error format.
6258 /// * *access_token* (query-string) - OAuth access token.
6259 /// * *alt* (query-string) - Data format for response.
6260 /// * *callback* (query-string) - JSONP
6261 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6262 /// * *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.
6263 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6264 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6265 /// * *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.
6266 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6267 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6268 pub fn param<T>(mut self, name: T, value: T) -> MethodGetIapSettingCall<'a, C>
6269 where
6270 T: AsRef<str>,
6271 {
6272 self._additional_params
6273 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6274 self
6275 }
6276
6277 /// Identifies the authorization scope for the method you are building.
6278 ///
6279 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6280 /// [`Scope::CloudPlatform`].
6281 ///
6282 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6283 /// tokens for more than one scope.
6284 ///
6285 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6286 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6287 /// sufficient, a read-write scope will do as well.
6288 pub fn add_scope<St>(mut self, scope: St) -> MethodGetIapSettingCall<'a, C>
6289 where
6290 St: AsRef<str>,
6291 {
6292 self._scopes.insert(String::from(scope.as_ref()));
6293 self
6294 }
6295 /// Identifies the authorization scope(s) for the method you are building.
6296 ///
6297 /// See [`Self::add_scope()`] for details.
6298 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodGetIapSettingCall<'a, C>
6299 where
6300 I: IntoIterator<Item = St>,
6301 St: AsRef<str>,
6302 {
6303 self._scopes
6304 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6305 self
6306 }
6307
6308 /// Removes all scopes, and no default scope will be used either.
6309 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6310 /// for details).
6311 pub fn clear_scopes(mut self) -> MethodGetIapSettingCall<'a, C> {
6312 self._scopes.clear();
6313 self
6314 }
6315}
6316
6317/// Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
6318///
6319/// A builder for the *setIamPolicy* method.
6320/// It is not used directly, but through a [`MethodMethods`] instance.
6321///
6322/// # Example
6323///
6324/// Instantiate a resource method builder
6325///
6326/// ```test_harness,no_run
6327/// # extern crate hyper;
6328/// # extern crate hyper_rustls;
6329/// # extern crate google_iap1 as iap1;
6330/// use iap1::api::SetIamPolicyRequest;
6331/// # async fn dox() {
6332/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6333///
6334/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6335/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6336/// # .with_native_roots()
6337/// # .unwrap()
6338/// # .https_only()
6339/// # .enable_http2()
6340/// # .build();
6341///
6342/// # let executor = hyper_util::rt::TokioExecutor::new();
6343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6344/// # secret,
6345/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6346/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6347/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6348/// # ),
6349/// # ).build().await.unwrap();
6350///
6351/// # let client = hyper_util::client::legacy::Client::builder(
6352/// # hyper_util::rt::TokioExecutor::new()
6353/// # )
6354/// # .build(
6355/// # hyper_rustls::HttpsConnectorBuilder::new()
6356/// # .with_native_roots()
6357/// # .unwrap()
6358/// # .https_or_http()
6359/// # .enable_http2()
6360/// # .build()
6361/// # );
6362/// # let mut hub = CloudIAP::new(client, auth);
6363/// // As the method needs a request, you would usually fill it with the desired information
6364/// // into the respective structure. Some of the parts shown here might not be applicable !
6365/// // Values shown here are possibly random and not representative !
6366/// let mut req = SetIamPolicyRequest::default();
6367///
6368/// // You can configure optional parameters by calling the respective setters at will, and
6369/// // execute the final call using `doit()`.
6370/// // Values shown here are possibly random and not representative !
6371/// let result = hub.methods().set_iam_policy(req, "resource")
6372/// .doit().await;
6373/// # }
6374/// ```
6375pub struct MethodSetIamPolicyCall<'a, C>
6376where
6377 C: 'a,
6378{
6379 hub: &'a CloudIAP<C>,
6380 _request: SetIamPolicyRequest,
6381 _resource: String,
6382 _delegate: Option<&'a mut dyn common::Delegate>,
6383 _additional_params: HashMap<String, String>,
6384 _scopes: BTreeSet<String>,
6385}
6386
6387impl<'a, C> common::CallBuilder for MethodSetIamPolicyCall<'a, C> {}
6388
6389impl<'a, C> MethodSetIamPolicyCall<'a, C>
6390where
6391 C: common::Connector,
6392{
6393 /// Perform the operation you have build so far.
6394 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6395 use std::borrow::Cow;
6396 use std::io::{Read, Seek};
6397
6398 use common::{url::Params, ToParts};
6399 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6400
6401 let mut dd = common::DefaultDelegate;
6402 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6403 dlg.begin(common::MethodInfo {
6404 id: "iap.setIamPolicy",
6405 http_method: hyper::Method::POST,
6406 });
6407
6408 for &field in ["alt", "resource"].iter() {
6409 if self._additional_params.contains_key(field) {
6410 dlg.finished(false);
6411 return Err(common::Error::FieldClash(field));
6412 }
6413 }
6414
6415 let mut params = Params::with_capacity(4 + self._additional_params.len());
6416 params.push("resource", self._resource);
6417
6418 params.extend(self._additional_params.iter());
6419
6420 params.push("alt", "json");
6421 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
6422 if self._scopes.is_empty() {
6423 self._scopes
6424 .insert(Scope::CloudPlatform.as_ref().to_string());
6425 }
6426
6427 #[allow(clippy::single_element_loop)]
6428 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6429 url = params.uri_replacement(url, param_name, find_this, true);
6430 }
6431 {
6432 let to_remove = ["resource"];
6433 params.remove_params(&to_remove);
6434 }
6435
6436 let url = params.parse_with_url(&url);
6437
6438 let mut json_mime_type = mime::APPLICATION_JSON;
6439 let mut request_value_reader = {
6440 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6441 common::remove_json_null_values(&mut value);
6442 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6443 serde_json::to_writer(&mut dst, &value).unwrap();
6444 dst
6445 };
6446 let request_size = request_value_reader
6447 .seek(std::io::SeekFrom::End(0))
6448 .unwrap();
6449 request_value_reader
6450 .seek(std::io::SeekFrom::Start(0))
6451 .unwrap();
6452
6453 loop {
6454 let token = match self
6455 .hub
6456 .auth
6457 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6458 .await
6459 {
6460 Ok(token) => token,
6461 Err(e) => match dlg.token(e) {
6462 Ok(token) => token,
6463 Err(e) => {
6464 dlg.finished(false);
6465 return Err(common::Error::MissingToken(e));
6466 }
6467 },
6468 };
6469 request_value_reader
6470 .seek(std::io::SeekFrom::Start(0))
6471 .unwrap();
6472 let mut req_result = {
6473 let client = &self.hub.client;
6474 dlg.pre_request();
6475 let mut req_builder = hyper::Request::builder()
6476 .method(hyper::Method::POST)
6477 .uri(url.as_str())
6478 .header(USER_AGENT, self.hub._user_agent.clone());
6479
6480 if let Some(token) = token.as_ref() {
6481 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6482 }
6483
6484 let request = req_builder
6485 .header(CONTENT_TYPE, json_mime_type.to_string())
6486 .header(CONTENT_LENGTH, request_size as u64)
6487 .body(common::to_body(
6488 request_value_reader.get_ref().clone().into(),
6489 ));
6490
6491 client.request(request.unwrap()).await
6492 };
6493
6494 match req_result {
6495 Err(err) => {
6496 if let common::Retry::After(d) = dlg.http_error(&err) {
6497 sleep(d).await;
6498 continue;
6499 }
6500 dlg.finished(false);
6501 return Err(common::Error::HttpError(err));
6502 }
6503 Ok(res) => {
6504 let (mut parts, body) = res.into_parts();
6505 let mut body = common::Body::new(body);
6506 if !parts.status.is_success() {
6507 let bytes = common::to_bytes(body).await.unwrap_or_default();
6508 let error = serde_json::from_str(&common::to_string(&bytes));
6509 let response = common::to_response(parts, bytes.into());
6510
6511 if let common::Retry::After(d) =
6512 dlg.http_failure(&response, error.as_ref().ok())
6513 {
6514 sleep(d).await;
6515 continue;
6516 }
6517
6518 dlg.finished(false);
6519
6520 return Err(match error {
6521 Ok(value) => common::Error::BadRequest(value),
6522 _ => common::Error::Failure(response),
6523 });
6524 }
6525 let response = {
6526 let bytes = common::to_bytes(body).await.unwrap_or_default();
6527 let encoded = common::to_string(&bytes);
6528 match serde_json::from_str(&encoded) {
6529 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6530 Err(error) => {
6531 dlg.response_json_decode_error(&encoded, &error);
6532 return Err(common::Error::JsonDecodeError(
6533 encoded.to_string(),
6534 error,
6535 ));
6536 }
6537 }
6538 };
6539
6540 dlg.finished(true);
6541 return Ok(response);
6542 }
6543 }
6544 }
6545 }
6546
6547 ///
6548 /// Sets the *request* property to the given value.
6549 ///
6550 /// Even though the property as already been set when instantiating this call,
6551 /// we provide this method for API completeness.
6552 pub fn request(mut self, new_value: SetIamPolicyRequest) -> MethodSetIamPolicyCall<'a, C> {
6553 self._request = new_value;
6554 self
6555 }
6556 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6557 ///
6558 /// Sets the *resource* path property to the given value.
6559 ///
6560 /// Even though the property as already been set when instantiating this call,
6561 /// we provide this method for API completeness.
6562 pub fn resource(mut self, new_value: &str) -> MethodSetIamPolicyCall<'a, C> {
6563 self._resource = new_value.to_string();
6564 self
6565 }
6566 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6567 /// while executing the actual API request.
6568 ///
6569 /// ````text
6570 /// It should be used to handle progress information, and to implement a certain level of resilience.
6571 /// ````
6572 ///
6573 /// Sets the *delegate* property to the given value.
6574 pub fn delegate(
6575 mut self,
6576 new_value: &'a mut dyn common::Delegate,
6577 ) -> MethodSetIamPolicyCall<'a, C> {
6578 self._delegate = Some(new_value);
6579 self
6580 }
6581
6582 /// Set any additional parameter of the query string used in the request.
6583 /// It should be used to set parameters which are not yet available through their own
6584 /// setters.
6585 ///
6586 /// Please note that this method must not be used to set any of the known parameters
6587 /// which have their own setter method. If done anyway, the request will fail.
6588 ///
6589 /// # Additional Parameters
6590 ///
6591 /// * *$.xgafv* (query-string) - V1 error format.
6592 /// * *access_token* (query-string) - OAuth access token.
6593 /// * *alt* (query-string) - Data format for response.
6594 /// * *callback* (query-string) - JSONP
6595 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6596 /// * *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.
6597 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6598 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6599 /// * *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.
6600 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6601 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6602 pub fn param<T>(mut self, name: T, value: T) -> MethodSetIamPolicyCall<'a, C>
6603 where
6604 T: AsRef<str>,
6605 {
6606 self._additional_params
6607 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6608 self
6609 }
6610
6611 /// Identifies the authorization scope for the method you are building.
6612 ///
6613 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6614 /// [`Scope::CloudPlatform`].
6615 ///
6616 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6617 /// tokens for more than one scope.
6618 ///
6619 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6620 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6621 /// sufficient, a read-write scope will do as well.
6622 pub fn add_scope<St>(mut self, scope: St) -> MethodSetIamPolicyCall<'a, C>
6623 where
6624 St: AsRef<str>,
6625 {
6626 self._scopes.insert(String::from(scope.as_ref()));
6627 self
6628 }
6629 /// Identifies the authorization scope(s) for the method you are building.
6630 ///
6631 /// See [`Self::add_scope()`] for details.
6632 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodSetIamPolicyCall<'a, C>
6633 where
6634 I: IntoIterator<Item = St>,
6635 St: AsRef<str>,
6636 {
6637 self._scopes
6638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6639 self
6640 }
6641
6642 /// Removes all scopes, and no default scope will be used either.
6643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6644 /// for details).
6645 pub fn clear_scopes(mut self) -> MethodSetIamPolicyCall<'a, C> {
6646 self._scopes.clear();
6647 self
6648 }
6649}
6650
6651/// Returns permissions that a caller has on the Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
6652///
6653/// A builder for the *testIamPermissions* method.
6654/// It is not used directly, but through a [`MethodMethods`] instance.
6655///
6656/// # Example
6657///
6658/// Instantiate a resource method builder
6659///
6660/// ```test_harness,no_run
6661/// # extern crate hyper;
6662/// # extern crate hyper_rustls;
6663/// # extern crate google_iap1 as iap1;
6664/// use iap1::api::TestIamPermissionsRequest;
6665/// # async fn dox() {
6666/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6667///
6668/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6669/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6670/// # .with_native_roots()
6671/// # .unwrap()
6672/// # .https_only()
6673/// # .enable_http2()
6674/// # .build();
6675///
6676/// # let executor = hyper_util::rt::TokioExecutor::new();
6677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6678/// # secret,
6679/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6680/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6681/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6682/// # ),
6683/// # ).build().await.unwrap();
6684///
6685/// # let client = hyper_util::client::legacy::Client::builder(
6686/// # hyper_util::rt::TokioExecutor::new()
6687/// # )
6688/// # .build(
6689/// # hyper_rustls::HttpsConnectorBuilder::new()
6690/// # .with_native_roots()
6691/// # .unwrap()
6692/// # .https_or_http()
6693/// # .enable_http2()
6694/// # .build()
6695/// # );
6696/// # let mut hub = CloudIAP::new(client, auth);
6697/// // As the method needs a request, you would usually fill it with the desired information
6698/// // into the respective structure. Some of the parts shown here might not be applicable !
6699/// // Values shown here are possibly random and not representative !
6700/// let mut req = TestIamPermissionsRequest::default();
6701///
6702/// // You can configure optional parameters by calling the respective setters at will, and
6703/// // execute the final call using `doit()`.
6704/// // Values shown here are possibly random and not representative !
6705/// let result = hub.methods().test_iam_permissions(req, "resource")
6706/// .doit().await;
6707/// # }
6708/// ```
6709pub struct MethodTestIamPermissionCall<'a, C>
6710where
6711 C: 'a,
6712{
6713 hub: &'a CloudIAP<C>,
6714 _request: TestIamPermissionsRequest,
6715 _resource: String,
6716 _delegate: Option<&'a mut dyn common::Delegate>,
6717 _additional_params: HashMap<String, String>,
6718 _scopes: BTreeSet<String>,
6719}
6720
6721impl<'a, C> common::CallBuilder for MethodTestIamPermissionCall<'a, C> {}
6722
6723impl<'a, C> MethodTestIamPermissionCall<'a, C>
6724where
6725 C: common::Connector,
6726{
6727 /// Perform the operation you have build so far.
6728 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6729 use std::borrow::Cow;
6730 use std::io::{Read, Seek};
6731
6732 use common::{url::Params, ToParts};
6733 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6734
6735 let mut dd = common::DefaultDelegate;
6736 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6737 dlg.begin(common::MethodInfo {
6738 id: "iap.testIamPermissions",
6739 http_method: hyper::Method::POST,
6740 });
6741
6742 for &field in ["alt", "resource"].iter() {
6743 if self._additional_params.contains_key(field) {
6744 dlg.finished(false);
6745 return Err(common::Error::FieldClash(field));
6746 }
6747 }
6748
6749 let mut params = Params::with_capacity(4 + self._additional_params.len());
6750 params.push("resource", self._resource);
6751
6752 params.extend(self._additional_params.iter());
6753
6754 params.push("alt", "json");
6755 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
6756 if self._scopes.is_empty() {
6757 self._scopes
6758 .insert(Scope::CloudPlatform.as_ref().to_string());
6759 }
6760
6761 #[allow(clippy::single_element_loop)]
6762 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6763 url = params.uri_replacement(url, param_name, find_this, true);
6764 }
6765 {
6766 let to_remove = ["resource"];
6767 params.remove_params(&to_remove);
6768 }
6769
6770 let url = params.parse_with_url(&url);
6771
6772 let mut json_mime_type = mime::APPLICATION_JSON;
6773 let mut request_value_reader = {
6774 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6775 common::remove_json_null_values(&mut value);
6776 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6777 serde_json::to_writer(&mut dst, &value).unwrap();
6778 dst
6779 };
6780 let request_size = request_value_reader
6781 .seek(std::io::SeekFrom::End(0))
6782 .unwrap();
6783 request_value_reader
6784 .seek(std::io::SeekFrom::Start(0))
6785 .unwrap();
6786
6787 loop {
6788 let token = match self
6789 .hub
6790 .auth
6791 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6792 .await
6793 {
6794 Ok(token) => token,
6795 Err(e) => match dlg.token(e) {
6796 Ok(token) => token,
6797 Err(e) => {
6798 dlg.finished(false);
6799 return Err(common::Error::MissingToken(e));
6800 }
6801 },
6802 };
6803 request_value_reader
6804 .seek(std::io::SeekFrom::Start(0))
6805 .unwrap();
6806 let mut req_result = {
6807 let client = &self.hub.client;
6808 dlg.pre_request();
6809 let mut req_builder = hyper::Request::builder()
6810 .method(hyper::Method::POST)
6811 .uri(url.as_str())
6812 .header(USER_AGENT, self.hub._user_agent.clone());
6813
6814 if let Some(token) = token.as_ref() {
6815 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6816 }
6817
6818 let request = req_builder
6819 .header(CONTENT_TYPE, json_mime_type.to_string())
6820 .header(CONTENT_LENGTH, request_size as u64)
6821 .body(common::to_body(
6822 request_value_reader.get_ref().clone().into(),
6823 ));
6824
6825 client.request(request.unwrap()).await
6826 };
6827
6828 match req_result {
6829 Err(err) => {
6830 if let common::Retry::After(d) = dlg.http_error(&err) {
6831 sleep(d).await;
6832 continue;
6833 }
6834 dlg.finished(false);
6835 return Err(common::Error::HttpError(err));
6836 }
6837 Ok(res) => {
6838 let (mut parts, body) = res.into_parts();
6839 let mut body = common::Body::new(body);
6840 if !parts.status.is_success() {
6841 let bytes = common::to_bytes(body).await.unwrap_or_default();
6842 let error = serde_json::from_str(&common::to_string(&bytes));
6843 let response = common::to_response(parts, bytes.into());
6844
6845 if let common::Retry::After(d) =
6846 dlg.http_failure(&response, error.as_ref().ok())
6847 {
6848 sleep(d).await;
6849 continue;
6850 }
6851
6852 dlg.finished(false);
6853
6854 return Err(match error {
6855 Ok(value) => common::Error::BadRequest(value),
6856 _ => common::Error::Failure(response),
6857 });
6858 }
6859 let response = {
6860 let bytes = common::to_bytes(body).await.unwrap_or_default();
6861 let encoded = common::to_string(&bytes);
6862 match serde_json::from_str(&encoded) {
6863 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6864 Err(error) => {
6865 dlg.response_json_decode_error(&encoded, &error);
6866 return Err(common::Error::JsonDecodeError(
6867 encoded.to_string(),
6868 error,
6869 ));
6870 }
6871 }
6872 };
6873
6874 dlg.finished(true);
6875 return Ok(response);
6876 }
6877 }
6878 }
6879 }
6880
6881 ///
6882 /// Sets the *request* property to the given value.
6883 ///
6884 /// Even though the property as already been set when instantiating this call,
6885 /// we provide this method for API completeness.
6886 pub fn request(
6887 mut self,
6888 new_value: TestIamPermissionsRequest,
6889 ) -> MethodTestIamPermissionCall<'a, C> {
6890 self._request = new_value;
6891 self
6892 }
6893 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6894 ///
6895 /// Sets the *resource* path property to the given value.
6896 ///
6897 /// Even though the property as already been set when instantiating this call,
6898 /// we provide this method for API completeness.
6899 pub fn resource(mut self, new_value: &str) -> MethodTestIamPermissionCall<'a, C> {
6900 self._resource = new_value.to_string();
6901 self
6902 }
6903 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6904 /// while executing the actual API request.
6905 ///
6906 /// ````text
6907 /// It should be used to handle progress information, and to implement a certain level of resilience.
6908 /// ````
6909 ///
6910 /// Sets the *delegate* property to the given value.
6911 pub fn delegate(
6912 mut self,
6913 new_value: &'a mut dyn common::Delegate,
6914 ) -> MethodTestIamPermissionCall<'a, C> {
6915 self._delegate = Some(new_value);
6916 self
6917 }
6918
6919 /// Set any additional parameter of the query string used in the request.
6920 /// It should be used to set parameters which are not yet available through their own
6921 /// setters.
6922 ///
6923 /// Please note that this method must not be used to set any of the known parameters
6924 /// which have their own setter method. If done anyway, the request will fail.
6925 ///
6926 /// # Additional Parameters
6927 ///
6928 /// * *$.xgafv* (query-string) - V1 error format.
6929 /// * *access_token* (query-string) - OAuth access token.
6930 /// * *alt* (query-string) - Data format for response.
6931 /// * *callback* (query-string) - JSONP
6932 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6933 /// * *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.
6934 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6935 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6936 /// * *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.
6937 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6938 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6939 pub fn param<T>(mut self, name: T, value: T) -> MethodTestIamPermissionCall<'a, C>
6940 where
6941 T: AsRef<str>,
6942 {
6943 self._additional_params
6944 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6945 self
6946 }
6947
6948 /// Identifies the authorization scope for the method you are building.
6949 ///
6950 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6951 /// [`Scope::CloudPlatform`].
6952 ///
6953 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6954 /// tokens for more than one scope.
6955 ///
6956 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6957 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6958 /// sufficient, a read-write scope will do as well.
6959 pub fn add_scope<St>(mut self, scope: St) -> MethodTestIamPermissionCall<'a, C>
6960 where
6961 St: AsRef<str>,
6962 {
6963 self._scopes.insert(String::from(scope.as_ref()));
6964 self
6965 }
6966 /// Identifies the authorization scope(s) for the method you are building.
6967 ///
6968 /// See [`Self::add_scope()`] for details.
6969 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodTestIamPermissionCall<'a, C>
6970 where
6971 I: IntoIterator<Item = St>,
6972 St: AsRef<str>,
6973 {
6974 self._scopes
6975 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6976 self
6977 }
6978
6979 /// Removes all scopes, and no default scope will be used either.
6980 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6981 /// for details).
6982 pub fn clear_scopes(mut self) -> MethodTestIamPermissionCall<'a, C> {
6983 self._scopes.clear();
6984 self
6985 }
6986}
6987
6988/// Updates the IAP settings on a particular IAP protected resource. It replaces all fields unless the `update_mask` is set.
6989///
6990/// A builder for the *updateIapSettings* method.
6991/// It is not used directly, but through a [`MethodMethods`] instance.
6992///
6993/// # Example
6994///
6995/// Instantiate a resource method builder
6996///
6997/// ```test_harness,no_run
6998/// # extern crate hyper;
6999/// # extern crate hyper_rustls;
7000/// # extern crate google_iap1 as iap1;
7001/// use iap1::api::IapSettings;
7002/// # async fn dox() {
7003/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7004///
7005/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7006/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7007/// # .with_native_roots()
7008/// # .unwrap()
7009/// # .https_only()
7010/// # .enable_http2()
7011/// # .build();
7012///
7013/// # let executor = hyper_util::rt::TokioExecutor::new();
7014/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7015/// # secret,
7016/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7017/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7018/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7019/// # ),
7020/// # ).build().await.unwrap();
7021///
7022/// # let client = hyper_util::client::legacy::Client::builder(
7023/// # hyper_util::rt::TokioExecutor::new()
7024/// # )
7025/// # .build(
7026/// # hyper_rustls::HttpsConnectorBuilder::new()
7027/// # .with_native_roots()
7028/// # .unwrap()
7029/// # .https_or_http()
7030/// # .enable_http2()
7031/// # .build()
7032/// # );
7033/// # let mut hub = CloudIAP::new(client, auth);
7034/// // As the method needs a request, you would usually fill it with the desired information
7035/// // into the respective structure. Some of the parts shown here might not be applicable !
7036/// // Values shown here are possibly random and not representative !
7037/// let mut req = IapSettings::default();
7038///
7039/// // You can configure optional parameters by calling the respective setters at will, and
7040/// // execute the final call using `doit()`.
7041/// // Values shown here are possibly random and not representative !
7042/// let result = hub.methods().update_iap_settings(req, "name")
7043/// .update_mask(FieldMask::new::<&str>(&[]))
7044/// .doit().await;
7045/// # }
7046/// ```
7047pub struct MethodUpdateIapSettingCall<'a, C>
7048where
7049 C: 'a,
7050{
7051 hub: &'a CloudIAP<C>,
7052 _request: IapSettings,
7053 _name: String,
7054 _update_mask: Option<common::FieldMask>,
7055 _delegate: Option<&'a mut dyn common::Delegate>,
7056 _additional_params: HashMap<String, String>,
7057 _scopes: BTreeSet<String>,
7058}
7059
7060impl<'a, C> common::CallBuilder for MethodUpdateIapSettingCall<'a, C> {}
7061
7062impl<'a, C> MethodUpdateIapSettingCall<'a, C>
7063where
7064 C: common::Connector,
7065{
7066 /// Perform the operation you have build so far.
7067 pub async fn doit(mut self) -> common::Result<(common::Response, IapSettings)> {
7068 use std::borrow::Cow;
7069 use std::io::{Read, Seek};
7070
7071 use common::{url::Params, ToParts};
7072 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7073
7074 let mut dd = common::DefaultDelegate;
7075 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7076 dlg.begin(common::MethodInfo {
7077 id: "iap.updateIapSettings",
7078 http_method: hyper::Method::PATCH,
7079 });
7080
7081 for &field in ["alt", "name", "updateMask"].iter() {
7082 if self._additional_params.contains_key(field) {
7083 dlg.finished(false);
7084 return Err(common::Error::FieldClash(field));
7085 }
7086 }
7087
7088 let mut params = Params::with_capacity(5 + self._additional_params.len());
7089 params.push("name", self._name);
7090 if let Some(value) = self._update_mask.as_ref() {
7091 params.push("updateMask", value.to_string());
7092 }
7093
7094 params.extend(self._additional_params.iter());
7095
7096 params.push("alt", "json");
7097 let mut url = self.hub._base_url.clone() + "v1/{+name}:iapSettings";
7098 if self._scopes.is_empty() {
7099 self._scopes
7100 .insert(Scope::CloudPlatform.as_ref().to_string());
7101 }
7102
7103 #[allow(clippy::single_element_loop)]
7104 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7105 url = params.uri_replacement(url, param_name, find_this, true);
7106 }
7107 {
7108 let to_remove = ["name"];
7109 params.remove_params(&to_remove);
7110 }
7111
7112 let url = params.parse_with_url(&url);
7113
7114 let mut json_mime_type = mime::APPLICATION_JSON;
7115 let mut request_value_reader = {
7116 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7117 common::remove_json_null_values(&mut value);
7118 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7119 serde_json::to_writer(&mut dst, &value).unwrap();
7120 dst
7121 };
7122 let request_size = request_value_reader
7123 .seek(std::io::SeekFrom::End(0))
7124 .unwrap();
7125 request_value_reader
7126 .seek(std::io::SeekFrom::Start(0))
7127 .unwrap();
7128
7129 loop {
7130 let token = match self
7131 .hub
7132 .auth
7133 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7134 .await
7135 {
7136 Ok(token) => token,
7137 Err(e) => match dlg.token(e) {
7138 Ok(token) => token,
7139 Err(e) => {
7140 dlg.finished(false);
7141 return Err(common::Error::MissingToken(e));
7142 }
7143 },
7144 };
7145 request_value_reader
7146 .seek(std::io::SeekFrom::Start(0))
7147 .unwrap();
7148 let mut req_result = {
7149 let client = &self.hub.client;
7150 dlg.pre_request();
7151 let mut req_builder = hyper::Request::builder()
7152 .method(hyper::Method::PATCH)
7153 .uri(url.as_str())
7154 .header(USER_AGENT, self.hub._user_agent.clone());
7155
7156 if let Some(token) = token.as_ref() {
7157 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7158 }
7159
7160 let request = req_builder
7161 .header(CONTENT_TYPE, json_mime_type.to_string())
7162 .header(CONTENT_LENGTH, request_size as u64)
7163 .body(common::to_body(
7164 request_value_reader.get_ref().clone().into(),
7165 ));
7166
7167 client.request(request.unwrap()).await
7168 };
7169
7170 match req_result {
7171 Err(err) => {
7172 if let common::Retry::After(d) = dlg.http_error(&err) {
7173 sleep(d).await;
7174 continue;
7175 }
7176 dlg.finished(false);
7177 return Err(common::Error::HttpError(err));
7178 }
7179 Ok(res) => {
7180 let (mut parts, body) = res.into_parts();
7181 let mut body = common::Body::new(body);
7182 if !parts.status.is_success() {
7183 let bytes = common::to_bytes(body).await.unwrap_or_default();
7184 let error = serde_json::from_str(&common::to_string(&bytes));
7185 let response = common::to_response(parts, bytes.into());
7186
7187 if let common::Retry::After(d) =
7188 dlg.http_failure(&response, error.as_ref().ok())
7189 {
7190 sleep(d).await;
7191 continue;
7192 }
7193
7194 dlg.finished(false);
7195
7196 return Err(match error {
7197 Ok(value) => common::Error::BadRequest(value),
7198 _ => common::Error::Failure(response),
7199 });
7200 }
7201 let response = {
7202 let bytes = common::to_bytes(body).await.unwrap_or_default();
7203 let encoded = common::to_string(&bytes);
7204 match serde_json::from_str(&encoded) {
7205 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7206 Err(error) => {
7207 dlg.response_json_decode_error(&encoded, &error);
7208 return Err(common::Error::JsonDecodeError(
7209 encoded.to_string(),
7210 error,
7211 ));
7212 }
7213 }
7214 };
7215
7216 dlg.finished(true);
7217 return Ok(response);
7218 }
7219 }
7220 }
7221 }
7222
7223 ///
7224 /// Sets the *request* property to the given value.
7225 ///
7226 /// Even though the property as already been set when instantiating this call,
7227 /// we provide this method for API completeness.
7228 pub fn request(mut self, new_value: IapSettings) -> MethodUpdateIapSettingCall<'a, C> {
7229 self._request = new_value;
7230 self
7231 }
7232 /// Required. The resource name of the IAP protected resource.
7233 ///
7234 /// Sets the *name* path property to the given value.
7235 ///
7236 /// Even though the property as already been set when instantiating this call,
7237 /// we provide this method for API completeness.
7238 pub fn name(mut self, new_value: &str) -> MethodUpdateIapSettingCall<'a, C> {
7239 self._name = new_value.to_string();
7240 self
7241 }
7242 /// The field mask specifying which IAP settings should be updated. If omitted, then all of the settings are updated. See https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Note: All IAP reauth settings must always be set together, using the field mask: `iapSettings.accessSettings.reauthSettings`.
7243 ///
7244 /// Sets the *update mask* query property to the given value.
7245 pub fn update_mask(
7246 mut self,
7247 new_value: common::FieldMask,
7248 ) -> MethodUpdateIapSettingCall<'a, C> {
7249 self._update_mask = Some(new_value);
7250 self
7251 }
7252 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7253 /// while executing the actual API request.
7254 ///
7255 /// ````text
7256 /// It should be used to handle progress information, and to implement a certain level of resilience.
7257 /// ````
7258 ///
7259 /// Sets the *delegate* property to the given value.
7260 pub fn delegate(
7261 mut self,
7262 new_value: &'a mut dyn common::Delegate,
7263 ) -> MethodUpdateIapSettingCall<'a, C> {
7264 self._delegate = Some(new_value);
7265 self
7266 }
7267
7268 /// Set any additional parameter of the query string used in the request.
7269 /// It should be used to set parameters which are not yet available through their own
7270 /// setters.
7271 ///
7272 /// Please note that this method must not be used to set any of the known parameters
7273 /// which have their own setter method. If done anyway, the request will fail.
7274 ///
7275 /// # Additional Parameters
7276 ///
7277 /// * *$.xgafv* (query-string) - V1 error format.
7278 /// * *access_token* (query-string) - OAuth access token.
7279 /// * *alt* (query-string) - Data format for response.
7280 /// * *callback* (query-string) - JSONP
7281 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7282 /// * *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.
7283 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7284 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7285 /// * *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.
7286 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7287 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7288 pub fn param<T>(mut self, name: T, value: T) -> MethodUpdateIapSettingCall<'a, C>
7289 where
7290 T: AsRef<str>,
7291 {
7292 self._additional_params
7293 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7294 self
7295 }
7296
7297 /// Identifies the authorization scope for the method you are building.
7298 ///
7299 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7300 /// [`Scope::CloudPlatform`].
7301 ///
7302 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7303 /// tokens for more than one scope.
7304 ///
7305 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7306 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7307 /// sufficient, a read-write scope will do as well.
7308 pub fn add_scope<St>(mut self, scope: St) -> MethodUpdateIapSettingCall<'a, C>
7309 where
7310 St: AsRef<str>,
7311 {
7312 self._scopes.insert(String::from(scope.as_ref()));
7313 self
7314 }
7315 /// Identifies the authorization scope(s) for the method you are building.
7316 ///
7317 /// See [`Self::add_scope()`] for details.
7318 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodUpdateIapSettingCall<'a, C>
7319 where
7320 I: IntoIterator<Item = St>,
7321 St: AsRef<str>,
7322 {
7323 self._scopes
7324 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7325 self
7326 }
7327
7328 /// Removes all scopes, and no default scope will be used either.
7329 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7330 /// for details).
7331 pub fn clear_scopes(mut self) -> MethodUpdateIapSettingCall<'a, C> {
7332 self._scopes.clear();
7333 self
7334 }
7335}
7336
7337/// Validates that a given CEL expression conforms to IAP restrictions.
7338///
7339/// A builder for the *validateAttributeExpression* method.
7340/// It is not used directly, but through a [`MethodMethods`] instance.
7341///
7342/// # Example
7343///
7344/// Instantiate a resource method builder
7345///
7346/// ```test_harness,no_run
7347/// # extern crate hyper;
7348/// # extern crate hyper_rustls;
7349/// # extern crate google_iap1 as iap1;
7350/// # async fn dox() {
7351/// # use iap1::{CloudIAP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7352///
7353/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7354/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7355/// # .with_native_roots()
7356/// # .unwrap()
7357/// # .https_only()
7358/// # .enable_http2()
7359/// # .build();
7360///
7361/// # let executor = hyper_util::rt::TokioExecutor::new();
7362/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7363/// # secret,
7364/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7365/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7366/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7367/// # ),
7368/// # ).build().await.unwrap();
7369///
7370/// # let client = hyper_util::client::legacy::Client::builder(
7371/// # hyper_util::rt::TokioExecutor::new()
7372/// # )
7373/// # .build(
7374/// # hyper_rustls::HttpsConnectorBuilder::new()
7375/// # .with_native_roots()
7376/// # .unwrap()
7377/// # .https_or_http()
7378/// # .enable_http2()
7379/// # .build()
7380/// # );
7381/// # let mut hub = CloudIAP::new(client, auth);
7382/// // You can configure optional parameters by calling the respective setters at will, and
7383/// // execute the final call using `doit()`.
7384/// // Values shown here are possibly random and not representative !
7385/// let result = hub.methods().validate_attribute_expression("name")
7386/// .expression("rebum.")
7387/// .doit().await;
7388/// # }
7389/// ```
7390pub struct MethodValidateAttributeExpressionCall<'a, C>
7391where
7392 C: 'a,
7393{
7394 hub: &'a CloudIAP<C>,
7395 _name: String,
7396 _expression: Option<String>,
7397 _delegate: Option<&'a mut dyn common::Delegate>,
7398 _additional_params: HashMap<String, String>,
7399 _scopes: BTreeSet<String>,
7400}
7401
7402impl<'a, C> common::CallBuilder for MethodValidateAttributeExpressionCall<'a, C> {}
7403
7404impl<'a, C> MethodValidateAttributeExpressionCall<'a, C>
7405where
7406 C: common::Connector,
7407{
7408 /// Perform the operation you have build so far.
7409 pub async fn doit(
7410 mut self,
7411 ) -> common::Result<(common::Response, ValidateIapAttributeExpressionResponse)> {
7412 use std::borrow::Cow;
7413 use std::io::{Read, Seek};
7414
7415 use common::{url::Params, ToParts};
7416 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7417
7418 let mut dd = common::DefaultDelegate;
7419 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7420 dlg.begin(common::MethodInfo {
7421 id: "iap.validateAttributeExpression",
7422 http_method: hyper::Method::POST,
7423 });
7424
7425 for &field in ["alt", "name", "expression"].iter() {
7426 if self._additional_params.contains_key(field) {
7427 dlg.finished(false);
7428 return Err(common::Error::FieldClash(field));
7429 }
7430 }
7431
7432 let mut params = Params::with_capacity(4 + self._additional_params.len());
7433 params.push("name", self._name);
7434 if let Some(value) = self._expression.as_ref() {
7435 params.push("expression", value);
7436 }
7437
7438 params.extend(self._additional_params.iter());
7439
7440 params.push("alt", "json");
7441 let mut url = self.hub._base_url.clone() + "v1/{+name}:validateAttributeExpression";
7442 if self._scopes.is_empty() {
7443 self._scopes
7444 .insert(Scope::CloudPlatform.as_ref().to_string());
7445 }
7446
7447 #[allow(clippy::single_element_loop)]
7448 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7449 url = params.uri_replacement(url, param_name, find_this, true);
7450 }
7451 {
7452 let to_remove = ["name"];
7453 params.remove_params(&to_remove);
7454 }
7455
7456 let url = params.parse_with_url(&url);
7457
7458 loop {
7459 let token = match self
7460 .hub
7461 .auth
7462 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7463 .await
7464 {
7465 Ok(token) => token,
7466 Err(e) => match dlg.token(e) {
7467 Ok(token) => token,
7468 Err(e) => {
7469 dlg.finished(false);
7470 return Err(common::Error::MissingToken(e));
7471 }
7472 },
7473 };
7474 let mut req_result = {
7475 let client = &self.hub.client;
7476 dlg.pre_request();
7477 let mut req_builder = hyper::Request::builder()
7478 .method(hyper::Method::POST)
7479 .uri(url.as_str())
7480 .header(USER_AGENT, self.hub._user_agent.clone());
7481
7482 if let Some(token) = token.as_ref() {
7483 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7484 }
7485
7486 let request = req_builder
7487 .header(CONTENT_LENGTH, 0_u64)
7488 .body(common::to_body::<String>(None));
7489
7490 client.request(request.unwrap()).await
7491 };
7492
7493 match req_result {
7494 Err(err) => {
7495 if let common::Retry::After(d) = dlg.http_error(&err) {
7496 sleep(d).await;
7497 continue;
7498 }
7499 dlg.finished(false);
7500 return Err(common::Error::HttpError(err));
7501 }
7502 Ok(res) => {
7503 let (mut parts, body) = res.into_parts();
7504 let mut body = common::Body::new(body);
7505 if !parts.status.is_success() {
7506 let bytes = common::to_bytes(body).await.unwrap_or_default();
7507 let error = serde_json::from_str(&common::to_string(&bytes));
7508 let response = common::to_response(parts, bytes.into());
7509
7510 if let common::Retry::After(d) =
7511 dlg.http_failure(&response, error.as_ref().ok())
7512 {
7513 sleep(d).await;
7514 continue;
7515 }
7516
7517 dlg.finished(false);
7518
7519 return Err(match error {
7520 Ok(value) => common::Error::BadRequest(value),
7521 _ => common::Error::Failure(response),
7522 });
7523 }
7524 let response = {
7525 let bytes = common::to_bytes(body).await.unwrap_or_default();
7526 let encoded = common::to_string(&bytes);
7527 match serde_json::from_str(&encoded) {
7528 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7529 Err(error) => {
7530 dlg.response_json_decode_error(&encoded, &error);
7531 return Err(common::Error::JsonDecodeError(
7532 encoded.to_string(),
7533 error,
7534 ));
7535 }
7536 }
7537 };
7538
7539 dlg.finished(true);
7540 return Ok(response);
7541 }
7542 }
7543 }
7544 }
7545
7546 /// Required. The resource name of the IAP protected resource.
7547 ///
7548 /// Sets the *name* path property to the given value.
7549 ///
7550 /// Even though the property as already been set when instantiating this call,
7551 /// we provide this method for API completeness.
7552 pub fn name(mut self, new_value: &str) -> MethodValidateAttributeExpressionCall<'a, C> {
7553 self._name = new_value.to_string();
7554 self
7555 }
7556 /// Required. User input string expression. Should be of the form `attributes.saml_attributes.filter(attribute, attribute.name in ['{attribute_name}', '{attribute_name}'])`
7557 ///
7558 /// Sets the *expression* query property to the given value.
7559 pub fn expression(mut self, new_value: &str) -> MethodValidateAttributeExpressionCall<'a, C> {
7560 self._expression = Some(new_value.to_string());
7561 self
7562 }
7563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7564 /// while executing the actual API request.
7565 ///
7566 /// ````text
7567 /// It should be used to handle progress information, and to implement a certain level of resilience.
7568 /// ````
7569 ///
7570 /// Sets the *delegate* property to the given value.
7571 pub fn delegate(
7572 mut self,
7573 new_value: &'a mut dyn common::Delegate,
7574 ) -> MethodValidateAttributeExpressionCall<'a, C> {
7575 self._delegate = Some(new_value);
7576 self
7577 }
7578
7579 /// Set any additional parameter of the query string used in the request.
7580 /// It should be used to set parameters which are not yet available through their own
7581 /// setters.
7582 ///
7583 /// Please note that this method must not be used to set any of the known parameters
7584 /// which have their own setter method. If done anyway, the request will fail.
7585 ///
7586 /// # Additional Parameters
7587 ///
7588 /// * *$.xgafv* (query-string) - V1 error format.
7589 /// * *access_token* (query-string) - OAuth access token.
7590 /// * *alt* (query-string) - Data format for response.
7591 /// * *callback* (query-string) - JSONP
7592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7593 /// * *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.
7594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7596 /// * *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.
7597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7599 pub fn param<T>(mut self, name: T, value: T) -> MethodValidateAttributeExpressionCall<'a, C>
7600 where
7601 T: AsRef<str>,
7602 {
7603 self._additional_params
7604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7605 self
7606 }
7607
7608 /// Identifies the authorization scope for the method you are building.
7609 ///
7610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7611 /// [`Scope::CloudPlatform`].
7612 ///
7613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7614 /// tokens for more than one scope.
7615 ///
7616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7618 /// sufficient, a read-write scope will do as well.
7619 pub fn add_scope<St>(mut self, scope: St) -> MethodValidateAttributeExpressionCall<'a, C>
7620 where
7621 St: AsRef<str>,
7622 {
7623 self._scopes.insert(String::from(scope.as_ref()));
7624 self
7625 }
7626 /// Identifies the authorization scope(s) for the method you are building.
7627 ///
7628 /// See [`Self::add_scope()`] for details.
7629 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodValidateAttributeExpressionCall<'a, C>
7630 where
7631 I: IntoIterator<Item = St>,
7632 St: AsRef<str>,
7633 {
7634 self._scopes
7635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7636 self
7637 }
7638
7639 /// Removes all scopes, and no default scope will be used either.
7640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7641 /// for details).
7642 pub fn clear_scopes(mut self) -> MethodValidateAttributeExpressionCall<'a, C> {
7643 self._scopes.clear();
7644 self
7645 }
7646}