google_gkehub1/api.rs
1use std::collections::HashMap;
2use std::cell::RefCell;
3use std::default::Default;
4use std::collections::BTreeSet;
5use std::error::Error as StdError;
6use serde_json as json;
7use std::io;
8use std::fs;
9use std::mem;
10
11use hyper::client::connect;
12use tokio::io::{AsyncRead, AsyncWrite};
13use tokio::time::sleep;
14use tower_service;
15use serde::{Serialize, Deserialize};
16
17use crate::{client, client::GetToken, client::serde_with};
18
19// ##############
20// UTILITIES ###
21// ############
22
23/// Identifies the an OAuth2 authorization scope.
24/// A scope is needed when requesting an
25/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
26#[derive(PartialEq, Eq, Hash)]
27pub enum Scope {
28 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
29 CloudPlatform,
30}
31
32impl AsRef<str> for Scope {
33 fn as_ref(&self) -> &str {
34 match *self {
35 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
36 }
37 }
38}
39
40impl Default for Scope {
41 fn default() -> Scope {
42 Scope::CloudPlatform
43 }
44}
45
46
47
48// ########
49// HUB ###
50// ######
51
52/// Central instance to access all GKEHub related resource activities
53///
54/// # Examples
55///
56/// Instantiate a new hub
57///
58/// ```test_harness,no_run
59/// extern crate hyper;
60/// extern crate hyper_rustls;
61/// extern crate google_gkehub1 as gkehub1;
62/// use gkehub1::api::Feature;
63/// use gkehub1::{Result, Error};
64/// # async fn dox() {
65/// use std::default::Default;
66/// use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
67///
68/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
69/// // `client_secret`, among other things.
70/// let secret: oauth2::ApplicationSecret = Default::default();
71/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
72/// // unless you replace `None` with the desired Flow.
73/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
74/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
75/// // retrieve them from storage.
76/// let auth = oauth2::InstalledFlowAuthenticator::builder(
77/// secret,
78/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79/// ).build().await.unwrap();
80/// let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
81/// // As the method needs a request, you would usually fill it with the desired information
82/// // into the respective structure. Some of the parts shown here might not be applicable !
83/// // Values shown here are possibly random and not representative !
84/// let mut req = Feature::default();
85///
86/// // You can configure optional parameters by calling the respective setters at will, and
87/// // execute the final call using `doit()`.
88/// // Values shown here are possibly random and not representative !
89/// let result = hub.projects().locations_features_create(req, "parent")
90/// .request_id("sed")
91/// .feature_id("amet.")
92/// .doit().await;
93///
94/// match result {
95/// Err(e) => match e {
96/// // The Error enum provides details about what exactly happened.
97/// // You can also just use its `Debug`, `Display` or `Error` traits
98/// Error::HttpError(_)
99/// |Error::Io(_)
100/// |Error::MissingAPIKey
101/// |Error::MissingToken(_)
102/// |Error::Cancelled
103/// |Error::UploadSizeLimitExceeded(_, _)
104/// |Error::Failure(_)
105/// |Error::BadRequest(_)
106/// |Error::FieldClash(_)
107/// |Error::JsonDecodeError(_, _) => println!("{}", e),
108/// },
109/// Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct GKEHub<S> {
115 pub client: hyper::Client<S, hyper::body::Body>,
116 pub auth: Box<dyn client::GetToken>,
117 _user_agent: String,
118 _base_url: String,
119 _root_url: String,
120}
121
122impl<'a, S> client::Hub for GKEHub<S> {}
123
124impl<'a, S> GKEHub<S> {
125
126 pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> GKEHub<S> {
127 GKEHub {
128 client,
129 auth: Box::new(auth),
130 _user_agent: "google-api-rust-client/5.0.3".to_string(),
131 _base_url: "https://gkehub.googleapis.com/".to_string(),
132 _root_url: "https://gkehub.googleapis.com/".to_string(),
133 }
134 }
135
136 pub fn projects(&'a self) -> ProjectMethods<'a, S> {
137 ProjectMethods { hub: &self }
138 }
139
140 /// Set the user-agent header field to use in all requests to the server.
141 /// It defaults to `google-api-rust-client/5.0.3`.
142 ///
143 /// Returns the previously set user-agent.
144 pub fn user_agent(&mut self, agent_name: String) -> String {
145 mem::replace(&mut self._user_agent, agent_name)
146 }
147
148 /// Set the base url to use in all requests to the server.
149 /// It defaults to `https://gkehub.googleapis.com/`.
150 ///
151 /// Returns the previously set base url.
152 pub fn base_url(&mut self, new_base_url: String) -> String {
153 mem::replace(&mut self._base_url, new_base_url)
154 }
155
156 /// Set the root url to use in all requests to the server.
157 /// It defaults to `https://gkehub.googleapis.com/`.
158 ///
159 /// Returns the previously set root url.
160 pub fn root_url(&mut self, new_root_url: String) -> String {
161 mem::replace(&mut self._root_url, new_root_url)
162 }
163}
164
165
166// ############
167// SCHEMAS ###
168// ##########
169/// Spec for App Dev Experience Feature.
170///
171/// This type is not used in any activity, and only used as *part* of another schema.
172///
173#[serde_with::serde_as(crate = "::client::serde_with")]
174#[derive(Default, Clone, Debug, Serialize, Deserialize)]
175pub struct AppDevExperienceFeatureSpec { _never_set: Option<bool> }
176
177impl client::Part for AppDevExperienceFeatureSpec {}
178
179
180/// State for App Dev Exp Feature.
181///
182/// This type is not used in any activity, and only used as *part* of another schema.
183///
184#[serde_with::serde_as(crate = "::client::serde_with")]
185#[derive(Default, Clone, Debug, Serialize, Deserialize)]
186pub struct AppDevExperienceFeatureState {
187 /// Status of subcomponent that detects configured Service Mesh resources.
188 #[serde(rename="networkingInstallSucceeded")]
189
190 pub networking_install_succeeded: Option<Status>,
191}
192
193impl client::Part for AppDevExperienceFeatureState {}
194
195
196/// ApplianceCluster contains information specific to GDC Edge Appliance Clusters.
197///
198/// This type is not used in any activity, and only used as *part* of another schema.
199///
200#[serde_with::serde_as(crate = "::client::serde_with")]
201#[derive(Default, Clone, Debug, Serialize, Deserialize)]
202pub struct ApplianceCluster {
203 /// Immutable. Self-link of the GCP resource for the Appliance Cluster. For example: //transferappliance.googleapis.com/projects/my-project/locations/us-west1-a/appliances/my-appliance
204 #[serde(rename="resourceLink")]
205
206 pub resource_link: Option<String>,
207}
208
209impl client::Part for ApplianceCluster {}
210
211
212/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
213///
214/// This type is not used in any activity, and only used as *part* of another schema.
215///
216#[serde_with::serde_as(crate = "::client::serde_with")]
217#[derive(Default, Clone, Debug, Serialize, Deserialize)]
218pub struct AuditConfig {
219 /// The configuration for logging of each type of permission.
220 #[serde(rename="auditLogConfigs")]
221
222 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
223 /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
224
225 pub service: Option<String>,
226}
227
228impl client::Part for AuditConfig {}
229
230
231/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[serde_with::serde_as(crate = "::client::serde_with")]
236#[derive(Default, Clone, Debug, Serialize, Deserialize)]
237pub struct AuditLogConfig {
238 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
239 #[serde(rename="exemptedMembers")]
240
241 pub exempted_members: Option<Vec<String>>,
242 /// The log type that this config enables.
243 #[serde(rename="logType")]
244
245 pub log_type: Option<String>,
246}
247
248impl client::Part for AuditLogConfig {}
249
250
251/// Authority encodes how Google will recognize identities from this Membership. See the workload identity documentation for more details: https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
252///
253/// This type is not used in any activity, and only used as *part* of another schema.
254///
255#[serde_with::serde_as(crate = "::client::serde_with")]
256#[derive(Default, Clone, Debug, Serialize, Deserialize)]
257pub struct Authority {
258 /// Output only. An identity provider that reflects the `issuer` in the workload identity pool.
259 #[serde(rename="identityProvider")]
260
261 pub identity_provider: Option<String>,
262 /// Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://` and be a valid URL with length <2000 characters. If set, then Google will allow valid OIDC tokens from this issuer to authenticate within the workload_identity_pool. OIDC discovery will be performed on this URI to validate tokens from the issuer. Clearing `issuer` disables Workload Identity. `issuer` cannot be directly modified; it must be cleared (and Workload Identity disabled) before using a new issuer (and re-enabling Workload Identity).
263
264 pub issuer: Option<String>,
265 /// Optional. OIDC verification keys for this Membership in JWKS format (RFC 7517). When this field is set, OIDC discovery will NOT be performed on `issuer`, and instead OIDC tokens will be validated using this field.
266 #[serde(rename="oidcJwks")]
267
268 #[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
269 pub oidc_jwks: Option<Vec<u8>>,
270 /// Output only. The name of the workload identity pool in which `issuer` will be recognized. There is a single Workload Identity Pool per Hub that is shared between all Memberships that belong to that Hub. For a Hub hosted in {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`, although this is subject to change in newer versions of this API.
271 #[serde(rename="workloadIdentityPool")]
272
273 pub workload_identity_pool: Option<String>,
274}
275
276impl client::Part for Authority {}
277
278
279/// Associates `members`, or principals, with a `role`.
280///
281/// This type is not used in any activity, and only used as *part* of another schema.
282///
283#[serde_with::serde_as(crate = "::client::serde_with")]
284#[derive(Default, Clone, Debug, Serialize, Deserialize)]
285pub struct Binding {
286 /// 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).
287
288 pub condition: Option<Expr>,
289 /// 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`. * `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. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
290
291 pub members: Option<Vec<String>>,
292 /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
293
294 pub role: Option<String>,
295}
296
297impl client::Part for Binding {}
298
299
300/// The request message for Operations.CancelOperation.
301///
302/// # Activities
303///
304/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
305/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
306///
307/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
308#[serde_with::serde_as(crate = "::client::serde_with")]
309#[derive(Default, Clone, Debug, Serialize, Deserialize)]
310pub struct CancelOperationRequest { _never_set: Option<bool> }
311
312impl client::RequestValue for CancelOperationRequest {}
313
314
315/// CommonFeatureSpec contains Hub-wide configuration information
316///
317/// This type is not used in any activity, and only used as *part* of another schema.
318///
319#[serde_with::serde_as(crate = "::client::serde_with")]
320#[derive(Default, Clone, Debug, Serialize, Deserialize)]
321pub struct CommonFeatureSpec {
322 /// Appdevexperience specific spec.
323
324 pub appdevexperience: Option<AppDevExperienceFeatureSpec>,
325 /// FleetObservability feature spec.
326
327 pub fleetobservability: Option<FleetObservabilityFeatureSpec>,
328 /// Multicluster Ingress-specific spec.
329
330 pub multiclusteringress: Option<MultiClusterIngressFeatureSpec>,
331}
332
333impl client::Part for CommonFeatureSpec {}
334
335
336/// CommonFeatureState contains Hub-wide Feature status information.
337///
338/// This type is not used in any activity, and only used as *part* of another schema.
339///
340#[serde_with::serde_as(crate = "::client::serde_with")]
341#[derive(Default, Clone, Debug, Serialize, Deserialize)]
342pub struct CommonFeatureState {
343 /// Appdevexperience specific state.
344
345 pub appdevexperience: Option<AppDevExperienceFeatureState>,
346 /// FleetObservability feature state.
347
348 pub fleetobservability: Option<FleetObservabilityFeatureState>,
349 /// Output only. The "running state" of the Feature in this Hub.
350
351 pub state: Option<FeatureState>,
352}
353
354impl client::Part for CommonFeatureState {}
355
356
357/// Configuration for Config Sync
358///
359/// This type is not used in any activity, and only used as *part* of another schema.
360///
361#[serde_with::serde_as(crate = "::client::serde_with")]
362#[derive(Default, Clone, Debug, Serialize, Deserialize)]
363pub struct ConfigManagementConfigSync {
364 /// Set to true to allow the vertical scaling. Defaults to false which disallows vertical scaling. This field is deprecated.
365 #[serde(rename="allowVerticalScale")]
366
367 pub allow_vertical_scale: Option<bool>,
368 /// Enables the installation of ConfigSync. If set to true, ConfigSync resources will be created and the other ConfigSync fields will be applied if exist. If set to false, all other ConfigSync fields will be ignored, ConfigSync resources will be deleted. If omitted, ConfigSync resources will be managed depends on the presence of git field.
369
370 pub enabled: Option<bool>,
371 /// Git repo configuration for the cluster.
372
373 pub git: Option<ConfigManagementGitConfig>,
374 /// OCI repo configuration for the cluster
375
376 pub oci: Option<ConfigManagementOciConfig>,
377 /// Set to true to enable the Config Sync admission webhook to prevent drifts. If set to `false`, disables the Config Sync admission webhook and does not prevent drifts.
378 #[serde(rename="preventDrift")]
379
380 pub prevent_drift: Option<bool>,
381 /// Specifies whether the Config Sync Repo is in "hierarchical" or "unstructured" mode.
382 #[serde(rename="sourceFormat")]
383
384 pub source_format: Option<String>,
385}
386
387impl client::Part for ConfigManagementConfigSync {}
388
389
390/// The state of ConfigSync's deployment on a cluster
391///
392/// This type is not used in any activity, and only used as *part* of another schema.
393///
394#[serde_with::serde_as(crate = "::client::serde_with")]
395#[derive(Default, Clone, Debug, Serialize, Deserialize)]
396pub struct ConfigManagementConfigSyncDeploymentState {
397 /// Deployment state of admission-webhook
398 #[serde(rename="admissionWebhook")]
399
400 pub admission_webhook: Option<String>,
401 /// Deployment state of the git-sync pod
402 #[serde(rename="gitSync")]
403
404 pub git_sync: Option<String>,
405 /// Deployment state of the importer pod
406
407 pub importer: Option<String>,
408 /// Deployment state of the monitor pod
409
410 pub monitor: Option<String>,
411 /// Deployment state of reconciler-manager pod
412 #[serde(rename="reconcilerManager")]
413
414 pub reconciler_manager: Option<String>,
415 /// Deployment state of root-reconciler
416 #[serde(rename="rootReconciler")]
417
418 pub root_reconciler: Option<String>,
419 /// Deployment state of the syncer pod
420
421 pub syncer: Option<String>,
422}
423
424impl client::Part for ConfigManagementConfigSyncDeploymentState {}
425
426
427/// State information for ConfigSync
428///
429/// This type is not used in any activity, and only used as *part* of another schema.
430///
431#[serde_with::serde_as(crate = "::client::serde_with")]
432#[derive(Default, Clone, Debug, Serialize, Deserialize)]
433pub struct ConfigManagementConfigSyncState {
434 /// Information about the deployment of ConfigSync, including the version of the various Pods deployed
435 #[serde(rename="deploymentState")]
436
437 pub deployment_state: Option<ConfigManagementConfigSyncDeploymentState>,
438 /// The state of ConfigSync's process to sync configs to a cluster
439 #[serde(rename="syncState")]
440
441 pub sync_state: Option<ConfigManagementSyncState>,
442 /// The version of ConfigSync deployed
443
444 pub version: Option<ConfigManagementConfigSyncVersion>,
445}
446
447impl client::Part for ConfigManagementConfigSyncState {}
448
449
450/// Specific versioning information pertaining to ConfigSync's Pods
451///
452/// This type is not used in any activity, and only used as *part* of another schema.
453///
454#[serde_with::serde_as(crate = "::client::serde_with")]
455#[derive(Default, Clone, Debug, Serialize, Deserialize)]
456pub struct ConfigManagementConfigSyncVersion {
457 /// Version of the deployed admission_webhook pod
458 #[serde(rename="admissionWebhook")]
459
460 pub admission_webhook: Option<String>,
461 /// Version of the deployed git-sync pod
462 #[serde(rename="gitSync")]
463
464 pub git_sync: Option<String>,
465 /// Version of the deployed importer pod
466
467 pub importer: Option<String>,
468 /// Version of the deployed monitor pod
469
470 pub monitor: Option<String>,
471 /// Version of the deployed reconciler-manager pod
472 #[serde(rename="reconcilerManager")]
473
474 pub reconciler_manager: Option<String>,
475 /// Version of the deployed reconciler container in root-reconciler pod
476 #[serde(rename="rootReconciler")]
477
478 pub root_reconciler: Option<String>,
479 /// Version of the deployed syncer pod
480
481 pub syncer: Option<String>,
482}
483
484impl client::Part for ConfigManagementConfigSyncVersion {}
485
486
487/// Model for a config file in the git repo with an associated Sync error
488///
489/// This type is not used in any activity, and only used as *part* of another schema.
490///
491#[serde_with::serde_as(crate = "::client::serde_with")]
492#[derive(Default, Clone, Debug, Serialize, Deserialize)]
493pub struct ConfigManagementErrorResource {
494 /// Group/version/kind of the resource that is causing an error
495 #[serde(rename="resourceGvk")]
496
497 pub resource_gvk: Option<ConfigManagementGroupVersionKind>,
498 /// Metadata name of the resource that is causing an error
499 #[serde(rename="resourceName")]
500
501 pub resource_name: Option<String>,
502 /// Namespace of the resource that is causing an error
503 #[serde(rename="resourceNamespace")]
504
505 pub resource_namespace: Option<String>,
506 /// Path in the git repo of the erroneous config
507 #[serde(rename="sourcePath")]
508
509 pub source_path: Option<String>,
510}
511
512impl client::Part for ConfigManagementErrorResource {}
513
514
515/// State of Policy Controller installation.
516///
517/// This type is not used in any activity, and only used as *part* of another schema.
518///
519#[serde_with::serde_as(crate = "::client::serde_with")]
520#[derive(Default, Clone, Debug, Serialize, Deserialize)]
521pub struct ConfigManagementGatekeeperDeploymentState {
522 /// Status of gatekeeper-audit deployment.
523 #[serde(rename="gatekeeperAudit")]
524
525 pub gatekeeper_audit: Option<String>,
526 /// Status of gatekeeper-controller-manager pod.
527 #[serde(rename="gatekeeperControllerManagerState")]
528
529 pub gatekeeper_controller_manager_state: Option<String>,
530 /// Status of the pod serving the mutation webhook.
531 #[serde(rename="gatekeeperMutation")]
532
533 pub gatekeeper_mutation: Option<String>,
534}
535
536impl client::Part for ConfigManagementGatekeeperDeploymentState {}
537
538
539/// Git repo configuration for a single cluster.
540///
541/// This type is not used in any activity, and only used as *part* of another schema.
542///
543#[serde_with::serde_as(crate = "::client::serde_with")]
544#[derive(Default, Clone, Debug, Serialize, Deserialize)]
545pub struct ConfigManagementGitConfig {
546 /// The GCP Service Account Email used for auth when secret_type is gcpServiceAccount.
547 #[serde(rename="gcpServiceAccountEmail")]
548
549 pub gcp_service_account_email: Option<String>,
550 /// URL for the HTTPS proxy to be used when communicating with the Git repo.
551 #[serde(rename="httpsProxy")]
552
553 pub https_proxy: Option<String>,
554 /// The path within the Git repository that represents the top level of the repo to sync. Default: the root directory of the repository.
555 #[serde(rename="policyDir")]
556
557 pub policy_dir: Option<String>,
558 /// Type of secret configured for access to the Git repo. Must be one of ssh, cookiefile, gcenode, token, gcpserviceaccount or none. The validation of this is case-sensitive. Required.
559 #[serde(rename="secretType")]
560
561 pub secret_type: Option<String>,
562 /// The branch of the repository to sync from. Default: master.
563 #[serde(rename="syncBranch")]
564
565 pub sync_branch: Option<String>,
566 /// The URL of the Git repository to use as the source of truth.
567 #[serde(rename="syncRepo")]
568
569 pub sync_repo: Option<String>,
570 /// Git revision (tag or hash) to check out. Default HEAD.
571 #[serde(rename="syncRev")]
572
573 pub sync_rev: Option<String>,
574 /// Period in seconds between consecutive syncs. Default: 15.
575 #[serde(rename="syncWaitSecs")]
576
577 #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
578 pub sync_wait_secs: Option<i64>,
579}
580
581impl client::Part for ConfigManagementGitConfig {}
582
583
584/// A Kubernetes object's GVK
585///
586/// This type is not used in any activity, and only used as *part* of another schema.
587///
588#[serde_with::serde_as(crate = "::client::serde_with")]
589#[derive(Default, Clone, Debug, Serialize, Deserialize)]
590pub struct ConfigManagementGroupVersionKind {
591 /// Kubernetes Group
592
593 pub group: Option<String>,
594 /// Kubernetes Kind
595
596 pub kind: Option<String>,
597 /// Kubernetes Version
598
599 pub version: Option<String>,
600}
601
602impl client::Part for ConfigManagementGroupVersionKind {}
603
604
605/// Configuration for Hierarchy Controller
606///
607/// This type is not used in any activity, and only used as *part* of another schema.
608///
609#[serde_with::serde_as(crate = "::client::serde_with")]
610#[derive(Default, Clone, Debug, Serialize, Deserialize)]
611pub struct ConfigManagementHierarchyControllerConfig {
612 /// Whether hierarchical resource quota is enabled in this cluster.
613 #[serde(rename="enableHierarchicalResourceQuota")]
614
615 pub enable_hierarchical_resource_quota: Option<bool>,
616 /// Whether pod tree labels are enabled in this cluster.
617 #[serde(rename="enablePodTreeLabels")]
618
619 pub enable_pod_tree_labels: Option<bool>,
620 /// Whether Hierarchy Controller is enabled in this cluster.
621
622 pub enabled: Option<bool>,
623}
624
625impl client::Part for ConfigManagementHierarchyControllerConfig {}
626
627
628/// Deployment state for Hierarchy Controller
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[serde_with::serde_as(crate = "::client::serde_with")]
633#[derive(Default, Clone, Debug, Serialize, Deserialize)]
634pub struct ConfigManagementHierarchyControllerDeploymentState {
635 /// The deployment state for Hierarchy Controller extension (e.g. v0.7.0-hc.1)
636
637 pub extension: Option<String>,
638 /// The deployment state for open source HNC (e.g. v0.7.0-hc.0)
639
640 pub hnc: Option<String>,
641}
642
643impl client::Part for ConfigManagementHierarchyControllerDeploymentState {}
644
645
646/// State for Hierarchy Controller
647///
648/// This type is not used in any activity, and only used as *part* of another schema.
649///
650#[serde_with::serde_as(crate = "::client::serde_with")]
651#[derive(Default, Clone, Debug, Serialize, Deserialize)]
652pub struct ConfigManagementHierarchyControllerState {
653 /// The deployment state for Hierarchy Controller
654
655 pub state: Option<ConfigManagementHierarchyControllerDeploymentState>,
656 /// The version for Hierarchy Controller
657
658 pub version: Option<ConfigManagementHierarchyControllerVersion>,
659}
660
661impl client::Part for ConfigManagementHierarchyControllerState {}
662
663
664/// Version for Hierarchy Controller
665///
666/// This type is not used in any activity, and only used as *part* of another schema.
667///
668#[serde_with::serde_as(crate = "::client::serde_with")]
669#[derive(Default, Clone, Debug, Serialize, Deserialize)]
670pub struct ConfigManagementHierarchyControllerVersion {
671 /// Version for Hierarchy Controller extension
672
673 pub extension: Option<String>,
674 /// Version for open source HNC
675
676 pub hnc: Option<String>,
677}
678
679impl client::Part for ConfigManagementHierarchyControllerVersion {}
680
681
682/// Errors pertaining to the installation of ACM
683///
684/// This type is not used in any activity, and only used as *part* of another schema.
685///
686#[serde_with::serde_as(crate = "::client::serde_with")]
687#[derive(Default, Clone, Debug, Serialize, Deserialize)]
688pub struct ConfigManagementInstallError {
689 /// A string representing the user facing error message
690 #[serde(rename="errorMessage")]
691
692 pub error_message: Option<String>,
693}
694
695impl client::Part for ConfigManagementInstallError {}
696
697
698/// **Anthos Config Management**: Configuration for a single cluster. Intended to parallel the ConfigManagement CR.
699///
700/// This type is not used in any activity, and only used as *part* of another schema.
701///
702#[serde_with::serde_as(crate = "::client::serde_with")]
703#[derive(Default, Clone, Debug, Serialize, Deserialize)]
704pub struct ConfigManagementMembershipSpec {
705 /// Config Sync configuration for the cluster.
706 #[serde(rename="configSync")]
707
708 pub config_sync: Option<ConfigManagementConfigSync>,
709 /// Hierarchy Controller configuration for the cluster.
710 #[serde(rename="hierarchyController")]
711
712 pub hierarchy_controller: Option<ConfigManagementHierarchyControllerConfig>,
713 /// Policy Controller configuration for the cluster.
714 #[serde(rename="policyController")]
715
716 pub policy_controller: Option<ConfigManagementPolicyController>,
717 /// Version of ACM installed.
718
719 pub version: Option<String>,
720}
721
722impl client::Part for ConfigManagementMembershipSpec {}
723
724
725/// **Anthos Config Management**: State for a single cluster.
726///
727/// This type is not used in any activity, and only used as *part* of another schema.
728///
729#[serde_with::serde_as(crate = "::client::serde_with")]
730#[derive(Default, Clone, Debug, Serialize, Deserialize)]
731pub struct ConfigManagementMembershipState {
732 /// The user-defined name for the cluster used by ClusterSelectors to group clusters together. This should match Membership's membership_name, unless the user installed ACM on the cluster manually prior to enabling the ACM hub feature. Unique within a Anthos Config Management installation.
733 #[serde(rename="clusterName")]
734
735 pub cluster_name: Option<String>,
736 /// Current sync status
737 #[serde(rename="configSyncState")]
738
739 pub config_sync_state: Option<ConfigManagementConfigSyncState>,
740 /// Hierarchy Controller status
741 #[serde(rename="hierarchyControllerState")]
742
743 pub hierarchy_controller_state: Option<ConfigManagementHierarchyControllerState>,
744 /// Membership configuration in the cluster. This represents the actual state in the cluster, while the MembershipSpec in the FeatureSpec represents the intended state
745 #[serde(rename="membershipSpec")]
746
747 pub membership_spec: Option<ConfigManagementMembershipSpec>,
748 /// Current install status of ACM's Operator
749 #[serde(rename="operatorState")]
750
751 pub operator_state: Option<ConfigManagementOperatorState>,
752 /// PolicyController status
753 #[serde(rename="policyControllerState")]
754
755 pub policy_controller_state: Option<ConfigManagementPolicyControllerState>,
756}
757
758impl client::Part for ConfigManagementMembershipState {}
759
760
761/// OCI repo configuration for a single cluster
762///
763/// This type is not used in any activity, and only used as *part* of another schema.
764///
765#[serde_with::serde_as(crate = "::client::serde_with")]
766#[derive(Default, Clone, Debug, Serialize, Deserialize)]
767pub struct ConfigManagementOciConfig {
768 /// The GCP Service Account Email used for auth when secret_type is gcpServiceAccount.
769 #[serde(rename="gcpServiceAccountEmail")]
770
771 pub gcp_service_account_email: Option<String>,
772 /// The absolute path of the directory that contains the local resources. Default: the root directory of the image.
773 #[serde(rename="policyDir")]
774
775 pub policy_dir: Option<String>,
776 /// Type of secret configured for access to the Git repo.
777 #[serde(rename="secretType")]
778
779 pub secret_type: Option<String>,
780 /// The OCI image repository URL for the package to sync from. e.g. `LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME/PACKAGE_NAME`.
781 #[serde(rename="syncRepo")]
782
783 pub sync_repo: Option<String>,
784 /// Period in seconds between consecutive syncs. Default: 15.
785 #[serde(rename="syncWaitSecs")]
786
787 #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
788 pub sync_wait_secs: Option<i64>,
789}
790
791impl client::Part for ConfigManagementOciConfig {}
792
793
794/// State information for an ACM's Operator
795///
796/// This type is not used in any activity, and only used as *part* of another schema.
797///
798#[serde_with::serde_as(crate = "::client::serde_with")]
799#[derive(Default, Clone, Debug, Serialize, Deserialize)]
800pub struct ConfigManagementOperatorState {
801 /// The state of the Operator's deployment
802 #[serde(rename="deploymentState")]
803
804 pub deployment_state: Option<String>,
805 /// Install errors.
806
807 pub errors: Option<Vec<ConfigManagementInstallError>>,
808 /// The semenatic version number of the operator
809
810 pub version: Option<String>,
811}
812
813impl client::Part for ConfigManagementOperatorState {}
814
815
816/// Configuration for Policy Controller
817///
818/// This type is not used in any activity, and only used as *part* of another schema.
819///
820#[serde_with::serde_as(crate = "::client::serde_with")]
821#[derive(Default, Clone, Debug, Serialize, Deserialize)]
822pub struct ConfigManagementPolicyController {
823 /// Sets the interval for Policy Controller Audit Scans (in seconds). When set to 0, this disables audit functionality altogether.
824 #[serde(rename="auditIntervalSeconds")]
825
826 #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
827 pub audit_interval_seconds: Option<i64>,
828 /// Enables the installation of Policy Controller. If false, the rest of PolicyController fields take no effect.
829
830 pub enabled: Option<bool>,
831 /// The set of namespaces that are excluded from Policy Controller checks. Namespaces do not need to currently exist on the cluster.
832 #[serde(rename="exemptableNamespaces")]
833
834 pub exemptable_namespaces: Option<Vec<String>>,
835 /// Logs all denies and dry run failures.
836 #[serde(rename="logDeniesEnabled")]
837
838 pub log_denies_enabled: Option<bool>,
839 /// Monitoring specifies the configuration of monitoring.
840
841 pub monitoring: Option<ConfigManagementPolicyControllerMonitoring>,
842 /// Enable or disable mutation in policy controller. If true, mutation CRDs, webhook and controller deployment will be deployed to the cluster.
843 #[serde(rename="mutationEnabled")]
844
845 pub mutation_enabled: Option<bool>,
846 /// Enables the ability to use Constraint Templates that reference to objects other than the object currently being evaluated.
847 #[serde(rename="referentialRulesEnabled")]
848
849 pub referential_rules_enabled: Option<bool>,
850 /// Installs the default template library along with Policy Controller.
851 #[serde(rename="templateLibraryInstalled")]
852
853 pub template_library_installed: Option<bool>,
854}
855
856impl client::Part for ConfigManagementPolicyController {}
857
858
859/// PolicyControllerMonitoring specifies the backends Policy Controller should export metrics to. For example, to specify metrics should be exported to Cloud Monitoring and Prometheus, specify backends: ["cloudmonitoring", "prometheus"]
860///
861/// This type is not used in any activity, and only used as *part* of another schema.
862///
863#[serde_with::serde_as(crate = "::client::serde_with")]
864#[derive(Default, Clone, Debug, Serialize, Deserialize)]
865pub struct ConfigManagementPolicyControllerMonitoring {
866 /// Specifies the list of backends Policy Controller will export to. An empty list would effectively disable metrics export.
867
868 pub backends: Option<Vec<String>>,
869}
870
871impl client::Part for ConfigManagementPolicyControllerMonitoring {}
872
873
874/// State for PolicyControllerState.
875///
876/// This type is not used in any activity, and only used as *part* of another schema.
877///
878#[serde_with::serde_as(crate = "::client::serde_with")]
879#[derive(Default, Clone, Debug, Serialize, Deserialize)]
880pub struct ConfigManagementPolicyControllerState {
881 /// The state about the policy controller installation.
882 #[serde(rename="deploymentState")]
883
884 pub deployment_state: Option<ConfigManagementGatekeeperDeploymentState>,
885 /// The version of Gatekeeper Policy Controller deployed.
886
887 pub version: Option<ConfigManagementPolicyControllerVersion>,
888}
889
890impl client::Part for ConfigManagementPolicyControllerState {}
891
892
893/// The build version of Gatekeeper Policy Controller is using.
894///
895/// This type is not used in any activity, and only used as *part* of another schema.
896///
897#[serde_with::serde_as(crate = "::client::serde_with")]
898#[derive(Default, Clone, Debug, Serialize, Deserialize)]
899pub struct ConfigManagementPolicyControllerVersion {
900 /// The gatekeeper image tag that is composed of ACM version, git tag, build number.
901
902 pub version: Option<String>,
903}
904
905impl client::Part for ConfigManagementPolicyControllerVersion {}
906
907
908/// An ACM created error representing a problem syncing configurations
909///
910/// This type is not used in any activity, and only used as *part* of another schema.
911///
912#[serde_with::serde_as(crate = "::client::serde_with")]
913#[derive(Default, Clone, Debug, Serialize, Deserialize)]
914pub struct ConfigManagementSyncError {
915 /// An ACM defined error code
916
917 pub code: Option<String>,
918 /// A description of the error
919 #[serde(rename="errorMessage")]
920
921 pub error_message: Option<String>,
922 /// A list of config(s) associated with the error, if any
923 #[serde(rename="errorResources")]
924
925 pub error_resources: Option<Vec<ConfigManagementErrorResource>>,
926}
927
928impl client::Part for ConfigManagementSyncError {}
929
930
931/// State indicating an ACM's progress syncing configurations to a cluster
932///
933/// This type is not used in any activity, and only used as *part* of another schema.
934///
935#[serde_with::serde_as(crate = "::client::serde_with")]
936#[derive(Default, Clone, Debug, Serialize, Deserialize)]
937pub struct ConfigManagementSyncState {
938 /// Sync status code
939
940 pub code: Option<String>,
941 /// A list of errors resulting from problematic configs. This list will be truncated after 100 errors, although it is unlikely for that many errors to simultaneously exist.
942
943 pub errors: Option<Vec<ConfigManagementSyncError>>,
944 /// Token indicating the state of the importer.
945 #[serde(rename="importToken")]
946
947 pub import_token: Option<String>,
948 /// Deprecated: use last_sync_time instead. Timestamp of when ACM last successfully synced the repo The time format is specified in https://golang.org/pkg/time/#Time.String
949 #[serde(rename="lastSync")]
950
951 pub last_sync: Option<String>,
952 /// Timestamp type of when ACM last successfully synced the repo
953 #[serde(rename="lastSyncTime")]
954
955 pub last_sync_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
956 /// Token indicating the state of the repo.
957 #[serde(rename="sourceToken")]
958
959 pub source_token: Option<String>,
960 /// Token indicating the state of the syncer.
961 #[serde(rename="syncToken")]
962
963 pub sync_token: Option<String>,
964}
965
966impl client::Part for ConfigManagementSyncState {}
967
968
969/// ConnectAgentResource represents a Kubernetes resource manifest for Connect Agent deployment.
970///
971/// This type is not used in any activity, and only used as *part* of another schema.
972///
973#[serde_with::serde_as(crate = "::client::serde_with")]
974#[derive(Default, Clone, Debug, Serialize, Deserialize)]
975pub struct ConnectAgentResource {
976 /// YAML manifest of the resource.
977
978 pub manifest: Option<String>,
979 /// Kubernetes type of the resource.
980 #[serde(rename="type")]
981
982 pub type_: Option<TypeMeta>,
983}
984
985impl client::Part for ConnectAgentResource {}
986
987
988/// EdgeCluster contains information specific to Google Edge Clusters.
989///
990/// This type is not used in any activity, and only used as *part* of another schema.
991///
992#[serde_with::serde_as(crate = "::client::serde_with")]
993#[derive(Default, Clone, Debug, Serialize, Deserialize)]
994pub struct EdgeCluster {
995 /// Immutable. Self-link of the GCP resource for the Edge Cluster. For example: //edgecontainer.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster
996 #[serde(rename="resourceLink")]
997
998 pub resource_link: Option<String>,
999}
1000
1001impl client::Part for EdgeCluster {}
1002
1003
1004/// 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); }
1005///
1006/// # Activities
1007///
1008/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1009/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1010///
1011/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1012/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1013#[serde_with::serde_as(crate = "::client::serde_with")]
1014#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1015pub struct Empty { _never_set: Option<bool> }
1016
1017impl client::ResponseResult for Empty {}
1018
1019
1020/// 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.
1021///
1022/// This type is not used in any activity, and only used as *part* of another schema.
1023///
1024#[serde_with::serde_as(crate = "::client::serde_with")]
1025#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1026pub struct Expr {
1027 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1028
1029 pub description: Option<String>,
1030 /// Textual representation of an expression in Common Expression Language syntax.
1031
1032 pub expression: Option<String>,
1033 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1034
1035 pub location: Option<String>,
1036 /// 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.
1037
1038 pub title: Option<String>,
1039}
1040
1041impl client::Part for Expr {}
1042
1043
1044/// Feature represents the settings and status of any Hub Feature.
1045///
1046/// # Activities
1047///
1048/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1049/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1050///
1051/// * [locations features create projects](ProjectLocationFeatureCreateCall) (request)
1052/// * [locations features get projects](ProjectLocationFeatureGetCall) (response)
1053/// * [locations features patch projects](ProjectLocationFeaturePatchCall) (request)
1054#[serde_with::serde_as(crate = "::client::serde_with")]
1055#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1056pub struct Feature {
1057 /// Output only. When the Feature resource was created.
1058 #[serde(rename="createTime")]
1059
1060 pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1061 /// Output only. When the Feature resource was deleted.
1062 #[serde(rename="deleteTime")]
1063
1064 pub delete_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1065 /// GCP labels for this Feature.
1066
1067 pub labels: Option<HashMap<String, String>>,
1068 /// Optional. Membership-specific configuration for this Feature. If this Feature does not support any per-Membership configuration, this field may be unused. The keys indicate which Membership the configuration is for, in the form: `projects/{p}/locations/{l}/memberships/{m}` Where {p} is the project, {l} is a valid location and {m} is a valid Membership in this project at that location. {p} WILL match the Feature's project. {p} will always be returned as the project number, but the project ID is also accepted during input. If the same Membership is specified in the map twice (using the project ID form, and the project number form), exactly ONE of the entries will be saved, with no guarantees as to which. For this reason, it is recommended the same format be used for all entries when mutating a Feature.
1069 #[serde(rename="membershipSpecs")]
1070
1071 pub membership_specs: Option<HashMap<String, MembershipFeatureSpec>>,
1072 /// Output only. Membership-specific Feature status. If this Feature does report any per-Membership status, this field may be unused. The keys indicate which Membership the state is for, in the form: `projects/{p}/locations/{l}/memberships/{m}` Where {p} is the project number, {l} is a valid location and {m} is a valid Membership in this project at that location. {p} MUST match the Feature's project number.
1073 #[serde(rename="membershipStates")]
1074
1075 pub membership_states: Option<HashMap<String, MembershipFeatureState>>,
1076 /// Output only. The full, unique name of this Feature resource in the format `projects/*/locations/*/features/*`.
1077
1078 pub name: Option<String>,
1079 /// Output only. State of the Feature resource itself.
1080 #[serde(rename="resourceState")]
1081
1082 pub resource_state: Option<FeatureResourceState>,
1083 /// Optional. Scope-specific configuration for this Feature. If this Feature does not support any per-Scope configuration, this field may be unused. The keys indicate which Scope the configuration is for, in the form: `projects/{p}/locations/global/scopes/{s}` Where {p} is the project, {s} is a valid Scope in this project. {p} WILL match the Feature's project. {p} will always be returned as the project number, but the project ID is also accepted during input. If the same Scope is specified in the map twice (using the project ID form, and the project number form), exactly ONE of the entries will be saved, with no guarantees as to which. For this reason, it is recommended the same format be used for all entries when mutating a Feature.
1084 #[serde(rename="scopeSpecs")]
1085
1086 pub scope_specs: Option<HashMap<String, ScopeFeatureSpec>>,
1087 /// Output only. Scope-specific Feature status. If this Feature does report any per-Scope status, this field may be unused. The keys indicate which Scope the state is for, in the form: `projects/{p}/locations/global/scopes/{s}` Where {p} is the project, {s} is a valid Scope in this project. {p} WILL match the Feature's project.
1088 #[serde(rename="scopeStates")]
1089
1090 pub scope_states: Option<HashMap<String, ScopeFeatureState>>,
1091 /// Optional. Hub-wide Feature configuration. If this Feature does not support any Hub-wide configuration, this field may be unused.
1092
1093 pub spec: Option<CommonFeatureSpec>,
1094 /// Output only. The Hub-wide Feature state.
1095
1096 pub state: Option<CommonFeatureState>,
1097 /// Output only. When the Feature resource was last updated.
1098 #[serde(rename="updateTime")]
1099
1100 pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1101}
1102
1103impl client::RequestValue for Feature {}
1104impl client::ResponseResult for Feature {}
1105
1106
1107/// FeatureResourceState describes the state of a Feature *resource* in the GkeHub API. See `FeatureState` for the "running state" of the Feature in the Hub and across Memberships.
1108///
1109/// This type is not used in any activity, and only used as *part* of another schema.
1110///
1111#[serde_with::serde_as(crate = "::client::serde_with")]
1112#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1113pub struct FeatureResourceState {
1114 /// The current state of the Feature resource in the Hub API.
1115
1116 pub state: Option<String>,
1117}
1118
1119impl client::Part for FeatureResourceState {}
1120
1121
1122/// FeatureState describes the high-level state of a Feature. It may be used to describe a Feature's state at the environ-level, or per-membershop, depending on the context.
1123///
1124/// This type is not used in any activity, and only used as *part* of another schema.
1125///
1126#[serde_with::serde_as(crate = "::client::serde_with")]
1127#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1128pub struct FeatureState {
1129 /// The high-level, machine-readable status of this Feature.
1130
1131 pub code: Option<String>,
1132 /// A human-readable description of the current status.
1133
1134 pub description: Option<String>,
1135 /// The time this status and any related Feature-specific details were updated.
1136 #[serde(rename="updateTime")]
1137
1138 pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1139}
1140
1141impl client::Part for FeatureState {}
1142
1143
1144/// **Fleet Observability**: The Hub-wide input for the FleetObservability feature.
1145///
1146/// This type is not used in any activity, and only used as *part* of another schema.
1147///
1148#[serde_with::serde_as(crate = "::client::serde_with")]
1149#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1150pub struct FleetObservabilityFeatureSpec { _never_set: Option<bool> }
1151
1152impl client::Part for FleetObservabilityFeatureSpec {}
1153
1154
1155/// **FleetObservability**: An empty state left as an example Hub-wide Feature state.
1156///
1157/// This type is not used in any activity, and only used as *part* of another schema.
1158///
1159#[serde_with::serde_as(crate = "::client::serde_with")]
1160#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1161pub struct FleetObservabilityFeatureState { _never_set: Option<bool> }
1162
1163impl client::Part for FleetObservabilityFeatureState {}
1164
1165
1166/// **FleetObservability**: The membership-specific input for FleetObservability feature.
1167///
1168/// This type is not used in any activity, and only used as *part* of another schema.
1169///
1170#[serde_with::serde_as(crate = "::client::serde_with")]
1171#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1172pub struct FleetObservabilityMembershipSpec { _never_set: Option<bool> }
1173
1174impl client::Part for FleetObservabilityMembershipSpec {}
1175
1176
1177/// **FleetObservability**: An empty state left as an example membership-specific Feature state.
1178///
1179/// This type is not used in any activity, and only used as *part* of another schema.
1180///
1181#[serde_with::serde_as(crate = "::client::serde_with")]
1182#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1183pub struct FleetObservabilityMembershipState { _never_set: Option<bool> }
1184
1185impl client::Part for FleetObservabilityMembershipState {}
1186
1187
1188/// GenerateConnectManifestResponse contains manifest information for installing/upgrading a Connect agent.
1189///
1190/// # Activities
1191///
1192/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1193/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1194///
1195/// * [locations memberships generate connect manifest projects](ProjectLocationMembershipGenerateConnectManifestCall) (response)
1196#[serde_with::serde_as(crate = "::client::serde_with")]
1197#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1198pub struct GenerateConnectManifestResponse {
1199 /// The ordered list of Kubernetes resources that need to be applied to the cluster for GKE Connect agent installation/upgrade.
1200
1201 pub manifest: Option<Vec<ConnectAgentResource>>,
1202}
1203
1204impl client::ResponseResult for GenerateConnectManifestResponse {}
1205
1206
1207/// GkeCluster contains information specific to GKE clusters.
1208///
1209/// This type is not used in any activity, and only used as *part* of another schema.
1210///
1211#[serde_with::serde_as(crate = "::client::serde_with")]
1212#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1213pub struct GkeCluster {
1214 /// Output only. If cluster_missing is set then it denotes that the GKE cluster no longer exists in the GKE Control Plane.
1215 #[serde(rename="clusterMissing")]
1216
1217 pub cluster_missing: Option<bool>,
1218 /// Immutable. Self-link of the GCP resource for the GKE cluster. For example: //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster Zonal clusters are also supported.
1219 #[serde(rename="resourceLink")]
1220
1221 pub resource_link: Option<String>,
1222}
1223
1224impl client::Part for GkeCluster {}
1225
1226
1227/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1228///
1229/// This type is not used in any activity, and only used as *part* of another schema.
1230///
1231#[serde_with::serde_as(crate = "::client::serde_with")]
1232#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1233pub struct GoogleRpcStatus {
1234 /// The status code, which should be an enum value of google.rpc.Code.
1235
1236 pub code: Option<i32>,
1237 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1238
1239 pub details: Option<Vec<HashMap<String, json::Value>>>,
1240 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1241
1242 pub message: Option<String>,
1243}
1244
1245impl client::Part for GoogleRpcStatus {}
1246
1247
1248/// Configuration of an auth method for a member/cluster. Only one authentication method (e.g., OIDC and LDAP) can be set per AuthMethod.
1249///
1250/// This type is not used in any activity, and only used as *part* of another schema.
1251///
1252#[serde_with::serde_as(crate = "::client::serde_with")]
1253#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1254pub struct IdentityServiceAuthMethod {
1255 /// AzureAD specific Configuration.
1256 #[serde(rename="azureadConfig")]
1257
1258 pub azuread_config: Option<IdentityServiceAzureADConfig>,
1259 /// GoogleConfig specific configuration
1260 #[serde(rename="googleConfig")]
1261
1262 pub google_config: Option<IdentityServiceGoogleConfig>,
1263 /// Identifier for auth config.
1264
1265 pub name: Option<String>,
1266 /// OIDC specific configuration.
1267 #[serde(rename="oidcConfig")]
1268
1269 pub oidc_config: Option<IdentityServiceOidcConfig>,
1270 /// Proxy server address to use for auth method.
1271
1272 pub proxy: Option<String>,
1273}
1274
1275impl client::Part for IdentityServiceAuthMethod {}
1276
1277
1278/// Configuration for the AzureAD Auth flow.
1279///
1280/// This type is not used in any activity, and only used as *part* of another schema.
1281///
1282#[serde_with::serde_as(crate = "::client::serde_with")]
1283#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1284pub struct IdentityServiceAzureADConfig {
1285 /// ID for the registered client application that makes authentication requests to the Azure AD identity provider.
1286 #[serde(rename="clientId")]
1287
1288 pub client_id: Option<String>,
1289 /// Input only. Unencrypted AzureAD client secret will be passed to the GKE Hub CLH.
1290 #[serde(rename="clientSecret")]
1291
1292 pub client_secret: Option<String>,
1293 /// Output only. Encrypted AzureAD client secret.
1294 #[serde(rename="encryptedClientSecret")]
1295
1296 #[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
1297 pub encrypted_client_secret: Option<Vec<u8>>,
1298 /// The redirect URL that kubectl uses for authorization.
1299 #[serde(rename="kubectlRedirectUri")]
1300
1301 pub kubectl_redirect_uri: Option<String>,
1302 /// Kind of Azure AD account to be authenticated. Supported values are or for accounts belonging to a specific tenant.
1303
1304 pub tenant: Option<String>,
1305}
1306
1307impl client::Part for IdentityServiceAzureADConfig {}
1308
1309
1310/// Configuration for the Google Plugin Auth flow.
1311///
1312/// This type is not used in any activity, and only used as *part* of another schema.
1313///
1314#[serde_with::serde_as(crate = "::client::serde_with")]
1315#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1316pub struct IdentityServiceGoogleConfig {
1317 /// Disable automatic configuration of Google Plugin on supported platforms.
1318
1319 pub disable: Option<bool>,
1320}
1321
1322impl client::Part for IdentityServiceGoogleConfig {}
1323
1324
1325/// **Anthos Identity Service**: Configuration for a single Membership.
1326///
1327/// This type is not used in any activity, and only used as *part* of another schema.
1328///
1329#[serde_with::serde_as(crate = "::client::serde_with")]
1330#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1331pub struct IdentityServiceMembershipSpec {
1332 /// A member may support multiple auth methods.
1333 #[serde(rename="authMethods")]
1334
1335 pub auth_methods: Option<Vec<IdentityServiceAuthMethod>>,
1336}
1337
1338impl client::Part for IdentityServiceMembershipSpec {}
1339
1340
1341/// **Anthos Identity Service**: State for a single Membership.
1342///
1343/// This type is not used in any activity, and only used as *part* of another schema.
1344///
1345#[serde_with::serde_as(crate = "::client::serde_with")]
1346#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1347pub struct IdentityServiceMembershipState {
1348 /// The reason of the failure.
1349 #[serde(rename="failureReason")]
1350
1351 pub failure_reason: Option<String>,
1352 /// Installed AIS version. This is the AIS version installed on this member. The values makes sense iff state is OK.
1353 #[serde(rename="installedVersion")]
1354
1355 pub installed_version: Option<String>,
1356 /// Last reconciled membership configuration
1357 #[serde(rename="memberConfig")]
1358
1359 pub member_config: Option<IdentityServiceMembershipSpec>,
1360 /// Deployment state on this member
1361
1362 pub state: Option<String>,
1363}
1364
1365impl client::Part for IdentityServiceMembershipState {}
1366
1367
1368/// Configuration for OIDC Auth flow.
1369///
1370/// This type is not used in any activity, and only used as *part* of another schema.
1371///
1372#[serde_with::serde_as(crate = "::client::serde_with")]
1373#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1374pub struct IdentityServiceOidcConfig {
1375 /// PEM-encoded CA for OIDC provider.
1376 #[serde(rename="certificateAuthorityData")]
1377
1378 pub certificate_authority_data: Option<String>,
1379 /// ID for OIDC client application.
1380 #[serde(rename="clientId")]
1381
1382 pub client_id: Option<String>,
1383 /// Input only. Unencrypted OIDC client secret will be passed to the GKE Hub CLH.
1384 #[serde(rename="clientSecret")]
1385
1386 pub client_secret: Option<String>,
1387 /// Flag to denote if reverse proxy is used to connect to auth provider. This flag should be set to true when provider is not reachable by Google Cloud Console.
1388 #[serde(rename="deployCloudConsoleProxy")]
1389
1390 pub deploy_cloud_console_proxy: Option<bool>,
1391 /// Enable access token.
1392 #[serde(rename="enableAccessToken")]
1393
1394 pub enable_access_token: Option<bool>,
1395 /// Output only. Encrypted OIDC Client secret
1396 #[serde(rename="encryptedClientSecret")]
1397
1398 #[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
1399 pub encrypted_client_secret: Option<Vec<u8>>,
1400 /// Comma-separated list of key-value pairs.
1401 #[serde(rename="extraParams")]
1402
1403 pub extra_params: Option<String>,
1404 /// Prefix to prepend to group name.
1405 #[serde(rename="groupPrefix")]
1406
1407 pub group_prefix: Option<String>,
1408 /// Claim in OIDC ID token that holds group information.
1409 #[serde(rename="groupsClaim")]
1410
1411 pub groups_claim: Option<String>,
1412 /// URI for the OIDC provider. This should point to the level below .well-known/openid-configuration.
1413 #[serde(rename="issuerUri")]
1414
1415 pub issuer_uri: Option<String>,
1416 /// Registered redirect uri to redirect users going through OAuth flow using kubectl plugin.
1417 #[serde(rename="kubectlRedirectUri")]
1418
1419 pub kubectl_redirect_uri: Option<String>,
1420 /// Comma-separated list of identifiers.
1421
1422 pub scopes: Option<String>,
1423 /// Claim in OIDC ID token that holds username.
1424 #[serde(rename="userClaim")]
1425
1426 pub user_claim: Option<String>,
1427 /// Prefix to prepend to user name.
1428 #[serde(rename="userPrefix")]
1429
1430 pub user_prefix: Option<String>,
1431}
1432
1433impl client::Part for IdentityServiceOidcConfig {}
1434
1435
1436/// KubernetesMetadata provides informational metadata for Memberships representing Kubernetes clusters.
1437///
1438/// This type is not used in any activity, and only used as *part* of another schema.
1439///
1440#[serde_with::serde_as(crate = "::client::serde_with")]
1441#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1442pub struct KubernetesMetadata {
1443 /// Output only. Kubernetes API server version string as reported by `/version`.
1444 #[serde(rename="kubernetesApiServerVersion")]
1445
1446 pub kubernetes_api_server_version: Option<String>,
1447 /// Output only. The total memory capacity as reported by the sum of all Kubernetes nodes resources, defined in MB.
1448 #[serde(rename="memoryMb")]
1449
1450 pub memory_mb: Option<i32>,
1451 /// Output only. Node count as reported by Kubernetes nodes resources.
1452 #[serde(rename="nodeCount")]
1453
1454 pub node_count: Option<i32>,
1455 /// Output only. Node providerID as reported by the first node in the list of nodes on the Kubernetes endpoint. On Kubernetes platforms that support zero-node clusters (like GKE-on-GCP), the node_count will be zero and the node_provider_id will be empty.
1456 #[serde(rename="nodeProviderId")]
1457
1458 pub node_provider_id: Option<String>,
1459 /// Output only. The time at which these details were last updated. This update_time is different from the Membership-level update_time since EndpointDetails are updated internally for API consumers.
1460 #[serde(rename="updateTime")]
1461
1462 pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1463 /// Output only. vCPU count as reported by Kubernetes nodes resources.
1464 #[serde(rename="vcpuCount")]
1465
1466 pub vcpu_count: Option<i32>,
1467}
1468
1469impl client::Part for KubernetesMetadata {}
1470
1471
1472/// KubernetesResource contains the YAML manifests and configuration for Membership Kubernetes resources in the cluster. After CreateMembership or UpdateMembership, these resources should be re-applied in the cluster.
1473///
1474/// This type is not used in any activity, and only used as *part* of another schema.
1475///
1476#[serde_with::serde_as(crate = "::client::serde_with")]
1477#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1478pub struct KubernetesResource {
1479 /// Output only. The Kubernetes resources for installing the GKE Connect agent This field is only populated in the Membership returned from a successful long-running operation from CreateMembership or UpdateMembership. It is not populated during normal GetMembership or ListMemberships requests. To get the resource manifest after the initial registration, the caller should make a UpdateMembership call with an empty field mask.
1480 #[serde(rename="connectResources")]
1481
1482 pub connect_resources: Option<Vec<ResourceManifest>>,
1483 /// Input only. The YAML representation of the Membership CR. This field is ignored for GKE clusters where Hub can read the CR directly. Callers should provide the CR that is currently present in the cluster during CreateMembership or UpdateMembership, or leave this field empty if none exists. The CR manifest is used to validate the cluster has not been registered with another Membership.
1484 #[serde(rename="membershipCrManifest")]
1485
1486 pub membership_cr_manifest: Option<String>,
1487 /// Output only. Additional Kubernetes resources that need to be applied to the cluster after Membership creation, and after every update. This field is only populated in the Membership returned from a successful long-running operation from CreateMembership or UpdateMembership. It is not populated during normal GetMembership or ListMemberships requests. To get the resource manifest after the initial registration, the caller should make a UpdateMembership call with an empty field mask.
1488 #[serde(rename="membershipResources")]
1489
1490 pub membership_resources: Option<Vec<ResourceManifest>>,
1491 /// Optional. Options for Kubernetes resource generation.
1492 #[serde(rename="resourceOptions")]
1493
1494 pub resource_options: Option<ResourceOptions>,
1495}
1496
1497impl client::Part for KubernetesResource {}
1498
1499
1500/// Response message for the `GkeHub.ListFeatures` method.
1501///
1502/// # Activities
1503///
1504/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1505/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1506///
1507/// * [locations features list projects](ProjectLocationFeatureListCall) (response)
1508#[serde_with::serde_as(crate = "::client::serde_with")]
1509#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1510pub struct ListFeaturesResponse {
1511 /// A token to request the next page of resources from the `ListFeatures` method. The value of an empty string means that there are no more resources to return.
1512 #[serde(rename="nextPageToken")]
1513
1514 pub next_page_token: Option<String>,
1515 /// The list of matching Features
1516
1517 pub resources: Option<Vec<Feature>>,
1518}
1519
1520impl client::ResponseResult for ListFeaturesResponse {}
1521
1522
1523/// The response message for Locations.ListLocations.
1524///
1525/// # Activities
1526///
1527/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1528/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1529///
1530/// * [locations list projects](ProjectLocationListCall) (response)
1531#[serde_with::serde_as(crate = "::client::serde_with")]
1532#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1533pub struct ListLocationsResponse {
1534 /// A list of locations that matches the specified filter in the request.
1535
1536 pub locations: Option<Vec<Location>>,
1537 /// The standard List next-page token.
1538 #[serde(rename="nextPageToken")]
1539
1540 pub next_page_token: Option<String>,
1541}
1542
1543impl client::ResponseResult for ListLocationsResponse {}
1544
1545
1546/// Response message for the `GkeHub.ListMemberships` method.
1547///
1548/// # Activities
1549///
1550/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1551/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1552///
1553/// * [locations memberships list projects](ProjectLocationMembershipListCall) (response)
1554#[serde_with::serde_as(crate = "::client::serde_with")]
1555#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1556pub struct ListMembershipsResponse {
1557 /// A token to request the next page of resources from the `ListMemberships` method. The value of an empty string means that there are no more resources to return.
1558 #[serde(rename="nextPageToken")]
1559
1560 pub next_page_token: Option<String>,
1561 /// The list of matching Memberships.
1562
1563 pub resources: Option<Vec<Membership>>,
1564 /// List of locations that could not be reached while fetching this list.
1565
1566 pub unreachable: Option<Vec<String>>,
1567}
1568
1569impl client::ResponseResult for ListMembershipsResponse {}
1570
1571
1572/// The response message for Operations.ListOperations.
1573///
1574/// # Activities
1575///
1576/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1577/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1578///
1579/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1580#[serde_with::serde_as(crate = "::client::serde_with")]
1581#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1582pub struct ListOperationsResponse {
1583 /// The standard List next-page token.
1584 #[serde(rename="nextPageToken")]
1585
1586 pub next_page_token: Option<String>,
1587 /// A list of operations that matches the specified filter in the request.
1588
1589 pub operations: Option<Vec<Operation>>,
1590}
1591
1592impl client::ResponseResult for ListOperationsResponse {}
1593
1594
1595/// A resource that represents Google Cloud Platform location.
1596///
1597/// # Activities
1598///
1599/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1600/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1601///
1602/// * [locations get projects](ProjectLocationGetCall) (response)
1603#[serde_with::serde_as(crate = "::client::serde_with")]
1604#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1605pub struct Location {
1606 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1607 #[serde(rename="displayName")]
1608
1609 pub display_name: Option<String>,
1610 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1611
1612 pub labels: Option<HashMap<String, String>>,
1613 /// The canonical id for this location. For example: `"us-east1"`.
1614 #[serde(rename="locationId")]
1615
1616 pub location_id: Option<String>,
1617 /// Service-specific metadata. For example the available capacity at the given location.
1618
1619 pub metadata: Option<HashMap<String, json::Value>>,
1620 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1621
1622 pub name: Option<String>,
1623}
1624
1625impl client::ResponseResult for Location {}
1626
1627
1628/// Membership contains information about a member cluster.
1629///
1630/// # Activities
1631///
1632/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1633/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1634///
1635/// * [locations memberships create projects](ProjectLocationMembershipCreateCall) (request)
1636/// * [locations memberships get projects](ProjectLocationMembershipGetCall) (response)
1637/// * [locations memberships patch projects](ProjectLocationMembershipPatchCall) (request)
1638#[serde_with::serde_as(crate = "::client::serde_with")]
1639#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1640pub struct Membership {
1641 /// Optional. How to identify workloads from this Membership. See the documentation on Workload Identity for more details: https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
1642
1643 pub authority: Option<Authority>,
1644 /// Output only. When the Membership was created.
1645 #[serde(rename="createTime")]
1646
1647 pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1648 /// Output only. When the Membership was deleted.
1649 #[serde(rename="deleteTime")]
1650
1651 pub delete_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1652 /// Output only. Description of this membership, limited to 63 characters. Must match the regex: `a-zA-Z0-9*` This field is present for legacy purposes.
1653
1654 pub description: Option<String>,
1655 /// Optional. Endpoint information to reach this member.
1656
1657 pub endpoint: Option<MembershipEndpoint>,
1658 /// Optional. An externally-generated and managed ID for this Membership. This ID may be modified after creation, but this is not recommended. The ID must match the regex: `a-zA-Z0-9*` If this Membership represents a Kubernetes cluster, this value should be set to the UID of the `kube-system` namespace object.
1659 #[serde(rename="externalId")]
1660
1661 pub external_id: Option<String>,
1662 /// Optional. GCP labels for this membership.
1663
1664 pub labels: Option<HashMap<String, String>>,
1665 /// Output only. For clusters using Connect, the timestamp of the most recent connection established with Google Cloud. This time is updated every several minutes, not continuously. For clusters that do not use GKE Connect, or that have never connected successfully, this field will be unset.
1666 #[serde(rename="lastConnectionTime")]
1667
1668 pub last_connection_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1669 /// Output only. The full, unique name of this Membership resource in the format `projects/*/locations/*/memberships/{membership_id}`, set during creation. `membership_id` must be a valid RFC 1123 compliant DNS label: 1. At most 63 characters in length 2. It must consist of lower case alphanumeric characters or `-` 3. It must start and end with an alphanumeric character Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, with a maximum length of 63 characters.
1670
1671 pub name: Option<String>,
1672 /// Output only. State of the Membership resource.
1673
1674 pub state: Option<MembershipState>,
1675 /// Output only. Google-generated UUID for this resource. This is unique across all Membership resources. If a Membership resource is deleted and another resource with the same name is created, it gets a different unique_id.
1676 #[serde(rename="uniqueId")]
1677
1678 pub unique_id: Option<String>,
1679 /// Output only. When the Membership was last updated.
1680 #[serde(rename="updateTime")]
1681
1682 pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
1683}
1684
1685impl client::RequestValue for Membership {}
1686impl client::ResponseResult for Membership {}
1687
1688
1689/// MembershipEndpoint contains information needed to contact a Kubernetes API, endpoint and any additional Kubernetes metadata.
1690///
1691/// This type is not used in any activity, and only used as *part* of another schema.
1692///
1693#[serde_with::serde_as(crate = "::client::serde_with")]
1694#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1695pub struct MembershipEndpoint {
1696 /// Optional. Specific information for a GDC Edge Appliance cluster.
1697 #[serde(rename="applianceCluster")]
1698
1699 pub appliance_cluster: Option<ApplianceCluster>,
1700 /// Optional. Specific information for a Google Edge cluster.
1701 #[serde(rename="edgeCluster")]
1702
1703 pub edge_cluster: Option<EdgeCluster>,
1704 /// Optional. Specific information for a GKE-on-GCP cluster.
1705 #[serde(rename="gkeCluster")]
1706
1707 pub gke_cluster: Option<GkeCluster>,
1708 /// Output only. Useful Kubernetes-specific metadata.
1709 #[serde(rename="kubernetesMetadata")]
1710
1711 pub kubernetes_metadata: Option<KubernetesMetadata>,
1712 /// Optional. The in-cluster Kubernetes Resources that should be applied for a correctly registered cluster, in the steady state. These resources: * Ensure that the cluster is exclusively registered to one and only one Hub Membership. * Propagate Workload Pool Information available in the Membership Authority field. * Ensure proper initial configuration of default Hub Features.
1713 #[serde(rename="kubernetesResource")]
1714
1715 pub kubernetes_resource: Option<KubernetesResource>,
1716 /// Optional. Specific information for a GKE Multi-Cloud cluster.
1717 #[serde(rename="multiCloudCluster")]
1718
1719 pub multi_cloud_cluster: Option<MultiCloudCluster>,
1720 /// Optional. Specific information for a GKE On-Prem cluster. An onprem user-cluster who has no resourceLink is not allowed to use this field, it should have a nil "type" instead.
1721 #[serde(rename="onPremCluster")]
1722
1723 pub on_prem_cluster: Option<OnPremCluster>,
1724}
1725
1726impl client::Part for MembershipEndpoint {}
1727
1728
1729/// MembershipFeatureSpec contains configuration information for a single Membership.
1730///
1731/// This type is not used in any activity, and only used as *part* of another schema.
1732///
1733#[serde_with::serde_as(crate = "::client::serde_with")]
1734#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1735pub struct MembershipFeatureSpec {
1736 /// Config Management-specific spec.
1737
1738 pub configmanagement: Option<ConfigManagementMembershipSpec>,
1739 /// True if value of `feature_spec` was inherited from a fleet-level default.
1740 #[serde(rename="fleetInherited")]
1741
1742 pub fleet_inherited: Option<bool>,
1743 /// Fleet observability membership spec
1744
1745 pub fleetobservability: Option<FleetObservabilityMembershipSpec>,
1746 /// Identity Service-specific spec.
1747
1748 pub identityservice: Option<IdentityServiceMembershipSpec>,
1749 /// Anthos Service Mesh-specific spec
1750
1751 pub mesh: Option<ServiceMeshMembershipSpec>,
1752}
1753
1754impl client::Part for MembershipFeatureSpec {}
1755
1756
1757/// MembershipFeatureState contains Feature status information for a single Membership.
1758///
1759/// This type is not used in any activity, and only used as *part* of another schema.
1760///
1761#[serde_with::serde_as(crate = "::client::serde_with")]
1762#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1763pub struct MembershipFeatureState {
1764 /// Appdevexperience specific state.
1765
1766 pub appdevexperience: Option<AppDevExperienceFeatureState>,
1767 /// Config Management-specific state.
1768
1769 pub configmanagement: Option<ConfigManagementMembershipState>,
1770 /// Fleet observability membership state.
1771
1772 pub fleetobservability: Option<FleetObservabilityMembershipState>,
1773 /// Identity Service-specific state.
1774
1775 pub identityservice: Option<IdentityServiceMembershipState>,
1776 /// Service Mesh-specific state.
1777
1778 pub servicemesh: Option<ServiceMeshMembershipState>,
1779 /// The high-level state of this Feature for a single membership.
1780
1781 pub state: Option<FeatureState>,
1782}
1783
1784impl client::Part for MembershipFeatureState {}
1785
1786
1787/// MembershipState describes the state of a Membership resource.
1788///
1789/// This type is not used in any activity, and only used as *part* of another schema.
1790///
1791#[serde_with::serde_as(crate = "::client::serde_with")]
1792#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1793pub struct MembershipState {
1794 /// Output only. The current state of the Membership resource.
1795
1796 pub code: Option<String>,
1797}
1798
1799impl client::Part for MembershipState {}
1800
1801
1802/// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters.
1803///
1804/// This type is not used in any activity, and only used as *part* of another schema.
1805///
1806#[serde_with::serde_as(crate = "::client::serde_with")]
1807#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1808pub struct MultiCloudCluster {
1809 /// Output only. If cluster_missing is set then it denotes that API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster no longer exists.
1810 #[serde(rename="clusterMissing")]
1811
1812 pub cluster_missing: Option<bool>,
1813 /// Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. For example: //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/attachedClusters/my-cluster
1814 #[serde(rename="resourceLink")]
1815
1816 pub resource_link: Option<String>,
1817}
1818
1819impl client::Part for MultiCloudCluster {}
1820
1821
1822/// **Multi-cluster Ingress**: The configuration for the MultiClusterIngress feature.
1823///
1824/// This type is not used in any activity, and only used as *part* of another schema.
1825///
1826#[serde_with::serde_as(crate = "::client::serde_with")]
1827#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1828pub struct MultiClusterIngressFeatureSpec {
1829 /// Fully-qualified Membership name which hosts the MultiClusterIngress CRD. Example: `projects/foo-proj/locations/global/memberships/bar`
1830 #[serde(rename="configMembership")]
1831
1832 pub config_membership: Option<String>,
1833}
1834
1835impl client::Part for MultiClusterIngressFeatureSpec {}
1836
1837
1838/// OnPremCluster contains information specific to GKE On-Prem clusters.
1839///
1840/// This type is not used in any activity, and only used as *part* of another schema.
1841///
1842#[serde_with::serde_as(crate = "::client::serde_with")]
1843#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1844pub struct OnPremCluster {
1845 /// Immutable. Whether the cluster is an admin cluster.
1846 #[serde(rename="adminCluster")]
1847
1848 pub admin_cluster: Option<bool>,
1849 /// Output only. If cluster_missing is set then it denotes that API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no longer exists.
1850 #[serde(rename="clusterMissing")]
1851
1852 pub cluster_missing: Option<bool>,
1853 /// Immutable. The on prem cluster's type.
1854 #[serde(rename="clusterType")]
1855
1856 pub cluster_type: Option<String>,
1857 /// Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For example: //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster
1858 #[serde(rename="resourceLink")]
1859
1860 pub resource_link: Option<String>,
1861}
1862
1863impl client::Part for OnPremCluster {}
1864
1865
1866/// This resource represents a long-running operation that is the result of a network API call.
1867///
1868/// # Activities
1869///
1870/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1871/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1872///
1873/// * [locations features create projects](ProjectLocationFeatureCreateCall) (response)
1874/// * [locations features delete projects](ProjectLocationFeatureDeleteCall) (response)
1875/// * [locations features patch projects](ProjectLocationFeaturePatchCall) (response)
1876/// * [locations memberships create projects](ProjectLocationMembershipCreateCall) (response)
1877/// * [locations memberships delete projects](ProjectLocationMembershipDeleteCall) (response)
1878/// * [locations memberships patch projects](ProjectLocationMembershipPatchCall) (response)
1879/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1880#[serde_with::serde_as(crate = "::client::serde_with")]
1881#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1882pub struct Operation {
1883 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1884
1885 pub done: Option<bool>,
1886 /// The error result of the operation in case of failure or cancellation.
1887
1888 pub error: Option<GoogleRpcStatus>,
1889 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1890
1891 pub metadata: Option<HashMap<String, json::Value>>,
1892 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1893
1894 pub name: Option<String>,
1895 /// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1896
1897 pub response: Option<HashMap<String, json::Value>>,
1898}
1899
1900impl client::ResponseResult for Operation {}
1901
1902
1903/// 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/).
1904///
1905/// # Activities
1906///
1907/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1908/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1909///
1910/// * [locations features get iam policy projects](ProjectLocationFeatureGetIamPolicyCall) (response)
1911/// * [locations features set iam policy projects](ProjectLocationFeatureSetIamPolicyCall) (response)
1912/// * [locations memberships get iam policy projects](ProjectLocationMembershipGetIamPolicyCall) (response)
1913/// * [locations memberships set iam policy projects](ProjectLocationMembershipSetIamPolicyCall) (response)
1914#[serde_with::serde_as(crate = "::client::serde_with")]
1915#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1916pub struct Policy {
1917 /// Specifies cloud audit logging configuration for this policy.
1918 #[serde(rename="auditConfigs")]
1919
1920 pub audit_configs: Option<Vec<AuditConfig>>,
1921 /// 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`.
1922
1923 pub bindings: Option<Vec<Binding>>,
1924 /// `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.
1925
1926 #[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
1927 pub etag: Option<Vec<u8>>,
1928 /// 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).
1929
1930 pub version: Option<i32>,
1931}
1932
1933impl client::ResponseResult for Policy {}
1934
1935
1936/// ResourceManifest represents a single Kubernetes resource to be applied to the cluster.
1937///
1938/// This type is not used in any activity, and only used as *part* of another schema.
1939///
1940#[serde_with::serde_as(crate = "::client::serde_with")]
1941#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1942pub struct ResourceManifest {
1943 /// Whether the resource provided in the manifest is `cluster_scoped`. If unset, the manifest is assumed to be namespace scoped. This field is used for REST mapping when applying the resource in a cluster.
1944 #[serde(rename="clusterScoped")]
1945
1946 pub cluster_scoped: Option<bool>,
1947 /// YAML manifest of the resource.
1948
1949 pub manifest: Option<String>,
1950}
1951
1952impl client::Part for ResourceManifest {}
1953
1954
1955/// ResourceOptions represent options for Kubernetes resource generation.
1956///
1957/// This type is not used in any activity, and only used as *part* of another schema.
1958///
1959#[serde_with::serde_as(crate = "::client::serde_with")]
1960#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1961pub struct ResourceOptions {
1962 /// Optional. The Connect agent version to use for connect_resources. Defaults to the latest GKE Connect version. The version must be a currently supported version, obsolete versions will be rejected.
1963 #[serde(rename="connectVersion")]
1964
1965 pub connect_version: Option<String>,
1966 /// Optional. Major version of the Kubernetes cluster. This is only used to determine which version to use for the CustomResourceDefinition resources, `apiextensions/v1beta1` or`apiextensions/v1`.
1967 #[serde(rename="k8sVersion")]
1968
1969 pub k8s_version: Option<String>,
1970 /// Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for CustomResourceDefinition resources. This option should be set for clusters with Kubernetes apiserver versions <1.16.
1971 #[serde(rename="v1beta1Crd")]
1972
1973 pub v1beta1_crd: Option<bool>,
1974}
1975
1976impl client::Part for ResourceOptions {}
1977
1978
1979/// ScopeFeatureSpec contains feature specs for a fleet scope.
1980///
1981/// This type is not used in any activity, and only used as *part* of another schema.
1982///
1983#[serde_with::serde_as(crate = "::client::serde_with")]
1984#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1985pub struct ScopeFeatureSpec { _never_set: Option<bool> }
1986
1987impl client::Part for ScopeFeatureSpec {}
1988
1989
1990/// ScopeFeatureState contains Scope-wide Feature status information.
1991///
1992/// This type is not used in any activity, and only used as *part* of another schema.
1993///
1994#[serde_with::serde_as(crate = "::client::serde_with")]
1995#[derive(Default, Clone, Debug, Serialize, Deserialize)]
1996pub struct ScopeFeatureState {
1997 /// Output only. The "running state" of the Feature in this Scope.
1998
1999 pub state: Option<FeatureState>,
2000}
2001
2002impl client::Part for ScopeFeatureState {}
2003
2004
2005/// Status of control plane management.
2006///
2007/// This type is not used in any activity, and only used as *part* of another schema.
2008///
2009#[serde_with::serde_as(crate = "::client::serde_with")]
2010#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2011pub struct ServiceMeshControlPlaneManagement {
2012 /// Explanation of state.
2013
2014 pub details: Option<Vec<ServiceMeshStatusDetails>>,
2015 /// LifecycleState of control plane management.
2016
2017 pub state: Option<String>,
2018}
2019
2020impl client::Part for ServiceMeshControlPlaneManagement {}
2021
2022
2023/// Status of data plane management. Only reported per-member.
2024///
2025/// This type is not used in any activity, and only used as *part* of another schema.
2026///
2027#[serde_with::serde_as(crate = "::client::serde_with")]
2028#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2029pub struct ServiceMeshDataPlaneManagement {
2030 /// Explanation of the status.
2031
2032 pub details: Option<Vec<ServiceMeshStatusDetails>>,
2033 /// Lifecycle status of data plane management.
2034
2035 pub state: Option<String>,
2036}
2037
2038impl client::Part for ServiceMeshDataPlaneManagement {}
2039
2040
2041/// **Service Mesh**: Spec for a single Membership for the servicemesh feature
2042///
2043/// This type is not used in any activity, and only used as *part* of another schema.
2044///
2045#[serde_with::serde_as(crate = "::client::serde_with")]
2046#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2047pub struct ServiceMeshMembershipSpec {
2048 /// Enables automatic control plane management.
2049 #[serde(rename="controlPlane")]
2050
2051 pub control_plane: Option<String>,
2052 /// Enables automatic Service Mesh management.
2053
2054 pub management: Option<String>,
2055}
2056
2057impl client::Part for ServiceMeshMembershipSpec {}
2058
2059
2060/// **Service Mesh**: State for a single Membership, as analyzed by the Service Mesh Hub Controller.
2061///
2062/// This type is not used in any activity, and only used as *part* of another schema.
2063///
2064#[serde_with::serde_as(crate = "::client::serde_with")]
2065#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2066pub struct ServiceMeshMembershipState {
2067 /// Output only. Status of control plane management
2068 #[serde(rename="controlPlaneManagement")]
2069
2070 pub control_plane_management: Option<ServiceMeshControlPlaneManagement>,
2071 /// Output only. Status of data plane management.
2072 #[serde(rename="dataPlaneManagement")]
2073
2074 pub data_plane_management: Option<ServiceMeshDataPlaneManagement>,
2075}
2076
2077impl client::Part for ServiceMeshMembershipState {}
2078
2079
2080/// Structured and human-readable details for a status.
2081///
2082/// This type is not used in any activity, and only used as *part* of another schema.
2083///
2084#[serde_with::serde_as(crate = "::client::serde_with")]
2085#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2086pub struct ServiceMeshStatusDetails {
2087 /// A machine-readable code that further describes a broad status.
2088
2089 pub code: Option<String>,
2090 /// Human-readable explanation of code.
2091
2092 pub details: Option<String>,
2093}
2094
2095impl client::Part for ServiceMeshStatusDetails {}
2096
2097
2098/// Request message for `SetIamPolicy` method.
2099///
2100/// # Activities
2101///
2102/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2103/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2104///
2105/// * [locations features set iam policy projects](ProjectLocationFeatureSetIamPolicyCall) (request)
2106/// * [locations memberships set iam policy projects](ProjectLocationMembershipSetIamPolicyCall) (request)
2107#[serde_with::serde_as(crate = "::client::serde_with")]
2108#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2109pub struct SetIamPolicyRequest {
2110 /// 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.
2111
2112 pub policy: Option<Policy>,
2113 /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
2114 #[serde(rename="updateMask")]
2115
2116 pub update_mask: Option<client::FieldMask>,
2117}
2118
2119impl client::RequestValue for SetIamPolicyRequest {}
2120
2121
2122/// Status specifies state for the subcomponent.
2123///
2124/// This type is not used in any activity, and only used as *part* of another schema.
2125///
2126#[serde_with::serde_as(crate = "::client::serde_with")]
2127#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2128pub struct Status {
2129 /// Code specifies AppDevExperienceFeature's subcomponent ready state.
2130
2131 pub code: Option<String>,
2132 /// Description is populated if Code is Failed, explaining why it has failed.
2133
2134 pub description: Option<String>,
2135}
2136
2137impl client::Part for Status {}
2138
2139
2140/// Request message for `TestIamPermissions` method.
2141///
2142/// # Activities
2143///
2144/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2145/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2146///
2147/// * [locations features test iam permissions projects](ProjectLocationFeatureTestIamPermissionCall) (request)
2148/// * [locations memberships test iam permissions projects](ProjectLocationMembershipTestIamPermissionCall) (request)
2149#[serde_with::serde_as(crate = "::client::serde_with")]
2150#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2151pub struct TestIamPermissionsRequest {
2152 /// 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).
2153
2154 pub permissions: Option<Vec<String>>,
2155}
2156
2157impl client::RequestValue for TestIamPermissionsRequest {}
2158
2159
2160/// Response message for `TestIamPermissions` method.
2161///
2162/// # Activities
2163///
2164/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2165/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2166///
2167/// * [locations features test iam permissions projects](ProjectLocationFeatureTestIamPermissionCall) (response)
2168/// * [locations memberships test iam permissions projects](ProjectLocationMembershipTestIamPermissionCall) (response)
2169#[serde_with::serde_as(crate = "::client::serde_with")]
2170#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2171pub struct TestIamPermissionsResponse {
2172 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2173
2174 pub permissions: Option<Vec<String>>,
2175}
2176
2177impl client::ResponseResult for TestIamPermissionsResponse {}
2178
2179
2180/// TypeMeta is the type information needed for content unmarshalling of Kubernetes resources in the manifest.
2181///
2182/// This type is not used in any activity, and only used as *part* of another schema.
2183///
2184#[serde_with::serde_as(crate = "::client::serde_with")]
2185#[derive(Default, Clone, Debug, Serialize, Deserialize)]
2186pub struct TypeMeta {
2187 /// APIVersion of the resource (e.g. v1).
2188 #[serde(rename="apiVersion")]
2189
2190 pub api_version: Option<String>,
2191 /// Kind of the resource (e.g. Deployment).
2192
2193 pub kind: Option<String>,
2194}
2195
2196impl client::Part for TypeMeta {}
2197
2198
2199
2200// ###################
2201// MethodBuilders ###
2202// #################
2203
2204/// A builder providing access to all methods supported on *project* resources.
2205/// It is not used directly, but through the [`GKEHub`] hub.
2206///
2207/// # Example
2208///
2209/// Instantiate a resource builder
2210///
2211/// ```test_harness,no_run
2212/// extern crate hyper;
2213/// extern crate hyper_rustls;
2214/// extern crate google_gkehub1 as gkehub1;
2215///
2216/// # async fn dox() {
2217/// use std::default::Default;
2218/// use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
2219///
2220/// let secret: oauth2::ApplicationSecret = Default::default();
2221/// let auth = oauth2::InstalledFlowAuthenticator::builder(
2222/// secret,
2223/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2224/// ).build().await.unwrap();
2225/// let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
2226/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2227/// // like `locations_features_create(...)`, `locations_features_delete(...)`, `locations_features_get(...)`, `locations_features_get_iam_policy(...)`, `locations_features_list(...)`, `locations_features_patch(...)`, `locations_features_set_iam_policy(...)`, `locations_features_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `locations_memberships_create(...)`, `locations_memberships_delete(...)`, `locations_memberships_generate_connect_manifest(...)`, `locations_memberships_get(...)`, `locations_memberships_get_iam_policy(...)`, `locations_memberships_list(...)`, `locations_memberships_patch(...)`, `locations_memberships_set_iam_policy(...)`, `locations_memberships_test_iam_permissions(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
2228/// // to build up your call.
2229/// let rb = hub.projects();
2230/// # }
2231/// ```
2232pub struct ProjectMethods<'a, S>
2233 where S: 'a {
2234
2235 hub: &'a GKEHub<S>,
2236}
2237
2238impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
2239
2240impl<'a, S> ProjectMethods<'a, S> {
2241
2242 /// Create a builder to help you perform the following task:
2243 ///
2244 /// Adds a new Feature.
2245 ///
2246 /// # Arguments
2247 ///
2248 /// * `request` - No description provided.
2249 /// * `parent` - Required. The parent (project and location) where the Feature will be created. Specified in the format `projects/*/locations/*`.
2250 pub fn locations_features_create(&self, request: Feature, parent: &str) -> ProjectLocationFeatureCreateCall<'a, S> {
2251 ProjectLocationFeatureCreateCall {
2252 hub: self.hub,
2253 _request: request,
2254 _parent: parent.to_string(),
2255 _request_id: Default::default(),
2256 _feature_id: Default::default(),
2257 _delegate: Default::default(),
2258 _additional_params: Default::default(),
2259 _scopes: Default::default(),
2260 }
2261 }
2262
2263 /// Create a builder to help you perform the following task:
2264 ///
2265 /// Removes a Feature.
2266 ///
2267 /// # Arguments
2268 ///
2269 /// * `name` - Required. The Feature resource name in the format `projects/*/locations/*/features/*`.
2270 pub fn locations_features_delete(&self, name: &str) -> ProjectLocationFeatureDeleteCall<'a, S> {
2271 ProjectLocationFeatureDeleteCall {
2272 hub: self.hub,
2273 _name: name.to_string(),
2274 _request_id: Default::default(),
2275 _force: Default::default(),
2276 _delegate: Default::default(),
2277 _additional_params: Default::default(),
2278 _scopes: Default::default(),
2279 }
2280 }
2281
2282 /// Create a builder to help you perform the following task:
2283 ///
2284 /// Gets details of a single Feature.
2285 ///
2286 /// # Arguments
2287 ///
2288 /// * `name` - Required. The Feature resource name in the format `projects/*/locations/*/features/*`
2289 pub fn locations_features_get(&self, name: &str) -> ProjectLocationFeatureGetCall<'a, S> {
2290 ProjectLocationFeatureGetCall {
2291 hub: self.hub,
2292 _name: name.to_string(),
2293 _delegate: Default::default(),
2294 _additional_params: Default::default(),
2295 _scopes: Default::default(),
2296 }
2297 }
2298
2299 /// Create a builder to help you perform the following task:
2300 ///
2301 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2302 ///
2303 /// # Arguments
2304 ///
2305 /// * `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.
2306 pub fn locations_features_get_iam_policy(&self, resource: &str) -> ProjectLocationFeatureGetIamPolicyCall<'a, S> {
2307 ProjectLocationFeatureGetIamPolicyCall {
2308 hub: self.hub,
2309 _resource: resource.to_string(),
2310 _options_requested_policy_version: Default::default(),
2311 _delegate: Default::default(),
2312 _additional_params: Default::default(),
2313 _scopes: Default::default(),
2314 }
2315 }
2316
2317 /// Create a builder to help you perform the following task:
2318 ///
2319 /// Lists Features in a given project and location.
2320 ///
2321 /// # Arguments
2322 ///
2323 /// * `parent` - Required. The parent (project and location) where the Features will be listed. Specified in the format `projects/*/locations/*`.
2324 pub fn locations_features_list(&self, parent: &str) -> ProjectLocationFeatureListCall<'a, S> {
2325 ProjectLocationFeatureListCall {
2326 hub: self.hub,
2327 _parent: parent.to_string(),
2328 _page_token: Default::default(),
2329 _page_size: Default::default(),
2330 _order_by: Default::default(),
2331 _filter: Default::default(),
2332 _delegate: Default::default(),
2333 _additional_params: Default::default(),
2334 _scopes: Default::default(),
2335 }
2336 }
2337
2338 /// Create a builder to help you perform the following task:
2339 ///
2340 /// Updates an existing Feature.
2341 ///
2342 /// # Arguments
2343 ///
2344 /// * `request` - No description provided.
2345 /// * `name` - Required. The Feature resource name in the format `projects/*/locations/*/features/*`.
2346 pub fn locations_features_patch(&self, request: Feature, name: &str) -> ProjectLocationFeaturePatchCall<'a, S> {
2347 ProjectLocationFeaturePatchCall {
2348 hub: self.hub,
2349 _request: request,
2350 _name: name.to_string(),
2351 _update_mask: Default::default(),
2352 _request_id: Default::default(),
2353 _delegate: Default::default(),
2354 _additional_params: Default::default(),
2355 _scopes: Default::default(),
2356 }
2357 }
2358
2359 /// Create a builder to help you perform the following task:
2360 ///
2361 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2362 ///
2363 /// # Arguments
2364 ///
2365 /// * `request` - No description provided.
2366 /// * `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.
2367 pub fn locations_features_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationFeatureSetIamPolicyCall<'a, S> {
2368 ProjectLocationFeatureSetIamPolicyCall {
2369 hub: self.hub,
2370 _request: request,
2371 _resource: resource.to_string(),
2372 _delegate: Default::default(),
2373 _additional_params: Default::default(),
2374 _scopes: Default::default(),
2375 }
2376 }
2377
2378 /// Create a builder to help you perform the following task:
2379 ///
2380 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2381 ///
2382 /// # Arguments
2383 ///
2384 /// * `request` - No description provided.
2385 /// * `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.
2386 pub fn locations_features_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationFeatureTestIamPermissionCall<'a, S> {
2387 ProjectLocationFeatureTestIamPermissionCall {
2388 hub: self.hub,
2389 _request: request,
2390 _resource: resource.to_string(),
2391 _delegate: Default::default(),
2392 _additional_params: Default::default(),
2393 _scopes: Default::default(),
2394 }
2395 }
2396
2397 /// Create a builder to help you perform the following task:
2398 ///
2399 /// Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.
2400 ///
2401 /// # Arguments
2402 ///
2403 /// * `request` - No description provided.
2404 /// * `parent` - Required. The parent (project and location) where the Memberships will be created. Specified in the format `projects/*/locations/*`.
2405 pub fn locations_memberships_create(&self, request: Membership, parent: &str) -> ProjectLocationMembershipCreateCall<'a, S> {
2406 ProjectLocationMembershipCreateCall {
2407 hub: self.hub,
2408 _request: request,
2409 _parent: parent.to_string(),
2410 _request_id: Default::default(),
2411 _membership_id: Default::default(),
2412 _delegate: Default::default(),
2413 _additional_params: Default::default(),
2414 _scopes: Default::default(),
2415 }
2416 }
2417
2418 /// Create a builder to help you perform the following task:
2419 ///
2420 /// Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.
2421 ///
2422 /// # Arguments
2423 ///
2424 /// * `name` - Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
2425 pub fn locations_memberships_delete(&self, name: &str) -> ProjectLocationMembershipDeleteCall<'a, S> {
2426 ProjectLocationMembershipDeleteCall {
2427 hub: self.hub,
2428 _name: name.to_string(),
2429 _request_id: Default::default(),
2430 _delegate: Default::default(),
2431 _additional_params: Default::default(),
2432 _scopes: Default::default(),
2433 }
2434 }
2435
2436 /// Create a builder to help you perform the following task:
2437 ///
2438 /// Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.
2439 ///
2440 /// # Arguments
2441 ///
2442 /// * `name` - Required. The Membership resource name the Agent will associate with, in the format `projects/*/locations/*/memberships/*`.
2443 pub fn locations_memberships_generate_connect_manifest(&self, name: &str) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
2444 ProjectLocationMembershipGenerateConnectManifestCall {
2445 hub: self.hub,
2446 _name: name.to_string(),
2447 _version: Default::default(),
2448 _registry: Default::default(),
2449 _proxy: Default::default(),
2450 _namespace: Default::default(),
2451 _is_upgrade: Default::default(),
2452 _image_pull_secret_content: Default::default(),
2453 _delegate: Default::default(),
2454 _additional_params: Default::default(),
2455 _scopes: Default::default(),
2456 }
2457 }
2458
2459 /// Create a builder to help you perform the following task:
2460 ///
2461 /// Gets the details of a Membership.
2462 ///
2463 /// # Arguments
2464 ///
2465 /// * `name` - Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
2466 pub fn locations_memberships_get(&self, name: &str) -> ProjectLocationMembershipGetCall<'a, S> {
2467 ProjectLocationMembershipGetCall {
2468 hub: self.hub,
2469 _name: name.to_string(),
2470 _delegate: Default::default(),
2471 _additional_params: Default::default(),
2472 _scopes: Default::default(),
2473 }
2474 }
2475
2476 /// Create a builder to help you perform the following task:
2477 ///
2478 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2479 ///
2480 /// # Arguments
2481 ///
2482 /// * `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.
2483 pub fn locations_memberships_get_iam_policy(&self, resource: &str) -> ProjectLocationMembershipGetIamPolicyCall<'a, S> {
2484 ProjectLocationMembershipGetIamPolicyCall {
2485 hub: self.hub,
2486 _resource: resource.to_string(),
2487 _options_requested_policy_version: Default::default(),
2488 _delegate: Default::default(),
2489 _additional_params: Default::default(),
2490 _scopes: Default::default(),
2491 }
2492 }
2493
2494 /// Create a builder to help you perform the following task:
2495 ///
2496 /// Lists Memberships in a given project and location.
2497 ///
2498 /// # Arguments
2499 ///
2500 /// * `parent` - Required. The parent (project and location) where the Memberships will be listed. Specified in the format `projects/*/locations/*`.
2501 pub fn locations_memberships_list(&self, parent: &str) -> ProjectLocationMembershipListCall<'a, S> {
2502 ProjectLocationMembershipListCall {
2503 hub: self.hub,
2504 _parent: parent.to_string(),
2505 _page_token: Default::default(),
2506 _page_size: Default::default(),
2507 _order_by: Default::default(),
2508 _filter: Default::default(),
2509 _delegate: Default::default(),
2510 _additional_params: Default::default(),
2511 _scopes: Default::default(),
2512 }
2513 }
2514
2515 /// Create a builder to help you perform the following task:
2516 ///
2517 /// Updates an existing Membership.
2518 ///
2519 /// # Arguments
2520 ///
2521 /// * `request` - No description provided.
2522 /// * `name` - Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
2523 pub fn locations_memberships_patch(&self, request: Membership, name: &str) -> ProjectLocationMembershipPatchCall<'a, S> {
2524 ProjectLocationMembershipPatchCall {
2525 hub: self.hub,
2526 _request: request,
2527 _name: name.to_string(),
2528 _update_mask: Default::default(),
2529 _request_id: Default::default(),
2530 _delegate: Default::default(),
2531 _additional_params: Default::default(),
2532 _scopes: Default::default(),
2533 }
2534 }
2535
2536 /// Create a builder to help you perform the following task:
2537 ///
2538 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2539 ///
2540 /// # Arguments
2541 ///
2542 /// * `request` - No description provided.
2543 /// * `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.
2544 pub fn locations_memberships_set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> ProjectLocationMembershipSetIamPolicyCall<'a, S> {
2545 ProjectLocationMembershipSetIamPolicyCall {
2546 hub: self.hub,
2547 _request: request,
2548 _resource: resource.to_string(),
2549 _delegate: Default::default(),
2550 _additional_params: Default::default(),
2551 _scopes: Default::default(),
2552 }
2553 }
2554
2555 /// Create a builder to help you perform the following task:
2556 ///
2557 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2558 ///
2559 /// # Arguments
2560 ///
2561 /// * `request` - No description provided.
2562 /// * `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.
2563 pub fn locations_memberships_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> ProjectLocationMembershipTestIamPermissionCall<'a, S> {
2564 ProjectLocationMembershipTestIamPermissionCall {
2565 hub: self.hub,
2566 _request: request,
2567 _resource: resource.to_string(),
2568 _delegate: Default::default(),
2569 _additional_params: Default::default(),
2570 _scopes: Default::default(),
2571 }
2572 }
2573
2574 /// Create a builder to help you perform the following task:
2575 ///
2576 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
2577 ///
2578 /// # Arguments
2579 ///
2580 /// * `request` - No description provided.
2581 /// * `name` - The name of the operation resource to be cancelled.
2582 pub fn locations_operations_cancel(&self, request: CancelOperationRequest, name: &str) -> ProjectLocationOperationCancelCall<'a, S> {
2583 ProjectLocationOperationCancelCall {
2584 hub: self.hub,
2585 _request: request,
2586 _name: name.to_string(),
2587 _delegate: Default::default(),
2588 _additional_params: Default::default(),
2589 _scopes: Default::default(),
2590 }
2591 }
2592
2593 /// Create a builder to help you perform the following task:
2594 ///
2595 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2596 ///
2597 /// # Arguments
2598 ///
2599 /// * `name` - The name of the operation resource to be deleted.
2600 pub fn locations_operations_delete(&self, name: &str) -> ProjectLocationOperationDeleteCall<'a, S> {
2601 ProjectLocationOperationDeleteCall {
2602 hub: self.hub,
2603 _name: name.to_string(),
2604 _delegate: Default::default(),
2605 _additional_params: Default::default(),
2606 _scopes: Default::default(),
2607 }
2608 }
2609
2610 /// Create a builder to help you perform the following task:
2611 ///
2612 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2613 ///
2614 /// # Arguments
2615 ///
2616 /// * `name` - The name of the operation resource.
2617 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, S> {
2618 ProjectLocationOperationGetCall {
2619 hub: self.hub,
2620 _name: name.to_string(),
2621 _delegate: Default::default(),
2622 _additional_params: Default::default(),
2623 _scopes: Default::default(),
2624 }
2625 }
2626
2627 /// Create a builder to help you perform the following task:
2628 ///
2629 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
2630 ///
2631 /// # Arguments
2632 ///
2633 /// * `name` - The name of the operation's parent resource.
2634 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, S> {
2635 ProjectLocationOperationListCall {
2636 hub: self.hub,
2637 _name: name.to_string(),
2638 _page_token: Default::default(),
2639 _page_size: Default::default(),
2640 _filter: Default::default(),
2641 _delegate: Default::default(),
2642 _additional_params: Default::default(),
2643 _scopes: Default::default(),
2644 }
2645 }
2646
2647 /// Create a builder to help you perform the following task:
2648 ///
2649 /// Gets information about a location.
2650 ///
2651 /// # Arguments
2652 ///
2653 /// * `name` - Resource name for the location.
2654 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, S> {
2655 ProjectLocationGetCall {
2656 hub: self.hub,
2657 _name: name.to_string(),
2658 _delegate: Default::default(),
2659 _additional_params: Default::default(),
2660 _scopes: Default::default(),
2661 }
2662 }
2663
2664 /// Create a builder to help you perform the following task:
2665 ///
2666 /// Lists information about the supported locations for this service.
2667 ///
2668 /// # Arguments
2669 ///
2670 /// * `name` - The resource that owns the locations collection, if applicable.
2671 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, S> {
2672 ProjectLocationListCall {
2673 hub: self.hub,
2674 _name: name.to_string(),
2675 _page_token: Default::default(),
2676 _page_size: Default::default(),
2677 _filter: Default::default(),
2678 _delegate: Default::default(),
2679 _additional_params: Default::default(),
2680 _scopes: Default::default(),
2681 }
2682 }
2683}
2684
2685
2686
2687
2688
2689// ###################
2690// CallBuilders ###
2691// #################
2692
2693/// Adds a new Feature.
2694///
2695/// A builder for the *locations.features.create* method supported by a *project* resource.
2696/// It is not used directly, but through a [`ProjectMethods`] instance.
2697///
2698/// # Example
2699///
2700/// Instantiate a resource method builder
2701///
2702/// ```test_harness,no_run
2703/// # extern crate hyper;
2704/// # extern crate hyper_rustls;
2705/// # extern crate google_gkehub1 as gkehub1;
2706/// use gkehub1::api::Feature;
2707/// # async fn dox() {
2708/// # use std::default::Default;
2709/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
2710///
2711/// # let secret: oauth2::ApplicationSecret = Default::default();
2712/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
2713/// # secret,
2714/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2715/// # ).build().await.unwrap();
2716/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
2717/// // As the method needs a request, you would usually fill it with the desired information
2718/// // into the respective structure. Some of the parts shown here might not be applicable !
2719/// // Values shown here are possibly random and not representative !
2720/// let mut req = Feature::default();
2721///
2722/// // You can configure optional parameters by calling the respective setters at will, and
2723/// // execute the final call using `doit()`.
2724/// // Values shown here are possibly random and not representative !
2725/// let result = hub.projects().locations_features_create(req, "parent")
2726/// .request_id("amet.")
2727/// .feature_id("duo")
2728/// .doit().await;
2729/// # }
2730/// ```
2731pub struct ProjectLocationFeatureCreateCall<'a, S>
2732 where S: 'a {
2733
2734 hub: &'a GKEHub<S>,
2735 _request: Feature,
2736 _parent: String,
2737 _request_id: Option<String>,
2738 _feature_id: Option<String>,
2739 _delegate: Option<&'a mut dyn client::Delegate>,
2740 _additional_params: HashMap<String, String>,
2741 _scopes: BTreeSet<String>
2742}
2743
2744impl<'a, S> client::CallBuilder for ProjectLocationFeatureCreateCall<'a, S> {}
2745
2746impl<'a, S> ProjectLocationFeatureCreateCall<'a, S>
2747where
2748 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
2749 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
2750 S::Future: Send + Unpin + 'static,
2751 S::Error: Into<Box<dyn StdError + Send + Sync>>,
2752{
2753
2754
2755 /// Perform the operation you have build so far.
2756 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
2757 use std::io::{Read, Seek};
2758 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
2759 use client::{ToParts, url::Params};
2760 use std::borrow::Cow;
2761
2762 let mut dd = client::DefaultDelegate;
2763 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
2764 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.create",
2765 http_method: hyper::Method::POST });
2766
2767 for &field in ["alt", "parent", "requestId", "featureId"].iter() {
2768 if self._additional_params.contains_key(field) {
2769 dlg.finished(false);
2770 return Err(client::Error::FieldClash(field));
2771 }
2772 }
2773
2774 let mut params = Params::with_capacity(6 + self._additional_params.len());
2775 params.push("parent", self._parent);
2776 if let Some(value) = self._request_id.as_ref() {
2777 params.push("requestId", value);
2778 }
2779 if let Some(value) = self._feature_id.as_ref() {
2780 params.push("featureId", value);
2781 }
2782
2783 params.extend(self._additional_params.iter());
2784
2785 params.push("alt", "json");
2786 let mut url = self.hub._base_url.clone() + "v1/{+parent}/features";
2787 if self._scopes.is_empty() {
2788 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
2789 }
2790
2791 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2792 url = params.uri_replacement(url, param_name, find_this, true);
2793 }
2794 {
2795 let to_remove = ["parent"];
2796 params.remove_params(&to_remove);
2797 }
2798
2799 let url = params.parse_with_url(&url);
2800
2801 let mut json_mime_type = mime::APPLICATION_JSON;
2802 let mut request_value_reader =
2803 {
2804 let mut value = json::value::to_value(&self._request).expect("serde to work");
2805 client::remove_json_null_values(&mut value);
2806 let mut dst = io::Cursor::new(Vec::with_capacity(128));
2807 json::to_writer(&mut dst, &value).unwrap();
2808 dst
2809 };
2810 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
2811 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2812
2813
2814 loop {
2815 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
2816 Ok(token) => token,
2817 Err(e) => {
2818 match dlg.token(e) {
2819 Ok(token) => token,
2820 Err(e) => {
2821 dlg.finished(false);
2822 return Err(client::Error::MissingToken(e));
2823 }
2824 }
2825 }
2826 };
2827 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
2828 let mut req_result = {
2829 let client = &self.hub.client;
2830 dlg.pre_request();
2831 let mut req_builder = hyper::Request::builder()
2832 .method(hyper::Method::POST)
2833 .uri(url.as_str())
2834 .header(USER_AGENT, self.hub._user_agent.clone());
2835
2836 if let Some(token) = token.as_ref() {
2837 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2838 }
2839
2840
2841 let request = req_builder
2842 .header(CONTENT_TYPE, json_mime_type.to_string())
2843 .header(CONTENT_LENGTH, request_size as u64)
2844 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
2845
2846 client.request(request.unwrap()).await
2847
2848 };
2849
2850 match req_result {
2851 Err(err) => {
2852 if let client::Retry::After(d) = dlg.http_error(&err) {
2853 sleep(d).await;
2854 continue;
2855 }
2856 dlg.finished(false);
2857 return Err(client::Error::HttpError(err))
2858 }
2859 Ok(mut res) => {
2860 if !res.status().is_success() {
2861 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2862 let (parts, _) = res.into_parts();
2863 let body = hyper::Body::from(res_body_string.clone());
2864 let restored_response = hyper::Response::from_parts(parts, body);
2865
2866 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
2867
2868 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
2869 sleep(d).await;
2870 continue;
2871 }
2872
2873 dlg.finished(false);
2874
2875 return match server_response {
2876 Some(error_value) => Err(client::Error::BadRequest(error_value)),
2877 None => Err(client::Error::Failure(restored_response)),
2878 }
2879 }
2880 let result_value = {
2881 let res_body_string = client::get_body_as_string(res.body_mut()).await;
2882
2883 match json::from_str(&res_body_string) {
2884 Ok(decoded) => (res, decoded),
2885 Err(err) => {
2886 dlg.response_json_decode_error(&res_body_string, &err);
2887 return Err(client::Error::JsonDecodeError(res_body_string, err));
2888 }
2889 }
2890 };
2891
2892 dlg.finished(true);
2893 return Ok(result_value)
2894 }
2895 }
2896 }
2897 }
2898
2899
2900 ///
2901 /// Sets the *request* property to the given value.
2902 ///
2903 /// Even though the property as already been set when instantiating this call,
2904 /// we provide this method for API completeness.
2905 pub fn request(mut self, new_value: Feature) -> ProjectLocationFeatureCreateCall<'a, S> {
2906 self._request = new_value;
2907 self
2908 }
2909 /// Required. The parent (project and location) where the Feature will be created. Specified in the format `projects/*/locations/*`.
2910 ///
2911 /// Sets the *parent* path property to the given value.
2912 ///
2913 /// Even though the property as already been set when instantiating this call,
2914 /// we provide this method for API completeness.
2915 pub fn parent(mut self, new_value: &str) -> ProjectLocationFeatureCreateCall<'a, S> {
2916 self._parent = new_value.to_string();
2917 self
2918 }
2919 /// A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
2920 ///
2921 /// Sets the *request id* query property to the given value.
2922 pub fn request_id(mut self, new_value: &str) -> ProjectLocationFeatureCreateCall<'a, S> {
2923 self._request_id = Some(new_value.to_string());
2924 self
2925 }
2926 /// The ID of the feature to create.
2927 ///
2928 /// Sets the *feature id* query property to the given value.
2929 pub fn feature_id(mut self, new_value: &str) -> ProjectLocationFeatureCreateCall<'a, S> {
2930 self._feature_id = Some(new_value.to_string());
2931 self
2932 }
2933 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2934 /// while executing the actual API request.
2935 ///
2936 /// ````text
2937 /// It should be used to handle progress information, and to implement a certain level of resilience.
2938 /// ````
2939 ///
2940 /// Sets the *delegate* property to the given value.
2941 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureCreateCall<'a, S> {
2942 self._delegate = Some(new_value);
2943 self
2944 }
2945
2946 /// Set any additional parameter of the query string used in the request.
2947 /// It should be used to set parameters which are not yet available through their own
2948 /// setters.
2949 ///
2950 /// Please note that this method must not be used to set any of the known parameters
2951 /// which have their own setter method. If done anyway, the request will fail.
2952 ///
2953 /// # Additional Parameters
2954 ///
2955 /// * *$.xgafv* (query-string) - V1 error format.
2956 /// * *access_token* (query-string) - OAuth access token.
2957 /// * *alt* (query-string) - Data format for response.
2958 /// * *callback* (query-string) - JSONP
2959 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2960 /// * *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.
2961 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2962 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2963 /// * *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.
2964 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2965 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2966 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureCreateCall<'a, S>
2967 where T: AsRef<str> {
2968 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
2969 self
2970 }
2971
2972 /// Identifies the authorization scope for the method you are building.
2973 ///
2974 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2975 /// [`Scope::CloudPlatform`].
2976 ///
2977 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2978 /// tokens for more than one scope.
2979 ///
2980 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2981 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2982 /// sufficient, a read-write scope will do as well.
2983 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureCreateCall<'a, S>
2984 where St: AsRef<str> {
2985 self._scopes.insert(String::from(scope.as_ref()));
2986 self
2987 }
2988 /// Identifies the authorization scope(s) for the method you are building.
2989 ///
2990 /// See [`Self::add_scope()`] for details.
2991 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureCreateCall<'a, S>
2992 where I: IntoIterator<Item = St>,
2993 St: AsRef<str> {
2994 self._scopes
2995 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2996 self
2997 }
2998
2999 /// Removes all scopes, and no default scope will be used either.
3000 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3001 /// for details).
3002 pub fn clear_scopes(mut self) -> ProjectLocationFeatureCreateCall<'a, S> {
3003 self._scopes.clear();
3004 self
3005 }
3006}
3007
3008
3009/// Removes a Feature.
3010///
3011/// A builder for the *locations.features.delete* method supported by a *project* resource.
3012/// It is not used directly, but through a [`ProjectMethods`] instance.
3013///
3014/// # Example
3015///
3016/// Instantiate a resource method builder
3017///
3018/// ```test_harness,no_run
3019/// # extern crate hyper;
3020/// # extern crate hyper_rustls;
3021/// # extern crate google_gkehub1 as gkehub1;
3022/// # async fn dox() {
3023/// # use std::default::Default;
3024/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3025///
3026/// # let secret: oauth2::ApplicationSecret = Default::default();
3027/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3028/// # secret,
3029/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3030/// # ).build().await.unwrap();
3031/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3032/// // You can configure optional parameters by calling the respective setters at will, and
3033/// // execute the final call using `doit()`.
3034/// // Values shown here are possibly random and not representative !
3035/// let result = hub.projects().locations_features_delete("name")
3036/// .request_id("gubergren")
3037/// .force(true)
3038/// .doit().await;
3039/// # }
3040/// ```
3041pub struct ProjectLocationFeatureDeleteCall<'a, S>
3042 where S: 'a {
3043
3044 hub: &'a GKEHub<S>,
3045 _name: String,
3046 _request_id: Option<String>,
3047 _force: Option<bool>,
3048 _delegate: Option<&'a mut dyn client::Delegate>,
3049 _additional_params: HashMap<String, String>,
3050 _scopes: BTreeSet<String>
3051}
3052
3053impl<'a, S> client::CallBuilder for ProjectLocationFeatureDeleteCall<'a, S> {}
3054
3055impl<'a, S> ProjectLocationFeatureDeleteCall<'a, S>
3056where
3057 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3058 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3059 S::Future: Send + Unpin + 'static,
3060 S::Error: Into<Box<dyn StdError + Send + Sync>>,
3061{
3062
3063
3064 /// Perform the operation you have build so far.
3065 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
3066 use std::io::{Read, Seek};
3067 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3068 use client::{ToParts, url::Params};
3069 use std::borrow::Cow;
3070
3071 let mut dd = client::DefaultDelegate;
3072 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3073 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.delete",
3074 http_method: hyper::Method::DELETE });
3075
3076 for &field in ["alt", "name", "requestId", "force"].iter() {
3077 if self._additional_params.contains_key(field) {
3078 dlg.finished(false);
3079 return Err(client::Error::FieldClash(field));
3080 }
3081 }
3082
3083 let mut params = Params::with_capacity(5 + self._additional_params.len());
3084 params.push("name", self._name);
3085 if let Some(value) = self._request_id.as_ref() {
3086 params.push("requestId", value);
3087 }
3088 if let Some(value) = self._force.as_ref() {
3089 params.push("force", value.to_string());
3090 }
3091
3092 params.extend(self._additional_params.iter());
3093
3094 params.push("alt", "json");
3095 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3096 if self._scopes.is_empty() {
3097 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
3098 }
3099
3100 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3101 url = params.uri_replacement(url, param_name, find_this, true);
3102 }
3103 {
3104 let to_remove = ["name"];
3105 params.remove_params(&to_remove);
3106 }
3107
3108 let url = params.parse_with_url(&url);
3109
3110
3111
3112 loop {
3113 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3114 Ok(token) => token,
3115 Err(e) => {
3116 match dlg.token(e) {
3117 Ok(token) => token,
3118 Err(e) => {
3119 dlg.finished(false);
3120 return Err(client::Error::MissingToken(e));
3121 }
3122 }
3123 }
3124 };
3125 let mut req_result = {
3126 let client = &self.hub.client;
3127 dlg.pre_request();
3128 let mut req_builder = hyper::Request::builder()
3129 .method(hyper::Method::DELETE)
3130 .uri(url.as_str())
3131 .header(USER_AGENT, self.hub._user_agent.clone());
3132
3133 if let Some(token) = token.as_ref() {
3134 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3135 }
3136
3137
3138 let request = req_builder
3139 .body(hyper::body::Body::empty());
3140
3141 client.request(request.unwrap()).await
3142
3143 };
3144
3145 match req_result {
3146 Err(err) => {
3147 if let client::Retry::After(d) = dlg.http_error(&err) {
3148 sleep(d).await;
3149 continue;
3150 }
3151 dlg.finished(false);
3152 return Err(client::Error::HttpError(err))
3153 }
3154 Ok(mut res) => {
3155 if !res.status().is_success() {
3156 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3157 let (parts, _) = res.into_parts();
3158 let body = hyper::Body::from(res_body_string.clone());
3159 let restored_response = hyper::Response::from_parts(parts, body);
3160
3161 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3162
3163 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3164 sleep(d).await;
3165 continue;
3166 }
3167
3168 dlg.finished(false);
3169
3170 return match server_response {
3171 Some(error_value) => Err(client::Error::BadRequest(error_value)),
3172 None => Err(client::Error::Failure(restored_response)),
3173 }
3174 }
3175 let result_value = {
3176 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3177
3178 match json::from_str(&res_body_string) {
3179 Ok(decoded) => (res, decoded),
3180 Err(err) => {
3181 dlg.response_json_decode_error(&res_body_string, &err);
3182 return Err(client::Error::JsonDecodeError(res_body_string, err));
3183 }
3184 }
3185 };
3186
3187 dlg.finished(true);
3188 return Ok(result_value)
3189 }
3190 }
3191 }
3192 }
3193
3194
3195 /// Required. The Feature resource name in the format `projects/*/locations/*/features/*`.
3196 ///
3197 /// Sets the *name* path property to the given value.
3198 ///
3199 /// Even though the property as already been set when instantiating this call,
3200 /// we provide this method for API completeness.
3201 pub fn name(mut self, new_value: &str) -> ProjectLocationFeatureDeleteCall<'a, S> {
3202 self._name = new_value.to_string();
3203 self
3204 }
3205 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
3206 ///
3207 /// Sets the *request id* query property to the given value.
3208 pub fn request_id(mut self, new_value: &str) -> ProjectLocationFeatureDeleteCall<'a, S> {
3209 self._request_id = Some(new_value.to_string());
3210 self
3211 }
3212 /// If set to true, the delete will ignore any outstanding resources for this Feature (that is, `FeatureState.has_resources` is set to true). These resources will NOT be cleaned up or modified in any way.
3213 ///
3214 /// Sets the *force* query property to the given value.
3215 pub fn force(mut self, new_value: bool) -> ProjectLocationFeatureDeleteCall<'a, S> {
3216 self._force = Some(new_value);
3217 self
3218 }
3219 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3220 /// while executing the actual API request.
3221 ///
3222 /// ````text
3223 /// It should be used to handle progress information, and to implement a certain level of resilience.
3224 /// ````
3225 ///
3226 /// Sets the *delegate* property to the given value.
3227 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureDeleteCall<'a, S> {
3228 self._delegate = Some(new_value);
3229 self
3230 }
3231
3232 /// Set any additional parameter of the query string used in the request.
3233 /// It should be used to set parameters which are not yet available through their own
3234 /// setters.
3235 ///
3236 /// Please note that this method must not be used to set any of the known parameters
3237 /// which have their own setter method. If done anyway, the request will fail.
3238 ///
3239 /// # Additional Parameters
3240 ///
3241 /// * *$.xgafv* (query-string) - V1 error format.
3242 /// * *access_token* (query-string) - OAuth access token.
3243 /// * *alt* (query-string) - Data format for response.
3244 /// * *callback* (query-string) - JSONP
3245 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3246 /// * *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.
3247 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3248 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3249 /// * *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.
3250 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3251 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3252 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureDeleteCall<'a, S>
3253 where T: AsRef<str> {
3254 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3255 self
3256 }
3257
3258 /// Identifies the authorization scope for the method you are building.
3259 ///
3260 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3261 /// [`Scope::CloudPlatform`].
3262 ///
3263 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3264 /// tokens for more than one scope.
3265 ///
3266 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3267 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3268 /// sufficient, a read-write scope will do as well.
3269 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureDeleteCall<'a, S>
3270 where St: AsRef<str> {
3271 self._scopes.insert(String::from(scope.as_ref()));
3272 self
3273 }
3274 /// Identifies the authorization scope(s) for the method you are building.
3275 ///
3276 /// See [`Self::add_scope()`] for details.
3277 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureDeleteCall<'a, S>
3278 where I: IntoIterator<Item = St>,
3279 St: AsRef<str> {
3280 self._scopes
3281 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3282 self
3283 }
3284
3285 /// Removes all scopes, and no default scope will be used either.
3286 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3287 /// for details).
3288 pub fn clear_scopes(mut self) -> ProjectLocationFeatureDeleteCall<'a, S> {
3289 self._scopes.clear();
3290 self
3291 }
3292}
3293
3294
3295/// Gets details of a single Feature.
3296///
3297/// A builder for the *locations.features.get* method supported by a *project* resource.
3298/// It is not used directly, but through a [`ProjectMethods`] instance.
3299///
3300/// # Example
3301///
3302/// Instantiate a resource method builder
3303///
3304/// ```test_harness,no_run
3305/// # extern crate hyper;
3306/// # extern crate hyper_rustls;
3307/// # extern crate google_gkehub1 as gkehub1;
3308/// # async fn dox() {
3309/// # use std::default::Default;
3310/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3311///
3312/// # let secret: oauth2::ApplicationSecret = Default::default();
3313/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3314/// # secret,
3315/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3316/// # ).build().await.unwrap();
3317/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3318/// // You can configure optional parameters by calling the respective setters at will, and
3319/// // execute the final call using `doit()`.
3320/// // Values shown here are possibly random and not representative !
3321/// let result = hub.projects().locations_features_get("name")
3322/// .doit().await;
3323/// # }
3324/// ```
3325pub struct ProjectLocationFeatureGetCall<'a, S>
3326 where S: 'a {
3327
3328 hub: &'a GKEHub<S>,
3329 _name: String,
3330 _delegate: Option<&'a mut dyn client::Delegate>,
3331 _additional_params: HashMap<String, String>,
3332 _scopes: BTreeSet<String>
3333}
3334
3335impl<'a, S> client::CallBuilder for ProjectLocationFeatureGetCall<'a, S> {}
3336
3337impl<'a, S> ProjectLocationFeatureGetCall<'a, S>
3338where
3339 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3340 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3341 S::Future: Send + Unpin + 'static,
3342 S::Error: Into<Box<dyn StdError + Send + Sync>>,
3343{
3344
3345
3346 /// Perform the operation you have build so far.
3347 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Feature)> {
3348 use std::io::{Read, Seek};
3349 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3350 use client::{ToParts, url::Params};
3351 use std::borrow::Cow;
3352
3353 let mut dd = client::DefaultDelegate;
3354 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3355 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.get",
3356 http_method: hyper::Method::GET });
3357
3358 for &field in ["alt", "name"].iter() {
3359 if self._additional_params.contains_key(field) {
3360 dlg.finished(false);
3361 return Err(client::Error::FieldClash(field));
3362 }
3363 }
3364
3365 let mut params = Params::with_capacity(3 + self._additional_params.len());
3366 params.push("name", self._name);
3367
3368 params.extend(self._additional_params.iter());
3369
3370 params.push("alt", "json");
3371 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3372 if self._scopes.is_empty() {
3373 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
3374 }
3375
3376 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3377 url = params.uri_replacement(url, param_name, find_this, true);
3378 }
3379 {
3380 let to_remove = ["name"];
3381 params.remove_params(&to_remove);
3382 }
3383
3384 let url = params.parse_with_url(&url);
3385
3386
3387
3388 loop {
3389 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3390 Ok(token) => token,
3391 Err(e) => {
3392 match dlg.token(e) {
3393 Ok(token) => token,
3394 Err(e) => {
3395 dlg.finished(false);
3396 return Err(client::Error::MissingToken(e));
3397 }
3398 }
3399 }
3400 };
3401 let mut req_result = {
3402 let client = &self.hub.client;
3403 dlg.pre_request();
3404 let mut req_builder = hyper::Request::builder()
3405 .method(hyper::Method::GET)
3406 .uri(url.as_str())
3407 .header(USER_AGENT, self.hub._user_agent.clone());
3408
3409 if let Some(token) = token.as_ref() {
3410 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3411 }
3412
3413
3414 let request = req_builder
3415 .body(hyper::body::Body::empty());
3416
3417 client.request(request.unwrap()).await
3418
3419 };
3420
3421 match req_result {
3422 Err(err) => {
3423 if let client::Retry::After(d) = dlg.http_error(&err) {
3424 sleep(d).await;
3425 continue;
3426 }
3427 dlg.finished(false);
3428 return Err(client::Error::HttpError(err))
3429 }
3430 Ok(mut res) => {
3431 if !res.status().is_success() {
3432 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3433 let (parts, _) = res.into_parts();
3434 let body = hyper::Body::from(res_body_string.clone());
3435 let restored_response = hyper::Response::from_parts(parts, body);
3436
3437 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3438
3439 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3440 sleep(d).await;
3441 continue;
3442 }
3443
3444 dlg.finished(false);
3445
3446 return match server_response {
3447 Some(error_value) => Err(client::Error::BadRequest(error_value)),
3448 None => Err(client::Error::Failure(restored_response)),
3449 }
3450 }
3451 let result_value = {
3452 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3453
3454 match json::from_str(&res_body_string) {
3455 Ok(decoded) => (res, decoded),
3456 Err(err) => {
3457 dlg.response_json_decode_error(&res_body_string, &err);
3458 return Err(client::Error::JsonDecodeError(res_body_string, err));
3459 }
3460 }
3461 };
3462
3463 dlg.finished(true);
3464 return Ok(result_value)
3465 }
3466 }
3467 }
3468 }
3469
3470
3471 /// Required. The Feature resource name in the format `projects/*/locations/*/features/*`
3472 ///
3473 /// Sets the *name* path property to the given value.
3474 ///
3475 /// Even though the property as already been set when instantiating this call,
3476 /// we provide this method for API completeness.
3477 pub fn name(mut self, new_value: &str) -> ProjectLocationFeatureGetCall<'a, S> {
3478 self._name = new_value.to_string();
3479 self
3480 }
3481 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3482 /// while executing the actual API request.
3483 ///
3484 /// ````text
3485 /// It should be used to handle progress information, and to implement a certain level of resilience.
3486 /// ````
3487 ///
3488 /// Sets the *delegate* property to the given value.
3489 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureGetCall<'a, S> {
3490 self._delegate = Some(new_value);
3491 self
3492 }
3493
3494 /// Set any additional parameter of the query string used in the request.
3495 /// It should be used to set parameters which are not yet available through their own
3496 /// setters.
3497 ///
3498 /// Please note that this method must not be used to set any of the known parameters
3499 /// which have their own setter method. If done anyway, the request will fail.
3500 ///
3501 /// # Additional Parameters
3502 ///
3503 /// * *$.xgafv* (query-string) - V1 error format.
3504 /// * *access_token* (query-string) - OAuth access token.
3505 /// * *alt* (query-string) - Data format for response.
3506 /// * *callback* (query-string) - JSONP
3507 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3508 /// * *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.
3509 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3510 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3511 /// * *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.
3512 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3513 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3514 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureGetCall<'a, S>
3515 where T: AsRef<str> {
3516 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3517 self
3518 }
3519
3520 /// Identifies the authorization scope for the method you are building.
3521 ///
3522 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3523 /// [`Scope::CloudPlatform`].
3524 ///
3525 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3526 /// tokens for more than one scope.
3527 ///
3528 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3529 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3530 /// sufficient, a read-write scope will do as well.
3531 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureGetCall<'a, S>
3532 where St: AsRef<str> {
3533 self._scopes.insert(String::from(scope.as_ref()));
3534 self
3535 }
3536 /// Identifies the authorization scope(s) for the method you are building.
3537 ///
3538 /// See [`Self::add_scope()`] for details.
3539 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureGetCall<'a, S>
3540 where I: IntoIterator<Item = St>,
3541 St: AsRef<str> {
3542 self._scopes
3543 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3544 self
3545 }
3546
3547 /// Removes all scopes, and no default scope will be used either.
3548 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3549 /// for details).
3550 pub fn clear_scopes(mut self) -> ProjectLocationFeatureGetCall<'a, S> {
3551 self._scopes.clear();
3552 self
3553 }
3554}
3555
3556
3557/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3558///
3559/// A builder for the *locations.features.getIamPolicy* method supported by a *project* resource.
3560/// It is not used directly, but through a [`ProjectMethods`] instance.
3561///
3562/// # Example
3563///
3564/// Instantiate a resource method builder
3565///
3566/// ```test_harness,no_run
3567/// # extern crate hyper;
3568/// # extern crate hyper_rustls;
3569/// # extern crate google_gkehub1 as gkehub1;
3570/// # async fn dox() {
3571/// # use std::default::Default;
3572/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3573///
3574/// # let secret: oauth2::ApplicationSecret = Default::default();
3575/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3576/// # secret,
3577/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3578/// # ).build().await.unwrap();
3579/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3580/// // You can configure optional parameters by calling the respective setters at will, and
3581/// // execute the final call using `doit()`.
3582/// // Values shown here are possibly random and not representative !
3583/// let result = hub.projects().locations_features_get_iam_policy("resource")
3584/// .options_requested_policy_version(-4)
3585/// .doit().await;
3586/// # }
3587/// ```
3588pub struct ProjectLocationFeatureGetIamPolicyCall<'a, S>
3589 where S: 'a {
3590
3591 hub: &'a GKEHub<S>,
3592 _resource: String,
3593 _options_requested_policy_version: Option<i32>,
3594 _delegate: Option<&'a mut dyn client::Delegate>,
3595 _additional_params: HashMap<String, String>,
3596 _scopes: BTreeSet<String>
3597}
3598
3599impl<'a, S> client::CallBuilder for ProjectLocationFeatureGetIamPolicyCall<'a, S> {}
3600
3601impl<'a, S> ProjectLocationFeatureGetIamPolicyCall<'a, S>
3602where
3603 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3604 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3605 S::Future: Send + Unpin + 'static,
3606 S::Error: Into<Box<dyn StdError + Send + Sync>>,
3607{
3608
3609
3610 /// Perform the operation you have build so far.
3611 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Policy)> {
3612 use std::io::{Read, Seek};
3613 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3614 use client::{ToParts, url::Params};
3615 use std::borrow::Cow;
3616
3617 let mut dd = client::DefaultDelegate;
3618 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3619 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.getIamPolicy",
3620 http_method: hyper::Method::GET });
3621
3622 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3623 if self._additional_params.contains_key(field) {
3624 dlg.finished(false);
3625 return Err(client::Error::FieldClash(field));
3626 }
3627 }
3628
3629 let mut params = Params::with_capacity(4 + self._additional_params.len());
3630 params.push("resource", self._resource);
3631 if let Some(value) = self._options_requested_policy_version.as_ref() {
3632 params.push("options.requestedPolicyVersion", value.to_string());
3633 }
3634
3635 params.extend(self._additional_params.iter());
3636
3637 params.push("alt", "json");
3638 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
3639 if self._scopes.is_empty() {
3640 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
3641 }
3642
3643 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3644 url = params.uri_replacement(url, param_name, find_this, true);
3645 }
3646 {
3647 let to_remove = ["resource"];
3648 params.remove_params(&to_remove);
3649 }
3650
3651 let url = params.parse_with_url(&url);
3652
3653
3654
3655 loop {
3656 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3657 Ok(token) => token,
3658 Err(e) => {
3659 match dlg.token(e) {
3660 Ok(token) => token,
3661 Err(e) => {
3662 dlg.finished(false);
3663 return Err(client::Error::MissingToken(e));
3664 }
3665 }
3666 }
3667 };
3668 let mut req_result = {
3669 let client = &self.hub.client;
3670 dlg.pre_request();
3671 let mut req_builder = hyper::Request::builder()
3672 .method(hyper::Method::GET)
3673 .uri(url.as_str())
3674 .header(USER_AGENT, self.hub._user_agent.clone());
3675
3676 if let Some(token) = token.as_ref() {
3677 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3678 }
3679
3680
3681 let request = req_builder
3682 .body(hyper::body::Body::empty());
3683
3684 client.request(request.unwrap()).await
3685
3686 };
3687
3688 match req_result {
3689 Err(err) => {
3690 if let client::Retry::After(d) = dlg.http_error(&err) {
3691 sleep(d).await;
3692 continue;
3693 }
3694 dlg.finished(false);
3695 return Err(client::Error::HttpError(err))
3696 }
3697 Ok(mut res) => {
3698 if !res.status().is_success() {
3699 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3700 let (parts, _) = res.into_parts();
3701 let body = hyper::Body::from(res_body_string.clone());
3702 let restored_response = hyper::Response::from_parts(parts, body);
3703
3704 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3705
3706 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3707 sleep(d).await;
3708 continue;
3709 }
3710
3711 dlg.finished(false);
3712
3713 return match server_response {
3714 Some(error_value) => Err(client::Error::BadRequest(error_value)),
3715 None => Err(client::Error::Failure(restored_response)),
3716 }
3717 }
3718 let result_value = {
3719 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3720
3721 match json::from_str(&res_body_string) {
3722 Ok(decoded) => (res, decoded),
3723 Err(err) => {
3724 dlg.response_json_decode_error(&res_body_string, &err);
3725 return Err(client::Error::JsonDecodeError(res_body_string, err));
3726 }
3727 }
3728 };
3729
3730 dlg.finished(true);
3731 return Ok(result_value)
3732 }
3733 }
3734 }
3735 }
3736
3737
3738 /// 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.
3739 ///
3740 /// Sets the *resource* path property to the given value.
3741 ///
3742 /// Even though the property as already been set when instantiating this call,
3743 /// we provide this method for API completeness.
3744 pub fn resource(mut self, new_value: &str) -> ProjectLocationFeatureGetIamPolicyCall<'a, S> {
3745 self._resource = new_value.to_string();
3746 self
3747 }
3748 /// 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).
3749 ///
3750 /// Sets the *options.requested policy version* query property to the given value.
3751 pub fn options_requested_policy_version(mut self, new_value: i32) -> ProjectLocationFeatureGetIamPolicyCall<'a, S> {
3752 self._options_requested_policy_version = Some(new_value);
3753 self
3754 }
3755 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3756 /// while executing the actual API request.
3757 ///
3758 /// ````text
3759 /// It should be used to handle progress information, and to implement a certain level of resilience.
3760 /// ````
3761 ///
3762 /// Sets the *delegate* property to the given value.
3763 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureGetIamPolicyCall<'a, S> {
3764 self._delegate = Some(new_value);
3765 self
3766 }
3767
3768 /// Set any additional parameter of the query string used in the request.
3769 /// It should be used to set parameters which are not yet available through their own
3770 /// setters.
3771 ///
3772 /// Please note that this method must not be used to set any of the known parameters
3773 /// which have their own setter method. If done anyway, the request will fail.
3774 ///
3775 /// # Additional Parameters
3776 ///
3777 /// * *$.xgafv* (query-string) - V1 error format.
3778 /// * *access_token* (query-string) - OAuth access token.
3779 /// * *alt* (query-string) - Data format for response.
3780 /// * *callback* (query-string) - JSONP
3781 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3782 /// * *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.
3783 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3784 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3785 /// * *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.
3786 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3787 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3788 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureGetIamPolicyCall<'a, S>
3789 where T: AsRef<str> {
3790 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
3791 self
3792 }
3793
3794 /// Identifies the authorization scope for the method you are building.
3795 ///
3796 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3797 /// [`Scope::CloudPlatform`].
3798 ///
3799 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3800 /// tokens for more than one scope.
3801 ///
3802 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3803 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3804 /// sufficient, a read-write scope will do as well.
3805 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureGetIamPolicyCall<'a, S>
3806 where St: AsRef<str> {
3807 self._scopes.insert(String::from(scope.as_ref()));
3808 self
3809 }
3810 /// Identifies the authorization scope(s) for the method you are building.
3811 ///
3812 /// See [`Self::add_scope()`] for details.
3813 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureGetIamPolicyCall<'a, S>
3814 where I: IntoIterator<Item = St>,
3815 St: AsRef<str> {
3816 self._scopes
3817 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3818 self
3819 }
3820
3821 /// Removes all scopes, and no default scope will be used either.
3822 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3823 /// for details).
3824 pub fn clear_scopes(mut self) -> ProjectLocationFeatureGetIamPolicyCall<'a, S> {
3825 self._scopes.clear();
3826 self
3827 }
3828}
3829
3830
3831/// Lists Features in a given project and location.
3832///
3833/// A builder for the *locations.features.list* method supported by a *project* resource.
3834/// It is not used directly, but through a [`ProjectMethods`] instance.
3835///
3836/// # Example
3837///
3838/// Instantiate a resource method builder
3839///
3840/// ```test_harness,no_run
3841/// # extern crate hyper;
3842/// # extern crate hyper_rustls;
3843/// # extern crate google_gkehub1 as gkehub1;
3844/// # async fn dox() {
3845/// # use std::default::Default;
3846/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
3847///
3848/// # let secret: oauth2::ApplicationSecret = Default::default();
3849/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
3850/// # secret,
3851/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3852/// # ).build().await.unwrap();
3853/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
3854/// // You can configure optional parameters by calling the respective setters at will, and
3855/// // execute the final call using `doit()`.
3856/// // Values shown here are possibly random and not representative !
3857/// let result = hub.projects().locations_features_list("parent")
3858/// .page_token("ipsum")
3859/// .page_size(-88)
3860/// .order_by("amet")
3861/// .filter("duo")
3862/// .doit().await;
3863/// # }
3864/// ```
3865pub struct ProjectLocationFeatureListCall<'a, S>
3866 where S: 'a {
3867
3868 hub: &'a GKEHub<S>,
3869 _parent: String,
3870 _page_token: Option<String>,
3871 _page_size: Option<i32>,
3872 _order_by: Option<String>,
3873 _filter: Option<String>,
3874 _delegate: Option<&'a mut dyn client::Delegate>,
3875 _additional_params: HashMap<String, String>,
3876 _scopes: BTreeSet<String>
3877}
3878
3879impl<'a, S> client::CallBuilder for ProjectLocationFeatureListCall<'a, S> {}
3880
3881impl<'a, S> ProjectLocationFeatureListCall<'a, S>
3882where
3883 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
3884 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
3885 S::Future: Send + Unpin + 'static,
3886 S::Error: Into<Box<dyn StdError + Send + Sync>>,
3887{
3888
3889
3890 /// Perform the operation you have build so far.
3891 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListFeaturesResponse)> {
3892 use std::io::{Read, Seek};
3893 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
3894 use client::{ToParts, url::Params};
3895 use std::borrow::Cow;
3896
3897 let mut dd = client::DefaultDelegate;
3898 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
3899 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.list",
3900 http_method: hyper::Method::GET });
3901
3902 for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() {
3903 if self._additional_params.contains_key(field) {
3904 dlg.finished(false);
3905 return Err(client::Error::FieldClash(field));
3906 }
3907 }
3908
3909 let mut params = Params::with_capacity(7 + self._additional_params.len());
3910 params.push("parent", self._parent);
3911 if let Some(value) = self._page_token.as_ref() {
3912 params.push("pageToken", value);
3913 }
3914 if let Some(value) = self._page_size.as_ref() {
3915 params.push("pageSize", value.to_string());
3916 }
3917 if let Some(value) = self._order_by.as_ref() {
3918 params.push("orderBy", value);
3919 }
3920 if let Some(value) = self._filter.as_ref() {
3921 params.push("filter", value);
3922 }
3923
3924 params.extend(self._additional_params.iter());
3925
3926 params.push("alt", "json");
3927 let mut url = self.hub._base_url.clone() + "v1/{+parent}/features";
3928 if self._scopes.is_empty() {
3929 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
3930 }
3931
3932 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3933 url = params.uri_replacement(url, param_name, find_this, true);
3934 }
3935 {
3936 let to_remove = ["parent"];
3937 params.remove_params(&to_remove);
3938 }
3939
3940 let url = params.parse_with_url(&url);
3941
3942
3943
3944 loop {
3945 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
3946 Ok(token) => token,
3947 Err(e) => {
3948 match dlg.token(e) {
3949 Ok(token) => token,
3950 Err(e) => {
3951 dlg.finished(false);
3952 return Err(client::Error::MissingToken(e));
3953 }
3954 }
3955 }
3956 };
3957 let mut req_result = {
3958 let client = &self.hub.client;
3959 dlg.pre_request();
3960 let mut req_builder = hyper::Request::builder()
3961 .method(hyper::Method::GET)
3962 .uri(url.as_str())
3963 .header(USER_AGENT, self.hub._user_agent.clone());
3964
3965 if let Some(token) = token.as_ref() {
3966 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3967 }
3968
3969
3970 let request = req_builder
3971 .body(hyper::body::Body::empty());
3972
3973 client.request(request.unwrap()).await
3974
3975 };
3976
3977 match req_result {
3978 Err(err) => {
3979 if let client::Retry::After(d) = dlg.http_error(&err) {
3980 sleep(d).await;
3981 continue;
3982 }
3983 dlg.finished(false);
3984 return Err(client::Error::HttpError(err))
3985 }
3986 Ok(mut res) => {
3987 if !res.status().is_success() {
3988 let res_body_string = client::get_body_as_string(res.body_mut()).await;
3989 let (parts, _) = res.into_parts();
3990 let body = hyper::Body::from(res_body_string.clone());
3991 let restored_response = hyper::Response::from_parts(parts, body);
3992
3993 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
3994
3995 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
3996 sleep(d).await;
3997 continue;
3998 }
3999
4000 dlg.finished(false);
4001
4002 return match server_response {
4003 Some(error_value) => Err(client::Error::BadRequest(error_value)),
4004 None => Err(client::Error::Failure(restored_response)),
4005 }
4006 }
4007 let result_value = {
4008 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4009
4010 match json::from_str(&res_body_string) {
4011 Ok(decoded) => (res, decoded),
4012 Err(err) => {
4013 dlg.response_json_decode_error(&res_body_string, &err);
4014 return Err(client::Error::JsonDecodeError(res_body_string, err));
4015 }
4016 }
4017 };
4018
4019 dlg.finished(true);
4020 return Ok(result_value)
4021 }
4022 }
4023 }
4024 }
4025
4026
4027 /// Required. The parent (project and location) where the Features will be listed. Specified in the format `projects/*/locations/*`.
4028 ///
4029 /// Sets the *parent* path property to the given value.
4030 ///
4031 /// Even though the property as already been set when instantiating this call,
4032 /// we provide this method for API completeness.
4033 pub fn parent(mut self, new_value: &str) -> ProjectLocationFeatureListCall<'a, S> {
4034 self._parent = new_value.to_string();
4035 self
4036 }
4037 /// Token returned by previous call to `ListFeatures` which specifies the position in the list from where to continue listing the resources.
4038 ///
4039 /// Sets the *page token* query property to the given value.
4040 pub fn page_token(mut self, new_value: &str) -> ProjectLocationFeatureListCall<'a, S> {
4041 self._page_token = Some(new_value.to_string());
4042 self
4043 }
4044 /// When requesting a 'page' of resources, `page_size` specifies number of resources to return. If unspecified or set to 0, all resources will be returned.
4045 ///
4046 /// Sets the *page size* query property to the given value.
4047 pub fn page_size(mut self, new_value: i32) -> ProjectLocationFeatureListCall<'a, S> {
4048 self._page_size = Some(new_value);
4049 self
4050 }
4051 /// One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
4052 ///
4053 /// Sets the *order by* query property to the given value.
4054 pub fn order_by(mut self, new_value: &str) -> ProjectLocationFeatureListCall<'a, S> {
4055 self._order_by = Some(new_value.to_string());
4056 self
4057 }
4058 /// Lists Features that match the filter expression, following the syntax outlined in https://google.aip.dev/160. Examples: - Feature with the name "servicemesh" in project "foo-proj": name = "projects/foo-proj/locations/global/features/servicemesh" - Features that have a label called `foo`: labels.foo:* - Features that have a label called `foo` whose value is `bar`: labels.foo = bar
4059 ///
4060 /// Sets the *filter* query property to the given value.
4061 pub fn filter(mut self, new_value: &str) -> ProjectLocationFeatureListCall<'a, S> {
4062 self._filter = Some(new_value.to_string());
4063 self
4064 }
4065 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4066 /// while executing the actual API request.
4067 ///
4068 /// ````text
4069 /// It should be used to handle progress information, and to implement a certain level of resilience.
4070 /// ````
4071 ///
4072 /// Sets the *delegate* property to the given value.
4073 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureListCall<'a, S> {
4074 self._delegate = Some(new_value);
4075 self
4076 }
4077
4078 /// Set any additional parameter of the query string used in the request.
4079 /// It should be used to set parameters which are not yet available through their own
4080 /// setters.
4081 ///
4082 /// Please note that this method must not be used to set any of the known parameters
4083 /// which have their own setter method. If done anyway, the request will fail.
4084 ///
4085 /// # Additional Parameters
4086 ///
4087 /// * *$.xgafv* (query-string) - V1 error format.
4088 /// * *access_token* (query-string) - OAuth access token.
4089 /// * *alt* (query-string) - Data format for response.
4090 /// * *callback* (query-string) - JSONP
4091 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4092 /// * *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.
4093 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4094 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4095 /// * *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.
4096 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4097 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4098 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureListCall<'a, S>
4099 where T: AsRef<str> {
4100 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4101 self
4102 }
4103
4104 /// Identifies the authorization scope for the method you are building.
4105 ///
4106 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4107 /// [`Scope::CloudPlatform`].
4108 ///
4109 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4110 /// tokens for more than one scope.
4111 ///
4112 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4113 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4114 /// sufficient, a read-write scope will do as well.
4115 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureListCall<'a, S>
4116 where St: AsRef<str> {
4117 self._scopes.insert(String::from(scope.as_ref()));
4118 self
4119 }
4120 /// Identifies the authorization scope(s) for the method you are building.
4121 ///
4122 /// See [`Self::add_scope()`] for details.
4123 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureListCall<'a, S>
4124 where I: IntoIterator<Item = St>,
4125 St: AsRef<str> {
4126 self._scopes
4127 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4128 self
4129 }
4130
4131 /// Removes all scopes, and no default scope will be used either.
4132 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4133 /// for details).
4134 pub fn clear_scopes(mut self) -> ProjectLocationFeatureListCall<'a, S> {
4135 self._scopes.clear();
4136 self
4137 }
4138}
4139
4140
4141/// Updates an existing Feature.
4142///
4143/// A builder for the *locations.features.patch* method supported by a *project* resource.
4144/// It is not used directly, but through a [`ProjectMethods`] instance.
4145///
4146/// # Example
4147///
4148/// Instantiate a resource method builder
4149///
4150/// ```test_harness,no_run
4151/// # extern crate hyper;
4152/// # extern crate hyper_rustls;
4153/// # extern crate google_gkehub1 as gkehub1;
4154/// use gkehub1::api::Feature;
4155/// # async fn dox() {
4156/// # use std::default::Default;
4157/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4158///
4159/// # let secret: oauth2::ApplicationSecret = Default::default();
4160/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4161/// # secret,
4162/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4163/// # ).build().await.unwrap();
4164/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4165/// // As the method needs a request, you would usually fill it with the desired information
4166/// // into the respective structure. Some of the parts shown here might not be applicable !
4167/// // Values shown here are possibly random and not representative !
4168/// let mut req = Feature::default();
4169///
4170/// // You can configure optional parameters by calling the respective setters at will, and
4171/// // execute the final call using `doit()`.
4172/// // Values shown here are possibly random and not representative !
4173/// let result = hub.projects().locations_features_patch(req, "name")
4174/// .update_mask(&Default::default())
4175/// .request_id("sed")
4176/// .doit().await;
4177/// # }
4178/// ```
4179pub struct ProjectLocationFeaturePatchCall<'a, S>
4180 where S: 'a {
4181
4182 hub: &'a GKEHub<S>,
4183 _request: Feature,
4184 _name: String,
4185 _update_mask: Option<client::FieldMask>,
4186 _request_id: Option<String>,
4187 _delegate: Option<&'a mut dyn client::Delegate>,
4188 _additional_params: HashMap<String, String>,
4189 _scopes: BTreeSet<String>
4190}
4191
4192impl<'a, S> client::CallBuilder for ProjectLocationFeaturePatchCall<'a, S> {}
4193
4194impl<'a, S> ProjectLocationFeaturePatchCall<'a, S>
4195where
4196 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4197 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4198 S::Future: Send + Unpin + 'static,
4199 S::Error: Into<Box<dyn StdError + Send + Sync>>,
4200{
4201
4202
4203 /// Perform the operation you have build so far.
4204 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
4205 use std::io::{Read, Seek};
4206 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4207 use client::{ToParts, url::Params};
4208 use std::borrow::Cow;
4209
4210 let mut dd = client::DefaultDelegate;
4211 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4212 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.patch",
4213 http_method: hyper::Method::PATCH });
4214
4215 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
4216 if self._additional_params.contains_key(field) {
4217 dlg.finished(false);
4218 return Err(client::Error::FieldClash(field));
4219 }
4220 }
4221
4222 let mut params = Params::with_capacity(6 + self._additional_params.len());
4223 params.push("name", self._name);
4224 if let Some(value) = self._update_mask.as_ref() {
4225 params.push("updateMask", value.to_string());
4226 }
4227 if let Some(value) = self._request_id.as_ref() {
4228 params.push("requestId", value);
4229 }
4230
4231 params.extend(self._additional_params.iter());
4232
4233 params.push("alt", "json");
4234 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4235 if self._scopes.is_empty() {
4236 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
4237 }
4238
4239 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4240 url = params.uri_replacement(url, param_name, find_this, true);
4241 }
4242 {
4243 let to_remove = ["name"];
4244 params.remove_params(&to_remove);
4245 }
4246
4247 let url = params.parse_with_url(&url);
4248
4249 let mut json_mime_type = mime::APPLICATION_JSON;
4250 let mut request_value_reader =
4251 {
4252 let mut value = json::value::to_value(&self._request).expect("serde to work");
4253 client::remove_json_null_values(&mut value);
4254 let mut dst = io::Cursor::new(Vec::with_capacity(128));
4255 json::to_writer(&mut dst, &value).unwrap();
4256 dst
4257 };
4258 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4259 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4260
4261
4262 loop {
4263 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4264 Ok(token) => token,
4265 Err(e) => {
4266 match dlg.token(e) {
4267 Ok(token) => token,
4268 Err(e) => {
4269 dlg.finished(false);
4270 return Err(client::Error::MissingToken(e));
4271 }
4272 }
4273 }
4274 };
4275 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4276 let mut req_result = {
4277 let client = &self.hub.client;
4278 dlg.pre_request();
4279 let mut req_builder = hyper::Request::builder()
4280 .method(hyper::Method::PATCH)
4281 .uri(url.as_str())
4282 .header(USER_AGENT, self.hub._user_agent.clone());
4283
4284 if let Some(token) = token.as_ref() {
4285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4286 }
4287
4288
4289 let request = req_builder
4290 .header(CONTENT_TYPE, json_mime_type.to_string())
4291 .header(CONTENT_LENGTH, request_size as u64)
4292 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4293
4294 client.request(request.unwrap()).await
4295
4296 };
4297
4298 match req_result {
4299 Err(err) => {
4300 if let client::Retry::After(d) = dlg.http_error(&err) {
4301 sleep(d).await;
4302 continue;
4303 }
4304 dlg.finished(false);
4305 return Err(client::Error::HttpError(err))
4306 }
4307 Ok(mut res) => {
4308 if !res.status().is_success() {
4309 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4310 let (parts, _) = res.into_parts();
4311 let body = hyper::Body::from(res_body_string.clone());
4312 let restored_response = hyper::Response::from_parts(parts, body);
4313
4314 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4315
4316 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4317 sleep(d).await;
4318 continue;
4319 }
4320
4321 dlg.finished(false);
4322
4323 return match server_response {
4324 Some(error_value) => Err(client::Error::BadRequest(error_value)),
4325 None => Err(client::Error::Failure(restored_response)),
4326 }
4327 }
4328 let result_value = {
4329 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4330
4331 match json::from_str(&res_body_string) {
4332 Ok(decoded) => (res, decoded),
4333 Err(err) => {
4334 dlg.response_json_decode_error(&res_body_string, &err);
4335 return Err(client::Error::JsonDecodeError(res_body_string, err));
4336 }
4337 }
4338 };
4339
4340 dlg.finished(true);
4341 return Ok(result_value)
4342 }
4343 }
4344 }
4345 }
4346
4347
4348 ///
4349 /// Sets the *request* property to the given value.
4350 ///
4351 /// Even though the property as already been set when instantiating this call,
4352 /// we provide this method for API completeness.
4353 pub fn request(mut self, new_value: Feature) -> ProjectLocationFeaturePatchCall<'a, S> {
4354 self._request = new_value;
4355 self
4356 }
4357 /// Required. The Feature resource name in the format `projects/*/locations/*/features/*`.
4358 ///
4359 /// Sets the *name* path property to the given value.
4360 ///
4361 /// Even though the property as already been set when instantiating this call,
4362 /// we provide this method for API completeness.
4363 pub fn name(mut self, new_value: &str) -> ProjectLocationFeaturePatchCall<'a, S> {
4364 self._name = new_value.to_string();
4365 self
4366 }
4367 /// Mask of fields to update.
4368 ///
4369 /// Sets the *update mask* query property to the given value.
4370 pub fn update_mask(mut self, new_value: client::FieldMask) -> ProjectLocationFeaturePatchCall<'a, S> {
4371 self._update_mask = Some(new_value);
4372 self
4373 }
4374 /// A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4375 ///
4376 /// Sets the *request id* query property to the given value.
4377 pub fn request_id(mut self, new_value: &str) -> ProjectLocationFeaturePatchCall<'a, S> {
4378 self._request_id = Some(new_value.to_string());
4379 self
4380 }
4381 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4382 /// while executing the actual API request.
4383 ///
4384 /// ````text
4385 /// It should be used to handle progress information, and to implement a certain level of resilience.
4386 /// ````
4387 ///
4388 /// Sets the *delegate* property to the given value.
4389 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeaturePatchCall<'a, S> {
4390 self._delegate = Some(new_value);
4391 self
4392 }
4393
4394 /// Set any additional parameter of the query string used in the request.
4395 /// It should be used to set parameters which are not yet available through their own
4396 /// setters.
4397 ///
4398 /// Please note that this method must not be used to set any of the known parameters
4399 /// which have their own setter method. If done anyway, the request will fail.
4400 ///
4401 /// # Additional Parameters
4402 ///
4403 /// * *$.xgafv* (query-string) - V1 error format.
4404 /// * *access_token* (query-string) - OAuth access token.
4405 /// * *alt* (query-string) - Data format for response.
4406 /// * *callback* (query-string) - JSONP
4407 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4408 /// * *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.
4409 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4410 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4411 /// * *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.
4412 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4413 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4414 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeaturePatchCall<'a, S>
4415 where T: AsRef<str> {
4416 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4417 self
4418 }
4419
4420 /// Identifies the authorization scope for the method you are building.
4421 ///
4422 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4423 /// [`Scope::CloudPlatform`].
4424 ///
4425 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4426 /// tokens for more than one scope.
4427 ///
4428 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4429 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4430 /// sufficient, a read-write scope will do as well.
4431 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeaturePatchCall<'a, S>
4432 where St: AsRef<str> {
4433 self._scopes.insert(String::from(scope.as_ref()));
4434 self
4435 }
4436 /// Identifies the authorization scope(s) for the method you are building.
4437 ///
4438 /// See [`Self::add_scope()`] for details.
4439 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeaturePatchCall<'a, S>
4440 where I: IntoIterator<Item = St>,
4441 St: AsRef<str> {
4442 self._scopes
4443 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4444 self
4445 }
4446
4447 /// Removes all scopes, and no default scope will be used either.
4448 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4449 /// for details).
4450 pub fn clear_scopes(mut self) -> ProjectLocationFeaturePatchCall<'a, S> {
4451 self._scopes.clear();
4452 self
4453 }
4454}
4455
4456
4457/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4458///
4459/// A builder for the *locations.features.setIamPolicy* method supported by a *project* resource.
4460/// It is not used directly, but through a [`ProjectMethods`] instance.
4461///
4462/// # Example
4463///
4464/// Instantiate a resource method builder
4465///
4466/// ```test_harness,no_run
4467/// # extern crate hyper;
4468/// # extern crate hyper_rustls;
4469/// # extern crate google_gkehub1 as gkehub1;
4470/// use gkehub1::api::SetIamPolicyRequest;
4471/// # async fn dox() {
4472/// # use std::default::Default;
4473/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4474///
4475/// # let secret: oauth2::ApplicationSecret = Default::default();
4476/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4477/// # secret,
4478/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4479/// # ).build().await.unwrap();
4480/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4481/// // As the method needs a request, you would usually fill it with the desired information
4482/// // into the respective structure. Some of the parts shown here might not be applicable !
4483/// // Values shown here are possibly random and not representative !
4484/// let mut req = SetIamPolicyRequest::default();
4485///
4486/// // You can configure optional parameters by calling the respective setters at will, and
4487/// // execute the final call using `doit()`.
4488/// // Values shown here are possibly random and not representative !
4489/// let result = hub.projects().locations_features_set_iam_policy(req, "resource")
4490/// .doit().await;
4491/// # }
4492/// ```
4493pub struct ProjectLocationFeatureSetIamPolicyCall<'a, S>
4494 where S: 'a {
4495
4496 hub: &'a GKEHub<S>,
4497 _request: SetIamPolicyRequest,
4498 _resource: String,
4499 _delegate: Option<&'a mut dyn client::Delegate>,
4500 _additional_params: HashMap<String, String>,
4501 _scopes: BTreeSet<String>
4502}
4503
4504impl<'a, S> client::CallBuilder for ProjectLocationFeatureSetIamPolicyCall<'a, S> {}
4505
4506impl<'a, S> ProjectLocationFeatureSetIamPolicyCall<'a, S>
4507where
4508 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4509 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4510 S::Future: Send + Unpin + 'static,
4511 S::Error: Into<Box<dyn StdError + Send + Sync>>,
4512{
4513
4514
4515 /// Perform the operation you have build so far.
4516 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Policy)> {
4517 use std::io::{Read, Seek};
4518 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4519 use client::{ToParts, url::Params};
4520 use std::borrow::Cow;
4521
4522 let mut dd = client::DefaultDelegate;
4523 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4524 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.setIamPolicy",
4525 http_method: hyper::Method::POST });
4526
4527 for &field in ["alt", "resource"].iter() {
4528 if self._additional_params.contains_key(field) {
4529 dlg.finished(false);
4530 return Err(client::Error::FieldClash(field));
4531 }
4532 }
4533
4534 let mut params = Params::with_capacity(4 + self._additional_params.len());
4535 params.push("resource", self._resource);
4536
4537 params.extend(self._additional_params.iter());
4538
4539 params.push("alt", "json");
4540 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4541 if self._scopes.is_empty() {
4542 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
4543 }
4544
4545 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4546 url = params.uri_replacement(url, param_name, find_this, true);
4547 }
4548 {
4549 let to_remove = ["resource"];
4550 params.remove_params(&to_remove);
4551 }
4552
4553 let url = params.parse_with_url(&url);
4554
4555 let mut json_mime_type = mime::APPLICATION_JSON;
4556 let mut request_value_reader =
4557 {
4558 let mut value = json::value::to_value(&self._request).expect("serde to work");
4559 client::remove_json_null_values(&mut value);
4560 let mut dst = io::Cursor::new(Vec::with_capacity(128));
4561 json::to_writer(&mut dst, &value).unwrap();
4562 dst
4563 };
4564 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4565 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4566
4567
4568 loop {
4569 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4570 Ok(token) => token,
4571 Err(e) => {
4572 match dlg.token(e) {
4573 Ok(token) => token,
4574 Err(e) => {
4575 dlg.finished(false);
4576 return Err(client::Error::MissingToken(e));
4577 }
4578 }
4579 }
4580 };
4581 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4582 let mut req_result = {
4583 let client = &self.hub.client;
4584 dlg.pre_request();
4585 let mut req_builder = hyper::Request::builder()
4586 .method(hyper::Method::POST)
4587 .uri(url.as_str())
4588 .header(USER_AGENT, self.hub._user_agent.clone());
4589
4590 if let Some(token) = token.as_ref() {
4591 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4592 }
4593
4594
4595 let request = req_builder
4596 .header(CONTENT_TYPE, json_mime_type.to_string())
4597 .header(CONTENT_LENGTH, request_size as u64)
4598 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4599
4600 client.request(request.unwrap()).await
4601
4602 };
4603
4604 match req_result {
4605 Err(err) => {
4606 if let client::Retry::After(d) = dlg.http_error(&err) {
4607 sleep(d).await;
4608 continue;
4609 }
4610 dlg.finished(false);
4611 return Err(client::Error::HttpError(err))
4612 }
4613 Ok(mut res) => {
4614 if !res.status().is_success() {
4615 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4616 let (parts, _) = res.into_parts();
4617 let body = hyper::Body::from(res_body_string.clone());
4618 let restored_response = hyper::Response::from_parts(parts, body);
4619
4620 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4621
4622 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4623 sleep(d).await;
4624 continue;
4625 }
4626
4627 dlg.finished(false);
4628
4629 return match server_response {
4630 Some(error_value) => Err(client::Error::BadRequest(error_value)),
4631 None => Err(client::Error::Failure(restored_response)),
4632 }
4633 }
4634 let result_value = {
4635 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4636
4637 match json::from_str(&res_body_string) {
4638 Ok(decoded) => (res, decoded),
4639 Err(err) => {
4640 dlg.response_json_decode_error(&res_body_string, &err);
4641 return Err(client::Error::JsonDecodeError(res_body_string, err));
4642 }
4643 }
4644 };
4645
4646 dlg.finished(true);
4647 return Ok(result_value)
4648 }
4649 }
4650 }
4651 }
4652
4653
4654 ///
4655 /// Sets the *request* property to the given value.
4656 ///
4657 /// Even though the property as already been set when instantiating this call,
4658 /// we provide this method for API completeness.
4659 pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationFeatureSetIamPolicyCall<'a, S> {
4660 self._request = new_value;
4661 self
4662 }
4663 /// 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.
4664 ///
4665 /// Sets the *resource* path property to the given value.
4666 ///
4667 /// Even though the property as already been set when instantiating this call,
4668 /// we provide this method for API completeness.
4669 pub fn resource(mut self, new_value: &str) -> ProjectLocationFeatureSetIamPolicyCall<'a, S> {
4670 self._resource = new_value.to_string();
4671 self
4672 }
4673 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4674 /// while executing the actual API request.
4675 ///
4676 /// ````text
4677 /// It should be used to handle progress information, and to implement a certain level of resilience.
4678 /// ````
4679 ///
4680 /// Sets the *delegate* property to the given value.
4681 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureSetIamPolicyCall<'a, S> {
4682 self._delegate = Some(new_value);
4683 self
4684 }
4685
4686 /// Set any additional parameter of the query string used in the request.
4687 /// It should be used to set parameters which are not yet available through their own
4688 /// setters.
4689 ///
4690 /// Please note that this method must not be used to set any of the known parameters
4691 /// which have their own setter method. If done anyway, the request will fail.
4692 ///
4693 /// # Additional Parameters
4694 ///
4695 /// * *$.xgafv* (query-string) - V1 error format.
4696 /// * *access_token* (query-string) - OAuth access token.
4697 /// * *alt* (query-string) - Data format for response.
4698 /// * *callback* (query-string) - JSONP
4699 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4700 /// * *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.
4701 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4702 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4703 /// * *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.
4704 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4705 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4706 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureSetIamPolicyCall<'a, S>
4707 where T: AsRef<str> {
4708 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
4709 self
4710 }
4711
4712 /// Identifies the authorization scope for the method you are building.
4713 ///
4714 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4715 /// [`Scope::CloudPlatform`].
4716 ///
4717 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4718 /// tokens for more than one scope.
4719 ///
4720 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4721 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4722 /// sufficient, a read-write scope will do as well.
4723 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureSetIamPolicyCall<'a, S>
4724 where St: AsRef<str> {
4725 self._scopes.insert(String::from(scope.as_ref()));
4726 self
4727 }
4728 /// Identifies the authorization scope(s) for the method you are building.
4729 ///
4730 /// See [`Self::add_scope()`] for details.
4731 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureSetIamPolicyCall<'a, S>
4732 where I: IntoIterator<Item = St>,
4733 St: AsRef<str> {
4734 self._scopes
4735 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4736 self
4737 }
4738
4739 /// Removes all scopes, and no default scope will be used either.
4740 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4741 /// for details).
4742 pub fn clear_scopes(mut self) -> ProjectLocationFeatureSetIamPolicyCall<'a, S> {
4743 self._scopes.clear();
4744 self
4745 }
4746}
4747
4748
4749/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4750///
4751/// A builder for the *locations.features.testIamPermissions* method supported by a *project* resource.
4752/// It is not used directly, but through a [`ProjectMethods`] instance.
4753///
4754/// # Example
4755///
4756/// Instantiate a resource method builder
4757///
4758/// ```test_harness,no_run
4759/// # extern crate hyper;
4760/// # extern crate hyper_rustls;
4761/// # extern crate google_gkehub1 as gkehub1;
4762/// use gkehub1::api::TestIamPermissionsRequest;
4763/// # async fn dox() {
4764/// # use std::default::Default;
4765/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
4766///
4767/// # let secret: oauth2::ApplicationSecret = Default::default();
4768/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
4769/// # secret,
4770/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4771/// # ).build().await.unwrap();
4772/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
4773/// // As the method needs a request, you would usually fill it with the desired information
4774/// // into the respective structure. Some of the parts shown here might not be applicable !
4775/// // Values shown here are possibly random and not representative !
4776/// let mut req = TestIamPermissionsRequest::default();
4777///
4778/// // You can configure optional parameters by calling the respective setters at will, and
4779/// // execute the final call using `doit()`.
4780/// // Values shown here are possibly random and not representative !
4781/// let result = hub.projects().locations_features_test_iam_permissions(req, "resource")
4782/// .doit().await;
4783/// # }
4784/// ```
4785pub struct ProjectLocationFeatureTestIamPermissionCall<'a, S>
4786 where S: 'a {
4787
4788 hub: &'a GKEHub<S>,
4789 _request: TestIamPermissionsRequest,
4790 _resource: String,
4791 _delegate: Option<&'a mut dyn client::Delegate>,
4792 _additional_params: HashMap<String, String>,
4793 _scopes: BTreeSet<String>
4794}
4795
4796impl<'a, S> client::CallBuilder for ProjectLocationFeatureTestIamPermissionCall<'a, S> {}
4797
4798impl<'a, S> ProjectLocationFeatureTestIamPermissionCall<'a, S>
4799where
4800 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
4801 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
4802 S::Future: Send + Unpin + 'static,
4803 S::Error: Into<Box<dyn StdError + Send + Sync>>,
4804{
4805
4806
4807 /// Perform the operation you have build so far.
4808 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, TestIamPermissionsResponse)> {
4809 use std::io::{Read, Seek};
4810 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
4811 use client::{ToParts, url::Params};
4812 use std::borrow::Cow;
4813
4814 let mut dd = client::DefaultDelegate;
4815 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
4816 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.features.testIamPermissions",
4817 http_method: hyper::Method::POST });
4818
4819 for &field in ["alt", "resource"].iter() {
4820 if self._additional_params.contains_key(field) {
4821 dlg.finished(false);
4822 return Err(client::Error::FieldClash(field));
4823 }
4824 }
4825
4826 let mut params = Params::with_capacity(4 + self._additional_params.len());
4827 params.push("resource", self._resource);
4828
4829 params.extend(self._additional_params.iter());
4830
4831 params.push("alt", "json");
4832 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
4833 if self._scopes.is_empty() {
4834 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
4835 }
4836
4837 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4838 url = params.uri_replacement(url, param_name, find_this, true);
4839 }
4840 {
4841 let to_remove = ["resource"];
4842 params.remove_params(&to_remove);
4843 }
4844
4845 let url = params.parse_with_url(&url);
4846
4847 let mut json_mime_type = mime::APPLICATION_JSON;
4848 let mut request_value_reader =
4849 {
4850 let mut value = json::value::to_value(&self._request).expect("serde to work");
4851 client::remove_json_null_values(&mut value);
4852 let mut dst = io::Cursor::new(Vec::with_capacity(128));
4853 json::to_writer(&mut dst, &value).unwrap();
4854 dst
4855 };
4856 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
4857 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4858
4859
4860 loop {
4861 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
4862 Ok(token) => token,
4863 Err(e) => {
4864 match dlg.token(e) {
4865 Ok(token) => token,
4866 Err(e) => {
4867 dlg.finished(false);
4868 return Err(client::Error::MissingToken(e));
4869 }
4870 }
4871 }
4872 };
4873 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
4874 let mut req_result = {
4875 let client = &self.hub.client;
4876 dlg.pre_request();
4877 let mut req_builder = hyper::Request::builder()
4878 .method(hyper::Method::POST)
4879 .uri(url.as_str())
4880 .header(USER_AGENT, self.hub._user_agent.clone());
4881
4882 if let Some(token) = token.as_ref() {
4883 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4884 }
4885
4886
4887 let request = req_builder
4888 .header(CONTENT_TYPE, json_mime_type.to_string())
4889 .header(CONTENT_LENGTH, request_size as u64)
4890 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
4891
4892 client.request(request.unwrap()).await
4893
4894 };
4895
4896 match req_result {
4897 Err(err) => {
4898 if let client::Retry::After(d) = dlg.http_error(&err) {
4899 sleep(d).await;
4900 continue;
4901 }
4902 dlg.finished(false);
4903 return Err(client::Error::HttpError(err))
4904 }
4905 Ok(mut res) => {
4906 if !res.status().is_success() {
4907 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4908 let (parts, _) = res.into_parts();
4909 let body = hyper::Body::from(res_body_string.clone());
4910 let restored_response = hyper::Response::from_parts(parts, body);
4911
4912 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
4913
4914 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
4915 sleep(d).await;
4916 continue;
4917 }
4918
4919 dlg.finished(false);
4920
4921 return match server_response {
4922 Some(error_value) => Err(client::Error::BadRequest(error_value)),
4923 None => Err(client::Error::Failure(restored_response)),
4924 }
4925 }
4926 let result_value = {
4927 let res_body_string = client::get_body_as_string(res.body_mut()).await;
4928
4929 match json::from_str(&res_body_string) {
4930 Ok(decoded) => (res, decoded),
4931 Err(err) => {
4932 dlg.response_json_decode_error(&res_body_string, &err);
4933 return Err(client::Error::JsonDecodeError(res_body_string, err));
4934 }
4935 }
4936 };
4937
4938 dlg.finished(true);
4939 return Ok(result_value)
4940 }
4941 }
4942 }
4943 }
4944
4945
4946 ///
4947 /// Sets the *request* property to the given value.
4948 ///
4949 /// Even though the property as already been set when instantiating this call,
4950 /// we provide this method for API completeness.
4951 pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationFeatureTestIamPermissionCall<'a, S> {
4952 self._request = new_value;
4953 self
4954 }
4955 /// 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.
4956 ///
4957 /// Sets the *resource* path property to the given value.
4958 ///
4959 /// Even though the property as already been set when instantiating this call,
4960 /// we provide this method for API completeness.
4961 pub fn resource(mut self, new_value: &str) -> ProjectLocationFeatureTestIamPermissionCall<'a, S> {
4962 self._resource = new_value.to_string();
4963 self
4964 }
4965 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4966 /// while executing the actual API request.
4967 ///
4968 /// ````text
4969 /// It should be used to handle progress information, and to implement a certain level of resilience.
4970 /// ````
4971 ///
4972 /// Sets the *delegate* property to the given value.
4973 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationFeatureTestIamPermissionCall<'a, S> {
4974 self._delegate = Some(new_value);
4975 self
4976 }
4977
4978 /// Set any additional parameter of the query string used in the request.
4979 /// It should be used to set parameters which are not yet available through their own
4980 /// setters.
4981 ///
4982 /// Please note that this method must not be used to set any of the known parameters
4983 /// which have their own setter method. If done anyway, the request will fail.
4984 ///
4985 /// # Additional Parameters
4986 ///
4987 /// * *$.xgafv* (query-string) - V1 error format.
4988 /// * *access_token* (query-string) - OAuth access token.
4989 /// * *alt* (query-string) - Data format for response.
4990 /// * *callback* (query-string) - JSONP
4991 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4992 /// * *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.
4993 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4994 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4995 /// * *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.
4996 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4997 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4998 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFeatureTestIamPermissionCall<'a, S>
4999 where T: AsRef<str> {
5000 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5001 self
5002 }
5003
5004 /// Identifies the authorization scope for the method you are building.
5005 ///
5006 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5007 /// [`Scope::CloudPlatform`].
5008 ///
5009 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5010 /// tokens for more than one scope.
5011 ///
5012 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5013 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5014 /// sufficient, a read-write scope will do as well.
5015 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFeatureTestIamPermissionCall<'a, S>
5016 where St: AsRef<str> {
5017 self._scopes.insert(String::from(scope.as_ref()));
5018 self
5019 }
5020 /// Identifies the authorization scope(s) for the method you are building.
5021 ///
5022 /// See [`Self::add_scope()`] for details.
5023 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFeatureTestIamPermissionCall<'a, S>
5024 where I: IntoIterator<Item = St>,
5025 St: AsRef<str> {
5026 self._scopes
5027 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5028 self
5029 }
5030
5031 /// Removes all scopes, and no default scope will be used either.
5032 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5033 /// for details).
5034 pub fn clear_scopes(mut self) -> ProjectLocationFeatureTestIamPermissionCall<'a, S> {
5035 self._scopes.clear();
5036 self
5037 }
5038}
5039
5040
5041/// Creates a new Membership. **This is currently only supported for GKE clusters on Google Cloud**. To register other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.
5042///
5043/// A builder for the *locations.memberships.create* method supported by a *project* resource.
5044/// It is not used directly, but through a [`ProjectMethods`] instance.
5045///
5046/// # Example
5047///
5048/// Instantiate a resource method builder
5049///
5050/// ```test_harness,no_run
5051/// # extern crate hyper;
5052/// # extern crate hyper_rustls;
5053/// # extern crate google_gkehub1 as gkehub1;
5054/// use gkehub1::api::Membership;
5055/// # async fn dox() {
5056/// # use std::default::Default;
5057/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5058///
5059/// # let secret: oauth2::ApplicationSecret = Default::default();
5060/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5061/// # secret,
5062/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5063/// # ).build().await.unwrap();
5064/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5065/// // As the method needs a request, you would usually fill it with the desired information
5066/// // into the respective structure. Some of the parts shown here might not be applicable !
5067/// // Values shown here are possibly random and not representative !
5068/// let mut req = Membership::default();
5069///
5070/// // You can configure optional parameters by calling the respective setters at will, and
5071/// // execute the final call using `doit()`.
5072/// // Values shown here are possibly random and not representative !
5073/// let result = hub.projects().locations_memberships_create(req, "parent")
5074/// .request_id("est")
5075/// .membership_id("ipsum")
5076/// .doit().await;
5077/// # }
5078/// ```
5079pub struct ProjectLocationMembershipCreateCall<'a, S>
5080 where S: 'a {
5081
5082 hub: &'a GKEHub<S>,
5083 _request: Membership,
5084 _parent: String,
5085 _request_id: Option<String>,
5086 _membership_id: Option<String>,
5087 _delegate: Option<&'a mut dyn client::Delegate>,
5088 _additional_params: HashMap<String, String>,
5089 _scopes: BTreeSet<String>
5090}
5091
5092impl<'a, S> client::CallBuilder for ProjectLocationMembershipCreateCall<'a, S> {}
5093
5094impl<'a, S> ProjectLocationMembershipCreateCall<'a, S>
5095where
5096 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5097 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5098 S::Future: Send + Unpin + 'static,
5099 S::Error: Into<Box<dyn StdError + Send + Sync>>,
5100{
5101
5102
5103 /// Perform the operation you have build so far.
5104 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
5105 use std::io::{Read, Seek};
5106 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5107 use client::{ToParts, url::Params};
5108 use std::borrow::Cow;
5109
5110 let mut dd = client::DefaultDelegate;
5111 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5112 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.create",
5113 http_method: hyper::Method::POST });
5114
5115 for &field in ["alt", "parent", "requestId", "membershipId"].iter() {
5116 if self._additional_params.contains_key(field) {
5117 dlg.finished(false);
5118 return Err(client::Error::FieldClash(field));
5119 }
5120 }
5121
5122 let mut params = Params::with_capacity(6 + self._additional_params.len());
5123 params.push("parent", self._parent);
5124 if let Some(value) = self._request_id.as_ref() {
5125 params.push("requestId", value);
5126 }
5127 if let Some(value) = self._membership_id.as_ref() {
5128 params.push("membershipId", value);
5129 }
5130
5131 params.extend(self._additional_params.iter());
5132
5133 params.push("alt", "json");
5134 let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships";
5135 if self._scopes.is_empty() {
5136 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
5137 }
5138
5139 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5140 url = params.uri_replacement(url, param_name, find_this, true);
5141 }
5142 {
5143 let to_remove = ["parent"];
5144 params.remove_params(&to_remove);
5145 }
5146
5147 let url = params.parse_with_url(&url);
5148
5149 let mut json_mime_type = mime::APPLICATION_JSON;
5150 let mut request_value_reader =
5151 {
5152 let mut value = json::value::to_value(&self._request).expect("serde to work");
5153 client::remove_json_null_values(&mut value);
5154 let mut dst = io::Cursor::new(Vec::with_capacity(128));
5155 json::to_writer(&mut dst, &value).unwrap();
5156 dst
5157 };
5158 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
5159 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5160
5161
5162 loop {
5163 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5164 Ok(token) => token,
5165 Err(e) => {
5166 match dlg.token(e) {
5167 Ok(token) => token,
5168 Err(e) => {
5169 dlg.finished(false);
5170 return Err(client::Error::MissingToken(e));
5171 }
5172 }
5173 }
5174 };
5175 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
5176 let mut req_result = {
5177 let client = &self.hub.client;
5178 dlg.pre_request();
5179 let mut req_builder = hyper::Request::builder()
5180 .method(hyper::Method::POST)
5181 .uri(url.as_str())
5182 .header(USER_AGENT, self.hub._user_agent.clone());
5183
5184 if let Some(token) = token.as_ref() {
5185 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5186 }
5187
5188
5189 let request = req_builder
5190 .header(CONTENT_TYPE, json_mime_type.to_string())
5191 .header(CONTENT_LENGTH, request_size as u64)
5192 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
5193
5194 client.request(request.unwrap()).await
5195
5196 };
5197
5198 match req_result {
5199 Err(err) => {
5200 if let client::Retry::After(d) = dlg.http_error(&err) {
5201 sleep(d).await;
5202 continue;
5203 }
5204 dlg.finished(false);
5205 return Err(client::Error::HttpError(err))
5206 }
5207 Ok(mut res) => {
5208 if !res.status().is_success() {
5209 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5210 let (parts, _) = res.into_parts();
5211 let body = hyper::Body::from(res_body_string.clone());
5212 let restored_response = hyper::Response::from_parts(parts, body);
5213
5214 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5215
5216 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5217 sleep(d).await;
5218 continue;
5219 }
5220
5221 dlg.finished(false);
5222
5223 return match server_response {
5224 Some(error_value) => Err(client::Error::BadRequest(error_value)),
5225 None => Err(client::Error::Failure(restored_response)),
5226 }
5227 }
5228 let result_value = {
5229 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5230
5231 match json::from_str(&res_body_string) {
5232 Ok(decoded) => (res, decoded),
5233 Err(err) => {
5234 dlg.response_json_decode_error(&res_body_string, &err);
5235 return Err(client::Error::JsonDecodeError(res_body_string, err));
5236 }
5237 }
5238 };
5239
5240 dlg.finished(true);
5241 return Ok(result_value)
5242 }
5243 }
5244 }
5245 }
5246
5247
5248 ///
5249 /// Sets the *request* property to the given value.
5250 ///
5251 /// Even though the property as already been set when instantiating this call,
5252 /// we provide this method for API completeness.
5253 pub fn request(mut self, new_value: Membership) -> ProjectLocationMembershipCreateCall<'a, S> {
5254 self._request = new_value;
5255 self
5256 }
5257 /// Required. The parent (project and location) where the Memberships will be created. Specified in the format `projects/*/locations/*`.
5258 ///
5259 /// Sets the *parent* path property to the given value.
5260 ///
5261 /// Even though the property as already been set when instantiating this call,
5262 /// we provide this method for API completeness.
5263 pub fn parent(mut self, new_value: &str) -> ProjectLocationMembershipCreateCall<'a, S> {
5264 self._parent = new_value.to_string();
5265 self
5266 }
5267 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
5268 ///
5269 /// Sets the *request id* query property to the given value.
5270 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMembershipCreateCall<'a, S> {
5271 self._request_id = Some(new_value.to_string());
5272 self
5273 }
5274 /// Required. Client chosen ID for the membership. `membership_id` must be a valid RFC 1123 compliant DNS label: 1. At most 63 characters in length 2. It must consist of lower case alphanumeric characters or `-` 3. It must start and end with an alphanumeric character Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, with a maximum length of 63 characters.
5275 ///
5276 /// Sets the *membership id* query property to the given value.
5277 pub fn membership_id(mut self, new_value: &str) -> ProjectLocationMembershipCreateCall<'a, S> {
5278 self._membership_id = Some(new_value.to_string());
5279 self
5280 }
5281 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5282 /// while executing the actual API request.
5283 ///
5284 /// ````text
5285 /// It should be used to handle progress information, and to implement a certain level of resilience.
5286 /// ````
5287 ///
5288 /// Sets the *delegate* property to the given value.
5289 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipCreateCall<'a, S> {
5290 self._delegate = Some(new_value);
5291 self
5292 }
5293
5294 /// Set any additional parameter of the query string used in the request.
5295 /// It should be used to set parameters which are not yet available through their own
5296 /// setters.
5297 ///
5298 /// Please note that this method must not be used to set any of the known parameters
5299 /// which have their own setter method. If done anyway, the request will fail.
5300 ///
5301 /// # Additional Parameters
5302 ///
5303 /// * *$.xgafv* (query-string) - V1 error format.
5304 /// * *access_token* (query-string) - OAuth access token.
5305 /// * *alt* (query-string) - Data format for response.
5306 /// * *callback* (query-string) - JSONP
5307 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5308 /// * *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.
5309 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5310 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5311 /// * *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.
5312 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5313 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5314 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipCreateCall<'a, S>
5315 where T: AsRef<str> {
5316 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5317 self
5318 }
5319
5320 /// Identifies the authorization scope for the method you are building.
5321 ///
5322 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5323 /// [`Scope::CloudPlatform`].
5324 ///
5325 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5326 /// tokens for more than one scope.
5327 ///
5328 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5329 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5330 /// sufficient, a read-write scope will do as well.
5331 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipCreateCall<'a, S>
5332 where St: AsRef<str> {
5333 self._scopes.insert(String::from(scope.as_ref()));
5334 self
5335 }
5336 /// Identifies the authorization scope(s) for the method you are building.
5337 ///
5338 /// See [`Self::add_scope()`] for details.
5339 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipCreateCall<'a, S>
5340 where I: IntoIterator<Item = St>,
5341 St: AsRef<str> {
5342 self._scopes
5343 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5344 self
5345 }
5346
5347 /// Removes all scopes, and no default scope will be used either.
5348 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5349 /// for details).
5350 pub fn clear_scopes(mut self) -> ProjectLocationMembershipCreateCall<'a, S> {
5351 self._scopes.clear();
5352 self
5353 }
5354}
5355
5356
5357/// Removes a Membership. **This is currently only supported for GKE clusters on Google Cloud**. To unregister other clusters, follow the instructions at https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.
5358///
5359/// A builder for the *locations.memberships.delete* method supported by a *project* resource.
5360/// It is not used directly, but through a [`ProjectMethods`] instance.
5361///
5362/// # Example
5363///
5364/// Instantiate a resource method builder
5365///
5366/// ```test_harness,no_run
5367/// # extern crate hyper;
5368/// # extern crate hyper_rustls;
5369/// # extern crate google_gkehub1 as gkehub1;
5370/// # async fn dox() {
5371/// # use std::default::Default;
5372/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5373///
5374/// # let secret: oauth2::ApplicationSecret = Default::default();
5375/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5376/// # secret,
5377/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5378/// # ).build().await.unwrap();
5379/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5380/// // You can configure optional parameters by calling the respective setters at will, and
5381/// // execute the final call using `doit()`.
5382/// // Values shown here are possibly random and not representative !
5383/// let result = hub.projects().locations_memberships_delete("name")
5384/// .request_id("est")
5385/// .doit().await;
5386/// # }
5387/// ```
5388pub struct ProjectLocationMembershipDeleteCall<'a, S>
5389 where S: 'a {
5390
5391 hub: &'a GKEHub<S>,
5392 _name: String,
5393 _request_id: Option<String>,
5394 _delegate: Option<&'a mut dyn client::Delegate>,
5395 _additional_params: HashMap<String, String>,
5396 _scopes: BTreeSet<String>
5397}
5398
5399impl<'a, S> client::CallBuilder for ProjectLocationMembershipDeleteCall<'a, S> {}
5400
5401impl<'a, S> ProjectLocationMembershipDeleteCall<'a, S>
5402where
5403 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5404 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5405 S::Future: Send + Unpin + 'static,
5406 S::Error: Into<Box<dyn StdError + Send + Sync>>,
5407{
5408
5409
5410 /// Perform the operation you have build so far.
5411 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
5412 use std::io::{Read, Seek};
5413 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5414 use client::{ToParts, url::Params};
5415 use std::borrow::Cow;
5416
5417 let mut dd = client::DefaultDelegate;
5418 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5419 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.delete",
5420 http_method: hyper::Method::DELETE });
5421
5422 for &field in ["alt", "name", "requestId"].iter() {
5423 if self._additional_params.contains_key(field) {
5424 dlg.finished(false);
5425 return Err(client::Error::FieldClash(field));
5426 }
5427 }
5428
5429 let mut params = Params::with_capacity(4 + self._additional_params.len());
5430 params.push("name", self._name);
5431 if let Some(value) = self._request_id.as_ref() {
5432 params.push("requestId", value);
5433 }
5434
5435 params.extend(self._additional_params.iter());
5436
5437 params.push("alt", "json");
5438 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5439 if self._scopes.is_empty() {
5440 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
5441 }
5442
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
5454
5455 loop {
5456 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5457 Ok(token) => token,
5458 Err(e) => {
5459 match dlg.token(e) {
5460 Ok(token) => token,
5461 Err(e) => {
5462 dlg.finished(false);
5463 return Err(client::Error::MissingToken(e));
5464 }
5465 }
5466 }
5467 };
5468 let mut req_result = {
5469 let client = &self.hub.client;
5470 dlg.pre_request();
5471 let mut req_builder = hyper::Request::builder()
5472 .method(hyper::Method::DELETE)
5473 .uri(url.as_str())
5474 .header(USER_AGENT, self.hub._user_agent.clone());
5475
5476 if let Some(token) = token.as_ref() {
5477 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5478 }
5479
5480
5481 let request = req_builder
5482 .body(hyper::body::Body::empty());
5483
5484 client.request(request.unwrap()).await
5485
5486 };
5487
5488 match req_result {
5489 Err(err) => {
5490 if let client::Retry::After(d) = dlg.http_error(&err) {
5491 sleep(d).await;
5492 continue;
5493 }
5494 dlg.finished(false);
5495 return Err(client::Error::HttpError(err))
5496 }
5497 Ok(mut res) => {
5498 if !res.status().is_success() {
5499 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5500 let (parts, _) = res.into_parts();
5501 let body = hyper::Body::from(res_body_string.clone());
5502 let restored_response = hyper::Response::from_parts(parts, body);
5503
5504 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5505
5506 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5507 sleep(d).await;
5508 continue;
5509 }
5510
5511 dlg.finished(false);
5512
5513 return match server_response {
5514 Some(error_value) => Err(client::Error::BadRequest(error_value)),
5515 None => Err(client::Error::Failure(restored_response)),
5516 }
5517 }
5518 let result_value = {
5519 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5520
5521 match json::from_str(&res_body_string) {
5522 Ok(decoded) => (res, decoded),
5523 Err(err) => {
5524 dlg.response_json_decode_error(&res_body_string, &err);
5525 return Err(client::Error::JsonDecodeError(res_body_string, err));
5526 }
5527 }
5528 };
5529
5530 dlg.finished(true);
5531 return Ok(result_value)
5532 }
5533 }
5534 }
5535 }
5536
5537
5538 /// Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
5539 ///
5540 /// Sets the *name* path property to the given value.
5541 ///
5542 /// Even though the property as already been set when instantiating this call,
5543 /// we provide this method for API completeness.
5544 pub fn name(mut self, new_value: &str) -> ProjectLocationMembershipDeleteCall<'a, S> {
5545 self._name = new_value.to_string();
5546 self
5547 }
5548 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
5549 ///
5550 /// Sets the *request id* query property to the given value.
5551 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMembershipDeleteCall<'a, S> {
5552 self._request_id = Some(new_value.to_string());
5553 self
5554 }
5555 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5556 /// while executing the actual API request.
5557 ///
5558 /// ````text
5559 /// It should be used to handle progress information, and to implement a certain level of resilience.
5560 /// ````
5561 ///
5562 /// Sets the *delegate* property to the given value.
5563 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipDeleteCall<'a, S> {
5564 self._delegate = Some(new_value);
5565 self
5566 }
5567
5568 /// Set any additional parameter of the query string used in the request.
5569 /// It should be used to set parameters which are not yet available through their own
5570 /// setters.
5571 ///
5572 /// Please note that this method must not be used to set any of the known parameters
5573 /// which have their own setter method. If done anyway, the request will fail.
5574 ///
5575 /// # Additional Parameters
5576 ///
5577 /// * *$.xgafv* (query-string) - V1 error format.
5578 /// * *access_token* (query-string) - OAuth access token.
5579 /// * *alt* (query-string) - Data format for response.
5580 /// * *callback* (query-string) - JSONP
5581 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5582 /// * *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.
5583 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5584 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5585 /// * *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.
5586 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5587 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5588 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipDeleteCall<'a, S>
5589 where T: AsRef<str> {
5590 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5591 self
5592 }
5593
5594 /// Identifies the authorization scope for the method you are building.
5595 ///
5596 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5597 /// [`Scope::CloudPlatform`].
5598 ///
5599 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5600 /// tokens for more than one scope.
5601 ///
5602 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5603 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5604 /// sufficient, a read-write scope will do as well.
5605 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipDeleteCall<'a, S>
5606 where St: AsRef<str> {
5607 self._scopes.insert(String::from(scope.as_ref()));
5608 self
5609 }
5610 /// Identifies the authorization scope(s) for the method you are building.
5611 ///
5612 /// See [`Self::add_scope()`] for details.
5613 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipDeleteCall<'a, S>
5614 where I: IntoIterator<Item = St>,
5615 St: AsRef<str> {
5616 self._scopes
5617 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5618 self
5619 }
5620
5621 /// Removes all scopes, and no default scope will be used either.
5622 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5623 /// for details).
5624 pub fn clear_scopes(mut self) -> ProjectLocationMembershipDeleteCall<'a, S> {
5625 self._scopes.clear();
5626 self
5627 }
5628}
5629
5630
5631/// Generates the manifest for deployment of the GKE connect agent. **This method is used internally by Google-provided libraries.** Most clients should not need to call this method directly.
5632///
5633/// A builder for the *locations.memberships.generateConnectManifest* method supported by a *project* resource.
5634/// It is not used directly, but through a [`ProjectMethods`] instance.
5635///
5636/// # Example
5637///
5638/// Instantiate a resource method builder
5639///
5640/// ```test_harness,no_run
5641/// # extern crate hyper;
5642/// # extern crate hyper_rustls;
5643/// # extern crate google_gkehub1 as gkehub1;
5644/// # async fn dox() {
5645/// # use std::default::Default;
5646/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5647///
5648/// # let secret: oauth2::ApplicationSecret = Default::default();
5649/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5650/// # secret,
5651/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5652/// # ).build().await.unwrap();
5653/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5654/// // You can configure optional parameters by calling the respective setters at will, and
5655/// // execute the final call using `doit()`.
5656/// // Values shown here are possibly random and not representative !
5657/// let result = hub.projects().locations_memberships_generate_connect_manifest("name")
5658/// .version("ea")
5659/// .registry("dolor")
5660/// .proxy(vec![0, 1, 2, 3])
5661/// .namespace("Lorem")
5662/// .is_upgrade(false)
5663/// .image_pull_secret_content(vec![0, 1, 2, 3])
5664/// .doit().await;
5665/// # }
5666/// ```
5667pub struct ProjectLocationMembershipGenerateConnectManifestCall<'a, S>
5668 where S: 'a {
5669
5670 hub: &'a GKEHub<S>,
5671 _name: String,
5672 _version: Option<String>,
5673 _registry: Option<String>,
5674 _proxy: Option<Vec<u8>>,
5675 _namespace: Option<String>,
5676 _is_upgrade: Option<bool>,
5677 _image_pull_secret_content: Option<Vec<u8>>,
5678 _delegate: Option<&'a mut dyn client::Delegate>,
5679 _additional_params: HashMap<String, String>,
5680 _scopes: BTreeSet<String>
5681}
5682
5683impl<'a, S> client::CallBuilder for ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {}
5684
5685impl<'a, S> ProjectLocationMembershipGenerateConnectManifestCall<'a, S>
5686where
5687 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
5688 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
5689 S::Future: Send + Unpin + 'static,
5690 S::Error: Into<Box<dyn StdError + Send + Sync>>,
5691{
5692
5693
5694 /// Perform the operation you have build so far.
5695 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GenerateConnectManifestResponse)> {
5696 use std::io::{Read, Seek};
5697 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
5698 use client::{ToParts, url::Params};
5699 use std::borrow::Cow;
5700
5701 let mut dd = client::DefaultDelegate;
5702 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
5703 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.generateConnectManifest",
5704 http_method: hyper::Method::GET });
5705
5706 for &field in ["alt", "name", "version", "registry", "proxy", "namespace", "isUpgrade", "imagePullSecretContent"].iter() {
5707 if self._additional_params.contains_key(field) {
5708 dlg.finished(false);
5709 return Err(client::Error::FieldClash(field));
5710 }
5711 }
5712
5713 let mut params = Params::with_capacity(9 + self._additional_params.len());
5714 params.push("name", self._name);
5715 if let Some(value) = self._version.as_ref() {
5716 params.push("version", value);
5717 }
5718 if let Some(value) = self._registry.as_ref() {
5719 params.push("registry", value);
5720 }
5721 if let Some(value) = self._proxy.as_ref() {
5722 params.push("proxy", ::client::serde::urlsafe_base64::to_string(&value));
5723 }
5724 if let Some(value) = self._namespace.as_ref() {
5725 params.push("namespace", value);
5726 }
5727 if let Some(value) = self._is_upgrade.as_ref() {
5728 params.push("isUpgrade", value.to_string());
5729 }
5730 if let Some(value) = self._image_pull_secret_content.as_ref() {
5731 params.push("imagePullSecretContent", ::client::serde::urlsafe_base64::to_string(&value));
5732 }
5733
5734 params.extend(self._additional_params.iter());
5735
5736 params.push("alt", "json");
5737 let mut url = self.hub._base_url.clone() + "v1/{+name}:generateConnectManifest";
5738 if self._scopes.is_empty() {
5739 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
5740 }
5741
5742 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5743 url = params.uri_replacement(url, param_name, find_this, true);
5744 }
5745 {
5746 let to_remove = ["name"];
5747 params.remove_params(&to_remove);
5748 }
5749
5750 let url = params.parse_with_url(&url);
5751
5752
5753
5754 loop {
5755 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
5756 Ok(token) => token,
5757 Err(e) => {
5758 match dlg.token(e) {
5759 Ok(token) => token,
5760 Err(e) => {
5761 dlg.finished(false);
5762 return Err(client::Error::MissingToken(e));
5763 }
5764 }
5765 }
5766 };
5767 let mut req_result = {
5768 let client = &self.hub.client;
5769 dlg.pre_request();
5770 let mut req_builder = hyper::Request::builder()
5771 .method(hyper::Method::GET)
5772 .uri(url.as_str())
5773 .header(USER_AGENT, self.hub._user_agent.clone());
5774
5775 if let Some(token) = token.as_ref() {
5776 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5777 }
5778
5779
5780 let request = req_builder
5781 .body(hyper::body::Body::empty());
5782
5783 client.request(request.unwrap()).await
5784
5785 };
5786
5787 match req_result {
5788 Err(err) => {
5789 if let client::Retry::After(d) = dlg.http_error(&err) {
5790 sleep(d).await;
5791 continue;
5792 }
5793 dlg.finished(false);
5794 return Err(client::Error::HttpError(err))
5795 }
5796 Ok(mut res) => {
5797 if !res.status().is_success() {
5798 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5799 let (parts, _) = res.into_parts();
5800 let body = hyper::Body::from(res_body_string.clone());
5801 let restored_response = hyper::Response::from_parts(parts, body);
5802
5803 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
5804
5805 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
5806 sleep(d).await;
5807 continue;
5808 }
5809
5810 dlg.finished(false);
5811
5812 return match server_response {
5813 Some(error_value) => Err(client::Error::BadRequest(error_value)),
5814 None => Err(client::Error::Failure(restored_response)),
5815 }
5816 }
5817 let result_value = {
5818 let res_body_string = client::get_body_as_string(res.body_mut()).await;
5819
5820 match json::from_str(&res_body_string) {
5821 Ok(decoded) => (res, decoded),
5822 Err(err) => {
5823 dlg.response_json_decode_error(&res_body_string, &err);
5824 return Err(client::Error::JsonDecodeError(res_body_string, err));
5825 }
5826 }
5827 };
5828
5829 dlg.finished(true);
5830 return Ok(result_value)
5831 }
5832 }
5833 }
5834 }
5835
5836
5837 /// Required. The Membership resource name the Agent will associate with, in the format `projects/*/locations/*/memberships/*`.
5838 ///
5839 /// Sets the *name* path property to the given value.
5840 ///
5841 /// Even though the property as already been set when instantiating this call,
5842 /// we provide this method for API completeness.
5843 pub fn name(mut self, new_value: &str) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5844 self._name = new_value.to_string();
5845 self
5846 }
5847 /// Optional. The Connect agent version to use. Defaults to the most current version.
5848 ///
5849 /// Sets the *version* query property to the given value.
5850 pub fn version(mut self, new_value: &str) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5851 self._version = Some(new_value.to_string());
5852 self
5853 }
5854 /// Optional. The registry to fetch the connect agent image from. Defaults to gcr.io/gkeconnect.
5855 ///
5856 /// Sets the *registry* query property to the given value.
5857 pub fn registry(mut self, new_value: &str) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5858 self._registry = Some(new_value.to_string());
5859 self
5860 }
5861 /// Optional. URI of a proxy if connectivity from the agent to gkeconnect.googleapis.com requires the use of a proxy. Format must be in the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS protocol supported by the proxy. This will direct the connect agent's outbound traffic through a HTTP(S) proxy.
5862 ///
5863 /// Sets the *proxy* query property to the given value.
5864 pub fn proxy(mut self, new_value: Vec<u8>) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5865 self._proxy = Some(new_value);
5866 self
5867 }
5868 /// Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`. The Connect Agent is authorized automatically when run in the default namespace. Otherwise, explicit authorization must be granted with an additional IAM binding.
5869 ///
5870 /// Sets the *namespace* query property to the given value.
5871 pub fn namespace(mut self, new_value: &str) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5872 self._namespace = Some(new_value.to_string());
5873 self
5874 }
5875 /// Optional. If true, generate the resources for upgrade only. Some resources generated only for installation (e.g. secrets) will be excluded.
5876 ///
5877 /// Sets the *is upgrade* query property to the given value.
5878 pub fn is_upgrade(mut self, new_value: bool) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5879 self._is_upgrade = Some(new_value);
5880 self
5881 }
5882 /// Optional. The image pull secret content for the registry, if not public.
5883 ///
5884 /// Sets the *image pull secret content* query property to the given value.
5885 pub fn image_pull_secret_content(mut self, new_value: Vec<u8>) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5886 self._image_pull_secret_content = Some(new_value);
5887 self
5888 }
5889 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5890 /// while executing the actual API request.
5891 ///
5892 /// ````text
5893 /// It should be used to handle progress information, and to implement a certain level of resilience.
5894 /// ````
5895 ///
5896 /// Sets the *delegate* property to the given value.
5897 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5898 self._delegate = Some(new_value);
5899 self
5900 }
5901
5902 /// Set any additional parameter of the query string used in the request.
5903 /// It should be used to set parameters which are not yet available through their own
5904 /// setters.
5905 ///
5906 /// Please note that this method must not be used to set any of the known parameters
5907 /// which have their own setter method. If done anyway, the request will fail.
5908 ///
5909 /// # Additional Parameters
5910 ///
5911 /// * *$.xgafv* (query-string) - V1 error format.
5912 /// * *access_token* (query-string) - OAuth access token.
5913 /// * *alt* (query-string) - Data format for response.
5914 /// * *callback* (query-string) - JSONP
5915 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5916 /// * *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.
5917 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5918 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5919 /// * *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.
5920 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5921 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5922 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S>
5923 where T: AsRef<str> {
5924 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
5925 self
5926 }
5927
5928 /// Identifies the authorization scope for the method you are building.
5929 ///
5930 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5931 /// [`Scope::CloudPlatform`].
5932 ///
5933 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5934 /// tokens for more than one scope.
5935 ///
5936 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5937 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5938 /// sufficient, a read-write scope will do as well.
5939 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S>
5940 where St: AsRef<str> {
5941 self._scopes.insert(String::from(scope.as_ref()));
5942 self
5943 }
5944 /// Identifies the authorization scope(s) for the method you are building.
5945 ///
5946 /// See [`Self::add_scope()`] for details.
5947 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S>
5948 where I: IntoIterator<Item = St>,
5949 St: AsRef<str> {
5950 self._scopes
5951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5952 self
5953 }
5954
5955 /// Removes all scopes, and no default scope will be used either.
5956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5957 /// for details).
5958 pub fn clear_scopes(mut self) -> ProjectLocationMembershipGenerateConnectManifestCall<'a, S> {
5959 self._scopes.clear();
5960 self
5961 }
5962}
5963
5964
5965/// Gets the details of a Membership.
5966///
5967/// A builder for the *locations.memberships.get* method supported by a *project* resource.
5968/// It is not used directly, but through a [`ProjectMethods`] instance.
5969///
5970/// # Example
5971///
5972/// Instantiate a resource method builder
5973///
5974/// ```test_harness,no_run
5975/// # extern crate hyper;
5976/// # extern crate hyper_rustls;
5977/// # extern crate google_gkehub1 as gkehub1;
5978/// # async fn dox() {
5979/// # use std::default::Default;
5980/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
5981///
5982/// # let secret: oauth2::ApplicationSecret = Default::default();
5983/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
5984/// # secret,
5985/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5986/// # ).build().await.unwrap();
5987/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
5988/// // You can configure optional parameters by calling the respective setters at will, and
5989/// // execute the final call using `doit()`.
5990/// // Values shown here are possibly random and not representative !
5991/// let result = hub.projects().locations_memberships_get("name")
5992/// .doit().await;
5993/// # }
5994/// ```
5995pub struct ProjectLocationMembershipGetCall<'a, S>
5996 where S: 'a {
5997
5998 hub: &'a GKEHub<S>,
5999 _name: String,
6000 _delegate: Option<&'a mut dyn client::Delegate>,
6001 _additional_params: HashMap<String, String>,
6002 _scopes: BTreeSet<String>
6003}
6004
6005impl<'a, S> client::CallBuilder for ProjectLocationMembershipGetCall<'a, S> {}
6006
6007impl<'a, S> ProjectLocationMembershipGetCall<'a, S>
6008where
6009 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6010 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6011 S::Future: Send + Unpin + 'static,
6012 S::Error: Into<Box<dyn StdError + Send + Sync>>,
6013{
6014
6015
6016 /// Perform the operation you have build so far.
6017 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Membership)> {
6018 use std::io::{Read, Seek};
6019 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6020 use client::{ToParts, url::Params};
6021 use std::borrow::Cow;
6022
6023 let mut dd = client::DefaultDelegate;
6024 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6025 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.get",
6026 http_method: hyper::Method::GET });
6027
6028 for &field in ["alt", "name"].iter() {
6029 if self._additional_params.contains_key(field) {
6030 dlg.finished(false);
6031 return Err(client::Error::FieldClash(field));
6032 }
6033 }
6034
6035 let mut params = Params::with_capacity(3 + self._additional_params.len());
6036 params.push("name", self._name);
6037
6038 params.extend(self._additional_params.iter());
6039
6040 params.push("alt", "json");
6041 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6042 if self._scopes.is_empty() {
6043 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
6044 }
6045
6046 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6047 url = params.uri_replacement(url, param_name, find_this, true);
6048 }
6049 {
6050 let to_remove = ["name"];
6051 params.remove_params(&to_remove);
6052 }
6053
6054 let url = params.parse_with_url(&url);
6055
6056
6057
6058 loop {
6059 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6060 Ok(token) => token,
6061 Err(e) => {
6062 match dlg.token(e) {
6063 Ok(token) => token,
6064 Err(e) => {
6065 dlg.finished(false);
6066 return Err(client::Error::MissingToken(e));
6067 }
6068 }
6069 }
6070 };
6071 let mut req_result = {
6072 let client = &self.hub.client;
6073 dlg.pre_request();
6074 let mut req_builder = hyper::Request::builder()
6075 .method(hyper::Method::GET)
6076 .uri(url.as_str())
6077 .header(USER_AGENT, self.hub._user_agent.clone());
6078
6079 if let Some(token) = token.as_ref() {
6080 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6081 }
6082
6083
6084 let request = req_builder
6085 .body(hyper::body::Body::empty());
6086
6087 client.request(request.unwrap()).await
6088
6089 };
6090
6091 match req_result {
6092 Err(err) => {
6093 if let client::Retry::After(d) = dlg.http_error(&err) {
6094 sleep(d).await;
6095 continue;
6096 }
6097 dlg.finished(false);
6098 return Err(client::Error::HttpError(err))
6099 }
6100 Ok(mut res) => {
6101 if !res.status().is_success() {
6102 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6103 let (parts, _) = res.into_parts();
6104 let body = hyper::Body::from(res_body_string.clone());
6105 let restored_response = hyper::Response::from_parts(parts, body);
6106
6107 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6108
6109 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6110 sleep(d).await;
6111 continue;
6112 }
6113
6114 dlg.finished(false);
6115
6116 return match server_response {
6117 Some(error_value) => Err(client::Error::BadRequest(error_value)),
6118 None => Err(client::Error::Failure(restored_response)),
6119 }
6120 }
6121 let result_value = {
6122 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6123
6124 match json::from_str(&res_body_string) {
6125 Ok(decoded) => (res, decoded),
6126 Err(err) => {
6127 dlg.response_json_decode_error(&res_body_string, &err);
6128 return Err(client::Error::JsonDecodeError(res_body_string, err));
6129 }
6130 }
6131 };
6132
6133 dlg.finished(true);
6134 return Ok(result_value)
6135 }
6136 }
6137 }
6138 }
6139
6140
6141 /// Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
6142 ///
6143 /// Sets the *name* path property to the given value.
6144 ///
6145 /// Even though the property as already been set when instantiating this call,
6146 /// we provide this method for API completeness.
6147 pub fn name(mut self, new_value: &str) -> ProjectLocationMembershipGetCall<'a, S> {
6148 self._name = new_value.to_string();
6149 self
6150 }
6151 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6152 /// while executing the actual API request.
6153 ///
6154 /// ````text
6155 /// It should be used to handle progress information, and to implement a certain level of resilience.
6156 /// ````
6157 ///
6158 /// Sets the *delegate* property to the given value.
6159 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipGetCall<'a, S> {
6160 self._delegate = Some(new_value);
6161 self
6162 }
6163
6164 /// Set any additional parameter of the query string used in the request.
6165 /// It should be used to set parameters which are not yet available through their own
6166 /// setters.
6167 ///
6168 /// Please note that this method must not be used to set any of the known parameters
6169 /// which have their own setter method. If done anyway, the request will fail.
6170 ///
6171 /// # Additional Parameters
6172 ///
6173 /// * *$.xgafv* (query-string) - V1 error format.
6174 /// * *access_token* (query-string) - OAuth access token.
6175 /// * *alt* (query-string) - Data format for response.
6176 /// * *callback* (query-string) - JSONP
6177 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6178 /// * *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.
6179 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6180 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6181 /// * *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.
6182 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6183 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6184 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipGetCall<'a, S>
6185 where T: AsRef<str> {
6186 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6187 self
6188 }
6189
6190 /// Identifies the authorization scope for the method you are building.
6191 ///
6192 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6193 /// [`Scope::CloudPlatform`].
6194 ///
6195 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6196 /// tokens for more than one scope.
6197 ///
6198 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6199 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6200 /// sufficient, a read-write scope will do as well.
6201 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipGetCall<'a, S>
6202 where St: AsRef<str> {
6203 self._scopes.insert(String::from(scope.as_ref()));
6204 self
6205 }
6206 /// Identifies the authorization scope(s) for the method you are building.
6207 ///
6208 /// See [`Self::add_scope()`] for details.
6209 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipGetCall<'a, S>
6210 where I: IntoIterator<Item = St>,
6211 St: AsRef<str> {
6212 self._scopes
6213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6214 self
6215 }
6216
6217 /// Removes all scopes, and no default scope will be used either.
6218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6219 /// for details).
6220 pub fn clear_scopes(mut self) -> ProjectLocationMembershipGetCall<'a, S> {
6221 self._scopes.clear();
6222 self
6223 }
6224}
6225
6226
6227/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6228///
6229/// A builder for the *locations.memberships.getIamPolicy* method supported by a *project* resource.
6230/// It is not used directly, but through a [`ProjectMethods`] instance.
6231///
6232/// # Example
6233///
6234/// Instantiate a resource method builder
6235///
6236/// ```test_harness,no_run
6237/// # extern crate hyper;
6238/// # extern crate hyper_rustls;
6239/// # extern crate google_gkehub1 as gkehub1;
6240/// # async fn dox() {
6241/// # use std::default::Default;
6242/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6243///
6244/// # let secret: oauth2::ApplicationSecret = Default::default();
6245/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6246/// # secret,
6247/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6248/// # ).build().await.unwrap();
6249/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6250/// // You can configure optional parameters by calling the respective setters at will, and
6251/// // execute the final call using `doit()`.
6252/// // Values shown here are possibly random and not representative !
6253/// let result = hub.projects().locations_memberships_get_iam_policy("resource")
6254/// .options_requested_policy_version(-80)
6255/// .doit().await;
6256/// # }
6257/// ```
6258pub struct ProjectLocationMembershipGetIamPolicyCall<'a, S>
6259 where S: 'a {
6260
6261 hub: &'a GKEHub<S>,
6262 _resource: String,
6263 _options_requested_policy_version: Option<i32>,
6264 _delegate: Option<&'a mut dyn client::Delegate>,
6265 _additional_params: HashMap<String, String>,
6266 _scopes: BTreeSet<String>
6267}
6268
6269impl<'a, S> client::CallBuilder for ProjectLocationMembershipGetIamPolicyCall<'a, S> {}
6270
6271impl<'a, S> ProjectLocationMembershipGetIamPolicyCall<'a, S>
6272where
6273 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6274 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6275 S::Future: Send + Unpin + 'static,
6276 S::Error: Into<Box<dyn StdError + Send + Sync>>,
6277{
6278
6279
6280 /// Perform the operation you have build so far.
6281 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Policy)> {
6282 use std::io::{Read, Seek};
6283 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6284 use client::{ToParts, url::Params};
6285 use std::borrow::Cow;
6286
6287 let mut dd = client::DefaultDelegate;
6288 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6289 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.getIamPolicy",
6290 http_method: hyper::Method::GET });
6291
6292 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6293 if self._additional_params.contains_key(field) {
6294 dlg.finished(false);
6295 return Err(client::Error::FieldClash(field));
6296 }
6297 }
6298
6299 let mut params = Params::with_capacity(4 + self._additional_params.len());
6300 params.push("resource", self._resource);
6301 if let Some(value) = self._options_requested_policy_version.as_ref() {
6302 params.push("options.requestedPolicyVersion", value.to_string());
6303 }
6304
6305 params.extend(self._additional_params.iter());
6306
6307 params.push("alt", "json");
6308 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
6309 if self._scopes.is_empty() {
6310 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
6311 }
6312
6313 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6314 url = params.uri_replacement(url, param_name, find_this, true);
6315 }
6316 {
6317 let to_remove = ["resource"];
6318 params.remove_params(&to_remove);
6319 }
6320
6321 let url = params.parse_with_url(&url);
6322
6323
6324
6325 loop {
6326 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6327 Ok(token) => token,
6328 Err(e) => {
6329 match dlg.token(e) {
6330 Ok(token) => token,
6331 Err(e) => {
6332 dlg.finished(false);
6333 return Err(client::Error::MissingToken(e));
6334 }
6335 }
6336 }
6337 };
6338 let mut req_result = {
6339 let client = &self.hub.client;
6340 dlg.pre_request();
6341 let mut req_builder = hyper::Request::builder()
6342 .method(hyper::Method::GET)
6343 .uri(url.as_str())
6344 .header(USER_AGENT, self.hub._user_agent.clone());
6345
6346 if let Some(token) = token.as_ref() {
6347 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6348 }
6349
6350
6351 let request = req_builder
6352 .body(hyper::body::Body::empty());
6353
6354 client.request(request.unwrap()).await
6355
6356 };
6357
6358 match req_result {
6359 Err(err) => {
6360 if let client::Retry::After(d) = dlg.http_error(&err) {
6361 sleep(d).await;
6362 continue;
6363 }
6364 dlg.finished(false);
6365 return Err(client::Error::HttpError(err))
6366 }
6367 Ok(mut res) => {
6368 if !res.status().is_success() {
6369 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6370 let (parts, _) = res.into_parts();
6371 let body = hyper::Body::from(res_body_string.clone());
6372 let restored_response = hyper::Response::from_parts(parts, body);
6373
6374 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6375
6376 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6377 sleep(d).await;
6378 continue;
6379 }
6380
6381 dlg.finished(false);
6382
6383 return match server_response {
6384 Some(error_value) => Err(client::Error::BadRequest(error_value)),
6385 None => Err(client::Error::Failure(restored_response)),
6386 }
6387 }
6388 let result_value = {
6389 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6390
6391 match json::from_str(&res_body_string) {
6392 Ok(decoded) => (res, decoded),
6393 Err(err) => {
6394 dlg.response_json_decode_error(&res_body_string, &err);
6395 return Err(client::Error::JsonDecodeError(res_body_string, err));
6396 }
6397 }
6398 };
6399
6400 dlg.finished(true);
6401 return Ok(result_value)
6402 }
6403 }
6404 }
6405 }
6406
6407
6408 /// 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.
6409 ///
6410 /// Sets the *resource* path property to the given value.
6411 ///
6412 /// Even though the property as already been set when instantiating this call,
6413 /// we provide this method for API completeness.
6414 pub fn resource(mut self, new_value: &str) -> ProjectLocationMembershipGetIamPolicyCall<'a, S> {
6415 self._resource = new_value.to_string();
6416 self
6417 }
6418 /// 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).
6419 ///
6420 /// Sets the *options.requested policy version* query property to the given value.
6421 pub fn options_requested_policy_version(mut self, new_value: i32) -> ProjectLocationMembershipGetIamPolicyCall<'a, S> {
6422 self._options_requested_policy_version = Some(new_value);
6423 self
6424 }
6425 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6426 /// while executing the actual API request.
6427 ///
6428 /// ````text
6429 /// It should be used to handle progress information, and to implement a certain level of resilience.
6430 /// ````
6431 ///
6432 /// Sets the *delegate* property to the given value.
6433 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipGetIamPolicyCall<'a, S> {
6434 self._delegate = Some(new_value);
6435 self
6436 }
6437
6438 /// Set any additional parameter of the query string used in the request.
6439 /// It should be used to set parameters which are not yet available through their own
6440 /// setters.
6441 ///
6442 /// Please note that this method must not be used to set any of the known parameters
6443 /// which have their own setter method. If done anyway, the request will fail.
6444 ///
6445 /// # Additional Parameters
6446 ///
6447 /// * *$.xgafv* (query-string) - V1 error format.
6448 /// * *access_token* (query-string) - OAuth access token.
6449 /// * *alt* (query-string) - Data format for response.
6450 /// * *callback* (query-string) - JSONP
6451 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6452 /// * *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.
6453 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6454 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6455 /// * *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.
6456 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6457 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6458 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipGetIamPolicyCall<'a, S>
6459 where T: AsRef<str> {
6460 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6461 self
6462 }
6463
6464 /// Identifies the authorization scope for the method you are building.
6465 ///
6466 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6467 /// [`Scope::CloudPlatform`].
6468 ///
6469 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6470 /// tokens for more than one scope.
6471 ///
6472 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6473 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6474 /// sufficient, a read-write scope will do as well.
6475 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipGetIamPolicyCall<'a, S>
6476 where St: AsRef<str> {
6477 self._scopes.insert(String::from(scope.as_ref()));
6478 self
6479 }
6480 /// Identifies the authorization scope(s) for the method you are building.
6481 ///
6482 /// See [`Self::add_scope()`] for details.
6483 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipGetIamPolicyCall<'a, S>
6484 where I: IntoIterator<Item = St>,
6485 St: AsRef<str> {
6486 self._scopes
6487 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6488 self
6489 }
6490
6491 /// Removes all scopes, and no default scope will be used either.
6492 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6493 /// for details).
6494 pub fn clear_scopes(mut self) -> ProjectLocationMembershipGetIamPolicyCall<'a, S> {
6495 self._scopes.clear();
6496 self
6497 }
6498}
6499
6500
6501/// Lists Memberships in a given project and location.
6502///
6503/// A builder for the *locations.memberships.list* method supported by a *project* resource.
6504/// It is not used directly, but through a [`ProjectMethods`] instance.
6505///
6506/// # Example
6507///
6508/// Instantiate a resource method builder
6509///
6510/// ```test_harness,no_run
6511/// # extern crate hyper;
6512/// # extern crate hyper_rustls;
6513/// # extern crate google_gkehub1 as gkehub1;
6514/// # async fn dox() {
6515/// # use std::default::Default;
6516/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6517///
6518/// # let secret: oauth2::ApplicationSecret = Default::default();
6519/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6520/// # secret,
6521/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6522/// # ).build().await.unwrap();
6523/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6524/// // You can configure optional parameters by calling the respective setters at will, and
6525/// // execute the final call using `doit()`.
6526/// // Values shown here are possibly random and not representative !
6527/// let result = hub.projects().locations_memberships_list("parent")
6528/// .page_token("Stet")
6529/// .page_size(-13)
6530/// .order_by("et")
6531/// .filter("sed")
6532/// .doit().await;
6533/// # }
6534/// ```
6535pub struct ProjectLocationMembershipListCall<'a, S>
6536 where S: 'a {
6537
6538 hub: &'a GKEHub<S>,
6539 _parent: String,
6540 _page_token: Option<String>,
6541 _page_size: Option<i32>,
6542 _order_by: Option<String>,
6543 _filter: Option<String>,
6544 _delegate: Option<&'a mut dyn client::Delegate>,
6545 _additional_params: HashMap<String, String>,
6546 _scopes: BTreeSet<String>
6547}
6548
6549impl<'a, S> client::CallBuilder for ProjectLocationMembershipListCall<'a, S> {}
6550
6551impl<'a, S> ProjectLocationMembershipListCall<'a, S>
6552where
6553 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6554 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6555 S::Future: Send + Unpin + 'static,
6556 S::Error: Into<Box<dyn StdError + Send + Sync>>,
6557{
6558
6559
6560 /// Perform the operation you have build so far.
6561 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListMembershipsResponse)> {
6562 use std::io::{Read, Seek};
6563 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6564 use client::{ToParts, url::Params};
6565 use std::borrow::Cow;
6566
6567 let mut dd = client::DefaultDelegate;
6568 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6569 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.list",
6570 http_method: hyper::Method::GET });
6571
6572 for &field in ["alt", "parent", "pageToken", "pageSize", "orderBy", "filter"].iter() {
6573 if self._additional_params.contains_key(field) {
6574 dlg.finished(false);
6575 return Err(client::Error::FieldClash(field));
6576 }
6577 }
6578
6579 let mut params = Params::with_capacity(7 + self._additional_params.len());
6580 params.push("parent", self._parent);
6581 if let Some(value) = self._page_token.as_ref() {
6582 params.push("pageToken", value);
6583 }
6584 if let Some(value) = self._page_size.as_ref() {
6585 params.push("pageSize", value.to_string());
6586 }
6587 if let Some(value) = self._order_by.as_ref() {
6588 params.push("orderBy", value);
6589 }
6590 if let Some(value) = self._filter.as_ref() {
6591 params.push("filter", value);
6592 }
6593
6594 params.extend(self._additional_params.iter());
6595
6596 params.push("alt", "json");
6597 let mut url = self.hub._base_url.clone() + "v1/{+parent}/memberships";
6598 if self._scopes.is_empty() {
6599 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
6600 }
6601
6602 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6603 url = params.uri_replacement(url, param_name, find_this, true);
6604 }
6605 {
6606 let to_remove = ["parent"];
6607 params.remove_params(&to_remove);
6608 }
6609
6610 let url = params.parse_with_url(&url);
6611
6612
6613
6614 loop {
6615 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6616 Ok(token) => token,
6617 Err(e) => {
6618 match dlg.token(e) {
6619 Ok(token) => token,
6620 Err(e) => {
6621 dlg.finished(false);
6622 return Err(client::Error::MissingToken(e));
6623 }
6624 }
6625 }
6626 };
6627 let mut req_result = {
6628 let client = &self.hub.client;
6629 dlg.pre_request();
6630 let mut req_builder = hyper::Request::builder()
6631 .method(hyper::Method::GET)
6632 .uri(url.as_str())
6633 .header(USER_AGENT, self.hub._user_agent.clone());
6634
6635 if let Some(token) = token.as_ref() {
6636 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6637 }
6638
6639
6640 let request = req_builder
6641 .body(hyper::body::Body::empty());
6642
6643 client.request(request.unwrap()).await
6644
6645 };
6646
6647 match req_result {
6648 Err(err) => {
6649 if let client::Retry::After(d) = dlg.http_error(&err) {
6650 sleep(d).await;
6651 continue;
6652 }
6653 dlg.finished(false);
6654 return Err(client::Error::HttpError(err))
6655 }
6656 Ok(mut res) => {
6657 if !res.status().is_success() {
6658 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6659 let (parts, _) = res.into_parts();
6660 let body = hyper::Body::from(res_body_string.clone());
6661 let restored_response = hyper::Response::from_parts(parts, body);
6662
6663 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6664
6665 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6666 sleep(d).await;
6667 continue;
6668 }
6669
6670 dlg.finished(false);
6671
6672 return match server_response {
6673 Some(error_value) => Err(client::Error::BadRequest(error_value)),
6674 None => Err(client::Error::Failure(restored_response)),
6675 }
6676 }
6677 let result_value = {
6678 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6679
6680 match json::from_str(&res_body_string) {
6681 Ok(decoded) => (res, decoded),
6682 Err(err) => {
6683 dlg.response_json_decode_error(&res_body_string, &err);
6684 return Err(client::Error::JsonDecodeError(res_body_string, err));
6685 }
6686 }
6687 };
6688
6689 dlg.finished(true);
6690 return Ok(result_value)
6691 }
6692 }
6693 }
6694 }
6695
6696
6697 /// Required. The parent (project and location) where the Memberships will be listed. Specified in the format `projects/*/locations/*`.
6698 ///
6699 /// Sets the *parent* path property to the given value.
6700 ///
6701 /// Even though the property as already been set when instantiating this call,
6702 /// we provide this method for API completeness.
6703 pub fn parent(mut self, new_value: &str) -> ProjectLocationMembershipListCall<'a, S> {
6704 self._parent = new_value.to_string();
6705 self
6706 }
6707 /// Optional. Token returned by previous call to `ListMemberships` which specifies the position in the list from where to continue listing the resources.
6708 ///
6709 /// Sets the *page token* query property to the given value.
6710 pub fn page_token(mut self, new_value: &str) -> ProjectLocationMembershipListCall<'a, S> {
6711 self._page_token = Some(new_value.to_string());
6712 self
6713 }
6714 /// Optional. When requesting a 'page' of resources, `page_size` specifies number of resources to return. If unspecified or set to 0, all resources will be returned.
6715 ///
6716 /// Sets the *page size* query property to the given value.
6717 pub fn page_size(mut self, new_value: i32) -> ProjectLocationMembershipListCall<'a, S> {
6718 self._page_size = Some(new_value);
6719 self
6720 }
6721 /// Optional. One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
6722 ///
6723 /// Sets the *order by* query property to the given value.
6724 pub fn order_by(mut self, new_value: &str) -> ProjectLocationMembershipListCall<'a, S> {
6725 self._order_by = Some(new_value.to_string());
6726 self
6727 }
6728 /// Optional. Lists Memberships that match the filter expression, following the syntax outlined in https://google.aip.dev/160. Examples: - Name is `bar` in project `foo-proj` and location `global`: name = "projects/foo-proj/locations/global/membership/bar" - Memberships that have a label called `foo`: labels.foo:* - Memberships that have a label called `foo` whose value is `bar`: labels.foo = bar - Memberships in the CREATING state: state = CREATING
6729 ///
6730 /// Sets the *filter* query property to the given value.
6731 pub fn filter(mut self, new_value: &str) -> ProjectLocationMembershipListCall<'a, S> {
6732 self._filter = Some(new_value.to_string());
6733 self
6734 }
6735 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6736 /// while executing the actual API request.
6737 ///
6738 /// ````text
6739 /// It should be used to handle progress information, and to implement a certain level of resilience.
6740 /// ````
6741 ///
6742 /// Sets the *delegate* property to the given value.
6743 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipListCall<'a, S> {
6744 self._delegate = Some(new_value);
6745 self
6746 }
6747
6748 /// Set any additional parameter of the query string used in the request.
6749 /// It should be used to set parameters which are not yet available through their own
6750 /// setters.
6751 ///
6752 /// Please note that this method must not be used to set any of the known parameters
6753 /// which have their own setter method. If done anyway, the request will fail.
6754 ///
6755 /// # Additional Parameters
6756 ///
6757 /// * *$.xgafv* (query-string) - V1 error format.
6758 /// * *access_token* (query-string) - OAuth access token.
6759 /// * *alt* (query-string) - Data format for response.
6760 /// * *callback* (query-string) - JSONP
6761 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6762 /// * *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.
6763 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6764 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6765 /// * *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.
6766 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6767 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6768 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipListCall<'a, S>
6769 where T: AsRef<str> {
6770 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
6771 self
6772 }
6773
6774 /// Identifies the authorization scope for the method you are building.
6775 ///
6776 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6777 /// [`Scope::CloudPlatform`].
6778 ///
6779 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6780 /// tokens for more than one scope.
6781 ///
6782 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6783 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6784 /// sufficient, a read-write scope will do as well.
6785 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipListCall<'a, S>
6786 where St: AsRef<str> {
6787 self._scopes.insert(String::from(scope.as_ref()));
6788 self
6789 }
6790 /// Identifies the authorization scope(s) for the method you are building.
6791 ///
6792 /// See [`Self::add_scope()`] for details.
6793 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipListCall<'a, S>
6794 where I: IntoIterator<Item = St>,
6795 St: AsRef<str> {
6796 self._scopes
6797 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6798 self
6799 }
6800
6801 /// Removes all scopes, and no default scope will be used either.
6802 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6803 /// for details).
6804 pub fn clear_scopes(mut self) -> ProjectLocationMembershipListCall<'a, S> {
6805 self._scopes.clear();
6806 self
6807 }
6808}
6809
6810
6811/// Updates an existing Membership.
6812///
6813/// A builder for the *locations.memberships.patch* method supported by a *project* resource.
6814/// It is not used directly, but through a [`ProjectMethods`] instance.
6815///
6816/// # Example
6817///
6818/// Instantiate a resource method builder
6819///
6820/// ```test_harness,no_run
6821/// # extern crate hyper;
6822/// # extern crate hyper_rustls;
6823/// # extern crate google_gkehub1 as gkehub1;
6824/// use gkehub1::api::Membership;
6825/// # async fn dox() {
6826/// # use std::default::Default;
6827/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
6828///
6829/// # let secret: oauth2::ApplicationSecret = Default::default();
6830/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
6831/// # secret,
6832/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6833/// # ).build().await.unwrap();
6834/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
6835/// // As the method needs a request, you would usually fill it with the desired information
6836/// // into the respective structure. Some of the parts shown here might not be applicable !
6837/// // Values shown here are possibly random and not representative !
6838/// let mut req = Membership::default();
6839///
6840/// // You can configure optional parameters by calling the respective setters at will, and
6841/// // execute the final call using `doit()`.
6842/// // Values shown here are possibly random and not representative !
6843/// let result = hub.projects().locations_memberships_patch(req, "name")
6844/// .update_mask(&Default::default())
6845/// .request_id("et")
6846/// .doit().await;
6847/// # }
6848/// ```
6849pub struct ProjectLocationMembershipPatchCall<'a, S>
6850 where S: 'a {
6851
6852 hub: &'a GKEHub<S>,
6853 _request: Membership,
6854 _name: String,
6855 _update_mask: Option<client::FieldMask>,
6856 _request_id: Option<String>,
6857 _delegate: Option<&'a mut dyn client::Delegate>,
6858 _additional_params: HashMap<String, String>,
6859 _scopes: BTreeSet<String>
6860}
6861
6862impl<'a, S> client::CallBuilder for ProjectLocationMembershipPatchCall<'a, S> {}
6863
6864impl<'a, S> ProjectLocationMembershipPatchCall<'a, S>
6865where
6866 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
6867 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
6868 S::Future: Send + Unpin + 'static,
6869 S::Error: Into<Box<dyn StdError + Send + Sync>>,
6870{
6871
6872
6873 /// Perform the operation you have build so far.
6874 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
6875 use std::io::{Read, Seek};
6876 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
6877 use client::{ToParts, url::Params};
6878 use std::borrow::Cow;
6879
6880 let mut dd = client::DefaultDelegate;
6881 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
6882 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.patch",
6883 http_method: hyper::Method::PATCH });
6884
6885 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
6886 if self._additional_params.contains_key(field) {
6887 dlg.finished(false);
6888 return Err(client::Error::FieldClash(field));
6889 }
6890 }
6891
6892 let mut params = Params::with_capacity(6 + self._additional_params.len());
6893 params.push("name", self._name);
6894 if let Some(value) = self._update_mask.as_ref() {
6895 params.push("updateMask", value.to_string());
6896 }
6897 if let Some(value) = self._request_id.as_ref() {
6898 params.push("requestId", value);
6899 }
6900
6901 params.extend(self._additional_params.iter());
6902
6903 params.push("alt", "json");
6904 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6905 if self._scopes.is_empty() {
6906 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
6907 }
6908
6909 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6910 url = params.uri_replacement(url, param_name, find_this, true);
6911 }
6912 {
6913 let to_remove = ["name"];
6914 params.remove_params(&to_remove);
6915 }
6916
6917 let url = params.parse_with_url(&url);
6918
6919 let mut json_mime_type = mime::APPLICATION_JSON;
6920 let mut request_value_reader =
6921 {
6922 let mut value = json::value::to_value(&self._request).expect("serde to work");
6923 client::remove_json_null_values(&mut value);
6924 let mut dst = io::Cursor::new(Vec::with_capacity(128));
6925 json::to_writer(&mut dst, &value).unwrap();
6926 dst
6927 };
6928 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
6929 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
6930
6931
6932 loop {
6933 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
6934 Ok(token) => token,
6935 Err(e) => {
6936 match dlg.token(e) {
6937 Ok(token) => token,
6938 Err(e) => {
6939 dlg.finished(false);
6940 return Err(client::Error::MissingToken(e));
6941 }
6942 }
6943 }
6944 };
6945 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
6946 let mut req_result = {
6947 let client = &self.hub.client;
6948 dlg.pre_request();
6949 let mut req_builder = hyper::Request::builder()
6950 .method(hyper::Method::PATCH)
6951 .uri(url.as_str())
6952 .header(USER_AGENT, self.hub._user_agent.clone());
6953
6954 if let Some(token) = token.as_ref() {
6955 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6956 }
6957
6958
6959 let request = req_builder
6960 .header(CONTENT_TYPE, json_mime_type.to_string())
6961 .header(CONTENT_LENGTH, request_size as u64)
6962 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
6963
6964 client.request(request.unwrap()).await
6965
6966 };
6967
6968 match req_result {
6969 Err(err) => {
6970 if let client::Retry::After(d) = dlg.http_error(&err) {
6971 sleep(d).await;
6972 continue;
6973 }
6974 dlg.finished(false);
6975 return Err(client::Error::HttpError(err))
6976 }
6977 Ok(mut res) => {
6978 if !res.status().is_success() {
6979 let res_body_string = client::get_body_as_string(res.body_mut()).await;
6980 let (parts, _) = res.into_parts();
6981 let body = hyper::Body::from(res_body_string.clone());
6982 let restored_response = hyper::Response::from_parts(parts, body);
6983
6984 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
6985
6986 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
6987 sleep(d).await;
6988 continue;
6989 }
6990
6991 dlg.finished(false);
6992
6993 return match server_response {
6994 Some(error_value) => Err(client::Error::BadRequest(error_value)),
6995 None => Err(client::Error::Failure(restored_response)),
6996 }
6997 }
6998 let result_value = {
6999 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7000
7001 match json::from_str(&res_body_string) {
7002 Ok(decoded) => (res, decoded),
7003 Err(err) => {
7004 dlg.response_json_decode_error(&res_body_string, &err);
7005 return Err(client::Error::JsonDecodeError(res_body_string, err));
7006 }
7007 }
7008 };
7009
7010 dlg.finished(true);
7011 return Ok(result_value)
7012 }
7013 }
7014 }
7015 }
7016
7017
7018 ///
7019 /// Sets the *request* property to the given value.
7020 ///
7021 /// Even though the property as already been set when instantiating this call,
7022 /// we provide this method for API completeness.
7023 pub fn request(mut self, new_value: Membership) -> ProjectLocationMembershipPatchCall<'a, S> {
7024 self._request = new_value;
7025 self
7026 }
7027 /// Required. The Membership resource name in the format `projects/*/locations/*/memberships/*`.
7028 ///
7029 /// Sets the *name* path property to the given value.
7030 ///
7031 /// Even though the property as already been set when instantiating this call,
7032 /// we provide this method for API completeness.
7033 pub fn name(mut self, new_value: &str) -> ProjectLocationMembershipPatchCall<'a, S> {
7034 self._name = new_value.to_string();
7035 self
7036 }
7037 /// Required. Mask of fields to update.
7038 ///
7039 /// Sets the *update mask* query property to the given value.
7040 pub fn update_mask(mut self, new_value: client::FieldMask) -> ProjectLocationMembershipPatchCall<'a, S> {
7041 self._update_mask = Some(new_value);
7042 self
7043 }
7044 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
7045 ///
7046 /// Sets the *request id* query property to the given value.
7047 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMembershipPatchCall<'a, S> {
7048 self._request_id = Some(new_value.to_string());
7049 self
7050 }
7051 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7052 /// while executing the actual API request.
7053 ///
7054 /// ````text
7055 /// It should be used to handle progress information, and to implement a certain level of resilience.
7056 /// ````
7057 ///
7058 /// Sets the *delegate* property to the given value.
7059 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipPatchCall<'a, S> {
7060 self._delegate = Some(new_value);
7061 self
7062 }
7063
7064 /// Set any additional parameter of the query string used in the request.
7065 /// It should be used to set parameters which are not yet available through their own
7066 /// setters.
7067 ///
7068 /// Please note that this method must not be used to set any of the known parameters
7069 /// which have their own setter method. If done anyway, the request will fail.
7070 ///
7071 /// # Additional Parameters
7072 ///
7073 /// * *$.xgafv* (query-string) - V1 error format.
7074 /// * *access_token* (query-string) - OAuth access token.
7075 /// * *alt* (query-string) - Data format for response.
7076 /// * *callback* (query-string) - JSONP
7077 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7078 /// * *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.
7079 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7080 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7081 /// * *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.
7082 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7083 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7084 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipPatchCall<'a, S>
7085 where T: AsRef<str> {
7086 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7087 self
7088 }
7089
7090 /// Identifies the authorization scope for the method you are building.
7091 ///
7092 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7093 /// [`Scope::CloudPlatform`].
7094 ///
7095 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7096 /// tokens for more than one scope.
7097 ///
7098 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7099 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7100 /// sufficient, a read-write scope will do as well.
7101 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipPatchCall<'a, S>
7102 where St: AsRef<str> {
7103 self._scopes.insert(String::from(scope.as_ref()));
7104 self
7105 }
7106 /// Identifies the authorization scope(s) for the method you are building.
7107 ///
7108 /// See [`Self::add_scope()`] for details.
7109 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipPatchCall<'a, S>
7110 where I: IntoIterator<Item = St>,
7111 St: AsRef<str> {
7112 self._scopes
7113 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7114 self
7115 }
7116
7117 /// Removes all scopes, and no default scope will be used either.
7118 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7119 /// for details).
7120 pub fn clear_scopes(mut self) -> ProjectLocationMembershipPatchCall<'a, S> {
7121 self._scopes.clear();
7122 self
7123 }
7124}
7125
7126
7127/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7128///
7129/// A builder for the *locations.memberships.setIamPolicy* method supported by a *project* resource.
7130/// It is not used directly, but through a [`ProjectMethods`] instance.
7131///
7132/// # Example
7133///
7134/// Instantiate a resource method builder
7135///
7136/// ```test_harness,no_run
7137/// # extern crate hyper;
7138/// # extern crate hyper_rustls;
7139/// # extern crate google_gkehub1 as gkehub1;
7140/// use gkehub1::api::SetIamPolicyRequest;
7141/// # async fn dox() {
7142/// # use std::default::Default;
7143/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7144///
7145/// # let secret: oauth2::ApplicationSecret = Default::default();
7146/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7147/// # secret,
7148/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7149/// # ).build().await.unwrap();
7150/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7151/// // As the method needs a request, you would usually fill it with the desired information
7152/// // into the respective structure. Some of the parts shown here might not be applicable !
7153/// // Values shown here are possibly random and not representative !
7154/// let mut req = SetIamPolicyRequest::default();
7155///
7156/// // You can configure optional parameters by calling the respective setters at will, and
7157/// // execute the final call using `doit()`.
7158/// // Values shown here are possibly random and not representative !
7159/// let result = hub.projects().locations_memberships_set_iam_policy(req, "resource")
7160/// .doit().await;
7161/// # }
7162/// ```
7163pub struct ProjectLocationMembershipSetIamPolicyCall<'a, S>
7164 where S: 'a {
7165
7166 hub: &'a GKEHub<S>,
7167 _request: SetIamPolicyRequest,
7168 _resource: String,
7169 _delegate: Option<&'a mut dyn client::Delegate>,
7170 _additional_params: HashMap<String, String>,
7171 _scopes: BTreeSet<String>
7172}
7173
7174impl<'a, S> client::CallBuilder for ProjectLocationMembershipSetIamPolicyCall<'a, S> {}
7175
7176impl<'a, S> ProjectLocationMembershipSetIamPolicyCall<'a, S>
7177where
7178 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7179 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7180 S::Future: Send + Unpin + 'static,
7181 S::Error: Into<Box<dyn StdError + Send + Sync>>,
7182{
7183
7184
7185 /// Perform the operation you have build so far.
7186 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Policy)> {
7187 use std::io::{Read, Seek};
7188 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7189 use client::{ToParts, url::Params};
7190 use std::borrow::Cow;
7191
7192 let mut dd = client::DefaultDelegate;
7193 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7194 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.setIamPolicy",
7195 http_method: hyper::Method::POST });
7196
7197 for &field in ["alt", "resource"].iter() {
7198 if self._additional_params.contains_key(field) {
7199 dlg.finished(false);
7200 return Err(client::Error::FieldClash(field));
7201 }
7202 }
7203
7204 let mut params = Params::with_capacity(4 + self._additional_params.len());
7205 params.push("resource", self._resource);
7206
7207 params.extend(self._additional_params.iter());
7208
7209 params.push("alt", "json");
7210 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
7211 if self._scopes.is_empty() {
7212 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
7213 }
7214
7215 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7216 url = params.uri_replacement(url, param_name, find_this, true);
7217 }
7218 {
7219 let to_remove = ["resource"];
7220 params.remove_params(&to_remove);
7221 }
7222
7223 let url = params.parse_with_url(&url);
7224
7225 let mut json_mime_type = mime::APPLICATION_JSON;
7226 let mut request_value_reader =
7227 {
7228 let mut value = json::value::to_value(&self._request).expect("serde to work");
7229 client::remove_json_null_values(&mut value);
7230 let mut dst = io::Cursor::new(Vec::with_capacity(128));
7231 json::to_writer(&mut dst, &value).unwrap();
7232 dst
7233 };
7234 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
7235 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7236
7237
7238 loop {
7239 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7240 Ok(token) => token,
7241 Err(e) => {
7242 match dlg.token(e) {
7243 Ok(token) => token,
7244 Err(e) => {
7245 dlg.finished(false);
7246 return Err(client::Error::MissingToken(e));
7247 }
7248 }
7249 }
7250 };
7251 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7252 let mut req_result = {
7253 let client = &self.hub.client;
7254 dlg.pre_request();
7255 let mut req_builder = hyper::Request::builder()
7256 .method(hyper::Method::POST)
7257 .uri(url.as_str())
7258 .header(USER_AGENT, self.hub._user_agent.clone());
7259
7260 if let Some(token) = token.as_ref() {
7261 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7262 }
7263
7264
7265 let request = req_builder
7266 .header(CONTENT_TYPE, json_mime_type.to_string())
7267 .header(CONTENT_LENGTH, request_size as u64)
7268 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
7269
7270 client.request(request.unwrap()).await
7271
7272 };
7273
7274 match req_result {
7275 Err(err) => {
7276 if let client::Retry::After(d) = dlg.http_error(&err) {
7277 sleep(d).await;
7278 continue;
7279 }
7280 dlg.finished(false);
7281 return Err(client::Error::HttpError(err))
7282 }
7283 Ok(mut res) => {
7284 if !res.status().is_success() {
7285 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7286 let (parts, _) = res.into_parts();
7287 let body = hyper::Body::from(res_body_string.clone());
7288 let restored_response = hyper::Response::from_parts(parts, body);
7289
7290 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7291
7292 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7293 sleep(d).await;
7294 continue;
7295 }
7296
7297 dlg.finished(false);
7298
7299 return match server_response {
7300 Some(error_value) => Err(client::Error::BadRequest(error_value)),
7301 None => Err(client::Error::Failure(restored_response)),
7302 }
7303 }
7304 let result_value = {
7305 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7306
7307 match json::from_str(&res_body_string) {
7308 Ok(decoded) => (res, decoded),
7309 Err(err) => {
7310 dlg.response_json_decode_error(&res_body_string, &err);
7311 return Err(client::Error::JsonDecodeError(res_body_string, err));
7312 }
7313 }
7314 };
7315
7316 dlg.finished(true);
7317 return Ok(result_value)
7318 }
7319 }
7320 }
7321 }
7322
7323
7324 ///
7325 /// Sets the *request* property to the given value.
7326 ///
7327 /// Even though the property as already been set when instantiating this call,
7328 /// we provide this method for API completeness.
7329 pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectLocationMembershipSetIamPolicyCall<'a, S> {
7330 self._request = new_value;
7331 self
7332 }
7333 /// 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.
7334 ///
7335 /// Sets the *resource* path property to the given value.
7336 ///
7337 /// Even though the property as already been set when instantiating this call,
7338 /// we provide this method for API completeness.
7339 pub fn resource(mut self, new_value: &str) -> ProjectLocationMembershipSetIamPolicyCall<'a, S> {
7340 self._resource = new_value.to_string();
7341 self
7342 }
7343 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7344 /// while executing the actual API request.
7345 ///
7346 /// ````text
7347 /// It should be used to handle progress information, and to implement a certain level of resilience.
7348 /// ````
7349 ///
7350 /// Sets the *delegate* property to the given value.
7351 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipSetIamPolicyCall<'a, S> {
7352 self._delegate = Some(new_value);
7353 self
7354 }
7355
7356 /// Set any additional parameter of the query string used in the request.
7357 /// It should be used to set parameters which are not yet available through their own
7358 /// setters.
7359 ///
7360 /// Please note that this method must not be used to set any of the known parameters
7361 /// which have their own setter method. If done anyway, the request will fail.
7362 ///
7363 /// # Additional Parameters
7364 ///
7365 /// * *$.xgafv* (query-string) - V1 error format.
7366 /// * *access_token* (query-string) - OAuth access token.
7367 /// * *alt* (query-string) - Data format for response.
7368 /// * *callback* (query-string) - JSONP
7369 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7370 /// * *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.
7371 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7372 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7373 /// * *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.
7374 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7375 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7376 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipSetIamPolicyCall<'a, S>
7377 where T: AsRef<str> {
7378 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7379 self
7380 }
7381
7382 /// Identifies the authorization scope for the method you are building.
7383 ///
7384 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7385 /// [`Scope::CloudPlatform`].
7386 ///
7387 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7388 /// tokens for more than one scope.
7389 ///
7390 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7391 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7392 /// sufficient, a read-write scope will do as well.
7393 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipSetIamPolicyCall<'a, S>
7394 where St: AsRef<str> {
7395 self._scopes.insert(String::from(scope.as_ref()));
7396 self
7397 }
7398 /// Identifies the authorization scope(s) for the method you are building.
7399 ///
7400 /// See [`Self::add_scope()`] for details.
7401 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipSetIamPolicyCall<'a, S>
7402 where I: IntoIterator<Item = St>,
7403 St: AsRef<str> {
7404 self._scopes
7405 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7406 self
7407 }
7408
7409 /// Removes all scopes, and no default scope will be used either.
7410 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7411 /// for details).
7412 pub fn clear_scopes(mut self) -> ProjectLocationMembershipSetIamPolicyCall<'a, S> {
7413 self._scopes.clear();
7414 self
7415 }
7416}
7417
7418
7419/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7420///
7421/// A builder for the *locations.memberships.testIamPermissions* method supported by a *project* resource.
7422/// It is not used directly, but through a [`ProjectMethods`] instance.
7423///
7424/// # Example
7425///
7426/// Instantiate a resource method builder
7427///
7428/// ```test_harness,no_run
7429/// # extern crate hyper;
7430/// # extern crate hyper_rustls;
7431/// # extern crate google_gkehub1 as gkehub1;
7432/// use gkehub1::api::TestIamPermissionsRequest;
7433/// # async fn dox() {
7434/// # use std::default::Default;
7435/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7436///
7437/// # let secret: oauth2::ApplicationSecret = Default::default();
7438/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7439/// # secret,
7440/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7441/// # ).build().await.unwrap();
7442/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7443/// // As the method needs a request, you would usually fill it with the desired information
7444/// // into the respective structure. Some of the parts shown here might not be applicable !
7445/// // Values shown here are possibly random and not representative !
7446/// let mut req = TestIamPermissionsRequest::default();
7447///
7448/// // You can configure optional parameters by calling the respective setters at will, and
7449/// // execute the final call using `doit()`.
7450/// // Values shown here are possibly random and not representative !
7451/// let result = hub.projects().locations_memberships_test_iam_permissions(req, "resource")
7452/// .doit().await;
7453/// # }
7454/// ```
7455pub struct ProjectLocationMembershipTestIamPermissionCall<'a, S>
7456 where S: 'a {
7457
7458 hub: &'a GKEHub<S>,
7459 _request: TestIamPermissionsRequest,
7460 _resource: String,
7461 _delegate: Option<&'a mut dyn client::Delegate>,
7462 _additional_params: HashMap<String, String>,
7463 _scopes: BTreeSet<String>
7464}
7465
7466impl<'a, S> client::CallBuilder for ProjectLocationMembershipTestIamPermissionCall<'a, S> {}
7467
7468impl<'a, S> ProjectLocationMembershipTestIamPermissionCall<'a, S>
7469where
7470 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7471 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7472 S::Future: Send + Unpin + 'static,
7473 S::Error: Into<Box<dyn StdError + Send + Sync>>,
7474{
7475
7476
7477 /// Perform the operation you have build so far.
7478 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, TestIamPermissionsResponse)> {
7479 use std::io::{Read, Seek};
7480 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7481 use client::{ToParts, url::Params};
7482 use std::borrow::Cow;
7483
7484 let mut dd = client::DefaultDelegate;
7485 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7486 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.memberships.testIamPermissions",
7487 http_method: hyper::Method::POST });
7488
7489 for &field in ["alt", "resource"].iter() {
7490 if self._additional_params.contains_key(field) {
7491 dlg.finished(false);
7492 return Err(client::Error::FieldClash(field));
7493 }
7494 }
7495
7496 let mut params = Params::with_capacity(4 + self._additional_params.len());
7497 params.push("resource", self._resource);
7498
7499 params.extend(self._additional_params.iter());
7500
7501 params.push("alt", "json");
7502 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
7503 if self._scopes.is_empty() {
7504 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
7505 }
7506
7507 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7508 url = params.uri_replacement(url, param_name, find_this, true);
7509 }
7510 {
7511 let to_remove = ["resource"];
7512 params.remove_params(&to_remove);
7513 }
7514
7515 let url = params.parse_with_url(&url);
7516
7517 let mut json_mime_type = mime::APPLICATION_JSON;
7518 let mut request_value_reader =
7519 {
7520 let mut value = json::value::to_value(&self._request).expect("serde to work");
7521 client::remove_json_null_values(&mut value);
7522 let mut dst = io::Cursor::new(Vec::with_capacity(128));
7523 json::to_writer(&mut dst, &value).unwrap();
7524 dst
7525 };
7526 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
7527 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7528
7529
7530 loop {
7531 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7532 Ok(token) => token,
7533 Err(e) => {
7534 match dlg.token(e) {
7535 Ok(token) => token,
7536 Err(e) => {
7537 dlg.finished(false);
7538 return Err(client::Error::MissingToken(e));
7539 }
7540 }
7541 }
7542 };
7543 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7544 let mut req_result = {
7545 let client = &self.hub.client;
7546 dlg.pre_request();
7547 let mut req_builder = hyper::Request::builder()
7548 .method(hyper::Method::POST)
7549 .uri(url.as_str())
7550 .header(USER_AGENT, self.hub._user_agent.clone());
7551
7552 if let Some(token) = token.as_ref() {
7553 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7554 }
7555
7556
7557 let request = req_builder
7558 .header(CONTENT_TYPE, json_mime_type.to_string())
7559 .header(CONTENT_LENGTH, request_size as u64)
7560 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
7561
7562 client.request(request.unwrap()).await
7563
7564 };
7565
7566 match req_result {
7567 Err(err) => {
7568 if let client::Retry::After(d) = dlg.http_error(&err) {
7569 sleep(d).await;
7570 continue;
7571 }
7572 dlg.finished(false);
7573 return Err(client::Error::HttpError(err))
7574 }
7575 Ok(mut res) => {
7576 if !res.status().is_success() {
7577 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7578 let (parts, _) = res.into_parts();
7579 let body = hyper::Body::from(res_body_string.clone());
7580 let restored_response = hyper::Response::from_parts(parts, body);
7581
7582 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7583
7584 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7585 sleep(d).await;
7586 continue;
7587 }
7588
7589 dlg.finished(false);
7590
7591 return match server_response {
7592 Some(error_value) => Err(client::Error::BadRequest(error_value)),
7593 None => Err(client::Error::Failure(restored_response)),
7594 }
7595 }
7596 let result_value = {
7597 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7598
7599 match json::from_str(&res_body_string) {
7600 Ok(decoded) => (res, decoded),
7601 Err(err) => {
7602 dlg.response_json_decode_error(&res_body_string, &err);
7603 return Err(client::Error::JsonDecodeError(res_body_string, err));
7604 }
7605 }
7606 };
7607
7608 dlg.finished(true);
7609 return Ok(result_value)
7610 }
7611 }
7612 }
7613 }
7614
7615
7616 ///
7617 /// Sets the *request* property to the given value.
7618 ///
7619 /// Even though the property as already been set when instantiating this call,
7620 /// we provide this method for API completeness.
7621 pub fn request(mut self, new_value: TestIamPermissionsRequest) -> ProjectLocationMembershipTestIamPermissionCall<'a, S> {
7622 self._request = new_value;
7623 self
7624 }
7625 /// 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.
7626 ///
7627 /// Sets the *resource* path property to the given value.
7628 ///
7629 /// Even though the property as already been set when instantiating this call,
7630 /// we provide this method for API completeness.
7631 pub fn resource(mut self, new_value: &str) -> ProjectLocationMembershipTestIamPermissionCall<'a, S> {
7632 self._resource = new_value.to_string();
7633 self
7634 }
7635 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7636 /// while executing the actual API request.
7637 ///
7638 /// ````text
7639 /// It should be used to handle progress information, and to implement a certain level of resilience.
7640 /// ````
7641 ///
7642 /// Sets the *delegate* property to the given value.
7643 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationMembershipTestIamPermissionCall<'a, S> {
7644 self._delegate = Some(new_value);
7645 self
7646 }
7647
7648 /// Set any additional parameter of the query string used in the request.
7649 /// It should be used to set parameters which are not yet available through their own
7650 /// setters.
7651 ///
7652 /// Please note that this method must not be used to set any of the known parameters
7653 /// which have their own setter method. If done anyway, the request will fail.
7654 ///
7655 /// # Additional Parameters
7656 ///
7657 /// * *$.xgafv* (query-string) - V1 error format.
7658 /// * *access_token* (query-string) - OAuth access token.
7659 /// * *alt* (query-string) - Data format for response.
7660 /// * *callback* (query-string) - JSONP
7661 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7662 /// * *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.
7663 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7664 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7665 /// * *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.
7666 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7667 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7668 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMembershipTestIamPermissionCall<'a, S>
7669 where T: AsRef<str> {
7670 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7671 self
7672 }
7673
7674 /// Identifies the authorization scope for the method you are building.
7675 ///
7676 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7677 /// [`Scope::CloudPlatform`].
7678 ///
7679 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7680 /// tokens for more than one scope.
7681 ///
7682 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7683 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7684 /// sufficient, a read-write scope will do as well.
7685 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMembershipTestIamPermissionCall<'a, S>
7686 where St: AsRef<str> {
7687 self._scopes.insert(String::from(scope.as_ref()));
7688 self
7689 }
7690 /// Identifies the authorization scope(s) for the method you are building.
7691 ///
7692 /// See [`Self::add_scope()`] for details.
7693 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMembershipTestIamPermissionCall<'a, S>
7694 where I: IntoIterator<Item = St>,
7695 St: AsRef<str> {
7696 self._scopes
7697 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7698 self
7699 }
7700
7701 /// Removes all scopes, and no default scope will be used either.
7702 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7703 /// for details).
7704 pub fn clear_scopes(mut self) -> ProjectLocationMembershipTestIamPermissionCall<'a, S> {
7705 self._scopes.clear();
7706 self
7707 }
7708}
7709
7710
7711/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
7712///
7713/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
7714/// It is not used directly, but through a [`ProjectMethods`] instance.
7715///
7716/// # Example
7717///
7718/// Instantiate a resource method builder
7719///
7720/// ```test_harness,no_run
7721/// # extern crate hyper;
7722/// # extern crate hyper_rustls;
7723/// # extern crate google_gkehub1 as gkehub1;
7724/// use gkehub1::api::CancelOperationRequest;
7725/// # async fn dox() {
7726/// # use std::default::Default;
7727/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
7728///
7729/// # let secret: oauth2::ApplicationSecret = Default::default();
7730/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
7731/// # secret,
7732/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7733/// # ).build().await.unwrap();
7734/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
7735/// // As the method needs a request, you would usually fill it with the desired information
7736/// // into the respective structure. Some of the parts shown here might not be applicable !
7737/// // Values shown here are possibly random and not representative !
7738/// let mut req = CancelOperationRequest::default();
7739///
7740/// // You can configure optional parameters by calling the respective setters at will, and
7741/// // execute the final call using `doit()`.
7742/// // Values shown here are possibly random and not representative !
7743/// let result = hub.projects().locations_operations_cancel(req, "name")
7744/// .doit().await;
7745/// # }
7746/// ```
7747pub struct ProjectLocationOperationCancelCall<'a, S>
7748 where S: 'a {
7749
7750 hub: &'a GKEHub<S>,
7751 _request: CancelOperationRequest,
7752 _name: String,
7753 _delegate: Option<&'a mut dyn client::Delegate>,
7754 _additional_params: HashMap<String, String>,
7755 _scopes: BTreeSet<String>
7756}
7757
7758impl<'a, S> client::CallBuilder for ProjectLocationOperationCancelCall<'a, S> {}
7759
7760impl<'a, S> ProjectLocationOperationCancelCall<'a, S>
7761where
7762 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
7763 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
7764 S::Future: Send + Unpin + 'static,
7765 S::Error: Into<Box<dyn StdError + Send + Sync>>,
7766{
7767
7768
7769 /// Perform the operation you have build so far.
7770 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
7771 use std::io::{Read, Seek};
7772 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
7773 use client::{ToParts, url::Params};
7774 use std::borrow::Cow;
7775
7776 let mut dd = client::DefaultDelegate;
7777 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
7778 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.operations.cancel",
7779 http_method: hyper::Method::POST });
7780
7781 for &field in ["alt", "name"].iter() {
7782 if self._additional_params.contains_key(field) {
7783 dlg.finished(false);
7784 return Err(client::Error::FieldClash(field));
7785 }
7786 }
7787
7788 let mut params = Params::with_capacity(4 + self._additional_params.len());
7789 params.push("name", self._name);
7790
7791 params.extend(self._additional_params.iter());
7792
7793 params.push("alt", "json");
7794 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
7795 if self._scopes.is_empty() {
7796 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
7797 }
7798
7799 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7800 url = params.uri_replacement(url, param_name, find_this, true);
7801 }
7802 {
7803 let to_remove = ["name"];
7804 params.remove_params(&to_remove);
7805 }
7806
7807 let url = params.parse_with_url(&url);
7808
7809 let mut json_mime_type = mime::APPLICATION_JSON;
7810 let mut request_value_reader =
7811 {
7812 let mut value = json::value::to_value(&self._request).expect("serde to work");
7813 client::remove_json_null_values(&mut value);
7814 let mut dst = io::Cursor::new(Vec::with_capacity(128));
7815 json::to_writer(&mut dst, &value).unwrap();
7816 dst
7817 };
7818 let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
7819 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7820
7821
7822 loop {
7823 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
7824 Ok(token) => token,
7825 Err(e) => {
7826 match dlg.token(e) {
7827 Ok(token) => token,
7828 Err(e) => {
7829 dlg.finished(false);
7830 return Err(client::Error::MissingToken(e));
7831 }
7832 }
7833 }
7834 };
7835 request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
7836 let mut req_result = {
7837 let client = &self.hub.client;
7838 dlg.pre_request();
7839 let mut req_builder = hyper::Request::builder()
7840 .method(hyper::Method::POST)
7841 .uri(url.as_str())
7842 .header(USER_AGENT, self.hub._user_agent.clone());
7843
7844 if let Some(token) = token.as_ref() {
7845 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7846 }
7847
7848
7849 let request = req_builder
7850 .header(CONTENT_TYPE, json_mime_type.to_string())
7851 .header(CONTENT_LENGTH, request_size as u64)
7852 .body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
7853
7854 client.request(request.unwrap()).await
7855
7856 };
7857
7858 match req_result {
7859 Err(err) => {
7860 if let client::Retry::After(d) = dlg.http_error(&err) {
7861 sleep(d).await;
7862 continue;
7863 }
7864 dlg.finished(false);
7865 return Err(client::Error::HttpError(err))
7866 }
7867 Ok(mut res) => {
7868 if !res.status().is_success() {
7869 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7870 let (parts, _) = res.into_parts();
7871 let body = hyper::Body::from(res_body_string.clone());
7872 let restored_response = hyper::Response::from_parts(parts, body);
7873
7874 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
7875
7876 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
7877 sleep(d).await;
7878 continue;
7879 }
7880
7881 dlg.finished(false);
7882
7883 return match server_response {
7884 Some(error_value) => Err(client::Error::BadRequest(error_value)),
7885 None => Err(client::Error::Failure(restored_response)),
7886 }
7887 }
7888 let result_value = {
7889 let res_body_string = client::get_body_as_string(res.body_mut()).await;
7890
7891 match json::from_str(&res_body_string) {
7892 Ok(decoded) => (res, decoded),
7893 Err(err) => {
7894 dlg.response_json_decode_error(&res_body_string, &err);
7895 return Err(client::Error::JsonDecodeError(res_body_string, err));
7896 }
7897 }
7898 };
7899
7900 dlg.finished(true);
7901 return Ok(result_value)
7902 }
7903 }
7904 }
7905 }
7906
7907
7908 ///
7909 /// Sets the *request* property to the given value.
7910 ///
7911 /// Even though the property as already been set when instantiating this call,
7912 /// we provide this method for API completeness.
7913 pub fn request(mut self, new_value: CancelOperationRequest) -> ProjectLocationOperationCancelCall<'a, S> {
7914 self._request = new_value;
7915 self
7916 }
7917 /// The name of the operation resource to be cancelled.
7918 ///
7919 /// Sets the *name* path property to the given value.
7920 ///
7921 /// Even though the property as already been set when instantiating this call,
7922 /// we provide this method for API completeness.
7923 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, S> {
7924 self._name = new_value.to_string();
7925 self
7926 }
7927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7928 /// while executing the actual API request.
7929 ///
7930 /// ````text
7931 /// It should be used to handle progress information, and to implement a certain level of resilience.
7932 /// ````
7933 ///
7934 /// Sets the *delegate* property to the given value.
7935 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationOperationCancelCall<'a, S> {
7936 self._delegate = Some(new_value);
7937 self
7938 }
7939
7940 /// Set any additional parameter of the query string used in the request.
7941 /// It should be used to set parameters which are not yet available through their own
7942 /// setters.
7943 ///
7944 /// Please note that this method must not be used to set any of the known parameters
7945 /// which have their own setter method. If done anyway, the request will fail.
7946 ///
7947 /// # Additional Parameters
7948 ///
7949 /// * *$.xgafv* (query-string) - V1 error format.
7950 /// * *access_token* (query-string) - OAuth access token.
7951 /// * *alt* (query-string) - Data format for response.
7952 /// * *callback* (query-string) - JSONP
7953 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7954 /// * *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.
7955 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7956 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7957 /// * *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.
7958 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7959 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7960 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, S>
7961 where T: AsRef<str> {
7962 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
7963 self
7964 }
7965
7966 /// Identifies the authorization scope for the method you are building.
7967 ///
7968 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7969 /// [`Scope::CloudPlatform`].
7970 ///
7971 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7972 /// tokens for more than one scope.
7973 ///
7974 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7975 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7976 /// sufficient, a read-write scope will do as well.
7977 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, S>
7978 where St: AsRef<str> {
7979 self._scopes.insert(String::from(scope.as_ref()));
7980 self
7981 }
7982 /// Identifies the authorization scope(s) for the method you are building.
7983 ///
7984 /// See [`Self::add_scope()`] for details.
7985 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, S>
7986 where I: IntoIterator<Item = St>,
7987 St: AsRef<str> {
7988 self._scopes
7989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7990 self
7991 }
7992
7993 /// Removes all scopes, and no default scope will be used either.
7994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7995 /// for details).
7996 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, S> {
7997 self._scopes.clear();
7998 self
7999 }
8000}
8001
8002
8003/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
8004///
8005/// A builder for the *locations.operations.delete* method supported by a *project* resource.
8006/// It is not used directly, but through a [`ProjectMethods`] instance.
8007///
8008/// # Example
8009///
8010/// Instantiate a resource method builder
8011///
8012/// ```test_harness,no_run
8013/// # extern crate hyper;
8014/// # extern crate hyper_rustls;
8015/// # extern crate google_gkehub1 as gkehub1;
8016/// # async fn dox() {
8017/// # use std::default::Default;
8018/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8019///
8020/// # let secret: oauth2::ApplicationSecret = Default::default();
8021/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8022/// # secret,
8023/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8024/// # ).build().await.unwrap();
8025/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8026/// // You can configure optional parameters by calling the respective setters at will, and
8027/// // execute the final call using `doit()`.
8028/// // Values shown here are possibly random and not representative !
8029/// let result = hub.projects().locations_operations_delete("name")
8030/// .doit().await;
8031/// # }
8032/// ```
8033pub struct ProjectLocationOperationDeleteCall<'a, S>
8034 where S: 'a {
8035
8036 hub: &'a GKEHub<S>,
8037 _name: String,
8038 _delegate: Option<&'a mut dyn client::Delegate>,
8039 _additional_params: HashMap<String, String>,
8040 _scopes: BTreeSet<String>
8041}
8042
8043impl<'a, S> client::CallBuilder for ProjectLocationOperationDeleteCall<'a, S> {}
8044
8045impl<'a, S> ProjectLocationOperationDeleteCall<'a, S>
8046where
8047 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8048 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8049 S::Future: Send + Unpin + 'static,
8050 S::Error: Into<Box<dyn StdError + Send + Sync>>,
8051{
8052
8053
8054 /// Perform the operation you have build so far.
8055 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
8056 use std::io::{Read, Seek};
8057 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8058 use client::{ToParts, url::Params};
8059 use std::borrow::Cow;
8060
8061 let mut dd = client::DefaultDelegate;
8062 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8063 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.operations.delete",
8064 http_method: hyper::Method::DELETE });
8065
8066 for &field in ["alt", "name"].iter() {
8067 if self._additional_params.contains_key(field) {
8068 dlg.finished(false);
8069 return Err(client::Error::FieldClash(field));
8070 }
8071 }
8072
8073 let mut params = Params::with_capacity(3 + self._additional_params.len());
8074 params.push("name", self._name);
8075
8076 params.extend(self._additional_params.iter());
8077
8078 params.push("alt", "json");
8079 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8080 if self._scopes.is_empty() {
8081 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
8082 }
8083
8084 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8085 url = params.uri_replacement(url, param_name, find_this, true);
8086 }
8087 {
8088 let to_remove = ["name"];
8089 params.remove_params(&to_remove);
8090 }
8091
8092 let url = params.parse_with_url(&url);
8093
8094
8095
8096 loop {
8097 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8098 Ok(token) => token,
8099 Err(e) => {
8100 match dlg.token(e) {
8101 Ok(token) => token,
8102 Err(e) => {
8103 dlg.finished(false);
8104 return Err(client::Error::MissingToken(e));
8105 }
8106 }
8107 }
8108 };
8109 let mut req_result = {
8110 let client = &self.hub.client;
8111 dlg.pre_request();
8112 let mut req_builder = hyper::Request::builder()
8113 .method(hyper::Method::DELETE)
8114 .uri(url.as_str())
8115 .header(USER_AGENT, self.hub._user_agent.clone());
8116
8117 if let Some(token) = token.as_ref() {
8118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8119 }
8120
8121
8122 let request = req_builder
8123 .body(hyper::body::Body::empty());
8124
8125 client.request(request.unwrap()).await
8126
8127 };
8128
8129 match req_result {
8130 Err(err) => {
8131 if let client::Retry::After(d) = dlg.http_error(&err) {
8132 sleep(d).await;
8133 continue;
8134 }
8135 dlg.finished(false);
8136 return Err(client::Error::HttpError(err))
8137 }
8138 Ok(mut res) => {
8139 if !res.status().is_success() {
8140 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8141 let (parts, _) = res.into_parts();
8142 let body = hyper::Body::from(res_body_string.clone());
8143 let restored_response = hyper::Response::from_parts(parts, body);
8144
8145 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8146
8147 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8148 sleep(d).await;
8149 continue;
8150 }
8151
8152 dlg.finished(false);
8153
8154 return match server_response {
8155 Some(error_value) => Err(client::Error::BadRequest(error_value)),
8156 None => Err(client::Error::Failure(restored_response)),
8157 }
8158 }
8159 let result_value = {
8160 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8161
8162 match json::from_str(&res_body_string) {
8163 Ok(decoded) => (res, decoded),
8164 Err(err) => {
8165 dlg.response_json_decode_error(&res_body_string, &err);
8166 return Err(client::Error::JsonDecodeError(res_body_string, err));
8167 }
8168 }
8169 };
8170
8171 dlg.finished(true);
8172 return Ok(result_value)
8173 }
8174 }
8175 }
8176 }
8177
8178
8179 /// The name of the operation resource to be deleted.
8180 ///
8181 /// Sets the *name* path property to the given value.
8182 ///
8183 /// Even though the property as already been set when instantiating this call,
8184 /// we provide this method for API completeness.
8185 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, S> {
8186 self._name = new_value.to_string();
8187 self
8188 }
8189 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8190 /// while executing the actual API request.
8191 ///
8192 /// ````text
8193 /// It should be used to handle progress information, and to implement a certain level of resilience.
8194 /// ````
8195 ///
8196 /// Sets the *delegate* property to the given value.
8197 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationOperationDeleteCall<'a, S> {
8198 self._delegate = Some(new_value);
8199 self
8200 }
8201
8202 /// Set any additional parameter of the query string used in the request.
8203 /// It should be used to set parameters which are not yet available through their own
8204 /// setters.
8205 ///
8206 /// Please note that this method must not be used to set any of the known parameters
8207 /// which have their own setter method. If done anyway, the request will fail.
8208 ///
8209 /// # Additional Parameters
8210 ///
8211 /// * *$.xgafv* (query-string) - V1 error format.
8212 /// * *access_token* (query-string) - OAuth access token.
8213 /// * *alt* (query-string) - Data format for response.
8214 /// * *callback* (query-string) - JSONP
8215 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8216 /// * *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.
8217 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8218 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8219 /// * *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.
8220 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8221 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8222 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, S>
8223 where T: AsRef<str> {
8224 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8225 self
8226 }
8227
8228 /// Identifies the authorization scope for the method you are building.
8229 ///
8230 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8231 /// [`Scope::CloudPlatform`].
8232 ///
8233 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8234 /// tokens for more than one scope.
8235 ///
8236 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8237 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8238 /// sufficient, a read-write scope will do as well.
8239 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, S>
8240 where St: AsRef<str> {
8241 self._scopes.insert(String::from(scope.as_ref()));
8242 self
8243 }
8244 /// Identifies the authorization scope(s) for the method you are building.
8245 ///
8246 /// See [`Self::add_scope()`] for details.
8247 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, S>
8248 where I: IntoIterator<Item = St>,
8249 St: AsRef<str> {
8250 self._scopes
8251 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8252 self
8253 }
8254
8255 /// Removes all scopes, and no default scope will be used either.
8256 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8257 /// for details).
8258 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, S> {
8259 self._scopes.clear();
8260 self
8261 }
8262}
8263
8264
8265/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
8266///
8267/// A builder for the *locations.operations.get* method supported by a *project* resource.
8268/// It is not used directly, but through a [`ProjectMethods`] instance.
8269///
8270/// # Example
8271///
8272/// Instantiate a resource method builder
8273///
8274/// ```test_harness,no_run
8275/// # extern crate hyper;
8276/// # extern crate hyper_rustls;
8277/// # extern crate google_gkehub1 as gkehub1;
8278/// # async fn dox() {
8279/// # use std::default::Default;
8280/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8281///
8282/// # let secret: oauth2::ApplicationSecret = Default::default();
8283/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8284/// # secret,
8285/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8286/// # ).build().await.unwrap();
8287/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8288/// // You can configure optional parameters by calling the respective setters at will, and
8289/// // execute the final call using `doit()`.
8290/// // Values shown here are possibly random and not representative !
8291/// let result = hub.projects().locations_operations_get("name")
8292/// .doit().await;
8293/// # }
8294/// ```
8295pub struct ProjectLocationOperationGetCall<'a, S>
8296 where S: 'a {
8297
8298 hub: &'a GKEHub<S>,
8299 _name: String,
8300 _delegate: Option<&'a mut dyn client::Delegate>,
8301 _additional_params: HashMap<String, String>,
8302 _scopes: BTreeSet<String>
8303}
8304
8305impl<'a, S> client::CallBuilder for ProjectLocationOperationGetCall<'a, S> {}
8306
8307impl<'a, S> ProjectLocationOperationGetCall<'a, S>
8308where
8309 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8310 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8311 S::Future: Send + Unpin + 'static,
8312 S::Error: Into<Box<dyn StdError + Send + Sync>>,
8313{
8314
8315
8316 /// Perform the operation you have build so far.
8317 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
8318 use std::io::{Read, Seek};
8319 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8320 use client::{ToParts, url::Params};
8321 use std::borrow::Cow;
8322
8323 let mut dd = client::DefaultDelegate;
8324 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8325 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.operations.get",
8326 http_method: hyper::Method::GET });
8327
8328 for &field in ["alt", "name"].iter() {
8329 if self._additional_params.contains_key(field) {
8330 dlg.finished(false);
8331 return Err(client::Error::FieldClash(field));
8332 }
8333 }
8334
8335 let mut params = Params::with_capacity(3 + self._additional_params.len());
8336 params.push("name", self._name);
8337
8338 params.extend(self._additional_params.iter());
8339
8340 params.push("alt", "json");
8341 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8342 if self._scopes.is_empty() {
8343 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
8344 }
8345
8346 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8347 url = params.uri_replacement(url, param_name, find_this, true);
8348 }
8349 {
8350 let to_remove = ["name"];
8351 params.remove_params(&to_remove);
8352 }
8353
8354 let url = params.parse_with_url(&url);
8355
8356
8357
8358 loop {
8359 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8360 Ok(token) => token,
8361 Err(e) => {
8362 match dlg.token(e) {
8363 Ok(token) => token,
8364 Err(e) => {
8365 dlg.finished(false);
8366 return Err(client::Error::MissingToken(e));
8367 }
8368 }
8369 }
8370 };
8371 let mut req_result = {
8372 let client = &self.hub.client;
8373 dlg.pre_request();
8374 let mut req_builder = hyper::Request::builder()
8375 .method(hyper::Method::GET)
8376 .uri(url.as_str())
8377 .header(USER_AGENT, self.hub._user_agent.clone());
8378
8379 if let Some(token) = token.as_ref() {
8380 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8381 }
8382
8383
8384 let request = req_builder
8385 .body(hyper::body::Body::empty());
8386
8387 client.request(request.unwrap()).await
8388
8389 };
8390
8391 match req_result {
8392 Err(err) => {
8393 if let client::Retry::After(d) = dlg.http_error(&err) {
8394 sleep(d).await;
8395 continue;
8396 }
8397 dlg.finished(false);
8398 return Err(client::Error::HttpError(err))
8399 }
8400 Ok(mut res) => {
8401 if !res.status().is_success() {
8402 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8403 let (parts, _) = res.into_parts();
8404 let body = hyper::Body::from(res_body_string.clone());
8405 let restored_response = hyper::Response::from_parts(parts, body);
8406
8407 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8408
8409 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8410 sleep(d).await;
8411 continue;
8412 }
8413
8414 dlg.finished(false);
8415
8416 return match server_response {
8417 Some(error_value) => Err(client::Error::BadRequest(error_value)),
8418 None => Err(client::Error::Failure(restored_response)),
8419 }
8420 }
8421 let result_value = {
8422 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8423
8424 match json::from_str(&res_body_string) {
8425 Ok(decoded) => (res, decoded),
8426 Err(err) => {
8427 dlg.response_json_decode_error(&res_body_string, &err);
8428 return Err(client::Error::JsonDecodeError(res_body_string, err));
8429 }
8430 }
8431 };
8432
8433 dlg.finished(true);
8434 return Ok(result_value)
8435 }
8436 }
8437 }
8438 }
8439
8440
8441 /// The name of the operation resource.
8442 ///
8443 /// Sets the *name* path property to the given value.
8444 ///
8445 /// Even though the property as already been set when instantiating this call,
8446 /// we provide this method for API completeness.
8447 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, S> {
8448 self._name = new_value.to_string();
8449 self
8450 }
8451 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8452 /// while executing the actual API request.
8453 ///
8454 /// ````text
8455 /// It should be used to handle progress information, and to implement a certain level of resilience.
8456 /// ````
8457 ///
8458 /// Sets the *delegate* property to the given value.
8459 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationOperationGetCall<'a, S> {
8460 self._delegate = Some(new_value);
8461 self
8462 }
8463
8464 /// Set any additional parameter of the query string used in the request.
8465 /// It should be used to set parameters which are not yet available through their own
8466 /// setters.
8467 ///
8468 /// Please note that this method must not be used to set any of the known parameters
8469 /// which have their own setter method. If done anyway, the request will fail.
8470 ///
8471 /// # Additional Parameters
8472 ///
8473 /// * *$.xgafv* (query-string) - V1 error format.
8474 /// * *access_token* (query-string) - OAuth access token.
8475 /// * *alt* (query-string) - Data format for response.
8476 /// * *callback* (query-string) - JSONP
8477 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8478 /// * *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.
8479 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8480 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8481 /// * *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.
8482 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8483 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8484 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, S>
8485 where T: AsRef<str> {
8486 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8487 self
8488 }
8489
8490 /// Identifies the authorization scope for the method you are building.
8491 ///
8492 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8493 /// [`Scope::CloudPlatform`].
8494 ///
8495 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8496 /// tokens for more than one scope.
8497 ///
8498 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8499 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8500 /// sufficient, a read-write scope will do as well.
8501 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, S>
8502 where St: AsRef<str> {
8503 self._scopes.insert(String::from(scope.as_ref()));
8504 self
8505 }
8506 /// Identifies the authorization scope(s) for the method you are building.
8507 ///
8508 /// See [`Self::add_scope()`] for details.
8509 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, S>
8510 where I: IntoIterator<Item = St>,
8511 St: AsRef<str> {
8512 self._scopes
8513 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8514 self
8515 }
8516
8517 /// Removes all scopes, and no default scope will be used either.
8518 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8519 /// for details).
8520 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, S> {
8521 self._scopes.clear();
8522 self
8523 }
8524}
8525
8526
8527/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
8528///
8529/// A builder for the *locations.operations.list* method supported by a *project* resource.
8530/// It is not used directly, but through a [`ProjectMethods`] instance.
8531///
8532/// # Example
8533///
8534/// Instantiate a resource method builder
8535///
8536/// ```test_harness,no_run
8537/// # extern crate hyper;
8538/// # extern crate hyper_rustls;
8539/// # extern crate google_gkehub1 as gkehub1;
8540/// # async fn dox() {
8541/// # use std::default::Default;
8542/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8543///
8544/// # let secret: oauth2::ApplicationSecret = Default::default();
8545/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8546/// # secret,
8547/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8548/// # ).build().await.unwrap();
8549/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8550/// // You can configure optional parameters by calling the respective setters at will, and
8551/// // execute the final call using `doit()`.
8552/// // Values shown here are possibly random and not representative !
8553/// let result = hub.projects().locations_operations_list("name")
8554/// .page_token("voluptua.")
8555/// .page_size(-2)
8556/// .filter("consetetur")
8557/// .doit().await;
8558/// # }
8559/// ```
8560pub struct ProjectLocationOperationListCall<'a, S>
8561 where S: 'a {
8562
8563 hub: &'a GKEHub<S>,
8564 _name: String,
8565 _page_token: Option<String>,
8566 _page_size: Option<i32>,
8567 _filter: Option<String>,
8568 _delegate: Option<&'a mut dyn client::Delegate>,
8569 _additional_params: HashMap<String, String>,
8570 _scopes: BTreeSet<String>
8571}
8572
8573impl<'a, S> client::CallBuilder for ProjectLocationOperationListCall<'a, S> {}
8574
8575impl<'a, S> ProjectLocationOperationListCall<'a, S>
8576where
8577 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8578 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8579 S::Future: Send + Unpin + 'static,
8580 S::Error: Into<Box<dyn StdError + Send + Sync>>,
8581{
8582
8583
8584 /// Perform the operation you have build so far.
8585 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListOperationsResponse)> {
8586 use std::io::{Read, Seek};
8587 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8588 use client::{ToParts, url::Params};
8589 use std::borrow::Cow;
8590
8591 let mut dd = client::DefaultDelegate;
8592 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8593 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.operations.list",
8594 http_method: hyper::Method::GET });
8595
8596 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
8597 if self._additional_params.contains_key(field) {
8598 dlg.finished(false);
8599 return Err(client::Error::FieldClash(field));
8600 }
8601 }
8602
8603 let mut params = Params::with_capacity(6 + self._additional_params.len());
8604 params.push("name", self._name);
8605 if let Some(value) = self._page_token.as_ref() {
8606 params.push("pageToken", value);
8607 }
8608 if let Some(value) = self._page_size.as_ref() {
8609 params.push("pageSize", value.to_string());
8610 }
8611 if let Some(value) = self._filter.as_ref() {
8612 params.push("filter", value);
8613 }
8614
8615 params.extend(self._additional_params.iter());
8616
8617 params.push("alt", "json");
8618 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
8619 if self._scopes.is_empty() {
8620 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
8621 }
8622
8623 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8624 url = params.uri_replacement(url, param_name, find_this, true);
8625 }
8626 {
8627 let to_remove = ["name"];
8628 params.remove_params(&to_remove);
8629 }
8630
8631 let url = params.parse_with_url(&url);
8632
8633
8634
8635 loop {
8636 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8637 Ok(token) => token,
8638 Err(e) => {
8639 match dlg.token(e) {
8640 Ok(token) => token,
8641 Err(e) => {
8642 dlg.finished(false);
8643 return Err(client::Error::MissingToken(e));
8644 }
8645 }
8646 }
8647 };
8648 let mut req_result = {
8649 let client = &self.hub.client;
8650 dlg.pre_request();
8651 let mut req_builder = hyper::Request::builder()
8652 .method(hyper::Method::GET)
8653 .uri(url.as_str())
8654 .header(USER_AGENT, self.hub._user_agent.clone());
8655
8656 if let Some(token) = token.as_ref() {
8657 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8658 }
8659
8660
8661 let request = req_builder
8662 .body(hyper::body::Body::empty());
8663
8664 client.request(request.unwrap()).await
8665
8666 };
8667
8668 match req_result {
8669 Err(err) => {
8670 if let client::Retry::After(d) = dlg.http_error(&err) {
8671 sleep(d).await;
8672 continue;
8673 }
8674 dlg.finished(false);
8675 return Err(client::Error::HttpError(err))
8676 }
8677 Ok(mut res) => {
8678 if !res.status().is_success() {
8679 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8680 let (parts, _) = res.into_parts();
8681 let body = hyper::Body::from(res_body_string.clone());
8682 let restored_response = hyper::Response::from_parts(parts, body);
8683
8684 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8685
8686 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8687 sleep(d).await;
8688 continue;
8689 }
8690
8691 dlg.finished(false);
8692
8693 return match server_response {
8694 Some(error_value) => Err(client::Error::BadRequest(error_value)),
8695 None => Err(client::Error::Failure(restored_response)),
8696 }
8697 }
8698 let result_value = {
8699 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8700
8701 match json::from_str(&res_body_string) {
8702 Ok(decoded) => (res, decoded),
8703 Err(err) => {
8704 dlg.response_json_decode_error(&res_body_string, &err);
8705 return Err(client::Error::JsonDecodeError(res_body_string, err));
8706 }
8707 }
8708 };
8709
8710 dlg.finished(true);
8711 return Ok(result_value)
8712 }
8713 }
8714 }
8715 }
8716
8717
8718 /// The name of the operation's parent resource.
8719 ///
8720 /// Sets the *name* path property to the given value.
8721 ///
8722 /// Even though the property as already been set when instantiating this call,
8723 /// we provide this method for API completeness.
8724 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, S> {
8725 self._name = new_value.to_string();
8726 self
8727 }
8728 /// The standard list page token.
8729 ///
8730 /// Sets the *page token* query property to the given value.
8731 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, S> {
8732 self._page_token = Some(new_value.to_string());
8733 self
8734 }
8735 /// The standard list page size.
8736 ///
8737 /// Sets the *page size* query property to the given value.
8738 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, S> {
8739 self._page_size = Some(new_value);
8740 self
8741 }
8742 /// The standard list filter.
8743 ///
8744 /// Sets the *filter* query property to the given value.
8745 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, S> {
8746 self._filter = Some(new_value.to_string());
8747 self
8748 }
8749 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8750 /// while executing the actual API request.
8751 ///
8752 /// ````text
8753 /// It should be used to handle progress information, and to implement a certain level of resilience.
8754 /// ````
8755 ///
8756 /// Sets the *delegate* property to the given value.
8757 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationOperationListCall<'a, S> {
8758 self._delegate = Some(new_value);
8759 self
8760 }
8761
8762 /// Set any additional parameter of the query string used in the request.
8763 /// It should be used to set parameters which are not yet available through their own
8764 /// setters.
8765 ///
8766 /// Please note that this method must not be used to set any of the known parameters
8767 /// which have their own setter method. If done anyway, the request will fail.
8768 ///
8769 /// # Additional Parameters
8770 ///
8771 /// * *$.xgafv* (query-string) - V1 error format.
8772 /// * *access_token* (query-string) - OAuth access token.
8773 /// * *alt* (query-string) - Data format for response.
8774 /// * *callback* (query-string) - JSONP
8775 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8776 /// * *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.
8777 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8778 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8779 /// * *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.
8780 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8781 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8782 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, S>
8783 where T: AsRef<str> {
8784 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
8785 self
8786 }
8787
8788 /// Identifies the authorization scope for the method you are building.
8789 ///
8790 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8791 /// [`Scope::CloudPlatform`].
8792 ///
8793 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8794 /// tokens for more than one scope.
8795 ///
8796 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8797 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8798 /// sufficient, a read-write scope will do as well.
8799 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, S>
8800 where St: AsRef<str> {
8801 self._scopes.insert(String::from(scope.as_ref()));
8802 self
8803 }
8804 /// Identifies the authorization scope(s) for the method you are building.
8805 ///
8806 /// See [`Self::add_scope()`] for details.
8807 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, S>
8808 where I: IntoIterator<Item = St>,
8809 St: AsRef<str> {
8810 self._scopes
8811 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8812 self
8813 }
8814
8815 /// Removes all scopes, and no default scope will be used either.
8816 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8817 /// for details).
8818 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, S> {
8819 self._scopes.clear();
8820 self
8821 }
8822}
8823
8824
8825/// Gets information about a location.
8826///
8827/// A builder for the *locations.get* method supported by a *project* resource.
8828/// It is not used directly, but through a [`ProjectMethods`] instance.
8829///
8830/// # Example
8831///
8832/// Instantiate a resource method builder
8833///
8834/// ```test_harness,no_run
8835/// # extern crate hyper;
8836/// # extern crate hyper_rustls;
8837/// # extern crate google_gkehub1 as gkehub1;
8838/// # async fn dox() {
8839/// # use std::default::Default;
8840/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
8841///
8842/// # let secret: oauth2::ApplicationSecret = Default::default();
8843/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
8844/// # secret,
8845/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8846/// # ).build().await.unwrap();
8847/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
8848/// // You can configure optional parameters by calling the respective setters at will, and
8849/// // execute the final call using `doit()`.
8850/// // Values shown here are possibly random and not representative !
8851/// let result = hub.projects().locations_get("name")
8852/// .doit().await;
8853/// # }
8854/// ```
8855pub struct ProjectLocationGetCall<'a, S>
8856 where S: 'a {
8857
8858 hub: &'a GKEHub<S>,
8859 _name: String,
8860 _delegate: Option<&'a mut dyn client::Delegate>,
8861 _additional_params: HashMap<String, String>,
8862 _scopes: BTreeSet<String>
8863}
8864
8865impl<'a, S> client::CallBuilder for ProjectLocationGetCall<'a, S> {}
8866
8867impl<'a, S> ProjectLocationGetCall<'a, S>
8868where
8869 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
8870 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
8871 S::Future: Send + Unpin + 'static,
8872 S::Error: Into<Box<dyn StdError + Send + Sync>>,
8873{
8874
8875
8876 /// Perform the operation you have build so far.
8877 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Location)> {
8878 use std::io::{Read, Seek};
8879 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
8880 use client::{ToParts, url::Params};
8881 use std::borrow::Cow;
8882
8883 let mut dd = client::DefaultDelegate;
8884 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
8885 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.get",
8886 http_method: hyper::Method::GET });
8887
8888 for &field in ["alt", "name"].iter() {
8889 if self._additional_params.contains_key(field) {
8890 dlg.finished(false);
8891 return Err(client::Error::FieldClash(field));
8892 }
8893 }
8894
8895 let mut params = Params::with_capacity(3 + self._additional_params.len());
8896 params.push("name", self._name);
8897
8898 params.extend(self._additional_params.iter());
8899
8900 params.push("alt", "json");
8901 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8902 if self._scopes.is_empty() {
8903 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
8904 }
8905
8906 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8907 url = params.uri_replacement(url, param_name, find_this, true);
8908 }
8909 {
8910 let to_remove = ["name"];
8911 params.remove_params(&to_remove);
8912 }
8913
8914 let url = params.parse_with_url(&url);
8915
8916
8917
8918 loop {
8919 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
8920 Ok(token) => token,
8921 Err(e) => {
8922 match dlg.token(e) {
8923 Ok(token) => token,
8924 Err(e) => {
8925 dlg.finished(false);
8926 return Err(client::Error::MissingToken(e));
8927 }
8928 }
8929 }
8930 };
8931 let mut req_result = {
8932 let client = &self.hub.client;
8933 dlg.pre_request();
8934 let mut req_builder = hyper::Request::builder()
8935 .method(hyper::Method::GET)
8936 .uri(url.as_str())
8937 .header(USER_AGENT, self.hub._user_agent.clone());
8938
8939 if let Some(token) = token.as_ref() {
8940 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8941 }
8942
8943
8944 let request = req_builder
8945 .body(hyper::body::Body::empty());
8946
8947 client.request(request.unwrap()).await
8948
8949 };
8950
8951 match req_result {
8952 Err(err) => {
8953 if let client::Retry::After(d) = dlg.http_error(&err) {
8954 sleep(d).await;
8955 continue;
8956 }
8957 dlg.finished(false);
8958 return Err(client::Error::HttpError(err))
8959 }
8960 Ok(mut res) => {
8961 if !res.status().is_success() {
8962 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8963 let (parts, _) = res.into_parts();
8964 let body = hyper::Body::from(res_body_string.clone());
8965 let restored_response = hyper::Response::from_parts(parts, body);
8966
8967 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
8968
8969 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
8970 sleep(d).await;
8971 continue;
8972 }
8973
8974 dlg.finished(false);
8975
8976 return match server_response {
8977 Some(error_value) => Err(client::Error::BadRequest(error_value)),
8978 None => Err(client::Error::Failure(restored_response)),
8979 }
8980 }
8981 let result_value = {
8982 let res_body_string = client::get_body_as_string(res.body_mut()).await;
8983
8984 match json::from_str(&res_body_string) {
8985 Ok(decoded) => (res, decoded),
8986 Err(err) => {
8987 dlg.response_json_decode_error(&res_body_string, &err);
8988 return Err(client::Error::JsonDecodeError(res_body_string, err));
8989 }
8990 }
8991 };
8992
8993 dlg.finished(true);
8994 return Ok(result_value)
8995 }
8996 }
8997 }
8998 }
8999
9000
9001 /// Resource name for the location.
9002 ///
9003 /// Sets the *name* path property to the given value.
9004 ///
9005 /// Even though the property as already been set when instantiating this call,
9006 /// we provide this method for API completeness.
9007 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, S> {
9008 self._name = new_value.to_string();
9009 self
9010 }
9011 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9012 /// while executing the actual API request.
9013 ///
9014 /// ````text
9015 /// It should be used to handle progress information, and to implement a certain level of resilience.
9016 /// ````
9017 ///
9018 /// Sets the *delegate* property to the given value.
9019 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationGetCall<'a, S> {
9020 self._delegate = Some(new_value);
9021 self
9022 }
9023
9024 /// Set any additional parameter of the query string used in the request.
9025 /// It should be used to set parameters which are not yet available through their own
9026 /// setters.
9027 ///
9028 /// Please note that this method must not be used to set any of the known parameters
9029 /// which have their own setter method. If done anyway, the request will fail.
9030 ///
9031 /// # Additional Parameters
9032 ///
9033 /// * *$.xgafv* (query-string) - V1 error format.
9034 /// * *access_token* (query-string) - OAuth access token.
9035 /// * *alt* (query-string) - Data format for response.
9036 /// * *callback* (query-string) - JSONP
9037 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9038 /// * *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.
9039 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9040 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9041 /// * *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.
9042 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9043 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9044 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, S>
9045 where T: AsRef<str> {
9046 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9047 self
9048 }
9049
9050 /// Identifies the authorization scope for the method you are building.
9051 ///
9052 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9053 /// [`Scope::CloudPlatform`].
9054 ///
9055 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9056 /// tokens for more than one scope.
9057 ///
9058 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9059 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9060 /// sufficient, a read-write scope will do as well.
9061 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, S>
9062 where St: AsRef<str> {
9063 self._scopes.insert(String::from(scope.as_ref()));
9064 self
9065 }
9066 /// Identifies the authorization scope(s) for the method you are building.
9067 ///
9068 /// See [`Self::add_scope()`] for details.
9069 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, S>
9070 where I: IntoIterator<Item = St>,
9071 St: AsRef<str> {
9072 self._scopes
9073 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9074 self
9075 }
9076
9077 /// Removes all scopes, and no default scope will be used either.
9078 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9079 /// for details).
9080 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, S> {
9081 self._scopes.clear();
9082 self
9083 }
9084}
9085
9086
9087/// Lists information about the supported locations for this service.
9088///
9089/// A builder for the *locations.list* method supported by a *project* resource.
9090/// It is not used directly, but through a [`ProjectMethods`] instance.
9091///
9092/// # Example
9093///
9094/// Instantiate a resource method builder
9095///
9096/// ```test_harness,no_run
9097/// # extern crate hyper;
9098/// # extern crate hyper_rustls;
9099/// # extern crate google_gkehub1 as gkehub1;
9100/// # async fn dox() {
9101/// # use std::default::Default;
9102/// # use gkehub1::{GKEHub, oauth2, hyper, hyper_rustls, chrono, FieldMask};
9103///
9104/// # let secret: oauth2::ApplicationSecret = Default::default();
9105/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
9106/// # secret,
9107/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9108/// # ).build().await.unwrap();
9109/// # let mut hub = GKEHub::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
9110/// // You can configure optional parameters by calling the respective setters at will, and
9111/// // execute the final call using `doit()`.
9112/// // Values shown here are possibly random and not representative !
9113/// let result = hub.projects().locations_list("name")
9114/// .page_token("et")
9115/// .page_size(-22)
9116/// .filter("sadipscing")
9117/// .doit().await;
9118/// # }
9119/// ```
9120pub struct ProjectLocationListCall<'a, S>
9121 where S: 'a {
9122
9123 hub: &'a GKEHub<S>,
9124 _name: String,
9125 _page_token: Option<String>,
9126 _page_size: Option<i32>,
9127 _filter: Option<String>,
9128 _delegate: Option<&'a mut dyn client::Delegate>,
9129 _additional_params: HashMap<String, String>,
9130 _scopes: BTreeSet<String>
9131}
9132
9133impl<'a, S> client::CallBuilder for ProjectLocationListCall<'a, S> {}
9134
9135impl<'a, S> ProjectLocationListCall<'a, S>
9136where
9137 S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
9138 S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
9139 S::Future: Send + Unpin + 'static,
9140 S::Error: Into<Box<dyn StdError + Send + Sync>>,
9141{
9142
9143
9144 /// Perform the operation you have build so far.
9145 pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListLocationsResponse)> {
9146 use std::io::{Read, Seek};
9147 use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
9148 use client::{ToParts, url::Params};
9149 use std::borrow::Cow;
9150
9151 let mut dd = client::DefaultDelegate;
9152 let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
9153 dlg.begin(client::MethodInfo { id: "gkehub.projects.locations.list",
9154 http_method: hyper::Method::GET });
9155
9156 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
9157 if self._additional_params.contains_key(field) {
9158 dlg.finished(false);
9159 return Err(client::Error::FieldClash(field));
9160 }
9161 }
9162
9163 let mut params = Params::with_capacity(6 + self._additional_params.len());
9164 params.push("name", self._name);
9165 if let Some(value) = self._page_token.as_ref() {
9166 params.push("pageToken", value);
9167 }
9168 if let Some(value) = self._page_size.as_ref() {
9169 params.push("pageSize", value.to_string());
9170 }
9171 if let Some(value) = self._filter.as_ref() {
9172 params.push("filter", value);
9173 }
9174
9175 params.extend(self._additional_params.iter());
9176
9177 params.push("alt", "json");
9178 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
9179 if self._scopes.is_empty() {
9180 self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
9181 }
9182
9183 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9184 url = params.uri_replacement(url, param_name, find_this, true);
9185 }
9186 {
9187 let to_remove = ["name"];
9188 params.remove_params(&to_remove);
9189 }
9190
9191 let url = params.parse_with_url(&url);
9192
9193
9194
9195 loop {
9196 let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
9197 Ok(token) => token,
9198 Err(e) => {
9199 match dlg.token(e) {
9200 Ok(token) => token,
9201 Err(e) => {
9202 dlg.finished(false);
9203 return Err(client::Error::MissingToken(e));
9204 }
9205 }
9206 }
9207 };
9208 let mut req_result = {
9209 let client = &self.hub.client;
9210 dlg.pre_request();
9211 let mut req_builder = hyper::Request::builder()
9212 .method(hyper::Method::GET)
9213 .uri(url.as_str())
9214 .header(USER_AGENT, self.hub._user_agent.clone());
9215
9216 if let Some(token) = token.as_ref() {
9217 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9218 }
9219
9220
9221 let request = req_builder
9222 .body(hyper::body::Body::empty());
9223
9224 client.request(request.unwrap()).await
9225
9226 };
9227
9228 match req_result {
9229 Err(err) => {
9230 if let client::Retry::After(d) = dlg.http_error(&err) {
9231 sleep(d).await;
9232 continue;
9233 }
9234 dlg.finished(false);
9235 return Err(client::Error::HttpError(err))
9236 }
9237 Ok(mut res) => {
9238 if !res.status().is_success() {
9239 let res_body_string = client::get_body_as_string(res.body_mut()).await;
9240 let (parts, _) = res.into_parts();
9241 let body = hyper::Body::from(res_body_string.clone());
9242 let restored_response = hyper::Response::from_parts(parts, body);
9243
9244 let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
9245
9246 if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
9247 sleep(d).await;
9248 continue;
9249 }
9250
9251 dlg.finished(false);
9252
9253 return match server_response {
9254 Some(error_value) => Err(client::Error::BadRequest(error_value)),
9255 None => Err(client::Error::Failure(restored_response)),
9256 }
9257 }
9258 let result_value = {
9259 let res_body_string = client::get_body_as_string(res.body_mut()).await;
9260
9261 match json::from_str(&res_body_string) {
9262 Ok(decoded) => (res, decoded),
9263 Err(err) => {
9264 dlg.response_json_decode_error(&res_body_string, &err);
9265 return Err(client::Error::JsonDecodeError(res_body_string, err));
9266 }
9267 }
9268 };
9269
9270 dlg.finished(true);
9271 return Ok(result_value)
9272 }
9273 }
9274 }
9275 }
9276
9277
9278 /// The resource that owns the locations collection, if applicable.
9279 ///
9280 /// Sets the *name* path property to the given value.
9281 ///
9282 /// Even though the property as already been set when instantiating this call,
9283 /// we provide this method for API completeness.
9284 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, S> {
9285 self._name = new_value.to_string();
9286 self
9287 }
9288 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
9289 ///
9290 /// Sets the *page token* query property to the given value.
9291 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, S> {
9292 self._page_token = Some(new_value.to_string());
9293 self
9294 }
9295 /// The maximum number of results to return. If not set, the service selects a default.
9296 ///
9297 /// Sets the *page size* query property to the given value.
9298 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, S> {
9299 self._page_size = Some(new_value);
9300 self
9301 }
9302 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
9303 ///
9304 /// Sets the *filter* query property to the given value.
9305 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, S> {
9306 self._filter = Some(new_value.to_string());
9307 self
9308 }
9309 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9310 /// while executing the actual API request.
9311 ///
9312 /// ````text
9313 /// It should be used to handle progress information, and to implement a certain level of resilience.
9314 /// ````
9315 ///
9316 /// Sets the *delegate* property to the given value.
9317 pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectLocationListCall<'a, S> {
9318 self._delegate = Some(new_value);
9319 self
9320 }
9321
9322 /// Set any additional parameter of the query string used in the request.
9323 /// It should be used to set parameters which are not yet available through their own
9324 /// setters.
9325 ///
9326 /// Please note that this method must not be used to set any of the known parameters
9327 /// which have their own setter method. If done anyway, the request will fail.
9328 ///
9329 /// # Additional Parameters
9330 ///
9331 /// * *$.xgafv* (query-string) - V1 error format.
9332 /// * *access_token* (query-string) - OAuth access token.
9333 /// * *alt* (query-string) - Data format for response.
9334 /// * *callback* (query-string) - JSONP
9335 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9336 /// * *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.
9337 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9338 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9339 /// * *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.
9340 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9341 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9342 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, S>
9343 where T: AsRef<str> {
9344 self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
9345 self
9346 }
9347
9348 /// Identifies the authorization scope for the method you are building.
9349 ///
9350 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9351 /// [`Scope::CloudPlatform`].
9352 ///
9353 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9354 /// tokens for more than one scope.
9355 ///
9356 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9357 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9358 /// sufficient, a read-write scope will do as well.
9359 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, S>
9360 where St: AsRef<str> {
9361 self._scopes.insert(String::from(scope.as_ref()));
9362 self
9363 }
9364 /// Identifies the authorization scope(s) for the method you are building.
9365 ///
9366 /// See [`Self::add_scope()`] for details.
9367 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, S>
9368 where I: IntoIterator<Item = St>,
9369 St: AsRef<str> {
9370 self._scopes
9371 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9372 self
9373 }
9374
9375 /// Removes all scopes, and no default scope will be used either.
9376 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9377 /// for details).
9378 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, S> {
9379 self._scopes.clear();
9380 self
9381 }
9382}
9383
9384