google_run2/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudRun related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_run2 as run2;
49/// use run2::api::GoogleCloudRunV2WorkerPool;
50/// use run2::{Result, Error};
51/// # async fn dox() {
52/// use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = CloudRun::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = GoogleCloudRunV2WorkerPool::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_worker_pools_patch(req, "name")
99///              .validate_only(false)
100///              .update_mask(FieldMask::new::<&str>(&[]))
101///              .force_new_revision(true)
102///              .allow_missing(false)
103///              .doit().await;
104///
105/// match result {
106///     Err(e) => match e {
107///         // The Error enum provides details about what exactly happened.
108///         // You can also just use its `Debug`, `Display` or `Error` traits
109///          Error::HttpError(_)
110///         |Error::Io(_)
111///         |Error::MissingAPIKey
112///         |Error::MissingToken(_)
113///         |Error::Cancelled
114///         |Error::UploadSizeLimitExceeded(_, _)
115///         |Error::Failure(_)
116///         |Error::BadRequest(_)
117///         |Error::FieldClash(_)
118///         |Error::JsonDecodeError(_, _) => println!("{}", e),
119///     },
120///     Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct CloudRun<C> {
126    pub client: common::Client<C>,
127    pub auth: Box<dyn common::GetToken>,
128    _user_agent: String,
129    _base_url: String,
130    _root_url: String,
131}
132
133impl<C> common::Hub for CloudRun<C> {}
134
135impl<'a, C> CloudRun<C> {
136    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudRun<C> {
137        CloudRun {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://run.googleapis.com/".to_string(),
142            _root_url: "https://run.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
147        ProjectMethods { hub: self }
148    }
149
150    /// Set the user-agent header field to use in all requests to the server.
151    /// It defaults to `google-api-rust-client/7.0.0`.
152    ///
153    /// Returns the previously set user-agent.
154    pub fn user_agent(&mut self, agent_name: String) -> String {
155        std::mem::replace(&mut self._user_agent, agent_name)
156    }
157
158    /// Set the base url to use in all requests to the server.
159    /// It defaults to `https://run.googleapis.com/`.
160    ///
161    /// Returns the previously set base url.
162    pub fn base_url(&mut self, new_base_url: String) -> String {
163        std::mem::replace(&mut self._base_url, new_base_url)
164    }
165
166    /// Set the root url to use in all requests to the server.
167    /// It defaults to `https://run.googleapis.com/`.
168    ///
169    /// Returns the previously set root url.
170    pub fn root_url(&mut self, new_root_url: String) -> String {
171        std::mem::replace(&mut self._root_url, new_root_url)
172    }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// Settings for Binary Authorization feature.
179///
180/// This type is not used in any activity, and only used as *part* of another schema.
181///
182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
183#[serde_with::serde_as]
184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
185pub struct GoogleCloudRunV2BinaryAuthorization {
186    /// Optional. If present, indicates to use Breakglass using this justification. If use_default is False, then it must be empty. For more information on breakglass, see https://cloud.google.com/binary-authorization/docs/using-breakglass
187    #[serde(rename = "breakglassJustification")]
188    pub breakglass_justification: Option<String>,
189    /// Optional. The path to a binary authorization policy. Format: `projects/{project}/platforms/cloudRun/{policy-name}`
190    pub policy: Option<String>,
191    /// Optional. If True, indicates to use the default project's binary authorization policy. If False, binary authorization will be disabled.
192    #[serde(rename = "useDefault")]
193    pub use_default: Option<bool>,
194}
195
196impl common::Part for GoogleCloudRunV2BinaryAuthorization {}
197
198/// Describes the Build step of the function that builds a container from the given source.
199///
200/// This type is not used in any activity, and only used as *part* of another schema.
201///
202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
203#[serde_with::serde_as]
204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
205pub struct GoogleCloudRunV2BuildConfig {
206    /// Optional. The base image used to build the function.
207    #[serde(rename = "baseImage")]
208    pub base_image: Option<String>,
209    /// Optional. Sets whether the function will receive automatic base image updates.
210    #[serde(rename = "enableAutomaticUpdates")]
211    pub enable_automatic_updates: Option<bool>,
212    /// Optional. User-provided build-time environment variables for the function
213    #[serde(rename = "environmentVariables")]
214    pub environment_variables: Option<HashMap<String, String>>,
215    /// Optional. The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named "function".
216    #[serde(rename = "functionTarget")]
217    pub function_target: Option<String>,
218    /// Optional. Artifact Registry URI to store the built image.
219    #[serde(rename = "imageUri")]
220    pub image_uri: Option<String>,
221    /// Output only. The Cloud Build name of the latest successful deployment of the function.
222    pub name: Option<String>,
223    /// Optional. Service account to be used for building the container. The format of this field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.
224    #[serde(rename = "serviceAccount")]
225    pub service_account: Option<String>,
226    /// The Cloud Storage bucket URI where the function source code is located.
227    #[serde(rename = "sourceLocation")]
228    pub source_location: Option<String>,
229    /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to build the Cloud Run function. The format of this field is `projects/{project}/locations/{region}/workerPools/{workerPool}` where `{project}` and `{region}` are the project id and region respectively where the worker pool is defined and `{workerPool}` is the short name of the worker pool.
230    #[serde(rename = "workerPool")]
231    pub worker_pool: Option<String>,
232}
233
234impl common::Part for GoogleCloudRunV2BuildConfig {}
235
236/// Build information of the image.
237///
238/// This type is not used in any activity, and only used as *part* of another schema.
239///
240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
241#[serde_with::serde_as]
242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
243pub struct GoogleCloudRunV2BuildInfo {
244    /// Output only. Entry point of the function when the image is a Cloud Run function.
245    #[serde(rename = "functionTarget")]
246    pub function_target: Option<String>,
247    /// Output only. Source code location of the image.
248    #[serde(rename = "sourceLocation")]
249    pub source_location: Option<String>,
250}
251
252impl common::Part for GoogleCloudRunV2BuildInfo {}
253
254/// Build the source using Buildpacks.
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct GoogleCloudRunV2BuildpacksBuild {
262    /// Optional. The base image to use for the build.
263    #[serde(rename = "baseImage")]
264    pub base_image: Option<String>,
265    /// Optional. cache_image_uri is the GCR/AR URL where the cache image will be stored. cache_image_uri is optional and omitting it will disable caching. This URL must be stable across builds. It is used to derive a build-specific temporary URL by substituting the tag with the build ID. The build will clean up the temporary image on a best-effort basis.
266    #[serde(rename = "cacheImageUri")]
267    pub cache_image_uri: Option<String>,
268    /// Optional. Whether or not the application container will be enrolled in automatic base image updates. When true, the application will be built on a scratch base image, so the base layers can be appended at run time.
269    #[serde(rename = "enableAutomaticUpdates")]
270    pub enable_automatic_updates: Option<bool>,
271    /// Optional. User-provided build-time environment variables.
272    #[serde(rename = "environmentVariables")]
273    pub environment_variables: Option<HashMap<String, String>>,
274    /// Optional. Name of the function target if the source is a function source. Required for function builds.
275    #[serde(rename = "functionTarget")]
276    pub function_target: Option<String>,
277    /// Optional. project_descriptor stores the path to the project descriptor file. When empty, it means that there is no project descriptor file in the source.
278    #[serde(rename = "projectDescriptor")]
279    pub project_descriptor: Option<String>,
280    /// The runtime name, e.g. 'go113'. Leave blank for generic builds.
281    pub runtime: Option<String>,
282}
283
284impl common::Part for GoogleCloudRunV2BuildpacksBuild {}
285
286/// Request message for deleting an Execution.
287///
288/// # Activities
289///
290/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
291/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
292///
293/// * [locations jobs executions cancel projects](ProjectLocationJobExecutionCancelCall) (request)
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct GoogleCloudRunV2CancelExecutionRequest {
298    /// A system-generated fingerprint for this version of the resource. This may be used to detect modification conflict during updates.
299    pub etag: Option<String>,
300    /// Indicates that the request should be validated without actually cancelling any resources.
301    #[serde(rename = "validateOnly")]
302    pub validate_only: Option<bool>,
303}
304
305impl common::RequestValue for GoogleCloudRunV2CancelExecutionRequest {}
306
307/// Represents a set of Cloud SQL instances. Each one will be available under /cloudsql/[instance]. Visit https://cloud.google.com/sql/docs/mysql/connect-run for more information on how to connect Cloud SQL and Cloud Run.
308///
309/// This type is not used in any activity, and only used as *part* of another schema.
310///
311#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
312#[serde_with::serde_as]
313#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
314pub struct GoogleCloudRunV2CloudSqlInstance {
315    /// The Cloud SQL instance connection names, as can be found in https://console.cloud.google.com/sql/instances. Visit https://cloud.google.com/sql/docs/mysql/connect-run for more information on how to connect Cloud SQL and Cloud Run. Format: {project}:{location}:{instance}
316    pub instances: Option<Vec<String>>,
317}
318
319impl common::Part for GoogleCloudRunV2CloudSqlInstance {}
320
321/// Cloud Storage source.
322///
323/// This type is not used in any activity, and only used as *part* of another schema.
324///
325#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
326#[serde_with::serde_as]
327#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
328pub struct GoogleCloudRunV2CloudStorageSource {
329    /// Required. The Cloud Storage bucket name.
330    pub bucket: Option<String>,
331    /// Optional. The Cloud Storage object generation.
332    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
333    pub generation: Option<i64>,
334    /// Required. The Cloud Storage object name.
335    pub object: Option<String>,
336}
337
338impl common::Part for GoogleCloudRunV2CloudStorageSource {}
339
340/// Defines a status condition for a resource.
341///
342/// This type is not used in any activity, and only used as *part* of another schema.
343///
344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
345#[serde_with::serde_as]
346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
347pub struct GoogleCloudRunV2Condition {
348    /// Output only. A reason for the execution condition.
349    #[serde(rename = "executionReason")]
350    pub execution_reason: Option<String>,
351    /// Last time the condition transitioned from one status to another.
352    #[serde(rename = "lastTransitionTime")]
353    pub last_transition_time: Option<chrono::DateTime<chrono::offset::Utc>>,
354    /// Human readable message indicating details about the current status.
355    pub message: Option<String>,
356    /// Output only. A common (service-level) reason for this condition.
357    pub reason: Option<String>,
358    /// Output only. A reason for the revision condition.
359    #[serde(rename = "revisionReason")]
360    pub revision_reason: Option<String>,
361    /// How to interpret failures of this condition, one of Error, Warning, Info
362    pub severity: Option<String>,
363    /// State of the condition.
364    pub state: Option<String>,
365    /// type is used to communicate the status of the reconciliation process. See also: https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting Types common to all resources include: * "Ready": True when the Resource is ready.
366    #[serde(rename = "type")]
367    pub type_: Option<String>,
368}
369
370impl common::Part for GoogleCloudRunV2Condition {}
371
372/// A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments can be supplied by the system to the container at runtime.
373///
374/// This type is not used in any activity, and only used as *part* of another schema.
375///
376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
377#[serde_with::serde_as]
378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
379pub struct GoogleCloudRunV2Container {
380    /// Arguments to the entrypoint. The docker image's CMD is used if this is not provided.
381    pub args: Option<Vec<String>>,
382    /// Base image for this container. Only supported for services. If set, it indicates that the service is enrolled into automatic base image update.
383    #[serde(rename = "baseImageUri")]
384    pub base_image_uri: Option<String>,
385    /// Output only. The build info of the container image.
386    #[serde(rename = "buildInfo")]
387    pub build_info: Option<GoogleCloudRunV2BuildInfo>,
388    /// Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided.
389    pub command: Option<Vec<String>>,
390    /// Names of the containers that must start before this container.
391    #[serde(rename = "dependsOn")]
392    pub depends_on: Option<Vec<String>>,
393    /// List of environment variables to set in the container.
394    pub env: Option<Vec<GoogleCloudRunV2EnvVar>>,
395    /// Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.
396    pub image: Option<String>,
397    /// Periodic probe of container liveness. Container will be restarted if the probe fails.
398    #[serde(rename = "livenessProbe")]
399    pub liveness_probe: Option<GoogleCloudRunV2Probe>,
400    /// Name of the container specified as a DNS_LABEL (RFC 1123).
401    pub name: Option<String>,
402    /// List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible. If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on.
403    pub ports: Option<Vec<GoogleCloudRunV2ContainerPort>>,
404    /// Compute Resource requirements by this container.
405    pub resources: Option<GoogleCloudRunV2ResourceRequirements>,
406    /// Optional. Location of the source.
407    #[serde(rename = "sourceCode")]
408    pub source_code: Option<GoogleCloudRunV2SourceCode>,
409    /// Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails.
410    #[serde(rename = "startupProbe")]
411    pub startup_probe: Option<GoogleCloudRunV2Probe>,
412    /// Volume to mount into the container's filesystem.
413    #[serde(rename = "volumeMounts")]
414    pub volume_mounts: Option<Vec<GoogleCloudRunV2VolumeMount>>,
415    /// Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.
416    #[serde(rename = "workingDir")]
417    pub working_dir: Option<String>,
418}
419
420impl common::Part for GoogleCloudRunV2Container {}
421
422/// Per-container override specification.
423///
424/// This type is not used in any activity, and only used as *part* of another schema.
425///
426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
427#[serde_with::serde_as]
428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
429pub struct GoogleCloudRunV2ContainerOverride {
430    /// Optional. Arguments to the entrypoint. Will replace existing args for override.
431    pub args: Option<Vec<String>>,
432    /// Optional. True if the intention is to clear out existing args list.
433    #[serde(rename = "clearArgs")]
434    pub clear_args: Option<bool>,
435    /// List of environment variables to set in the container. Will be merged with existing env for override.
436    pub env: Option<Vec<GoogleCloudRunV2EnvVar>>,
437    /// The name of the container specified as a DNS_LABEL.
438    pub name: Option<String>,
439}
440
441impl common::Part for GoogleCloudRunV2ContainerOverride {}
442
443/// ContainerPort represents a network port in a single container.
444///
445/// This type is not used in any activity, and only used as *part* of another schema.
446///
447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
448#[serde_with::serde_as]
449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
450pub struct GoogleCloudRunV2ContainerPort {
451    /// Port number the container listens on. This must be a valid TCP port number, 0 < container_port < 65536.
452    #[serde(rename = "containerPort")]
453    pub container_port: Option<i32>,
454    /// If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c".
455    pub name: Option<String>,
456}
457
458impl common::Part for GoogleCloudRunV2ContainerPort {}
459
460/// Build the source using Docker. This means the source has a Dockerfile.
461///
462/// This type is not used in any activity, and only used as *part* of another schema.
463///
464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
465#[serde_with::serde_as]
466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
467pub struct GoogleCloudRunV2DockerBuild {
468    _never_set: Option<bool>,
469}
470
471impl common::Part for GoogleCloudRunV2DockerBuild {}
472
473/// In memory (tmpfs) ephemeral storage. It is ephemeral in the sense that when the sandbox is taken down, the data is destroyed with it (it does not persist across sandbox runs).
474///
475/// This type is not used in any activity, and only used as *part* of another schema.
476///
477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
478#[serde_with::serde_as]
479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
480pub struct GoogleCloudRunV2EmptyDirVolumeSource {
481    /// The medium on which the data is stored. Acceptable values today is only MEMORY or none. When none, the default will currently be backed by memory but could change over time. +optional
482    pub medium: Option<String>,
483    /// Limit on the storage usable by this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers. The default is nil which means that the limit is undefined. More info: https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume. Info in Kubernetes: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
484    #[serde(rename = "sizeLimit")]
485    pub size_limit: Option<String>,
486}
487
488impl common::Part for GoogleCloudRunV2EmptyDirVolumeSource {}
489
490/// EnvVar represents an environment variable present in a Container.
491///
492/// This type is not used in any activity, and only used as *part* of another schema.
493///
494#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
495#[serde_with::serde_as]
496#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
497pub struct GoogleCloudRunV2EnvVar {
498    /// Required. Name of the environment variable. Must not exceed 32768 characters.
499    pub name: Option<String>,
500    /// Literal value of the environment variable. Defaults to "", and the maximum length is 32768 bytes. Variable references are not supported in Cloud Run.
501    pub value: Option<String>,
502    /// Source for the environment variable's value.
503    #[serde(rename = "valueSource")]
504    pub value_source: Option<GoogleCloudRunV2EnvVarSource>,
505}
506
507impl common::Part for GoogleCloudRunV2EnvVar {}
508
509/// EnvVarSource represents a source for the value of an EnvVar.
510///
511/// This type is not used in any activity, and only used as *part* of another schema.
512///
513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
514#[serde_with::serde_as]
515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
516pub struct GoogleCloudRunV2EnvVarSource {
517    /// Selects a secret and a specific version from Cloud Secret Manager.
518    #[serde(rename = "secretKeyRef")]
519    pub secret_key_ref: Option<GoogleCloudRunV2SecretKeySelector>,
520}
521
522impl common::Part for GoogleCloudRunV2EnvVarSource {}
523
524/// Execution represents the configuration of a single execution. A execution an immutable resource that references a container image which is run to completion.
525///
526/// # Activities
527///
528/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
529/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
530///
531/// * [locations jobs executions get projects](ProjectLocationJobExecutionGetCall) (response)
532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
533#[serde_with::serde_as]
534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
535pub struct GoogleCloudRunV2Execution {
536    /// Output only. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
537    pub annotations: Option<HashMap<String, String>>,
538    /// Output only. The number of tasks which reached phase Cancelled.
539    #[serde(rename = "cancelledCount")]
540    pub cancelled_count: Option<i32>,
541    /// Output only. Represents time when the execution was completed. It is not guaranteed to be set in happens-before order across separate operations.
542    #[serde(rename = "completionTime")]
543    pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
544    /// Output only. The Condition of this Execution, containing its readiness status, and detailed error information in case it did not reach the desired state.
545    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
546    /// Output only. Represents time when the execution was acknowledged by the execution controller. It is not guaranteed to be set in happens-before order across separate operations.
547    #[serde(rename = "createTime")]
548    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
549    /// Output only. Email address of the authenticated creator.
550    pub creator: Option<String>,
551    /// Output only. For a deleted resource, the deletion time. It is only populated as a response to a Delete request.
552    #[serde(rename = "deleteTime")]
553    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
554    /// Output only. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
555    pub etag: Option<String>,
556    /// Output only. For a deleted resource, the time after which it will be permamently deleted. It is only populated as a response to a Delete request.
557    #[serde(rename = "expireTime")]
558    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
559    /// Output only. The number of tasks which reached phase Failed.
560    #[serde(rename = "failedCount")]
561    pub failed_count: Option<i32>,
562    /// Output only. A number that monotonically increases every time the user modifies the desired state.
563    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
564    pub generation: Option<i64>,
565    /// Output only. The name of the parent Job.
566    pub job: Option<String>,
567    /// Output only. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels
568    pub labels: Option<HashMap<String, String>>,
569    /// The least stable launch stage needed to create this resource, as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. Note that this value might not be what was used as input. For example, if ALPHA was provided as input in the parent resource, but only BETA and GA-level features are were, this field will be BETA.
570    #[serde(rename = "launchStage")]
571    pub launch_stage: Option<String>,
572    /// Output only. URI where logs for this execution can be found in Cloud Console.
573    #[serde(rename = "logUri")]
574    pub log_uri: Option<String>,
575    /// Output only. The unique name of this Execution.
576    pub name: Option<String>,
577    /// Output only. The generation of this Execution. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
578    #[serde(rename = "observedGeneration")]
579    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
580    pub observed_generation: Option<i64>,
581    /// Output only. Specifies the maximum desired number of tasks the execution should run at any given time. Must be <= task_count. The actual number of tasks running in steady state will be less than this number when ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when the work left to do is less than max parallelism.
582    pub parallelism: Option<i32>,
583    /// Output only. Indicates whether the resource's reconciliation is still in progress. See comments in `Job.reconciling` for additional information on reconciliation process in Cloud Run.
584    pub reconciling: Option<bool>,
585    /// Output only. The number of tasks which have retried at least once.
586    #[serde(rename = "retriedCount")]
587    pub retried_count: Option<i32>,
588    /// Output only. The number of actively running tasks.
589    #[serde(rename = "runningCount")]
590    pub running_count: Option<i32>,
591    /// Output only. Reserved for future use.
592    #[serde(rename = "satisfiesPzs")]
593    pub satisfies_pzs: Option<bool>,
594    /// Output only. Represents time when the execution started to run. It is not guaranteed to be set in happens-before order across separate operations.
595    #[serde(rename = "startTime")]
596    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
597    /// Output only. The number of tasks which reached phase Succeeded.
598    #[serde(rename = "succeededCount")]
599    pub succeeded_count: Option<i32>,
600    /// Output only. Specifies the desired number of tasks the execution should run. Setting to 1 means that parallelism is limited to 1 and the success of that task signals the success of the execution.
601    #[serde(rename = "taskCount")]
602    pub task_count: Option<i32>,
603    /// Output only. The template used to create tasks for this execution.
604    pub template: Option<GoogleCloudRunV2TaskTemplate>,
605    /// Output only. Server assigned unique identifier for the Execution. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
606    pub uid: Option<String>,
607    /// Output only. The last-modified time.
608    #[serde(rename = "updateTime")]
609    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
610}
611
612impl common::ResponseResult for GoogleCloudRunV2Execution {}
613
614/// Reference to an Execution. Use /Executions.GetExecution with the given name to get full execution including the latest status.
615///
616/// This type is not used in any activity, and only used as *part* of another schema.
617///
618#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
619#[serde_with::serde_as]
620#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
621pub struct GoogleCloudRunV2ExecutionReference {
622    /// Status for the execution completion.
623    #[serde(rename = "completionStatus")]
624    pub completion_status: Option<String>,
625    /// Creation timestamp of the execution.
626    #[serde(rename = "completionTime")]
627    pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
628    /// Creation timestamp of the execution.
629    #[serde(rename = "createTime")]
630    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
631    /// The deletion time of the execution. It is only populated as a response to a Delete request.
632    #[serde(rename = "deleteTime")]
633    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
634    /// Name of the execution.
635    pub name: Option<String>,
636}
637
638impl common::Part for GoogleCloudRunV2ExecutionReference {}
639
640/// ExecutionTemplate describes the data an execution should have when created from a template.
641///
642/// This type is not used in any activity, and only used as *part* of another schema.
643///
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct GoogleCloudRunV2ExecutionTemplate {
648    /// Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system annotations in v1 now have a corresponding field in v2 ExecutionTemplate. This field follows Kubernetes annotations' namespacing, limits, and rules.
649    pub annotations: Option<HashMap<String, String>>,
650    /// Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 ExecutionTemplate.
651    pub labels: Option<HashMap<String, String>>,
652    /// Optional. Specifies the maximum desired number of tasks the execution should run at given time. When the job is run, if this field is 0 or unset, the maximum possible value will be used for that execution. The actual number of tasks running in steady state will be less than this number when there are fewer tasks waiting to be completed remaining, i.e. when the work left to do is less than max parallelism.
653    pub parallelism: Option<i32>,
654    /// Specifies the desired number of tasks the execution should run. Setting to 1 means that parallelism is limited to 1 and the success of that task signals the success of the execution. Defaults to 1.
655    #[serde(rename = "taskCount")]
656    pub task_count: Option<i32>,
657    /// Required. Describes the task(s) that will be created when executing an execution.
658    pub template: Option<GoogleCloudRunV2TaskTemplate>,
659}
660
661impl common::Part for GoogleCloudRunV2ExecutionTemplate {}
662
663/// Request message for exporting Cloud Run image.
664///
665/// # Activities
666///
667/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
668/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
669///
670/// * [locations export image projects](ProjectLocationExportImageCall) (request)
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct GoogleCloudRunV2ExportImageRequest {
675    /// Required. The export destination url (the Artifact Registry repo).
676    #[serde(rename = "destinationRepo")]
677    pub destination_repo: Option<String>,
678}
679
680impl common::RequestValue for GoogleCloudRunV2ExportImageRequest {}
681
682/// ExportImageResponse contains an operation Id to track the image export operation.
683///
684/// # Activities
685///
686/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
687/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
688///
689/// * [locations export image projects](ProjectLocationExportImageCall) (response)
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct GoogleCloudRunV2ExportImageResponse {
694    /// An operation ID used to track the status of image exports tied to the original pod ID in the request.
695    #[serde(rename = "operationId")]
696    pub operation_id: Option<String>,
697}
698
699impl common::ResponseResult for GoogleCloudRunV2ExportImageResponse {}
700
701/// ExportStatusResponse contains the status of image export operation, with the status of each image export job.
702///
703/// # Activities
704///
705/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
706/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
707///
708/// * [locations jobs executions export status projects](ProjectLocationJobExecutionExportStatuCall) (response)
709/// * [locations services revisions export status projects](ProjectLocationServiceRevisionExportStatuCall) (response)
710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
711#[serde_with::serde_as]
712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
713pub struct GoogleCloudRunV2ExportStatusResponse {
714    /// The status of each image export job.
715    #[serde(rename = "imageExportStatuses")]
716    pub image_export_statuses: Option<Vec<GoogleCloudRunV2ImageExportStatus>>,
717    /// The operation id.
718    #[serde(rename = "operationId")]
719    pub operation_id: Option<String>,
720    /// Output only. The state of the overall export operation.
721    #[serde(rename = "operationState")]
722    pub operation_state: Option<String>,
723}
724
725impl common::ResponseResult for GoogleCloudRunV2ExportStatusResponse {}
726
727/// Represents a volume backed by a Cloud Storage bucket using Cloud Storage FUSE.
728///
729/// This type is not used in any activity, and only used as *part* of another schema.
730///
731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
732#[serde_with::serde_as]
733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
734pub struct GoogleCloudRunV2GCSVolumeSource {
735    /// Cloud Storage Bucket name.
736    pub bucket: Option<String>,
737    /// A list of additional flags to pass to the gcsfuse CLI. Options should be specified without the leading "--".
738    #[serde(rename = "mountOptions")]
739    pub mount_options: Option<Vec<String>>,
740    /// If true, the volume will be mounted as read only for all mounts.
741    #[serde(rename = "readOnly")]
742    pub read_only: Option<bool>,
743}
744
745impl common::Part for GoogleCloudRunV2GCSVolumeSource {}
746
747/// GRPCAction describes an action involving a GRPC port.
748///
749/// This type is not used in any activity, and only used as *part* of another schema.
750///
751#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
752#[serde_with::serde_as]
753#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
754pub struct GoogleCloudRunV2GRPCAction {
755    /// Optional. Port number of the gRPC service. Number must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
756    pub port: Option<i32>,
757    /// Optional. Service is the name of the service to place in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If this is not specified, the default behavior is defined by gRPC.
758    pub service: Option<String>,
759}
760
761impl common::Part for GoogleCloudRunV2GRPCAction {}
762
763/// HTTPGetAction describes an action based on HTTP Get requests.
764///
765/// This type is not used in any activity, and only used as *part* of another schema.
766///
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct GoogleCloudRunV2HTTPGetAction {
771    /// Optional. Custom headers to set in the request. HTTP allows repeated headers.
772    #[serde(rename = "httpHeaders")]
773    pub http_headers: Option<Vec<GoogleCloudRunV2HTTPHeader>>,
774    /// Optional. Path to access on the HTTP server. Defaults to '/'.
775    pub path: Option<String>,
776    /// Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
777    pub port: Option<i32>,
778}
779
780impl common::Part for GoogleCloudRunV2HTTPGetAction {}
781
782/// HTTPHeader describes a custom header to be used in HTTP probes
783///
784/// This type is not used in any activity, and only used as *part* of another schema.
785///
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct GoogleCloudRunV2HTTPHeader {
790    /// Required. The header field name
791    pub name: Option<String>,
792    /// Optional. The header field value
793    pub value: Option<String>,
794}
795
796impl common::Part for GoogleCloudRunV2HTTPHeader {}
797
798/// The status of an image export job.
799///
800/// This type is not used in any activity, and only used as *part* of another schema.
801///
802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
803#[serde_with::serde_as]
804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
805pub struct GoogleCloudRunV2ImageExportStatus {
806    /// Output only. Has the image export job finished (regardless of successful or failure).
807    #[serde(rename = "exportJobState")]
808    pub export_job_state: Option<String>,
809    /// The exported image ID as it will appear in Artifact Registry.
810    #[serde(rename = "exportedImageDigest")]
811    pub exported_image_digest: Option<String>,
812    /// The status of the export task if done.
813    pub status: Option<UtilStatusProto>,
814    /// The image tag as it will appear in Artifact Registry.
815    pub tag: Option<String>,
816}
817
818impl common::Part for GoogleCloudRunV2ImageExportStatus {}
819
820/// Holds a single instance split entry for the Worker. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.
821///
822/// This type is not used in any activity, and only used as *part* of another schema.
823///
824#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
825#[serde_with::serde_as]
826#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
827pub struct GoogleCloudRunV2InstanceSplit {
828    /// Specifies percent of the instance split to this Revision. This defaults to zero if unspecified.
829    pub percent: Option<i32>,
830    /// Revision to which to assign this portion of instances, if split allocation is by revision.
831    pub revision: Option<String>,
832    /// The allocation type for this instance split.
833    #[serde(rename = "type")]
834    pub type_: Option<String>,
835}
836
837impl common::Part for GoogleCloudRunV2InstanceSplit {}
838
839/// Represents the observed state of a single `InstanceSplit` entry.
840///
841/// This type is not used in any activity, and only used as *part* of another schema.
842///
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct GoogleCloudRunV2InstanceSplitStatus {
847    /// Specifies percent of the instance split to this Revision.
848    pub percent: Option<i32>,
849    /// Revision to which this instance split is assigned.
850    pub revision: Option<String>,
851    /// The allocation type for this instance split.
852    #[serde(rename = "type")]
853    pub type_: Option<String>,
854}
855
856impl common::Part for GoogleCloudRunV2InstanceSplitStatus {}
857
858/// Job represents the configuration of a single job, which references a container image that is run to completion.
859///
860/// # Activities
861///
862/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
863/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
864///
865/// * [locations jobs create projects](ProjectLocationJobCreateCall) (request)
866/// * [locations jobs get projects](ProjectLocationJobGetCall) (response)
867/// * [locations jobs patch projects](ProjectLocationJobPatchCall) (request)
868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
869#[serde_with::serde_as]
870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
871pub struct GoogleCloudRunV2Job {
872    /// Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected on new resources. All system annotations in v1 now have a corresponding field in v2 Job. This field follows Kubernetes annotations' namespacing, limits, and rules.
873    pub annotations: Option<HashMap<String, String>>,
874    /// Settings for the Binary Authorization feature.
875    #[serde(rename = "binaryAuthorization")]
876    pub binary_authorization: Option<GoogleCloudRunV2BinaryAuthorization>,
877    /// Arbitrary identifier for the API client.
878    pub client: Option<String>,
879    /// Arbitrary version identifier for the API client.
880    #[serde(rename = "clientVersion")]
881    pub client_version: Option<String>,
882    /// Output only. The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the Job does not reach its desired state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
883    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
884    /// Output only. The creation time.
885    #[serde(rename = "createTime")]
886    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
887    /// Output only. Email address of the authenticated creator.
888    pub creator: Option<String>,
889    /// Output only. The deletion time. It is only populated as a response to a Delete request.
890    #[serde(rename = "deleteTime")]
891    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
892    /// Optional. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
893    pub etag: Option<String>,
894    /// Output only. Number of executions created for this job.
895    #[serde(rename = "executionCount")]
896    pub execution_count: Option<i32>,
897    /// Output only. For a deleted resource, the time after which it will be permamently deleted.
898    #[serde(rename = "expireTime")]
899    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
900    /// Output only. A number that monotonically increases every time the user modifies the desired state.
901    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
902    pub generation: Option<i64>,
903    /// Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 Job.
904    pub labels: Option<HashMap<String, String>>,
905    /// Output only. Email address of the last authenticated modifier.
906    #[serde(rename = "lastModifier")]
907    pub last_modifier: Option<String>,
908    /// Output only. Name of the last created execution.
909    #[serde(rename = "latestCreatedExecution")]
910    pub latest_created_execution: Option<GoogleCloudRunV2ExecutionReference>,
911    /// The launch stage as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output.
912    #[serde(rename = "launchStage")]
913    pub launch_stage: Option<String>,
914    /// The fully qualified name of this Job. Format: projects/{project}/locations/{location}/jobs/{job}
915    pub name: Option<String>,
916    /// Output only. The generation of this Job. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
917    #[serde(rename = "observedGeneration")]
918    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
919    pub observed_generation: Option<i64>,
920    /// Output only. Returns true if the Job is currently being acted upon by the system to bring it into the desired state. When a new Job is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the Job to the desired state. This process is called reconciliation. While reconciliation is in process, `observed_generation` and `latest_succeeded_execution`, will have transient values that might mismatch the intended state: Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the state matches the Job, or there was an error, and reconciliation failed. This state can be found in `terminal_condition.state`. If reconciliation succeeded, the following fields will match: `observed_generation` and `generation`, `latest_succeeded_execution` and `latest_created_execution`. If reconciliation failed, `observed_generation` and `latest_succeeded_execution` will have the state of the last succeeded execution or empty for newly created Job. Additional information on the failure can be found in `terminal_condition` and `conditions`.
921    pub reconciling: Option<bool>,
922    /// A unique string used as a suffix for creating a new execution. The Job will become ready when the execution is successfully completed. The sum of job name and token length must be fewer than 63 characters.
923    #[serde(rename = "runExecutionToken")]
924    pub run_execution_token: Option<String>,
925    /// Output only. Reserved for future use.
926    #[serde(rename = "satisfiesPzs")]
927    pub satisfies_pzs: Option<bool>,
928    /// A unique string used as a suffix creating a new execution. The Job will become ready when the execution is successfully started. The sum of job name and token length must be fewer than 63 characters.
929    #[serde(rename = "startExecutionToken")]
930    pub start_execution_token: Option<String>,
931    /// Required. The template used to create executions for this Job.
932    pub template: Option<GoogleCloudRunV2ExecutionTemplate>,
933    /// Output only. The Condition of this Job, containing its readiness status, and detailed error information in case it did not reach the desired state.
934    #[serde(rename = "terminalCondition")]
935    pub terminal_condition: Option<GoogleCloudRunV2Condition>,
936    /// Output only. Server assigned unique identifier for the Execution. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
937    pub uid: Option<String>,
938    /// Output only. The last-modified time.
939    #[serde(rename = "updateTime")]
940    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
941}
942
943impl common::RequestValue for GoogleCloudRunV2Job {}
944impl common::ResponseResult for GoogleCloudRunV2Job {}
945
946/// Response message containing a list of Executions.
947///
948/// # Activities
949///
950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
952///
953/// * [locations jobs executions list projects](ProjectLocationJobExecutionListCall) (response)
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct GoogleCloudRunV2ListExecutionsResponse {
958    /// The resulting list of Executions.
959    pub executions: Option<Vec<GoogleCloudRunV2Execution>>,
960    /// A token indicating there are more items than page_size. Use it in the next ListExecutions request to continue.
961    #[serde(rename = "nextPageToken")]
962    pub next_page_token: Option<String>,
963}
964
965impl common::ResponseResult for GoogleCloudRunV2ListExecutionsResponse {}
966
967/// Response message containing a list of Jobs.
968///
969/// # Activities
970///
971/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
972/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
973///
974/// * [locations jobs list projects](ProjectLocationJobListCall) (response)
975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
976#[serde_with::serde_as]
977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
978pub struct GoogleCloudRunV2ListJobsResponse {
979    /// The resulting list of Jobs.
980    pub jobs: Option<Vec<GoogleCloudRunV2Job>>,
981    /// A token indicating there are more items than page_size. Use it in the next ListJobs request to continue.
982    #[serde(rename = "nextPageToken")]
983    pub next_page_token: Option<String>,
984}
985
986impl common::ResponseResult for GoogleCloudRunV2ListJobsResponse {}
987
988/// Response message containing a list of Revisions.
989///
990/// # Activities
991///
992/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
993/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
994///
995/// * [locations services revisions list projects](ProjectLocationServiceRevisionListCall) (response)
996/// * [locations worker pools revisions list projects](ProjectLocationWorkerPoolRevisionListCall) (response)
997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
998#[serde_with::serde_as]
999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1000pub struct GoogleCloudRunV2ListRevisionsResponse {
1001    /// A token indicating there are more items than page_size. Use it in the next ListRevisions request to continue.
1002    #[serde(rename = "nextPageToken")]
1003    pub next_page_token: Option<String>,
1004    /// The resulting list of Revisions.
1005    pub revisions: Option<Vec<GoogleCloudRunV2Revision>>,
1006}
1007
1008impl common::ResponseResult for GoogleCloudRunV2ListRevisionsResponse {}
1009
1010/// Response message containing a list of Services.
1011///
1012/// # Activities
1013///
1014/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1015/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1016///
1017/// * [locations services list projects](ProjectLocationServiceListCall) (response)
1018#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1019#[serde_with::serde_as]
1020#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1021pub struct GoogleCloudRunV2ListServicesResponse {
1022    /// A token indicating there are more items than page_size. Use it in the next ListServices request to continue.
1023    #[serde(rename = "nextPageToken")]
1024    pub next_page_token: Option<String>,
1025    /// The resulting list of Services.
1026    pub services: Option<Vec<GoogleCloudRunV2Service>>,
1027    /// Output only. For global requests, returns the list of regions that could not be reached within the deadline.
1028    pub unreachable: Option<Vec<String>>,
1029}
1030
1031impl common::ResponseResult for GoogleCloudRunV2ListServicesResponse {}
1032
1033/// Response message containing a list of Tasks.
1034///
1035/// # Activities
1036///
1037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1039///
1040/// * [locations jobs executions tasks list projects](ProjectLocationJobExecutionTaskListCall) (response)
1041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1042#[serde_with::serde_as]
1043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1044pub struct GoogleCloudRunV2ListTasksResponse {
1045    /// A token indicating there are more items than page_size. Use it in the next ListTasks request to continue.
1046    #[serde(rename = "nextPageToken")]
1047    pub next_page_token: Option<String>,
1048    /// The resulting list of Tasks.
1049    pub tasks: Option<Vec<GoogleCloudRunV2Task>>,
1050}
1051
1052impl common::ResponseResult for GoogleCloudRunV2ListTasksResponse {}
1053
1054/// Response message containing a list of WorkerPools.
1055///
1056/// # Activities
1057///
1058/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1059/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1060///
1061/// * [locations worker pools list projects](ProjectLocationWorkerPoolListCall) (response)
1062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1063#[serde_with::serde_as]
1064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1065pub struct GoogleCloudRunV2ListWorkerPoolsResponse {
1066    /// A token indicating there are more items than page_size. Use it in the next ListWorkerPools request to continue.
1067    #[serde(rename = "nextPageToken")]
1068    pub next_page_token: Option<String>,
1069    /// The resulting list of WorkerPools.
1070    #[serde(rename = "workerPools")]
1071    pub worker_pools: Option<Vec<GoogleCloudRunV2WorkerPool>>,
1072}
1073
1074impl common::ResponseResult for GoogleCloudRunV2ListWorkerPoolsResponse {}
1075
1076/// Metadata represents the JSON encoded generated customer metadata.
1077///
1078/// # Activities
1079///
1080/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1081/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1082///
1083/// * [locations export image metadata projects](ProjectLocationExportImageMetadataCall) (response)
1084/// * [locations export metadata projects](ProjectLocationExportMetadataCall) (response)
1085/// * [locations export project metadata projects](ProjectLocationExportProjectMetadataCall) (response)
1086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1087#[serde_with::serde_as]
1088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1089pub struct GoogleCloudRunV2Metadata {
1090    /// JSON encoded Google-generated Customer Metadata for a given resource/project.
1091    pub metadata: Option<String>,
1092}
1093
1094impl common::ResponseResult for GoogleCloudRunV2Metadata {}
1095
1096/// Settings for multi-region deployment.
1097///
1098/// This type is not used in any activity, and only used as *part* of another schema.
1099///
1100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1101#[serde_with::serde_as]
1102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1103pub struct GoogleCloudRunV2MultiRegionSettings {
1104    /// Optional. System-generated unique id for the multi-region Service.
1105    #[serde(rename = "multiRegionId")]
1106    pub multi_region_id: Option<String>,
1107    /// Required. List of regions to deploy to, including primary region.
1108    pub regions: Option<Vec<String>>,
1109}
1110
1111impl common::Part for GoogleCloudRunV2MultiRegionSettings {}
1112
1113/// Represents an NFS mount.
1114///
1115/// This type is not used in any activity, and only used as *part* of another schema.
1116///
1117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1118#[serde_with::serde_as]
1119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1120pub struct GoogleCloudRunV2NFSVolumeSource {
1121    /// Path that is exported by the NFS server.
1122    pub path: Option<String>,
1123    /// If true, the volume will be mounted as read only for all mounts.
1124    #[serde(rename = "readOnly")]
1125    pub read_only: Option<bool>,
1126    /// Hostname or IP address of the NFS server
1127    pub server: Option<String>,
1128}
1129
1130impl common::Part for GoogleCloudRunV2NFSVolumeSource {}
1131
1132/// Direct VPC egress settings.
1133///
1134/// This type is not used in any activity, and only used as *part* of another schema.
1135///
1136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1137#[serde_with::serde_as]
1138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1139pub struct GoogleCloudRunV2NetworkInterface {
1140    /// Optional. The VPC network that the Cloud Run resource will be able to send traffic to. At least one of network or subnetwork must be specified. If both network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If network is not specified, it will be looked up from the subnetwork.
1141    pub network: Option<String>,
1142    /// Optional. The VPC subnetwork that the Cloud Run resource will get IPs from. At least one of network or subnetwork must be specified. If both network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If subnetwork is not specified, the subnetwork with the same name with the network will be used.
1143    pub subnetwork: Option<String>,
1144    /// Optional. Network tags applied to this Cloud Run resource.
1145    pub tags: Option<Vec<String>>,
1146}
1147
1148impl common::Part for GoogleCloudRunV2NetworkInterface {}
1149
1150/// Hardware constraints configuration.
1151///
1152/// This type is not used in any activity, and only used as *part* of another schema.
1153///
1154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1155#[serde_with::serde_as]
1156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1157pub struct GoogleCloudRunV2NodeSelector {
1158    /// Required. GPU accelerator type to attach to an instance.
1159    pub accelerator: Option<String>,
1160}
1161
1162impl common::Part for GoogleCloudRunV2NodeSelector {}
1163
1164/// RunJob Overrides that contains Execution fields to be overridden.
1165///
1166/// This type is not used in any activity, and only used as *part* of another schema.
1167///
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct GoogleCloudRunV2Overrides {
1172    /// Per container override specification.
1173    #[serde(rename = "containerOverrides")]
1174    pub container_overrides: Option<Vec<GoogleCloudRunV2ContainerOverride>>,
1175    /// Optional. The desired number of tasks the execution should run. Will replace existing task_count value.
1176    #[serde(rename = "taskCount")]
1177    pub task_count: Option<i32>,
1178    /// Duration in seconds the task may be active before the system will actively try to mark it failed and kill associated containers. Will replace existing timeout_seconds value.
1179    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1180    pub timeout: Option<chrono::Duration>,
1181}
1182
1183impl common::Part for GoogleCloudRunV2Overrides {}
1184
1185/// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
1186///
1187/// This type is not used in any activity, and only used as *part* of another schema.
1188///
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct GoogleCloudRunV2Probe {
1193    /// Optional. Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.
1194    #[serde(rename = "failureThreshold")]
1195    pub failure_threshold: Option<i32>,
1196    /// Optional. GRPC specifies an action involving a gRPC port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
1197    pub grpc: Option<GoogleCloudRunV2GRPCAction>,
1198    /// Optional. HTTPGet specifies the http request to perform. Exactly one of httpGet, tcpSocket, or grpc must be specified.
1199    #[serde(rename = "httpGet")]
1200    pub http_get: Option<GoogleCloudRunV2HTTPGetAction>,
1201    /// Optional. Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240.
1202    #[serde(rename = "initialDelaySeconds")]
1203    pub initial_delay_seconds: Option<i32>,
1204    /// Optional. How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeout_seconds.
1205    #[serde(rename = "periodSeconds")]
1206    pub period_seconds: Option<i32>,
1207    /// Optional. TCPSocket specifies an action involving a TCP port. Exactly one of httpGet, tcpSocket, or grpc must be specified.
1208    #[serde(rename = "tcpSocket")]
1209    pub tcp_socket: Option<GoogleCloudRunV2TCPSocketAction>,
1210    /// Optional. Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than period_seconds.
1211    #[serde(rename = "timeoutSeconds")]
1212    pub timeout_seconds: Option<i32>,
1213}
1214
1215impl common::Part for GoogleCloudRunV2Probe {}
1216
1217/// ResourceRequirements describes the compute resource requirements.
1218///
1219/// This type is not used in any activity, and only used as *part* of another schema.
1220///
1221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1222#[serde_with::serde_as]
1223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1224pub struct GoogleCloudRunV2ResourceRequirements {
1225    /// Determines whether CPU is only allocated during requests (true by default). However, if ResourceRequirements is set, the caller must explicitly set this field to true to preserve the default behavior.
1226    #[serde(rename = "cpuIdle")]
1227    pub cpu_idle: Option<bool>,
1228    /// Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported. Notes: * The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits * The only supported 'nvidia.com/gpu' value is '1'.
1229    pub limits: Option<HashMap<String, String>>,
1230    /// Determines whether CPU should be boosted on startup of a new container instance above the requested CPU threshold, this can help reduce cold-start latency.
1231    #[serde(rename = "startupCpuBoost")]
1232    pub startup_cpu_boost: Option<bool>,
1233}
1234
1235impl common::Part for GoogleCloudRunV2ResourceRequirements {}
1236
1237/// A Revision is an immutable snapshot of code and configuration. A Revision references a container image. Revisions are only created by updates to its parent Service.
1238///
1239/// # Activities
1240///
1241/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1242/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1243///
1244/// * [locations services revisions get projects](ProjectLocationServiceRevisionGetCall) (response)
1245/// * [locations worker pools revisions get projects](ProjectLocationWorkerPoolRevisionGetCall) (response)
1246#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1247#[serde_with::serde_as]
1248#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1249pub struct GoogleCloudRunV2Revision {
1250    /// Output only. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
1251    pub annotations: Option<HashMap<String, String>>,
1252    /// Output only. The Condition of this Revision, containing its readiness status, and detailed error information in case it did not reach a serving state.
1253    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
1254    /// Holds the single container that defines the unit of execution for this Revision.
1255    pub containers: Option<Vec<GoogleCloudRunV2Container>>,
1256    /// Output only. The creation time.
1257    #[serde(rename = "createTime")]
1258    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1259    /// Output only. Email address of the authenticated creator.
1260    pub creator: Option<String>,
1261    /// Output only. For a deleted resource, the deletion time. It is only populated as a response to a Delete request.
1262    #[serde(rename = "deleteTime")]
1263    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1264    /// A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
1265    #[serde(rename = "encryptionKey")]
1266    pub encryption_key: Option<String>,
1267    /// The action to take if the encryption key is revoked.
1268    #[serde(rename = "encryptionKeyRevocationAction")]
1269    pub encryption_key_revocation_action: Option<String>,
1270    /// If encryption_key_revocation_action is SHUTDOWN, the duration before shutting down all instances. The minimum increment is 1 hour.
1271    #[serde(rename = "encryptionKeyShutdownDuration")]
1272    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1273    pub encryption_key_shutdown_duration: Option<chrono::Duration>,
1274    /// Output only. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
1275    pub etag: Option<String>,
1276    /// The execution environment being used to host this Revision.
1277    #[serde(rename = "executionEnvironment")]
1278    pub execution_environment: Option<String>,
1279    /// Output only. For a deleted resource, the time after which it will be permamently deleted. It is only populated as a response to a Delete request.
1280    #[serde(rename = "expireTime")]
1281    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1282    /// Output only. A number that monotonically increases every time the user modifies the desired state.
1283    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1284    pub generation: Option<i64>,
1285    /// Optional. Output only. True if GPU zonal redundancy is disabled on this revision.
1286    #[serde(rename = "gpuZonalRedundancyDisabled")]
1287    pub gpu_zonal_redundancy_disabled: Option<bool>,
1288    /// Output only. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels.
1289    pub labels: Option<HashMap<String, String>>,
1290    /// The least stable launch stage needed to create this resource, as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. Note that this value might not be what was used as input. For example, if ALPHA was provided as input in the parent resource, but only BETA and GA-level features are were, this field will be BETA.
1291    #[serde(rename = "launchStage")]
1292    pub launch_stage: Option<String>,
1293    /// Output only. The Google Console URI to obtain logs for the Revision.
1294    #[serde(rename = "logUri")]
1295    pub log_uri: Option<String>,
1296    /// Sets the maximum number of requests that each serving instance can receive.
1297    #[serde(rename = "maxInstanceRequestConcurrency")]
1298    pub max_instance_request_concurrency: Option<i32>,
1299    /// Output only. The unique name of this Revision.
1300    pub name: Option<String>,
1301    /// The node selector for the revision.
1302    #[serde(rename = "nodeSelector")]
1303    pub node_selector: Option<GoogleCloudRunV2NodeSelector>,
1304    /// Output only. The generation of this Revision currently serving traffic. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1305    #[serde(rename = "observedGeneration")]
1306    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1307    pub observed_generation: Option<i64>,
1308    /// Output only. Indicates whether the resource's reconciliation is still in progress. See comments in `Service.reconciling` for additional information on reconciliation process in Cloud Run.
1309    pub reconciling: Option<bool>,
1310    /// Output only. Reserved for future use.
1311    #[serde(rename = "satisfiesPzs")]
1312    pub satisfies_pzs: Option<bool>,
1313    /// Scaling settings for this revision.
1314    pub scaling: Option<GoogleCloudRunV2RevisionScaling>,
1315    /// Output only. The current effective scaling settings for the revision.
1316    #[serde(rename = "scalingStatus")]
1317    pub scaling_status: Option<GoogleCloudRunV2RevisionScalingStatus>,
1318    /// Output only. The name of the parent service.
1319    pub service: Option<String>,
1320    /// Email address of the IAM service account associated with the revision of the service. The service account represents the identity of the running revision, and determines what permissions the revision has.
1321    #[serde(rename = "serviceAccount")]
1322    pub service_account: Option<String>,
1323    /// Enables service mesh connectivity.
1324    #[serde(rename = "serviceMesh")]
1325    pub service_mesh: Option<GoogleCloudRunV2ServiceMesh>,
1326    /// Enable session affinity.
1327    #[serde(rename = "sessionAffinity")]
1328    pub session_affinity: Option<bool>,
1329    /// Max allowed time for an instance to respond to a request.
1330    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1331    pub timeout: Option<chrono::Duration>,
1332    /// Output only. Server assigned unique identifier for the Revision. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1333    pub uid: Option<String>,
1334    /// Output only. The last-modified time.
1335    #[serde(rename = "updateTime")]
1336    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1337    /// A list of Volumes to make available to containers.
1338    pub volumes: Option<Vec<GoogleCloudRunV2Volume>>,
1339    /// VPC Access configuration for this Revision. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
1340    #[serde(rename = "vpcAccess")]
1341    pub vpc_access: Option<GoogleCloudRunV2VpcAccess>,
1342}
1343
1344impl common::ResponseResult for GoogleCloudRunV2Revision {}
1345
1346/// Settings for revision-level scaling settings.
1347///
1348/// This type is not used in any activity, and only used as *part* of another schema.
1349///
1350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1351#[serde_with::serde_as]
1352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1353pub struct GoogleCloudRunV2RevisionScaling {
1354    /// Optional. Maximum number of serving instances that this resource should have. When unspecified, the field is set to the server default value of 100. For more information see https://cloud.google.com/run/docs/configuring/max-instances
1355    #[serde(rename = "maxInstanceCount")]
1356    pub max_instance_count: Option<i32>,
1357    /// Optional. Minimum number of serving instances that this resource should have.
1358    #[serde(rename = "minInstanceCount")]
1359    pub min_instance_count: Option<i32>,
1360}
1361
1362impl common::Part for GoogleCloudRunV2RevisionScaling {}
1363
1364/// Effective settings for the current revision
1365///
1366/// This type is not used in any activity, and only used as *part* of another schema.
1367///
1368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1369#[serde_with::serde_as]
1370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1371pub struct GoogleCloudRunV2RevisionScalingStatus {
1372    /// The current number of min instances provisioned for this revision.
1373    #[serde(rename = "desiredMinInstanceCount")]
1374    pub desired_min_instance_count: Option<i32>,
1375}
1376
1377impl common::Part for GoogleCloudRunV2RevisionScalingStatus {}
1378
1379/// RevisionTemplate describes the data a revision should have when created from a template.
1380///
1381/// This type is not used in any activity, and only used as *part* of another schema.
1382///
1383#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1384#[serde_with::serde_as]
1385#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1386pub struct GoogleCloudRunV2RevisionTemplate {
1387    /// Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system annotations in v1 now have a corresponding field in v2 RevisionTemplate. This field follows Kubernetes annotations' namespacing, limits, and rules.
1388    pub annotations: Option<HashMap<String, String>>,
1389    /// Holds the single container that defines the unit of execution for this Revision.
1390    pub containers: Option<Vec<GoogleCloudRunV2Container>>,
1391    /// A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
1392    #[serde(rename = "encryptionKey")]
1393    pub encryption_key: Option<String>,
1394    /// Optional. The action to take if the encryption key is revoked.
1395    #[serde(rename = "encryptionKeyRevocationAction")]
1396    pub encryption_key_revocation_action: Option<String>,
1397    /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration before shutting down all instances. The minimum increment is 1 hour.
1398    #[serde(rename = "encryptionKeyShutdownDuration")]
1399    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1400    pub encryption_key_shutdown_duration: Option<chrono::Duration>,
1401    /// Optional. The sandbox environment to host this Revision.
1402    #[serde(rename = "executionEnvironment")]
1403    pub execution_environment: Option<String>,
1404    /// Optional. True if GPU zonal redundancy is disabled on this revision.
1405    #[serde(rename = "gpuZonalRedundancyDisabled")]
1406    pub gpu_zonal_redundancy_disabled: Option<bool>,
1407    /// Optional. Disables health checking containers during deployment.
1408    #[serde(rename = "healthCheckDisabled")]
1409    pub health_check_disabled: Option<bool>,
1410    /// Optional. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 RevisionTemplate.
1411    pub labels: Option<HashMap<String, String>>,
1412    /// Optional. Sets the maximum number of requests that each serving instance can receive. If not specified or 0, concurrency defaults to 80 when requested `CPU >= 1` and defaults to 1 when requested `CPU < 1`.
1413    #[serde(rename = "maxInstanceRequestConcurrency")]
1414    pub max_instance_request_concurrency: Option<i32>,
1415    /// Optional. The node selector for the revision template.
1416    #[serde(rename = "nodeSelector")]
1417    pub node_selector: Option<GoogleCloudRunV2NodeSelector>,
1418    /// Optional. The unique name for the revision. If this field is omitted, it will be automatically generated based on the Service name.
1419    pub revision: Option<String>,
1420    /// Optional. Scaling settings for this Revision.
1421    pub scaling: Option<GoogleCloudRunV2RevisionScaling>,
1422    /// Optional. Email address of the IAM service account associated with the revision of the service. The service account represents the identity of the running revision, and determines what permissions the revision has. If not provided, the revision will use the project's default service account.
1423    #[serde(rename = "serviceAccount")]
1424    pub service_account: Option<String>,
1425    /// Optional. Enables service mesh connectivity.
1426    #[serde(rename = "serviceMesh")]
1427    pub service_mesh: Option<GoogleCloudRunV2ServiceMesh>,
1428    /// Optional. Enable session affinity.
1429    #[serde(rename = "sessionAffinity")]
1430    pub session_affinity: Option<bool>,
1431    /// Optional. Max allowed time for an instance to respond to a request.
1432    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1433    pub timeout: Option<chrono::Duration>,
1434    /// Optional. A list of Volumes to make available to containers.
1435    pub volumes: Option<Vec<GoogleCloudRunV2Volume>>,
1436    /// Optional. VPC Access configuration to use for this Revision. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
1437    #[serde(rename = "vpcAccess")]
1438    pub vpc_access: Option<GoogleCloudRunV2VpcAccess>,
1439}
1440
1441impl common::Part for GoogleCloudRunV2RevisionTemplate {}
1442
1443/// Request message to create a new Execution of a Job.
1444///
1445/// # Activities
1446///
1447/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1448/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1449///
1450/// * [locations jobs run projects](ProjectLocationJobRunCall) (request)
1451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1452#[serde_with::serde_as]
1453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1454pub struct GoogleCloudRunV2RunJobRequest {
1455    /// A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
1456    pub etag: Option<String>,
1457    /// Overrides specification for a given execution of a job. If provided, overrides will be applied to update the execution or task spec.
1458    pub overrides: Option<GoogleCloudRunV2Overrides>,
1459    /// Indicates that the request should be validated without actually deleting any resources.
1460    #[serde(rename = "validateOnly")]
1461    pub validate_only: Option<bool>,
1462}
1463
1464impl common::RequestValue for GoogleCloudRunV2RunJobRequest {}
1465
1466/// SecretEnvVarSource represents a source for the value of an EnvVar.
1467///
1468/// This type is not used in any activity, and only used as *part* of another schema.
1469///
1470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1471#[serde_with::serde_as]
1472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1473pub struct GoogleCloudRunV2SecretKeySelector {
1474    /// Required. The name of the secret in Cloud Secret Manager. Format: {secret_name} if the secret is in the same project. projects/{project}/secrets/{secret_name} if the secret is in a different project.
1475    pub secret: Option<String>,
1476    /// The Cloud Secret Manager secret version. Can be 'latest' for the latest version, an integer for a specific version, or a version alias.
1477    pub version: Option<String>,
1478}
1479
1480impl common::Part for GoogleCloudRunV2SecretKeySelector {}
1481
1482/// The secret's value will be presented as the content of a file whose name is defined in the item path. If no items are defined, the name of the file is the secret.
1483///
1484/// This type is not used in any activity, and only used as *part* of another schema.
1485///
1486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1487#[serde_with::serde_as]
1488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1489pub struct GoogleCloudRunV2SecretVolumeSource {
1490    /// Integer representation of mode bits to use on created files by default. Must be a value between 0000 and 0777 (octal), defaulting to 0444. Directories within the path are not affected by this setting. Notes * Internally, a umask of 0222 will be applied to any non-zero value. * This is an integer representation of the mode bits. So, the octal integer value should look exactly as the chmod numeric notation with a leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal) or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or 493 (base-10). * This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set. This might be in conflict with other options that affect the file mode, like fsGroup, and as a result, other mode bits could be set.
1491    #[serde(rename = "defaultMode")]
1492    pub default_mode: Option<i32>,
1493    /// If unspecified, the volume will expose a file whose name is the secret, relative to VolumeMount.mount_path + VolumeMount.sub_path. If specified, the key will be used as the version to fetch from Cloud Secret Manager and the path will be the name of the file exposed in the volume. When items are defined, they must specify a path and a version.
1494    pub items: Option<Vec<GoogleCloudRunV2VersionToPath>>,
1495    /// Required. The name of the secret in Cloud Secret Manager. Format: {secret} if the secret is in the same project. projects/{project}/secrets/{secret} if the secret is in a different project.
1496    pub secret: Option<String>,
1497}
1498
1499impl common::Part for GoogleCloudRunV2SecretVolumeSource {}
1500
1501/// Service acts as a top-level container that manages a set of configurations and revision templates which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership.
1502///
1503/// # Activities
1504///
1505/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1506/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1507///
1508/// * [locations services create projects](ProjectLocationServiceCreateCall) (request)
1509/// * [locations services get projects](ProjectLocationServiceGetCall) (response)
1510/// * [locations services patch projects](ProjectLocationServicePatchCall) (request)
1511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1512#[serde_with::serde_as]
1513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1514pub struct GoogleCloudRunV2Service {
1515    /// Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected in new resources. All system annotations in v1 now have a corresponding field in v2 Service. This field follows Kubernetes annotations' namespacing, limits, and rules.
1516    pub annotations: Option<HashMap<String, String>>,
1517    /// Optional. Settings for the Binary Authorization feature.
1518    #[serde(rename = "binaryAuthorization")]
1519    pub binary_authorization: Option<GoogleCloudRunV2BinaryAuthorization>,
1520    /// Optional. Configuration for building a Cloud Run function.
1521    #[serde(rename = "buildConfig")]
1522    pub build_config: Option<GoogleCloudRunV2BuildConfig>,
1523    /// Arbitrary identifier for the API client.
1524    pub client: Option<String>,
1525    /// Arbitrary version identifier for the API client.
1526    #[serde(rename = "clientVersion")]
1527    pub client_version: Option<String>,
1528    /// Output only. The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the Service does not reach its Serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1529    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
1530    /// Output only. The creation time.
1531    #[serde(rename = "createTime")]
1532    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1533    /// Output only. Email address of the authenticated creator.
1534    pub creator: Option<String>,
1535    /// One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see https://cloud.google.com/run/docs/configuring/custom-audiences.
1536    #[serde(rename = "customAudiences")]
1537    pub custom_audiences: Option<Vec<String>>,
1538    /// Optional. Disables public resolution of the default URI of this service.
1539    #[serde(rename = "defaultUriDisabled")]
1540    pub default_uri_disabled: Option<bool>,
1541    /// Output only. The deletion time. It is only populated as a response to a Delete request.
1542    #[serde(rename = "deleteTime")]
1543    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1544    /// User-provided description of the Service. This field currently has a 512-character limit.
1545    pub description: Option<String>,
1546    /// Optional. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
1547    pub etag: Option<String>,
1548    /// Output only. For a deleted resource, the time after which it will be permanently deleted.
1549    #[serde(rename = "expireTime")]
1550    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1551    /// Output only. A number that monotonically increases every time the user modifies the desired state. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
1552    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1553    pub generation: Option<i64>,
1554    /// Optional. IAP settings on the Service.
1555    #[serde(rename = "iapEnabled")]
1556    pub iap_enabled: Option<bool>,
1557    /// Optional. Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no revision is active.
1558    pub ingress: Option<String>,
1559    /// Optional. Disables IAM permission check for run.routes.invoke for callers of this service. For more information, visit https://cloud.google.com/run/docs/securing/managing-access#invoker_check.
1560    #[serde(rename = "invokerIamDisabled")]
1561    pub invoker_iam_disabled: Option<bool>,
1562    /// Optional. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 Service.
1563    pub labels: Option<HashMap<String, String>>,
1564    /// Output only. Email address of the last authenticated modifier.
1565    #[serde(rename = "lastModifier")]
1566    pub last_modifier: Option<String>,
1567    /// Output only. Name of the last created revision. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1568    #[serde(rename = "latestCreatedRevision")]
1569    pub latest_created_revision: Option<String>,
1570    /// Output only. Name of the latest revision that is serving traffic. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1571    #[serde(rename = "latestReadyRevision")]
1572    pub latest_ready_revision: Option<String>,
1573    /// Optional. The launch stage as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output.
1574    #[serde(rename = "launchStage")]
1575    pub launch_stage: Option<String>,
1576    /// Optional. Settings for multi-region deployment.
1577    #[serde(rename = "multiRegionSettings")]
1578    pub multi_region_settings: Option<GoogleCloudRunV2MultiRegionSettings>,
1579    /// Identifier. The fully qualified name of this Service. In CreateServiceRequest, this field is ignored, and instead composed from CreateServiceRequest.parent and CreateServiceRequest.service_id. Format: projects/{project}/locations/{location}/services/{service_id}
1580    pub name: Option<String>,
1581    /// Output only. The generation of this Service currently serving traffic. See comments in `reconciling` for additional information on reconciliation process in Cloud Run. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
1582    #[serde(rename = "observedGeneration")]
1583    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1584    pub observed_generation: Option<i64>,
1585    /// Output only. Returns true if the Service is currently being acted upon by the system to bring it into the desired state. When a new Service is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the Service to the desired serving state. This process is called reconciliation. While reconciliation is in process, `observed_generation`, `latest_ready_revision`, `traffic_statuses`, and `uri` will have transient values that might mismatch the intended state: Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the serving state matches the Service, or there was an error, and reconciliation failed. This state can be found in `terminal_condition.state`. If reconciliation succeeded, the following fields will match: `traffic` and `traffic_statuses`, `observed_generation` and `generation`, `latest_ready_revision` and `latest_created_revision`. If reconciliation failed, `traffic_statuses`, `observed_generation`, and `latest_ready_revision` will have the state of the last serving revision, or empty for newly created Services. Additional information on the failure can be found in `terminal_condition` and `conditions`.
1586    pub reconciling: Option<bool>,
1587    /// Output only. Reserved for future use.
1588    #[serde(rename = "satisfiesPzs")]
1589    pub satisfies_pzs: Option<bool>,
1590    /// Optional. Specifies service-level scaling settings
1591    pub scaling: Option<GoogleCloudRunV2ServiceScaling>,
1592    /// Required. The template used to create revisions for this Service.
1593    pub template: Option<GoogleCloudRunV2RevisionTemplate>,
1594    /// Output only. The Condition of this Service, containing its readiness status, and detailed error information in case it did not reach a serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1595    #[serde(rename = "terminalCondition")]
1596    pub terminal_condition: Option<GoogleCloudRunV2Condition>,
1597    /// Output only. True if Cloud Run Threat Detection monitoring is enabled for the parent project of this Service.
1598    #[serde(rename = "threatDetectionEnabled")]
1599    pub threat_detection_enabled: Option<bool>,
1600    /// Optional. Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not provided, defaults to 100% traffic to the latest `Ready` Revision.
1601    pub traffic: Option<Vec<GoogleCloudRunV2TrafficTarget>>,
1602    /// Output only. Detailed status information for corresponding traffic targets. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
1603    #[serde(rename = "trafficStatuses")]
1604    pub traffic_statuses: Option<Vec<GoogleCloudRunV2TrafficTargetStatus>>,
1605    /// Output only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1606    pub uid: Option<String>,
1607    /// Output only. The last-modified time.
1608    #[serde(rename = "updateTime")]
1609    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1610    /// Output only. The main URI in which this Service is serving traffic.
1611    pub uri: Option<String>,
1612    /// Output only. All URLs serving traffic for this Service.
1613    pub urls: Option<Vec<String>>,
1614}
1615
1616impl common::RequestValue for GoogleCloudRunV2Service {}
1617impl common::ResponseResult for GoogleCloudRunV2Service {}
1618
1619/// Settings for Cloud Service Mesh. For more information see https://cloud.google.com/service-mesh/docs/overview.
1620///
1621/// This type is not used in any activity, and only used as *part* of another schema.
1622///
1623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1624#[serde_with::serde_as]
1625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1626pub struct GoogleCloudRunV2ServiceMesh {
1627    /// The Mesh resource name. Format: `projects/{project}/locations/global/meshes/{mesh}`, where `{project}` can be project id or number.
1628    pub mesh: Option<String>,
1629}
1630
1631impl common::Part for GoogleCloudRunV2ServiceMesh {}
1632
1633/// Scaling settings applied at the service level rather than at the revision level.
1634///
1635/// This type is not used in any activity, and only used as *part* of another schema.
1636///
1637#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1638#[serde_with::serde_as]
1639#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1640pub struct GoogleCloudRunV2ServiceScaling {
1641    /// Optional. total instance count for the service in manual scaling mode. This number of instances is divided among all revisions with specified traffic based on the percent of traffic they are receiving.
1642    #[serde(rename = "manualInstanceCount")]
1643    pub manual_instance_count: Option<i32>,
1644    /// Optional. total max instances for the service. This number of instances is divided among all revisions with specified traffic based on the percent of traffic they are receiving.
1645    #[serde(rename = "maxInstanceCount")]
1646    pub max_instance_count: Option<i32>,
1647    /// Optional. total min instances for the service. This number of instances is divided among all revisions with specified traffic based on the percent of traffic they are receiving.
1648    #[serde(rename = "minInstanceCount")]
1649    pub min_instance_count: Option<i32>,
1650    /// Optional. The scaling mode for the service.
1651    #[serde(rename = "scalingMode")]
1652    pub scaling_mode: Option<String>,
1653}
1654
1655impl common::Part for GoogleCloudRunV2ServiceScaling {}
1656
1657/// Source type for the container.
1658///
1659/// This type is not used in any activity, and only used as *part* of another schema.
1660///
1661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1662#[serde_with::serde_as]
1663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1664pub struct GoogleCloudRunV2SourceCode {
1665    /// The source is a Cloud Storage bucket.
1666    #[serde(rename = "cloudStorageSource")]
1667    pub cloud_storage_source: Option<GoogleCloudRunV2CloudStorageSource>,
1668}
1669
1670impl common::Part for GoogleCloudRunV2SourceCode {}
1671
1672/// Location of the source in an archive file in Google Cloud Storage.
1673///
1674/// This type is not used in any activity, and only used as *part* of another schema.
1675///
1676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1677#[serde_with::serde_as]
1678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1679pub struct GoogleCloudRunV2StorageSource {
1680    /// Required. Google Cloud Storage bucket containing the source (see [Bucket Name Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).
1681    pub bucket: Option<String>,
1682    /// Optional. Google Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.
1683    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1684    pub generation: Option<i64>,
1685    /// Required. Google Cloud Storage object containing the source. This object must be a gzipped archive file (`.tar.gz`) containing source to build.
1686    pub object: Option<String>,
1687}
1688
1689impl common::Part for GoogleCloudRunV2StorageSource {}
1690
1691/// Request message for submitting a Build.
1692///
1693/// # Activities
1694///
1695/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1696/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1697///
1698/// * [locations builds submit projects](ProjectLocationBuildSubmitCall) (request)
1699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1700#[serde_with::serde_as]
1701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1702pub struct GoogleCloudRunV2SubmitBuildRequest {
1703    /// Build the source using Buildpacks.
1704    #[serde(rename = "buildpackBuild")]
1705    pub buildpack_build: Option<GoogleCloudRunV2BuildpacksBuild>,
1706    /// Optional. The client that initiated the build request.
1707    pub client: Option<String>,
1708    /// Build the source using Docker. This means the source has a Dockerfile.
1709    #[serde(rename = "dockerBuild")]
1710    pub docker_build: Option<GoogleCloudRunV2DockerBuild>,
1711    /// Required. Artifact Registry URI to store the built image.
1712    #[serde(rename = "imageUri")]
1713    pub image_uri: Option<String>,
1714    /// Optional. The machine type from default pool to use for the build. If left blank, cloudbuild will use a sensible default. Currently only E2_HIGHCPU_8 is supported. If worker_pool is set, this field will be ignored.
1715    #[serde(rename = "machineType")]
1716    pub machine_type: Option<String>,
1717    /// Optional. The release track of the client that initiated the build request.
1718    #[serde(rename = "releaseTrack")]
1719    pub release_track: Option<String>,
1720    /// Optional. The service account to use for the build. If not set, the default Cloud Build service account for the project will be used.
1721    #[serde(rename = "serviceAccount")]
1722    pub service_account: Option<String>,
1723    /// Required. Source for the build.
1724    #[serde(rename = "storageSource")]
1725    pub storage_source: Option<GoogleCloudRunV2StorageSource>,
1726    /// Optional. Additional tags to annotate the build.
1727    pub tags: Option<Vec<String>>,
1728    /// Optional. Name of the Cloud Build Custom Worker Pool that should be used to build the function. The format of this field is `projects/{project}/locations/{region}/workerPools/{workerPool}` where `{project}` and `{region}` are the project id and region respectively where the worker pool is defined and `{workerPool}` is the short name of the worker pool.
1729    #[serde(rename = "workerPool")]
1730    pub worker_pool: Option<String>,
1731}
1732
1733impl common::RequestValue for GoogleCloudRunV2SubmitBuildRequest {}
1734
1735/// Response message for submitting a Build.
1736///
1737/// # Activities
1738///
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741///
1742/// * [locations builds submit projects](ProjectLocationBuildSubmitCall) (response)
1743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1744#[serde_with::serde_as]
1745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1746pub struct GoogleCloudRunV2SubmitBuildResponse {
1747    /// URI of the base builder image in Artifact Registry being used in the build. Used to opt into automatic base image updates.
1748    #[serde(rename = "baseImageUri")]
1749    pub base_image_uri: Option<String>,
1750    /// Warning message for the base image.
1751    #[serde(rename = "baseImageWarning")]
1752    pub base_image_warning: Option<String>,
1753    /// Cloud Build operation to be polled via CloudBuild API.
1754    #[serde(rename = "buildOperation")]
1755    pub build_operation: Option<GoogleLongrunningOperation>,
1756}
1757
1758impl common::ResponseResult for GoogleCloudRunV2SubmitBuildResponse {}
1759
1760/// TCPSocketAction describes an action based on opening a socket
1761///
1762/// This type is not used in any activity, and only used as *part* of another schema.
1763///
1764#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1765#[serde_with::serde_as]
1766#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1767pub struct GoogleCloudRunV2TCPSocketAction {
1768    /// Optional. Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to the exposed port of the container, which is the value of container.ports[0].containerPort.
1769    pub port: Option<i32>,
1770}
1771
1772impl common::Part for GoogleCloudRunV2TCPSocketAction {}
1773
1774/// Task represents a single run of a container to completion.
1775///
1776/// # Activities
1777///
1778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1780///
1781/// * [locations jobs executions tasks get projects](ProjectLocationJobExecutionTaskGetCall) (response)
1782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1783#[serde_with::serde_as]
1784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1785pub struct GoogleCloudRunV2Task {
1786    /// Output only. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
1787    pub annotations: Option<HashMap<String, String>>,
1788    /// Output only. Represents time when the Task was completed. It is not guaranteed to be set in happens-before order across separate operations.
1789    #[serde(rename = "completionTime")]
1790    pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1791    /// Output only. The Condition of this Task, containing its readiness status, and detailed error information in case it did not reach the desired state.
1792    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
1793    /// Holds the single container that defines the unit of execution for this task.
1794    pub containers: Option<Vec<GoogleCloudRunV2Container>>,
1795    /// Output only. Represents time when the task was created by the system. It is not guaranteed to be set in happens-before order across separate operations.
1796    #[serde(rename = "createTime")]
1797    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1798    /// Output only. For a deleted resource, the deletion time. It is only populated as a response to a Delete request.
1799    #[serde(rename = "deleteTime")]
1800    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1801    /// Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
1802    #[serde(rename = "encryptionKey")]
1803    pub encryption_key: Option<String>,
1804    /// Output only. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
1805    pub etag: Option<String>,
1806    /// Output only. The name of the parent Execution.
1807    pub execution: Option<String>,
1808    /// The execution environment being used to host this Task.
1809    #[serde(rename = "executionEnvironment")]
1810    pub execution_environment: Option<String>,
1811    /// Output only. For a deleted resource, the time after which it will be permamently deleted. It is only populated as a response to a Delete request.
1812    #[serde(rename = "expireTime")]
1813    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1814    /// Output only. A number that monotonically increases every time the user modifies the desired state.
1815    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1816    pub generation: Option<i64>,
1817    /// Optional. Output only. True if GPU zonal redundancy is disabled on this task.
1818    #[serde(rename = "gpuZonalRedundancyDisabled")]
1819    pub gpu_zonal_redundancy_disabled: Option<bool>,
1820    /// Output only. Index of the Task, unique per execution, and beginning at 0.
1821    pub index: Option<i32>,
1822    /// Output only. The name of the parent Job.
1823    pub job: Option<String>,
1824    /// Output only. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels
1825    pub labels: Option<HashMap<String, String>>,
1826    /// Output only. Result of the last attempt of this Task.
1827    #[serde(rename = "lastAttemptResult")]
1828    pub last_attempt_result: Option<GoogleCloudRunV2TaskAttemptResult>,
1829    /// Output only. URI where logs for this execution can be found in Cloud Console.
1830    #[serde(rename = "logUri")]
1831    pub log_uri: Option<String>,
1832    /// Number of retries allowed per Task, before marking this Task failed.
1833    #[serde(rename = "maxRetries")]
1834    pub max_retries: Option<i32>,
1835    /// Output only. The unique name of this Task.
1836    pub name: Option<String>,
1837    /// Output only. The node selector for the task.
1838    #[serde(rename = "nodeSelector")]
1839    pub node_selector: Option<GoogleCloudRunV2NodeSelector>,
1840    /// Output only. The generation of this Task. See comments in `Job.reconciling` for additional information on reconciliation process in Cloud Run.
1841    #[serde(rename = "observedGeneration")]
1842    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1843    pub observed_generation: Option<i64>,
1844    /// Output only. Indicates whether the resource's reconciliation is still in progress. See comments in `Job.reconciling` for additional information on reconciliation process in Cloud Run.
1845    pub reconciling: Option<bool>,
1846    /// Output only. The number of times this Task was retried. Tasks are retried when they fail up to the maxRetries limit.
1847    pub retried: Option<i32>,
1848    /// Output only. Reserved for future use.
1849    #[serde(rename = "satisfiesPzs")]
1850    pub satisfies_pzs: Option<bool>,
1851    /// Output only. Represents time when the task was scheduled to run by the system. It is not guaranteed to be set in happens-before order across separate operations.
1852    #[serde(rename = "scheduledTime")]
1853    pub scheduled_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1854    /// Email address of the IAM service account associated with the Task of a Job. The service account represents the identity of the running task, and determines what permissions the task has. If not provided, the task will use the project's default service account.
1855    #[serde(rename = "serviceAccount")]
1856    pub service_account: Option<String>,
1857    /// Output only. Represents time when the task started to run. It is not guaranteed to be set in happens-before order across separate operations.
1858    #[serde(rename = "startTime")]
1859    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1860    /// Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. This applies per attempt of a task, meaning each retry can run for the full timeout.
1861    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1862    pub timeout: Option<chrono::Duration>,
1863    /// Output only. Server assigned unique identifier for the Task. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
1864    pub uid: Option<String>,
1865    /// Output only. The last-modified time.
1866    #[serde(rename = "updateTime")]
1867    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1868    /// A list of Volumes to make available to containers.
1869    pub volumes: Option<Vec<GoogleCloudRunV2Volume>>,
1870    /// Output only. VPC Access configuration to use for this Task. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
1871    #[serde(rename = "vpcAccess")]
1872    pub vpc_access: Option<GoogleCloudRunV2VpcAccess>,
1873}
1874
1875impl common::ResponseResult for GoogleCloudRunV2Task {}
1876
1877/// Result of a task attempt.
1878///
1879/// This type is not used in any activity, and only used as *part* of another schema.
1880///
1881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1882#[serde_with::serde_as]
1883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1884pub struct GoogleCloudRunV2TaskAttemptResult {
1885    /// Output only. The exit code of this attempt. This may be unset if the container was unable to exit cleanly with a code due to some other failure. See status field for possible failure details. At most one of exit_code or term_signal will be set.
1886    #[serde(rename = "exitCode")]
1887    pub exit_code: Option<i32>,
1888    /// Output only. The status of this attempt. If the status code is OK, then the attempt succeeded.
1889    pub status: Option<GoogleRpcStatus>,
1890    /// Output only. Termination signal of the container. This is set to non-zero if the container is terminated by the system. At most one of exit_code or term_signal will be set.
1891    #[serde(rename = "termSignal")]
1892    pub term_signal: Option<i32>,
1893}
1894
1895impl common::Part for GoogleCloudRunV2TaskAttemptResult {}
1896
1897/// TaskTemplate describes the data a task should have when created from a template.
1898///
1899/// This type is not used in any activity, and only used as *part* of another schema.
1900///
1901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1902#[serde_with::serde_as]
1903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1904pub struct GoogleCloudRunV2TaskTemplate {
1905    /// Holds the single container that defines the unit of execution for this task.
1906    pub containers: Option<Vec<GoogleCloudRunV2Container>>,
1907    /// A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
1908    #[serde(rename = "encryptionKey")]
1909    pub encryption_key: Option<String>,
1910    /// Optional. The execution environment being used to host this Task.
1911    #[serde(rename = "executionEnvironment")]
1912    pub execution_environment: Option<String>,
1913    /// Optional. True if GPU zonal redundancy is disabled on this task template.
1914    #[serde(rename = "gpuZonalRedundancyDisabled")]
1915    pub gpu_zonal_redundancy_disabled: Option<bool>,
1916    /// Number of retries allowed per Task, before marking this Task failed. Defaults to 3.
1917    #[serde(rename = "maxRetries")]
1918    pub max_retries: Option<i32>,
1919    /// Optional. The node selector for the task template.
1920    #[serde(rename = "nodeSelector")]
1921    pub node_selector: Option<GoogleCloudRunV2NodeSelector>,
1922    /// Optional. Email address of the IAM service account associated with the Task of a Job. The service account represents the identity of the running task, and determines what permissions the task has. If not provided, the task will use the project's default service account.
1923    #[serde(rename = "serviceAccount")]
1924    pub service_account: Option<String>,
1925    /// Optional. Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. This applies per attempt of a task, meaning each retry can run for the full timeout. Defaults to 600 seconds.
1926    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1927    pub timeout: Option<chrono::Duration>,
1928    /// Optional. A list of Volumes to make available to containers.
1929    pub volumes: Option<Vec<GoogleCloudRunV2Volume>>,
1930    /// Optional. VPC Access configuration to use for this Task. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
1931    #[serde(rename = "vpcAccess")]
1932    pub vpc_access: Option<GoogleCloudRunV2VpcAccess>,
1933}
1934
1935impl common::Part for GoogleCloudRunV2TaskTemplate {}
1936
1937/// Holds a single traffic routing entry for the Service. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.
1938///
1939/// This type is not used in any activity, and only used as *part* of another schema.
1940///
1941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1942#[serde_with::serde_as]
1943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1944pub struct GoogleCloudRunV2TrafficTarget {
1945    /// Specifies percent of the traffic to this Revision. This defaults to zero if unspecified.
1946    pub percent: Option<i32>,
1947    /// Revision to which to send this portion of traffic, if traffic allocation is by revision.
1948    pub revision: Option<String>,
1949    /// Indicates a string to be part of the URI to exclusively reference this target.
1950    pub tag: Option<String>,
1951    /// The allocation type for this traffic target.
1952    #[serde(rename = "type")]
1953    pub type_: Option<String>,
1954}
1955
1956impl common::Part for GoogleCloudRunV2TrafficTarget {}
1957
1958/// Represents the observed state of a single `TrafficTarget` entry.
1959///
1960/// This type is not used in any activity, and only used as *part* of another schema.
1961///
1962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1963#[serde_with::serde_as]
1964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1965pub struct GoogleCloudRunV2TrafficTargetStatus {
1966    /// Specifies percent of the traffic to this Revision.
1967    pub percent: Option<i32>,
1968    /// Revision to which this traffic is sent.
1969    pub revision: Option<String>,
1970    /// Indicates the string used in the URI to exclusively reference this target.
1971    pub tag: Option<String>,
1972    /// The allocation type for this traffic target.
1973    #[serde(rename = "type")]
1974    pub type_: Option<String>,
1975    /// Displays the target URI.
1976    pub uri: Option<String>,
1977}
1978
1979impl common::Part for GoogleCloudRunV2TrafficTargetStatus {}
1980
1981/// VersionToPath maps a specific version of a secret to a relative file to mount to, relative to VolumeMount's mount_path.
1982///
1983/// This type is not used in any activity, and only used as *part* of another schema.
1984///
1985#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1986#[serde_with::serde_as]
1987#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1988pub struct GoogleCloudRunV2VersionToPath {
1989    /// Integer octal mode bits to use on this file, must be a value between 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be used. Notes * Internally, a umask of 0222 will be applied to any non-zero value. * This is an integer representation of the mode bits. So, the octal integer value should look exactly as the chmod numeric notation with a leading zero. Some examples: for chmod 640 (u=rw,g=r), set to 0640 (octal) or 416 (base-10). For chmod 755 (u=rwx,g=rx,o=rx), set to 0755 (octal) or 493 (base-10). * This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.
1990    pub mode: Option<i32>,
1991    /// Required. The relative path of the secret in the container.
1992    pub path: Option<String>,
1993    /// The Cloud Secret Manager secret version. Can be 'latest' for the latest value, or an integer or a secret alias for a specific version.
1994    pub version: Option<String>,
1995}
1996
1997impl common::Part for GoogleCloudRunV2VersionToPath {}
1998
1999/// Volume represents a named volume in a container.
2000///
2001/// This type is not used in any activity, and only used as *part* of another schema.
2002///
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct GoogleCloudRunV2Volume {
2007    /// For Cloud SQL volumes, contains the specific instances that should be mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for more information on how to connect Cloud SQL and Cloud Run.
2008    #[serde(rename = "cloudSqlInstance")]
2009    pub cloud_sql_instance: Option<GoogleCloudRunV2CloudSqlInstance>,
2010    /// Ephemeral storage used as a shared volume.
2011    #[serde(rename = "emptyDir")]
2012    pub empty_dir: Option<GoogleCloudRunV2EmptyDirVolumeSource>,
2013    /// Persistent storage backed by a Google Cloud Storage bucket.
2014    pub gcs: Option<GoogleCloudRunV2GCSVolumeSource>,
2015    /// Required. Volume's name.
2016    pub name: Option<String>,
2017    /// For NFS Voumes, contains the path to the nfs Volume
2018    pub nfs: Option<GoogleCloudRunV2NFSVolumeSource>,
2019    /// Secret represents a secret that should populate this volume.
2020    pub secret: Option<GoogleCloudRunV2SecretVolumeSource>,
2021}
2022
2023impl common::Part for GoogleCloudRunV2Volume {}
2024
2025/// VolumeMount describes a mounting of a Volume within a container.
2026///
2027/// This type is not used in any activity, and only used as *part* of another schema.
2028///
2029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2030#[serde_with::serde_as]
2031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2032pub struct GoogleCloudRunV2VolumeMount {
2033    /// Required. Path within the container at which the volume should be mounted. Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must otherwise be `/cloudsql`. All instances defined in the Volume will be available as `/cloudsql/[instance]`. For more information on Cloud SQL volumes, visit https://cloud.google.com/sql/docs/mysql/connect-run
2034    #[serde(rename = "mountPath")]
2035    pub mount_path: Option<String>,
2036    /// Required. This must match the Name of a Volume.
2037    pub name: Option<String>,
2038    /// Optional. Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
2039    #[serde(rename = "subPath")]
2040    pub sub_path: Option<String>,
2041}
2042
2043impl common::Part for GoogleCloudRunV2VolumeMount {}
2044
2045/// VPC Access settings. For more information on sending traffic to a VPC network, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
2046///
2047/// This type is not used in any activity, and only used as *part* of another schema.
2048///
2049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2050#[serde_with::serde_as]
2051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2052pub struct GoogleCloudRunV2VpcAccess {
2053    /// VPC Access connector name. Format: `projects/{project}/locations/{location}/connectors/{connector}`, where `{project}` can be project id or number. For more information on sending traffic to a VPC network via a connector, visit https://cloud.google.com/run/docs/configuring/vpc-connectors.
2054    pub connector: Option<String>,
2055    /// Optional. Traffic VPC egress settings. If not provided, it defaults to PRIVATE_RANGES_ONLY.
2056    pub egress: Option<String>,
2057    /// Optional. Direct VPC egress settings. Currently only single network interface is supported.
2058    #[serde(rename = "networkInterfaces")]
2059    pub network_interfaces: Option<Vec<GoogleCloudRunV2NetworkInterface>>,
2060}
2061
2062impl common::Part for GoogleCloudRunV2VpcAccess {}
2063
2064/// WorkerPool acts as a top-level container that manages a set of configurations and revision templates which implement a pull-based workload. WorkerPool exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership.
2065///
2066/// # Activities
2067///
2068/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2069/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2070///
2071/// * [locations worker pools create projects](ProjectLocationWorkerPoolCreateCall) (request)
2072/// * [locations worker pools get projects](ProjectLocationWorkerPoolGetCall) (response)
2073/// * [locations worker pools patch projects](ProjectLocationWorkerPoolPatchCall) (request)
2074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2075#[serde_with::serde_as]
2076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2077pub struct GoogleCloudRunV2WorkerPool {
2078    /// Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected in new resources. All system annotations in v1 now have a corresponding field in v2 WorkerPool. This field follows Kubernetes annotations' namespacing, limits, and rules.
2079    pub annotations: Option<HashMap<String, String>>,
2080    /// Optional. Settings for the Binary Authorization feature.
2081    #[serde(rename = "binaryAuthorization")]
2082    pub binary_authorization: Option<GoogleCloudRunV2BinaryAuthorization>,
2083    /// Arbitrary identifier for the API client.
2084    pub client: Option<String>,
2085    /// Arbitrary version identifier for the API client.
2086    #[serde(rename = "clientVersion")]
2087    pub client_version: Option<String>,
2088    /// Output only. The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the WorkerPool does not reach its Serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
2089    pub conditions: Option<Vec<GoogleCloudRunV2Condition>>,
2090    /// Output only. The creation time.
2091    #[serde(rename = "createTime")]
2092    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2093    /// Output only. Email address of the authenticated creator.
2094    pub creator: Option<String>,
2095    /// Not supported, and ignored by Cloud Run.
2096    #[serde(rename = "customAudiences")]
2097    pub custom_audiences: Option<Vec<String>>,
2098    /// Output only. The deletion time. It is only populated as a response to a Delete request.
2099    #[serde(rename = "deleteTime")]
2100    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2101    /// User-provided description of the WorkerPool. This field currently has a 512-character limit.
2102    pub description: Option<String>,
2103    /// Optional. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
2104    pub etag: Option<String>,
2105    /// Output only. For a deleted resource, the time after which it will be permamently deleted.
2106    #[serde(rename = "expireTime")]
2107    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2108    /// Output only. A number that monotonically increases every time the user modifies the desired state. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
2109    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2110    pub generation: Option<i64>,
2111    /// Output only. Detailed status information for corresponding instance splits. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
2112    #[serde(rename = "instanceSplitStatuses")]
2113    pub instance_split_statuses: Option<Vec<GoogleCloudRunV2InstanceSplitStatus>>,
2114    /// Optional. Specifies how to distribute instances over a collection of Revisions belonging to the WorkerPool. If instance split is empty or not provided, defaults to 100% instances assigned to the latest `Ready` Revision.
2115    #[serde(rename = "instanceSplits")]
2116    pub instance_splits: Option<Vec<GoogleCloudRunV2InstanceSplit>>,
2117    /// Optional. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 WorkerPool.
2118    pub labels: Option<HashMap<String, String>>,
2119    /// Output only. Email address of the last authenticated modifier.
2120    #[serde(rename = "lastModifier")]
2121    pub last_modifier: Option<String>,
2122    /// Output only. Name of the last created revision. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
2123    #[serde(rename = "latestCreatedRevision")]
2124    pub latest_created_revision: Option<String>,
2125    /// Output only. Name of the latest revision that is serving workloads. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
2126    #[serde(rename = "latestReadyRevision")]
2127    pub latest_ready_revision: Option<String>,
2128    /// Optional. The launch stage as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output.
2129    #[serde(rename = "launchStage")]
2130    pub launch_stage: Option<String>,
2131    /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest, this field is ignored, and instead composed from CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id. Format: `projects/{project}/locations/{location}/workerPools/{worker_id}`
2132    pub name: Option<String>,
2133    /// Output only. The generation of this WorkerPool currently serving workloads. See comments in `reconciling` for additional information on reconciliation process in Cloud Run. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a `string` instead of an `integer`.
2134    #[serde(rename = "observedGeneration")]
2135    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2136    pub observed_generation: Option<i64>,
2137    /// Output only. Returns true if the WorkerPool is currently being acted upon by the system to bring it into the desired state. When a new WorkerPool is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the WorkerPool to the desired serving state. This process is called reconciliation. While reconciliation is in process, `observed_generation`, `latest_ready_revison`, `instance_split_statuses`, and `uri` will have transient values that might mismatch the intended state: Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the serving state matches the WorkerPool, or there was an error, and reconciliation failed. This state can be found in `terminal_condition.state`. If reconciliation succeeded, the following fields will match: `instance_splits` and `instance_split_statuses`, `observed_generation` and `generation`, `latest_ready_revision` and `latest_created_revision`. If reconciliation failed, `instance_split_statuses`, `observed_generation`, and `latest_ready_revision` will have the state of the last serving revision, or empty for newly created WorkerPools. Additional information on the failure can be found in `terminal_condition` and `conditions`.
2138    pub reconciling: Option<bool>,
2139    /// Output only. Reserved for future use.
2140    #[serde(rename = "satisfiesPzs")]
2141    pub satisfies_pzs: Option<bool>,
2142    /// Optional. Specifies worker-pool-level scaling settings
2143    pub scaling: Option<GoogleCloudRunV2WorkerPoolScaling>,
2144    /// Required. The template used to create revisions for this WorkerPool.
2145    pub template: Option<GoogleCloudRunV2WorkerPoolRevisionTemplate>,
2146    /// Output only. The Condition of this WorkerPool, containing its readiness status, and detailed error information in case it did not reach a serving state. See comments in `reconciling` for additional information on reconciliation process in Cloud Run.
2147    #[serde(rename = "terminalCondition")]
2148    pub terminal_condition: Option<GoogleCloudRunV2Condition>,
2149    /// Output only. Indicates whether Cloud Run Threat Detection monitoring is enabled for the parent project of this worker pool.
2150    #[serde(rename = "threatDetectionEnabled")]
2151    pub threat_detection_enabled: Option<bool>,
2152    /// Output only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
2153    pub uid: Option<String>,
2154    /// Output only. The last-modified time.
2155    #[serde(rename = "updateTime")]
2156    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2157}
2158
2159impl common::RequestValue for GoogleCloudRunV2WorkerPool {}
2160impl common::ResponseResult for GoogleCloudRunV2WorkerPool {}
2161
2162/// WorkerPoolRevisionTemplate describes the data a worker pool revision should have when created from a template.
2163///
2164/// This type is not used in any activity, and only used as *part* of another schema.
2165///
2166#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2167#[serde_with::serde_as]
2168#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2169pub struct GoogleCloudRunV2WorkerPoolRevisionTemplate {
2170    /// Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. Cloud Run API v2 does not support annotations with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system annotations in v1 now have a corresponding field in v2 WorkerPoolRevisionTemplate. This field follows Kubernetes annotations' namespacing, limits, and rules.
2171    pub annotations: Option<HashMap<String, String>>,
2172    /// Holds list of the containers that defines the unit of execution for this Revision.
2173    pub containers: Option<Vec<GoogleCloudRunV2Container>>,
2174    /// A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
2175    #[serde(rename = "encryptionKey")]
2176    pub encryption_key: Option<String>,
2177    /// Optional. The action to take if the encryption key is revoked.
2178    #[serde(rename = "encryptionKeyRevocationAction")]
2179    pub encryption_key_revocation_action: Option<String>,
2180    /// Optional. If encryption_key_revocation_action is SHUTDOWN, the duration before shutting down all instances. The minimum increment is 1 hour.
2181    #[serde(rename = "encryptionKeyShutdownDuration")]
2182    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2183    pub encryption_key_shutdown_duration: Option<chrono::Duration>,
2184    /// Optional. True if GPU zonal redundancy is disabled on this worker pool.
2185    #[serde(rename = "gpuZonalRedundancyDisabled")]
2186    pub gpu_zonal_redundancy_disabled: Option<bool>,
2187    /// Optional. Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with `run.googleapis.com`, `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev` namespaces, and they will be rejected. All system labels in v1 now have a corresponding field in v2 WorkerPoolRevisionTemplate.
2188    pub labels: Option<HashMap<String, String>>,
2189    /// Optional. The node selector for the revision template.
2190    #[serde(rename = "nodeSelector")]
2191    pub node_selector: Option<GoogleCloudRunV2NodeSelector>,
2192    /// Optional. The unique name for the revision. If this field is omitted, it will be automatically generated based on the WorkerPool name.
2193    pub revision: Option<String>,
2194    /// Optional. Email address of the IAM service account associated with the revision of the service. The service account represents the identity of the running revision, and determines what permissions the revision has. If not provided, the revision will use the project's default service account.
2195    #[serde(rename = "serviceAccount")]
2196    pub service_account: Option<String>,
2197    /// Optional. Enables service mesh connectivity.
2198    #[serde(rename = "serviceMesh")]
2199    pub service_mesh: Option<GoogleCloudRunV2ServiceMesh>,
2200    /// Optional. A list of Volumes to make available to containers.
2201    pub volumes: Option<Vec<GoogleCloudRunV2Volume>>,
2202    /// Optional. VPC Access configuration to use for this Revision. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
2203    #[serde(rename = "vpcAccess")]
2204    pub vpc_access: Option<GoogleCloudRunV2VpcAccess>,
2205}
2206
2207impl common::Part for GoogleCloudRunV2WorkerPoolRevisionTemplate {}
2208
2209/// Worker pool scaling settings.
2210///
2211/// This type is not used in any activity, and only used as *part* of another schema.
2212///
2213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2214#[serde_with::serde_as]
2215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2216pub struct GoogleCloudRunV2WorkerPoolScaling {
2217    /// Optional. The total number of instances in manual scaling mode.
2218    #[serde(rename = "manualInstanceCount")]
2219    pub manual_instance_count: Option<i32>,
2220}
2221
2222impl common::Part for GoogleCloudRunV2WorkerPoolScaling {}
2223
2224/// 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.
2225///
2226/// This type is not used in any activity, and only used as *part* of another schema.
2227///
2228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2229#[serde_with::serde_as]
2230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2231pub struct GoogleIamV1AuditConfig {
2232    /// The configuration for logging of each type of permission.
2233    #[serde(rename = "auditLogConfigs")]
2234    pub audit_log_configs: Option<Vec<GoogleIamV1AuditLogConfig>>,
2235    /// 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.
2236    pub service: Option<String>,
2237}
2238
2239impl common::Part for GoogleIamV1AuditConfig {}
2240
2241/// 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.
2242///
2243/// This type is not used in any activity, and only used as *part* of another schema.
2244///
2245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2246#[serde_with::serde_as]
2247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2248pub struct GoogleIamV1AuditLogConfig {
2249    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
2250    #[serde(rename = "exemptedMembers")]
2251    pub exempted_members: Option<Vec<String>>,
2252    /// The log type that this config enables.
2253    #[serde(rename = "logType")]
2254    pub log_type: Option<String>,
2255}
2256
2257impl common::Part for GoogleIamV1AuditLogConfig {}
2258
2259/// Associates `members`, or principals, with a `role`.
2260///
2261/// This type is not used in any activity, and only used as *part* of another schema.
2262///
2263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2264#[serde_with::serde_as]
2265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2266pub struct GoogleIamV1Binding {
2267    /// 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).
2268    pub condition: Option<GoogleTypeExpr>,
2269    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
2270    pub members: Option<Vec<String>>,
2271    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
2272    pub role: Option<String>,
2273}
2274
2275impl common::Part for GoogleIamV1Binding {}
2276
2277/// 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/).
2278///
2279/// # Activities
2280///
2281/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2282/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2283///
2284/// * [locations jobs get iam policy projects](ProjectLocationJobGetIamPolicyCall) (response)
2285/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (response)
2286/// * [locations services get iam policy projects](ProjectLocationServiceGetIamPolicyCall) (response)
2287/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (response)
2288/// * [locations worker pools get iam policy projects](ProjectLocationWorkerPoolGetIamPolicyCall) (response)
2289/// * [locations worker pools set iam policy projects](ProjectLocationWorkerPoolSetIamPolicyCall) (response)
2290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2291#[serde_with::serde_as]
2292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2293pub struct GoogleIamV1Policy {
2294    /// Specifies cloud audit logging configuration for this policy.
2295    #[serde(rename = "auditConfigs")]
2296    pub audit_configs: Option<Vec<GoogleIamV1AuditConfig>>,
2297    /// 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`.
2298    pub bindings: Option<Vec<GoogleIamV1Binding>>,
2299    /// `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.
2300    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2301    pub etag: Option<Vec<u8>>,
2302    /// 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).
2303    pub version: Option<i32>,
2304}
2305
2306impl common::ResponseResult for GoogleIamV1Policy {}
2307
2308/// Request message for `SetIamPolicy` method.
2309///
2310/// # Activities
2311///
2312/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2313/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2314///
2315/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (request)
2316/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (request)
2317/// * [locations worker pools set iam policy projects](ProjectLocationWorkerPoolSetIamPolicyCall) (request)
2318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2319#[serde_with::serde_as]
2320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2321pub struct GoogleIamV1SetIamPolicyRequest {
2322    /// 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.
2323    pub policy: Option<GoogleIamV1Policy>,
2324    /// 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"`
2325    #[serde(rename = "updateMask")]
2326    pub update_mask: Option<common::FieldMask>,
2327}
2328
2329impl common::RequestValue for GoogleIamV1SetIamPolicyRequest {}
2330
2331/// Request message for `TestIamPermissions` method.
2332///
2333/// # Activities
2334///
2335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2337///
2338/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (request)
2339/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (request)
2340/// * [locations worker pools test iam permissions projects](ProjectLocationWorkerPoolTestIamPermissionCall) (request)
2341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2342#[serde_with::serde_as]
2343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2344pub struct GoogleIamV1TestIamPermissionsRequest {
2345    /// 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).
2346    pub permissions: Option<Vec<String>>,
2347}
2348
2349impl common::RequestValue for GoogleIamV1TestIamPermissionsRequest {}
2350
2351/// Response message for `TestIamPermissions` method.
2352///
2353/// # Activities
2354///
2355/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2356/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2357///
2358/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (response)
2359/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (response)
2360/// * [locations worker pools test iam permissions projects](ProjectLocationWorkerPoolTestIamPermissionCall) (response)
2361#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2362#[serde_with::serde_as]
2363#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2364pub struct GoogleIamV1TestIamPermissionsResponse {
2365    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2366    pub permissions: Option<Vec<String>>,
2367}
2368
2369impl common::ResponseResult for GoogleIamV1TestIamPermissionsResponse {}
2370
2371/// The response message for Operations.ListOperations.
2372///
2373/// # Activities
2374///
2375/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2376/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2377///
2378/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
2379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2380#[serde_with::serde_as]
2381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2382pub struct GoogleLongrunningListOperationsResponse {
2383    /// The standard List next-page token.
2384    #[serde(rename = "nextPageToken")]
2385    pub next_page_token: Option<String>,
2386    /// A list of operations that matches the specified filter in the request.
2387    pub operations: Option<Vec<GoogleLongrunningOperation>>,
2388    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
2389    pub unreachable: Option<Vec<String>>,
2390}
2391
2392impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
2393
2394/// This resource represents a long-running operation that is the result of a network API call.
2395///
2396/// # Activities
2397///
2398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2400///
2401/// * [locations jobs executions cancel projects](ProjectLocationJobExecutionCancelCall) (response)
2402/// * [locations jobs executions delete projects](ProjectLocationJobExecutionDeleteCall) (response)
2403/// * [locations jobs create projects](ProjectLocationJobCreateCall) (response)
2404/// * [locations jobs delete projects](ProjectLocationJobDeleteCall) (response)
2405/// * [locations jobs patch projects](ProjectLocationJobPatchCall) (response)
2406/// * [locations jobs run projects](ProjectLocationJobRunCall) (response)
2407/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2408/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (response)
2409/// * [locations services revisions delete projects](ProjectLocationServiceRevisionDeleteCall) (response)
2410/// * [locations services create projects](ProjectLocationServiceCreateCall) (response)
2411/// * [locations services delete projects](ProjectLocationServiceDeleteCall) (response)
2412/// * [locations services patch projects](ProjectLocationServicePatchCall) (response)
2413/// * [locations worker pools revisions delete projects](ProjectLocationWorkerPoolRevisionDeleteCall) (response)
2414/// * [locations worker pools create projects](ProjectLocationWorkerPoolCreateCall) (response)
2415/// * [locations worker pools delete projects](ProjectLocationWorkerPoolDeleteCall) (response)
2416/// * [locations worker pools patch projects](ProjectLocationWorkerPoolPatchCall) (response)
2417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2418#[serde_with::serde_as]
2419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2420pub struct GoogleLongrunningOperation {
2421    /// 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.
2422    pub done: Option<bool>,
2423    /// The error result of the operation in case of failure or cancellation.
2424    pub error: Option<GoogleRpcStatus>,
2425    /// 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.
2426    pub metadata: Option<HashMap<String, serde_json::Value>>,
2427    /// 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}`.
2428    pub name: Option<String>,
2429    /// The normal, successful response of the operation. 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`.
2430    pub response: Option<HashMap<String, serde_json::Value>>,
2431}
2432
2433impl common::ResponseResult for GoogleLongrunningOperation {}
2434
2435/// The request message for Operations.WaitOperation.
2436///
2437/// # Activities
2438///
2439/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2440/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2441///
2442/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (request)
2443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2444#[serde_with::serde_as]
2445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2446pub struct GoogleLongrunningWaitOperationRequest {
2447    /// The maximum duration to wait before timing out. If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol. If RPC context deadline is also specified, the shorter one will be used.
2448    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2449    pub timeout: Option<chrono::Duration>,
2450}
2451
2452impl common::RequestValue for GoogleLongrunningWaitOperationRequest {}
2453
2454/// 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); }
2455///
2456/// # Activities
2457///
2458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2460///
2461/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
2462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2463#[serde_with::serde_as]
2464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2465pub struct GoogleProtobufEmpty {
2466    _never_set: Option<bool>,
2467}
2468
2469impl common::ResponseResult for GoogleProtobufEmpty {}
2470
2471/// 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).
2472///
2473/// This type is not used in any activity, and only used as *part* of another schema.
2474///
2475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2476#[serde_with::serde_as]
2477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2478pub struct GoogleRpcStatus {
2479    /// The status code, which should be an enum value of google.rpc.Code.
2480    pub code: Option<i32>,
2481    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2482    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2483    /// 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.
2484    pub message: Option<String>,
2485}
2486
2487impl common::Part for GoogleRpcStatus {}
2488
2489/// 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.
2490///
2491/// This type is not used in any activity, and only used as *part* of another schema.
2492///
2493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2494#[serde_with::serde_as]
2495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2496pub struct GoogleTypeExpr {
2497    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
2498    pub description: Option<String>,
2499    /// Textual representation of an expression in Common Expression Language syntax.
2500    pub expression: Option<String>,
2501    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
2502    pub location: Option<String>,
2503    /// 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.
2504    pub title: Option<String>,
2505}
2506
2507impl common::Part for GoogleTypeExpr {}
2508
2509/// This is proto2's version of MessageSet. DEPRECATED: DO NOT USE FOR NEW FIELDS. If you are using editions or proto2, please make your own extendable messages for your use case. If you are using proto3, please use `Any` instead. MessageSet was the implementation of extensions for proto1. When proto2 was introduced, extensions were implemented as a first-class feature. This schema for MessageSet was meant to be a "bridge" solution to migrate MessageSet-bearing messages from proto1 to proto2. This schema has been open-sourced only to facilitate the migration of Google products with MessageSet-bearing messages to open-source environments.
2510///
2511/// This type is not used in any activity, and only used as *part* of another schema.
2512///
2513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2514#[serde_with::serde_as]
2515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2516pub struct Proto2BridgeMessageSet {
2517    _never_set: Option<bool>,
2518}
2519
2520impl common::Part for Proto2BridgeMessageSet {}
2521
2522/// Wire-format for a Status object
2523///
2524/// This type is not used in any activity, and only used as *part* of another schema.
2525///
2526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2527#[serde_with::serde_as]
2528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2529pub struct UtilStatusProto {
2530    /// copybara:strip_begin(b/383363683) copybara:strip_end_and_replace optional int32 canonical_code = 6;
2531    #[serde(rename = "canonicalCode")]
2532    pub canonical_code: Option<i32>,
2533    /// Numeric code drawn from the space specified below. Often, this is the canonical error space, and code is drawn from google3/util/task/codes.proto copybara:strip_begin(b/383363683) copybara:strip_end_and_replace optional int32 code = 1;
2534    pub code: Option<i32>,
2535    /// Detail message copybara:strip_begin(b/383363683) copybara:strip_end_and_replace optional string message = 3;
2536    pub message: Option<String>,
2537    /// message_set associates an arbitrary proto message with the status. copybara:strip_begin(b/383363683) copybara:strip_end_and_replace optional proto2.bridge.MessageSet message_set = 5;
2538    #[serde(rename = "messageSet")]
2539    pub message_set: Option<Proto2BridgeMessageSet>,
2540    /// copybara:strip_begin(b/383363683) Space to which this status belongs copybara:strip_end_and_replace optional string space = 2; // Space to which this status belongs
2541    pub space: Option<String>,
2542}
2543
2544impl common::Part for UtilStatusProto {}
2545
2546// ###################
2547// MethodBuilders ###
2548// #################
2549
2550/// A builder providing access to all methods supported on *project* resources.
2551/// It is not used directly, but through the [`CloudRun`] hub.
2552///
2553/// # Example
2554///
2555/// Instantiate a resource builder
2556///
2557/// ```test_harness,no_run
2558/// extern crate hyper;
2559/// extern crate hyper_rustls;
2560/// extern crate google_run2 as run2;
2561///
2562/// # async fn dox() {
2563/// use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2564///
2565/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2566/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2567///     .with_native_roots()
2568///     .unwrap()
2569///     .https_only()
2570///     .enable_http2()
2571///     .build();
2572///
2573/// let executor = hyper_util::rt::TokioExecutor::new();
2574/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2575///     secret,
2576///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2577///     yup_oauth2::client::CustomHyperClientBuilder::from(
2578///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2579///     ),
2580/// ).build().await.unwrap();
2581///
2582/// let client = hyper_util::client::legacy::Client::builder(
2583///     hyper_util::rt::TokioExecutor::new()
2584/// )
2585/// .build(
2586///     hyper_rustls::HttpsConnectorBuilder::new()
2587///         .with_native_roots()
2588///         .unwrap()
2589///         .https_or_http()
2590///         .enable_http2()
2591///         .build()
2592/// );
2593/// let mut hub = CloudRun::new(client, auth);
2594/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2595/// // like `locations_builds_submit(...)`, `locations_export_image(...)`, `locations_export_image_metadata(...)`, `locations_export_metadata(...)`, `locations_export_project_metadata(...)`, `locations_jobs_create(...)`, `locations_jobs_delete(...)`, `locations_jobs_executions_cancel(...)`, `locations_jobs_executions_delete(...)`, `locations_jobs_executions_export_status(...)`, `locations_jobs_executions_get(...)`, `locations_jobs_executions_list(...)`, `locations_jobs_executions_tasks_get(...)`, `locations_jobs_executions_tasks_list(...)`, `locations_jobs_get(...)`, `locations_jobs_get_iam_policy(...)`, `locations_jobs_list(...)`, `locations_jobs_patch(...)`, `locations_jobs_run(...)`, `locations_jobs_set_iam_policy(...)`, `locations_jobs_test_iam_permissions(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_operations_wait(...)`, `locations_services_create(...)`, `locations_services_delete(...)`, `locations_services_get(...)`, `locations_services_get_iam_policy(...)`, `locations_services_list(...)`, `locations_services_patch(...)`, `locations_services_revisions_delete(...)`, `locations_services_revisions_export_status(...)`, `locations_services_revisions_get(...)`, `locations_services_revisions_list(...)`, `locations_services_set_iam_policy(...)`, `locations_services_test_iam_permissions(...)`, `locations_worker_pools_create(...)`, `locations_worker_pools_delete(...)`, `locations_worker_pools_get(...)`, `locations_worker_pools_get_iam_policy(...)`, `locations_worker_pools_list(...)`, `locations_worker_pools_patch(...)`, `locations_worker_pools_revisions_delete(...)`, `locations_worker_pools_revisions_get(...)`, `locations_worker_pools_revisions_list(...)`, `locations_worker_pools_set_iam_policy(...)` and `locations_worker_pools_test_iam_permissions(...)`
2596/// // to build up your call.
2597/// let rb = hub.projects();
2598/// # }
2599/// ```
2600pub struct ProjectMethods<'a, C>
2601where
2602    C: 'a,
2603{
2604    hub: &'a CloudRun<C>,
2605}
2606
2607impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2608
2609impl<'a, C> ProjectMethods<'a, C> {
2610    /// Create a builder to help you perform the following task:
2611    ///
2612    /// Submits a build in a given project.
2613    ///
2614    /// # Arguments
2615    ///
2616    /// * `request` - No description provided.
2617    /// * `parent` - Required. The project and location to build in. Location must be a region, e.g., 'us-central1' or 'global' if the global builder is to be used. Format: `projects/{project}/locations/{location}`
2618    pub fn locations_builds_submit(
2619        &self,
2620        request: GoogleCloudRunV2SubmitBuildRequest,
2621        parent: &str,
2622    ) -> ProjectLocationBuildSubmitCall<'a, C> {
2623        ProjectLocationBuildSubmitCall {
2624            hub: self.hub,
2625            _request: request,
2626            _parent: parent.to_string(),
2627            _delegate: Default::default(),
2628            _additional_params: Default::default(),
2629            _scopes: Default::default(),
2630        }
2631    }
2632
2633    /// Create a builder to help you perform the following task:
2634    ///
2635    /// Gets information about a Task.
2636    ///
2637    /// # Arguments
2638    ///
2639    /// * `name` - Required. The full name of the Task. Format: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
2640    pub fn locations_jobs_executions_tasks_get(
2641        &self,
2642        name: &str,
2643    ) -> ProjectLocationJobExecutionTaskGetCall<'a, C> {
2644        ProjectLocationJobExecutionTaskGetCall {
2645            hub: self.hub,
2646            _name: name.to_string(),
2647            _delegate: Default::default(),
2648            _additional_params: Default::default(),
2649            _scopes: Default::default(),
2650        }
2651    }
2652
2653    /// Create a builder to help you perform the following task:
2654    ///
2655    /// Lists Tasks from an Execution of a Job.
2656    ///
2657    /// # Arguments
2658    ///
2659    /// * `parent` - Required. The Execution from which the Tasks should be listed. To list all Tasks across Executions of a Job, use "-" instead of Execution name. To list all Tasks across Jobs, use "-" instead of Job name. Format: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
2660    pub fn locations_jobs_executions_tasks_list(
2661        &self,
2662        parent: &str,
2663    ) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
2664        ProjectLocationJobExecutionTaskListCall {
2665            hub: self.hub,
2666            _parent: parent.to_string(),
2667            _show_deleted: Default::default(),
2668            _page_token: Default::default(),
2669            _page_size: Default::default(),
2670            _delegate: Default::default(),
2671            _additional_params: Default::default(),
2672            _scopes: Default::default(),
2673        }
2674    }
2675
2676    /// Create a builder to help you perform the following task:
2677    ///
2678    /// Cancels an Execution.
2679    ///
2680    /// # Arguments
2681    ///
2682    /// * `request` - No description provided.
2683    /// * `name` - Required. The name of the Execution to cancel. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
2684    pub fn locations_jobs_executions_cancel(
2685        &self,
2686        request: GoogleCloudRunV2CancelExecutionRequest,
2687        name: &str,
2688    ) -> ProjectLocationJobExecutionCancelCall<'a, C> {
2689        ProjectLocationJobExecutionCancelCall {
2690            hub: self.hub,
2691            _request: request,
2692            _name: name.to_string(),
2693            _delegate: Default::default(),
2694            _additional_params: Default::default(),
2695            _scopes: Default::default(),
2696        }
2697    }
2698
2699    /// Create a builder to help you perform the following task:
2700    ///
2701    /// Deletes an Execution.
2702    ///
2703    /// # Arguments
2704    ///
2705    /// * `name` - Required. The name of the Execution to delete. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
2706    pub fn locations_jobs_executions_delete(
2707        &self,
2708        name: &str,
2709    ) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
2710        ProjectLocationJobExecutionDeleteCall {
2711            hub: self.hub,
2712            _name: name.to_string(),
2713            _validate_only: Default::default(),
2714            _etag: Default::default(),
2715            _delegate: Default::default(),
2716            _additional_params: Default::default(),
2717            _scopes: Default::default(),
2718        }
2719    }
2720
2721    /// Create a builder to help you perform the following task:
2722    ///
2723    /// Read the status of an image export operation.
2724    ///
2725    /// # Arguments
2726    ///
2727    /// * `name` - Required. The name of the resource of which image export operation status has to be fetched. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
2728    /// * `operationId` - Required. The operation id returned from ExportImage.
2729    pub fn locations_jobs_executions_export_status(
2730        &self,
2731        name: &str,
2732        operation_id: &str,
2733    ) -> ProjectLocationJobExecutionExportStatuCall<'a, C> {
2734        ProjectLocationJobExecutionExportStatuCall {
2735            hub: self.hub,
2736            _name: name.to_string(),
2737            _operation_id: operation_id.to_string(),
2738            _delegate: Default::default(),
2739            _additional_params: Default::default(),
2740            _scopes: Default::default(),
2741        }
2742    }
2743
2744    /// Create a builder to help you perform the following task:
2745    ///
2746    /// Gets information about an Execution.
2747    ///
2748    /// # Arguments
2749    ///
2750    /// * `name` - Required. The full name of the Execution. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
2751    pub fn locations_jobs_executions_get(
2752        &self,
2753        name: &str,
2754    ) -> ProjectLocationJobExecutionGetCall<'a, C> {
2755        ProjectLocationJobExecutionGetCall {
2756            hub: self.hub,
2757            _name: name.to_string(),
2758            _delegate: Default::default(),
2759            _additional_params: Default::default(),
2760            _scopes: Default::default(),
2761        }
2762    }
2763
2764    /// Create a builder to help you perform the following task:
2765    ///
2766    /// Lists Executions from a Job. Results are sorted by creation time, descending.
2767    ///
2768    /// # Arguments
2769    ///
2770    /// * `parent` - Required. The Execution from which the Executions should be listed. To list all Executions across Jobs, use "-" instead of Job name. Format: `projects/{project}/locations/{location}/jobs/{job}`, where `{project}` can be project id or number.
2771    pub fn locations_jobs_executions_list(
2772        &self,
2773        parent: &str,
2774    ) -> ProjectLocationJobExecutionListCall<'a, C> {
2775        ProjectLocationJobExecutionListCall {
2776            hub: self.hub,
2777            _parent: parent.to_string(),
2778            _show_deleted: Default::default(),
2779            _page_token: Default::default(),
2780            _page_size: Default::default(),
2781            _delegate: Default::default(),
2782            _additional_params: Default::default(),
2783            _scopes: Default::default(),
2784        }
2785    }
2786
2787    /// Create a builder to help you perform the following task:
2788    ///
2789    /// Creates a Job.
2790    ///
2791    /// # Arguments
2792    ///
2793    /// * `request` - No description provided.
2794    /// * `parent` - Required. The location and project in which this Job should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
2795    pub fn locations_jobs_create(
2796        &self,
2797        request: GoogleCloudRunV2Job,
2798        parent: &str,
2799    ) -> ProjectLocationJobCreateCall<'a, C> {
2800        ProjectLocationJobCreateCall {
2801            hub: self.hub,
2802            _request: request,
2803            _parent: parent.to_string(),
2804            _validate_only: Default::default(),
2805            _job_id: Default::default(),
2806            _delegate: Default::default(),
2807            _additional_params: Default::default(),
2808            _scopes: Default::default(),
2809        }
2810    }
2811
2812    /// Create a builder to help you perform the following task:
2813    ///
2814    /// Deletes a Job.
2815    ///
2816    /// # Arguments
2817    ///
2818    /// * `name` - Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
2819    pub fn locations_jobs_delete(&self, name: &str) -> ProjectLocationJobDeleteCall<'a, C> {
2820        ProjectLocationJobDeleteCall {
2821            hub: self.hub,
2822            _name: name.to_string(),
2823            _validate_only: Default::default(),
2824            _etag: Default::default(),
2825            _delegate: Default::default(),
2826            _additional_params: Default::default(),
2827            _scopes: Default::default(),
2828        }
2829    }
2830
2831    /// Create a builder to help you perform the following task:
2832    ///
2833    /// Gets information about a Job.
2834    ///
2835    /// # Arguments
2836    ///
2837    /// * `name` - Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
2838    pub fn locations_jobs_get(&self, name: &str) -> ProjectLocationJobGetCall<'a, C> {
2839        ProjectLocationJobGetCall {
2840            hub: self.hub,
2841            _name: name.to_string(),
2842            _delegate: Default::default(),
2843            _additional_params: Default::default(),
2844            _scopes: Default::default(),
2845        }
2846    }
2847
2848    /// Create a builder to help you perform the following task:
2849    ///
2850    /// Gets the IAM Access Control policy currently in effect for the given Job. This result does not include any inherited policies.
2851    ///
2852    /// # Arguments
2853    ///
2854    /// * `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.
2855    pub fn locations_jobs_get_iam_policy(
2856        &self,
2857        resource: &str,
2858    ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
2859        ProjectLocationJobGetIamPolicyCall {
2860            hub: self.hub,
2861            _resource: resource.to_string(),
2862            _options_requested_policy_version: Default::default(),
2863            _delegate: Default::default(),
2864            _additional_params: Default::default(),
2865            _scopes: Default::default(),
2866        }
2867    }
2868
2869    /// Create a builder to help you perform the following task:
2870    ///
2871    /// Lists Jobs. Results are sorted by creation time, descending.
2872    ///
2873    /// # Arguments
2874    ///
2875    /// * `parent` - Required. The location and project to list resources on. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
2876    pub fn locations_jobs_list(&self, parent: &str) -> ProjectLocationJobListCall<'a, C> {
2877        ProjectLocationJobListCall {
2878            hub: self.hub,
2879            _parent: parent.to_string(),
2880            _show_deleted: Default::default(),
2881            _page_token: Default::default(),
2882            _page_size: Default::default(),
2883            _delegate: Default::default(),
2884            _additional_params: Default::default(),
2885            _scopes: Default::default(),
2886        }
2887    }
2888
2889    /// Create a builder to help you perform the following task:
2890    ///
2891    /// Updates a Job.
2892    ///
2893    /// # Arguments
2894    ///
2895    /// * `request` - No description provided.
2896    /// * `name` - The fully qualified name of this Job. Format: projects/{project}/locations/{location}/jobs/{job}
2897    pub fn locations_jobs_patch(
2898        &self,
2899        request: GoogleCloudRunV2Job,
2900        name: &str,
2901    ) -> ProjectLocationJobPatchCall<'a, C> {
2902        ProjectLocationJobPatchCall {
2903            hub: self.hub,
2904            _request: request,
2905            _name: name.to_string(),
2906            _validate_only: Default::default(),
2907            _allow_missing: Default::default(),
2908            _delegate: Default::default(),
2909            _additional_params: Default::default(),
2910            _scopes: Default::default(),
2911        }
2912    }
2913
2914    /// Create a builder to help you perform the following task:
2915    ///
2916    /// Triggers creation of a new Execution of this Job.
2917    ///
2918    /// # Arguments
2919    ///
2920    /// * `request` - No description provided.
2921    /// * `name` - Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
2922    pub fn locations_jobs_run(
2923        &self,
2924        request: GoogleCloudRunV2RunJobRequest,
2925        name: &str,
2926    ) -> ProjectLocationJobRunCall<'a, C> {
2927        ProjectLocationJobRunCall {
2928            hub: self.hub,
2929            _request: request,
2930            _name: name.to_string(),
2931            _delegate: Default::default(),
2932            _additional_params: Default::default(),
2933            _scopes: Default::default(),
2934        }
2935    }
2936
2937    /// Create a builder to help you perform the following task:
2938    ///
2939    /// Sets the IAM Access control policy for the specified Job. Overwrites any existing policy.
2940    ///
2941    /// # Arguments
2942    ///
2943    /// * `request` - No description provided.
2944    /// * `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.
2945    pub fn locations_jobs_set_iam_policy(
2946        &self,
2947        request: GoogleIamV1SetIamPolicyRequest,
2948        resource: &str,
2949    ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
2950        ProjectLocationJobSetIamPolicyCall {
2951            hub: self.hub,
2952            _request: request,
2953            _resource: resource.to_string(),
2954            _delegate: Default::default(),
2955            _additional_params: Default::default(),
2956            _scopes: Default::default(),
2957        }
2958    }
2959
2960    /// Create a builder to help you perform the following task:
2961    ///
2962    /// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
2963    ///
2964    /// # Arguments
2965    ///
2966    /// * `request` - No description provided.
2967    /// * `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.
2968    pub fn locations_jobs_test_iam_permissions(
2969        &self,
2970        request: GoogleIamV1TestIamPermissionsRequest,
2971        resource: &str,
2972    ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
2973        ProjectLocationJobTestIamPermissionCall {
2974            hub: self.hub,
2975            _request: request,
2976            _resource: resource.to_string(),
2977            _delegate: Default::default(),
2978            _additional_params: Default::default(),
2979            _scopes: Default::default(),
2980        }
2981    }
2982
2983    /// Create a builder to help you perform the following task:
2984    ///
2985    /// 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`.
2986    ///
2987    /// # Arguments
2988    ///
2989    /// * `name` - The name of the operation resource to be deleted.
2990    pub fn locations_operations_delete(
2991        &self,
2992        name: &str,
2993    ) -> ProjectLocationOperationDeleteCall<'a, C> {
2994        ProjectLocationOperationDeleteCall {
2995            hub: self.hub,
2996            _name: name.to_string(),
2997            _delegate: Default::default(),
2998            _additional_params: Default::default(),
2999            _scopes: Default::default(),
3000        }
3001    }
3002
3003    /// Create a builder to help you perform the following task:
3004    ///
3005    /// 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.
3006    ///
3007    /// # Arguments
3008    ///
3009    /// * `name` - The name of the operation resource.
3010    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3011        ProjectLocationOperationGetCall {
3012            hub: self.hub,
3013            _name: name.to_string(),
3014            _delegate: Default::default(),
3015            _additional_params: Default::default(),
3016            _scopes: Default::default(),
3017        }
3018    }
3019
3020    /// Create a builder to help you perform the following task:
3021    ///
3022    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3023    ///
3024    /// # Arguments
3025    ///
3026    /// * `name` - Required. To query for all of the operations for a project.
3027    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3028        ProjectLocationOperationListCall {
3029            hub: self.hub,
3030            _name: name.to_string(),
3031            _return_partial_success: Default::default(),
3032            _page_token: Default::default(),
3033            _page_size: Default::default(),
3034            _filter: Default::default(),
3035            _delegate: Default::default(),
3036            _additional_params: Default::default(),
3037            _scopes: Default::default(),
3038        }
3039    }
3040
3041    /// Create a builder to help you perform the following task:
3042    ///
3043    /// Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
3044    ///
3045    /// # Arguments
3046    ///
3047    /// * `request` - No description provided.
3048    /// * `name` - The name of the operation resource to wait on.
3049    pub fn locations_operations_wait(
3050        &self,
3051        request: GoogleLongrunningWaitOperationRequest,
3052        name: &str,
3053    ) -> ProjectLocationOperationWaitCall<'a, C> {
3054        ProjectLocationOperationWaitCall {
3055            hub: self.hub,
3056            _request: request,
3057            _name: name.to_string(),
3058            _delegate: Default::default(),
3059            _additional_params: Default::default(),
3060            _scopes: Default::default(),
3061        }
3062    }
3063
3064    /// Create a builder to help you perform the following task:
3065    ///
3066    /// Deletes a Revision.
3067    ///
3068    /// # Arguments
3069    ///
3070    /// * `name` - Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
3071    pub fn locations_services_revisions_delete(
3072        &self,
3073        name: &str,
3074    ) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
3075        ProjectLocationServiceRevisionDeleteCall {
3076            hub: self.hub,
3077            _name: name.to_string(),
3078            _validate_only: Default::default(),
3079            _etag: Default::default(),
3080            _delegate: Default::default(),
3081            _additional_params: Default::default(),
3082            _scopes: Default::default(),
3083        }
3084    }
3085
3086    /// Create a builder to help you perform the following task:
3087    ///
3088    /// Read the status of an image export operation.
3089    ///
3090    /// # Arguments
3091    ///
3092    /// * `name` - Required. The name of the resource of which image export operation status has to be fetched. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
3093    /// * `operationId` - Required. The operation id returned from ExportImage.
3094    pub fn locations_services_revisions_export_status(
3095        &self,
3096        name: &str,
3097        operation_id: &str,
3098    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C> {
3099        ProjectLocationServiceRevisionExportStatuCall {
3100            hub: self.hub,
3101            _name: name.to_string(),
3102            _operation_id: operation_id.to_string(),
3103            _delegate: Default::default(),
3104            _additional_params: Default::default(),
3105            _scopes: Default::default(),
3106        }
3107    }
3108
3109    /// Create a builder to help you perform the following task:
3110    ///
3111    /// Gets information about a Revision.
3112    ///
3113    /// # Arguments
3114    ///
3115    /// * `name` - Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
3116    pub fn locations_services_revisions_get(
3117        &self,
3118        name: &str,
3119    ) -> ProjectLocationServiceRevisionGetCall<'a, C> {
3120        ProjectLocationServiceRevisionGetCall {
3121            hub: self.hub,
3122            _name: name.to_string(),
3123            _delegate: Default::default(),
3124            _additional_params: Default::default(),
3125            _scopes: Default::default(),
3126        }
3127    }
3128
3129    /// Create a builder to help you perform the following task:
3130    ///
3131    /// Lists Revisions from a given Service, or from a given location. Results are sorted by creation time, descending.
3132    ///
3133    /// # Arguments
3134    ///
3135    /// * `parent` - Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service}
3136    pub fn locations_services_revisions_list(
3137        &self,
3138        parent: &str,
3139    ) -> ProjectLocationServiceRevisionListCall<'a, C> {
3140        ProjectLocationServiceRevisionListCall {
3141            hub: self.hub,
3142            _parent: parent.to_string(),
3143            _show_deleted: Default::default(),
3144            _page_token: Default::default(),
3145            _page_size: Default::default(),
3146            _delegate: Default::default(),
3147            _additional_params: Default::default(),
3148            _scopes: Default::default(),
3149        }
3150    }
3151
3152    /// Create a builder to help you perform the following task:
3153    ///
3154    /// Creates a new Service in a given project and location.
3155    ///
3156    /// # Arguments
3157    ///
3158    /// * `request` - No description provided.
3159    /// * `parent` - Required. The location and project in which this service should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number. Only lowercase characters, digits, and hyphens.
3160    pub fn locations_services_create(
3161        &self,
3162        request: GoogleCloudRunV2Service,
3163        parent: &str,
3164    ) -> ProjectLocationServiceCreateCall<'a, C> {
3165        ProjectLocationServiceCreateCall {
3166            hub: self.hub,
3167            _request: request,
3168            _parent: parent.to_string(),
3169            _validate_only: Default::default(),
3170            _service_id: Default::default(),
3171            _delegate: Default::default(),
3172            _additional_params: Default::default(),
3173            _scopes: Default::default(),
3174        }
3175    }
3176
3177    /// Create a builder to help you perform the following task:
3178    ///
3179    /// Deletes a Service. This will cause the Service to stop serving traffic and will delete all revisions.
3180    ///
3181    /// # Arguments
3182    ///
3183    /// * `name` - Required. The full name of the Service. Format: projects/{project}/locations/{location}/services/{service}, where {project} can be project id or number.
3184    pub fn locations_services_delete(&self, name: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
3185        ProjectLocationServiceDeleteCall {
3186            hub: self.hub,
3187            _name: name.to_string(),
3188            _validate_only: Default::default(),
3189            _etag: Default::default(),
3190            _delegate: Default::default(),
3191            _additional_params: Default::default(),
3192            _scopes: Default::default(),
3193        }
3194    }
3195
3196    /// Create a builder to help you perform the following task:
3197    ///
3198    /// Gets information about a Service.
3199    ///
3200    /// # Arguments
3201    ///
3202    /// * `name` - Required. The full name of the Service. Format: projects/{project}/locations/{location}/services/{service}, where {project} can be project id or number.
3203    pub fn locations_services_get(&self, name: &str) -> ProjectLocationServiceGetCall<'a, C> {
3204        ProjectLocationServiceGetCall {
3205            hub: self.hub,
3206            _name: name.to_string(),
3207            _delegate: Default::default(),
3208            _additional_params: Default::default(),
3209            _scopes: Default::default(),
3210        }
3211    }
3212
3213    /// Create a builder to help you perform the following task:
3214    ///
3215    /// Gets the IAM Access Control policy currently in effect for the given Cloud Run Service. This result does not include any inherited policies.
3216    ///
3217    /// # Arguments
3218    ///
3219    /// * `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.
3220    pub fn locations_services_get_iam_policy(
3221        &self,
3222        resource: &str,
3223    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
3224        ProjectLocationServiceGetIamPolicyCall {
3225            hub: self.hub,
3226            _resource: resource.to_string(),
3227            _options_requested_policy_version: Default::default(),
3228            _delegate: Default::default(),
3229            _additional_params: Default::default(),
3230            _scopes: Default::default(),
3231        }
3232    }
3233
3234    /// Create a builder to help you perform the following task:
3235    ///
3236    /// Lists Services. Results are sorted by creation time, descending.
3237    ///
3238    /// # Arguments
3239    ///
3240    /// * `parent` - Required. The location and project to list resources on. Location must be a valid Google Cloud region, and cannot be the "-" wildcard. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
3241    pub fn locations_services_list(&self, parent: &str) -> ProjectLocationServiceListCall<'a, C> {
3242        ProjectLocationServiceListCall {
3243            hub: self.hub,
3244            _parent: parent.to_string(),
3245            _show_deleted: Default::default(),
3246            _page_token: Default::default(),
3247            _page_size: Default::default(),
3248            _delegate: Default::default(),
3249            _additional_params: Default::default(),
3250            _scopes: Default::default(),
3251        }
3252    }
3253
3254    /// Create a builder to help you perform the following task:
3255    ///
3256    /// Updates a Service.
3257    ///
3258    /// # Arguments
3259    ///
3260    /// * `request` - No description provided.
3261    /// * `name` - Identifier. The fully qualified name of this Service. In CreateServiceRequest, this field is ignored, and instead composed from CreateServiceRequest.parent and CreateServiceRequest.service_id. Format: projects/{project}/locations/{location}/services/{service_id}
3262    pub fn locations_services_patch(
3263        &self,
3264        request: GoogleCloudRunV2Service,
3265        name: &str,
3266    ) -> ProjectLocationServicePatchCall<'a, C> {
3267        ProjectLocationServicePatchCall {
3268            hub: self.hub,
3269            _request: request,
3270            _name: name.to_string(),
3271            _validate_only: Default::default(),
3272            _update_mask: Default::default(),
3273            _allow_missing: Default::default(),
3274            _delegate: Default::default(),
3275            _additional_params: Default::default(),
3276            _scopes: Default::default(),
3277        }
3278    }
3279
3280    /// Create a builder to help you perform the following task:
3281    ///
3282    /// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
3283    ///
3284    /// # Arguments
3285    ///
3286    /// * `request` - No description provided.
3287    /// * `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.
3288    pub fn locations_services_set_iam_policy(
3289        &self,
3290        request: GoogleIamV1SetIamPolicyRequest,
3291        resource: &str,
3292    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
3293        ProjectLocationServiceSetIamPolicyCall {
3294            hub: self.hub,
3295            _request: request,
3296            _resource: resource.to_string(),
3297            _delegate: Default::default(),
3298            _additional_params: Default::default(),
3299            _scopes: Default::default(),
3300        }
3301    }
3302
3303    /// Create a builder to help you perform the following task:
3304    ///
3305    /// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
3306    ///
3307    /// # Arguments
3308    ///
3309    /// * `request` - No description provided.
3310    /// * `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.
3311    pub fn locations_services_test_iam_permissions(
3312        &self,
3313        request: GoogleIamV1TestIamPermissionsRequest,
3314        resource: &str,
3315    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
3316        ProjectLocationServiceTestIamPermissionCall {
3317            hub: self.hub,
3318            _request: request,
3319            _resource: resource.to_string(),
3320            _delegate: Default::default(),
3321            _additional_params: Default::default(),
3322            _scopes: Default::default(),
3323        }
3324    }
3325
3326    /// Create a builder to help you perform the following task:
3327    ///
3328    /// Deletes a Revision.
3329    ///
3330    /// # Arguments
3331    ///
3332    /// * `name` - Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
3333    pub fn locations_worker_pools_revisions_delete(
3334        &self,
3335        name: &str,
3336    ) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
3337        ProjectLocationWorkerPoolRevisionDeleteCall {
3338            hub: self.hub,
3339            _name: name.to_string(),
3340            _validate_only: Default::default(),
3341            _etag: Default::default(),
3342            _delegate: Default::default(),
3343            _additional_params: Default::default(),
3344            _scopes: Default::default(),
3345        }
3346    }
3347
3348    /// Create a builder to help you perform the following task:
3349    ///
3350    /// Gets information about a Revision.
3351    ///
3352    /// # Arguments
3353    ///
3354    /// * `name` - Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
3355    pub fn locations_worker_pools_revisions_get(
3356        &self,
3357        name: &str,
3358    ) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C> {
3359        ProjectLocationWorkerPoolRevisionGetCall {
3360            hub: self.hub,
3361            _name: name.to_string(),
3362            _delegate: Default::default(),
3363            _additional_params: Default::default(),
3364            _scopes: Default::default(),
3365        }
3366    }
3367
3368    /// Create a builder to help you perform the following task:
3369    ///
3370    /// Lists Revisions from a given Service, or from a given location. Results are sorted by creation time, descending.
3371    ///
3372    /// # Arguments
3373    ///
3374    /// * `parent` - Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service}
3375    pub fn locations_worker_pools_revisions_list(
3376        &self,
3377        parent: &str,
3378    ) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
3379        ProjectLocationWorkerPoolRevisionListCall {
3380            hub: self.hub,
3381            _parent: parent.to_string(),
3382            _show_deleted: Default::default(),
3383            _page_token: Default::default(),
3384            _page_size: Default::default(),
3385            _delegate: Default::default(),
3386            _additional_params: Default::default(),
3387            _scopes: Default::default(),
3388        }
3389    }
3390
3391    /// Create a builder to help you perform the following task:
3392    ///
3393    /// Creates a new WorkerPool in a given project and location.
3394    ///
3395    /// # Arguments
3396    ///
3397    /// * `request` - No description provided.
3398    /// * `parent` - Required. The location and project in which this worker pool should be created. Format: `projects/{project}/locations/{location}`, where `{project}` can be project id or number. Only lowercase characters, digits, and hyphens.
3399    pub fn locations_worker_pools_create(
3400        &self,
3401        request: GoogleCloudRunV2WorkerPool,
3402        parent: &str,
3403    ) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
3404        ProjectLocationWorkerPoolCreateCall {
3405            hub: self.hub,
3406            _request: request,
3407            _parent: parent.to_string(),
3408            _worker_pool_id: Default::default(),
3409            _validate_only: Default::default(),
3410            _delegate: Default::default(),
3411            _additional_params: Default::default(),
3412            _scopes: Default::default(),
3413        }
3414    }
3415
3416    /// Create a builder to help you perform the following task:
3417    ///
3418    /// Deletes a WorkerPool.
3419    ///
3420    /// # Arguments
3421    ///
3422    /// * `name` - Required. The full name of the WorkerPool. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where `{project}` can be project id or number.
3423    pub fn locations_worker_pools_delete(
3424        &self,
3425        name: &str,
3426    ) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
3427        ProjectLocationWorkerPoolDeleteCall {
3428            hub: self.hub,
3429            _name: name.to_string(),
3430            _validate_only: Default::default(),
3431            _etag: Default::default(),
3432            _delegate: Default::default(),
3433            _additional_params: Default::default(),
3434            _scopes: Default::default(),
3435        }
3436    }
3437
3438    /// Create a builder to help you perform the following task:
3439    ///
3440    /// Gets information about a WorkerPool.
3441    ///
3442    /// # Arguments
3443    ///
3444    /// * `name` - Required. The full name of the WorkerPool. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where `{project}` can be project id or number.
3445    pub fn locations_worker_pools_get(
3446        &self,
3447        name: &str,
3448    ) -> ProjectLocationWorkerPoolGetCall<'a, C> {
3449        ProjectLocationWorkerPoolGetCall {
3450            hub: self.hub,
3451            _name: name.to_string(),
3452            _delegate: Default::default(),
3453            _additional_params: Default::default(),
3454            _scopes: Default::default(),
3455        }
3456    }
3457
3458    /// Create a builder to help you perform the following task:
3459    ///
3460    /// Gets the IAM Access Control policy currently in effect for the given Cloud Run WorkerPool. This result does not include any inherited policies.
3461    ///
3462    /// # Arguments
3463    ///
3464    /// * `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.
3465    pub fn locations_worker_pools_get_iam_policy(
3466        &self,
3467        resource: &str,
3468    ) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {
3469        ProjectLocationWorkerPoolGetIamPolicyCall {
3470            hub: self.hub,
3471            _resource: resource.to_string(),
3472            _options_requested_policy_version: Default::default(),
3473            _delegate: Default::default(),
3474            _additional_params: Default::default(),
3475            _scopes: Default::default(),
3476        }
3477    }
3478
3479    /// Create a builder to help you perform the following task:
3480    ///
3481    /// Lists WorkerPools. Results are sorted by creation time, descending.
3482    ///
3483    /// # Arguments
3484    ///
3485    /// * `parent` - Required. The location and project to list resources on. Location must be a valid Google Cloud region, and cannot be the "-" wildcard. Format: `projects/{project}/locations/{location}`, where `{project}` can be project id or number.
3486    pub fn locations_worker_pools_list(
3487        &self,
3488        parent: &str,
3489    ) -> ProjectLocationWorkerPoolListCall<'a, C> {
3490        ProjectLocationWorkerPoolListCall {
3491            hub: self.hub,
3492            _parent: parent.to_string(),
3493            _show_deleted: Default::default(),
3494            _page_token: Default::default(),
3495            _page_size: Default::default(),
3496            _delegate: Default::default(),
3497            _additional_params: Default::default(),
3498            _scopes: Default::default(),
3499        }
3500    }
3501
3502    /// Create a builder to help you perform the following task:
3503    ///
3504    /// Updates a WorkerPool.
3505    ///
3506    /// # Arguments
3507    ///
3508    /// * `request` - No description provided.
3509    /// * `name` - The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest, this field is ignored, and instead composed from CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id. Format: `projects/{project}/locations/{location}/workerPools/{worker_id}`
3510    pub fn locations_worker_pools_patch(
3511        &self,
3512        request: GoogleCloudRunV2WorkerPool,
3513        name: &str,
3514    ) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
3515        ProjectLocationWorkerPoolPatchCall {
3516            hub: self.hub,
3517            _request: request,
3518            _name: name.to_string(),
3519            _validate_only: Default::default(),
3520            _update_mask: Default::default(),
3521            _force_new_revision: Default::default(),
3522            _allow_missing: Default::default(),
3523            _delegate: Default::default(),
3524            _additional_params: Default::default(),
3525            _scopes: Default::default(),
3526        }
3527    }
3528
3529    /// Create a builder to help you perform the following task:
3530    ///
3531    /// Sets the IAM Access control policy for the specified WorkerPool. Overwrites any existing policy.
3532    ///
3533    /// # Arguments
3534    ///
3535    /// * `request` - No description provided.
3536    /// * `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.
3537    pub fn locations_worker_pools_set_iam_policy(
3538        &self,
3539        request: GoogleIamV1SetIamPolicyRequest,
3540        resource: &str,
3541    ) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {
3542        ProjectLocationWorkerPoolSetIamPolicyCall {
3543            hub: self.hub,
3544            _request: request,
3545            _resource: resource.to_string(),
3546            _delegate: Default::default(),
3547            _additional_params: Default::default(),
3548            _scopes: Default::default(),
3549        }
3550    }
3551
3552    /// Create a builder to help you perform the following task:
3553    ///
3554    /// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
3555    ///
3556    /// # Arguments
3557    ///
3558    /// * `request` - No description provided.
3559    /// * `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.
3560    pub fn locations_worker_pools_test_iam_permissions(
3561        &self,
3562        request: GoogleIamV1TestIamPermissionsRequest,
3563        resource: &str,
3564    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {
3565        ProjectLocationWorkerPoolTestIamPermissionCall {
3566            hub: self.hub,
3567            _request: request,
3568            _resource: resource.to_string(),
3569            _delegate: Default::default(),
3570            _additional_params: Default::default(),
3571            _scopes: Default::default(),
3572        }
3573    }
3574
3575    /// Create a builder to help you perform the following task:
3576    ///
3577    /// Export image for a given resource.
3578    ///
3579    /// # Arguments
3580    ///
3581    /// * `request` - No description provided.
3582    /// * `name` - Required. The name of the resource of which image metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
3583    pub fn locations_export_image(
3584        &self,
3585        request: GoogleCloudRunV2ExportImageRequest,
3586        name: &str,
3587    ) -> ProjectLocationExportImageCall<'a, C> {
3588        ProjectLocationExportImageCall {
3589            hub: self.hub,
3590            _request: request,
3591            _name: name.to_string(),
3592            _delegate: Default::default(),
3593            _additional_params: Default::default(),
3594            _scopes: Default::default(),
3595        }
3596    }
3597
3598    /// Create a builder to help you perform the following task:
3599    ///
3600    /// Export image metadata for a given resource.
3601    ///
3602    /// # Arguments
3603    ///
3604    /// * `name` - Required. The name of the resource of which image metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
3605    pub fn locations_export_image_metadata(
3606        &self,
3607        name: &str,
3608    ) -> ProjectLocationExportImageMetadataCall<'a, C> {
3609        ProjectLocationExportImageMetadataCall {
3610            hub: self.hub,
3611            _name: name.to_string(),
3612            _delegate: Default::default(),
3613            _additional_params: Default::default(),
3614            _scopes: Default::default(),
3615        }
3616    }
3617
3618    /// Create a builder to help you perform the following task:
3619    ///
3620    /// Export generated customer metadata for a given resource.
3621    ///
3622    /// # Arguments
3623    ///
3624    /// * `name` - Required. The name of the resource of which metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}` for Service `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution {project_id_or_number} may contains domain-scoped project IDs
3625    pub fn locations_export_metadata(
3626        &self,
3627        name: &str,
3628    ) -> ProjectLocationExportMetadataCall<'a, C> {
3629        ProjectLocationExportMetadataCall {
3630            hub: self.hub,
3631            _name: name.to_string(),
3632            _delegate: Default::default(),
3633            _additional_params: Default::default(),
3634            _scopes: Default::default(),
3635        }
3636    }
3637
3638    /// Create a builder to help you perform the following task:
3639    ///
3640    /// Export generated customer metadata for a given project.
3641    ///
3642    /// # Arguments
3643    ///
3644    /// * `name` - Required. The name of the project of which metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}` for Project in a given location.
3645    pub fn locations_export_project_metadata(
3646        &self,
3647        name: &str,
3648    ) -> ProjectLocationExportProjectMetadataCall<'a, C> {
3649        ProjectLocationExportProjectMetadataCall {
3650            hub: self.hub,
3651            _name: name.to_string(),
3652            _delegate: Default::default(),
3653            _additional_params: Default::default(),
3654            _scopes: Default::default(),
3655        }
3656    }
3657}
3658
3659// ###################
3660// CallBuilders   ###
3661// #################
3662
3663/// Submits a build in a given project.
3664///
3665/// A builder for the *locations.builds.submit* method supported by a *project* resource.
3666/// It is not used directly, but through a [`ProjectMethods`] instance.
3667///
3668/// # Example
3669///
3670/// Instantiate a resource method builder
3671///
3672/// ```test_harness,no_run
3673/// # extern crate hyper;
3674/// # extern crate hyper_rustls;
3675/// # extern crate google_run2 as run2;
3676/// use run2::api::GoogleCloudRunV2SubmitBuildRequest;
3677/// # async fn dox() {
3678/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3679///
3680/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3681/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3682/// #     .with_native_roots()
3683/// #     .unwrap()
3684/// #     .https_only()
3685/// #     .enable_http2()
3686/// #     .build();
3687///
3688/// # let executor = hyper_util::rt::TokioExecutor::new();
3689/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3690/// #     secret,
3691/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3692/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3693/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3694/// #     ),
3695/// # ).build().await.unwrap();
3696///
3697/// # let client = hyper_util::client::legacy::Client::builder(
3698/// #     hyper_util::rt::TokioExecutor::new()
3699/// # )
3700/// # .build(
3701/// #     hyper_rustls::HttpsConnectorBuilder::new()
3702/// #         .with_native_roots()
3703/// #         .unwrap()
3704/// #         .https_or_http()
3705/// #         .enable_http2()
3706/// #         .build()
3707/// # );
3708/// # let mut hub = CloudRun::new(client, auth);
3709/// // As the method needs a request, you would usually fill it with the desired information
3710/// // into the respective structure. Some of the parts shown here might not be applicable !
3711/// // Values shown here are possibly random and not representative !
3712/// let mut req = GoogleCloudRunV2SubmitBuildRequest::default();
3713///
3714/// // You can configure optional parameters by calling the respective setters at will, and
3715/// // execute the final call using `doit()`.
3716/// // Values shown here are possibly random and not representative !
3717/// let result = hub.projects().locations_builds_submit(req, "parent")
3718///              .doit().await;
3719/// # }
3720/// ```
3721pub struct ProjectLocationBuildSubmitCall<'a, C>
3722where
3723    C: 'a,
3724{
3725    hub: &'a CloudRun<C>,
3726    _request: GoogleCloudRunV2SubmitBuildRequest,
3727    _parent: String,
3728    _delegate: Option<&'a mut dyn common::Delegate>,
3729    _additional_params: HashMap<String, String>,
3730    _scopes: BTreeSet<String>,
3731}
3732
3733impl<'a, C> common::CallBuilder for ProjectLocationBuildSubmitCall<'a, C> {}
3734
3735impl<'a, C> ProjectLocationBuildSubmitCall<'a, C>
3736where
3737    C: common::Connector,
3738{
3739    /// Perform the operation you have build so far.
3740    pub async fn doit(
3741        mut self,
3742    ) -> common::Result<(common::Response, GoogleCloudRunV2SubmitBuildResponse)> {
3743        use std::borrow::Cow;
3744        use std::io::{Read, Seek};
3745
3746        use common::{url::Params, ToParts};
3747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3748
3749        let mut dd = common::DefaultDelegate;
3750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3751        dlg.begin(common::MethodInfo {
3752            id: "run.projects.locations.builds.submit",
3753            http_method: hyper::Method::POST,
3754        });
3755
3756        for &field in ["alt", "parent"].iter() {
3757            if self._additional_params.contains_key(field) {
3758                dlg.finished(false);
3759                return Err(common::Error::FieldClash(field));
3760            }
3761        }
3762
3763        let mut params = Params::with_capacity(4 + self._additional_params.len());
3764        params.push("parent", self._parent);
3765
3766        params.extend(self._additional_params.iter());
3767
3768        params.push("alt", "json");
3769        let mut url = self.hub._base_url.clone() + "v2/{+parent}/builds:submit";
3770        if self._scopes.is_empty() {
3771            self._scopes
3772                .insert(Scope::CloudPlatform.as_ref().to_string());
3773        }
3774
3775        #[allow(clippy::single_element_loop)]
3776        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3777            url = params.uri_replacement(url, param_name, find_this, true);
3778        }
3779        {
3780            let to_remove = ["parent"];
3781            params.remove_params(&to_remove);
3782        }
3783
3784        let url = params.parse_with_url(&url);
3785
3786        let mut json_mime_type = mime::APPLICATION_JSON;
3787        let mut request_value_reader = {
3788            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3789            common::remove_json_null_values(&mut value);
3790            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3791            serde_json::to_writer(&mut dst, &value).unwrap();
3792            dst
3793        };
3794        let request_size = request_value_reader
3795            .seek(std::io::SeekFrom::End(0))
3796            .unwrap();
3797        request_value_reader
3798            .seek(std::io::SeekFrom::Start(0))
3799            .unwrap();
3800
3801        loop {
3802            let token = match self
3803                .hub
3804                .auth
3805                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3806                .await
3807            {
3808                Ok(token) => token,
3809                Err(e) => match dlg.token(e) {
3810                    Ok(token) => token,
3811                    Err(e) => {
3812                        dlg.finished(false);
3813                        return Err(common::Error::MissingToken(e));
3814                    }
3815                },
3816            };
3817            request_value_reader
3818                .seek(std::io::SeekFrom::Start(0))
3819                .unwrap();
3820            let mut req_result = {
3821                let client = &self.hub.client;
3822                dlg.pre_request();
3823                let mut req_builder = hyper::Request::builder()
3824                    .method(hyper::Method::POST)
3825                    .uri(url.as_str())
3826                    .header(USER_AGENT, self.hub._user_agent.clone());
3827
3828                if let Some(token) = token.as_ref() {
3829                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3830                }
3831
3832                let request = req_builder
3833                    .header(CONTENT_TYPE, json_mime_type.to_string())
3834                    .header(CONTENT_LENGTH, request_size as u64)
3835                    .body(common::to_body(
3836                        request_value_reader.get_ref().clone().into(),
3837                    ));
3838
3839                client.request(request.unwrap()).await
3840            };
3841
3842            match req_result {
3843                Err(err) => {
3844                    if let common::Retry::After(d) = dlg.http_error(&err) {
3845                        sleep(d).await;
3846                        continue;
3847                    }
3848                    dlg.finished(false);
3849                    return Err(common::Error::HttpError(err));
3850                }
3851                Ok(res) => {
3852                    let (mut parts, body) = res.into_parts();
3853                    let mut body = common::Body::new(body);
3854                    if !parts.status.is_success() {
3855                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3856                        let error = serde_json::from_str(&common::to_string(&bytes));
3857                        let response = common::to_response(parts, bytes.into());
3858
3859                        if let common::Retry::After(d) =
3860                            dlg.http_failure(&response, error.as_ref().ok())
3861                        {
3862                            sleep(d).await;
3863                            continue;
3864                        }
3865
3866                        dlg.finished(false);
3867
3868                        return Err(match error {
3869                            Ok(value) => common::Error::BadRequest(value),
3870                            _ => common::Error::Failure(response),
3871                        });
3872                    }
3873                    let response = {
3874                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3875                        let encoded = common::to_string(&bytes);
3876                        match serde_json::from_str(&encoded) {
3877                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3878                            Err(error) => {
3879                                dlg.response_json_decode_error(&encoded, &error);
3880                                return Err(common::Error::JsonDecodeError(
3881                                    encoded.to_string(),
3882                                    error,
3883                                ));
3884                            }
3885                        }
3886                    };
3887
3888                    dlg.finished(true);
3889                    return Ok(response);
3890                }
3891            }
3892        }
3893    }
3894
3895    ///
3896    /// Sets the *request* property to the given value.
3897    ///
3898    /// Even though the property as already been set when instantiating this call,
3899    /// we provide this method for API completeness.
3900    pub fn request(
3901        mut self,
3902        new_value: GoogleCloudRunV2SubmitBuildRequest,
3903    ) -> ProjectLocationBuildSubmitCall<'a, C> {
3904        self._request = new_value;
3905        self
3906    }
3907    /// Required. The project and location to build in. Location must be a region, e.g., 'us-central1' or 'global' if the global builder is to be used. Format: `projects/{project}/locations/{location}`
3908    ///
3909    /// Sets the *parent* path property to the given value.
3910    ///
3911    /// Even though the property as already been set when instantiating this call,
3912    /// we provide this method for API completeness.
3913    pub fn parent(mut self, new_value: &str) -> ProjectLocationBuildSubmitCall<'a, C> {
3914        self._parent = new_value.to_string();
3915        self
3916    }
3917    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3918    /// while executing the actual API request.
3919    ///
3920    /// ````text
3921    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3922    /// ````
3923    ///
3924    /// Sets the *delegate* property to the given value.
3925    pub fn delegate(
3926        mut self,
3927        new_value: &'a mut dyn common::Delegate,
3928    ) -> ProjectLocationBuildSubmitCall<'a, C> {
3929        self._delegate = Some(new_value);
3930        self
3931    }
3932
3933    /// Set any additional parameter of the query string used in the request.
3934    /// It should be used to set parameters which are not yet available through their own
3935    /// setters.
3936    ///
3937    /// Please note that this method must not be used to set any of the known parameters
3938    /// which have their own setter method. If done anyway, the request will fail.
3939    ///
3940    /// # Additional Parameters
3941    ///
3942    /// * *$.xgafv* (query-string) - V1 error format.
3943    /// * *access_token* (query-string) - OAuth access token.
3944    /// * *alt* (query-string) - Data format for response.
3945    /// * *callback* (query-string) - JSONP
3946    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3947    /// * *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.
3948    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3949    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3950    /// * *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.
3951    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3952    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3953    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBuildSubmitCall<'a, C>
3954    where
3955        T: AsRef<str>,
3956    {
3957        self._additional_params
3958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3959        self
3960    }
3961
3962    /// Identifies the authorization scope for the method you are building.
3963    ///
3964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3965    /// [`Scope::CloudPlatform`].
3966    ///
3967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3968    /// tokens for more than one scope.
3969    ///
3970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3972    /// sufficient, a read-write scope will do as well.
3973    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBuildSubmitCall<'a, C>
3974    where
3975        St: AsRef<str>,
3976    {
3977        self._scopes.insert(String::from(scope.as_ref()));
3978        self
3979    }
3980    /// Identifies the authorization scope(s) for the method you are building.
3981    ///
3982    /// See [`Self::add_scope()`] for details.
3983    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBuildSubmitCall<'a, C>
3984    where
3985        I: IntoIterator<Item = St>,
3986        St: AsRef<str>,
3987    {
3988        self._scopes
3989            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3990        self
3991    }
3992
3993    /// Removes all scopes, and no default scope will be used either.
3994    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3995    /// for details).
3996    pub fn clear_scopes(mut self) -> ProjectLocationBuildSubmitCall<'a, C> {
3997        self._scopes.clear();
3998        self
3999    }
4000}
4001
4002/// Gets information about a Task.
4003///
4004/// A builder for the *locations.jobs.executions.tasks.get* method supported by a *project* resource.
4005/// It is not used directly, but through a [`ProjectMethods`] instance.
4006///
4007/// # Example
4008///
4009/// Instantiate a resource method builder
4010///
4011/// ```test_harness,no_run
4012/// # extern crate hyper;
4013/// # extern crate hyper_rustls;
4014/// # extern crate google_run2 as run2;
4015/// # async fn dox() {
4016/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4017///
4018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4020/// #     .with_native_roots()
4021/// #     .unwrap()
4022/// #     .https_only()
4023/// #     .enable_http2()
4024/// #     .build();
4025///
4026/// # let executor = hyper_util::rt::TokioExecutor::new();
4027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4028/// #     secret,
4029/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4030/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4031/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4032/// #     ),
4033/// # ).build().await.unwrap();
4034///
4035/// # let client = hyper_util::client::legacy::Client::builder(
4036/// #     hyper_util::rt::TokioExecutor::new()
4037/// # )
4038/// # .build(
4039/// #     hyper_rustls::HttpsConnectorBuilder::new()
4040/// #         .with_native_roots()
4041/// #         .unwrap()
4042/// #         .https_or_http()
4043/// #         .enable_http2()
4044/// #         .build()
4045/// # );
4046/// # let mut hub = CloudRun::new(client, auth);
4047/// // You can configure optional parameters by calling the respective setters at will, and
4048/// // execute the final call using `doit()`.
4049/// // Values shown here are possibly random and not representative !
4050/// let result = hub.projects().locations_jobs_executions_tasks_get("name")
4051///              .doit().await;
4052/// # }
4053/// ```
4054pub struct ProjectLocationJobExecutionTaskGetCall<'a, C>
4055where
4056    C: 'a,
4057{
4058    hub: &'a CloudRun<C>,
4059    _name: String,
4060    _delegate: Option<&'a mut dyn common::Delegate>,
4061    _additional_params: HashMap<String, String>,
4062    _scopes: BTreeSet<String>,
4063}
4064
4065impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionTaskGetCall<'a, C> {}
4066
4067impl<'a, C> ProjectLocationJobExecutionTaskGetCall<'a, C>
4068where
4069    C: common::Connector,
4070{
4071    /// Perform the operation you have build so far.
4072    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Task)> {
4073        use std::borrow::Cow;
4074        use std::io::{Read, Seek};
4075
4076        use common::{url::Params, ToParts};
4077        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4078
4079        let mut dd = common::DefaultDelegate;
4080        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4081        dlg.begin(common::MethodInfo {
4082            id: "run.projects.locations.jobs.executions.tasks.get",
4083            http_method: hyper::Method::GET,
4084        });
4085
4086        for &field in ["alt", "name"].iter() {
4087            if self._additional_params.contains_key(field) {
4088                dlg.finished(false);
4089                return Err(common::Error::FieldClash(field));
4090            }
4091        }
4092
4093        let mut params = Params::with_capacity(3 + self._additional_params.len());
4094        params.push("name", self._name);
4095
4096        params.extend(self._additional_params.iter());
4097
4098        params.push("alt", "json");
4099        let mut url = self.hub._base_url.clone() + "v2/{+name}";
4100        if self._scopes.is_empty() {
4101            self._scopes
4102                .insert(Scope::CloudPlatform.as_ref().to_string());
4103        }
4104
4105        #[allow(clippy::single_element_loop)]
4106        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4107            url = params.uri_replacement(url, param_name, find_this, true);
4108        }
4109        {
4110            let to_remove = ["name"];
4111            params.remove_params(&to_remove);
4112        }
4113
4114        let url = params.parse_with_url(&url);
4115
4116        loop {
4117            let token = match self
4118                .hub
4119                .auth
4120                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4121                .await
4122            {
4123                Ok(token) => token,
4124                Err(e) => match dlg.token(e) {
4125                    Ok(token) => token,
4126                    Err(e) => {
4127                        dlg.finished(false);
4128                        return Err(common::Error::MissingToken(e));
4129                    }
4130                },
4131            };
4132            let mut req_result = {
4133                let client = &self.hub.client;
4134                dlg.pre_request();
4135                let mut req_builder = hyper::Request::builder()
4136                    .method(hyper::Method::GET)
4137                    .uri(url.as_str())
4138                    .header(USER_AGENT, self.hub._user_agent.clone());
4139
4140                if let Some(token) = token.as_ref() {
4141                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4142                }
4143
4144                let request = req_builder
4145                    .header(CONTENT_LENGTH, 0_u64)
4146                    .body(common::to_body::<String>(None));
4147
4148                client.request(request.unwrap()).await
4149            };
4150
4151            match req_result {
4152                Err(err) => {
4153                    if let common::Retry::After(d) = dlg.http_error(&err) {
4154                        sleep(d).await;
4155                        continue;
4156                    }
4157                    dlg.finished(false);
4158                    return Err(common::Error::HttpError(err));
4159                }
4160                Ok(res) => {
4161                    let (mut parts, body) = res.into_parts();
4162                    let mut body = common::Body::new(body);
4163                    if !parts.status.is_success() {
4164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4165                        let error = serde_json::from_str(&common::to_string(&bytes));
4166                        let response = common::to_response(parts, bytes.into());
4167
4168                        if let common::Retry::After(d) =
4169                            dlg.http_failure(&response, error.as_ref().ok())
4170                        {
4171                            sleep(d).await;
4172                            continue;
4173                        }
4174
4175                        dlg.finished(false);
4176
4177                        return Err(match error {
4178                            Ok(value) => common::Error::BadRequest(value),
4179                            _ => common::Error::Failure(response),
4180                        });
4181                    }
4182                    let response = {
4183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4184                        let encoded = common::to_string(&bytes);
4185                        match serde_json::from_str(&encoded) {
4186                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4187                            Err(error) => {
4188                                dlg.response_json_decode_error(&encoded, &error);
4189                                return Err(common::Error::JsonDecodeError(
4190                                    encoded.to_string(),
4191                                    error,
4192                                ));
4193                            }
4194                        }
4195                    };
4196
4197                    dlg.finished(true);
4198                    return Ok(response);
4199                }
4200            }
4201        }
4202    }
4203
4204    /// Required. The full name of the Task. Format: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
4205    ///
4206    /// Sets the *name* path property to the given value.
4207    ///
4208    /// Even though the property as already been set when instantiating this call,
4209    /// we provide this method for API completeness.
4210    pub fn name(mut self, new_value: &str) -> ProjectLocationJobExecutionTaskGetCall<'a, C> {
4211        self._name = new_value.to_string();
4212        self
4213    }
4214    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4215    /// while executing the actual API request.
4216    ///
4217    /// ````text
4218    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4219    /// ````
4220    ///
4221    /// Sets the *delegate* property to the given value.
4222    pub fn delegate(
4223        mut self,
4224        new_value: &'a mut dyn common::Delegate,
4225    ) -> ProjectLocationJobExecutionTaskGetCall<'a, C> {
4226        self._delegate = Some(new_value);
4227        self
4228    }
4229
4230    /// Set any additional parameter of the query string used in the request.
4231    /// It should be used to set parameters which are not yet available through their own
4232    /// setters.
4233    ///
4234    /// Please note that this method must not be used to set any of the known parameters
4235    /// which have their own setter method. If done anyway, the request will fail.
4236    ///
4237    /// # Additional Parameters
4238    ///
4239    /// * *$.xgafv* (query-string) - V1 error format.
4240    /// * *access_token* (query-string) - OAuth access token.
4241    /// * *alt* (query-string) - Data format for response.
4242    /// * *callback* (query-string) - JSONP
4243    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4244    /// * *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.
4245    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4246    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4247    /// * *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.
4248    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4249    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4250    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionTaskGetCall<'a, C>
4251    where
4252        T: AsRef<str>,
4253    {
4254        self._additional_params
4255            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4256        self
4257    }
4258
4259    /// Identifies the authorization scope for the method you are building.
4260    ///
4261    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4262    /// [`Scope::CloudPlatform`].
4263    ///
4264    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4265    /// tokens for more than one scope.
4266    ///
4267    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4268    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4269    /// sufficient, a read-write scope will do as well.
4270    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionTaskGetCall<'a, C>
4271    where
4272        St: AsRef<str>,
4273    {
4274        self._scopes.insert(String::from(scope.as_ref()));
4275        self
4276    }
4277    /// Identifies the authorization scope(s) for the method you are building.
4278    ///
4279    /// See [`Self::add_scope()`] for details.
4280    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionTaskGetCall<'a, C>
4281    where
4282        I: IntoIterator<Item = St>,
4283        St: AsRef<str>,
4284    {
4285        self._scopes
4286            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4287        self
4288    }
4289
4290    /// Removes all scopes, and no default scope will be used either.
4291    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4292    /// for details).
4293    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionTaskGetCall<'a, C> {
4294        self._scopes.clear();
4295        self
4296    }
4297}
4298
4299/// Lists Tasks from an Execution of a Job.
4300///
4301/// A builder for the *locations.jobs.executions.tasks.list* method supported by a *project* resource.
4302/// It is not used directly, but through a [`ProjectMethods`] instance.
4303///
4304/// # Example
4305///
4306/// Instantiate a resource method builder
4307///
4308/// ```test_harness,no_run
4309/// # extern crate hyper;
4310/// # extern crate hyper_rustls;
4311/// # extern crate google_run2 as run2;
4312/// # async fn dox() {
4313/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4314///
4315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4317/// #     .with_native_roots()
4318/// #     .unwrap()
4319/// #     .https_only()
4320/// #     .enable_http2()
4321/// #     .build();
4322///
4323/// # let executor = hyper_util::rt::TokioExecutor::new();
4324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4325/// #     secret,
4326/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4327/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4328/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4329/// #     ),
4330/// # ).build().await.unwrap();
4331///
4332/// # let client = hyper_util::client::legacy::Client::builder(
4333/// #     hyper_util::rt::TokioExecutor::new()
4334/// # )
4335/// # .build(
4336/// #     hyper_rustls::HttpsConnectorBuilder::new()
4337/// #         .with_native_roots()
4338/// #         .unwrap()
4339/// #         .https_or_http()
4340/// #         .enable_http2()
4341/// #         .build()
4342/// # );
4343/// # let mut hub = CloudRun::new(client, auth);
4344/// // You can configure optional parameters by calling the respective setters at will, and
4345/// // execute the final call using `doit()`.
4346/// // Values shown here are possibly random and not representative !
4347/// let result = hub.projects().locations_jobs_executions_tasks_list("parent")
4348///              .show_deleted(false)
4349///              .page_token("ut")
4350///              .page_size(-12)
4351///              .doit().await;
4352/// # }
4353/// ```
4354pub struct ProjectLocationJobExecutionTaskListCall<'a, C>
4355where
4356    C: 'a,
4357{
4358    hub: &'a CloudRun<C>,
4359    _parent: String,
4360    _show_deleted: Option<bool>,
4361    _page_token: Option<String>,
4362    _page_size: Option<i32>,
4363    _delegate: Option<&'a mut dyn common::Delegate>,
4364    _additional_params: HashMap<String, String>,
4365    _scopes: BTreeSet<String>,
4366}
4367
4368impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionTaskListCall<'a, C> {}
4369
4370impl<'a, C> ProjectLocationJobExecutionTaskListCall<'a, C>
4371where
4372    C: common::Connector,
4373{
4374    /// Perform the operation you have build so far.
4375    pub async fn doit(
4376        mut self,
4377    ) -> common::Result<(common::Response, GoogleCloudRunV2ListTasksResponse)> {
4378        use std::borrow::Cow;
4379        use std::io::{Read, Seek};
4380
4381        use common::{url::Params, ToParts};
4382        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4383
4384        let mut dd = common::DefaultDelegate;
4385        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4386        dlg.begin(common::MethodInfo {
4387            id: "run.projects.locations.jobs.executions.tasks.list",
4388            http_method: hyper::Method::GET,
4389        });
4390
4391        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
4392            if self._additional_params.contains_key(field) {
4393                dlg.finished(false);
4394                return Err(common::Error::FieldClash(field));
4395            }
4396        }
4397
4398        let mut params = Params::with_capacity(6 + self._additional_params.len());
4399        params.push("parent", self._parent);
4400        if let Some(value) = self._show_deleted.as_ref() {
4401            params.push("showDeleted", value.to_string());
4402        }
4403        if let Some(value) = self._page_token.as_ref() {
4404            params.push("pageToken", value);
4405        }
4406        if let Some(value) = self._page_size.as_ref() {
4407            params.push("pageSize", value.to_string());
4408        }
4409
4410        params.extend(self._additional_params.iter());
4411
4412        params.push("alt", "json");
4413        let mut url = self.hub._base_url.clone() + "v2/{+parent}/tasks";
4414        if self._scopes.is_empty() {
4415            self._scopes
4416                .insert(Scope::CloudPlatform.as_ref().to_string());
4417        }
4418
4419        #[allow(clippy::single_element_loop)]
4420        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4421            url = params.uri_replacement(url, param_name, find_this, true);
4422        }
4423        {
4424            let to_remove = ["parent"];
4425            params.remove_params(&to_remove);
4426        }
4427
4428        let url = params.parse_with_url(&url);
4429
4430        loop {
4431            let token = match self
4432                .hub
4433                .auth
4434                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4435                .await
4436            {
4437                Ok(token) => token,
4438                Err(e) => match dlg.token(e) {
4439                    Ok(token) => token,
4440                    Err(e) => {
4441                        dlg.finished(false);
4442                        return Err(common::Error::MissingToken(e));
4443                    }
4444                },
4445            };
4446            let mut req_result = {
4447                let client = &self.hub.client;
4448                dlg.pre_request();
4449                let mut req_builder = hyper::Request::builder()
4450                    .method(hyper::Method::GET)
4451                    .uri(url.as_str())
4452                    .header(USER_AGENT, self.hub._user_agent.clone());
4453
4454                if let Some(token) = token.as_ref() {
4455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4456                }
4457
4458                let request = req_builder
4459                    .header(CONTENT_LENGTH, 0_u64)
4460                    .body(common::to_body::<String>(None));
4461
4462                client.request(request.unwrap()).await
4463            };
4464
4465            match req_result {
4466                Err(err) => {
4467                    if let common::Retry::After(d) = dlg.http_error(&err) {
4468                        sleep(d).await;
4469                        continue;
4470                    }
4471                    dlg.finished(false);
4472                    return Err(common::Error::HttpError(err));
4473                }
4474                Ok(res) => {
4475                    let (mut parts, body) = res.into_parts();
4476                    let mut body = common::Body::new(body);
4477                    if !parts.status.is_success() {
4478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4479                        let error = serde_json::from_str(&common::to_string(&bytes));
4480                        let response = common::to_response(parts, bytes.into());
4481
4482                        if let common::Retry::After(d) =
4483                            dlg.http_failure(&response, error.as_ref().ok())
4484                        {
4485                            sleep(d).await;
4486                            continue;
4487                        }
4488
4489                        dlg.finished(false);
4490
4491                        return Err(match error {
4492                            Ok(value) => common::Error::BadRequest(value),
4493                            _ => common::Error::Failure(response),
4494                        });
4495                    }
4496                    let response = {
4497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4498                        let encoded = common::to_string(&bytes);
4499                        match serde_json::from_str(&encoded) {
4500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4501                            Err(error) => {
4502                                dlg.response_json_decode_error(&encoded, &error);
4503                                return Err(common::Error::JsonDecodeError(
4504                                    encoded.to_string(),
4505                                    error,
4506                                ));
4507                            }
4508                        }
4509                    };
4510
4511                    dlg.finished(true);
4512                    return Ok(response);
4513                }
4514            }
4515        }
4516    }
4517
4518    /// Required. The Execution from which the Tasks should be listed. To list all Tasks across Executions of a Job, use "-" instead of Execution name. To list all Tasks across Jobs, use "-" instead of Job name. Format: projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
4519    ///
4520    /// Sets the *parent* path property to the given value.
4521    ///
4522    /// Even though the property as already been set when instantiating this call,
4523    /// we provide this method for API completeness.
4524    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4525        self._parent = new_value.to_string();
4526        self
4527    }
4528    /// If true, returns deleted (but unexpired) resources along with active ones.
4529    ///
4530    /// Sets the *show deleted* query property to the given value.
4531    pub fn show_deleted(
4532        mut self,
4533        new_value: bool,
4534    ) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4535        self._show_deleted = Some(new_value);
4536        self
4537    }
4538    /// A page token received from a previous call to ListTasks. All other parameters must match.
4539    ///
4540    /// Sets the *page token* query property to the given value.
4541    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4542        self._page_token = Some(new_value.to_string());
4543        self
4544    }
4545    /// Maximum number of Tasks to return in this call.
4546    ///
4547    /// Sets the *page size* query property to the given value.
4548    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4549        self._page_size = Some(new_value);
4550        self
4551    }
4552    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4553    /// while executing the actual API request.
4554    ///
4555    /// ````text
4556    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4557    /// ````
4558    ///
4559    /// Sets the *delegate* property to the given value.
4560    pub fn delegate(
4561        mut self,
4562        new_value: &'a mut dyn common::Delegate,
4563    ) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4564        self._delegate = Some(new_value);
4565        self
4566    }
4567
4568    /// Set any additional parameter of the query string used in the request.
4569    /// It should be used to set parameters which are not yet available through their own
4570    /// setters.
4571    ///
4572    /// Please note that this method must not be used to set any of the known parameters
4573    /// which have their own setter method. If done anyway, the request will fail.
4574    ///
4575    /// # Additional Parameters
4576    ///
4577    /// * *$.xgafv* (query-string) - V1 error format.
4578    /// * *access_token* (query-string) - OAuth access token.
4579    /// * *alt* (query-string) - Data format for response.
4580    /// * *callback* (query-string) - JSONP
4581    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4582    /// * *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.
4583    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4584    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4585    /// * *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.
4586    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4587    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4588    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionTaskListCall<'a, C>
4589    where
4590        T: AsRef<str>,
4591    {
4592        self._additional_params
4593            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4594        self
4595    }
4596
4597    /// Identifies the authorization scope for the method you are building.
4598    ///
4599    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4600    /// [`Scope::CloudPlatform`].
4601    ///
4602    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4603    /// tokens for more than one scope.
4604    ///
4605    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4606    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4607    /// sufficient, a read-write scope will do as well.
4608    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionTaskListCall<'a, C>
4609    where
4610        St: AsRef<str>,
4611    {
4612        self._scopes.insert(String::from(scope.as_ref()));
4613        self
4614    }
4615    /// Identifies the authorization scope(s) for the method you are building.
4616    ///
4617    /// See [`Self::add_scope()`] for details.
4618    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionTaskListCall<'a, C>
4619    where
4620        I: IntoIterator<Item = St>,
4621        St: AsRef<str>,
4622    {
4623        self._scopes
4624            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4625        self
4626    }
4627
4628    /// Removes all scopes, and no default scope will be used either.
4629    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4630    /// for details).
4631    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionTaskListCall<'a, C> {
4632        self._scopes.clear();
4633        self
4634    }
4635}
4636
4637/// Cancels an Execution.
4638///
4639/// A builder for the *locations.jobs.executions.cancel* method supported by a *project* resource.
4640/// It is not used directly, but through a [`ProjectMethods`] instance.
4641///
4642/// # Example
4643///
4644/// Instantiate a resource method builder
4645///
4646/// ```test_harness,no_run
4647/// # extern crate hyper;
4648/// # extern crate hyper_rustls;
4649/// # extern crate google_run2 as run2;
4650/// use run2::api::GoogleCloudRunV2CancelExecutionRequest;
4651/// # async fn dox() {
4652/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4653///
4654/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4655/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4656/// #     .with_native_roots()
4657/// #     .unwrap()
4658/// #     .https_only()
4659/// #     .enable_http2()
4660/// #     .build();
4661///
4662/// # let executor = hyper_util::rt::TokioExecutor::new();
4663/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4664/// #     secret,
4665/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4666/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4667/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4668/// #     ),
4669/// # ).build().await.unwrap();
4670///
4671/// # let client = hyper_util::client::legacy::Client::builder(
4672/// #     hyper_util::rt::TokioExecutor::new()
4673/// # )
4674/// # .build(
4675/// #     hyper_rustls::HttpsConnectorBuilder::new()
4676/// #         .with_native_roots()
4677/// #         .unwrap()
4678/// #         .https_or_http()
4679/// #         .enable_http2()
4680/// #         .build()
4681/// # );
4682/// # let mut hub = CloudRun::new(client, auth);
4683/// // As the method needs a request, you would usually fill it with the desired information
4684/// // into the respective structure. Some of the parts shown here might not be applicable !
4685/// // Values shown here are possibly random and not representative !
4686/// let mut req = GoogleCloudRunV2CancelExecutionRequest::default();
4687///
4688/// // You can configure optional parameters by calling the respective setters at will, and
4689/// // execute the final call using `doit()`.
4690/// // Values shown here are possibly random and not representative !
4691/// let result = hub.projects().locations_jobs_executions_cancel(req, "name")
4692///              .doit().await;
4693/// # }
4694/// ```
4695pub struct ProjectLocationJobExecutionCancelCall<'a, C>
4696where
4697    C: 'a,
4698{
4699    hub: &'a CloudRun<C>,
4700    _request: GoogleCloudRunV2CancelExecutionRequest,
4701    _name: String,
4702    _delegate: Option<&'a mut dyn common::Delegate>,
4703    _additional_params: HashMap<String, String>,
4704    _scopes: BTreeSet<String>,
4705}
4706
4707impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionCancelCall<'a, C> {}
4708
4709impl<'a, C> ProjectLocationJobExecutionCancelCall<'a, C>
4710where
4711    C: common::Connector,
4712{
4713    /// Perform the operation you have build so far.
4714    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
4715        use std::borrow::Cow;
4716        use std::io::{Read, Seek};
4717
4718        use common::{url::Params, ToParts};
4719        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4720
4721        let mut dd = common::DefaultDelegate;
4722        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4723        dlg.begin(common::MethodInfo {
4724            id: "run.projects.locations.jobs.executions.cancel",
4725            http_method: hyper::Method::POST,
4726        });
4727
4728        for &field in ["alt", "name"].iter() {
4729            if self._additional_params.contains_key(field) {
4730                dlg.finished(false);
4731                return Err(common::Error::FieldClash(field));
4732            }
4733        }
4734
4735        let mut params = Params::with_capacity(4 + self._additional_params.len());
4736        params.push("name", self._name);
4737
4738        params.extend(self._additional_params.iter());
4739
4740        params.push("alt", "json");
4741        let mut url = self.hub._base_url.clone() + "v2/{+name}:cancel";
4742        if self._scopes.is_empty() {
4743            self._scopes
4744                .insert(Scope::CloudPlatform.as_ref().to_string());
4745        }
4746
4747        #[allow(clippy::single_element_loop)]
4748        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4749            url = params.uri_replacement(url, param_name, find_this, true);
4750        }
4751        {
4752            let to_remove = ["name"];
4753            params.remove_params(&to_remove);
4754        }
4755
4756        let url = params.parse_with_url(&url);
4757
4758        let mut json_mime_type = mime::APPLICATION_JSON;
4759        let mut request_value_reader = {
4760            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4761            common::remove_json_null_values(&mut value);
4762            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4763            serde_json::to_writer(&mut dst, &value).unwrap();
4764            dst
4765        };
4766        let request_size = request_value_reader
4767            .seek(std::io::SeekFrom::End(0))
4768            .unwrap();
4769        request_value_reader
4770            .seek(std::io::SeekFrom::Start(0))
4771            .unwrap();
4772
4773        loop {
4774            let token = match self
4775                .hub
4776                .auth
4777                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4778                .await
4779            {
4780                Ok(token) => token,
4781                Err(e) => match dlg.token(e) {
4782                    Ok(token) => token,
4783                    Err(e) => {
4784                        dlg.finished(false);
4785                        return Err(common::Error::MissingToken(e));
4786                    }
4787                },
4788            };
4789            request_value_reader
4790                .seek(std::io::SeekFrom::Start(0))
4791                .unwrap();
4792            let mut req_result = {
4793                let client = &self.hub.client;
4794                dlg.pre_request();
4795                let mut req_builder = hyper::Request::builder()
4796                    .method(hyper::Method::POST)
4797                    .uri(url.as_str())
4798                    .header(USER_AGENT, self.hub._user_agent.clone());
4799
4800                if let Some(token) = token.as_ref() {
4801                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4802                }
4803
4804                let request = req_builder
4805                    .header(CONTENT_TYPE, json_mime_type.to_string())
4806                    .header(CONTENT_LENGTH, request_size as u64)
4807                    .body(common::to_body(
4808                        request_value_reader.get_ref().clone().into(),
4809                    ));
4810
4811                client.request(request.unwrap()).await
4812            };
4813
4814            match req_result {
4815                Err(err) => {
4816                    if let common::Retry::After(d) = dlg.http_error(&err) {
4817                        sleep(d).await;
4818                        continue;
4819                    }
4820                    dlg.finished(false);
4821                    return Err(common::Error::HttpError(err));
4822                }
4823                Ok(res) => {
4824                    let (mut parts, body) = res.into_parts();
4825                    let mut body = common::Body::new(body);
4826                    if !parts.status.is_success() {
4827                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4828                        let error = serde_json::from_str(&common::to_string(&bytes));
4829                        let response = common::to_response(parts, bytes.into());
4830
4831                        if let common::Retry::After(d) =
4832                            dlg.http_failure(&response, error.as_ref().ok())
4833                        {
4834                            sleep(d).await;
4835                            continue;
4836                        }
4837
4838                        dlg.finished(false);
4839
4840                        return Err(match error {
4841                            Ok(value) => common::Error::BadRequest(value),
4842                            _ => common::Error::Failure(response),
4843                        });
4844                    }
4845                    let response = {
4846                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4847                        let encoded = common::to_string(&bytes);
4848                        match serde_json::from_str(&encoded) {
4849                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4850                            Err(error) => {
4851                                dlg.response_json_decode_error(&encoded, &error);
4852                                return Err(common::Error::JsonDecodeError(
4853                                    encoded.to_string(),
4854                                    error,
4855                                ));
4856                            }
4857                        }
4858                    };
4859
4860                    dlg.finished(true);
4861                    return Ok(response);
4862                }
4863            }
4864        }
4865    }
4866
4867    ///
4868    /// Sets the *request* property to the given value.
4869    ///
4870    /// Even though the property as already been set when instantiating this call,
4871    /// we provide this method for API completeness.
4872    pub fn request(
4873        mut self,
4874        new_value: GoogleCloudRunV2CancelExecutionRequest,
4875    ) -> ProjectLocationJobExecutionCancelCall<'a, C> {
4876        self._request = new_value;
4877        self
4878    }
4879    /// Required. The name of the Execution to cancel. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
4880    ///
4881    /// Sets the *name* path property to the given value.
4882    ///
4883    /// Even though the property as already been set when instantiating this call,
4884    /// we provide this method for API completeness.
4885    pub fn name(mut self, new_value: &str) -> ProjectLocationJobExecutionCancelCall<'a, C> {
4886        self._name = new_value.to_string();
4887        self
4888    }
4889    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4890    /// while executing the actual API request.
4891    ///
4892    /// ````text
4893    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4894    /// ````
4895    ///
4896    /// Sets the *delegate* property to the given value.
4897    pub fn delegate(
4898        mut self,
4899        new_value: &'a mut dyn common::Delegate,
4900    ) -> ProjectLocationJobExecutionCancelCall<'a, C> {
4901        self._delegate = Some(new_value);
4902        self
4903    }
4904
4905    /// Set any additional parameter of the query string used in the request.
4906    /// It should be used to set parameters which are not yet available through their own
4907    /// setters.
4908    ///
4909    /// Please note that this method must not be used to set any of the known parameters
4910    /// which have their own setter method. If done anyway, the request will fail.
4911    ///
4912    /// # Additional Parameters
4913    ///
4914    /// * *$.xgafv* (query-string) - V1 error format.
4915    /// * *access_token* (query-string) - OAuth access token.
4916    /// * *alt* (query-string) - Data format for response.
4917    /// * *callback* (query-string) - JSONP
4918    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4919    /// * *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.
4920    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4921    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4922    /// * *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.
4923    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4924    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4925    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionCancelCall<'a, C>
4926    where
4927        T: AsRef<str>,
4928    {
4929        self._additional_params
4930            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4931        self
4932    }
4933
4934    /// Identifies the authorization scope for the method you are building.
4935    ///
4936    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4937    /// [`Scope::CloudPlatform`].
4938    ///
4939    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4940    /// tokens for more than one scope.
4941    ///
4942    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4943    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4944    /// sufficient, a read-write scope will do as well.
4945    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionCancelCall<'a, C>
4946    where
4947        St: AsRef<str>,
4948    {
4949        self._scopes.insert(String::from(scope.as_ref()));
4950        self
4951    }
4952    /// Identifies the authorization scope(s) for the method you are building.
4953    ///
4954    /// See [`Self::add_scope()`] for details.
4955    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionCancelCall<'a, C>
4956    where
4957        I: IntoIterator<Item = St>,
4958        St: AsRef<str>,
4959    {
4960        self._scopes
4961            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4962        self
4963    }
4964
4965    /// Removes all scopes, and no default scope will be used either.
4966    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4967    /// for details).
4968    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionCancelCall<'a, C> {
4969        self._scopes.clear();
4970        self
4971    }
4972}
4973
4974/// Deletes an Execution.
4975///
4976/// A builder for the *locations.jobs.executions.delete* method supported by a *project* resource.
4977/// It is not used directly, but through a [`ProjectMethods`] instance.
4978///
4979/// # Example
4980///
4981/// Instantiate a resource method builder
4982///
4983/// ```test_harness,no_run
4984/// # extern crate hyper;
4985/// # extern crate hyper_rustls;
4986/// # extern crate google_run2 as run2;
4987/// # async fn dox() {
4988/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4989///
4990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4992/// #     .with_native_roots()
4993/// #     .unwrap()
4994/// #     .https_only()
4995/// #     .enable_http2()
4996/// #     .build();
4997///
4998/// # let executor = hyper_util::rt::TokioExecutor::new();
4999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5000/// #     secret,
5001/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5002/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5003/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5004/// #     ),
5005/// # ).build().await.unwrap();
5006///
5007/// # let client = hyper_util::client::legacy::Client::builder(
5008/// #     hyper_util::rt::TokioExecutor::new()
5009/// # )
5010/// # .build(
5011/// #     hyper_rustls::HttpsConnectorBuilder::new()
5012/// #         .with_native_roots()
5013/// #         .unwrap()
5014/// #         .https_or_http()
5015/// #         .enable_http2()
5016/// #         .build()
5017/// # );
5018/// # let mut hub = CloudRun::new(client, auth);
5019/// // You can configure optional parameters by calling the respective setters at will, and
5020/// // execute the final call using `doit()`.
5021/// // Values shown here are possibly random and not representative !
5022/// let result = hub.projects().locations_jobs_executions_delete("name")
5023///              .validate_only(true)
5024///              .etag("ipsum")
5025///              .doit().await;
5026/// # }
5027/// ```
5028pub struct ProjectLocationJobExecutionDeleteCall<'a, C>
5029where
5030    C: 'a,
5031{
5032    hub: &'a CloudRun<C>,
5033    _name: String,
5034    _validate_only: Option<bool>,
5035    _etag: Option<String>,
5036    _delegate: Option<&'a mut dyn common::Delegate>,
5037    _additional_params: HashMap<String, String>,
5038    _scopes: BTreeSet<String>,
5039}
5040
5041impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionDeleteCall<'a, C> {}
5042
5043impl<'a, C> ProjectLocationJobExecutionDeleteCall<'a, C>
5044where
5045    C: common::Connector,
5046{
5047    /// Perform the operation you have build so far.
5048    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
5049        use std::borrow::Cow;
5050        use std::io::{Read, Seek};
5051
5052        use common::{url::Params, ToParts};
5053        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5054
5055        let mut dd = common::DefaultDelegate;
5056        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5057        dlg.begin(common::MethodInfo {
5058            id: "run.projects.locations.jobs.executions.delete",
5059            http_method: hyper::Method::DELETE,
5060        });
5061
5062        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
5063            if self._additional_params.contains_key(field) {
5064                dlg.finished(false);
5065                return Err(common::Error::FieldClash(field));
5066            }
5067        }
5068
5069        let mut params = Params::with_capacity(5 + self._additional_params.len());
5070        params.push("name", self._name);
5071        if let Some(value) = self._validate_only.as_ref() {
5072            params.push("validateOnly", value.to_string());
5073        }
5074        if let Some(value) = self._etag.as_ref() {
5075            params.push("etag", value);
5076        }
5077
5078        params.extend(self._additional_params.iter());
5079
5080        params.push("alt", "json");
5081        let mut url = self.hub._base_url.clone() + "v2/{+name}";
5082        if self._scopes.is_empty() {
5083            self._scopes
5084                .insert(Scope::CloudPlatform.as_ref().to_string());
5085        }
5086
5087        #[allow(clippy::single_element_loop)]
5088        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5089            url = params.uri_replacement(url, param_name, find_this, true);
5090        }
5091        {
5092            let to_remove = ["name"];
5093            params.remove_params(&to_remove);
5094        }
5095
5096        let url = params.parse_with_url(&url);
5097
5098        loop {
5099            let token = match self
5100                .hub
5101                .auth
5102                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5103                .await
5104            {
5105                Ok(token) => token,
5106                Err(e) => match dlg.token(e) {
5107                    Ok(token) => token,
5108                    Err(e) => {
5109                        dlg.finished(false);
5110                        return Err(common::Error::MissingToken(e));
5111                    }
5112                },
5113            };
5114            let mut req_result = {
5115                let client = &self.hub.client;
5116                dlg.pre_request();
5117                let mut req_builder = hyper::Request::builder()
5118                    .method(hyper::Method::DELETE)
5119                    .uri(url.as_str())
5120                    .header(USER_AGENT, self.hub._user_agent.clone());
5121
5122                if let Some(token) = token.as_ref() {
5123                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5124                }
5125
5126                let request = req_builder
5127                    .header(CONTENT_LENGTH, 0_u64)
5128                    .body(common::to_body::<String>(None));
5129
5130                client.request(request.unwrap()).await
5131            };
5132
5133            match req_result {
5134                Err(err) => {
5135                    if let common::Retry::After(d) = dlg.http_error(&err) {
5136                        sleep(d).await;
5137                        continue;
5138                    }
5139                    dlg.finished(false);
5140                    return Err(common::Error::HttpError(err));
5141                }
5142                Ok(res) => {
5143                    let (mut parts, body) = res.into_parts();
5144                    let mut body = common::Body::new(body);
5145                    if !parts.status.is_success() {
5146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5147                        let error = serde_json::from_str(&common::to_string(&bytes));
5148                        let response = common::to_response(parts, bytes.into());
5149
5150                        if let common::Retry::After(d) =
5151                            dlg.http_failure(&response, error.as_ref().ok())
5152                        {
5153                            sleep(d).await;
5154                            continue;
5155                        }
5156
5157                        dlg.finished(false);
5158
5159                        return Err(match error {
5160                            Ok(value) => common::Error::BadRequest(value),
5161                            _ => common::Error::Failure(response),
5162                        });
5163                    }
5164                    let response = {
5165                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5166                        let encoded = common::to_string(&bytes);
5167                        match serde_json::from_str(&encoded) {
5168                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5169                            Err(error) => {
5170                                dlg.response_json_decode_error(&encoded, &error);
5171                                return Err(common::Error::JsonDecodeError(
5172                                    encoded.to_string(),
5173                                    error,
5174                                ));
5175                            }
5176                        }
5177                    };
5178
5179                    dlg.finished(true);
5180                    return Ok(response);
5181                }
5182            }
5183        }
5184    }
5185
5186    /// Required. The name of the Execution to delete. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
5187    ///
5188    /// Sets the *name* path property to the given value.
5189    ///
5190    /// Even though the property as already been set when instantiating this call,
5191    /// we provide this method for API completeness.
5192    pub fn name(mut self, new_value: &str) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
5193        self._name = new_value.to_string();
5194        self
5195    }
5196    /// Indicates that the request should be validated without actually deleting any resources.
5197    ///
5198    /// Sets the *validate only* query property to the given value.
5199    pub fn validate_only(
5200        mut self,
5201        new_value: bool,
5202    ) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
5203        self._validate_only = Some(new_value);
5204        self
5205    }
5206    /// A system-generated fingerprint for this version of the resource. This may be used to detect modification conflict during updates.
5207    ///
5208    /// Sets the *etag* query property to the given value.
5209    pub fn etag(mut self, new_value: &str) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
5210        self._etag = Some(new_value.to_string());
5211        self
5212    }
5213    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5214    /// while executing the actual API request.
5215    ///
5216    /// ````text
5217    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5218    /// ````
5219    ///
5220    /// Sets the *delegate* property to the given value.
5221    pub fn delegate(
5222        mut self,
5223        new_value: &'a mut dyn common::Delegate,
5224    ) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
5225        self._delegate = Some(new_value);
5226        self
5227    }
5228
5229    /// Set any additional parameter of the query string used in the request.
5230    /// It should be used to set parameters which are not yet available through their own
5231    /// setters.
5232    ///
5233    /// Please note that this method must not be used to set any of the known parameters
5234    /// which have their own setter method. If done anyway, the request will fail.
5235    ///
5236    /// # Additional Parameters
5237    ///
5238    /// * *$.xgafv* (query-string) - V1 error format.
5239    /// * *access_token* (query-string) - OAuth access token.
5240    /// * *alt* (query-string) - Data format for response.
5241    /// * *callback* (query-string) - JSONP
5242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5243    /// * *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.
5244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5246    /// * *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.
5247    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5248    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5249    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionDeleteCall<'a, C>
5250    where
5251        T: AsRef<str>,
5252    {
5253        self._additional_params
5254            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5255        self
5256    }
5257
5258    /// Identifies the authorization scope for the method you are building.
5259    ///
5260    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5261    /// [`Scope::CloudPlatform`].
5262    ///
5263    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5264    /// tokens for more than one scope.
5265    ///
5266    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5267    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5268    /// sufficient, a read-write scope will do as well.
5269    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionDeleteCall<'a, C>
5270    where
5271        St: AsRef<str>,
5272    {
5273        self._scopes.insert(String::from(scope.as_ref()));
5274        self
5275    }
5276    /// Identifies the authorization scope(s) for the method you are building.
5277    ///
5278    /// See [`Self::add_scope()`] for details.
5279    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionDeleteCall<'a, C>
5280    where
5281        I: IntoIterator<Item = St>,
5282        St: AsRef<str>,
5283    {
5284        self._scopes
5285            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5286        self
5287    }
5288
5289    /// Removes all scopes, and no default scope will be used either.
5290    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5291    /// for details).
5292    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionDeleteCall<'a, C> {
5293        self._scopes.clear();
5294        self
5295    }
5296}
5297
5298/// Read the status of an image export operation.
5299///
5300/// A builder for the *locations.jobs.executions.exportStatus* method supported by a *project* resource.
5301/// It is not used directly, but through a [`ProjectMethods`] instance.
5302///
5303/// # Example
5304///
5305/// Instantiate a resource method builder
5306///
5307/// ```test_harness,no_run
5308/// # extern crate hyper;
5309/// # extern crate hyper_rustls;
5310/// # extern crate google_run2 as run2;
5311/// # async fn dox() {
5312/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5313///
5314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5315/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5316/// #     .with_native_roots()
5317/// #     .unwrap()
5318/// #     .https_only()
5319/// #     .enable_http2()
5320/// #     .build();
5321///
5322/// # let executor = hyper_util::rt::TokioExecutor::new();
5323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5324/// #     secret,
5325/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5326/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5327/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5328/// #     ),
5329/// # ).build().await.unwrap();
5330///
5331/// # let client = hyper_util::client::legacy::Client::builder(
5332/// #     hyper_util::rt::TokioExecutor::new()
5333/// # )
5334/// # .build(
5335/// #     hyper_rustls::HttpsConnectorBuilder::new()
5336/// #         .with_native_roots()
5337/// #         .unwrap()
5338/// #         .https_or_http()
5339/// #         .enable_http2()
5340/// #         .build()
5341/// # );
5342/// # let mut hub = CloudRun::new(client, auth);
5343/// // You can configure optional parameters by calling the respective setters at will, and
5344/// // execute the final call using `doit()`.
5345/// // Values shown here are possibly random and not representative !
5346/// let result = hub.projects().locations_jobs_executions_export_status("name", "operationId")
5347///              .doit().await;
5348/// # }
5349/// ```
5350pub struct ProjectLocationJobExecutionExportStatuCall<'a, C>
5351where
5352    C: 'a,
5353{
5354    hub: &'a CloudRun<C>,
5355    _name: String,
5356    _operation_id: String,
5357    _delegate: Option<&'a mut dyn common::Delegate>,
5358    _additional_params: HashMap<String, String>,
5359    _scopes: BTreeSet<String>,
5360}
5361
5362impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionExportStatuCall<'a, C> {}
5363
5364impl<'a, C> ProjectLocationJobExecutionExportStatuCall<'a, C>
5365where
5366    C: common::Connector,
5367{
5368    /// Perform the operation you have build so far.
5369    pub async fn doit(
5370        mut self,
5371    ) -> common::Result<(common::Response, GoogleCloudRunV2ExportStatusResponse)> {
5372        use std::borrow::Cow;
5373        use std::io::{Read, Seek};
5374
5375        use common::{url::Params, ToParts};
5376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5377
5378        let mut dd = common::DefaultDelegate;
5379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5380        dlg.begin(common::MethodInfo {
5381            id: "run.projects.locations.jobs.executions.exportStatus",
5382            http_method: hyper::Method::GET,
5383        });
5384
5385        for &field in ["alt", "name", "operationId"].iter() {
5386            if self._additional_params.contains_key(field) {
5387                dlg.finished(false);
5388                return Err(common::Error::FieldClash(field));
5389            }
5390        }
5391
5392        let mut params = Params::with_capacity(4 + self._additional_params.len());
5393        params.push("name", self._name);
5394        params.push("operationId", self._operation_id);
5395
5396        params.extend(self._additional_params.iter());
5397
5398        params.push("alt", "json");
5399        let mut url = self.hub._base_url.clone() + "v2/{+name}/{+operationId}:exportStatus";
5400        if self._scopes.is_empty() {
5401            self._scopes
5402                .insert(Scope::CloudPlatform.as_ref().to_string());
5403        }
5404
5405        #[allow(clippy::single_element_loop)]
5406        for &(find_this, param_name) in
5407            [("{+name}", "name"), ("{+operationId}", "operationId")].iter()
5408        {
5409            url = params.uri_replacement(url, param_name, find_this, true);
5410        }
5411        {
5412            let to_remove = ["operationId", "name"];
5413            params.remove_params(&to_remove);
5414        }
5415
5416        let url = params.parse_with_url(&url);
5417
5418        loop {
5419            let token = match self
5420                .hub
5421                .auth
5422                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5423                .await
5424            {
5425                Ok(token) => token,
5426                Err(e) => match dlg.token(e) {
5427                    Ok(token) => token,
5428                    Err(e) => {
5429                        dlg.finished(false);
5430                        return Err(common::Error::MissingToken(e));
5431                    }
5432                },
5433            };
5434            let mut req_result = {
5435                let client = &self.hub.client;
5436                dlg.pre_request();
5437                let mut req_builder = hyper::Request::builder()
5438                    .method(hyper::Method::GET)
5439                    .uri(url.as_str())
5440                    .header(USER_AGENT, self.hub._user_agent.clone());
5441
5442                if let Some(token) = token.as_ref() {
5443                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5444                }
5445
5446                let request = req_builder
5447                    .header(CONTENT_LENGTH, 0_u64)
5448                    .body(common::to_body::<String>(None));
5449
5450                client.request(request.unwrap()).await
5451            };
5452
5453            match req_result {
5454                Err(err) => {
5455                    if let common::Retry::After(d) = dlg.http_error(&err) {
5456                        sleep(d).await;
5457                        continue;
5458                    }
5459                    dlg.finished(false);
5460                    return Err(common::Error::HttpError(err));
5461                }
5462                Ok(res) => {
5463                    let (mut parts, body) = res.into_parts();
5464                    let mut body = common::Body::new(body);
5465                    if !parts.status.is_success() {
5466                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5467                        let error = serde_json::from_str(&common::to_string(&bytes));
5468                        let response = common::to_response(parts, bytes.into());
5469
5470                        if let common::Retry::After(d) =
5471                            dlg.http_failure(&response, error.as_ref().ok())
5472                        {
5473                            sleep(d).await;
5474                            continue;
5475                        }
5476
5477                        dlg.finished(false);
5478
5479                        return Err(match error {
5480                            Ok(value) => common::Error::BadRequest(value),
5481                            _ => common::Error::Failure(response),
5482                        });
5483                    }
5484                    let response = {
5485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5486                        let encoded = common::to_string(&bytes);
5487                        match serde_json::from_str(&encoded) {
5488                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5489                            Err(error) => {
5490                                dlg.response_json_decode_error(&encoded, &error);
5491                                return Err(common::Error::JsonDecodeError(
5492                                    encoded.to_string(),
5493                                    error,
5494                                ));
5495                            }
5496                        }
5497                    };
5498
5499                    dlg.finished(true);
5500                    return Ok(response);
5501                }
5502            }
5503        }
5504    }
5505
5506    /// Required. The name of the resource of which image export operation status has to be fetched. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
5507    ///
5508    /// Sets the *name* path property to the given value.
5509    ///
5510    /// Even though the property as already been set when instantiating this call,
5511    /// we provide this method for API completeness.
5512    pub fn name(mut self, new_value: &str) -> ProjectLocationJobExecutionExportStatuCall<'a, C> {
5513        self._name = new_value.to_string();
5514        self
5515    }
5516    /// Required. The operation id returned from ExportImage.
5517    ///
5518    /// Sets the *operation id* path property to the given value.
5519    ///
5520    /// Even though the property as already been set when instantiating this call,
5521    /// we provide this method for API completeness.
5522    pub fn operation_id(
5523        mut self,
5524        new_value: &str,
5525    ) -> ProjectLocationJobExecutionExportStatuCall<'a, C> {
5526        self._operation_id = new_value.to_string();
5527        self
5528    }
5529    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5530    /// while executing the actual API request.
5531    ///
5532    /// ````text
5533    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5534    /// ````
5535    ///
5536    /// Sets the *delegate* property to the given value.
5537    pub fn delegate(
5538        mut self,
5539        new_value: &'a mut dyn common::Delegate,
5540    ) -> ProjectLocationJobExecutionExportStatuCall<'a, C> {
5541        self._delegate = Some(new_value);
5542        self
5543    }
5544
5545    /// Set any additional parameter of the query string used in the request.
5546    /// It should be used to set parameters which are not yet available through their own
5547    /// setters.
5548    ///
5549    /// Please note that this method must not be used to set any of the known parameters
5550    /// which have their own setter method. If done anyway, the request will fail.
5551    ///
5552    /// # Additional Parameters
5553    ///
5554    /// * *$.xgafv* (query-string) - V1 error format.
5555    /// * *access_token* (query-string) - OAuth access token.
5556    /// * *alt* (query-string) - Data format for response.
5557    /// * *callback* (query-string) - JSONP
5558    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5559    /// * *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.
5560    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5561    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5562    /// * *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.
5563    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5564    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5565    pub fn param<T>(
5566        mut self,
5567        name: T,
5568        value: T,
5569    ) -> ProjectLocationJobExecutionExportStatuCall<'a, C>
5570    where
5571        T: AsRef<str>,
5572    {
5573        self._additional_params
5574            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5575        self
5576    }
5577
5578    /// Identifies the authorization scope for the method you are building.
5579    ///
5580    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5581    /// [`Scope::CloudPlatform`].
5582    ///
5583    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5584    /// tokens for more than one scope.
5585    ///
5586    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5587    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5588    /// sufficient, a read-write scope will do as well.
5589    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionExportStatuCall<'a, C>
5590    where
5591        St: AsRef<str>,
5592    {
5593        self._scopes.insert(String::from(scope.as_ref()));
5594        self
5595    }
5596    /// Identifies the authorization scope(s) for the method you are building.
5597    ///
5598    /// See [`Self::add_scope()`] for details.
5599    pub fn add_scopes<I, St>(
5600        mut self,
5601        scopes: I,
5602    ) -> ProjectLocationJobExecutionExportStatuCall<'a, C>
5603    where
5604        I: IntoIterator<Item = St>,
5605        St: AsRef<str>,
5606    {
5607        self._scopes
5608            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5609        self
5610    }
5611
5612    /// Removes all scopes, and no default scope will be used either.
5613    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5614    /// for details).
5615    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionExportStatuCall<'a, C> {
5616        self._scopes.clear();
5617        self
5618    }
5619}
5620
5621/// Gets information about an Execution.
5622///
5623/// A builder for the *locations.jobs.executions.get* method supported by a *project* resource.
5624/// It is not used directly, but through a [`ProjectMethods`] instance.
5625///
5626/// # Example
5627///
5628/// Instantiate a resource method builder
5629///
5630/// ```test_harness,no_run
5631/// # extern crate hyper;
5632/// # extern crate hyper_rustls;
5633/// # extern crate google_run2 as run2;
5634/// # async fn dox() {
5635/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5636///
5637/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5638/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5639/// #     .with_native_roots()
5640/// #     .unwrap()
5641/// #     .https_only()
5642/// #     .enable_http2()
5643/// #     .build();
5644///
5645/// # let executor = hyper_util::rt::TokioExecutor::new();
5646/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5647/// #     secret,
5648/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5649/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5650/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5651/// #     ),
5652/// # ).build().await.unwrap();
5653///
5654/// # let client = hyper_util::client::legacy::Client::builder(
5655/// #     hyper_util::rt::TokioExecutor::new()
5656/// # )
5657/// # .build(
5658/// #     hyper_rustls::HttpsConnectorBuilder::new()
5659/// #         .with_native_roots()
5660/// #         .unwrap()
5661/// #         .https_or_http()
5662/// #         .enable_http2()
5663/// #         .build()
5664/// # );
5665/// # let mut hub = CloudRun::new(client, auth);
5666/// // You can configure optional parameters by calling the respective setters at will, and
5667/// // execute the final call using `doit()`.
5668/// // Values shown here are possibly random and not representative !
5669/// let result = hub.projects().locations_jobs_executions_get("name")
5670///              .doit().await;
5671/// # }
5672/// ```
5673pub struct ProjectLocationJobExecutionGetCall<'a, C>
5674where
5675    C: 'a,
5676{
5677    hub: &'a CloudRun<C>,
5678    _name: String,
5679    _delegate: Option<&'a mut dyn common::Delegate>,
5680    _additional_params: HashMap<String, String>,
5681    _scopes: BTreeSet<String>,
5682}
5683
5684impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionGetCall<'a, C> {}
5685
5686impl<'a, C> ProjectLocationJobExecutionGetCall<'a, C>
5687where
5688    C: common::Connector,
5689{
5690    /// Perform the operation you have build so far.
5691    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Execution)> {
5692        use std::borrow::Cow;
5693        use std::io::{Read, Seek};
5694
5695        use common::{url::Params, ToParts};
5696        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5697
5698        let mut dd = common::DefaultDelegate;
5699        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5700        dlg.begin(common::MethodInfo {
5701            id: "run.projects.locations.jobs.executions.get",
5702            http_method: hyper::Method::GET,
5703        });
5704
5705        for &field in ["alt", "name"].iter() {
5706            if self._additional_params.contains_key(field) {
5707                dlg.finished(false);
5708                return Err(common::Error::FieldClash(field));
5709            }
5710        }
5711
5712        let mut params = Params::with_capacity(3 + self._additional_params.len());
5713        params.push("name", self._name);
5714
5715        params.extend(self._additional_params.iter());
5716
5717        params.push("alt", "json");
5718        let mut url = self.hub._base_url.clone() + "v2/{+name}";
5719        if self._scopes.is_empty() {
5720            self._scopes
5721                .insert(Scope::CloudPlatform.as_ref().to_string());
5722        }
5723
5724        #[allow(clippy::single_element_loop)]
5725        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5726            url = params.uri_replacement(url, param_name, find_this, true);
5727        }
5728        {
5729            let to_remove = ["name"];
5730            params.remove_params(&to_remove);
5731        }
5732
5733        let url = params.parse_with_url(&url);
5734
5735        loop {
5736            let token = match self
5737                .hub
5738                .auth
5739                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5740                .await
5741            {
5742                Ok(token) => token,
5743                Err(e) => match dlg.token(e) {
5744                    Ok(token) => token,
5745                    Err(e) => {
5746                        dlg.finished(false);
5747                        return Err(common::Error::MissingToken(e));
5748                    }
5749                },
5750            };
5751            let mut req_result = {
5752                let client = &self.hub.client;
5753                dlg.pre_request();
5754                let mut req_builder = hyper::Request::builder()
5755                    .method(hyper::Method::GET)
5756                    .uri(url.as_str())
5757                    .header(USER_AGENT, self.hub._user_agent.clone());
5758
5759                if let Some(token) = token.as_ref() {
5760                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5761                }
5762
5763                let request = req_builder
5764                    .header(CONTENT_LENGTH, 0_u64)
5765                    .body(common::to_body::<String>(None));
5766
5767                client.request(request.unwrap()).await
5768            };
5769
5770            match req_result {
5771                Err(err) => {
5772                    if let common::Retry::After(d) = dlg.http_error(&err) {
5773                        sleep(d).await;
5774                        continue;
5775                    }
5776                    dlg.finished(false);
5777                    return Err(common::Error::HttpError(err));
5778                }
5779                Ok(res) => {
5780                    let (mut parts, body) = res.into_parts();
5781                    let mut body = common::Body::new(body);
5782                    if !parts.status.is_success() {
5783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5784                        let error = serde_json::from_str(&common::to_string(&bytes));
5785                        let response = common::to_response(parts, bytes.into());
5786
5787                        if let common::Retry::After(d) =
5788                            dlg.http_failure(&response, error.as_ref().ok())
5789                        {
5790                            sleep(d).await;
5791                            continue;
5792                        }
5793
5794                        dlg.finished(false);
5795
5796                        return Err(match error {
5797                            Ok(value) => common::Error::BadRequest(value),
5798                            _ => common::Error::Failure(response),
5799                        });
5800                    }
5801                    let response = {
5802                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5803                        let encoded = common::to_string(&bytes);
5804                        match serde_json::from_str(&encoded) {
5805                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5806                            Err(error) => {
5807                                dlg.response_json_decode_error(&encoded, &error);
5808                                return Err(common::Error::JsonDecodeError(
5809                                    encoded.to_string(),
5810                                    error,
5811                                ));
5812                            }
5813                        }
5814                    };
5815
5816                    dlg.finished(true);
5817                    return Ok(response);
5818                }
5819            }
5820        }
5821    }
5822
5823    /// Required. The full name of the Execution. Format: `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where `{project}` can be project id or number.
5824    ///
5825    /// Sets the *name* path property to the given value.
5826    ///
5827    /// Even though the property as already been set when instantiating this call,
5828    /// we provide this method for API completeness.
5829    pub fn name(mut self, new_value: &str) -> ProjectLocationJobExecutionGetCall<'a, C> {
5830        self._name = new_value.to_string();
5831        self
5832    }
5833    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5834    /// while executing the actual API request.
5835    ///
5836    /// ````text
5837    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5838    /// ````
5839    ///
5840    /// Sets the *delegate* property to the given value.
5841    pub fn delegate(
5842        mut self,
5843        new_value: &'a mut dyn common::Delegate,
5844    ) -> ProjectLocationJobExecutionGetCall<'a, C> {
5845        self._delegate = Some(new_value);
5846        self
5847    }
5848
5849    /// Set any additional parameter of the query string used in the request.
5850    /// It should be used to set parameters which are not yet available through their own
5851    /// setters.
5852    ///
5853    /// Please note that this method must not be used to set any of the known parameters
5854    /// which have their own setter method. If done anyway, the request will fail.
5855    ///
5856    /// # Additional Parameters
5857    ///
5858    /// * *$.xgafv* (query-string) - V1 error format.
5859    /// * *access_token* (query-string) - OAuth access token.
5860    /// * *alt* (query-string) - Data format for response.
5861    /// * *callback* (query-string) - JSONP
5862    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5863    /// * *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.
5864    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5865    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5866    /// * *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.
5867    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5868    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5869    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionGetCall<'a, C>
5870    where
5871        T: AsRef<str>,
5872    {
5873        self._additional_params
5874            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5875        self
5876    }
5877
5878    /// Identifies the authorization scope for the method you are building.
5879    ///
5880    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5881    /// [`Scope::CloudPlatform`].
5882    ///
5883    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5884    /// tokens for more than one scope.
5885    ///
5886    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5887    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5888    /// sufficient, a read-write scope will do as well.
5889    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionGetCall<'a, C>
5890    where
5891        St: AsRef<str>,
5892    {
5893        self._scopes.insert(String::from(scope.as_ref()));
5894        self
5895    }
5896    /// Identifies the authorization scope(s) for the method you are building.
5897    ///
5898    /// See [`Self::add_scope()`] for details.
5899    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionGetCall<'a, C>
5900    where
5901        I: IntoIterator<Item = St>,
5902        St: AsRef<str>,
5903    {
5904        self._scopes
5905            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5906        self
5907    }
5908
5909    /// Removes all scopes, and no default scope will be used either.
5910    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5911    /// for details).
5912    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionGetCall<'a, C> {
5913        self._scopes.clear();
5914        self
5915    }
5916}
5917
5918/// Lists Executions from a Job. Results are sorted by creation time, descending.
5919///
5920/// A builder for the *locations.jobs.executions.list* method supported by a *project* resource.
5921/// It is not used directly, but through a [`ProjectMethods`] instance.
5922///
5923/// # Example
5924///
5925/// Instantiate a resource method builder
5926///
5927/// ```test_harness,no_run
5928/// # extern crate hyper;
5929/// # extern crate hyper_rustls;
5930/// # extern crate google_run2 as run2;
5931/// # async fn dox() {
5932/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5933///
5934/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5935/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5936/// #     .with_native_roots()
5937/// #     .unwrap()
5938/// #     .https_only()
5939/// #     .enable_http2()
5940/// #     .build();
5941///
5942/// # let executor = hyper_util::rt::TokioExecutor::new();
5943/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5944/// #     secret,
5945/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5946/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5947/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5948/// #     ),
5949/// # ).build().await.unwrap();
5950///
5951/// # let client = hyper_util::client::legacy::Client::builder(
5952/// #     hyper_util::rt::TokioExecutor::new()
5953/// # )
5954/// # .build(
5955/// #     hyper_rustls::HttpsConnectorBuilder::new()
5956/// #         .with_native_roots()
5957/// #         .unwrap()
5958/// #         .https_or_http()
5959/// #         .enable_http2()
5960/// #         .build()
5961/// # );
5962/// # let mut hub = CloudRun::new(client, auth);
5963/// // You can configure optional parameters by calling the respective setters at will, and
5964/// // execute the final call using `doit()`.
5965/// // Values shown here are possibly random and not representative !
5966/// let result = hub.projects().locations_jobs_executions_list("parent")
5967///              .show_deleted(true)
5968///              .page_token("eos")
5969///              .page_size(-86)
5970///              .doit().await;
5971/// # }
5972/// ```
5973pub struct ProjectLocationJobExecutionListCall<'a, C>
5974where
5975    C: 'a,
5976{
5977    hub: &'a CloudRun<C>,
5978    _parent: String,
5979    _show_deleted: Option<bool>,
5980    _page_token: Option<String>,
5981    _page_size: Option<i32>,
5982    _delegate: Option<&'a mut dyn common::Delegate>,
5983    _additional_params: HashMap<String, String>,
5984    _scopes: BTreeSet<String>,
5985}
5986
5987impl<'a, C> common::CallBuilder for ProjectLocationJobExecutionListCall<'a, C> {}
5988
5989impl<'a, C> ProjectLocationJobExecutionListCall<'a, C>
5990where
5991    C: common::Connector,
5992{
5993    /// Perform the operation you have build so far.
5994    pub async fn doit(
5995        mut self,
5996    ) -> common::Result<(common::Response, GoogleCloudRunV2ListExecutionsResponse)> {
5997        use std::borrow::Cow;
5998        use std::io::{Read, Seek};
5999
6000        use common::{url::Params, ToParts};
6001        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6002
6003        let mut dd = common::DefaultDelegate;
6004        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6005        dlg.begin(common::MethodInfo {
6006            id: "run.projects.locations.jobs.executions.list",
6007            http_method: hyper::Method::GET,
6008        });
6009
6010        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
6011            if self._additional_params.contains_key(field) {
6012                dlg.finished(false);
6013                return Err(common::Error::FieldClash(field));
6014            }
6015        }
6016
6017        let mut params = Params::with_capacity(6 + self._additional_params.len());
6018        params.push("parent", self._parent);
6019        if let Some(value) = self._show_deleted.as_ref() {
6020            params.push("showDeleted", value.to_string());
6021        }
6022        if let Some(value) = self._page_token.as_ref() {
6023            params.push("pageToken", value);
6024        }
6025        if let Some(value) = self._page_size.as_ref() {
6026            params.push("pageSize", value.to_string());
6027        }
6028
6029        params.extend(self._additional_params.iter());
6030
6031        params.push("alt", "json");
6032        let mut url = self.hub._base_url.clone() + "v2/{+parent}/executions";
6033        if self._scopes.is_empty() {
6034            self._scopes
6035                .insert(Scope::CloudPlatform.as_ref().to_string());
6036        }
6037
6038        #[allow(clippy::single_element_loop)]
6039        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6040            url = params.uri_replacement(url, param_name, find_this, true);
6041        }
6042        {
6043            let to_remove = ["parent"];
6044            params.remove_params(&to_remove);
6045        }
6046
6047        let url = params.parse_with_url(&url);
6048
6049        loop {
6050            let token = match self
6051                .hub
6052                .auth
6053                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6054                .await
6055            {
6056                Ok(token) => token,
6057                Err(e) => match dlg.token(e) {
6058                    Ok(token) => token,
6059                    Err(e) => {
6060                        dlg.finished(false);
6061                        return Err(common::Error::MissingToken(e));
6062                    }
6063                },
6064            };
6065            let mut req_result = {
6066                let client = &self.hub.client;
6067                dlg.pre_request();
6068                let mut req_builder = hyper::Request::builder()
6069                    .method(hyper::Method::GET)
6070                    .uri(url.as_str())
6071                    .header(USER_AGENT, self.hub._user_agent.clone());
6072
6073                if let Some(token) = token.as_ref() {
6074                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6075                }
6076
6077                let request = req_builder
6078                    .header(CONTENT_LENGTH, 0_u64)
6079                    .body(common::to_body::<String>(None));
6080
6081                client.request(request.unwrap()).await
6082            };
6083
6084            match req_result {
6085                Err(err) => {
6086                    if let common::Retry::After(d) = dlg.http_error(&err) {
6087                        sleep(d).await;
6088                        continue;
6089                    }
6090                    dlg.finished(false);
6091                    return Err(common::Error::HttpError(err));
6092                }
6093                Ok(res) => {
6094                    let (mut parts, body) = res.into_parts();
6095                    let mut body = common::Body::new(body);
6096                    if !parts.status.is_success() {
6097                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6098                        let error = serde_json::from_str(&common::to_string(&bytes));
6099                        let response = common::to_response(parts, bytes.into());
6100
6101                        if let common::Retry::After(d) =
6102                            dlg.http_failure(&response, error.as_ref().ok())
6103                        {
6104                            sleep(d).await;
6105                            continue;
6106                        }
6107
6108                        dlg.finished(false);
6109
6110                        return Err(match error {
6111                            Ok(value) => common::Error::BadRequest(value),
6112                            _ => common::Error::Failure(response),
6113                        });
6114                    }
6115                    let response = {
6116                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6117                        let encoded = common::to_string(&bytes);
6118                        match serde_json::from_str(&encoded) {
6119                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6120                            Err(error) => {
6121                                dlg.response_json_decode_error(&encoded, &error);
6122                                return Err(common::Error::JsonDecodeError(
6123                                    encoded.to_string(),
6124                                    error,
6125                                ));
6126                            }
6127                        }
6128                    };
6129
6130                    dlg.finished(true);
6131                    return Ok(response);
6132                }
6133            }
6134        }
6135    }
6136
6137    /// Required. The Execution from which the Executions should be listed. To list all Executions across Jobs, use "-" instead of Job name. Format: `projects/{project}/locations/{location}/jobs/{job}`, where `{project}` can be project id or number.
6138    ///
6139    /// Sets the *parent* path property to the given value.
6140    ///
6141    /// Even though the property as already been set when instantiating this call,
6142    /// we provide this method for API completeness.
6143    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobExecutionListCall<'a, C> {
6144        self._parent = new_value.to_string();
6145        self
6146    }
6147    /// If true, returns deleted (but unexpired) resources along with active ones.
6148    ///
6149    /// Sets the *show deleted* query property to the given value.
6150    pub fn show_deleted(mut self, new_value: bool) -> ProjectLocationJobExecutionListCall<'a, C> {
6151        self._show_deleted = Some(new_value);
6152        self
6153    }
6154    /// A page token received from a previous call to ListExecutions. All other parameters must match.
6155    ///
6156    /// Sets the *page token* query property to the given value.
6157    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobExecutionListCall<'a, C> {
6158        self._page_token = Some(new_value.to_string());
6159        self
6160    }
6161    /// Maximum number of Executions to return in this call.
6162    ///
6163    /// Sets the *page size* query property to the given value.
6164    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobExecutionListCall<'a, C> {
6165        self._page_size = Some(new_value);
6166        self
6167    }
6168    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6169    /// while executing the actual API request.
6170    ///
6171    /// ````text
6172    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6173    /// ````
6174    ///
6175    /// Sets the *delegate* property to the given value.
6176    pub fn delegate(
6177        mut self,
6178        new_value: &'a mut dyn common::Delegate,
6179    ) -> ProjectLocationJobExecutionListCall<'a, C> {
6180        self._delegate = Some(new_value);
6181        self
6182    }
6183
6184    /// Set any additional parameter of the query string used in the request.
6185    /// It should be used to set parameters which are not yet available through their own
6186    /// setters.
6187    ///
6188    /// Please note that this method must not be used to set any of the known parameters
6189    /// which have their own setter method. If done anyway, the request will fail.
6190    ///
6191    /// # Additional Parameters
6192    ///
6193    /// * *$.xgafv* (query-string) - V1 error format.
6194    /// * *access_token* (query-string) - OAuth access token.
6195    /// * *alt* (query-string) - Data format for response.
6196    /// * *callback* (query-string) - JSONP
6197    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6198    /// * *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.
6199    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6200    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6201    /// * *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.
6202    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6203    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6204    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobExecutionListCall<'a, C>
6205    where
6206        T: AsRef<str>,
6207    {
6208        self._additional_params
6209            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6210        self
6211    }
6212
6213    /// Identifies the authorization scope for the method you are building.
6214    ///
6215    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6216    /// [`Scope::CloudPlatform`].
6217    ///
6218    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6219    /// tokens for more than one scope.
6220    ///
6221    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6222    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6223    /// sufficient, a read-write scope will do as well.
6224    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobExecutionListCall<'a, C>
6225    where
6226        St: AsRef<str>,
6227    {
6228        self._scopes.insert(String::from(scope.as_ref()));
6229        self
6230    }
6231    /// Identifies the authorization scope(s) for the method you are building.
6232    ///
6233    /// See [`Self::add_scope()`] for details.
6234    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobExecutionListCall<'a, C>
6235    where
6236        I: IntoIterator<Item = St>,
6237        St: AsRef<str>,
6238    {
6239        self._scopes
6240            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6241        self
6242    }
6243
6244    /// Removes all scopes, and no default scope will be used either.
6245    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6246    /// for details).
6247    pub fn clear_scopes(mut self) -> ProjectLocationJobExecutionListCall<'a, C> {
6248        self._scopes.clear();
6249        self
6250    }
6251}
6252
6253/// Creates a Job.
6254///
6255/// A builder for the *locations.jobs.create* method supported by a *project* resource.
6256/// It is not used directly, but through a [`ProjectMethods`] instance.
6257///
6258/// # Example
6259///
6260/// Instantiate a resource method builder
6261///
6262/// ```test_harness,no_run
6263/// # extern crate hyper;
6264/// # extern crate hyper_rustls;
6265/// # extern crate google_run2 as run2;
6266/// use run2::api::GoogleCloudRunV2Job;
6267/// # async fn dox() {
6268/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6269///
6270/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6271/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6272/// #     .with_native_roots()
6273/// #     .unwrap()
6274/// #     .https_only()
6275/// #     .enable_http2()
6276/// #     .build();
6277///
6278/// # let executor = hyper_util::rt::TokioExecutor::new();
6279/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6280/// #     secret,
6281/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6282/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6283/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6284/// #     ),
6285/// # ).build().await.unwrap();
6286///
6287/// # let client = hyper_util::client::legacy::Client::builder(
6288/// #     hyper_util::rt::TokioExecutor::new()
6289/// # )
6290/// # .build(
6291/// #     hyper_rustls::HttpsConnectorBuilder::new()
6292/// #         .with_native_roots()
6293/// #         .unwrap()
6294/// #         .https_or_http()
6295/// #         .enable_http2()
6296/// #         .build()
6297/// # );
6298/// # let mut hub = CloudRun::new(client, auth);
6299/// // As the method needs a request, you would usually fill it with the desired information
6300/// // into the respective structure. Some of the parts shown here might not be applicable !
6301/// // Values shown here are possibly random and not representative !
6302/// let mut req = GoogleCloudRunV2Job::default();
6303///
6304/// // You can configure optional parameters by calling the respective setters at will, and
6305/// // execute the final call using `doit()`.
6306/// // Values shown here are possibly random and not representative !
6307/// let result = hub.projects().locations_jobs_create(req, "parent")
6308///              .validate_only(false)
6309///              .job_id("sed")
6310///              .doit().await;
6311/// # }
6312/// ```
6313pub struct ProjectLocationJobCreateCall<'a, C>
6314where
6315    C: 'a,
6316{
6317    hub: &'a CloudRun<C>,
6318    _request: GoogleCloudRunV2Job,
6319    _parent: String,
6320    _validate_only: Option<bool>,
6321    _job_id: Option<String>,
6322    _delegate: Option<&'a mut dyn common::Delegate>,
6323    _additional_params: HashMap<String, String>,
6324    _scopes: BTreeSet<String>,
6325}
6326
6327impl<'a, C> common::CallBuilder for ProjectLocationJobCreateCall<'a, C> {}
6328
6329impl<'a, C> ProjectLocationJobCreateCall<'a, C>
6330where
6331    C: common::Connector,
6332{
6333    /// Perform the operation you have build so far.
6334    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
6335        use std::borrow::Cow;
6336        use std::io::{Read, Seek};
6337
6338        use common::{url::Params, ToParts};
6339        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6340
6341        let mut dd = common::DefaultDelegate;
6342        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6343        dlg.begin(common::MethodInfo {
6344            id: "run.projects.locations.jobs.create",
6345            http_method: hyper::Method::POST,
6346        });
6347
6348        for &field in ["alt", "parent", "validateOnly", "jobId"].iter() {
6349            if self._additional_params.contains_key(field) {
6350                dlg.finished(false);
6351                return Err(common::Error::FieldClash(field));
6352            }
6353        }
6354
6355        let mut params = Params::with_capacity(6 + self._additional_params.len());
6356        params.push("parent", self._parent);
6357        if let Some(value) = self._validate_only.as_ref() {
6358            params.push("validateOnly", value.to_string());
6359        }
6360        if let Some(value) = self._job_id.as_ref() {
6361            params.push("jobId", value);
6362        }
6363
6364        params.extend(self._additional_params.iter());
6365
6366        params.push("alt", "json");
6367        let mut url = self.hub._base_url.clone() + "v2/{+parent}/jobs";
6368        if self._scopes.is_empty() {
6369            self._scopes
6370                .insert(Scope::CloudPlatform.as_ref().to_string());
6371        }
6372
6373        #[allow(clippy::single_element_loop)]
6374        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6375            url = params.uri_replacement(url, param_name, find_this, true);
6376        }
6377        {
6378            let to_remove = ["parent"];
6379            params.remove_params(&to_remove);
6380        }
6381
6382        let url = params.parse_with_url(&url);
6383
6384        let mut json_mime_type = mime::APPLICATION_JSON;
6385        let mut request_value_reader = {
6386            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6387            common::remove_json_null_values(&mut value);
6388            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6389            serde_json::to_writer(&mut dst, &value).unwrap();
6390            dst
6391        };
6392        let request_size = request_value_reader
6393            .seek(std::io::SeekFrom::End(0))
6394            .unwrap();
6395        request_value_reader
6396            .seek(std::io::SeekFrom::Start(0))
6397            .unwrap();
6398
6399        loop {
6400            let token = match self
6401                .hub
6402                .auth
6403                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6404                .await
6405            {
6406                Ok(token) => token,
6407                Err(e) => match dlg.token(e) {
6408                    Ok(token) => token,
6409                    Err(e) => {
6410                        dlg.finished(false);
6411                        return Err(common::Error::MissingToken(e));
6412                    }
6413                },
6414            };
6415            request_value_reader
6416                .seek(std::io::SeekFrom::Start(0))
6417                .unwrap();
6418            let mut req_result = {
6419                let client = &self.hub.client;
6420                dlg.pre_request();
6421                let mut req_builder = hyper::Request::builder()
6422                    .method(hyper::Method::POST)
6423                    .uri(url.as_str())
6424                    .header(USER_AGENT, self.hub._user_agent.clone());
6425
6426                if let Some(token) = token.as_ref() {
6427                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6428                }
6429
6430                let request = req_builder
6431                    .header(CONTENT_TYPE, json_mime_type.to_string())
6432                    .header(CONTENT_LENGTH, request_size as u64)
6433                    .body(common::to_body(
6434                        request_value_reader.get_ref().clone().into(),
6435                    ));
6436
6437                client.request(request.unwrap()).await
6438            };
6439
6440            match req_result {
6441                Err(err) => {
6442                    if let common::Retry::After(d) = dlg.http_error(&err) {
6443                        sleep(d).await;
6444                        continue;
6445                    }
6446                    dlg.finished(false);
6447                    return Err(common::Error::HttpError(err));
6448                }
6449                Ok(res) => {
6450                    let (mut parts, body) = res.into_parts();
6451                    let mut body = common::Body::new(body);
6452                    if !parts.status.is_success() {
6453                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6454                        let error = serde_json::from_str(&common::to_string(&bytes));
6455                        let response = common::to_response(parts, bytes.into());
6456
6457                        if let common::Retry::After(d) =
6458                            dlg.http_failure(&response, error.as_ref().ok())
6459                        {
6460                            sleep(d).await;
6461                            continue;
6462                        }
6463
6464                        dlg.finished(false);
6465
6466                        return Err(match error {
6467                            Ok(value) => common::Error::BadRequest(value),
6468                            _ => common::Error::Failure(response),
6469                        });
6470                    }
6471                    let response = {
6472                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6473                        let encoded = common::to_string(&bytes);
6474                        match serde_json::from_str(&encoded) {
6475                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6476                            Err(error) => {
6477                                dlg.response_json_decode_error(&encoded, &error);
6478                                return Err(common::Error::JsonDecodeError(
6479                                    encoded.to_string(),
6480                                    error,
6481                                ));
6482                            }
6483                        }
6484                    };
6485
6486                    dlg.finished(true);
6487                    return Ok(response);
6488                }
6489            }
6490        }
6491    }
6492
6493    ///
6494    /// Sets the *request* property to the given value.
6495    ///
6496    /// Even though the property as already been set when instantiating this call,
6497    /// we provide this method for API completeness.
6498    pub fn request(
6499        mut self,
6500        new_value: GoogleCloudRunV2Job,
6501    ) -> ProjectLocationJobCreateCall<'a, C> {
6502        self._request = new_value;
6503        self
6504    }
6505    /// Required. The location and project in which this Job should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
6506    ///
6507    /// Sets the *parent* path property to the given value.
6508    ///
6509    /// Even though the property as already been set when instantiating this call,
6510    /// we provide this method for API completeness.
6511    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C> {
6512        self._parent = new_value.to_string();
6513        self
6514    }
6515    /// Indicates that the request should be validated and default values populated, without persisting the request or creating any resources.
6516    ///
6517    /// Sets the *validate only* query property to the given value.
6518    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationJobCreateCall<'a, C> {
6519        self._validate_only = Some(new_value);
6520        self
6521    }
6522    /// Required. The unique identifier for the Job. The name of the job becomes {parent}/jobs/{job_id}.
6523    ///
6524    /// Sets the *job id* query property to the given value.
6525    pub fn job_id(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C> {
6526        self._job_id = Some(new_value.to_string());
6527        self
6528    }
6529    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6530    /// while executing the actual API request.
6531    ///
6532    /// ````text
6533    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6534    /// ````
6535    ///
6536    /// Sets the *delegate* property to the given value.
6537    pub fn delegate(
6538        mut self,
6539        new_value: &'a mut dyn common::Delegate,
6540    ) -> ProjectLocationJobCreateCall<'a, C> {
6541        self._delegate = Some(new_value);
6542        self
6543    }
6544
6545    /// Set any additional parameter of the query string used in the request.
6546    /// It should be used to set parameters which are not yet available through their own
6547    /// setters.
6548    ///
6549    /// Please note that this method must not be used to set any of the known parameters
6550    /// which have their own setter method. If done anyway, the request will fail.
6551    ///
6552    /// # Additional Parameters
6553    ///
6554    /// * *$.xgafv* (query-string) - V1 error format.
6555    /// * *access_token* (query-string) - OAuth access token.
6556    /// * *alt* (query-string) - Data format for response.
6557    /// * *callback* (query-string) - JSONP
6558    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6559    /// * *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.
6560    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6561    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6562    /// * *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.
6563    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6564    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6565    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobCreateCall<'a, C>
6566    where
6567        T: AsRef<str>,
6568    {
6569        self._additional_params
6570            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6571        self
6572    }
6573
6574    /// Identifies the authorization scope for the method you are building.
6575    ///
6576    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6577    /// [`Scope::CloudPlatform`].
6578    ///
6579    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6580    /// tokens for more than one scope.
6581    ///
6582    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6583    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6584    /// sufficient, a read-write scope will do as well.
6585    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobCreateCall<'a, C>
6586    where
6587        St: AsRef<str>,
6588    {
6589        self._scopes.insert(String::from(scope.as_ref()));
6590        self
6591    }
6592    /// Identifies the authorization scope(s) for the method you are building.
6593    ///
6594    /// See [`Self::add_scope()`] for details.
6595    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobCreateCall<'a, C>
6596    where
6597        I: IntoIterator<Item = St>,
6598        St: AsRef<str>,
6599    {
6600        self._scopes
6601            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6602        self
6603    }
6604
6605    /// Removes all scopes, and no default scope will be used either.
6606    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6607    /// for details).
6608    pub fn clear_scopes(mut self) -> ProjectLocationJobCreateCall<'a, C> {
6609        self._scopes.clear();
6610        self
6611    }
6612}
6613
6614/// Deletes a Job.
6615///
6616/// A builder for the *locations.jobs.delete* method supported by a *project* resource.
6617/// It is not used directly, but through a [`ProjectMethods`] instance.
6618///
6619/// # Example
6620///
6621/// Instantiate a resource method builder
6622///
6623/// ```test_harness,no_run
6624/// # extern crate hyper;
6625/// # extern crate hyper_rustls;
6626/// # extern crate google_run2 as run2;
6627/// # async fn dox() {
6628/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6629///
6630/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6631/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6632/// #     .with_native_roots()
6633/// #     .unwrap()
6634/// #     .https_only()
6635/// #     .enable_http2()
6636/// #     .build();
6637///
6638/// # let executor = hyper_util::rt::TokioExecutor::new();
6639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6640/// #     secret,
6641/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6642/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6643/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6644/// #     ),
6645/// # ).build().await.unwrap();
6646///
6647/// # let client = hyper_util::client::legacy::Client::builder(
6648/// #     hyper_util::rt::TokioExecutor::new()
6649/// # )
6650/// # .build(
6651/// #     hyper_rustls::HttpsConnectorBuilder::new()
6652/// #         .with_native_roots()
6653/// #         .unwrap()
6654/// #         .https_or_http()
6655/// #         .enable_http2()
6656/// #         .build()
6657/// # );
6658/// # let mut hub = CloudRun::new(client, auth);
6659/// // You can configure optional parameters by calling the respective setters at will, and
6660/// // execute the final call using `doit()`.
6661/// // Values shown here are possibly random and not representative !
6662/// let result = hub.projects().locations_jobs_delete("name")
6663///              .validate_only(true)
6664///              .etag("et")
6665///              .doit().await;
6666/// # }
6667/// ```
6668pub struct ProjectLocationJobDeleteCall<'a, C>
6669where
6670    C: 'a,
6671{
6672    hub: &'a CloudRun<C>,
6673    _name: String,
6674    _validate_only: Option<bool>,
6675    _etag: Option<String>,
6676    _delegate: Option<&'a mut dyn common::Delegate>,
6677    _additional_params: HashMap<String, String>,
6678    _scopes: BTreeSet<String>,
6679}
6680
6681impl<'a, C> common::CallBuilder for ProjectLocationJobDeleteCall<'a, C> {}
6682
6683impl<'a, C> ProjectLocationJobDeleteCall<'a, C>
6684where
6685    C: common::Connector,
6686{
6687    /// Perform the operation you have build so far.
6688    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
6689        use std::borrow::Cow;
6690        use std::io::{Read, Seek};
6691
6692        use common::{url::Params, ToParts};
6693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6694
6695        let mut dd = common::DefaultDelegate;
6696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6697        dlg.begin(common::MethodInfo {
6698            id: "run.projects.locations.jobs.delete",
6699            http_method: hyper::Method::DELETE,
6700        });
6701
6702        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
6703            if self._additional_params.contains_key(field) {
6704                dlg.finished(false);
6705                return Err(common::Error::FieldClash(field));
6706            }
6707        }
6708
6709        let mut params = Params::with_capacity(5 + self._additional_params.len());
6710        params.push("name", self._name);
6711        if let Some(value) = self._validate_only.as_ref() {
6712            params.push("validateOnly", value.to_string());
6713        }
6714        if let Some(value) = self._etag.as_ref() {
6715            params.push("etag", value);
6716        }
6717
6718        params.extend(self._additional_params.iter());
6719
6720        params.push("alt", "json");
6721        let mut url = self.hub._base_url.clone() + "v2/{+name}";
6722        if self._scopes.is_empty() {
6723            self._scopes
6724                .insert(Scope::CloudPlatform.as_ref().to_string());
6725        }
6726
6727        #[allow(clippy::single_element_loop)]
6728        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6729            url = params.uri_replacement(url, param_name, find_this, true);
6730        }
6731        {
6732            let to_remove = ["name"];
6733            params.remove_params(&to_remove);
6734        }
6735
6736        let url = params.parse_with_url(&url);
6737
6738        loop {
6739            let token = match self
6740                .hub
6741                .auth
6742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6743                .await
6744            {
6745                Ok(token) => token,
6746                Err(e) => match dlg.token(e) {
6747                    Ok(token) => token,
6748                    Err(e) => {
6749                        dlg.finished(false);
6750                        return Err(common::Error::MissingToken(e));
6751                    }
6752                },
6753            };
6754            let mut req_result = {
6755                let client = &self.hub.client;
6756                dlg.pre_request();
6757                let mut req_builder = hyper::Request::builder()
6758                    .method(hyper::Method::DELETE)
6759                    .uri(url.as_str())
6760                    .header(USER_AGENT, self.hub._user_agent.clone());
6761
6762                if let Some(token) = token.as_ref() {
6763                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6764                }
6765
6766                let request = req_builder
6767                    .header(CONTENT_LENGTH, 0_u64)
6768                    .body(common::to_body::<String>(None));
6769
6770                client.request(request.unwrap()).await
6771            };
6772
6773            match req_result {
6774                Err(err) => {
6775                    if let common::Retry::After(d) = dlg.http_error(&err) {
6776                        sleep(d).await;
6777                        continue;
6778                    }
6779                    dlg.finished(false);
6780                    return Err(common::Error::HttpError(err));
6781                }
6782                Ok(res) => {
6783                    let (mut parts, body) = res.into_parts();
6784                    let mut body = common::Body::new(body);
6785                    if !parts.status.is_success() {
6786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6787                        let error = serde_json::from_str(&common::to_string(&bytes));
6788                        let response = common::to_response(parts, bytes.into());
6789
6790                        if let common::Retry::After(d) =
6791                            dlg.http_failure(&response, error.as_ref().ok())
6792                        {
6793                            sleep(d).await;
6794                            continue;
6795                        }
6796
6797                        dlg.finished(false);
6798
6799                        return Err(match error {
6800                            Ok(value) => common::Error::BadRequest(value),
6801                            _ => common::Error::Failure(response),
6802                        });
6803                    }
6804                    let response = {
6805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6806                        let encoded = common::to_string(&bytes);
6807                        match serde_json::from_str(&encoded) {
6808                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6809                            Err(error) => {
6810                                dlg.response_json_decode_error(&encoded, &error);
6811                                return Err(common::Error::JsonDecodeError(
6812                                    encoded.to_string(),
6813                                    error,
6814                                ));
6815                            }
6816                        }
6817                    };
6818
6819                    dlg.finished(true);
6820                    return Ok(response);
6821                }
6822            }
6823        }
6824    }
6825
6826    /// Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
6827    ///
6828    /// Sets the *name* path property to the given value.
6829    ///
6830    /// Even though the property as already been set when instantiating this call,
6831    /// we provide this method for API completeness.
6832    pub fn name(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C> {
6833        self._name = new_value.to_string();
6834        self
6835    }
6836    /// Indicates that the request should be validated without actually deleting any resources.
6837    ///
6838    /// Sets the *validate only* query property to the given value.
6839    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationJobDeleteCall<'a, C> {
6840        self._validate_only = Some(new_value);
6841        self
6842    }
6843    /// A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
6844    ///
6845    /// Sets the *etag* query property to the given value.
6846    pub fn etag(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C> {
6847        self._etag = Some(new_value.to_string());
6848        self
6849    }
6850    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6851    /// while executing the actual API request.
6852    ///
6853    /// ````text
6854    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6855    /// ````
6856    ///
6857    /// Sets the *delegate* property to the given value.
6858    pub fn delegate(
6859        mut self,
6860        new_value: &'a mut dyn common::Delegate,
6861    ) -> ProjectLocationJobDeleteCall<'a, C> {
6862        self._delegate = Some(new_value);
6863        self
6864    }
6865
6866    /// Set any additional parameter of the query string used in the request.
6867    /// It should be used to set parameters which are not yet available through their own
6868    /// setters.
6869    ///
6870    /// Please note that this method must not be used to set any of the known parameters
6871    /// which have their own setter method. If done anyway, the request will fail.
6872    ///
6873    /// # Additional Parameters
6874    ///
6875    /// * *$.xgafv* (query-string) - V1 error format.
6876    /// * *access_token* (query-string) - OAuth access token.
6877    /// * *alt* (query-string) - Data format for response.
6878    /// * *callback* (query-string) - JSONP
6879    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6880    /// * *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.
6881    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6882    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6883    /// * *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.
6884    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6885    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6886    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobDeleteCall<'a, C>
6887    where
6888        T: AsRef<str>,
6889    {
6890        self._additional_params
6891            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6892        self
6893    }
6894
6895    /// Identifies the authorization scope for the method you are building.
6896    ///
6897    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6898    /// [`Scope::CloudPlatform`].
6899    ///
6900    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6901    /// tokens for more than one scope.
6902    ///
6903    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6904    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6905    /// sufficient, a read-write scope will do as well.
6906    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobDeleteCall<'a, C>
6907    where
6908        St: AsRef<str>,
6909    {
6910        self._scopes.insert(String::from(scope.as_ref()));
6911        self
6912    }
6913    /// Identifies the authorization scope(s) for the method you are building.
6914    ///
6915    /// See [`Self::add_scope()`] for details.
6916    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobDeleteCall<'a, C>
6917    where
6918        I: IntoIterator<Item = St>,
6919        St: AsRef<str>,
6920    {
6921        self._scopes
6922            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6923        self
6924    }
6925
6926    /// Removes all scopes, and no default scope will be used either.
6927    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6928    /// for details).
6929    pub fn clear_scopes(mut self) -> ProjectLocationJobDeleteCall<'a, C> {
6930        self._scopes.clear();
6931        self
6932    }
6933}
6934
6935/// Gets information about a Job.
6936///
6937/// A builder for the *locations.jobs.get* method supported by a *project* resource.
6938/// It is not used directly, but through a [`ProjectMethods`] instance.
6939///
6940/// # Example
6941///
6942/// Instantiate a resource method builder
6943///
6944/// ```test_harness,no_run
6945/// # extern crate hyper;
6946/// # extern crate hyper_rustls;
6947/// # extern crate google_run2 as run2;
6948/// # async fn dox() {
6949/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6950///
6951/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6952/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6953/// #     .with_native_roots()
6954/// #     .unwrap()
6955/// #     .https_only()
6956/// #     .enable_http2()
6957/// #     .build();
6958///
6959/// # let executor = hyper_util::rt::TokioExecutor::new();
6960/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6961/// #     secret,
6962/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6963/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6964/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6965/// #     ),
6966/// # ).build().await.unwrap();
6967///
6968/// # let client = hyper_util::client::legacy::Client::builder(
6969/// #     hyper_util::rt::TokioExecutor::new()
6970/// # )
6971/// # .build(
6972/// #     hyper_rustls::HttpsConnectorBuilder::new()
6973/// #         .with_native_roots()
6974/// #         .unwrap()
6975/// #         .https_or_http()
6976/// #         .enable_http2()
6977/// #         .build()
6978/// # );
6979/// # let mut hub = CloudRun::new(client, auth);
6980/// // You can configure optional parameters by calling the respective setters at will, and
6981/// // execute the final call using `doit()`.
6982/// // Values shown here are possibly random and not representative !
6983/// let result = hub.projects().locations_jobs_get("name")
6984///              .doit().await;
6985/// # }
6986/// ```
6987pub struct ProjectLocationJobGetCall<'a, C>
6988where
6989    C: 'a,
6990{
6991    hub: &'a CloudRun<C>,
6992    _name: String,
6993    _delegate: Option<&'a mut dyn common::Delegate>,
6994    _additional_params: HashMap<String, String>,
6995    _scopes: BTreeSet<String>,
6996}
6997
6998impl<'a, C> common::CallBuilder for ProjectLocationJobGetCall<'a, C> {}
6999
7000impl<'a, C> ProjectLocationJobGetCall<'a, C>
7001where
7002    C: common::Connector,
7003{
7004    /// Perform the operation you have build so far.
7005    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Job)> {
7006        use std::borrow::Cow;
7007        use std::io::{Read, Seek};
7008
7009        use common::{url::Params, ToParts};
7010        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7011
7012        let mut dd = common::DefaultDelegate;
7013        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7014        dlg.begin(common::MethodInfo {
7015            id: "run.projects.locations.jobs.get",
7016            http_method: hyper::Method::GET,
7017        });
7018
7019        for &field in ["alt", "name"].iter() {
7020            if self._additional_params.contains_key(field) {
7021                dlg.finished(false);
7022                return Err(common::Error::FieldClash(field));
7023            }
7024        }
7025
7026        let mut params = Params::with_capacity(3 + self._additional_params.len());
7027        params.push("name", self._name);
7028
7029        params.extend(self._additional_params.iter());
7030
7031        params.push("alt", "json");
7032        let mut url = self.hub._base_url.clone() + "v2/{+name}";
7033        if self._scopes.is_empty() {
7034            self._scopes
7035                .insert(Scope::CloudPlatform.as_ref().to_string());
7036        }
7037
7038        #[allow(clippy::single_element_loop)]
7039        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7040            url = params.uri_replacement(url, param_name, find_this, true);
7041        }
7042        {
7043            let to_remove = ["name"];
7044            params.remove_params(&to_remove);
7045        }
7046
7047        let url = params.parse_with_url(&url);
7048
7049        loop {
7050            let token = match self
7051                .hub
7052                .auth
7053                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7054                .await
7055            {
7056                Ok(token) => token,
7057                Err(e) => match dlg.token(e) {
7058                    Ok(token) => token,
7059                    Err(e) => {
7060                        dlg.finished(false);
7061                        return Err(common::Error::MissingToken(e));
7062                    }
7063                },
7064            };
7065            let mut req_result = {
7066                let client = &self.hub.client;
7067                dlg.pre_request();
7068                let mut req_builder = hyper::Request::builder()
7069                    .method(hyper::Method::GET)
7070                    .uri(url.as_str())
7071                    .header(USER_AGENT, self.hub._user_agent.clone());
7072
7073                if let Some(token) = token.as_ref() {
7074                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7075                }
7076
7077                let request = req_builder
7078                    .header(CONTENT_LENGTH, 0_u64)
7079                    .body(common::to_body::<String>(None));
7080
7081                client.request(request.unwrap()).await
7082            };
7083
7084            match req_result {
7085                Err(err) => {
7086                    if let common::Retry::After(d) = dlg.http_error(&err) {
7087                        sleep(d).await;
7088                        continue;
7089                    }
7090                    dlg.finished(false);
7091                    return Err(common::Error::HttpError(err));
7092                }
7093                Ok(res) => {
7094                    let (mut parts, body) = res.into_parts();
7095                    let mut body = common::Body::new(body);
7096                    if !parts.status.is_success() {
7097                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7098                        let error = serde_json::from_str(&common::to_string(&bytes));
7099                        let response = common::to_response(parts, bytes.into());
7100
7101                        if let common::Retry::After(d) =
7102                            dlg.http_failure(&response, error.as_ref().ok())
7103                        {
7104                            sleep(d).await;
7105                            continue;
7106                        }
7107
7108                        dlg.finished(false);
7109
7110                        return Err(match error {
7111                            Ok(value) => common::Error::BadRequest(value),
7112                            _ => common::Error::Failure(response),
7113                        });
7114                    }
7115                    let response = {
7116                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7117                        let encoded = common::to_string(&bytes);
7118                        match serde_json::from_str(&encoded) {
7119                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7120                            Err(error) => {
7121                                dlg.response_json_decode_error(&encoded, &error);
7122                                return Err(common::Error::JsonDecodeError(
7123                                    encoded.to_string(),
7124                                    error,
7125                                ));
7126                            }
7127                        }
7128                    };
7129
7130                    dlg.finished(true);
7131                    return Ok(response);
7132                }
7133            }
7134        }
7135    }
7136
7137    /// Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
7138    ///
7139    /// Sets the *name* path property to the given value.
7140    ///
7141    /// Even though the property as already been set when instantiating this call,
7142    /// we provide this method for API completeness.
7143    pub fn name(mut self, new_value: &str) -> ProjectLocationJobGetCall<'a, C> {
7144        self._name = new_value.to_string();
7145        self
7146    }
7147    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7148    /// while executing the actual API request.
7149    ///
7150    /// ````text
7151    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7152    /// ````
7153    ///
7154    /// Sets the *delegate* property to the given value.
7155    pub fn delegate(
7156        mut self,
7157        new_value: &'a mut dyn common::Delegate,
7158    ) -> ProjectLocationJobGetCall<'a, C> {
7159        self._delegate = Some(new_value);
7160        self
7161    }
7162
7163    /// Set any additional parameter of the query string used in the request.
7164    /// It should be used to set parameters which are not yet available through their own
7165    /// setters.
7166    ///
7167    /// Please note that this method must not be used to set any of the known parameters
7168    /// which have their own setter method. If done anyway, the request will fail.
7169    ///
7170    /// # Additional Parameters
7171    ///
7172    /// * *$.xgafv* (query-string) - V1 error format.
7173    /// * *access_token* (query-string) - OAuth access token.
7174    /// * *alt* (query-string) - Data format for response.
7175    /// * *callback* (query-string) - JSONP
7176    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7177    /// * *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.
7178    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7179    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7180    /// * *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.
7181    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7182    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7183    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetCall<'a, C>
7184    where
7185        T: AsRef<str>,
7186    {
7187        self._additional_params
7188            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7189        self
7190    }
7191
7192    /// Identifies the authorization scope for the method you are building.
7193    ///
7194    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7195    /// [`Scope::CloudPlatform`].
7196    ///
7197    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7198    /// tokens for more than one scope.
7199    ///
7200    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7201    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7202    /// sufficient, a read-write scope will do as well.
7203    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetCall<'a, C>
7204    where
7205        St: AsRef<str>,
7206    {
7207        self._scopes.insert(String::from(scope.as_ref()));
7208        self
7209    }
7210    /// Identifies the authorization scope(s) for the method you are building.
7211    ///
7212    /// See [`Self::add_scope()`] for details.
7213    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetCall<'a, C>
7214    where
7215        I: IntoIterator<Item = St>,
7216        St: AsRef<str>,
7217    {
7218        self._scopes
7219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7220        self
7221    }
7222
7223    /// Removes all scopes, and no default scope will be used either.
7224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7225    /// for details).
7226    pub fn clear_scopes(mut self) -> ProjectLocationJobGetCall<'a, C> {
7227        self._scopes.clear();
7228        self
7229    }
7230}
7231
7232/// Gets the IAM Access Control policy currently in effect for the given Job. This result does not include any inherited policies.
7233///
7234/// A builder for the *locations.jobs.getIamPolicy* method supported by a *project* resource.
7235/// It is not used directly, but through a [`ProjectMethods`] instance.
7236///
7237/// # Example
7238///
7239/// Instantiate a resource method builder
7240///
7241/// ```test_harness,no_run
7242/// # extern crate hyper;
7243/// # extern crate hyper_rustls;
7244/// # extern crate google_run2 as run2;
7245/// # async fn dox() {
7246/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7247///
7248/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7249/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7250/// #     .with_native_roots()
7251/// #     .unwrap()
7252/// #     .https_only()
7253/// #     .enable_http2()
7254/// #     .build();
7255///
7256/// # let executor = hyper_util::rt::TokioExecutor::new();
7257/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7258/// #     secret,
7259/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7260/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7261/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7262/// #     ),
7263/// # ).build().await.unwrap();
7264///
7265/// # let client = hyper_util::client::legacy::Client::builder(
7266/// #     hyper_util::rt::TokioExecutor::new()
7267/// # )
7268/// # .build(
7269/// #     hyper_rustls::HttpsConnectorBuilder::new()
7270/// #         .with_native_roots()
7271/// #         .unwrap()
7272/// #         .https_or_http()
7273/// #         .enable_http2()
7274/// #         .build()
7275/// # );
7276/// # let mut hub = CloudRun::new(client, auth);
7277/// // You can configure optional parameters by calling the respective setters at will, and
7278/// // execute the final call using `doit()`.
7279/// // Values shown here are possibly random and not representative !
7280/// let result = hub.projects().locations_jobs_get_iam_policy("resource")
7281///              .options_requested_policy_version(-31)
7282///              .doit().await;
7283/// # }
7284/// ```
7285pub struct ProjectLocationJobGetIamPolicyCall<'a, C>
7286where
7287    C: 'a,
7288{
7289    hub: &'a CloudRun<C>,
7290    _resource: String,
7291    _options_requested_policy_version: Option<i32>,
7292    _delegate: Option<&'a mut dyn common::Delegate>,
7293    _additional_params: HashMap<String, String>,
7294    _scopes: BTreeSet<String>,
7295}
7296
7297impl<'a, C> common::CallBuilder for ProjectLocationJobGetIamPolicyCall<'a, C> {}
7298
7299impl<'a, C> ProjectLocationJobGetIamPolicyCall<'a, C>
7300where
7301    C: common::Connector,
7302{
7303    /// Perform the operation you have build so far.
7304    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
7305        use std::borrow::Cow;
7306        use std::io::{Read, Seek};
7307
7308        use common::{url::Params, ToParts};
7309        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7310
7311        let mut dd = common::DefaultDelegate;
7312        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7313        dlg.begin(common::MethodInfo {
7314            id: "run.projects.locations.jobs.getIamPolicy",
7315            http_method: hyper::Method::GET,
7316        });
7317
7318        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
7319            if self._additional_params.contains_key(field) {
7320                dlg.finished(false);
7321                return Err(common::Error::FieldClash(field));
7322            }
7323        }
7324
7325        let mut params = Params::with_capacity(4 + self._additional_params.len());
7326        params.push("resource", self._resource);
7327        if let Some(value) = self._options_requested_policy_version.as_ref() {
7328            params.push("options.requestedPolicyVersion", value.to_string());
7329        }
7330
7331        params.extend(self._additional_params.iter());
7332
7333        params.push("alt", "json");
7334        let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy";
7335        if self._scopes.is_empty() {
7336            self._scopes
7337                .insert(Scope::CloudPlatform.as_ref().to_string());
7338        }
7339
7340        #[allow(clippy::single_element_loop)]
7341        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7342            url = params.uri_replacement(url, param_name, find_this, true);
7343        }
7344        {
7345            let to_remove = ["resource"];
7346            params.remove_params(&to_remove);
7347        }
7348
7349        let url = params.parse_with_url(&url);
7350
7351        loop {
7352            let token = match self
7353                .hub
7354                .auth
7355                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7356                .await
7357            {
7358                Ok(token) => token,
7359                Err(e) => match dlg.token(e) {
7360                    Ok(token) => token,
7361                    Err(e) => {
7362                        dlg.finished(false);
7363                        return Err(common::Error::MissingToken(e));
7364                    }
7365                },
7366            };
7367            let mut req_result = {
7368                let client = &self.hub.client;
7369                dlg.pre_request();
7370                let mut req_builder = hyper::Request::builder()
7371                    .method(hyper::Method::GET)
7372                    .uri(url.as_str())
7373                    .header(USER_AGENT, self.hub._user_agent.clone());
7374
7375                if let Some(token) = token.as_ref() {
7376                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7377                }
7378
7379                let request = req_builder
7380                    .header(CONTENT_LENGTH, 0_u64)
7381                    .body(common::to_body::<String>(None));
7382
7383                client.request(request.unwrap()).await
7384            };
7385
7386            match req_result {
7387                Err(err) => {
7388                    if let common::Retry::After(d) = dlg.http_error(&err) {
7389                        sleep(d).await;
7390                        continue;
7391                    }
7392                    dlg.finished(false);
7393                    return Err(common::Error::HttpError(err));
7394                }
7395                Ok(res) => {
7396                    let (mut parts, body) = res.into_parts();
7397                    let mut body = common::Body::new(body);
7398                    if !parts.status.is_success() {
7399                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7400                        let error = serde_json::from_str(&common::to_string(&bytes));
7401                        let response = common::to_response(parts, bytes.into());
7402
7403                        if let common::Retry::After(d) =
7404                            dlg.http_failure(&response, error.as_ref().ok())
7405                        {
7406                            sleep(d).await;
7407                            continue;
7408                        }
7409
7410                        dlg.finished(false);
7411
7412                        return Err(match error {
7413                            Ok(value) => common::Error::BadRequest(value),
7414                            _ => common::Error::Failure(response),
7415                        });
7416                    }
7417                    let response = {
7418                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7419                        let encoded = common::to_string(&bytes);
7420                        match serde_json::from_str(&encoded) {
7421                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7422                            Err(error) => {
7423                                dlg.response_json_decode_error(&encoded, &error);
7424                                return Err(common::Error::JsonDecodeError(
7425                                    encoded.to_string(),
7426                                    error,
7427                                ));
7428                            }
7429                        }
7430                    };
7431
7432                    dlg.finished(true);
7433                    return Ok(response);
7434                }
7435            }
7436        }
7437    }
7438
7439    /// 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.
7440    ///
7441    /// Sets the *resource* path property to the given value.
7442    ///
7443    /// Even though the property as already been set when instantiating this call,
7444    /// we provide this method for API completeness.
7445    pub fn resource(mut self, new_value: &str) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
7446        self._resource = new_value.to_string();
7447        self
7448    }
7449    /// 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).
7450    ///
7451    /// Sets the *options.requested policy version* query property to the given value.
7452    pub fn options_requested_policy_version(
7453        mut self,
7454        new_value: i32,
7455    ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
7456        self._options_requested_policy_version = Some(new_value);
7457        self
7458    }
7459    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7460    /// while executing the actual API request.
7461    ///
7462    /// ````text
7463    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7464    /// ````
7465    ///
7466    /// Sets the *delegate* property to the given value.
7467    pub fn delegate(
7468        mut self,
7469        new_value: &'a mut dyn common::Delegate,
7470    ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
7471        self._delegate = Some(new_value);
7472        self
7473    }
7474
7475    /// Set any additional parameter of the query string used in the request.
7476    /// It should be used to set parameters which are not yet available through their own
7477    /// setters.
7478    ///
7479    /// Please note that this method must not be used to set any of the known parameters
7480    /// which have their own setter method. If done anyway, the request will fail.
7481    ///
7482    /// # Additional Parameters
7483    ///
7484    /// * *$.xgafv* (query-string) - V1 error format.
7485    /// * *access_token* (query-string) - OAuth access token.
7486    /// * *alt* (query-string) - Data format for response.
7487    /// * *callback* (query-string) - JSONP
7488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7489    /// * *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.
7490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7492    /// * *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.
7493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7495    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetIamPolicyCall<'a, C>
7496    where
7497        T: AsRef<str>,
7498    {
7499        self._additional_params
7500            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7501        self
7502    }
7503
7504    /// Identifies the authorization scope for the method you are building.
7505    ///
7506    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7507    /// [`Scope::CloudPlatform`].
7508    ///
7509    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7510    /// tokens for more than one scope.
7511    ///
7512    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7513    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7514    /// sufficient, a read-write scope will do as well.
7515    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetIamPolicyCall<'a, C>
7516    where
7517        St: AsRef<str>,
7518    {
7519        self._scopes.insert(String::from(scope.as_ref()));
7520        self
7521    }
7522    /// Identifies the authorization scope(s) for the method you are building.
7523    ///
7524    /// See [`Self::add_scope()`] for details.
7525    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetIamPolicyCall<'a, C>
7526    where
7527        I: IntoIterator<Item = St>,
7528        St: AsRef<str>,
7529    {
7530        self._scopes
7531            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7532        self
7533    }
7534
7535    /// Removes all scopes, and no default scope will be used either.
7536    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7537    /// for details).
7538    pub fn clear_scopes(mut self) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
7539        self._scopes.clear();
7540        self
7541    }
7542}
7543
7544/// Lists Jobs. Results are sorted by creation time, descending.
7545///
7546/// A builder for the *locations.jobs.list* method supported by a *project* resource.
7547/// It is not used directly, but through a [`ProjectMethods`] instance.
7548///
7549/// # Example
7550///
7551/// Instantiate a resource method builder
7552///
7553/// ```test_harness,no_run
7554/// # extern crate hyper;
7555/// # extern crate hyper_rustls;
7556/// # extern crate google_run2 as run2;
7557/// # async fn dox() {
7558/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7559///
7560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7561/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7562/// #     .with_native_roots()
7563/// #     .unwrap()
7564/// #     .https_only()
7565/// #     .enable_http2()
7566/// #     .build();
7567///
7568/// # let executor = hyper_util::rt::TokioExecutor::new();
7569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7570/// #     secret,
7571/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7572/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7573/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7574/// #     ),
7575/// # ).build().await.unwrap();
7576///
7577/// # let client = hyper_util::client::legacy::Client::builder(
7578/// #     hyper_util::rt::TokioExecutor::new()
7579/// # )
7580/// # .build(
7581/// #     hyper_rustls::HttpsConnectorBuilder::new()
7582/// #         .with_native_roots()
7583/// #         .unwrap()
7584/// #         .https_or_http()
7585/// #         .enable_http2()
7586/// #         .build()
7587/// # );
7588/// # let mut hub = CloudRun::new(client, auth);
7589/// // You can configure optional parameters by calling the respective setters at will, and
7590/// // execute the final call using `doit()`.
7591/// // Values shown here are possibly random and not representative !
7592/// let result = hub.projects().locations_jobs_list("parent")
7593///              .show_deleted(false)
7594///              .page_token("diam")
7595///              .page_size(-49)
7596///              .doit().await;
7597/// # }
7598/// ```
7599pub struct ProjectLocationJobListCall<'a, C>
7600where
7601    C: 'a,
7602{
7603    hub: &'a CloudRun<C>,
7604    _parent: String,
7605    _show_deleted: Option<bool>,
7606    _page_token: Option<String>,
7607    _page_size: Option<i32>,
7608    _delegate: Option<&'a mut dyn common::Delegate>,
7609    _additional_params: HashMap<String, String>,
7610    _scopes: BTreeSet<String>,
7611}
7612
7613impl<'a, C> common::CallBuilder for ProjectLocationJobListCall<'a, C> {}
7614
7615impl<'a, C> ProjectLocationJobListCall<'a, C>
7616where
7617    C: common::Connector,
7618{
7619    /// Perform the operation you have build so far.
7620    pub async fn doit(
7621        mut self,
7622    ) -> common::Result<(common::Response, GoogleCloudRunV2ListJobsResponse)> {
7623        use std::borrow::Cow;
7624        use std::io::{Read, Seek};
7625
7626        use common::{url::Params, ToParts};
7627        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7628
7629        let mut dd = common::DefaultDelegate;
7630        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7631        dlg.begin(common::MethodInfo {
7632            id: "run.projects.locations.jobs.list",
7633            http_method: hyper::Method::GET,
7634        });
7635
7636        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
7637            if self._additional_params.contains_key(field) {
7638                dlg.finished(false);
7639                return Err(common::Error::FieldClash(field));
7640            }
7641        }
7642
7643        let mut params = Params::with_capacity(6 + self._additional_params.len());
7644        params.push("parent", self._parent);
7645        if let Some(value) = self._show_deleted.as_ref() {
7646            params.push("showDeleted", value.to_string());
7647        }
7648        if let Some(value) = self._page_token.as_ref() {
7649            params.push("pageToken", value);
7650        }
7651        if let Some(value) = self._page_size.as_ref() {
7652            params.push("pageSize", value.to_string());
7653        }
7654
7655        params.extend(self._additional_params.iter());
7656
7657        params.push("alt", "json");
7658        let mut url = self.hub._base_url.clone() + "v2/{+parent}/jobs";
7659        if self._scopes.is_empty() {
7660            self._scopes
7661                .insert(Scope::CloudPlatform.as_ref().to_string());
7662        }
7663
7664        #[allow(clippy::single_element_loop)]
7665        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7666            url = params.uri_replacement(url, param_name, find_this, true);
7667        }
7668        {
7669            let to_remove = ["parent"];
7670            params.remove_params(&to_remove);
7671        }
7672
7673        let url = params.parse_with_url(&url);
7674
7675        loop {
7676            let token = match self
7677                .hub
7678                .auth
7679                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7680                .await
7681            {
7682                Ok(token) => token,
7683                Err(e) => match dlg.token(e) {
7684                    Ok(token) => token,
7685                    Err(e) => {
7686                        dlg.finished(false);
7687                        return Err(common::Error::MissingToken(e));
7688                    }
7689                },
7690            };
7691            let mut req_result = {
7692                let client = &self.hub.client;
7693                dlg.pre_request();
7694                let mut req_builder = hyper::Request::builder()
7695                    .method(hyper::Method::GET)
7696                    .uri(url.as_str())
7697                    .header(USER_AGENT, self.hub._user_agent.clone());
7698
7699                if let Some(token) = token.as_ref() {
7700                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7701                }
7702
7703                let request = req_builder
7704                    .header(CONTENT_LENGTH, 0_u64)
7705                    .body(common::to_body::<String>(None));
7706
7707                client.request(request.unwrap()).await
7708            };
7709
7710            match req_result {
7711                Err(err) => {
7712                    if let common::Retry::After(d) = dlg.http_error(&err) {
7713                        sleep(d).await;
7714                        continue;
7715                    }
7716                    dlg.finished(false);
7717                    return Err(common::Error::HttpError(err));
7718                }
7719                Ok(res) => {
7720                    let (mut parts, body) = res.into_parts();
7721                    let mut body = common::Body::new(body);
7722                    if !parts.status.is_success() {
7723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7724                        let error = serde_json::from_str(&common::to_string(&bytes));
7725                        let response = common::to_response(parts, bytes.into());
7726
7727                        if let common::Retry::After(d) =
7728                            dlg.http_failure(&response, error.as_ref().ok())
7729                        {
7730                            sleep(d).await;
7731                            continue;
7732                        }
7733
7734                        dlg.finished(false);
7735
7736                        return Err(match error {
7737                            Ok(value) => common::Error::BadRequest(value),
7738                            _ => common::Error::Failure(response),
7739                        });
7740                    }
7741                    let response = {
7742                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7743                        let encoded = common::to_string(&bytes);
7744                        match serde_json::from_str(&encoded) {
7745                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7746                            Err(error) => {
7747                                dlg.response_json_decode_error(&encoded, &error);
7748                                return Err(common::Error::JsonDecodeError(
7749                                    encoded.to_string(),
7750                                    error,
7751                                ));
7752                            }
7753                        }
7754                    };
7755
7756                    dlg.finished(true);
7757                    return Ok(response);
7758                }
7759            }
7760        }
7761    }
7762
7763    /// Required. The location and project to list resources on. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
7764    ///
7765    /// Sets the *parent* path property to the given value.
7766    ///
7767    /// Even though the property as already been set when instantiating this call,
7768    /// we provide this method for API completeness.
7769    pub fn parent(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
7770        self._parent = new_value.to_string();
7771        self
7772    }
7773    /// If true, returns deleted (but unexpired) resources along with active ones.
7774    ///
7775    /// Sets the *show deleted* query property to the given value.
7776    pub fn show_deleted(mut self, new_value: bool) -> ProjectLocationJobListCall<'a, C> {
7777        self._show_deleted = Some(new_value);
7778        self
7779    }
7780    /// A page token received from a previous call to ListJobs. All other parameters must match.
7781    ///
7782    /// Sets the *page token* query property to the given value.
7783    pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
7784        self._page_token = Some(new_value.to_string());
7785        self
7786    }
7787    /// Maximum number of Jobs to return in this call.
7788    ///
7789    /// Sets the *page size* query property to the given value.
7790    pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobListCall<'a, C> {
7791        self._page_size = Some(new_value);
7792        self
7793    }
7794    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7795    /// while executing the actual API request.
7796    ///
7797    /// ````text
7798    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7799    /// ````
7800    ///
7801    /// Sets the *delegate* property to the given value.
7802    pub fn delegate(
7803        mut self,
7804        new_value: &'a mut dyn common::Delegate,
7805    ) -> ProjectLocationJobListCall<'a, C> {
7806        self._delegate = Some(new_value);
7807        self
7808    }
7809
7810    /// Set any additional parameter of the query string used in the request.
7811    /// It should be used to set parameters which are not yet available through their own
7812    /// setters.
7813    ///
7814    /// Please note that this method must not be used to set any of the known parameters
7815    /// which have their own setter method. If done anyway, the request will fail.
7816    ///
7817    /// # Additional Parameters
7818    ///
7819    /// * *$.xgafv* (query-string) - V1 error format.
7820    /// * *access_token* (query-string) - OAuth access token.
7821    /// * *alt* (query-string) - Data format for response.
7822    /// * *callback* (query-string) - JSONP
7823    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7824    /// * *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.
7825    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7826    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7827    /// * *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.
7828    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7829    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7830    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobListCall<'a, C>
7831    where
7832        T: AsRef<str>,
7833    {
7834        self._additional_params
7835            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7836        self
7837    }
7838
7839    /// Identifies the authorization scope for the method you are building.
7840    ///
7841    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7842    /// [`Scope::CloudPlatform`].
7843    ///
7844    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7845    /// tokens for more than one scope.
7846    ///
7847    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7848    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7849    /// sufficient, a read-write scope will do as well.
7850    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobListCall<'a, C>
7851    where
7852        St: AsRef<str>,
7853    {
7854        self._scopes.insert(String::from(scope.as_ref()));
7855        self
7856    }
7857    /// Identifies the authorization scope(s) for the method you are building.
7858    ///
7859    /// See [`Self::add_scope()`] for details.
7860    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobListCall<'a, C>
7861    where
7862        I: IntoIterator<Item = St>,
7863        St: AsRef<str>,
7864    {
7865        self._scopes
7866            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7867        self
7868    }
7869
7870    /// Removes all scopes, and no default scope will be used either.
7871    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7872    /// for details).
7873    pub fn clear_scopes(mut self) -> ProjectLocationJobListCall<'a, C> {
7874        self._scopes.clear();
7875        self
7876    }
7877}
7878
7879/// Updates a Job.
7880///
7881/// A builder for the *locations.jobs.patch* method supported by a *project* resource.
7882/// It is not used directly, but through a [`ProjectMethods`] instance.
7883///
7884/// # Example
7885///
7886/// Instantiate a resource method builder
7887///
7888/// ```test_harness,no_run
7889/// # extern crate hyper;
7890/// # extern crate hyper_rustls;
7891/// # extern crate google_run2 as run2;
7892/// use run2::api::GoogleCloudRunV2Job;
7893/// # async fn dox() {
7894/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7895///
7896/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7897/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7898/// #     .with_native_roots()
7899/// #     .unwrap()
7900/// #     .https_only()
7901/// #     .enable_http2()
7902/// #     .build();
7903///
7904/// # let executor = hyper_util::rt::TokioExecutor::new();
7905/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7906/// #     secret,
7907/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7908/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7909/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7910/// #     ),
7911/// # ).build().await.unwrap();
7912///
7913/// # let client = hyper_util::client::legacy::Client::builder(
7914/// #     hyper_util::rt::TokioExecutor::new()
7915/// # )
7916/// # .build(
7917/// #     hyper_rustls::HttpsConnectorBuilder::new()
7918/// #         .with_native_roots()
7919/// #         .unwrap()
7920/// #         .https_or_http()
7921/// #         .enable_http2()
7922/// #         .build()
7923/// # );
7924/// # let mut hub = CloudRun::new(client, auth);
7925/// // As the method needs a request, you would usually fill it with the desired information
7926/// // into the respective structure. Some of the parts shown here might not be applicable !
7927/// // Values shown here are possibly random and not representative !
7928/// let mut req = GoogleCloudRunV2Job::default();
7929///
7930/// // You can configure optional parameters by calling the respective setters at will, and
7931/// // execute the final call using `doit()`.
7932/// // Values shown here are possibly random and not representative !
7933/// let result = hub.projects().locations_jobs_patch(req, "name")
7934///              .validate_only(false)
7935///              .allow_missing(false)
7936///              .doit().await;
7937/// # }
7938/// ```
7939pub struct ProjectLocationJobPatchCall<'a, C>
7940where
7941    C: 'a,
7942{
7943    hub: &'a CloudRun<C>,
7944    _request: GoogleCloudRunV2Job,
7945    _name: String,
7946    _validate_only: Option<bool>,
7947    _allow_missing: Option<bool>,
7948    _delegate: Option<&'a mut dyn common::Delegate>,
7949    _additional_params: HashMap<String, String>,
7950    _scopes: BTreeSet<String>,
7951}
7952
7953impl<'a, C> common::CallBuilder for ProjectLocationJobPatchCall<'a, C> {}
7954
7955impl<'a, C> ProjectLocationJobPatchCall<'a, C>
7956where
7957    C: common::Connector,
7958{
7959    /// Perform the operation you have build so far.
7960    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
7961        use std::borrow::Cow;
7962        use std::io::{Read, Seek};
7963
7964        use common::{url::Params, ToParts};
7965        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7966
7967        let mut dd = common::DefaultDelegate;
7968        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7969        dlg.begin(common::MethodInfo {
7970            id: "run.projects.locations.jobs.patch",
7971            http_method: hyper::Method::PATCH,
7972        });
7973
7974        for &field in ["alt", "name", "validateOnly", "allowMissing"].iter() {
7975            if self._additional_params.contains_key(field) {
7976                dlg.finished(false);
7977                return Err(common::Error::FieldClash(field));
7978            }
7979        }
7980
7981        let mut params = Params::with_capacity(6 + self._additional_params.len());
7982        params.push("name", self._name);
7983        if let Some(value) = self._validate_only.as_ref() {
7984            params.push("validateOnly", value.to_string());
7985        }
7986        if let Some(value) = self._allow_missing.as_ref() {
7987            params.push("allowMissing", value.to_string());
7988        }
7989
7990        params.extend(self._additional_params.iter());
7991
7992        params.push("alt", "json");
7993        let mut url = self.hub._base_url.clone() + "v2/{+name}";
7994        if self._scopes.is_empty() {
7995            self._scopes
7996                .insert(Scope::CloudPlatform.as_ref().to_string());
7997        }
7998
7999        #[allow(clippy::single_element_loop)]
8000        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8001            url = params.uri_replacement(url, param_name, find_this, true);
8002        }
8003        {
8004            let to_remove = ["name"];
8005            params.remove_params(&to_remove);
8006        }
8007
8008        let url = params.parse_with_url(&url);
8009
8010        let mut json_mime_type = mime::APPLICATION_JSON;
8011        let mut request_value_reader = {
8012            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8013            common::remove_json_null_values(&mut value);
8014            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8015            serde_json::to_writer(&mut dst, &value).unwrap();
8016            dst
8017        };
8018        let request_size = request_value_reader
8019            .seek(std::io::SeekFrom::End(0))
8020            .unwrap();
8021        request_value_reader
8022            .seek(std::io::SeekFrom::Start(0))
8023            .unwrap();
8024
8025        loop {
8026            let token = match self
8027                .hub
8028                .auth
8029                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8030                .await
8031            {
8032                Ok(token) => token,
8033                Err(e) => match dlg.token(e) {
8034                    Ok(token) => token,
8035                    Err(e) => {
8036                        dlg.finished(false);
8037                        return Err(common::Error::MissingToken(e));
8038                    }
8039                },
8040            };
8041            request_value_reader
8042                .seek(std::io::SeekFrom::Start(0))
8043                .unwrap();
8044            let mut req_result = {
8045                let client = &self.hub.client;
8046                dlg.pre_request();
8047                let mut req_builder = hyper::Request::builder()
8048                    .method(hyper::Method::PATCH)
8049                    .uri(url.as_str())
8050                    .header(USER_AGENT, self.hub._user_agent.clone());
8051
8052                if let Some(token) = token.as_ref() {
8053                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8054                }
8055
8056                let request = req_builder
8057                    .header(CONTENT_TYPE, json_mime_type.to_string())
8058                    .header(CONTENT_LENGTH, request_size as u64)
8059                    .body(common::to_body(
8060                        request_value_reader.get_ref().clone().into(),
8061                    ));
8062
8063                client.request(request.unwrap()).await
8064            };
8065
8066            match req_result {
8067                Err(err) => {
8068                    if let common::Retry::After(d) = dlg.http_error(&err) {
8069                        sleep(d).await;
8070                        continue;
8071                    }
8072                    dlg.finished(false);
8073                    return Err(common::Error::HttpError(err));
8074                }
8075                Ok(res) => {
8076                    let (mut parts, body) = res.into_parts();
8077                    let mut body = common::Body::new(body);
8078                    if !parts.status.is_success() {
8079                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8080                        let error = serde_json::from_str(&common::to_string(&bytes));
8081                        let response = common::to_response(parts, bytes.into());
8082
8083                        if let common::Retry::After(d) =
8084                            dlg.http_failure(&response, error.as_ref().ok())
8085                        {
8086                            sleep(d).await;
8087                            continue;
8088                        }
8089
8090                        dlg.finished(false);
8091
8092                        return Err(match error {
8093                            Ok(value) => common::Error::BadRequest(value),
8094                            _ => common::Error::Failure(response),
8095                        });
8096                    }
8097                    let response = {
8098                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8099                        let encoded = common::to_string(&bytes);
8100                        match serde_json::from_str(&encoded) {
8101                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8102                            Err(error) => {
8103                                dlg.response_json_decode_error(&encoded, &error);
8104                                return Err(common::Error::JsonDecodeError(
8105                                    encoded.to_string(),
8106                                    error,
8107                                ));
8108                            }
8109                        }
8110                    };
8111
8112                    dlg.finished(true);
8113                    return Ok(response);
8114                }
8115            }
8116        }
8117    }
8118
8119    ///
8120    /// Sets the *request* property to the given value.
8121    ///
8122    /// Even though the property as already been set when instantiating this call,
8123    /// we provide this method for API completeness.
8124    pub fn request(mut self, new_value: GoogleCloudRunV2Job) -> ProjectLocationJobPatchCall<'a, C> {
8125        self._request = new_value;
8126        self
8127    }
8128    /// The fully qualified name of this Job. Format: projects/{project}/locations/{location}/jobs/{job}
8129    ///
8130    /// Sets the *name* path property to the given value.
8131    ///
8132    /// Even though the property as already been set when instantiating this call,
8133    /// we provide this method for API completeness.
8134    pub fn name(mut self, new_value: &str) -> ProjectLocationJobPatchCall<'a, C> {
8135        self._name = new_value.to_string();
8136        self
8137    }
8138    /// Indicates that the request should be validated and default values populated, without persisting the request or updating any resources.
8139    ///
8140    /// Sets the *validate only* query property to the given value.
8141    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationJobPatchCall<'a, C> {
8142        self._validate_only = Some(new_value);
8143        self
8144    }
8145    /// Optional. If set to true, and if the Job does not exist, it will create a new one. Caller must have both create and update permissions for this call if this is set to true.
8146    ///
8147    /// Sets the *allow missing* query property to the given value.
8148    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationJobPatchCall<'a, C> {
8149        self._allow_missing = Some(new_value);
8150        self
8151    }
8152    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8153    /// while executing the actual API request.
8154    ///
8155    /// ````text
8156    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8157    /// ````
8158    ///
8159    /// Sets the *delegate* property to the given value.
8160    pub fn delegate(
8161        mut self,
8162        new_value: &'a mut dyn common::Delegate,
8163    ) -> ProjectLocationJobPatchCall<'a, C> {
8164        self._delegate = Some(new_value);
8165        self
8166    }
8167
8168    /// Set any additional parameter of the query string used in the request.
8169    /// It should be used to set parameters which are not yet available through their own
8170    /// setters.
8171    ///
8172    /// Please note that this method must not be used to set any of the known parameters
8173    /// which have their own setter method. If done anyway, the request will fail.
8174    ///
8175    /// # Additional Parameters
8176    ///
8177    /// * *$.xgafv* (query-string) - V1 error format.
8178    /// * *access_token* (query-string) - OAuth access token.
8179    /// * *alt* (query-string) - Data format for response.
8180    /// * *callback* (query-string) - JSONP
8181    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8182    /// * *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.
8183    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8184    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8185    /// * *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.
8186    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8187    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8188    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobPatchCall<'a, C>
8189    where
8190        T: AsRef<str>,
8191    {
8192        self._additional_params
8193            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8194        self
8195    }
8196
8197    /// Identifies the authorization scope for the method you are building.
8198    ///
8199    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8200    /// [`Scope::CloudPlatform`].
8201    ///
8202    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8203    /// tokens for more than one scope.
8204    ///
8205    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8206    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8207    /// sufficient, a read-write scope will do as well.
8208    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobPatchCall<'a, C>
8209    where
8210        St: AsRef<str>,
8211    {
8212        self._scopes.insert(String::from(scope.as_ref()));
8213        self
8214    }
8215    /// Identifies the authorization scope(s) for the method you are building.
8216    ///
8217    /// See [`Self::add_scope()`] for details.
8218    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobPatchCall<'a, C>
8219    where
8220        I: IntoIterator<Item = St>,
8221        St: AsRef<str>,
8222    {
8223        self._scopes
8224            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8225        self
8226    }
8227
8228    /// Removes all scopes, and no default scope will be used either.
8229    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8230    /// for details).
8231    pub fn clear_scopes(mut self) -> ProjectLocationJobPatchCall<'a, C> {
8232        self._scopes.clear();
8233        self
8234    }
8235}
8236
8237/// Triggers creation of a new Execution of this Job.
8238///
8239/// A builder for the *locations.jobs.run* method supported by a *project* resource.
8240/// It is not used directly, but through a [`ProjectMethods`] instance.
8241///
8242/// # Example
8243///
8244/// Instantiate a resource method builder
8245///
8246/// ```test_harness,no_run
8247/// # extern crate hyper;
8248/// # extern crate hyper_rustls;
8249/// # extern crate google_run2 as run2;
8250/// use run2::api::GoogleCloudRunV2RunJobRequest;
8251/// # async fn dox() {
8252/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8253///
8254/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8255/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8256/// #     .with_native_roots()
8257/// #     .unwrap()
8258/// #     .https_only()
8259/// #     .enable_http2()
8260/// #     .build();
8261///
8262/// # let executor = hyper_util::rt::TokioExecutor::new();
8263/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8264/// #     secret,
8265/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8266/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8267/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8268/// #     ),
8269/// # ).build().await.unwrap();
8270///
8271/// # let client = hyper_util::client::legacy::Client::builder(
8272/// #     hyper_util::rt::TokioExecutor::new()
8273/// # )
8274/// # .build(
8275/// #     hyper_rustls::HttpsConnectorBuilder::new()
8276/// #         .with_native_roots()
8277/// #         .unwrap()
8278/// #         .https_or_http()
8279/// #         .enable_http2()
8280/// #         .build()
8281/// # );
8282/// # let mut hub = CloudRun::new(client, auth);
8283/// // As the method needs a request, you would usually fill it with the desired information
8284/// // into the respective structure. Some of the parts shown here might not be applicable !
8285/// // Values shown here are possibly random and not representative !
8286/// let mut req = GoogleCloudRunV2RunJobRequest::default();
8287///
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_jobs_run(req, "name")
8292///              .doit().await;
8293/// # }
8294/// ```
8295pub struct ProjectLocationJobRunCall<'a, C>
8296where
8297    C: 'a,
8298{
8299    hub: &'a CloudRun<C>,
8300    _request: GoogleCloudRunV2RunJobRequest,
8301    _name: String,
8302    _delegate: Option<&'a mut dyn common::Delegate>,
8303    _additional_params: HashMap<String, String>,
8304    _scopes: BTreeSet<String>,
8305}
8306
8307impl<'a, C> common::CallBuilder for ProjectLocationJobRunCall<'a, C> {}
8308
8309impl<'a, C> ProjectLocationJobRunCall<'a, C>
8310where
8311    C: common::Connector,
8312{
8313    /// Perform the operation you have build so far.
8314    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
8315        use std::borrow::Cow;
8316        use std::io::{Read, Seek};
8317
8318        use common::{url::Params, ToParts};
8319        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8320
8321        let mut dd = common::DefaultDelegate;
8322        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8323        dlg.begin(common::MethodInfo {
8324            id: "run.projects.locations.jobs.run",
8325            http_method: hyper::Method::POST,
8326        });
8327
8328        for &field in ["alt", "name"].iter() {
8329            if self._additional_params.contains_key(field) {
8330                dlg.finished(false);
8331                return Err(common::Error::FieldClash(field));
8332            }
8333        }
8334
8335        let mut params = Params::with_capacity(4 + 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() + "v2/{+name}:run";
8342        if self._scopes.is_empty() {
8343            self._scopes
8344                .insert(Scope::CloudPlatform.as_ref().to_string());
8345        }
8346
8347        #[allow(clippy::single_element_loop)]
8348        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8349            url = params.uri_replacement(url, param_name, find_this, true);
8350        }
8351        {
8352            let to_remove = ["name"];
8353            params.remove_params(&to_remove);
8354        }
8355
8356        let url = params.parse_with_url(&url);
8357
8358        let mut json_mime_type = mime::APPLICATION_JSON;
8359        let mut request_value_reader = {
8360            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8361            common::remove_json_null_values(&mut value);
8362            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8363            serde_json::to_writer(&mut dst, &value).unwrap();
8364            dst
8365        };
8366        let request_size = request_value_reader
8367            .seek(std::io::SeekFrom::End(0))
8368            .unwrap();
8369        request_value_reader
8370            .seek(std::io::SeekFrom::Start(0))
8371            .unwrap();
8372
8373        loop {
8374            let token = match self
8375                .hub
8376                .auth
8377                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8378                .await
8379            {
8380                Ok(token) => token,
8381                Err(e) => match dlg.token(e) {
8382                    Ok(token) => token,
8383                    Err(e) => {
8384                        dlg.finished(false);
8385                        return Err(common::Error::MissingToken(e));
8386                    }
8387                },
8388            };
8389            request_value_reader
8390                .seek(std::io::SeekFrom::Start(0))
8391                .unwrap();
8392            let mut req_result = {
8393                let client = &self.hub.client;
8394                dlg.pre_request();
8395                let mut req_builder = hyper::Request::builder()
8396                    .method(hyper::Method::POST)
8397                    .uri(url.as_str())
8398                    .header(USER_AGENT, self.hub._user_agent.clone());
8399
8400                if let Some(token) = token.as_ref() {
8401                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8402                }
8403
8404                let request = req_builder
8405                    .header(CONTENT_TYPE, json_mime_type.to_string())
8406                    .header(CONTENT_LENGTH, request_size as u64)
8407                    .body(common::to_body(
8408                        request_value_reader.get_ref().clone().into(),
8409                    ));
8410
8411                client.request(request.unwrap()).await
8412            };
8413
8414            match req_result {
8415                Err(err) => {
8416                    if let common::Retry::After(d) = dlg.http_error(&err) {
8417                        sleep(d).await;
8418                        continue;
8419                    }
8420                    dlg.finished(false);
8421                    return Err(common::Error::HttpError(err));
8422                }
8423                Ok(res) => {
8424                    let (mut parts, body) = res.into_parts();
8425                    let mut body = common::Body::new(body);
8426                    if !parts.status.is_success() {
8427                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8428                        let error = serde_json::from_str(&common::to_string(&bytes));
8429                        let response = common::to_response(parts, bytes.into());
8430
8431                        if let common::Retry::After(d) =
8432                            dlg.http_failure(&response, error.as_ref().ok())
8433                        {
8434                            sleep(d).await;
8435                            continue;
8436                        }
8437
8438                        dlg.finished(false);
8439
8440                        return Err(match error {
8441                            Ok(value) => common::Error::BadRequest(value),
8442                            _ => common::Error::Failure(response),
8443                        });
8444                    }
8445                    let response = {
8446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8447                        let encoded = common::to_string(&bytes);
8448                        match serde_json::from_str(&encoded) {
8449                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8450                            Err(error) => {
8451                                dlg.response_json_decode_error(&encoded, &error);
8452                                return Err(common::Error::JsonDecodeError(
8453                                    encoded.to_string(),
8454                                    error,
8455                                ));
8456                            }
8457                        }
8458                    };
8459
8460                    dlg.finished(true);
8461                    return Ok(response);
8462                }
8463            }
8464        }
8465    }
8466
8467    ///
8468    /// Sets the *request* property to the given value.
8469    ///
8470    /// Even though the property as already been set when instantiating this call,
8471    /// we provide this method for API completeness.
8472    pub fn request(
8473        mut self,
8474        new_value: GoogleCloudRunV2RunJobRequest,
8475    ) -> ProjectLocationJobRunCall<'a, C> {
8476        self._request = new_value;
8477        self
8478    }
8479    /// Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.
8480    ///
8481    /// Sets the *name* path property to the given value.
8482    ///
8483    /// Even though the property as already been set when instantiating this call,
8484    /// we provide this method for API completeness.
8485    pub fn name(mut self, new_value: &str) -> ProjectLocationJobRunCall<'a, C> {
8486        self._name = new_value.to_string();
8487        self
8488    }
8489    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8490    /// while executing the actual API request.
8491    ///
8492    /// ````text
8493    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8494    /// ````
8495    ///
8496    /// Sets the *delegate* property to the given value.
8497    pub fn delegate(
8498        mut self,
8499        new_value: &'a mut dyn common::Delegate,
8500    ) -> ProjectLocationJobRunCall<'a, C> {
8501        self._delegate = Some(new_value);
8502        self
8503    }
8504
8505    /// Set any additional parameter of the query string used in the request.
8506    /// It should be used to set parameters which are not yet available through their own
8507    /// setters.
8508    ///
8509    /// Please note that this method must not be used to set any of the known parameters
8510    /// which have their own setter method. If done anyway, the request will fail.
8511    ///
8512    /// # Additional Parameters
8513    ///
8514    /// * *$.xgafv* (query-string) - V1 error format.
8515    /// * *access_token* (query-string) - OAuth access token.
8516    /// * *alt* (query-string) - Data format for response.
8517    /// * *callback* (query-string) - JSONP
8518    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8519    /// * *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.
8520    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8521    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8522    /// * *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.
8523    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8524    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8525    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobRunCall<'a, C>
8526    where
8527        T: AsRef<str>,
8528    {
8529        self._additional_params
8530            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8531        self
8532    }
8533
8534    /// Identifies the authorization scope for the method you are building.
8535    ///
8536    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8537    /// [`Scope::CloudPlatform`].
8538    ///
8539    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8540    /// tokens for more than one scope.
8541    ///
8542    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8543    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8544    /// sufficient, a read-write scope will do as well.
8545    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobRunCall<'a, C>
8546    where
8547        St: AsRef<str>,
8548    {
8549        self._scopes.insert(String::from(scope.as_ref()));
8550        self
8551    }
8552    /// Identifies the authorization scope(s) for the method you are building.
8553    ///
8554    /// See [`Self::add_scope()`] for details.
8555    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobRunCall<'a, C>
8556    where
8557        I: IntoIterator<Item = St>,
8558        St: AsRef<str>,
8559    {
8560        self._scopes
8561            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8562        self
8563    }
8564
8565    /// Removes all scopes, and no default scope will be used either.
8566    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8567    /// for details).
8568    pub fn clear_scopes(mut self) -> ProjectLocationJobRunCall<'a, C> {
8569        self._scopes.clear();
8570        self
8571    }
8572}
8573
8574/// Sets the IAM Access control policy for the specified Job. Overwrites any existing policy.
8575///
8576/// A builder for the *locations.jobs.setIamPolicy* method supported by a *project* resource.
8577/// It is not used directly, but through a [`ProjectMethods`] instance.
8578///
8579/// # Example
8580///
8581/// Instantiate a resource method builder
8582///
8583/// ```test_harness,no_run
8584/// # extern crate hyper;
8585/// # extern crate hyper_rustls;
8586/// # extern crate google_run2 as run2;
8587/// use run2::api::GoogleIamV1SetIamPolicyRequest;
8588/// # async fn dox() {
8589/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8590///
8591/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8592/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8593/// #     .with_native_roots()
8594/// #     .unwrap()
8595/// #     .https_only()
8596/// #     .enable_http2()
8597/// #     .build();
8598///
8599/// # let executor = hyper_util::rt::TokioExecutor::new();
8600/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8601/// #     secret,
8602/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8603/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8604/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8605/// #     ),
8606/// # ).build().await.unwrap();
8607///
8608/// # let client = hyper_util::client::legacy::Client::builder(
8609/// #     hyper_util::rt::TokioExecutor::new()
8610/// # )
8611/// # .build(
8612/// #     hyper_rustls::HttpsConnectorBuilder::new()
8613/// #         .with_native_roots()
8614/// #         .unwrap()
8615/// #         .https_or_http()
8616/// #         .enable_http2()
8617/// #         .build()
8618/// # );
8619/// # let mut hub = CloudRun::new(client, auth);
8620/// // As the method needs a request, you would usually fill it with the desired information
8621/// // into the respective structure. Some of the parts shown here might not be applicable !
8622/// // Values shown here are possibly random and not representative !
8623/// let mut req = GoogleIamV1SetIamPolicyRequest::default();
8624///
8625/// // You can configure optional parameters by calling the respective setters at will, and
8626/// // execute the final call using `doit()`.
8627/// // Values shown here are possibly random and not representative !
8628/// let result = hub.projects().locations_jobs_set_iam_policy(req, "resource")
8629///              .doit().await;
8630/// # }
8631/// ```
8632pub struct ProjectLocationJobSetIamPolicyCall<'a, C>
8633where
8634    C: 'a,
8635{
8636    hub: &'a CloudRun<C>,
8637    _request: GoogleIamV1SetIamPolicyRequest,
8638    _resource: String,
8639    _delegate: Option<&'a mut dyn common::Delegate>,
8640    _additional_params: HashMap<String, String>,
8641    _scopes: BTreeSet<String>,
8642}
8643
8644impl<'a, C> common::CallBuilder for ProjectLocationJobSetIamPolicyCall<'a, C> {}
8645
8646impl<'a, C> ProjectLocationJobSetIamPolicyCall<'a, C>
8647where
8648    C: common::Connector,
8649{
8650    /// Perform the operation you have build so far.
8651    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
8652        use std::borrow::Cow;
8653        use std::io::{Read, Seek};
8654
8655        use common::{url::Params, ToParts};
8656        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8657
8658        let mut dd = common::DefaultDelegate;
8659        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8660        dlg.begin(common::MethodInfo {
8661            id: "run.projects.locations.jobs.setIamPolicy",
8662            http_method: hyper::Method::POST,
8663        });
8664
8665        for &field in ["alt", "resource"].iter() {
8666            if self._additional_params.contains_key(field) {
8667                dlg.finished(false);
8668                return Err(common::Error::FieldClash(field));
8669            }
8670        }
8671
8672        let mut params = Params::with_capacity(4 + self._additional_params.len());
8673        params.push("resource", self._resource);
8674
8675        params.extend(self._additional_params.iter());
8676
8677        params.push("alt", "json");
8678        let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy";
8679        if self._scopes.is_empty() {
8680            self._scopes
8681                .insert(Scope::CloudPlatform.as_ref().to_string());
8682        }
8683
8684        #[allow(clippy::single_element_loop)]
8685        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8686            url = params.uri_replacement(url, param_name, find_this, true);
8687        }
8688        {
8689            let to_remove = ["resource"];
8690            params.remove_params(&to_remove);
8691        }
8692
8693        let url = params.parse_with_url(&url);
8694
8695        let mut json_mime_type = mime::APPLICATION_JSON;
8696        let mut request_value_reader = {
8697            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8698            common::remove_json_null_values(&mut value);
8699            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8700            serde_json::to_writer(&mut dst, &value).unwrap();
8701            dst
8702        };
8703        let request_size = request_value_reader
8704            .seek(std::io::SeekFrom::End(0))
8705            .unwrap();
8706        request_value_reader
8707            .seek(std::io::SeekFrom::Start(0))
8708            .unwrap();
8709
8710        loop {
8711            let token = match self
8712                .hub
8713                .auth
8714                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8715                .await
8716            {
8717                Ok(token) => token,
8718                Err(e) => match dlg.token(e) {
8719                    Ok(token) => token,
8720                    Err(e) => {
8721                        dlg.finished(false);
8722                        return Err(common::Error::MissingToken(e));
8723                    }
8724                },
8725            };
8726            request_value_reader
8727                .seek(std::io::SeekFrom::Start(0))
8728                .unwrap();
8729            let mut req_result = {
8730                let client = &self.hub.client;
8731                dlg.pre_request();
8732                let mut req_builder = hyper::Request::builder()
8733                    .method(hyper::Method::POST)
8734                    .uri(url.as_str())
8735                    .header(USER_AGENT, self.hub._user_agent.clone());
8736
8737                if let Some(token) = token.as_ref() {
8738                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8739                }
8740
8741                let request = req_builder
8742                    .header(CONTENT_TYPE, json_mime_type.to_string())
8743                    .header(CONTENT_LENGTH, request_size as u64)
8744                    .body(common::to_body(
8745                        request_value_reader.get_ref().clone().into(),
8746                    ));
8747
8748                client.request(request.unwrap()).await
8749            };
8750
8751            match req_result {
8752                Err(err) => {
8753                    if let common::Retry::After(d) = dlg.http_error(&err) {
8754                        sleep(d).await;
8755                        continue;
8756                    }
8757                    dlg.finished(false);
8758                    return Err(common::Error::HttpError(err));
8759                }
8760                Ok(res) => {
8761                    let (mut parts, body) = res.into_parts();
8762                    let mut body = common::Body::new(body);
8763                    if !parts.status.is_success() {
8764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8765                        let error = serde_json::from_str(&common::to_string(&bytes));
8766                        let response = common::to_response(parts, bytes.into());
8767
8768                        if let common::Retry::After(d) =
8769                            dlg.http_failure(&response, error.as_ref().ok())
8770                        {
8771                            sleep(d).await;
8772                            continue;
8773                        }
8774
8775                        dlg.finished(false);
8776
8777                        return Err(match error {
8778                            Ok(value) => common::Error::BadRequest(value),
8779                            _ => common::Error::Failure(response),
8780                        });
8781                    }
8782                    let response = {
8783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8784                        let encoded = common::to_string(&bytes);
8785                        match serde_json::from_str(&encoded) {
8786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8787                            Err(error) => {
8788                                dlg.response_json_decode_error(&encoded, &error);
8789                                return Err(common::Error::JsonDecodeError(
8790                                    encoded.to_string(),
8791                                    error,
8792                                ));
8793                            }
8794                        }
8795                    };
8796
8797                    dlg.finished(true);
8798                    return Ok(response);
8799                }
8800            }
8801        }
8802    }
8803
8804    ///
8805    /// Sets the *request* property to the given value.
8806    ///
8807    /// Even though the property as already been set when instantiating this call,
8808    /// we provide this method for API completeness.
8809    pub fn request(
8810        mut self,
8811        new_value: GoogleIamV1SetIamPolicyRequest,
8812    ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
8813        self._request = new_value;
8814        self
8815    }
8816    /// 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.
8817    ///
8818    /// Sets the *resource* path property to the given value.
8819    ///
8820    /// Even though the property as already been set when instantiating this call,
8821    /// we provide this method for API completeness.
8822    pub fn resource(mut self, new_value: &str) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
8823        self._resource = new_value.to_string();
8824        self
8825    }
8826    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8827    /// while executing the actual API request.
8828    ///
8829    /// ````text
8830    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8831    /// ````
8832    ///
8833    /// Sets the *delegate* property to the given value.
8834    pub fn delegate(
8835        mut self,
8836        new_value: &'a mut dyn common::Delegate,
8837    ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
8838        self._delegate = Some(new_value);
8839        self
8840    }
8841
8842    /// Set any additional parameter of the query string used in the request.
8843    /// It should be used to set parameters which are not yet available through their own
8844    /// setters.
8845    ///
8846    /// Please note that this method must not be used to set any of the known parameters
8847    /// which have their own setter method. If done anyway, the request will fail.
8848    ///
8849    /// # Additional Parameters
8850    ///
8851    /// * *$.xgafv* (query-string) - V1 error format.
8852    /// * *access_token* (query-string) - OAuth access token.
8853    /// * *alt* (query-string) - Data format for response.
8854    /// * *callback* (query-string) - JSONP
8855    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8856    /// * *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.
8857    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8858    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8859    /// * *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.
8860    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8861    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8862    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobSetIamPolicyCall<'a, C>
8863    where
8864        T: AsRef<str>,
8865    {
8866        self._additional_params
8867            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8868        self
8869    }
8870
8871    /// Identifies the authorization scope for the method you are building.
8872    ///
8873    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8874    /// [`Scope::CloudPlatform`].
8875    ///
8876    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8877    /// tokens for more than one scope.
8878    ///
8879    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8880    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8881    /// sufficient, a read-write scope will do as well.
8882    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobSetIamPolicyCall<'a, C>
8883    where
8884        St: AsRef<str>,
8885    {
8886        self._scopes.insert(String::from(scope.as_ref()));
8887        self
8888    }
8889    /// Identifies the authorization scope(s) for the method you are building.
8890    ///
8891    /// See [`Self::add_scope()`] for details.
8892    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobSetIamPolicyCall<'a, C>
8893    where
8894        I: IntoIterator<Item = St>,
8895        St: AsRef<str>,
8896    {
8897        self._scopes
8898            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8899        self
8900    }
8901
8902    /// Removes all scopes, and no default scope will be used either.
8903    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8904    /// for details).
8905    pub fn clear_scopes(mut self) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
8906        self._scopes.clear();
8907        self
8908    }
8909}
8910
8911/// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
8912///
8913/// A builder for the *locations.jobs.testIamPermissions* method supported by a *project* resource.
8914/// It is not used directly, but through a [`ProjectMethods`] instance.
8915///
8916/// # Example
8917///
8918/// Instantiate a resource method builder
8919///
8920/// ```test_harness,no_run
8921/// # extern crate hyper;
8922/// # extern crate hyper_rustls;
8923/// # extern crate google_run2 as run2;
8924/// use run2::api::GoogleIamV1TestIamPermissionsRequest;
8925/// # async fn dox() {
8926/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8927///
8928/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8929/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8930/// #     .with_native_roots()
8931/// #     .unwrap()
8932/// #     .https_only()
8933/// #     .enable_http2()
8934/// #     .build();
8935///
8936/// # let executor = hyper_util::rt::TokioExecutor::new();
8937/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8938/// #     secret,
8939/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8940/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8941/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8942/// #     ),
8943/// # ).build().await.unwrap();
8944///
8945/// # let client = hyper_util::client::legacy::Client::builder(
8946/// #     hyper_util::rt::TokioExecutor::new()
8947/// # )
8948/// # .build(
8949/// #     hyper_rustls::HttpsConnectorBuilder::new()
8950/// #         .with_native_roots()
8951/// #         .unwrap()
8952/// #         .https_or_http()
8953/// #         .enable_http2()
8954/// #         .build()
8955/// # );
8956/// # let mut hub = CloudRun::new(client, auth);
8957/// // As the method needs a request, you would usually fill it with the desired information
8958/// // into the respective structure. Some of the parts shown here might not be applicable !
8959/// // Values shown here are possibly random and not representative !
8960/// let mut req = GoogleIamV1TestIamPermissionsRequest::default();
8961///
8962/// // You can configure optional parameters by calling the respective setters at will, and
8963/// // execute the final call using `doit()`.
8964/// // Values shown here are possibly random and not representative !
8965/// let result = hub.projects().locations_jobs_test_iam_permissions(req, "resource")
8966///              .doit().await;
8967/// # }
8968/// ```
8969pub struct ProjectLocationJobTestIamPermissionCall<'a, C>
8970where
8971    C: 'a,
8972{
8973    hub: &'a CloudRun<C>,
8974    _request: GoogleIamV1TestIamPermissionsRequest,
8975    _resource: String,
8976    _delegate: Option<&'a mut dyn common::Delegate>,
8977    _additional_params: HashMap<String, String>,
8978    _scopes: BTreeSet<String>,
8979}
8980
8981impl<'a, C> common::CallBuilder for ProjectLocationJobTestIamPermissionCall<'a, C> {}
8982
8983impl<'a, C> ProjectLocationJobTestIamPermissionCall<'a, C>
8984where
8985    C: common::Connector,
8986{
8987    /// Perform the operation you have build so far.
8988    pub async fn doit(
8989        mut self,
8990    ) -> common::Result<(common::Response, GoogleIamV1TestIamPermissionsResponse)> {
8991        use std::borrow::Cow;
8992        use std::io::{Read, Seek};
8993
8994        use common::{url::Params, ToParts};
8995        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8996
8997        let mut dd = common::DefaultDelegate;
8998        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8999        dlg.begin(common::MethodInfo {
9000            id: "run.projects.locations.jobs.testIamPermissions",
9001            http_method: hyper::Method::POST,
9002        });
9003
9004        for &field in ["alt", "resource"].iter() {
9005            if self._additional_params.contains_key(field) {
9006                dlg.finished(false);
9007                return Err(common::Error::FieldClash(field));
9008            }
9009        }
9010
9011        let mut params = Params::with_capacity(4 + self._additional_params.len());
9012        params.push("resource", self._resource);
9013
9014        params.extend(self._additional_params.iter());
9015
9016        params.push("alt", "json");
9017        let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions";
9018        if self._scopes.is_empty() {
9019            self._scopes
9020                .insert(Scope::CloudPlatform.as_ref().to_string());
9021        }
9022
9023        #[allow(clippy::single_element_loop)]
9024        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9025            url = params.uri_replacement(url, param_name, find_this, true);
9026        }
9027        {
9028            let to_remove = ["resource"];
9029            params.remove_params(&to_remove);
9030        }
9031
9032        let url = params.parse_with_url(&url);
9033
9034        let mut json_mime_type = mime::APPLICATION_JSON;
9035        let mut request_value_reader = {
9036            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9037            common::remove_json_null_values(&mut value);
9038            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9039            serde_json::to_writer(&mut dst, &value).unwrap();
9040            dst
9041        };
9042        let request_size = request_value_reader
9043            .seek(std::io::SeekFrom::End(0))
9044            .unwrap();
9045        request_value_reader
9046            .seek(std::io::SeekFrom::Start(0))
9047            .unwrap();
9048
9049        loop {
9050            let token = match self
9051                .hub
9052                .auth
9053                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9054                .await
9055            {
9056                Ok(token) => token,
9057                Err(e) => match dlg.token(e) {
9058                    Ok(token) => token,
9059                    Err(e) => {
9060                        dlg.finished(false);
9061                        return Err(common::Error::MissingToken(e));
9062                    }
9063                },
9064            };
9065            request_value_reader
9066                .seek(std::io::SeekFrom::Start(0))
9067                .unwrap();
9068            let mut req_result = {
9069                let client = &self.hub.client;
9070                dlg.pre_request();
9071                let mut req_builder = hyper::Request::builder()
9072                    .method(hyper::Method::POST)
9073                    .uri(url.as_str())
9074                    .header(USER_AGENT, self.hub._user_agent.clone());
9075
9076                if let Some(token) = token.as_ref() {
9077                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9078                }
9079
9080                let request = req_builder
9081                    .header(CONTENT_TYPE, json_mime_type.to_string())
9082                    .header(CONTENT_LENGTH, request_size as u64)
9083                    .body(common::to_body(
9084                        request_value_reader.get_ref().clone().into(),
9085                    ));
9086
9087                client.request(request.unwrap()).await
9088            };
9089
9090            match req_result {
9091                Err(err) => {
9092                    if let common::Retry::After(d) = dlg.http_error(&err) {
9093                        sleep(d).await;
9094                        continue;
9095                    }
9096                    dlg.finished(false);
9097                    return Err(common::Error::HttpError(err));
9098                }
9099                Ok(res) => {
9100                    let (mut parts, body) = res.into_parts();
9101                    let mut body = common::Body::new(body);
9102                    if !parts.status.is_success() {
9103                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9104                        let error = serde_json::from_str(&common::to_string(&bytes));
9105                        let response = common::to_response(parts, bytes.into());
9106
9107                        if let common::Retry::After(d) =
9108                            dlg.http_failure(&response, error.as_ref().ok())
9109                        {
9110                            sleep(d).await;
9111                            continue;
9112                        }
9113
9114                        dlg.finished(false);
9115
9116                        return Err(match error {
9117                            Ok(value) => common::Error::BadRequest(value),
9118                            _ => common::Error::Failure(response),
9119                        });
9120                    }
9121                    let response = {
9122                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9123                        let encoded = common::to_string(&bytes);
9124                        match serde_json::from_str(&encoded) {
9125                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9126                            Err(error) => {
9127                                dlg.response_json_decode_error(&encoded, &error);
9128                                return Err(common::Error::JsonDecodeError(
9129                                    encoded.to_string(),
9130                                    error,
9131                                ));
9132                            }
9133                        }
9134                    };
9135
9136                    dlg.finished(true);
9137                    return Ok(response);
9138                }
9139            }
9140        }
9141    }
9142
9143    ///
9144    /// Sets the *request* property to the given value.
9145    ///
9146    /// Even though the property as already been set when instantiating this call,
9147    /// we provide this method for API completeness.
9148    pub fn request(
9149        mut self,
9150        new_value: GoogleIamV1TestIamPermissionsRequest,
9151    ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
9152        self._request = new_value;
9153        self
9154    }
9155    /// 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.
9156    ///
9157    /// Sets the *resource* path property to the given value.
9158    ///
9159    /// Even though the property as already been set when instantiating this call,
9160    /// we provide this method for API completeness.
9161    pub fn resource(mut self, new_value: &str) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
9162        self._resource = new_value.to_string();
9163        self
9164    }
9165    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9166    /// while executing the actual API request.
9167    ///
9168    /// ````text
9169    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9170    /// ````
9171    ///
9172    /// Sets the *delegate* property to the given value.
9173    pub fn delegate(
9174        mut self,
9175        new_value: &'a mut dyn common::Delegate,
9176    ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
9177        self._delegate = Some(new_value);
9178        self
9179    }
9180
9181    /// Set any additional parameter of the query string used in the request.
9182    /// It should be used to set parameters which are not yet available through their own
9183    /// setters.
9184    ///
9185    /// Please note that this method must not be used to set any of the known parameters
9186    /// which have their own setter method. If done anyway, the request will fail.
9187    ///
9188    /// # Additional Parameters
9189    ///
9190    /// * *$.xgafv* (query-string) - V1 error format.
9191    /// * *access_token* (query-string) - OAuth access token.
9192    /// * *alt* (query-string) - Data format for response.
9193    /// * *callback* (query-string) - JSONP
9194    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9195    /// * *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.
9196    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9197    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9198    /// * *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.
9199    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9200    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9201    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTestIamPermissionCall<'a, C>
9202    where
9203        T: AsRef<str>,
9204    {
9205        self._additional_params
9206            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9207        self
9208    }
9209
9210    /// Identifies the authorization scope for the method you are building.
9211    ///
9212    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9213    /// [`Scope::CloudPlatform`].
9214    ///
9215    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9216    /// tokens for more than one scope.
9217    ///
9218    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9219    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9220    /// sufficient, a read-write scope will do as well.
9221    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTestIamPermissionCall<'a, C>
9222    where
9223        St: AsRef<str>,
9224    {
9225        self._scopes.insert(String::from(scope.as_ref()));
9226        self
9227    }
9228    /// Identifies the authorization scope(s) for the method you are building.
9229    ///
9230    /// See [`Self::add_scope()`] for details.
9231    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTestIamPermissionCall<'a, C>
9232    where
9233        I: IntoIterator<Item = St>,
9234        St: AsRef<str>,
9235    {
9236        self._scopes
9237            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9238        self
9239    }
9240
9241    /// Removes all scopes, and no default scope will be used either.
9242    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9243    /// for details).
9244    pub fn clear_scopes(mut self) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
9245        self._scopes.clear();
9246        self
9247    }
9248}
9249
9250/// 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`.
9251///
9252/// A builder for the *locations.operations.delete* method supported by a *project* resource.
9253/// It is not used directly, but through a [`ProjectMethods`] instance.
9254///
9255/// # Example
9256///
9257/// Instantiate a resource method builder
9258///
9259/// ```test_harness,no_run
9260/// # extern crate hyper;
9261/// # extern crate hyper_rustls;
9262/// # extern crate google_run2 as run2;
9263/// # async fn dox() {
9264/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9265///
9266/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9267/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9268/// #     .with_native_roots()
9269/// #     .unwrap()
9270/// #     .https_only()
9271/// #     .enable_http2()
9272/// #     .build();
9273///
9274/// # let executor = hyper_util::rt::TokioExecutor::new();
9275/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9276/// #     secret,
9277/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9278/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9279/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9280/// #     ),
9281/// # ).build().await.unwrap();
9282///
9283/// # let client = hyper_util::client::legacy::Client::builder(
9284/// #     hyper_util::rt::TokioExecutor::new()
9285/// # )
9286/// # .build(
9287/// #     hyper_rustls::HttpsConnectorBuilder::new()
9288/// #         .with_native_roots()
9289/// #         .unwrap()
9290/// #         .https_or_http()
9291/// #         .enable_http2()
9292/// #         .build()
9293/// # );
9294/// # let mut hub = CloudRun::new(client, auth);
9295/// // You can configure optional parameters by calling the respective setters at will, and
9296/// // execute the final call using `doit()`.
9297/// // Values shown here are possibly random and not representative !
9298/// let result = hub.projects().locations_operations_delete("name")
9299///              .doit().await;
9300/// # }
9301/// ```
9302pub struct ProjectLocationOperationDeleteCall<'a, C>
9303where
9304    C: 'a,
9305{
9306    hub: &'a CloudRun<C>,
9307    _name: String,
9308    _delegate: Option<&'a mut dyn common::Delegate>,
9309    _additional_params: HashMap<String, String>,
9310    _scopes: BTreeSet<String>,
9311}
9312
9313impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
9314
9315impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
9316where
9317    C: common::Connector,
9318{
9319    /// Perform the operation you have build so far.
9320    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
9321        use std::borrow::Cow;
9322        use std::io::{Read, Seek};
9323
9324        use common::{url::Params, ToParts};
9325        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9326
9327        let mut dd = common::DefaultDelegate;
9328        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9329        dlg.begin(common::MethodInfo {
9330            id: "run.projects.locations.operations.delete",
9331            http_method: hyper::Method::DELETE,
9332        });
9333
9334        for &field in ["alt", "name"].iter() {
9335            if self._additional_params.contains_key(field) {
9336                dlg.finished(false);
9337                return Err(common::Error::FieldClash(field));
9338            }
9339        }
9340
9341        let mut params = Params::with_capacity(3 + self._additional_params.len());
9342        params.push("name", self._name);
9343
9344        params.extend(self._additional_params.iter());
9345
9346        params.push("alt", "json");
9347        let mut url = self.hub._base_url.clone() + "v2/{+name}";
9348        if self._scopes.is_empty() {
9349            self._scopes
9350                .insert(Scope::CloudPlatform.as_ref().to_string());
9351        }
9352
9353        #[allow(clippy::single_element_loop)]
9354        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9355            url = params.uri_replacement(url, param_name, find_this, true);
9356        }
9357        {
9358            let to_remove = ["name"];
9359            params.remove_params(&to_remove);
9360        }
9361
9362        let url = params.parse_with_url(&url);
9363
9364        loop {
9365            let token = match self
9366                .hub
9367                .auth
9368                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9369                .await
9370            {
9371                Ok(token) => token,
9372                Err(e) => match dlg.token(e) {
9373                    Ok(token) => token,
9374                    Err(e) => {
9375                        dlg.finished(false);
9376                        return Err(common::Error::MissingToken(e));
9377                    }
9378                },
9379            };
9380            let mut req_result = {
9381                let client = &self.hub.client;
9382                dlg.pre_request();
9383                let mut req_builder = hyper::Request::builder()
9384                    .method(hyper::Method::DELETE)
9385                    .uri(url.as_str())
9386                    .header(USER_AGENT, self.hub._user_agent.clone());
9387
9388                if let Some(token) = token.as_ref() {
9389                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9390                }
9391
9392                let request = req_builder
9393                    .header(CONTENT_LENGTH, 0_u64)
9394                    .body(common::to_body::<String>(None));
9395
9396                client.request(request.unwrap()).await
9397            };
9398
9399            match req_result {
9400                Err(err) => {
9401                    if let common::Retry::After(d) = dlg.http_error(&err) {
9402                        sleep(d).await;
9403                        continue;
9404                    }
9405                    dlg.finished(false);
9406                    return Err(common::Error::HttpError(err));
9407                }
9408                Ok(res) => {
9409                    let (mut parts, body) = res.into_parts();
9410                    let mut body = common::Body::new(body);
9411                    if !parts.status.is_success() {
9412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9413                        let error = serde_json::from_str(&common::to_string(&bytes));
9414                        let response = common::to_response(parts, bytes.into());
9415
9416                        if let common::Retry::After(d) =
9417                            dlg.http_failure(&response, error.as_ref().ok())
9418                        {
9419                            sleep(d).await;
9420                            continue;
9421                        }
9422
9423                        dlg.finished(false);
9424
9425                        return Err(match error {
9426                            Ok(value) => common::Error::BadRequest(value),
9427                            _ => common::Error::Failure(response),
9428                        });
9429                    }
9430                    let response = {
9431                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9432                        let encoded = common::to_string(&bytes);
9433                        match serde_json::from_str(&encoded) {
9434                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9435                            Err(error) => {
9436                                dlg.response_json_decode_error(&encoded, &error);
9437                                return Err(common::Error::JsonDecodeError(
9438                                    encoded.to_string(),
9439                                    error,
9440                                ));
9441                            }
9442                        }
9443                    };
9444
9445                    dlg.finished(true);
9446                    return Ok(response);
9447                }
9448            }
9449        }
9450    }
9451
9452    /// The name of the operation resource to be deleted.
9453    ///
9454    /// Sets the *name* path property to the given value.
9455    ///
9456    /// Even though the property as already been set when instantiating this call,
9457    /// we provide this method for API completeness.
9458    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
9459        self._name = new_value.to_string();
9460        self
9461    }
9462    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9463    /// while executing the actual API request.
9464    ///
9465    /// ````text
9466    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9467    /// ````
9468    ///
9469    /// Sets the *delegate* property to the given value.
9470    pub fn delegate(
9471        mut self,
9472        new_value: &'a mut dyn common::Delegate,
9473    ) -> ProjectLocationOperationDeleteCall<'a, C> {
9474        self._delegate = Some(new_value);
9475        self
9476    }
9477
9478    /// Set any additional parameter of the query string used in the request.
9479    /// It should be used to set parameters which are not yet available through their own
9480    /// setters.
9481    ///
9482    /// Please note that this method must not be used to set any of the known parameters
9483    /// which have their own setter method. If done anyway, the request will fail.
9484    ///
9485    /// # Additional Parameters
9486    ///
9487    /// * *$.xgafv* (query-string) - V1 error format.
9488    /// * *access_token* (query-string) - OAuth access token.
9489    /// * *alt* (query-string) - Data format for response.
9490    /// * *callback* (query-string) - JSONP
9491    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9492    /// * *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.
9493    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9494    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9495    /// * *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.
9496    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9497    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9498    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
9499    where
9500        T: AsRef<str>,
9501    {
9502        self._additional_params
9503            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9504        self
9505    }
9506
9507    /// Identifies the authorization scope for the method you are building.
9508    ///
9509    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9510    /// [`Scope::CloudPlatform`].
9511    ///
9512    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9513    /// tokens for more than one scope.
9514    ///
9515    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9516    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9517    /// sufficient, a read-write scope will do as well.
9518    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
9519    where
9520        St: AsRef<str>,
9521    {
9522        self._scopes.insert(String::from(scope.as_ref()));
9523        self
9524    }
9525    /// Identifies the authorization scope(s) for the method you are building.
9526    ///
9527    /// See [`Self::add_scope()`] for details.
9528    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
9529    where
9530        I: IntoIterator<Item = St>,
9531        St: AsRef<str>,
9532    {
9533        self._scopes
9534            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9535        self
9536    }
9537
9538    /// Removes all scopes, and no default scope will be used either.
9539    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9540    /// for details).
9541    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
9542        self._scopes.clear();
9543        self
9544    }
9545}
9546
9547/// 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.
9548///
9549/// A builder for the *locations.operations.get* method supported by a *project* resource.
9550/// It is not used directly, but through a [`ProjectMethods`] instance.
9551///
9552/// # Example
9553///
9554/// Instantiate a resource method builder
9555///
9556/// ```test_harness,no_run
9557/// # extern crate hyper;
9558/// # extern crate hyper_rustls;
9559/// # extern crate google_run2 as run2;
9560/// # async fn dox() {
9561/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9562///
9563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9564/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9565/// #     .with_native_roots()
9566/// #     .unwrap()
9567/// #     .https_only()
9568/// #     .enable_http2()
9569/// #     .build();
9570///
9571/// # let executor = hyper_util::rt::TokioExecutor::new();
9572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9573/// #     secret,
9574/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9575/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9576/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9577/// #     ),
9578/// # ).build().await.unwrap();
9579///
9580/// # let client = hyper_util::client::legacy::Client::builder(
9581/// #     hyper_util::rt::TokioExecutor::new()
9582/// # )
9583/// # .build(
9584/// #     hyper_rustls::HttpsConnectorBuilder::new()
9585/// #         .with_native_roots()
9586/// #         .unwrap()
9587/// #         .https_or_http()
9588/// #         .enable_http2()
9589/// #         .build()
9590/// # );
9591/// # let mut hub = CloudRun::new(client, auth);
9592/// // You can configure optional parameters by calling the respective setters at will, and
9593/// // execute the final call using `doit()`.
9594/// // Values shown here are possibly random and not representative !
9595/// let result = hub.projects().locations_operations_get("name")
9596///              .doit().await;
9597/// # }
9598/// ```
9599pub struct ProjectLocationOperationGetCall<'a, C>
9600where
9601    C: 'a,
9602{
9603    hub: &'a CloudRun<C>,
9604    _name: String,
9605    _delegate: Option<&'a mut dyn common::Delegate>,
9606    _additional_params: HashMap<String, String>,
9607    _scopes: BTreeSet<String>,
9608}
9609
9610impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
9611
9612impl<'a, C> ProjectLocationOperationGetCall<'a, C>
9613where
9614    C: common::Connector,
9615{
9616    /// Perform the operation you have build so far.
9617    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
9618        use std::borrow::Cow;
9619        use std::io::{Read, Seek};
9620
9621        use common::{url::Params, ToParts};
9622        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9623
9624        let mut dd = common::DefaultDelegate;
9625        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9626        dlg.begin(common::MethodInfo {
9627            id: "run.projects.locations.operations.get",
9628            http_method: hyper::Method::GET,
9629        });
9630
9631        for &field in ["alt", "name"].iter() {
9632            if self._additional_params.contains_key(field) {
9633                dlg.finished(false);
9634                return Err(common::Error::FieldClash(field));
9635            }
9636        }
9637
9638        let mut params = Params::with_capacity(3 + self._additional_params.len());
9639        params.push("name", self._name);
9640
9641        params.extend(self._additional_params.iter());
9642
9643        params.push("alt", "json");
9644        let mut url = self.hub._base_url.clone() + "v2/{+name}";
9645        if self._scopes.is_empty() {
9646            self._scopes
9647                .insert(Scope::CloudPlatform.as_ref().to_string());
9648        }
9649
9650        #[allow(clippy::single_element_loop)]
9651        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9652            url = params.uri_replacement(url, param_name, find_this, true);
9653        }
9654        {
9655            let to_remove = ["name"];
9656            params.remove_params(&to_remove);
9657        }
9658
9659        let url = params.parse_with_url(&url);
9660
9661        loop {
9662            let token = match self
9663                .hub
9664                .auth
9665                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9666                .await
9667            {
9668                Ok(token) => token,
9669                Err(e) => match dlg.token(e) {
9670                    Ok(token) => token,
9671                    Err(e) => {
9672                        dlg.finished(false);
9673                        return Err(common::Error::MissingToken(e));
9674                    }
9675                },
9676            };
9677            let mut req_result = {
9678                let client = &self.hub.client;
9679                dlg.pre_request();
9680                let mut req_builder = hyper::Request::builder()
9681                    .method(hyper::Method::GET)
9682                    .uri(url.as_str())
9683                    .header(USER_AGENT, self.hub._user_agent.clone());
9684
9685                if let Some(token) = token.as_ref() {
9686                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9687                }
9688
9689                let request = req_builder
9690                    .header(CONTENT_LENGTH, 0_u64)
9691                    .body(common::to_body::<String>(None));
9692
9693                client.request(request.unwrap()).await
9694            };
9695
9696            match req_result {
9697                Err(err) => {
9698                    if let common::Retry::After(d) = dlg.http_error(&err) {
9699                        sleep(d).await;
9700                        continue;
9701                    }
9702                    dlg.finished(false);
9703                    return Err(common::Error::HttpError(err));
9704                }
9705                Ok(res) => {
9706                    let (mut parts, body) = res.into_parts();
9707                    let mut body = common::Body::new(body);
9708                    if !parts.status.is_success() {
9709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9710                        let error = serde_json::from_str(&common::to_string(&bytes));
9711                        let response = common::to_response(parts, bytes.into());
9712
9713                        if let common::Retry::After(d) =
9714                            dlg.http_failure(&response, error.as_ref().ok())
9715                        {
9716                            sleep(d).await;
9717                            continue;
9718                        }
9719
9720                        dlg.finished(false);
9721
9722                        return Err(match error {
9723                            Ok(value) => common::Error::BadRequest(value),
9724                            _ => common::Error::Failure(response),
9725                        });
9726                    }
9727                    let response = {
9728                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9729                        let encoded = common::to_string(&bytes);
9730                        match serde_json::from_str(&encoded) {
9731                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9732                            Err(error) => {
9733                                dlg.response_json_decode_error(&encoded, &error);
9734                                return Err(common::Error::JsonDecodeError(
9735                                    encoded.to_string(),
9736                                    error,
9737                                ));
9738                            }
9739                        }
9740                    };
9741
9742                    dlg.finished(true);
9743                    return Ok(response);
9744                }
9745            }
9746        }
9747    }
9748
9749    /// The name of the operation resource.
9750    ///
9751    /// Sets the *name* path property to the given value.
9752    ///
9753    /// Even though the property as already been set when instantiating this call,
9754    /// we provide this method for API completeness.
9755    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
9756        self._name = new_value.to_string();
9757        self
9758    }
9759    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9760    /// while executing the actual API request.
9761    ///
9762    /// ````text
9763    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9764    /// ````
9765    ///
9766    /// Sets the *delegate* property to the given value.
9767    pub fn delegate(
9768        mut self,
9769        new_value: &'a mut dyn common::Delegate,
9770    ) -> ProjectLocationOperationGetCall<'a, C> {
9771        self._delegate = Some(new_value);
9772        self
9773    }
9774
9775    /// Set any additional parameter of the query string used in the request.
9776    /// It should be used to set parameters which are not yet available through their own
9777    /// setters.
9778    ///
9779    /// Please note that this method must not be used to set any of the known parameters
9780    /// which have their own setter method. If done anyway, the request will fail.
9781    ///
9782    /// # Additional Parameters
9783    ///
9784    /// * *$.xgafv* (query-string) - V1 error format.
9785    /// * *access_token* (query-string) - OAuth access token.
9786    /// * *alt* (query-string) - Data format for response.
9787    /// * *callback* (query-string) - JSONP
9788    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9789    /// * *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.
9790    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9791    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9792    /// * *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.
9793    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9794    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9795    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
9796    where
9797        T: AsRef<str>,
9798    {
9799        self._additional_params
9800            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9801        self
9802    }
9803
9804    /// Identifies the authorization scope for the method you are building.
9805    ///
9806    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9807    /// [`Scope::CloudPlatform`].
9808    ///
9809    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9810    /// tokens for more than one scope.
9811    ///
9812    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9813    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9814    /// sufficient, a read-write scope will do as well.
9815    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
9816    where
9817        St: AsRef<str>,
9818    {
9819        self._scopes.insert(String::from(scope.as_ref()));
9820        self
9821    }
9822    /// Identifies the authorization scope(s) for the method you are building.
9823    ///
9824    /// See [`Self::add_scope()`] for details.
9825    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
9826    where
9827        I: IntoIterator<Item = St>,
9828        St: AsRef<str>,
9829    {
9830        self._scopes
9831            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9832        self
9833    }
9834
9835    /// Removes all scopes, and no default scope will be used either.
9836    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9837    /// for details).
9838    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
9839        self._scopes.clear();
9840        self
9841    }
9842}
9843
9844/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
9845///
9846/// A builder for the *locations.operations.list* method supported by a *project* resource.
9847/// It is not used directly, but through a [`ProjectMethods`] instance.
9848///
9849/// # Example
9850///
9851/// Instantiate a resource method builder
9852///
9853/// ```test_harness,no_run
9854/// # extern crate hyper;
9855/// # extern crate hyper_rustls;
9856/// # extern crate google_run2 as run2;
9857/// # async fn dox() {
9858/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9859///
9860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9861/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9862/// #     .with_native_roots()
9863/// #     .unwrap()
9864/// #     .https_only()
9865/// #     .enable_http2()
9866/// #     .build();
9867///
9868/// # let executor = hyper_util::rt::TokioExecutor::new();
9869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9870/// #     secret,
9871/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9872/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9873/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9874/// #     ),
9875/// # ).build().await.unwrap();
9876///
9877/// # let client = hyper_util::client::legacy::Client::builder(
9878/// #     hyper_util::rt::TokioExecutor::new()
9879/// # )
9880/// # .build(
9881/// #     hyper_rustls::HttpsConnectorBuilder::new()
9882/// #         .with_native_roots()
9883/// #         .unwrap()
9884/// #         .https_or_http()
9885/// #         .enable_http2()
9886/// #         .build()
9887/// # );
9888/// # let mut hub = CloudRun::new(client, auth);
9889/// // You can configure optional parameters by calling the respective setters at will, and
9890/// // execute the final call using `doit()`.
9891/// // Values shown here are possibly random and not representative !
9892/// let result = hub.projects().locations_operations_list("name")
9893///              .return_partial_success(true)
9894///              .page_token("Lorem")
9895///              .page_size(-29)
9896///              .filter("no")
9897///              .doit().await;
9898/// # }
9899/// ```
9900pub struct ProjectLocationOperationListCall<'a, C>
9901where
9902    C: 'a,
9903{
9904    hub: &'a CloudRun<C>,
9905    _name: String,
9906    _return_partial_success: Option<bool>,
9907    _page_token: Option<String>,
9908    _page_size: Option<i32>,
9909    _filter: Option<String>,
9910    _delegate: Option<&'a mut dyn common::Delegate>,
9911    _additional_params: HashMap<String, String>,
9912    _scopes: BTreeSet<String>,
9913}
9914
9915impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
9916
9917impl<'a, C> ProjectLocationOperationListCall<'a, C>
9918where
9919    C: common::Connector,
9920{
9921    /// Perform the operation you have build so far.
9922    pub async fn doit(
9923        mut self,
9924    ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
9925        use std::borrow::Cow;
9926        use std::io::{Read, Seek};
9927
9928        use common::{url::Params, ToParts};
9929        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9930
9931        let mut dd = common::DefaultDelegate;
9932        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9933        dlg.begin(common::MethodInfo {
9934            id: "run.projects.locations.operations.list",
9935            http_method: hyper::Method::GET,
9936        });
9937
9938        for &field in [
9939            "alt",
9940            "name",
9941            "returnPartialSuccess",
9942            "pageToken",
9943            "pageSize",
9944            "filter",
9945        ]
9946        .iter()
9947        {
9948            if self._additional_params.contains_key(field) {
9949                dlg.finished(false);
9950                return Err(common::Error::FieldClash(field));
9951            }
9952        }
9953
9954        let mut params = Params::with_capacity(7 + self._additional_params.len());
9955        params.push("name", self._name);
9956        if let Some(value) = self._return_partial_success.as_ref() {
9957            params.push("returnPartialSuccess", value.to_string());
9958        }
9959        if let Some(value) = self._page_token.as_ref() {
9960            params.push("pageToken", value);
9961        }
9962        if let Some(value) = self._page_size.as_ref() {
9963            params.push("pageSize", value.to_string());
9964        }
9965        if let Some(value) = self._filter.as_ref() {
9966            params.push("filter", value);
9967        }
9968
9969        params.extend(self._additional_params.iter());
9970
9971        params.push("alt", "json");
9972        let mut url = self.hub._base_url.clone() + "v2/{+name}/operations";
9973        if self._scopes.is_empty() {
9974            self._scopes
9975                .insert(Scope::CloudPlatform.as_ref().to_string());
9976        }
9977
9978        #[allow(clippy::single_element_loop)]
9979        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9980            url = params.uri_replacement(url, param_name, find_this, true);
9981        }
9982        {
9983            let to_remove = ["name"];
9984            params.remove_params(&to_remove);
9985        }
9986
9987        let url = params.parse_with_url(&url);
9988
9989        loop {
9990            let token = match self
9991                .hub
9992                .auth
9993                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9994                .await
9995            {
9996                Ok(token) => token,
9997                Err(e) => match dlg.token(e) {
9998                    Ok(token) => token,
9999                    Err(e) => {
10000                        dlg.finished(false);
10001                        return Err(common::Error::MissingToken(e));
10002                    }
10003                },
10004            };
10005            let mut req_result = {
10006                let client = &self.hub.client;
10007                dlg.pre_request();
10008                let mut req_builder = hyper::Request::builder()
10009                    .method(hyper::Method::GET)
10010                    .uri(url.as_str())
10011                    .header(USER_AGENT, self.hub._user_agent.clone());
10012
10013                if let Some(token) = token.as_ref() {
10014                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10015                }
10016
10017                let request = req_builder
10018                    .header(CONTENT_LENGTH, 0_u64)
10019                    .body(common::to_body::<String>(None));
10020
10021                client.request(request.unwrap()).await
10022            };
10023
10024            match req_result {
10025                Err(err) => {
10026                    if let common::Retry::After(d) = dlg.http_error(&err) {
10027                        sleep(d).await;
10028                        continue;
10029                    }
10030                    dlg.finished(false);
10031                    return Err(common::Error::HttpError(err));
10032                }
10033                Ok(res) => {
10034                    let (mut parts, body) = res.into_parts();
10035                    let mut body = common::Body::new(body);
10036                    if !parts.status.is_success() {
10037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10038                        let error = serde_json::from_str(&common::to_string(&bytes));
10039                        let response = common::to_response(parts, bytes.into());
10040
10041                        if let common::Retry::After(d) =
10042                            dlg.http_failure(&response, error.as_ref().ok())
10043                        {
10044                            sleep(d).await;
10045                            continue;
10046                        }
10047
10048                        dlg.finished(false);
10049
10050                        return Err(match error {
10051                            Ok(value) => common::Error::BadRequest(value),
10052                            _ => common::Error::Failure(response),
10053                        });
10054                    }
10055                    let response = {
10056                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10057                        let encoded = common::to_string(&bytes);
10058                        match serde_json::from_str(&encoded) {
10059                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10060                            Err(error) => {
10061                                dlg.response_json_decode_error(&encoded, &error);
10062                                return Err(common::Error::JsonDecodeError(
10063                                    encoded.to_string(),
10064                                    error,
10065                                ));
10066                            }
10067                        }
10068                    };
10069
10070                    dlg.finished(true);
10071                    return Ok(response);
10072                }
10073            }
10074        }
10075    }
10076
10077    /// Required. To query for all of the operations for a project.
10078    ///
10079    /// Sets the *name* path property to the given value.
10080    ///
10081    /// Even though the property as already been set when instantiating this call,
10082    /// we provide this method for API completeness.
10083    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10084        self._name = new_value.to_string();
10085        self
10086    }
10087    /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
10088    ///
10089    /// Sets the *return partial success* query property to the given value.
10090    pub fn return_partial_success(
10091        mut self,
10092        new_value: bool,
10093    ) -> ProjectLocationOperationListCall<'a, C> {
10094        self._return_partial_success = Some(new_value);
10095        self
10096    }
10097    /// Token identifying which result to start with, which is returned by a previous list call.
10098    ///
10099    /// Sets the *page token* query property to the given value.
10100    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10101        self._page_token = Some(new_value.to_string());
10102        self
10103    }
10104    /// The maximum number of records that should be returned. Requested page size cannot exceed 100. If not set or set to less than or equal to 0, the default page size is 100. .
10105    ///
10106    /// Sets the *page size* query property to the given value.
10107    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
10108        self._page_size = Some(new_value);
10109        self
10110    }
10111    /// Optional. A filter for matching the completed or in-progress operations. The supported formats of *filter* are: To query for only completed operations: done:true To query for only ongoing operations: done:false Must be empty to query for all of the latest operations for the given parent project.
10112    ///
10113    /// Sets the *filter* query property to the given value.
10114    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10115        self._filter = Some(new_value.to_string());
10116        self
10117    }
10118    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10119    /// while executing the actual API request.
10120    ///
10121    /// ````text
10122    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10123    /// ````
10124    ///
10125    /// Sets the *delegate* property to the given value.
10126    pub fn delegate(
10127        mut self,
10128        new_value: &'a mut dyn common::Delegate,
10129    ) -> ProjectLocationOperationListCall<'a, C> {
10130        self._delegate = Some(new_value);
10131        self
10132    }
10133
10134    /// Set any additional parameter of the query string used in the request.
10135    /// It should be used to set parameters which are not yet available through their own
10136    /// setters.
10137    ///
10138    /// Please note that this method must not be used to set any of the known parameters
10139    /// which have their own setter method. If done anyway, the request will fail.
10140    ///
10141    /// # Additional Parameters
10142    ///
10143    /// * *$.xgafv* (query-string) - V1 error format.
10144    /// * *access_token* (query-string) - OAuth access token.
10145    /// * *alt* (query-string) - Data format for response.
10146    /// * *callback* (query-string) - JSONP
10147    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10148    /// * *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.
10149    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10150    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10151    /// * *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.
10152    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10153    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10154    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
10155    where
10156        T: AsRef<str>,
10157    {
10158        self._additional_params
10159            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10160        self
10161    }
10162
10163    /// Identifies the authorization scope for the method you are building.
10164    ///
10165    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10166    /// [`Scope::CloudPlatform`].
10167    ///
10168    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10169    /// tokens for more than one scope.
10170    ///
10171    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10172    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10173    /// sufficient, a read-write scope will do as well.
10174    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
10175    where
10176        St: AsRef<str>,
10177    {
10178        self._scopes.insert(String::from(scope.as_ref()));
10179        self
10180    }
10181    /// Identifies the authorization scope(s) for the method you are building.
10182    ///
10183    /// See [`Self::add_scope()`] for details.
10184    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
10185    where
10186        I: IntoIterator<Item = St>,
10187        St: AsRef<str>,
10188    {
10189        self._scopes
10190            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10191        self
10192    }
10193
10194    /// Removes all scopes, and no default scope will be used either.
10195    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10196    /// for details).
10197    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
10198        self._scopes.clear();
10199        self
10200    }
10201}
10202
10203/// Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
10204///
10205/// A builder for the *locations.operations.wait* method supported by a *project* resource.
10206/// It is not used directly, but through a [`ProjectMethods`] instance.
10207///
10208/// # Example
10209///
10210/// Instantiate a resource method builder
10211///
10212/// ```test_harness,no_run
10213/// # extern crate hyper;
10214/// # extern crate hyper_rustls;
10215/// # extern crate google_run2 as run2;
10216/// use run2::api::GoogleLongrunningWaitOperationRequest;
10217/// # async fn dox() {
10218/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10219///
10220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10221/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10222/// #     .with_native_roots()
10223/// #     .unwrap()
10224/// #     .https_only()
10225/// #     .enable_http2()
10226/// #     .build();
10227///
10228/// # let executor = hyper_util::rt::TokioExecutor::new();
10229/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10230/// #     secret,
10231/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10232/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10233/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10234/// #     ),
10235/// # ).build().await.unwrap();
10236///
10237/// # let client = hyper_util::client::legacy::Client::builder(
10238/// #     hyper_util::rt::TokioExecutor::new()
10239/// # )
10240/// # .build(
10241/// #     hyper_rustls::HttpsConnectorBuilder::new()
10242/// #         .with_native_roots()
10243/// #         .unwrap()
10244/// #         .https_or_http()
10245/// #         .enable_http2()
10246/// #         .build()
10247/// # );
10248/// # let mut hub = CloudRun::new(client, auth);
10249/// // As the method needs a request, you would usually fill it with the desired information
10250/// // into the respective structure. Some of the parts shown here might not be applicable !
10251/// // Values shown here are possibly random and not representative !
10252/// let mut req = GoogleLongrunningWaitOperationRequest::default();
10253///
10254/// // You can configure optional parameters by calling the respective setters at will, and
10255/// // execute the final call using `doit()`.
10256/// // Values shown here are possibly random and not representative !
10257/// let result = hub.projects().locations_operations_wait(req, "name")
10258///              .doit().await;
10259/// # }
10260/// ```
10261pub struct ProjectLocationOperationWaitCall<'a, C>
10262where
10263    C: 'a,
10264{
10265    hub: &'a CloudRun<C>,
10266    _request: GoogleLongrunningWaitOperationRequest,
10267    _name: String,
10268    _delegate: Option<&'a mut dyn common::Delegate>,
10269    _additional_params: HashMap<String, String>,
10270    _scopes: BTreeSet<String>,
10271}
10272
10273impl<'a, C> common::CallBuilder for ProjectLocationOperationWaitCall<'a, C> {}
10274
10275impl<'a, C> ProjectLocationOperationWaitCall<'a, C>
10276where
10277    C: common::Connector,
10278{
10279    /// Perform the operation you have build so far.
10280    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
10281        use std::borrow::Cow;
10282        use std::io::{Read, Seek};
10283
10284        use common::{url::Params, ToParts};
10285        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10286
10287        let mut dd = common::DefaultDelegate;
10288        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10289        dlg.begin(common::MethodInfo {
10290            id: "run.projects.locations.operations.wait",
10291            http_method: hyper::Method::POST,
10292        });
10293
10294        for &field in ["alt", "name"].iter() {
10295            if self._additional_params.contains_key(field) {
10296                dlg.finished(false);
10297                return Err(common::Error::FieldClash(field));
10298            }
10299        }
10300
10301        let mut params = Params::with_capacity(4 + self._additional_params.len());
10302        params.push("name", self._name);
10303
10304        params.extend(self._additional_params.iter());
10305
10306        params.push("alt", "json");
10307        let mut url = self.hub._base_url.clone() + "v2/{+name}:wait";
10308        if self._scopes.is_empty() {
10309            self._scopes
10310                .insert(Scope::CloudPlatform.as_ref().to_string());
10311        }
10312
10313        #[allow(clippy::single_element_loop)]
10314        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10315            url = params.uri_replacement(url, param_name, find_this, true);
10316        }
10317        {
10318            let to_remove = ["name"];
10319            params.remove_params(&to_remove);
10320        }
10321
10322        let url = params.parse_with_url(&url);
10323
10324        let mut json_mime_type = mime::APPLICATION_JSON;
10325        let mut request_value_reader = {
10326            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10327            common::remove_json_null_values(&mut value);
10328            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10329            serde_json::to_writer(&mut dst, &value).unwrap();
10330            dst
10331        };
10332        let request_size = request_value_reader
10333            .seek(std::io::SeekFrom::End(0))
10334            .unwrap();
10335        request_value_reader
10336            .seek(std::io::SeekFrom::Start(0))
10337            .unwrap();
10338
10339        loop {
10340            let token = match self
10341                .hub
10342                .auth
10343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10344                .await
10345            {
10346                Ok(token) => token,
10347                Err(e) => match dlg.token(e) {
10348                    Ok(token) => token,
10349                    Err(e) => {
10350                        dlg.finished(false);
10351                        return Err(common::Error::MissingToken(e));
10352                    }
10353                },
10354            };
10355            request_value_reader
10356                .seek(std::io::SeekFrom::Start(0))
10357                .unwrap();
10358            let mut req_result = {
10359                let client = &self.hub.client;
10360                dlg.pre_request();
10361                let mut req_builder = hyper::Request::builder()
10362                    .method(hyper::Method::POST)
10363                    .uri(url.as_str())
10364                    .header(USER_AGENT, self.hub._user_agent.clone());
10365
10366                if let Some(token) = token.as_ref() {
10367                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10368                }
10369
10370                let request = req_builder
10371                    .header(CONTENT_TYPE, json_mime_type.to_string())
10372                    .header(CONTENT_LENGTH, request_size as u64)
10373                    .body(common::to_body(
10374                        request_value_reader.get_ref().clone().into(),
10375                    ));
10376
10377                client.request(request.unwrap()).await
10378            };
10379
10380            match req_result {
10381                Err(err) => {
10382                    if let common::Retry::After(d) = dlg.http_error(&err) {
10383                        sleep(d).await;
10384                        continue;
10385                    }
10386                    dlg.finished(false);
10387                    return Err(common::Error::HttpError(err));
10388                }
10389                Ok(res) => {
10390                    let (mut parts, body) = res.into_parts();
10391                    let mut body = common::Body::new(body);
10392                    if !parts.status.is_success() {
10393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10394                        let error = serde_json::from_str(&common::to_string(&bytes));
10395                        let response = common::to_response(parts, bytes.into());
10396
10397                        if let common::Retry::After(d) =
10398                            dlg.http_failure(&response, error.as_ref().ok())
10399                        {
10400                            sleep(d).await;
10401                            continue;
10402                        }
10403
10404                        dlg.finished(false);
10405
10406                        return Err(match error {
10407                            Ok(value) => common::Error::BadRequest(value),
10408                            _ => common::Error::Failure(response),
10409                        });
10410                    }
10411                    let response = {
10412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10413                        let encoded = common::to_string(&bytes);
10414                        match serde_json::from_str(&encoded) {
10415                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10416                            Err(error) => {
10417                                dlg.response_json_decode_error(&encoded, &error);
10418                                return Err(common::Error::JsonDecodeError(
10419                                    encoded.to_string(),
10420                                    error,
10421                                ));
10422                            }
10423                        }
10424                    };
10425
10426                    dlg.finished(true);
10427                    return Ok(response);
10428                }
10429            }
10430        }
10431    }
10432
10433    ///
10434    /// Sets the *request* property to the given value.
10435    ///
10436    /// Even though the property as already been set when instantiating this call,
10437    /// we provide this method for API completeness.
10438    pub fn request(
10439        mut self,
10440        new_value: GoogleLongrunningWaitOperationRequest,
10441    ) -> ProjectLocationOperationWaitCall<'a, C> {
10442        self._request = new_value;
10443        self
10444    }
10445    /// The name of the operation resource to wait on.
10446    ///
10447    /// Sets the *name* path property to the given value.
10448    ///
10449    /// Even though the property as already been set when instantiating this call,
10450    /// we provide this method for API completeness.
10451    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationWaitCall<'a, C> {
10452        self._name = new_value.to_string();
10453        self
10454    }
10455    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10456    /// while executing the actual API request.
10457    ///
10458    /// ````text
10459    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10460    /// ````
10461    ///
10462    /// Sets the *delegate* property to the given value.
10463    pub fn delegate(
10464        mut self,
10465        new_value: &'a mut dyn common::Delegate,
10466    ) -> ProjectLocationOperationWaitCall<'a, C> {
10467        self._delegate = Some(new_value);
10468        self
10469    }
10470
10471    /// Set any additional parameter of the query string used in the request.
10472    /// It should be used to set parameters which are not yet available through their own
10473    /// setters.
10474    ///
10475    /// Please note that this method must not be used to set any of the known parameters
10476    /// which have their own setter method. If done anyway, the request will fail.
10477    ///
10478    /// # Additional Parameters
10479    ///
10480    /// * *$.xgafv* (query-string) - V1 error format.
10481    /// * *access_token* (query-string) - OAuth access token.
10482    /// * *alt* (query-string) - Data format for response.
10483    /// * *callback* (query-string) - JSONP
10484    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10485    /// * *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.
10486    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10487    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10488    /// * *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.
10489    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10490    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10491    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationWaitCall<'a, C>
10492    where
10493        T: AsRef<str>,
10494    {
10495        self._additional_params
10496            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10497        self
10498    }
10499
10500    /// Identifies the authorization scope for the method you are building.
10501    ///
10502    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10503    /// [`Scope::CloudPlatform`].
10504    ///
10505    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10506    /// tokens for more than one scope.
10507    ///
10508    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10509    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10510    /// sufficient, a read-write scope will do as well.
10511    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationWaitCall<'a, C>
10512    where
10513        St: AsRef<str>,
10514    {
10515        self._scopes.insert(String::from(scope.as_ref()));
10516        self
10517    }
10518    /// Identifies the authorization scope(s) for the method you are building.
10519    ///
10520    /// See [`Self::add_scope()`] for details.
10521    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationWaitCall<'a, C>
10522    where
10523        I: IntoIterator<Item = St>,
10524        St: AsRef<str>,
10525    {
10526        self._scopes
10527            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10528        self
10529    }
10530
10531    /// Removes all scopes, and no default scope will be used either.
10532    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10533    /// for details).
10534    pub fn clear_scopes(mut self) -> ProjectLocationOperationWaitCall<'a, C> {
10535        self._scopes.clear();
10536        self
10537    }
10538}
10539
10540/// Deletes a Revision.
10541///
10542/// A builder for the *locations.services.revisions.delete* method supported by a *project* resource.
10543/// It is not used directly, but through a [`ProjectMethods`] instance.
10544///
10545/// # Example
10546///
10547/// Instantiate a resource method builder
10548///
10549/// ```test_harness,no_run
10550/// # extern crate hyper;
10551/// # extern crate hyper_rustls;
10552/// # extern crate google_run2 as run2;
10553/// # async fn dox() {
10554/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10555///
10556/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10557/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10558/// #     .with_native_roots()
10559/// #     .unwrap()
10560/// #     .https_only()
10561/// #     .enable_http2()
10562/// #     .build();
10563///
10564/// # let executor = hyper_util::rt::TokioExecutor::new();
10565/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10566/// #     secret,
10567/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10568/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10569/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10570/// #     ),
10571/// # ).build().await.unwrap();
10572///
10573/// # let client = hyper_util::client::legacy::Client::builder(
10574/// #     hyper_util::rt::TokioExecutor::new()
10575/// # )
10576/// # .build(
10577/// #     hyper_rustls::HttpsConnectorBuilder::new()
10578/// #         .with_native_roots()
10579/// #         .unwrap()
10580/// #         .https_or_http()
10581/// #         .enable_http2()
10582/// #         .build()
10583/// # );
10584/// # let mut hub = CloudRun::new(client, auth);
10585/// // You can configure optional parameters by calling the respective setters at will, and
10586/// // execute the final call using `doit()`.
10587/// // Values shown here are possibly random and not representative !
10588/// let result = hub.projects().locations_services_revisions_delete("name")
10589///              .validate_only(true)
10590///              .etag("consetetur")
10591///              .doit().await;
10592/// # }
10593/// ```
10594pub struct ProjectLocationServiceRevisionDeleteCall<'a, C>
10595where
10596    C: 'a,
10597{
10598    hub: &'a CloudRun<C>,
10599    _name: String,
10600    _validate_only: Option<bool>,
10601    _etag: Option<String>,
10602    _delegate: Option<&'a mut dyn common::Delegate>,
10603    _additional_params: HashMap<String, String>,
10604    _scopes: BTreeSet<String>,
10605}
10606
10607impl<'a, C> common::CallBuilder for ProjectLocationServiceRevisionDeleteCall<'a, C> {}
10608
10609impl<'a, C> ProjectLocationServiceRevisionDeleteCall<'a, C>
10610where
10611    C: common::Connector,
10612{
10613    /// Perform the operation you have build so far.
10614    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
10615        use std::borrow::Cow;
10616        use std::io::{Read, Seek};
10617
10618        use common::{url::Params, ToParts};
10619        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10620
10621        let mut dd = common::DefaultDelegate;
10622        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10623        dlg.begin(common::MethodInfo {
10624            id: "run.projects.locations.services.revisions.delete",
10625            http_method: hyper::Method::DELETE,
10626        });
10627
10628        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
10629            if self._additional_params.contains_key(field) {
10630                dlg.finished(false);
10631                return Err(common::Error::FieldClash(field));
10632            }
10633        }
10634
10635        let mut params = Params::with_capacity(5 + self._additional_params.len());
10636        params.push("name", self._name);
10637        if let Some(value) = self._validate_only.as_ref() {
10638            params.push("validateOnly", value.to_string());
10639        }
10640        if let Some(value) = self._etag.as_ref() {
10641            params.push("etag", value);
10642        }
10643
10644        params.extend(self._additional_params.iter());
10645
10646        params.push("alt", "json");
10647        let mut url = self.hub._base_url.clone() + "v2/{+name}";
10648        if self._scopes.is_empty() {
10649            self._scopes
10650                .insert(Scope::CloudPlatform.as_ref().to_string());
10651        }
10652
10653        #[allow(clippy::single_element_loop)]
10654        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10655            url = params.uri_replacement(url, param_name, find_this, true);
10656        }
10657        {
10658            let to_remove = ["name"];
10659            params.remove_params(&to_remove);
10660        }
10661
10662        let url = params.parse_with_url(&url);
10663
10664        loop {
10665            let token = match self
10666                .hub
10667                .auth
10668                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10669                .await
10670            {
10671                Ok(token) => token,
10672                Err(e) => match dlg.token(e) {
10673                    Ok(token) => token,
10674                    Err(e) => {
10675                        dlg.finished(false);
10676                        return Err(common::Error::MissingToken(e));
10677                    }
10678                },
10679            };
10680            let mut req_result = {
10681                let client = &self.hub.client;
10682                dlg.pre_request();
10683                let mut req_builder = hyper::Request::builder()
10684                    .method(hyper::Method::DELETE)
10685                    .uri(url.as_str())
10686                    .header(USER_AGENT, self.hub._user_agent.clone());
10687
10688                if let Some(token) = token.as_ref() {
10689                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10690                }
10691
10692                let request = req_builder
10693                    .header(CONTENT_LENGTH, 0_u64)
10694                    .body(common::to_body::<String>(None));
10695
10696                client.request(request.unwrap()).await
10697            };
10698
10699            match req_result {
10700                Err(err) => {
10701                    if let common::Retry::After(d) = dlg.http_error(&err) {
10702                        sleep(d).await;
10703                        continue;
10704                    }
10705                    dlg.finished(false);
10706                    return Err(common::Error::HttpError(err));
10707                }
10708                Ok(res) => {
10709                    let (mut parts, body) = res.into_parts();
10710                    let mut body = common::Body::new(body);
10711                    if !parts.status.is_success() {
10712                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10713                        let error = serde_json::from_str(&common::to_string(&bytes));
10714                        let response = common::to_response(parts, bytes.into());
10715
10716                        if let common::Retry::After(d) =
10717                            dlg.http_failure(&response, error.as_ref().ok())
10718                        {
10719                            sleep(d).await;
10720                            continue;
10721                        }
10722
10723                        dlg.finished(false);
10724
10725                        return Err(match error {
10726                            Ok(value) => common::Error::BadRequest(value),
10727                            _ => common::Error::Failure(response),
10728                        });
10729                    }
10730                    let response = {
10731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10732                        let encoded = common::to_string(&bytes);
10733                        match serde_json::from_str(&encoded) {
10734                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10735                            Err(error) => {
10736                                dlg.response_json_decode_error(&encoded, &error);
10737                                return Err(common::Error::JsonDecodeError(
10738                                    encoded.to_string(),
10739                                    error,
10740                                ));
10741                            }
10742                        }
10743                    };
10744
10745                    dlg.finished(true);
10746                    return Ok(response);
10747                }
10748            }
10749        }
10750    }
10751
10752    /// Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
10753    ///
10754    /// Sets the *name* path property to the given value.
10755    ///
10756    /// Even though the property as already been set when instantiating this call,
10757    /// we provide this method for API completeness.
10758    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
10759        self._name = new_value.to_string();
10760        self
10761    }
10762    /// Indicates that the request should be validated without actually deleting any resources.
10763    ///
10764    /// Sets the *validate only* query property to the given value.
10765    pub fn validate_only(
10766        mut self,
10767        new_value: bool,
10768    ) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
10769        self._validate_only = Some(new_value);
10770        self
10771    }
10772    /// A system-generated fingerprint for this version of the resource. This may be used to detect modification conflict during updates.
10773    ///
10774    /// Sets the *etag* query property to the given value.
10775    pub fn etag(mut self, new_value: &str) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
10776        self._etag = Some(new_value.to_string());
10777        self
10778    }
10779    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10780    /// while executing the actual API request.
10781    ///
10782    /// ````text
10783    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10784    /// ````
10785    ///
10786    /// Sets the *delegate* property to the given value.
10787    pub fn delegate(
10788        mut self,
10789        new_value: &'a mut dyn common::Delegate,
10790    ) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
10791        self._delegate = Some(new_value);
10792        self
10793    }
10794
10795    /// Set any additional parameter of the query string used in the request.
10796    /// It should be used to set parameters which are not yet available through their own
10797    /// setters.
10798    ///
10799    /// Please note that this method must not be used to set any of the known parameters
10800    /// which have their own setter method. If done anyway, the request will fail.
10801    ///
10802    /// # Additional Parameters
10803    ///
10804    /// * *$.xgafv* (query-string) - V1 error format.
10805    /// * *access_token* (query-string) - OAuth access token.
10806    /// * *alt* (query-string) - Data format for response.
10807    /// * *callback* (query-string) - JSONP
10808    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10809    /// * *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.
10810    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10811    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10812    /// * *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.
10813    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10814    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10815    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceRevisionDeleteCall<'a, C>
10816    where
10817        T: AsRef<str>,
10818    {
10819        self._additional_params
10820            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10821        self
10822    }
10823
10824    /// Identifies the authorization scope for the method you are building.
10825    ///
10826    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10827    /// [`Scope::CloudPlatform`].
10828    ///
10829    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10830    /// tokens for more than one scope.
10831    ///
10832    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10833    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10834    /// sufficient, a read-write scope will do as well.
10835    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceRevisionDeleteCall<'a, C>
10836    where
10837        St: AsRef<str>,
10838    {
10839        self._scopes.insert(String::from(scope.as_ref()));
10840        self
10841    }
10842    /// Identifies the authorization scope(s) for the method you are building.
10843    ///
10844    /// See [`Self::add_scope()`] for details.
10845    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceRevisionDeleteCall<'a, C>
10846    where
10847        I: IntoIterator<Item = St>,
10848        St: AsRef<str>,
10849    {
10850        self._scopes
10851            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10852        self
10853    }
10854
10855    /// Removes all scopes, and no default scope will be used either.
10856    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10857    /// for details).
10858    pub fn clear_scopes(mut self) -> ProjectLocationServiceRevisionDeleteCall<'a, C> {
10859        self._scopes.clear();
10860        self
10861    }
10862}
10863
10864/// Read the status of an image export operation.
10865///
10866/// A builder for the *locations.services.revisions.exportStatus* method supported by a *project* resource.
10867/// It is not used directly, but through a [`ProjectMethods`] instance.
10868///
10869/// # Example
10870///
10871/// Instantiate a resource method builder
10872///
10873/// ```test_harness,no_run
10874/// # extern crate hyper;
10875/// # extern crate hyper_rustls;
10876/// # extern crate google_run2 as run2;
10877/// # async fn dox() {
10878/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10879///
10880/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10881/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10882/// #     .with_native_roots()
10883/// #     .unwrap()
10884/// #     .https_only()
10885/// #     .enable_http2()
10886/// #     .build();
10887///
10888/// # let executor = hyper_util::rt::TokioExecutor::new();
10889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10890/// #     secret,
10891/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10892/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10893/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10894/// #     ),
10895/// # ).build().await.unwrap();
10896///
10897/// # let client = hyper_util::client::legacy::Client::builder(
10898/// #     hyper_util::rt::TokioExecutor::new()
10899/// # )
10900/// # .build(
10901/// #     hyper_rustls::HttpsConnectorBuilder::new()
10902/// #         .with_native_roots()
10903/// #         .unwrap()
10904/// #         .https_or_http()
10905/// #         .enable_http2()
10906/// #         .build()
10907/// # );
10908/// # let mut hub = CloudRun::new(client, auth);
10909/// // You can configure optional parameters by calling the respective setters at will, and
10910/// // execute the final call using `doit()`.
10911/// // Values shown here are possibly random and not representative !
10912/// let result = hub.projects().locations_services_revisions_export_status("name", "operationId")
10913///              .doit().await;
10914/// # }
10915/// ```
10916pub struct ProjectLocationServiceRevisionExportStatuCall<'a, C>
10917where
10918    C: 'a,
10919{
10920    hub: &'a CloudRun<C>,
10921    _name: String,
10922    _operation_id: String,
10923    _delegate: Option<&'a mut dyn common::Delegate>,
10924    _additional_params: HashMap<String, String>,
10925    _scopes: BTreeSet<String>,
10926}
10927
10928impl<'a, C> common::CallBuilder for ProjectLocationServiceRevisionExportStatuCall<'a, C> {}
10929
10930impl<'a, C> ProjectLocationServiceRevisionExportStatuCall<'a, C>
10931where
10932    C: common::Connector,
10933{
10934    /// Perform the operation you have build so far.
10935    pub async fn doit(
10936        mut self,
10937    ) -> common::Result<(common::Response, GoogleCloudRunV2ExportStatusResponse)> {
10938        use std::borrow::Cow;
10939        use std::io::{Read, Seek};
10940
10941        use common::{url::Params, ToParts};
10942        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10943
10944        let mut dd = common::DefaultDelegate;
10945        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10946        dlg.begin(common::MethodInfo {
10947            id: "run.projects.locations.services.revisions.exportStatus",
10948            http_method: hyper::Method::GET,
10949        });
10950
10951        for &field in ["alt", "name", "operationId"].iter() {
10952            if self._additional_params.contains_key(field) {
10953                dlg.finished(false);
10954                return Err(common::Error::FieldClash(field));
10955            }
10956        }
10957
10958        let mut params = Params::with_capacity(4 + self._additional_params.len());
10959        params.push("name", self._name);
10960        params.push("operationId", self._operation_id);
10961
10962        params.extend(self._additional_params.iter());
10963
10964        params.push("alt", "json");
10965        let mut url = self.hub._base_url.clone() + "v2/{+name}/{+operationId}:exportStatus";
10966        if self._scopes.is_empty() {
10967            self._scopes
10968                .insert(Scope::CloudPlatform.as_ref().to_string());
10969        }
10970
10971        #[allow(clippy::single_element_loop)]
10972        for &(find_this, param_name) in
10973            [("{+name}", "name"), ("{+operationId}", "operationId")].iter()
10974        {
10975            url = params.uri_replacement(url, param_name, find_this, true);
10976        }
10977        {
10978            let to_remove = ["operationId", "name"];
10979            params.remove_params(&to_remove);
10980        }
10981
10982        let url = params.parse_with_url(&url);
10983
10984        loop {
10985            let token = match self
10986                .hub
10987                .auth
10988                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10989                .await
10990            {
10991                Ok(token) => token,
10992                Err(e) => match dlg.token(e) {
10993                    Ok(token) => token,
10994                    Err(e) => {
10995                        dlg.finished(false);
10996                        return Err(common::Error::MissingToken(e));
10997                    }
10998                },
10999            };
11000            let mut req_result = {
11001                let client = &self.hub.client;
11002                dlg.pre_request();
11003                let mut req_builder = hyper::Request::builder()
11004                    .method(hyper::Method::GET)
11005                    .uri(url.as_str())
11006                    .header(USER_AGENT, self.hub._user_agent.clone());
11007
11008                if let Some(token) = token.as_ref() {
11009                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11010                }
11011
11012                let request = req_builder
11013                    .header(CONTENT_LENGTH, 0_u64)
11014                    .body(common::to_body::<String>(None));
11015
11016                client.request(request.unwrap()).await
11017            };
11018
11019            match req_result {
11020                Err(err) => {
11021                    if let common::Retry::After(d) = dlg.http_error(&err) {
11022                        sleep(d).await;
11023                        continue;
11024                    }
11025                    dlg.finished(false);
11026                    return Err(common::Error::HttpError(err));
11027                }
11028                Ok(res) => {
11029                    let (mut parts, body) = res.into_parts();
11030                    let mut body = common::Body::new(body);
11031                    if !parts.status.is_success() {
11032                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11033                        let error = serde_json::from_str(&common::to_string(&bytes));
11034                        let response = common::to_response(parts, bytes.into());
11035
11036                        if let common::Retry::After(d) =
11037                            dlg.http_failure(&response, error.as_ref().ok())
11038                        {
11039                            sleep(d).await;
11040                            continue;
11041                        }
11042
11043                        dlg.finished(false);
11044
11045                        return Err(match error {
11046                            Ok(value) => common::Error::BadRequest(value),
11047                            _ => common::Error::Failure(response),
11048                        });
11049                    }
11050                    let response = {
11051                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11052                        let encoded = common::to_string(&bytes);
11053                        match serde_json::from_str(&encoded) {
11054                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11055                            Err(error) => {
11056                                dlg.response_json_decode_error(&encoded, &error);
11057                                return Err(common::Error::JsonDecodeError(
11058                                    encoded.to_string(),
11059                                    error,
11060                                ));
11061                            }
11062                        }
11063                    };
11064
11065                    dlg.finished(true);
11066                    return Ok(response);
11067                }
11068            }
11069        }
11070    }
11071
11072    /// Required. The name of the resource of which image export operation status has to be fetched. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
11073    ///
11074    /// Sets the *name* path property to the given value.
11075    ///
11076    /// Even though the property as already been set when instantiating this call,
11077    /// we provide this method for API completeness.
11078    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceRevisionExportStatuCall<'a, C> {
11079        self._name = new_value.to_string();
11080        self
11081    }
11082    /// Required. The operation id returned from ExportImage.
11083    ///
11084    /// Sets the *operation id* path property to the given value.
11085    ///
11086    /// Even though the property as already been set when instantiating this call,
11087    /// we provide this method for API completeness.
11088    pub fn operation_id(
11089        mut self,
11090        new_value: &str,
11091    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C> {
11092        self._operation_id = new_value.to_string();
11093        self
11094    }
11095    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11096    /// while executing the actual API request.
11097    ///
11098    /// ````text
11099    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11100    /// ````
11101    ///
11102    /// Sets the *delegate* property to the given value.
11103    pub fn delegate(
11104        mut self,
11105        new_value: &'a mut dyn common::Delegate,
11106    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C> {
11107        self._delegate = Some(new_value);
11108        self
11109    }
11110
11111    /// Set any additional parameter of the query string used in the request.
11112    /// It should be used to set parameters which are not yet available through their own
11113    /// setters.
11114    ///
11115    /// Please note that this method must not be used to set any of the known parameters
11116    /// which have their own setter method. If done anyway, the request will fail.
11117    ///
11118    /// # Additional Parameters
11119    ///
11120    /// * *$.xgafv* (query-string) - V1 error format.
11121    /// * *access_token* (query-string) - OAuth access token.
11122    /// * *alt* (query-string) - Data format for response.
11123    /// * *callback* (query-string) - JSONP
11124    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11125    /// * *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.
11126    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11127    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11128    /// * *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.
11129    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11130    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11131    pub fn param<T>(
11132        mut self,
11133        name: T,
11134        value: T,
11135    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C>
11136    where
11137        T: AsRef<str>,
11138    {
11139        self._additional_params
11140            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11141        self
11142    }
11143
11144    /// Identifies the authorization scope for the method you are building.
11145    ///
11146    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11147    /// [`Scope::CloudPlatform`].
11148    ///
11149    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11150    /// tokens for more than one scope.
11151    ///
11152    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11153    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11154    /// sufficient, a read-write scope will do as well.
11155    pub fn add_scope<St>(
11156        mut self,
11157        scope: St,
11158    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C>
11159    where
11160        St: AsRef<str>,
11161    {
11162        self._scopes.insert(String::from(scope.as_ref()));
11163        self
11164    }
11165    /// Identifies the authorization scope(s) for the method you are building.
11166    ///
11167    /// See [`Self::add_scope()`] for details.
11168    pub fn add_scopes<I, St>(
11169        mut self,
11170        scopes: I,
11171    ) -> ProjectLocationServiceRevisionExportStatuCall<'a, C>
11172    where
11173        I: IntoIterator<Item = St>,
11174        St: AsRef<str>,
11175    {
11176        self._scopes
11177            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11178        self
11179    }
11180
11181    /// Removes all scopes, and no default scope will be used either.
11182    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11183    /// for details).
11184    pub fn clear_scopes(mut self) -> ProjectLocationServiceRevisionExportStatuCall<'a, C> {
11185        self._scopes.clear();
11186        self
11187    }
11188}
11189
11190/// Gets information about a Revision.
11191///
11192/// A builder for the *locations.services.revisions.get* method supported by a *project* resource.
11193/// It is not used directly, but through a [`ProjectMethods`] instance.
11194///
11195/// # Example
11196///
11197/// Instantiate a resource method builder
11198///
11199/// ```test_harness,no_run
11200/// # extern crate hyper;
11201/// # extern crate hyper_rustls;
11202/// # extern crate google_run2 as run2;
11203/// # async fn dox() {
11204/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11205///
11206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11207/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11208/// #     .with_native_roots()
11209/// #     .unwrap()
11210/// #     .https_only()
11211/// #     .enable_http2()
11212/// #     .build();
11213///
11214/// # let executor = hyper_util::rt::TokioExecutor::new();
11215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11216/// #     secret,
11217/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11218/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11219/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11220/// #     ),
11221/// # ).build().await.unwrap();
11222///
11223/// # let client = hyper_util::client::legacy::Client::builder(
11224/// #     hyper_util::rt::TokioExecutor::new()
11225/// # )
11226/// # .build(
11227/// #     hyper_rustls::HttpsConnectorBuilder::new()
11228/// #         .with_native_roots()
11229/// #         .unwrap()
11230/// #         .https_or_http()
11231/// #         .enable_http2()
11232/// #         .build()
11233/// # );
11234/// # let mut hub = CloudRun::new(client, auth);
11235/// // You can configure optional parameters by calling the respective setters at will, and
11236/// // execute the final call using `doit()`.
11237/// // Values shown here are possibly random and not representative !
11238/// let result = hub.projects().locations_services_revisions_get("name")
11239///              .doit().await;
11240/// # }
11241/// ```
11242pub struct ProjectLocationServiceRevisionGetCall<'a, C>
11243where
11244    C: 'a,
11245{
11246    hub: &'a CloudRun<C>,
11247    _name: String,
11248    _delegate: Option<&'a mut dyn common::Delegate>,
11249    _additional_params: HashMap<String, String>,
11250    _scopes: BTreeSet<String>,
11251}
11252
11253impl<'a, C> common::CallBuilder for ProjectLocationServiceRevisionGetCall<'a, C> {}
11254
11255impl<'a, C> ProjectLocationServiceRevisionGetCall<'a, C>
11256where
11257    C: common::Connector,
11258{
11259    /// Perform the operation you have build so far.
11260    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Revision)> {
11261        use std::borrow::Cow;
11262        use std::io::{Read, Seek};
11263
11264        use common::{url::Params, ToParts};
11265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11266
11267        let mut dd = common::DefaultDelegate;
11268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11269        dlg.begin(common::MethodInfo {
11270            id: "run.projects.locations.services.revisions.get",
11271            http_method: hyper::Method::GET,
11272        });
11273
11274        for &field in ["alt", "name"].iter() {
11275            if self._additional_params.contains_key(field) {
11276                dlg.finished(false);
11277                return Err(common::Error::FieldClash(field));
11278            }
11279        }
11280
11281        let mut params = Params::with_capacity(3 + self._additional_params.len());
11282        params.push("name", self._name);
11283
11284        params.extend(self._additional_params.iter());
11285
11286        params.push("alt", "json");
11287        let mut url = self.hub._base_url.clone() + "v2/{+name}";
11288        if self._scopes.is_empty() {
11289            self._scopes
11290                .insert(Scope::CloudPlatform.as_ref().to_string());
11291        }
11292
11293        #[allow(clippy::single_element_loop)]
11294        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11295            url = params.uri_replacement(url, param_name, find_this, true);
11296        }
11297        {
11298            let to_remove = ["name"];
11299            params.remove_params(&to_remove);
11300        }
11301
11302        let url = params.parse_with_url(&url);
11303
11304        loop {
11305            let token = match self
11306                .hub
11307                .auth
11308                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11309                .await
11310            {
11311                Ok(token) => token,
11312                Err(e) => match dlg.token(e) {
11313                    Ok(token) => token,
11314                    Err(e) => {
11315                        dlg.finished(false);
11316                        return Err(common::Error::MissingToken(e));
11317                    }
11318                },
11319            };
11320            let mut req_result = {
11321                let client = &self.hub.client;
11322                dlg.pre_request();
11323                let mut req_builder = hyper::Request::builder()
11324                    .method(hyper::Method::GET)
11325                    .uri(url.as_str())
11326                    .header(USER_AGENT, self.hub._user_agent.clone());
11327
11328                if let Some(token) = token.as_ref() {
11329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11330                }
11331
11332                let request = req_builder
11333                    .header(CONTENT_LENGTH, 0_u64)
11334                    .body(common::to_body::<String>(None));
11335
11336                client.request(request.unwrap()).await
11337            };
11338
11339            match req_result {
11340                Err(err) => {
11341                    if let common::Retry::After(d) = dlg.http_error(&err) {
11342                        sleep(d).await;
11343                        continue;
11344                    }
11345                    dlg.finished(false);
11346                    return Err(common::Error::HttpError(err));
11347                }
11348                Ok(res) => {
11349                    let (mut parts, body) = res.into_parts();
11350                    let mut body = common::Body::new(body);
11351                    if !parts.status.is_success() {
11352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11353                        let error = serde_json::from_str(&common::to_string(&bytes));
11354                        let response = common::to_response(parts, bytes.into());
11355
11356                        if let common::Retry::After(d) =
11357                            dlg.http_failure(&response, error.as_ref().ok())
11358                        {
11359                            sleep(d).await;
11360                            continue;
11361                        }
11362
11363                        dlg.finished(false);
11364
11365                        return Err(match error {
11366                            Ok(value) => common::Error::BadRequest(value),
11367                            _ => common::Error::Failure(response),
11368                        });
11369                    }
11370                    let response = {
11371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11372                        let encoded = common::to_string(&bytes);
11373                        match serde_json::from_str(&encoded) {
11374                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11375                            Err(error) => {
11376                                dlg.response_json_decode_error(&encoded, &error);
11377                                return Err(common::Error::JsonDecodeError(
11378                                    encoded.to_string(),
11379                                    error,
11380                                ));
11381                            }
11382                        }
11383                    };
11384
11385                    dlg.finished(true);
11386                    return Ok(response);
11387                }
11388            }
11389        }
11390    }
11391
11392    /// Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
11393    ///
11394    /// Sets the *name* path property to the given value.
11395    ///
11396    /// Even though the property as already been set when instantiating this call,
11397    /// we provide this method for API completeness.
11398    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceRevisionGetCall<'a, C> {
11399        self._name = new_value.to_string();
11400        self
11401    }
11402    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11403    /// while executing the actual API request.
11404    ///
11405    /// ````text
11406    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11407    /// ````
11408    ///
11409    /// Sets the *delegate* property to the given value.
11410    pub fn delegate(
11411        mut self,
11412        new_value: &'a mut dyn common::Delegate,
11413    ) -> ProjectLocationServiceRevisionGetCall<'a, C> {
11414        self._delegate = Some(new_value);
11415        self
11416    }
11417
11418    /// Set any additional parameter of the query string used in the request.
11419    /// It should be used to set parameters which are not yet available through their own
11420    /// setters.
11421    ///
11422    /// Please note that this method must not be used to set any of the known parameters
11423    /// which have their own setter method. If done anyway, the request will fail.
11424    ///
11425    /// # Additional Parameters
11426    ///
11427    /// * *$.xgafv* (query-string) - V1 error format.
11428    /// * *access_token* (query-string) - OAuth access token.
11429    /// * *alt* (query-string) - Data format for response.
11430    /// * *callback* (query-string) - JSONP
11431    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11432    /// * *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.
11433    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11434    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11435    /// * *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.
11436    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11437    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11438    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceRevisionGetCall<'a, C>
11439    where
11440        T: AsRef<str>,
11441    {
11442        self._additional_params
11443            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11444        self
11445    }
11446
11447    /// Identifies the authorization scope for the method you are building.
11448    ///
11449    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11450    /// [`Scope::CloudPlatform`].
11451    ///
11452    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11453    /// tokens for more than one scope.
11454    ///
11455    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11456    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11457    /// sufficient, a read-write scope will do as well.
11458    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceRevisionGetCall<'a, C>
11459    where
11460        St: AsRef<str>,
11461    {
11462        self._scopes.insert(String::from(scope.as_ref()));
11463        self
11464    }
11465    /// Identifies the authorization scope(s) for the method you are building.
11466    ///
11467    /// See [`Self::add_scope()`] for details.
11468    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceRevisionGetCall<'a, C>
11469    where
11470        I: IntoIterator<Item = St>,
11471        St: AsRef<str>,
11472    {
11473        self._scopes
11474            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11475        self
11476    }
11477
11478    /// Removes all scopes, and no default scope will be used either.
11479    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11480    /// for details).
11481    pub fn clear_scopes(mut self) -> ProjectLocationServiceRevisionGetCall<'a, C> {
11482        self._scopes.clear();
11483        self
11484    }
11485}
11486
11487/// Lists Revisions from a given Service, or from a given location. Results are sorted by creation time, descending.
11488///
11489/// A builder for the *locations.services.revisions.list* method supported by a *project* resource.
11490/// It is not used directly, but through a [`ProjectMethods`] instance.
11491///
11492/// # Example
11493///
11494/// Instantiate a resource method builder
11495///
11496/// ```test_harness,no_run
11497/// # extern crate hyper;
11498/// # extern crate hyper_rustls;
11499/// # extern crate google_run2 as run2;
11500/// # async fn dox() {
11501/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11502///
11503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11504/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11505/// #     .with_native_roots()
11506/// #     .unwrap()
11507/// #     .https_only()
11508/// #     .enable_http2()
11509/// #     .build();
11510///
11511/// # let executor = hyper_util::rt::TokioExecutor::new();
11512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11513/// #     secret,
11514/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11515/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11516/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11517/// #     ),
11518/// # ).build().await.unwrap();
11519///
11520/// # let client = hyper_util::client::legacy::Client::builder(
11521/// #     hyper_util::rt::TokioExecutor::new()
11522/// # )
11523/// # .build(
11524/// #     hyper_rustls::HttpsConnectorBuilder::new()
11525/// #         .with_native_roots()
11526/// #         .unwrap()
11527/// #         .https_or_http()
11528/// #         .enable_http2()
11529/// #         .build()
11530/// # );
11531/// # let mut hub = CloudRun::new(client, auth);
11532/// // You can configure optional parameters by calling the respective setters at will, and
11533/// // execute the final call using `doit()`.
11534/// // Values shown here are possibly random and not representative !
11535/// let result = hub.projects().locations_services_revisions_list("parent")
11536///              .show_deleted(true)
11537///              .page_token("et")
11538///              .page_size(-23)
11539///              .doit().await;
11540/// # }
11541/// ```
11542pub struct ProjectLocationServiceRevisionListCall<'a, C>
11543where
11544    C: 'a,
11545{
11546    hub: &'a CloudRun<C>,
11547    _parent: String,
11548    _show_deleted: Option<bool>,
11549    _page_token: Option<String>,
11550    _page_size: Option<i32>,
11551    _delegate: Option<&'a mut dyn common::Delegate>,
11552    _additional_params: HashMap<String, String>,
11553    _scopes: BTreeSet<String>,
11554}
11555
11556impl<'a, C> common::CallBuilder for ProjectLocationServiceRevisionListCall<'a, C> {}
11557
11558impl<'a, C> ProjectLocationServiceRevisionListCall<'a, C>
11559where
11560    C: common::Connector,
11561{
11562    /// Perform the operation you have build so far.
11563    pub async fn doit(
11564        mut self,
11565    ) -> common::Result<(common::Response, GoogleCloudRunV2ListRevisionsResponse)> {
11566        use std::borrow::Cow;
11567        use std::io::{Read, Seek};
11568
11569        use common::{url::Params, ToParts};
11570        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11571
11572        let mut dd = common::DefaultDelegate;
11573        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11574        dlg.begin(common::MethodInfo {
11575            id: "run.projects.locations.services.revisions.list",
11576            http_method: hyper::Method::GET,
11577        });
11578
11579        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
11580            if self._additional_params.contains_key(field) {
11581                dlg.finished(false);
11582                return Err(common::Error::FieldClash(field));
11583            }
11584        }
11585
11586        let mut params = Params::with_capacity(6 + self._additional_params.len());
11587        params.push("parent", self._parent);
11588        if let Some(value) = self._show_deleted.as_ref() {
11589            params.push("showDeleted", value.to_string());
11590        }
11591        if let Some(value) = self._page_token.as_ref() {
11592            params.push("pageToken", value);
11593        }
11594        if let Some(value) = self._page_size.as_ref() {
11595            params.push("pageSize", value.to_string());
11596        }
11597
11598        params.extend(self._additional_params.iter());
11599
11600        params.push("alt", "json");
11601        let mut url = self.hub._base_url.clone() + "v2/{+parent}/revisions";
11602        if self._scopes.is_empty() {
11603            self._scopes
11604                .insert(Scope::CloudPlatform.as_ref().to_string());
11605        }
11606
11607        #[allow(clippy::single_element_loop)]
11608        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11609            url = params.uri_replacement(url, param_name, find_this, true);
11610        }
11611        {
11612            let to_remove = ["parent"];
11613            params.remove_params(&to_remove);
11614        }
11615
11616        let url = params.parse_with_url(&url);
11617
11618        loop {
11619            let token = match self
11620                .hub
11621                .auth
11622                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11623                .await
11624            {
11625                Ok(token) => token,
11626                Err(e) => match dlg.token(e) {
11627                    Ok(token) => token,
11628                    Err(e) => {
11629                        dlg.finished(false);
11630                        return Err(common::Error::MissingToken(e));
11631                    }
11632                },
11633            };
11634            let mut req_result = {
11635                let client = &self.hub.client;
11636                dlg.pre_request();
11637                let mut req_builder = hyper::Request::builder()
11638                    .method(hyper::Method::GET)
11639                    .uri(url.as_str())
11640                    .header(USER_AGENT, self.hub._user_agent.clone());
11641
11642                if let Some(token) = token.as_ref() {
11643                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11644                }
11645
11646                let request = req_builder
11647                    .header(CONTENT_LENGTH, 0_u64)
11648                    .body(common::to_body::<String>(None));
11649
11650                client.request(request.unwrap()).await
11651            };
11652
11653            match req_result {
11654                Err(err) => {
11655                    if let common::Retry::After(d) = dlg.http_error(&err) {
11656                        sleep(d).await;
11657                        continue;
11658                    }
11659                    dlg.finished(false);
11660                    return Err(common::Error::HttpError(err));
11661                }
11662                Ok(res) => {
11663                    let (mut parts, body) = res.into_parts();
11664                    let mut body = common::Body::new(body);
11665                    if !parts.status.is_success() {
11666                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11667                        let error = serde_json::from_str(&common::to_string(&bytes));
11668                        let response = common::to_response(parts, bytes.into());
11669
11670                        if let common::Retry::After(d) =
11671                            dlg.http_failure(&response, error.as_ref().ok())
11672                        {
11673                            sleep(d).await;
11674                            continue;
11675                        }
11676
11677                        dlg.finished(false);
11678
11679                        return Err(match error {
11680                            Ok(value) => common::Error::BadRequest(value),
11681                            _ => common::Error::Failure(response),
11682                        });
11683                    }
11684                    let response = {
11685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11686                        let encoded = common::to_string(&bytes);
11687                        match serde_json::from_str(&encoded) {
11688                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11689                            Err(error) => {
11690                                dlg.response_json_decode_error(&encoded, &error);
11691                                return Err(common::Error::JsonDecodeError(
11692                                    encoded.to_string(),
11693                                    error,
11694                                ));
11695                            }
11696                        }
11697                    };
11698
11699                    dlg.finished(true);
11700                    return Ok(response);
11701                }
11702            }
11703        }
11704    }
11705
11706    /// Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service}
11707    ///
11708    /// Sets the *parent* path property to the given value.
11709    ///
11710    /// Even though the property as already been set when instantiating this call,
11711    /// we provide this method for API completeness.
11712    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceRevisionListCall<'a, C> {
11713        self._parent = new_value.to_string();
11714        self
11715    }
11716    /// If true, returns deleted (but unexpired) resources along with active ones.
11717    ///
11718    /// Sets the *show deleted* query property to the given value.
11719    pub fn show_deleted(
11720        mut self,
11721        new_value: bool,
11722    ) -> ProjectLocationServiceRevisionListCall<'a, C> {
11723        self._show_deleted = Some(new_value);
11724        self
11725    }
11726    /// A page token received from a previous call to ListRevisions. All other parameters must match.
11727    ///
11728    /// Sets the *page token* query property to the given value.
11729    pub fn page_token(mut self, new_value: &str) -> ProjectLocationServiceRevisionListCall<'a, C> {
11730        self._page_token = Some(new_value.to_string());
11731        self
11732    }
11733    /// Maximum number of revisions to return in this call.
11734    ///
11735    /// Sets the *page size* query property to the given value.
11736    pub fn page_size(mut self, new_value: i32) -> ProjectLocationServiceRevisionListCall<'a, C> {
11737        self._page_size = Some(new_value);
11738        self
11739    }
11740    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11741    /// while executing the actual API request.
11742    ///
11743    /// ````text
11744    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11745    /// ````
11746    ///
11747    /// Sets the *delegate* property to the given value.
11748    pub fn delegate(
11749        mut self,
11750        new_value: &'a mut dyn common::Delegate,
11751    ) -> ProjectLocationServiceRevisionListCall<'a, C> {
11752        self._delegate = Some(new_value);
11753        self
11754    }
11755
11756    /// Set any additional parameter of the query string used in the request.
11757    /// It should be used to set parameters which are not yet available through their own
11758    /// setters.
11759    ///
11760    /// Please note that this method must not be used to set any of the known parameters
11761    /// which have their own setter method. If done anyway, the request will fail.
11762    ///
11763    /// # Additional Parameters
11764    ///
11765    /// * *$.xgafv* (query-string) - V1 error format.
11766    /// * *access_token* (query-string) - OAuth access token.
11767    /// * *alt* (query-string) - Data format for response.
11768    /// * *callback* (query-string) - JSONP
11769    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11770    /// * *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.
11771    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11772    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11773    /// * *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.
11774    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11775    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11776    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceRevisionListCall<'a, C>
11777    where
11778        T: AsRef<str>,
11779    {
11780        self._additional_params
11781            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11782        self
11783    }
11784
11785    /// Identifies the authorization scope for the method you are building.
11786    ///
11787    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11788    /// [`Scope::CloudPlatform`].
11789    ///
11790    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11791    /// tokens for more than one scope.
11792    ///
11793    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11794    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11795    /// sufficient, a read-write scope will do as well.
11796    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceRevisionListCall<'a, C>
11797    where
11798        St: AsRef<str>,
11799    {
11800        self._scopes.insert(String::from(scope.as_ref()));
11801        self
11802    }
11803    /// Identifies the authorization scope(s) for the method you are building.
11804    ///
11805    /// See [`Self::add_scope()`] for details.
11806    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceRevisionListCall<'a, C>
11807    where
11808        I: IntoIterator<Item = St>,
11809        St: AsRef<str>,
11810    {
11811        self._scopes
11812            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11813        self
11814    }
11815
11816    /// Removes all scopes, and no default scope will be used either.
11817    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11818    /// for details).
11819    pub fn clear_scopes(mut self) -> ProjectLocationServiceRevisionListCall<'a, C> {
11820        self._scopes.clear();
11821        self
11822    }
11823}
11824
11825/// Creates a new Service in a given project and location.
11826///
11827/// A builder for the *locations.services.create* method supported by a *project* resource.
11828/// It is not used directly, but through a [`ProjectMethods`] instance.
11829///
11830/// # Example
11831///
11832/// Instantiate a resource method builder
11833///
11834/// ```test_harness,no_run
11835/// # extern crate hyper;
11836/// # extern crate hyper_rustls;
11837/// # extern crate google_run2 as run2;
11838/// use run2::api::GoogleCloudRunV2Service;
11839/// # async fn dox() {
11840/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11841///
11842/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11843/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11844/// #     .with_native_roots()
11845/// #     .unwrap()
11846/// #     .https_only()
11847/// #     .enable_http2()
11848/// #     .build();
11849///
11850/// # let executor = hyper_util::rt::TokioExecutor::new();
11851/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11852/// #     secret,
11853/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11854/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11855/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11856/// #     ),
11857/// # ).build().await.unwrap();
11858///
11859/// # let client = hyper_util::client::legacy::Client::builder(
11860/// #     hyper_util::rt::TokioExecutor::new()
11861/// # )
11862/// # .build(
11863/// #     hyper_rustls::HttpsConnectorBuilder::new()
11864/// #         .with_native_roots()
11865/// #         .unwrap()
11866/// #         .https_or_http()
11867/// #         .enable_http2()
11868/// #         .build()
11869/// # );
11870/// # let mut hub = CloudRun::new(client, auth);
11871/// // As the method needs a request, you would usually fill it with the desired information
11872/// // into the respective structure. Some of the parts shown here might not be applicable !
11873/// // Values shown here are possibly random and not representative !
11874/// let mut req = GoogleCloudRunV2Service::default();
11875///
11876/// // You can configure optional parameters by calling the respective setters at will, and
11877/// // execute the final call using `doit()`.
11878/// // Values shown here are possibly random and not representative !
11879/// let result = hub.projects().locations_services_create(req, "parent")
11880///              .validate_only(false)
11881///              .service_id("amet.")
11882///              .doit().await;
11883/// # }
11884/// ```
11885pub struct ProjectLocationServiceCreateCall<'a, C>
11886where
11887    C: 'a,
11888{
11889    hub: &'a CloudRun<C>,
11890    _request: GoogleCloudRunV2Service,
11891    _parent: String,
11892    _validate_only: Option<bool>,
11893    _service_id: Option<String>,
11894    _delegate: Option<&'a mut dyn common::Delegate>,
11895    _additional_params: HashMap<String, String>,
11896    _scopes: BTreeSet<String>,
11897}
11898
11899impl<'a, C> common::CallBuilder for ProjectLocationServiceCreateCall<'a, C> {}
11900
11901impl<'a, C> ProjectLocationServiceCreateCall<'a, C>
11902where
11903    C: common::Connector,
11904{
11905    /// Perform the operation you have build so far.
11906    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
11907        use std::borrow::Cow;
11908        use std::io::{Read, Seek};
11909
11910        use common::{url::Params, ToParts};
11911        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11912
11913        let mut dd = common::DefaultDelegate;
11914        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11915        dlg.begin(common::MethodInfo {
11916            id: "run.projects.locations.services.create",
11917            http_method: hyper::Method::POST,
11918        });
11919
11920        for &field in ["alt", "parent", "validateOnly", "serviceId"].iter() {
11921            if self._additional_params.contains_key(field) {
11922                dlg.finished(false);
11923                return Err(common::Error::FieldClash(field));
11924            }
11925        }
11926
11927        let mut params = Params::with_capacity(6 + self._additional_params.len());
11928        params.push("parent", self._parent);
11929        if let Some(value) = self._validate_only.as_ref() {
11930            params.push("validateOnly", value.to_string());
11931        }
11932        if let Some(value) = self._service_id.as_ref() {
11933            params.push("serviceId", value);
11934        }
11935
11936        params.extend(self._additional_params.iter());
11937
11938        params.push("alt", "json");
11939        let mut url = self.hub._base_url.clone() + "v2/{+parent}/services";
11940        if self._scopes.is_empty() {
11941            self._scopes
11942                .insert(Scope::CloudPlatform.as_ref().to_string());
11943        }
11944
11945        #[allow(clippy::single_element_loop)]
11946        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11947            url = params.uri_replacement(url, param_name, find_this, true);
11948        }
11949        {
11950            let to_remove = ["parent"];
11951            params.remove_params(&to_remove);
11952        }
11953
11954        let url = params.parse_with_url(&url);
11955
11956        let mut json_mime_type = mime::APPLICATION_JSON;
11957        let mut request_value_reader = {
11958            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11959            common::remove_json_null_values(&mut value);
11960            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11961            serde_json::to_writer(&mut dst, &value).unwrap();
11962            dst
11963        };
11964        let request_size = request_value_reader
11965            .seek(std::io::SeekFrom::End(0))
11966            .unwrap();
11967        request_value_reader
11968            .seek(std::io::SeekFrom::Start(0))
11969            .unwrap();
11970
11971        loop {
11972            let token = match self
11973                .hub
11974                .auth
11975                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11976                .await
11977            {
11978                Ok(token) => token,
11979                Err(e) => match dlg.token(e) {
11980                    Ok(token) => token,
11981                    Err(e) => {
11982                        dlg.finished(false);
11983                        return Err(common::Error::MissingToken(e));
11984                    }
11985                },
11986            };
11987            request_value_reader
11988                .seek(std::io::SeekFrom::Start(0))
11989                .unwrap();
11990            let mut req_result = {
11991                let client = &self.hub.client;
11992                dlg.pre_request();
11993                let mut req_builder = hyper::Request::builder()
11994                    .method(hyper::Method::POST)
11995                    .uri(url.as_str())
11996                    .header(USER_AGENT, self.hub._user_agent.clone());
11997
11998                if let Some(token) = token.as_ref() {
11999                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12000                }
12001
12002                let request = req_builder
12003                    .header(CONTENT_TYPE, json_mime_type.to_string())
12004                    .header(CONTENT_LENGTH, request_size as u64)
12005                    .body(common::to_body(
12006                        request_value_reader.get_ref().clone().into(),
12007                    ));
12008
12009                client.request(request.unwrap()).await
12010            };
12011
12012            match req_result {
12013                Err(err) => {
12014                    if let common::Retry::After(d) = dlg.http_error(&err) {
12015                        sleep(d).await;
12016                        continue;
12017                    }
12018                    dlg.finished(false);
12019                    return Err(common::Error::HttpError(err));
12020                }
12021                Ok(res) => {
12022                    let (mut parts, body) = res.into_parts();
12023                    let mut body = common::Body::new(body);
12024                    if !parts.status.is_success() {
12025                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12026                        let error = serde_json::from_str(&common::to_string(&bytes));
12027                        let response = common::to_response(parts, bytes.into());
12028
12029                        if let common::Retry::After(d) =
12030                            dlg.http_failure(&response, error.as_ref().ok())
12031                        {
12032                            sleep(d).await;
12033                            continue;
12034                        }
12035
12036                        dlg.finished(false);
12037
12038                        return Err(match error {
12039                            Ok(value) => common::Error::BadRequest(value),
12040                            _ => common::Error::Failure(response),
12041                        });
12042                    }
12043                    let response = {
12044                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12045                        let encoded = common::to_string(&bytes);
12046                        match serde_json::from_str(&encoded) {
12047                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12048                            Err(error) => {
12049                                dlg.response_json_decode_error(&encoded, &error);
12050                                return Err(common::Error::JsonDecodeError(
12051                                    encoded.to_string(),
12052                                    error,
12053                                ));
12054                            }
12055                        }
12056                    };
12057
12058                    dlg.finished(true);
12059                    return Ok(response);
12060                }
12061            }
12062        }
12063    }
12064
12065    ///
12066    /// Sets the *request* property to the given value.
12067    ///
12068    /// Even though the property as already been set when instantiating this call,
12069    /// we provide this method for API completeness.
12070    pub fn request(
12071        mut self,
12072        new_value: GoogleCloudRunV2Service,
12073    ) -> ProjectLocationServiceCreateCall<'a, C> {
12074        self._request = new_value;
12075        self
12076    }
12077    /// Required. The location and project in which this service should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number. Only lowercase characters, digits, and hyphens.
12078    ///
12079    /// Sets the *parent* path property to the given value.
12080    ///
12081    /// Even though the property as already been set when instantiating this call,
12082    /// we provide this method for API completeness.
12083    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
12084        self._parent = new_value.to_string();
12085        self
12086    }
12087    /// Indicates that the request should be validated and default values populated, without persisting the request or creating any resources.
12088    ///
12089    /// Sets the *validate only* query property to the given value.
12090    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationServiceCreateCall<'a, C> {
12091        self._validate_only = Some(new_value);
12092        self
12093    }
12094    /// Required. The unique identifier for the Service. It must begin with letter, and cannot end with hyphen; must contain fewer than 50 characters. The name of the service becomes {parent}/services/{service_id}.
12095    ///
12096    /// Sets the *service id* query property to the given value.
12097    pub fn service_id(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
12098        self._service_id = Some(new_value.to_string());
12099        self
12100    }
12101    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12102    /// while executing the actual API request.
12103    ///
12104    /// ````text
12105    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12106    /// ````
12107    ///
12108    /// Sets the *delegate* property to the given value.
12109    pub fn delegate(
12110        mut self,
12111        new_value: &'a mut dyn common::Delegate,
12112    ) -> ProjectLocationServiceCreateCall<'a, C> {
12113        self._delegate = Some(new_value);
12114        self
12115    }
12116
12117    /// Set any additional parameter of the query string used in the request.
12118    /// It should be used to set parameters which are not yet available through their own
12119    /// setters.
12120    ///
12121    /// Please note that this method must not be used to set any of the known parameters
12122    /// which have their own setter method. If done anyway, the request will fail.
12123    ///
12124    /// # Additional Parameters
12125    ///
12126    /// * *$.xgafv* (query-string) - V1 error format.
12127    /// * *access_token* (query-string) - OAuth access token.
12128    /// * *alt* (query-string) - Data format for response.
12129    /// * *callback* (query-string) - JSONP
12130    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12131    /// * *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.
12132    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12133    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12134    /// * *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.
12135    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12136    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12137    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceCreateCall<'a, C>
12138    where
12139        T: AsRef<str>,
12140    {
12141        self._additional_params
12142            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12143        self
12144    }
12145
12146    /// Identifies the authorization scope for the method you are building.
12147    ///
12148    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12149    /// [`Scope::CloudPlatform`].
12150    ///
12151    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12152    /// tokens for more than one scope.
12153    ///
12154    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12155    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12156    /// sufficient, a read-write scope will do as well.
12157    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCreateCall<'a, C>
12158    where
12159        St: AsRef<str>,
12160    {
12161        self._scopes.insert(String::from(scope.as_ref()));
12162        self
12163    }
12164    /// Identifies the authorization scope(s) for the method you are building.
12165    ///
12166    /// See [`Self::add_scope()`] for details.
12167    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceCreateCall<'a, C>
12168    where
12169        I: IntoIterator<Item = St>,
12170        St: AsRef<str>,
12171    {
12172        self._scopes
12173            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12174        self
12175    }
12176
12177    /// Removes all scopes, and no default scope will be used either.
12178    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12179    /// for details).
12180    pub fn clear_scopes(mut self) -> ProjectLocationServiceCreateCall<'a, C> {
12181        self._scopes.clear();
12182        self
12183    }
12184}
12185
12186/// Deletes a Service. This will cause the Service to stop serving traffic and will delete all revisions.
12187///
12188/// A builder for the *locations.services.delete* method supported by a *project* resource.
12189/// It is not used directly, but through a [`ProjectMethods`] instance.
12190///
12191/// # Example
12192///
12193/// Instantiate a resource method builder
12194///
12195/// ```test_harness,no_run
12196/// # extern crate hyper;
12197/// # extern crate hyper_rustls;
12198/// # extern crate google_run2 as run2;
12199/// # async fn dox() {
12200/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12201///
12202/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12203/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12204/// #     .with_native_roots()
12205/// #     .unwrap()
12206/// #     .https_only()
12207/// #     .enable_http2()
12208/// #     .build();
12209///
12210/// # let executor = hyper_util::rt::TokioExecutor::new();
12211/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12212/// #     secret,
12213/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12214/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12215/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12216/// #     ),
12217/// # ).build().await.unwrap();
12218///
12219/// # let client = hyper_util::client::legacy::Client::builder(
12220/// #     hyper_util::rt::TokioExecutor::new()
12221/// # )
12222/// # .build(
12223/// #     hyper_rustls::HttpsConnectorBuilder::new()
12224/// #         .with_native_roots()
12225/// #         .unwrap()
12226/// #         .https_or_http()
12227/// #         .enable_http2()
12228/// #         .build()
12229/// # );
12230/// # let mut hub = CloudRun::new(client, auth);
12231/// // You can configure optional parameters by calling the respective setters at will, and
12232/// // execute the final call using `doit()`.
12233/// // Values shown here are possibly random and not representative !
12234/// let result = hub.projects().locations_services_delete("name")
12235///              .validate_only(false)
12236///              .etag("Lorem")
12237///              .doit().await;
12238/// # }
12239/// ```
12240pub struct ProjectLocationServiceDeleteCall<'a, C>
12241where
12242    C: 'a,
12243{
12244    hub: &'a CloudRun<C>,
12245    _name: String,
12246    _validate_only: Option<bool>,
12247    _etag: Option<String>,
12248    _delegate: Option<&'a mut dyn common::Delegate>,
12249    _additional_params: HashMap<String, String>,
12250    _scopes: BTreeSet<String>,
12251}
12252
12253impl<'a, C> common::CallBuilder for ProjectLocationServiceDeleteCall<'a, C> {}
12254
12255impl<'a, C> ProjectLocationServiceDeleteCall<'a, C>
12256where
12257    C: common::Connector,
12258{
12259    /// Perform the operation you have build so far.
12260    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
12261        use std::borrow::Cow;
12262        use std::io::{Read, Seek};
12263
12264        use common::{url::Params, ToParts};
12265        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12266
12267        let mut dd = common::DefaultDelegate;
12268        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12269        dlg.begin(common::MethodInfo {
12270            id: "run.projects.locations.services.delete",
12271            http_method: hyper::Method::DELETE,
12272        });
12273
12274        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
12275            if self._additional_params.contains_key(field) {
12276                dlg.finished(false);
12277                return Err(common::Error::FieldClash(field));
12278            }
12279        }
12280
12281        let mut params = Params::with_capacity(5 + self._additional_params.len());
12282        params.push("name", self._name);
12283        if let Some(value) = self._validate_only.as_ref() {
12284            params.push("validateOnly", value.to_string());
12285        }
12286        if let Some(value) = self._etag.as_ref() {
12287            params.push("etag", value);
12288        }
12289
12290        params.extend(self._additional_params.iter());
12291
12292        params.push("alt", "json");
12293        let mut url = self.hub._base_url.clone() + "v2/{+name}";
12294        if self._scopes.is_empty() {
12295            self._scopes
12296                .insert(Scope::CloudPlatform.as_ref().to_string());
12297        }
12298
12299        #[allow(clippy::single_element_loop)]
12300        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12301            url = params.uri_replacement(url, param_name, find_this, true);
12302        }
12303        {
12304            let to_remove = ["name"];
12305            params.remove_params(&to_remove);
12306        }
12307
12308        let url = params.parse_with_url(&url);
12309
12310        loop {
12311            let token = match self
12312                .hub
12313                .auth
12314                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12315                .await
12316            {
12317                Ok(token) => token,
12318                Err(e) => match dlg.token(e) {
12319                    Ok(token) => token,
12320                    Err(e) => {
12321                        dlg.finished(false);
12322                        return Err(common::Error::MissingToken(e));
12323                    }
12324                },
12325            };
12326            let mut req_result = {
12327                let client = &self.hub.client;
12328                dlg.pre_request();
12329                let mut req_builder = hyper::Request::builder()
12330                    .method(hyper::Method::DELETE)
12331                    .uri(url.as_str())
12332                    .header(USER_AGENT, self.hub._user_agent.clone());
12333
12334                if let Some(token) = token.as_ref() {
12335                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12336                }
12337
12338                let request = req_builder
12339                    .header(CONTENT_LENGTH, 0_u64)
12340                    .body(common::to_body::<String>(None));
12341
12342                client.request(request.unwrap()).await
12343            };
12344
12345            match req_result {
12346                Err(err) => {
12347                    if let common::Retry::After(d) = dlg.http_error(&err) {
12348                        sleep(d).await;
12349                        continue;
12350                    }
12351                    dlg.finished(false);
12352                    return Err(common::Error::HttpError(err));
12353                }
12354                Ok(res) => {
12355                    let (mut parts, body) = res.into_parts();
12356                    let mut body = common::Body::new(body);
12357                    if !parts.status.is_success() {
12358                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12359                        let error = serde_json::from_str(&common::to_string(&bytes));
12360                        let response = common::to_response(parts, bytes.into());
12361
12362                        if let common::Retry::After(d) =
12363                            dlg.http_failure(&response, error.as_ref().ok())
12364                        {
12365                            sleep(d).await;
12366                            continue;
12367                        }
12368
12369                        dlg.finished(false);
12370
12371                        return Err(match error {
12372                            Ok(value) => common::Error::BadRequest(value),
12373                            _ => common::Error::Failure(response),
12374                        });
12375                    }
12376                    let response = {
12377                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12378                        let encoded = common::to_string(&bytes);
12379                        match serde_json::from_str(&encoded) {
12380                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12381                            Err(error) => {
12382                                dlg.response_json_decode_error(&encoded, &error);
12383                                return Err(common::Error::JsonDecodeError(
12384                                    encoded.to_string(),
12385                                    error,
12386                                ));
12387                            }
12388                        }
12389                    };
12390
12391                    dlg.finished(true);
12392                    return Ok(response);
12393                }
12394            }
12395        }
12396    }
12397
12398    /// Required. The full name of the Service. Format: projects/{project}/locations/{location}/services/{service}, where {project} can be project id or number.
12399    ///
12400    /// Sets the *name* path property to the given value.
12401    ///
12402    /// Even though the property as already been set when instantiating this call,
12403    /// we provide this method for API completeness.
12404    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
12405        self._name = new_value.to_string();
12406        self
12407    }
12408    /// Indicates that the request should be validated without actually deleting any resources.
12409    ///
12410    /// Sets the *validate only* query property to the given value.
12411    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationServiceDeleteCall<'a, C> {
12412        self._validate_only = Some(new_value);
12413        self
12414    }
12415    /// A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
12416    ///
12417    /// Sets the *etag* query property to the given value.
12418    pub fn etag(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
12419        self._etag = Some(new_value.to_string());
12420        self
12421    }
12422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12423    /// while executing the actual API request.
12424    ///
12425    /// ````text
12426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12427    /// ````
12428    ///
12429    /// Sets the *delegate* property to the given value.
12430    pub fn delegate(
12431        mut self,
12432        new_value: &'a mut dyn common::Delegate,
12433    ) -> ProjectLocationServiceDeleteCall<'a, C> {
12434        self._delegate = Some(new_value);
12435        self
12436    }
12437
12438    /// Set any additional parameter of the query string used in the request.
12439    /// It should be used to set parameters which are not yet available through their own
12440    /// setters.
12441    ///
12442    /// Please note that this method must not be used to set any of the known parameters
12443    /// which have their own setter method. If done anyway, the request will fail.
12444    ///
12445    /// # Additional Parameters
12446    ///
12447    /// * *$.xgafv* (query-string) - V1 error format.
12448    /// * *access_token* (query-string) - OAuth access token.
12449    /// * *alt* (query-string) - Data format for response.
12450    /// * *callback* (query-string) - JSONP
12451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12452    /// * *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.
12453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12455    /// * *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.
12456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12458    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceDeleteCall<'a, C>
12459    where
12460        T: AsRef<str>,
12461    {
12462        self._additional_params
12463            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12464        self
12465    }
12466
12467    /// Identifies the authorization scope for the method you are building.
12468    ///
12469    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12470    /// [`Scope::CloudPlatform`].
12471    ///
12472    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12473    /// tokens for more than one scope.
12474    ///
12475    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12476    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12477    /// sufficient, a read-write scope will do as well.
12478    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceDeleteCall<'a, C>
12479    where
12480        St: AsRef<str>,
12481    {
12482        self._scopes.insert(String::from(scope.as_ref()));
12483        self
12484    }
12485    /// Identifies the authorization scope(s) for the method you are building.
12486    ///
12487    /// See [`Self::add_scope()`] for details.
12488    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceDeleteCall<'a, C>
12489    where
12490        I: IntoIterator<Item = St>,
12491        St: AsRef<str>,
12492    {
12493        self._scopes
12494            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12495        self
12496    }
12497
12498    /// Removes all scopes, and no default scope will be used either.
12499    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12500    /// for details).
12501    pub fn clear_scopes(mut self) -> ProjectLocationServiceDeleteCall<'a, C> {
12502        self._scopes.clear();
12503        self
12504    }
12505}
12506
12507/// Gets information about a Service.
12508///
12509/// A builder for the *locations.services.get* method supported by a *project* resource.
12510/// It is not used directly, but through a [`ProjectMethods`] instance.
12511///
12512/// # Example
12513///
12514/// Instantiate a resource method builder
12515///
12516/// ```test_harness,no_run
12517/// # extern crate hyper;
12518/// # extern crate hyper_rustls;
12519/// # extern crate google_run2 as run2;
12520/// # async fn dox() {
12521/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12522///
12523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12524/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12525/// #     .with_native_roots()
12526/// #     .unwrap()
12527/// #     .https_only()
12528/// #     .enable_http2()
12529/// #     .build();
12530///
12531/// # let executor = hyper_util::rt::TokioExecutor::new();
12532/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12533/// #     secret,
12534/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12535/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12536/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12537/// #     ),
12538/// # ).build().await.unwrap();
12539///
12540/// # let client = hyper_util::client::legacy::Client::builder(
12541/// #     hyper_util::rt::TokioExecutor::new()
12542/// # )
12543/// # .build(
12544/// #     hyper_rustls::HttpsConnectorBuilder::new()
12545/// #         .with_native_roots()
12546/// #         .unwrap()
12547/// #         .https_or_http()
12548/// #         .enable_http2()
12549/// #         .build()
12550/// # );
12551/// # let mut hub = CloudRun::new(client, auth);
12552/// // You can configure optional parameters by calling the respective setters at will, and
12553/// // execute the final call using `doit()`.
12554/// // Values shown here are possibly random and not representative !
12555/// let result = hub.projects().locations_services_get("name")
12556///              .doit().await;
12557/// # }
12558/// ```
12559pub struct ProjectLocationServiceGetCall<'a, C>
12560where
12561    C: 'a,
12562{
12563    hub: &'a CloudRun<C>,
12564    _name: String,
12565    _delegate: Option<&'a mut dyn common::Delegate>,
12566    _additional_params: HashMap<String, String>,
12567    _scopes: BTreeSet<String>,
12568}
12569
12570impl<'a, C> common::CallBuilder for ProjectLocationServiceGetCall<'a, C> {}
12571
12572impl<'a, C> ProjectLocationServiceGetCall<'a, C>
12573where
12574    C: common::Connector,
12575{
12576    /// Perform the operation you have build so far.
12577    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Service)> {
12578        use std::borrow::Cow;
12579        use std::io::{Read, Seek};
12580
12581        use common::{url::Params, ToParts};
12582        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12583
12584        let mut dd = common::DefaultDelegate;
12585        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12586        dlg.begin(common::MethodInfo {
12587            id: "run.projects.locations.services.get",
12588            http_method: hyper::Method::GET,
12589        });
12590
12591        for &field in ["alt", "name"].iter() {
12592            if self._additional_params.contains_key(field) {
12593                dlg.finished(false);
12594                return Err(common::Error::FieldClash(field));
12595            }
12596        }
12597
12598        let mut params = Params::with_capacity(3 + self._additional_params.len());
12599        params.push("name", self._name);
12600
12601        params.extend(self._additional_params.iter());
12602
12603        params.push("alt", "json");
12604        let mut url = self.hub._base_url.clone() + "v2/{+name}";
12605        if self._scopes.is_empty() {
12606            self._scopes
12607                .insert(Scope::CloudPlatform.as_ref().to_string());
12608        }
12609
12610        #[allow(clippy::single_element_loop)]
12611        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12612            url = params.uri_replacement(url, param_name, find_this, true);
12613        }
12614        {
12615            let to_remove = ["name"];
12616            params.remove_params(&to_remove);
12617        }
12618
12619        let url = params.parse_with_url(&url);
12620
12621        loop {
12622            let token = match self
12623                .hub
12624                .auth
12625                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12626                .await
12627            {
12628                Ok(token) => token,
12629                Err(e) => match dlg.token(e) {
12630                    Ok(token) => token,
12631                    Err(e) => {
12632                        dlg.finished(false);
12633                        return Err(common::Error::MissingToken(e));
12634                    }
12635                },
12636            };
12637            let mut req_result = {
12638                let client = &self.hub.client;
12639                dlg.pre_request();
12640                let mut req_builder = hyper::Request::builder()
12641                    .method(hyper::Method::GET)
12642                    .uri(url.as_str())
12643                    .header(USER_AGENT, self.hub._user_agent.clone());
12644
12645                if let Some(token) = token.as_ref() {
12646                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12647                }
12648
12649                let request = req_builder
12650                    .header(CONTENT_LENGTH, 0_u64)
12651                    .body(common::to_body::<String>(None));
12652
12653                client.request(request.unwrap()).await
12654            };
12655
12656            match req_result {
12657                Err(err) => {
12658                    if let common::Retry::After(d) = dlg.http_error(&err) {
12659                        sleep(d).await;
12660                        continue;
12661                    }
12662                    dlg.finished(false);
12663                    return Err(common::Error::HttpError(err));
12664                }
12665                Ok(res) => {
12666                    let (mut parts, body) = res.into_parts();
12667                    let mut body = common::Body::new(body);
12668                    if !parts.status.is_success() {
12669                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12670                        let error = serde_json::from_str(&common::to_string(&bytes));
12671                        let response = common::to_response(parts, bytes.into());
12672
12673                        if let common::Retry::After(d) =
12674                            dlg.http_failure(&response, error.as_ref().ok())
12675                        {
12676                            sleep(d).await;
12677                            continue;
12678                        }
12679
12680                        dlg.finished(false);
12681
12682                        return Err(match error {
12683                            Ok(value) => common::Error::BadRequest(value),
12684                            _ => common::Error::Failure(response),
12685                        });
12686                    }
12687                    let response = {
12688                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12689                        let encoded = common::to_string(&bytes);
12690                        match serde_json::from_str(&encoded) {
12691                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12692                            Err(error) => {
12693                                dlg.response_json_decode_error(&encoded, &error);
12694                                return Err(common::Error::JsonDecodeError(
12695                                    encoded.to_string(),
12696                                    error,
12697                                ));
12698                            }
12699                        }
12700                    };
12701
12702                    dlg.finished(true);
12703                    return Ok(response);
12704                }
12705            }
12706        }
12707    }
12708
12709    /// Required. The full name of the Service. Format: projects/{project}/locations/{location}/services/{service}, where {project} can be project id or number.
12710    ///
12711    /// Sets the *name* path property to the given value.
12712    ///
12713    /// Even though the property as already been set when instantiating this call,
12714    /// we provide this method for API completeness.
12715    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceGetCall<'a, C> {
12716        self._name = new_value.to_string();
12717        self
12718    }
12719    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12720    /// while executing the actual API request.
12721    ///
12722    /// ````text
12723    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12724    /// ````
12725    ///
12726    /// Sets the *delegate* property to the given value.
12727    pub fn delegate(
12728        mut self,
12729        new_value: &'a mut dyn common::Delegate,
12730    ) -> ProjectLocationServiceGetCall<'a, C> {
12731        self._delegate = Some(new_value);
12732        self
12733    }
12734
12735    /// Set any additional parameter of the query string used in the request.
12736    /// It should be used to set parameters which are not yet available through their own
12737    /// setters.
12738    ///
12739    /// Please note that this method must not be used to set any of the known parameters
12740    /// which have their own setter method. If done anyway, the request will fail.
12741    ///
12742    /// # Additional Parameters
12743    ///
12744    /// * *$.xgafv* (query-string) - V1 error format.
12745    /// * *access_token* (query-string) - OAuth access token.
12746    /// * *alt* (query-string) - Data format for response.
12747    /// * *callback* (query-string) - JSONP
12748    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12749    /// * *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.
12750    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12751    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12752    /// * *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.
12753    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12754    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12755    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetCall<'a, C>
12756    where
12757        T: AsRef<str>,
12758    {
12759        self._additional_params
12760            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12761        self
12762    }
12763
12764    /// Identifies the authorization scope for the method you are building.
12765    ///
12766    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12767    /// [`Scope::CloudPlatform`].
12768    ///
12769    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12770    /// tokens for more than one scope.
12771    ///
12772    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12773    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12774    /// sufficient, a read-write scope will do as well.
12775    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetCall<'a, C>
12776    where
12777        St: AsRef<str>,
12778    {
12779        self._scopes.insert(String::from(scope.as_ref()));
12780        self
12781    }
12782    /// Identifies the authorization scope(s) for the method you are building.
12783    ///
12784    /// See [`Self::add_scope()`] for details.
12785    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetCall<'a, C>
12786    where
12787        I: IntoIterator<Item = St>,
12788        St: AsRef<str>,
12789    {
12790        self._scopes
12791            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12792        self
12793    }
12794
12795    /// Removes all scopes, and no default scope will be used either.
12796    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12797    /// for details).
12798    pub fn clear_scopes(mut self) -> ProjectLocationServiceGetCall<'a, C> {
12799        self._scopes.clear();
12800        self
12801    }
12802}
12803
12804/// Gets the IAM Access Control policy currently in effect for the given Cloud Run Service. This result does not include any inherited policies.
12805///
12806/// A builder for the *locations.services.getIamPolicy* method supported by a *project* resource.
12807/// It is not used directly, but through a [`ProjectMethods`] instance.
12808///
12809/// # Example
12810///
12811/// Instantiate a resource method builder
12812///
12813/// ```test_harness,no_run
12814/// # extern crate hyper;
12815/// # extern crate hyper_rustls;
12816/// # extern crate google_run2 as run2;
12817/// # async fn dox() {
12818/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12819///
12820/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12821/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12822/// #     .with_native_roots()
12823/// #     .unwrap()
12824/// #     .https_only()
12825/// #     .enable_http2()
12826/// #     .build();
12827///
12828/// # let executor = hyper_util::rt::TokioExecutor::new();
12829/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12830/// #     secret,
12831/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12832/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12833/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12834/// #     ),
12835/// # ).build().await.unwrap();
12836///
12837/// # let client = hyper_util::client::legacy::Client::builder(
12838/// #     hyper_util::rt::TokioExecutor::new()
12839/// # )
12840/// # .build(
12841/// #     hyper_rustls::HttpsConnectorBuilder::new()
12842/// #         .with_native_roots()
12843/// #         .unwrap()
12844/// #         .https_or_http()
12845/// #         .enable_http2()
12846/// #         .build()
12847/// # );
12848/// # let mut hub = CloudRun::new(client, auth);
12849/// // You can configure optional parameters by calling the respective setters at will, and
12850/// // execute the final call using `doit()`.
12851/// // Values shown here are possibly random and not representative !
12852/// let result = hub.projects().locations_services_get_iam_policy("resource")
12853///              .options_requested_policy_version(-7)
12854///              .doit().await;
12855/// # }
12856/// ```
12857pub struct ProjectLocationServiceGetIamPolicyCall<'a, C>
12858where
12859    C: 'a,
12860{
12861    hub: &'a CloudRun<C>,
12862    _resource: String,
12863    _options_requested_policy_version: Option<i32>,
12864    _delegate: Option<&'a mut dyn common::Delegate>,
12865    _additional_params: HashMap<String, String>,
12866    _scopes: BTreeSet<String>,
12867}
12868
12869impl<'a, C> common::CallBuilder for ProjectLocationServiceGetIamPolicyCall<'a, C> {}
12870
12871impl<'a, C> ProjectLocationServiceGetIamPolicyCall<'a, C>
12872where
12873    C: common::Connector,
12874{
12875    /// Perform the operation you have build so far.
12876    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
12877        use std::borrow::Cow;
12878        use std::io::{Read, Seek};
12879
12880        use common::{url::Params, ToParts};
12881        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12882
12883        let mut dd = common::DefaultDelegate;
12884        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12885        dlg.begin(common::MethodInfo {
12886            id: "run.projects.locations.services.getIamPolicy",
12887            http_method: hyper::Method::GET,
12888        });
12889
12890        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
12891            if self._additional_params.contains_key(field) {
12892                dlg.finished(false);
12893                return Err(common::Error::FieldClash(field));
12894            }
12895        }
12896
12897        let mut params = Params::with_capacity(4 + self._additional_params.len());
12898        params.push("resource", self._resource);
12899        if let Some(value) = self._options_requested_policy_version.as_ref() {
12900            params.push("options.requestedPolicyVersion", value.to_string());
12901        }
12902
12903        params.extend(self._additional_params.iter());
12904
12905        params.push("alt", "json");
12906        let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy";
12907        if self._scopes.is_empty() {
12908            self._scopes
12909                .insert(Scope::CloudPlatform.as_ref().to_string());
12910        }
12911
12912        #[allow(clippy::single_element_loop)]
12913        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12914            url = params.uri_replacement(url, param_name, find_this, true);
12915        }
12916        {
12917            let to_remove = ["resource"];
12918            params.remove_params(&to_remove);
12919        }
12920
12921        let url = params.parse_with_url(&url);
12922
12923        loop {
12924            let token = match self
12925                .hub
12926                .auth
12927                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12928                .await
12929            {
12930                Ok(token) => token,
12931                Err(e) => match dlg.token(e) {
12932                    Ok(token) => token,
12933                    Err(e) => {
12934                        dlg.finished(false);
12935                        return Err(common::Error::MissingToken(e));
12936                    }
12937                },
12938            };
12939            let mut req_result = {
12940                let client = &self.hub.client;
12941                dlg.pre_request();
12942                let mut req_builder = hyper::Request::builder()
12943                    .method(hyper::Method::GET)
12944                    .uri(url.as_str())
12945                    .header(USER_AGENT, self.hub._user_agent.clone());
12946
12947                if let Some(token) = token.as_ref() {
12948                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12949                }
12950
12951                let request = req_builder
12952                    .header(CONTENT_LENGTH, 0_u64)
12953                    .body(common::to_body::<String>(None));
12954
12955                client.request(request.unwrap()).await
12956            };
12957
12958            match req_result {
12959                Err(err) => {
12960                    if let common::Retry::After(d) = dlg.http_error(&err) {
12961                        sleep(d).await;
12962                        continue;
12963                    }
12964                    dlg.finished(false);
12965                    return Err(common::Error::HttpError(err));
12966                }
12967                Ok(res) => {
12968                    let (mut parts, body) = res.into_parts();
12969                    let mut body = common::Body::new(body);
12970                    if !parts.status.is_success() {
12971                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12972                        let error = serde_json::from_str(&common::to_string(&bytes));
12973                        let response = common::to_response(parts, bytes.into());
12974
12975                        if let common::Retry::After(d) =
12976                            dlg.http_failure(&response, error.as_ref().ok())
12977                        {
12978                            sleep(d).await;
12979                            continue;
12980                        }
12981
12982                        dlg.finished(false);
12983
12984                        return Err(match error {
12985                            Ok(value) => common::Error::BadRequest(value),
12986                            _ => common::Error::Failure(response),
12987                        });
12988                    }
12989                    let response = {
12990                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12991                        let encoded = common::to_string(&bytes);
12992                        match serde_json::from_str(&encoded) {
12993                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12994                            Err(error) => {
12995                                dlg.response_json_decode_error(&encoded, &error);
12996                                return Err(common::Error::JsonDecodeError(
12997                                    encoded.to_string(),
12998                                    error,
12999                                ));
13000                            }
13001                        }
13002                    };
13003
13004                    dlg.finished(true);
13005                    return Ok(response);
13006                }
13007            }
13008        }
13009    }
13010
13011    /// 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.
13012    ///
13013    /// Sets the *resource* path property to the given value.
13014    ///
13015    /// Even though the property as already been set when instantiating this call,
13016    /// we provide this method for API completeness.
13017    pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
13018        self._resource = new_value.to_string();
13019        self
13020    }
13021    /// 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).
13022    ///
13023    /// Sets the *options.requested policy version* query property to the given value.
13024    pub fn options_requested_policy_version(
13025        mut self,
13026        new_value: i32,
13027    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
13028        self._options_requested_policy_version = Some(new_value);
13029        self
13030    }
13031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13032    /// while executing the actual API request.
13033    ///
13034    /// ````text
13035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13036    /// ````
13037    ///
13038    /// Sets the *delegate* property to the given value.
13039    pub fn delegate(
13040        mut self,
13041        new_value: &'a mut dyn common::Delegate,
13042    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
13043        self._delegate = Some(new_value);
13044        self
13045    }
13046
13047    /// Set any additional parameter of the query string used in the request.
13048    /// It should be used to set parameters which are not yet available through their own
13049    /// setters.
13050    ///
13051    /// Please note that this method must not be used to set any of the known parameters
13052    /// which have their own setter method. If done anyway, the request will fail.
13053    ///
13054    /// # Additional Parameters
13055    ///
13056    /// * *$.xgafv* (query-string) - V1 error format.
13057    /// * *access_token* (query-string) - OAuth access token.
13058    /// * *alt* (query-string) - Data format for response.
13059    /// * *callback* (query-string) - JSONP
13060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13061    /// * *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.
13062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13064    /// * *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.
13065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13067    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
13068    where
13069        T: AsRef<str>,
13070    {
13071        self._additional_params
13072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13073        self
13074    }
13075
13076    /// Identifies the authorization scope for the method you are building.
13077    ///
13078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13079    /// [`Scope::CloudPlatform`].
13080    ///
13081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13082    /// tokens for more than one scope.
13083    ///
13084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13086    /// sufficient, a read-write scope will do as well.
13087    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
13088    where
13089        St: AsRef<str>,
13090    {
13091        self._scopes.insert(String::from(scope.as_ref()));
13092        self
13093    }
13094    /// Identifies the authorization scope(s) for the method you are building.
13095    ///
13096    /// See [`Self::add_scope()`] for details.
13097    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
13098    where
13099        I: IntoIterator<Item = St>,
13100        St: AsRef<str>,
13101    {
13102        self._scopes
13103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13104        self
13105    }
13106
13107    /// Removes all scopes, and no default scope will be used either.
13108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13109    /// for details).
13110    pub fn clear_scopes(mut self) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
13111        self._scopes.clear();
13112        self
13113    }
13114}
13115
13116/// Lists Services. Results are sorted by creation time, descending.
13117///
13118/// A builder for the *locations.services.list* method supported by a *project* resource.
13119/// It is not used directly, but through a [`ProjectMethods`] instance.
13120///
13121/// # Example
13122///
13123/// Instantiate a resource method builder
13124///
13125/// ```test_harness,no_run
13126/// # extern crate hyper;
13127/// # extern crate hyper_rustls;
13128/// # extern crate google_run2 as run2;
13129/// # async fn dox() {
13130/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13131///
13132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13133/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13134/// #     .with_native_roots()
13135/// #     .unwrap()
13136/// #     .https_only()
13137/// #     .enable_http2()
13138/// #     .build();
13139///
13140/// # let executor = hyper_util::rt::TokioExecutor::new();
13141/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13142/// #     secret,
13143/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13144/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13145/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13146/// #     ),
13147/// # ).build().await.unwrap();
13148///
13149/// # let client = hyper_util::client::legacy::Client::builder(
13150/// #     hyper_util::rt::TokioExecutor::new()
13151/// # )
13152/// # .build(
13153/// #     hyper_rustls::HttpsConnectorBuilder::new()
13154/// #         .with_native_roots()
13155/// #         .unwrap()
13156/// #         .https_or_http()
13157/// #         .enable_http2()
13158/// #         .build()
13159/// # );
13160/// # let mut hub = CloudRun::new(client, auth);
13161/// // You can configure optional parameters by calling the respective setters at will, and
13162/// // execute the final call using `doit()`.
13163/// // Values shown here are possibly random and not representative !
13164/// let result = hub.projects().locations_services_list("parent")
13165///              .show_deleted(true)
13166///              .page_token("sit")
13167///              .page_size(-35)
13168///              .doit().await;
13169/// # }
13170/// ```
13171pub struct ProjectLocationServiceListCall<'a, C>
13172where
13173    C: 'a,
13174{
13175    hub: &'a CloudRun<C>,
13176    _parent: String,
13177    _show_deleted: Option<bool>,
13178    _page_token: Option<String>,
13179    _page_size: Option<i32>,
13180    _delegate: Option<&'a mut dyn common::Delegate>,
13181    _additional_params: HashMap<String, String>,
13182    _scopes: BTreeSet<String>,
13183}
13184
13185impl<'a, C> common::CallBuilder for ProjectLocationServiceListCall<'a, C> {}
13186
13187impl<'a, C> ProjectLocationServiceListCall<'a, C>
13188where
13189    C: common::Connector,
13190{
13191    /// Perform the operation you have build so far.
13192    pub async fn doit(
13193        mut self,
13194    ) -> common::Result<(common::Response, GoogleCloudRunV2ListServicesResponse)> {
13195        use std::borrow::Cow;
13196        use std::io::{Read, Seek};
13197
13198        use common::{url::Params, ToParts};
13199        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13200
13201        let mut dd = common::DefaultDelegate;
13202        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13203        dlg.begin(common::MethodInfo {
13204            id: "run.projects.locations.services.list",
13205            http_method: hyper::Method::GET,
13206        });
13207
13208        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
13209            if self._additional_params.contains_key(field) {
13210                dlg.finished(false);
13211                return Err(common::Error::FieldClash(field));
13212            }
13213        }
13214
13215        let mut params = Params::with_capacity(6 + self._additional_params.len());
13216        params.push("parent", self._parent);
13217        if let Some(value) = self._show_deleted.as_ref() {
13218            params.push("showDeleted", value.to_string());
13219        }
13220        if let Some(value) = self._page_token.as_ref() {
13221            params.push("pageToken", value);
13222        }
13223        if let Some(value) = self._page_size.as_ref() {
13224            params.push("pageSize", value.to_string());
13225        }
13226
13227        params.extend(self._additional_params.iter());
13228
13229        params.push("alt", "json");
13230        let mut url = self.hub._base_url.clone() + "v2/{+parent}/services";
13231        if self._scopes.is_empty() {
13232            self._scopes
13233                .insert(Scope::CloudPlatform.as_ref().to_string());
13234        }
13235
13236        #[allow(clippy::single_element_loop)]
13237        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13238            url = params.uri_replacement(url, param_name, find_this, true);
13239        }
13240        {
13241            let to_remove = ["parent"];
13242            params.remove_params(&to_remove);
13243        }
13244
13245        let url = params.parse_with_url(&url);
13246
13247        loop {
13248            let token = match self
13249                .hub
13250                .auth
13251                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13252                .await
13253            {
13254                Ok(token) => token,
13255                Err(e) => match dlg.token(e) {
13256                    Ok(token) => token,
13257                    Err(e) => {
13258                        dlg.finished(false);
13259                        return Err(common::Error::MissingToken(e));
13260                    }
13261                },
13262            };
13263            let mut req_result = {
13264                let client = &self.hub.client;
13265                dlg.pre_request();
13266                let mut req_builder = hyper::Request::builder()
13267                    .method(hyper::Method::GET)
13268                    .uri(url.as_str())
13269                    .header(USER_AGENT, self.hub._user_agent.clone());
13270
13271                if let Some(token) = token.as_ref() {
13272                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13273                }
13274
13275                let request = req_builder
13276                    .header(CONTENT_LENGTH, 0_u64)
13277                    .body(common::to_body::<String>(None));
13278
13279                client.request(request.unwrap()).await
13280            };
13281
13282            match req_result {
13283                Err(err) => {
13284                    if let common::Retry::After(d) = dlg.http_error(&err) {
13285                        sleep(d).await;
13286                        continue;
13287                    }
13288                    dlg.finished(false);
13289                    return Err(common::Error::HttpError(err));
13290                }
13291                Ok(res) => {
13292                    let (mut parts, body) = res.into_parts();
13293                    let mut body = common::Body::new(body);
13294                    if !parts.status.is_success() {
13295                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13296                        let error = serde_json::from_str(&common::to_string(&bytes));
13297                        let response = common::to_response(parts, bytes.into());
13298
13299                        if let common::Retry::After(d) =
13300                            dlg.http_failure(&response, error.as_ref().ok())
13301                        {
13302                            sleep(d).await;
13303                            continue;
13304                        }
13305
13306                        dlg.finished(false);
13307
13308                        return Err(match error {
13309                            Ok(value) => common::Error::BadRequest(value),
13310                            _ => common::Error::Failure(response),
13311                        });
13312                    }
13313                    let response = {
13314                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13315                        let encoded = common::to_string(&bytes);
13316                        match serde_json::from_str(&encoded) {
13317                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13318                            Err(error) => {
13319                                dlg.response_json_decode_error(&encoded, &error);
13320                                return Err(common::Error::JsonDecodeError(
13321                                    encoded.to_string(),
13322                                    error,
13323                                ));
13324                            }
13325                        }
13326                    };
13327
13328                    dlg.finished(true);
13329                    return Ok(response);
13330                }
13331            }
13332        }
13333    }
13334
13335    /// Required. The location and project to list resources on. Location must be a valid Google Cloud region, and cannot be the "-" wildcard. Format: projects/{project}/locations/{location}, where {project} can be project id or number.
13336    ///
13337    /// Sets the *parent* path property to the given value.
13338    ///
13339    /// Even though the property as already been set when instantiating this call,
13340    /// we provide this method for API completeness.
13341    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
13342        self._parent = new_value.to_string();
13343        self
13344    }
13345    /// If true, returns deleted (but unexpired) resources along with active ones.
13346    ///
13347    /// Sets the *show deleted* query property to the given value.
13348    pub fn show_deleted(mut self, new_value: bool) -> ProjectLocationServiceListCall<'a, C> {
13349        self._show_deleted = Some(new_value);
13350        self
13351    }
13352    /// A page token received from a previous call to ListServices. All other parameters must match.
13353    ///
13354    /// Sets the *page token* query property to the given value.
13355    pub fn page_token(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
13356        self._page_token = Some(new_value.to_string());
13357        self
13358    }
13359    /// Maximum number of Services to return in this call.
13360    ///
13361    /// Sets the *page size* query property to the given value.
13362    pub fn page_size(mut self, new_value: i32) -> ProjectLocationServiceListCall<'a, C> {
13363        self._page_size = Some(new_value);
13364        self
13365    }
13366    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13367    /// while executing the actual API request.
13368    ///
13369    /// ````text
13370    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13371    /// ````
13372    ///
13373    /// Sets the *delegate* property to the given value.
13374    pub fn delegate(
13375        mut self,
13376        new_value: &'a mut dyn common::Delegate,
13377    ) -> ProjectLocationServiceListCall<'a, C> {
13378        self._delegate = Some(new_value);
13379        self
13380    }
13381
13382    /// Set any additional parameter of the query string used in the request.
13383    /// It should be used to set parameters which are not yet available through their own
13384    /// setters.
13385    ///
13386    /// Please note that this method must not be used to set any of the known parameters
13387    /// which have their own setter method. If done anyway, the request will fail.
13388    ///
13389    /// # Additional Parameters
13390    ///
13391    /// * *$.xgafv* (query-string) - V1 error format.
13392    /// * *access_token* (query-string) - OAuth access token.
13393    /// * *alt* (query-string) - Data format for response.
13394    /// * *callback* (query-string) - JSONP
13395    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13396    /// * *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.
13397    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13398    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13399    /// * *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.
13400    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13401    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13402    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceListCall<'a, C>
13403    where
13404        T: AsRef<str>,
13405    {
13406        self._additional_params
13407            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13408        self
13409    }
13410
13411    /// Identifies the authorization scope for the method you are building.
13412    ///
13413    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13414    /// [`Scope::CloudPlatform`].
13415    ///
13416    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13417    /// tokens for more than one scope.
13418    ///
13419    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13420    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13421    /// sufficient, a read-write scope will do as well.
13422    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceListCall<'a, C>
13423    where
13424        St: AsRef<str>,
13425    {
13426        self._scopes.insert(String::from(scope.as_ref()));
13427        self
13428    }
13429    /// Identifies the authorization scope(s) for the method you are building.
13430    ///
13431    /// See [`Self::add_scope()`] for details.
13432    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceListCall<'a, C>
13433    where
13434        I: IntoIterator<Item = St>,
13435        St: AsRef<str>,
13436    {
13437        self._scopes
13438            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13439        self
13440    }
13441
13442    /// Removes all scopes, and no default scope will be used either.
13443    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13444    /// for details).
13445    pub fn clear_scopes(mut self) -> ProjectLocationServiceListCall<'a, C> {
13446        self._scopes.clear();
13447        self
13448    }
13449}
13450
13451/// Updates a Service.
13452///
13453/// A builder for the *locations.services.patch* method supported by a *project* resource.
13454/// It is not used directly, but through a [`ProjectMethods`] instance.
13455///
13456/// # Example
13457///
13458/// Instantiate a resource method builder
13459///
13460/// ```test_harness,no_run
13461/// # extern crate hyper;
13462/// # extern crate hyper_rustls;
13463/// # extern crate google_run2 as run2;
13464/// use run2::api::GoogleCloudRunV2Service;
13465/// # async fn dox() {
13466/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13467///
13468/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13469/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13470/// #     .with_native_roots()
13471/// #     .unwrap()
13472/// #     .https_only()
13473/// #     .enable_http2()
13474/// #     .build();
13475///
13476/// # let executor = hyper_util::rt::TokioExecutor::new();
13477/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13478/// #     secret,
13479/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13480/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13481/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13482/// #     ),
13483/// # ).build().await.unwrap();
13484///
13485/// # let client = hyper_util::client::legacy::Client::builder(
13486/// #     hyper_util::rt::TokioExecutor::new()
13487/// # )
13488/// # .build(
13489/// #     hyper_rustls::HttpsConnectorBuilder::new()
13490/// #         .with_native_roots()
13491/// #         .unwrap()
13492/// #         .https_or_http()
13493/// #         .enable_http2()
13494/// #         .build()
13495/// # );
13496/// # let mut hub = CloudRun::new(client, auth);
13497/// // As the method needs a request, you would usually fill it with the desired information
13498/// // into the respective structure. Some of the parts shown here might not be applicable !
13499/// // Values shown here are possibly random and not representative !
13500/// let mut req = GoogleCloudRunV2Service::default();
13501///
13502/// // You can configure optional parameters by calling the respective setters at will, and
13503/// // execute the final call using `doit()`.
13504/// // Values shown here are possibly random and not representative !
13505/// let result = hub.projects().locations_services_patch(req, "name")
13506///              .validate_only(true)
13507///              .update_mask(FieldMask::new::<&str>(&[]))
13508///              .allow_missing(true)
13509///              .doit().await;
13510/// # }
13511/// ```
13512pub struct ProjectLocationServicePatchCall<'a, C>
13513where
13514    C: 'a,
13515{
13516    hub: &'a CloudRun<C>,
13517    _request: GoogleCloudRunV2Service,
13518    _name: String,
13519    _validate_only: Option<bool>,
13520    _update_mask: Option<common::FieldMask>,
13521    _allow_missing: Option<bool>,
13522    _delegate: Option<&'a mut dyn common::Delegate>,
13523    _additional_params: HashMap<String, String>,
13524    _scopes: BTreeSet<String>,
13525}
13526
13527impl<'a, C> common::CallBuilder for ProjectLocationServicePatchCall<'a, C> {}
13528
13529impl<'a, C> ProjectLocationServicePatchCall<'a, C>
13530where
13531    C: common::Connector,
13532{
13533    /// Perform the operation you have build so far.
13534    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
13535        use std::borrow::Cow;
13536        use std::io::{Read, Seek};
13537
13538        use common::{url::Params, ToParts};
13539        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13540
13541        let mut dd = common::DefaultDelegate;
13542        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13543        dlg.begin(common::MethodInfo {
13544            id: "run.projects.locations.services.patch",
13545            http_method: hyper::Method::PATCH,
13546        });
13547
13548        for &field in ["alt", "name", "validateOnly", "updateMask", "allowMissing"].iter() {
13549            if self._additional_params.contains_key(field) {
13550                dlg.finished(false);
13551                return Err(common::Error::FieldClash(field));
13552            }
13553        }
13554
13555        let mut params = Params::with_capacity(7 + self._additional_params.len());
13556        params.push("name", self._name);
13557        if let Some(value) = self._validate_only.as_ref() {
13558            params.push("validateOnly", value.to_string());
13559        }
13560        if let Some(value) = self._update_mask.as_ref() {
13561            params.push("updateMask", value.to_string());
13562        }
13563        if let Some(value) = self._allow_missing.as_ref() {
13564            params.push("allowMissing", value.to_string());
13565        }
13566
13567        params.extend(self._additional_params.iter());
13568
13569        params.push("alt", "json");
13570        let mut url = self.hub._base_url.clone() + "v2/{+name}";
13571        if self._scopes.is_empty() {
13572            self._scopes
13573                .insert(Scope::CloudPlatform.as_ref().to_string());
13574        }
13575
13576        #[allow(clippy::single_element_loop)]
13577        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13578            url = params.uri_replacement(url, param_name, find_this, true);
13579        }
13580        {
13581            let to_remove = ["name"];
13582            params.remove_params(&to_remove);
13583        }
13584
13585        let url = params.parse_with_url(&url);
13586
13587        let mut json_mime_type = mime::APPLICATION_JSON;
13588        let mut request_value_reader = {
13589            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13590            common::remove_json_null_values(&mut value);
13591            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13592            serde_json::to_writer(&mut dst, &value).unwrap();
13593            dst
13594        };
13595        let request_size = request_value_reader
13596            .seek(std::io::SeekFrom::End(0))
13597            .unwrap();
13598        request_value_reader
13599            .seek(std::io::SeekFrom::Start(0))
13600            .unwrap();
13601
13602        loop {
13603            let token = match self
13604                .hub
13605                .auth
13606                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13607                .await
13608            {
13609                Ok(token) => token,
13610                Err(e) => match dlg.token(e) {
13611                    Ok(token) => token,
13612                    Err(e) => {
13613                        dlg.finished(false);
13614                        return Err(common::Error::MissingToken(e));
13615                    }
13616                },
13617            };
13618            request_value_reader
13619                .seek(std::io::SeekFrom::Start(0))
13620                .unwrap();
13621            let mut req_result = {
13622                let client = &self.hub.client;
13623                dlg.pre_request();
13624                let mut req_builder = hyper::Request::builder()
13625                    .method(hyper::Method::PATCH)
13626                    .uri(url.as_str())
13627                    .header(USER_AGENT, self.hub._user_agent.clone());
13628
13629                if let Some(token) = token.as_ref() {
13630                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13631                }
13632
13633                let request = req_builder
13634                    .header(CONTENT_TYPE, json_mime_type.to_string())
13635                    .header(CONTENT_LENGTH, request_size as u64)
13636                    .body(common::to_body(
13637                        request_value_reader.get_ref().clone().into(),
13638                    ));
13639
13640                client.request(request.unwrap()).await
13641            };
13642
13643            match req_result {
13644                Err(err) => {
13645                    if let common::Retry::After(d) = dlg.http_error(&err) {
13646                        sleep(d).await;
13647                        continue;
13648                    }
13649                    dlg.finished(false);
13650                    return Err(common::Error::HttpError(err));
13651                }
13652                Ok(res) => {
13653                    let (mut parts, body) = res.into_parts();
13654                    let mut body = common::Body::new(body);
13655                    if !parts.status.is_success() {
13656                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13657                        let error = serde_json::from_str(&common::to_string(&bytes));
13658                        let response = common::to_response(parts, bytes.into());
13659
13660                        if let common::Retry::After(d) =
13661                            dlg.http_failure(&response, error.as_ref().ok())
13662                        {
13663                            sleep(d).await;
13664                            continue;
13665                        }
13666
13667                        dlg.finished(false);
13668
13669                        return Err(match error {
13670                            Ok(value) => common::Error::BadRequest(value),
13671                            _ => common::Error::Failure(response),
13672                        });
13673                    }
13674                    let response = {
13675                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13676                        let encoded = common::to_string(&bytes);
13677                        match serde_json::from_str(&encoded) {
13678                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13679                            Err(error) => {
13680                                dlg.response_json_decode_error(&encoded, &error);
13681                                return Err(common::Error::JsonDecodeError(
13682                                    encoded.to_string(),
13683                                    error,
13684                                ));
13685                            }
13686                        }
13687                    };
13688
13689                    dlg.finished(true);
13690                    return Ok(response);
13691                }
13692            }
13693        }
13694    }
13695
13696    ///
13697    /// Sets the *request* property to the given value.
13698    ///
13699    /// Even though the property as already been set when instantiating this call,
13700    /// we provide this method for API completeness.
13701    pub fn request(
13702        mut self,
13703        new_value: GoogleCloudRunV2Service,
13704    ) -> ProjectLocationServicePatchCall<'a, C> {
13705        self._request = new_value;
13706        self
13707    }
13708    /// Identifier. The fully qualified name of this Service. In CreateServiceRequest, this field is ignored, and instead composed from CreateServiceRequest.parent and CreateServiceRequest.service_id. Format: projects/{project}/locations/{location}/services/{service_id}
13709    ///
13710    /// Sets the *name* path property to the given value.
13711    ///
13712    /// Even though the property as already been set when instantiating this call,
13713    /// we provide this method for API completeness.
13714    pub fn name(mut self, new_value: &str) -> ProjectLocationServicePatchCall<'a, C> {
13715        self._name = new_value.to_string();
13716        self
13717    }
13718    /// Indicates that the request should be validated and default values populated, without persisting the request or updating any resources.
13719    ///
13720    /// Sets the *validate only* query property to the given value.
13721    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationServicePatchCall<'a, C> {
13722        self._validate_only = Some(new_value);
13723        self
13724    }
13725    /// Optional. The list of fields to be updated.
13726    ///
13727    /// Sets the *update mask* query property to the given value.
13728    pub fn update_mask(
13729        mut self,
13730        new_value: common::FieldMask,
13731    ) -> ProjectLocationServicePatchCall<'a, C> {
13732        self._update_mask = Some(new_value);
13733        self
13734    }
13735    /// Optional. If set to true, and if the Service does not exist, it will create a new one. The caller must have 'run.services.create' permissions if this is set to true and the Service does not exist.
13736    ///
13737    /// Sets the *allow missing* query property to the given value.
13738    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationServicePatchCall<'a, C> {
13739        self._allow_missing = Some(new_value);
13740        self
13741    }
13742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13743    /// while executing the actual API request.
13744    ///
13745    /// ````text
13746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13747    /// ````
13748    ///
13749    /// Sets the *delegate* property to the given value.
13750    pub fn delegate(
13751        mut self,
13752        new_value: &'a mut dyn common::Delegate,
13753    ) -> ProjectLocationServicePatchCall<'a, C> {
13754        self._delegate = Some(new_value);
13755        self
13756    }
13757
13758    /// Set any additional parameter of the query string used in the request.
13759    /// It should be used to set parameters which are not yet available through their own
13760    /// setters.
13761    ///
13762    /// Please note that this method must not be used to set any of the known parameters
13763    /// which have their own setter method. If done anyway, the request will fail.
13764    ///
13765    /// # Additional Parameters
13766    ///
13767    /// * *$.xgafv* (query-string) - V1 error format.
13768    /// * *access_token* (query-string) - OAuth access token.
13769    /// * *alt* (query-string) - Data format for response.
13770    /// * *callback* (query-string) - JSONP
13771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13772    /// * *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.
13773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13775    /// * *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.
13776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13778    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServicePatchCall<'a, C>
13779    where
13780        T: AsRef<str>,
13781    {
13782        self._additional_params
13783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13784        self
13785    }
13786
13787    /// Identifies the authorization scope for the method you are building.
13788    ///
13789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13790    /// [`Scope::CloudPlatform`].
13791    ///
13792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13793    /// tokens for more than one scope.
13794    ///
13795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13797    /// sufficient, a read-write scope will do as well.
13798    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServicePatchCall<'a, C>
13799    where
13800        St: AsRef<str>,
13801    {
13802        self._scopes.insert(String::from(scope.as_ref()));
13803        self
13804    }
13805    /// Identifies the authorization scope(s) for the method you are building.
13806    ///
13807    /// See [`Self::add_scope()`] for details.
13808    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServicePatchCall<'a, C>
13809    where
13810        I: IntoIterator<Item = St>,
13811        St: AsRef<str>,
13812    {
13813        self._scopes
13814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13815        self
13816    }
13817
13818    /// Removes all scopes, and no default scope will be used either.
13819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13820    /// for details).
13821    pub fn clear_scopes(mut self) -> ProjectLocationServicePatchCall<'a, C> {
13822        self._scopes.clear();
13823        self
13824    }
13825}
13826
13827/// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
13828///
13829/// A builder for the *locations.services.setIamPolicy* method supported by a *project* resource.
13830/// It is not used directly, but through a [`ProjectMethods`] instance.
13831///
13832/// # Example
13833///
13834/// Instantiate a resource method builder
13835///
13836/// ```test_harness,no_run
13837/// # extern crate hyper;
13838/// # extern crate hyper_rustls;
13839/// # extern crate google_run2 as run2;
13840/// use run2::api::GoogleIamV1SetIamPolicyRequest;
13841/// # async fn dox() {
13842/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13843///
13844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13845/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13846/// #     .with_native_roots()
13847/// #     .unwrap()
13848/// #     .https_only()
13849/// #     .enable_http2()
13850/// #     .build();
13851///
13852/// # let executor = hyper_util::rt::TokioExecutor::new();
13853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13854/// #     secret,
13855/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13856/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13857/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13858/// #     ),
13859/// # ).build().await.unwrap();
13860///
13861/// # let client = hyper_util::client::legacy::Client::builder(
13862/// #     hyper_util::rt::TokioExecutor::new()
13863/// # )
13864/// # .build(
13865/// #     hyper_rustls::HttpsConnectorBuilder::new()
13866/// #         .with_native_roots()
13867/// #         .unwrap()
13868/// #         .https_or_http()
13869/// #         .enable_http2()
13870/// #         .build()
13871/// # );
13872/// # let mut hub = CloudRun::new(client, auth);
13873/// // As the method needs a request, you would usually fill it with the desired information
13874/// // into the respective structure. Some of the parts shown here might not be applicable !
13875/// // Values shown here are possibly random and not representative !
13876/// let mut req = GoogleIamV1SetIamPolicyRequest::default();
13877///
13878/// // You can configure optional parameters by calling the respective setters at will, and
13879/// // execute the final call using `doit()`.
13880/// // Values shown here are possibly random and not representative !
13881/// let result = hub.projects().locations_services_set_iam_policy(req, "resource")
13882///              .doit().await;
13883/// # }
13884/// ```
13885pub struct ProjectLocationServiceSetIamPolicyCall<'a, C>
13886where
13887    C: 'a,
13888{
13889    hub: &'a CloudRun<C>,
13890    _request: GoogleIamV1SetIamPolicyRequest,
13891    _resource: String,
13892    _delegate: Option<&'a mut dyn common::Delegate>,
13893    _additional_params: HashMap<String, String>,
13894    _scopes: BTreeSet<String>,
13895}
13896
13897impl<'a, C> common::CallBuilder for ProjectLocationServiceSetIamPolicyCall<'a, C> {}
13898
13899impl<'a, C> ProjectLocationServiceSetIamPolicyCall<'a, C>
13900where
13901    C: common::Connector,
13902{
13903    /// Perform the operation you have build so far.
13904    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
13905        use std::borrow::Cow;
13906        use std::io::{Read, Seek};
13907
13908        use common::{url::Params, ToParts};
13909        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13910
13911        let mut dd = common::DefaultDelegate;
13912        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13913        dlg.begin(common::MethodInfo {
13914            id: "run.projects.locations.services.setIamPolicy",
13915            http_method: hyper::Method::POST,
13916        });
13917
13918        for &field in ["alt", "resource"].iter() {
13919            if self._additional_params.contains_key(field) {
13920                dlg.finished(false);
13921                return Err(common::Error::FieldClash(field));
13922            }
13923        }
13924
13925        let mut params = Params::with_capacity(4 + self._additional_params.len());
13926        params.push("resource", self._resource);
13927
13928        params.extend(self._additional_params.iter());
13929
13930        params.push("alt", "json");
13931        let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy";
13932        if self._scopes.is_empty() {
13933            self._scopes
13934                .insert(Scope::CloudPlatform.as_ref().to_string());
13935        }
13936
13937        #[allow(clippy::single_element_loop)]
13938        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13939            url = params.uri_replacement(url, param_name, find_this, true);
13940        }
13941        {
13942            let to_remove = ["resource"];
13943            params.remove_params(&to_remove);
13944        }
13945
13946        let url = params.parse_with_url(&url);
13947
13948        let mut json_mime_type = mime::APPLICATION_JSON;
13949        let mut request_value_reader = {
13950            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13951            common::remove_json_null_values(&mut value);
13952            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13953            serde_json::to_writer(&mut dst, &value).unwrap();
13954            dst
13955        };
13956        let request_size = request_value_reader
13957            .seek(std::io::SeekFrom::End(0))
13958            .unwrap();
13959        request_value_reader
13960            .seek(std::io::SeekFrom::Start(0))
13961            .unwrap();
13962
13963        loop {
13964            let token = match self
13965                .hub
13966                .auth
13967                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13968                .await
13969            {
13970                Ok(token) => token,
13971                Err(e) => match dlg.token(e) {
13972                    Ok(token) => token,
13973                    Err(e) => {
13974                        dlg.finished(false);
13975                        return Err(common::Error::MissingToken(e));
13976                    }
13977                },
13978            };
13979            request_value_reader
13980                .seek(std::io::SeekFrom::Start(0))
13981                .unwrap();
13982            let mut req_result = {
13983                let client = &self.hub.client;
13984                dlg.pre_request();
13985                let mut req_builder = hyper::Request::builder()
13986                    .method(hyper::Method::POST)
13987                    .uri(url.as_str())
13988                    .header(USER_AGENT, self.hub._user_agent.clone());
13989
13990                if let Some(token) = token.as_ref() {
13991                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13992                }
13993
13994                let request = req_builder
13995                    .header(CONTENT_TYPE, json_mime_type.to_string())
13996                    .header(CONTENT_LENGTH, request_size as u64)
13997                    .body(common::to_body(
13998                        request_value_reader.get_ref().clone().into(),
13999                    ));
14000
14001                client.request(request.unwrap()).await
14002            };
14003
14004            match req_result {
14005                Err(err) => {
14006                    if let common::Retry::After(d) = dlg.http_error(&err) {
14007                        sleep(d).await;
14008                        continue;
14009                    }
14010                    dlg.finished(false);
14011                    return Err(common::Error::HttpError(err));
14012                }
14013                Ok(res) => {
14014                    let (mut parts, body) = res.into_parts();
14015                    let mut body = common::Body::new(body);
14016                    if !parts.status.is_success() {
14017                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14018                        let error = serde_json::from_str(&common::to_string(&bytes));
14019                        let response = common::to_response(parts, bytes.into());
14020
14021                        if let common::Retry::After(d) =
14022                            dlg.http_failure(&response, error.as_ref().ok())
14023                        {
14024                            sleep(d).await;
14025                            continue;
14026                        }
14027
14028                        dlg.finished(false);
14029
14030                        return Err(match error {
14031                            Ok(value) => common::Error::BadRequest(value),
14032                            _ => common::Error::Failure(response),
14033                        });
14034                    }
14035                    let response = {
14036                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14037                        let encoded = common::to_string(&bytes);
14038                        match serde_json::from_str(&encoded) {
14039                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14040                            Err(error) => {
14041                                dlg.response_json_decode_error(&encoded, &error);
14042                                return Err(common::Error::JsonDecodeError(
14043                                    encoded.to_string(),
14044                                    error,
14045                                ));
14046                            }
14047                        }
14048                    };
14049
14050                    dlg.finished(true);
14051                    return Ok(response);
14052                }
14053            }
14054        }
14055    }
14056
14057    ///
14058    /// Sets the *request* property to the given value.
14059    ///
14060    /// Even though the property as already been set when instantiating this call,
14061    /// we provide this method for API completeness.
14062    pub fn request(
14063        mut self,
14064        new_value: GoogleIamV1SetIamPolicyRequest,
14065    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
14066        self._request = new_value;
14067        self
14068    }
14069    /// 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.
14070    ///
14071    /// Sets the *resource* path property to the given value.
14072    ///
14073    /// Even though the property as already been set when instantiating this call,
14074    /// we provide this method for API completeness.
14075    pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
14076        self._resource = new_value.to_string();
14077        self
14078    }
14079    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14080    /// while executing the actual API request.
14081    ///
14082    /// ````text
14083    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14084    /// ````
14085    ///
14086    /// Sets the *delegate* property to the given value.
14087    pub fn delegate(
14088        mut self,
14089        new_value: &'a mut dyn common::Delegate,
14090    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
14091        self._delegate = Some(new_value);
14092        self
14093    }
14094
14095    /// Set any additional parameter of the query string used in the request.
14096    /// It should be used to set parameters which are not yet available through their own
14097    /// setters.
14098    ///
14099    /// Please note that this method must not be used to set any of the known parameters
14100    /// which have their own setter method. If done anyway, the request will fail.
14101    ///
14102    /// # Additional Parameters
14103    ///
14104    /// * *$.xgafv* (query-string) - V1 error format.
14105    /// * *access_token* (query-string) - OAuth access token.
14106    /// * *alt* (query-string) - Data format for response.
14107    /// * *callback* (query-string) - JSONP
14108    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14109    /// * *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.
14110    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14111    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14112    /// * *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.
14113    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14114    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14115    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
14116    where
14117        T: AsRef<str>,
14118    {
14119        self._additional_params
14120            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14121        self
14122    }
14123
14124    /// Identifies the authorization scope for the method you are building.
14125    ///
14126    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14127    /// [`Scope::CloudPlatform`].
14128    ///
14129    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14130    /// tokens for more than one scope.
14131    ///
14132    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14133    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14134    /// sufficient, a read-write scope will do as well.
14135    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
14136    where
14137        St: AsRef<str>,
14138    {
14139        self._scopes.insert(String::from(scope.as_ref()));
14140        self
14141    }
14142    /// Identifies the authorization scope(s) for the method you are building.
14143    ///
14144    /// See [`Self::add_scope()`] for details.
14145    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
14146    where
14147        I: IntoIterator<Item = St>,
14148        St: AsRef<str>,
14149    {
14150        self._scopes
14151            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14152        self
14153    }
14154
14155    /// Removes all scopes, and no default scope will be used either.
14156    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14157    /// for details).
14158    pub fn clear_scopes(mut self) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
14159        self._scopes.clear();
14160        self
14161    }
14162}
14163
14164/// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
14165///
14166/// A builder for the *locations.services.testIamPermissions* method supported by a *project* resource.
14167/// It is not used directly, but through a [`ProjectMethods`] instance.
14168///
14169/// # Example
14170///
14171/// Instantiate a resource method builder
14172///
14173/// ```test_harness,no_run
14174/// # extern crate hyper;
14175/// # extern crate hyper_rustls;
14176/// # extern crate google_run2 as run2;
14177/// use run2::api::GoogleIamV1TestIamPermissionsRequest;
14178/// # async fn dox() {
14179/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14180///
14181/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14182/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14183/// #     .with_native_roots()
14184/// #     .unwrap()
14185/// #     .https_only()
14186/// #     .enable_http2()
14187/// #     .build();
14188///
14189/// # let executor = hyper_util::rt::TokioExecutor::new();
14190/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14191/// #     secret,
14192/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14193/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14194/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14195/// #     ),
14196/// # ).build().await.unwrap();
14197///
14198/// # let client = hyper_util::client::legacy::Client::builder(
14199/// #     hyper_util::rt::TokioExecutor::new()
14200/// # )
14201/// # .build(
14202/// #     hyper_rustls::HttpsConnectorBuilder::new()
14203/// #         .with_native_roots()
14204/// #         .unwrap()
14205/// #         .https_or_http()
14206/// #         .enable_http2()
14207/// #         .build()
14208/// # );
14209/// # let mut hub = CloudRun::new(client, auth);
14210/// // As the method needs a request, you would usually fill it with the desired information
14211/// // into the respective structure. Some of the parts shown here might not be applicable !
14212/// // Values shown here are possibly random and not representative !
14213/// let mut req = GoogleIamV1TestIamPermissionsRequest::default();
14214///
14215/// // You can configure optional parameters by calling the respective setters at will, and
14216/// // execute the final call using `doit()`.
14217/// // Values shown here are possibly random and not representative !
14218/// let result = hub.projects().locations_services_test_iam_permissions(req, "resource")
14219///              .doit().await;
14220/// # }
14221/// ```
14222pub struct ProjectLocationServiceTestIamPermissionCall<'a, C>
14223where
14224    C: 'a,
14225{
14226    hub: &'a CloudRun<C>,
14227    _request: GoogleIamV1TestIamPermissionsRequest,
14228    _resource: String,
14229    _delegate: Option<&'a mut dyn common::Delegate>,
14230    _additional_params: HashMap<String, String>,
14231    _scopes: BTreeSet<String>,
14232}
14233
14234impl<'a, C> common::CallBuilder for ProjectLocationServiceTestIamPermissionCall<'a, C> {}
14235
14236impl<'a, C> ProjectLocationServiceTestIamPermissionCall<'a, C>
14237where
14238    C: common::Connector,
14239{
14240    /// Perform the operation you have build so far.
14241    pub async fn doit(
14242        mut self,
14243    ) -> common::Result<(common::Response, GoogleIamV1TestIamPermissionsResponse)> {
14244        use std::borrow::Cow;
14245        use std::io::{Read, Seek};
14246
14247        use common::{url::Params, ToParts};
14248        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14249
14250        let mut dd = common::DefaultDelegate;
14251        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14252        dlg.begin(common::MethodInfo {
14253            id: "run.projects.locations.services.testIamPermissions",
14254            http_method: hyper::Method::POST,
14255        });
14256
14257        for &field in ["alt", "resource"].iter() {
14258            if self._additional_params.contains_key(field) {
14259                dlg.finished(false);
14260                return Err(common::Error::FieldClash(field));
14261            }
14262        }
14263
14264        let mut params = Params::with_capacity(4 + self._additional_params.len());
14265        params.push("resource", self._resource);
14266
14267        params.extend(self._additional_params.iter());
14268
14269        params.push("alt", "json");
14270        let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions";
14271        if self._scopes.is_empty() {
14272            self._scopes
14273                .insert(Scope::CloudPlatform.as_ref().to_string());
14274        }
14275
14276        #[allow(clippy::single_element_loop)]
14277        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14278            url = params.uri_replacement(url, param_name, find_this, true);
14279        }
14280        {
14281            let to_remove = ["resource"];
14282            params.remove_params(&to_remove);
14283        }
14284
14285        let url = params.parse_with_url(&url);
14286
14287        let mut json_mime_type = mime::APPLICATION_JSON;
14288        let mut request_value_reader = {
14289            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14290            common::remove_json_null_values(&mut value);
14291            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14292            serde_json::to_writer(&mut dst, &value).unwrap();
14293            dst
14294        };
14295        let request_size = request_value_reader
14296            .seek(std::io::SeekFrom::End(0))
14297            .unwrap();
14298        request_value_reader
14299            .seek(std::io::SeekFrom::Start(0))
14300            .unwrap();
14301
14302        loop {
14303            let token = match self
14304                .hub
14305                .auth
14306                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14307                .await
14308            {
14309                Ok(token) => token,
14310                Err(e) => match dlg.token(e) {
14311                    Ok(token) => token,
14312                    Err(e) => {
14313                        dlg.finished(false);
14314                        return Err(common::Error::MissingToken(e));
14315                    }
14316                },
14317            };
14318            request_value_reader
14319                .seek(std::io::SeekFrom::Start(0))
14320                .unwrap();
14321            let mut req_result = {
14322                let client = &self.hub.client;
14323                dlg.pre_request();
14324                let mut req_builder = hyper::Request::builder()
14325                    .method(hyper::Method::POST)
14326                    .uri(url.as_str())
14327                    .header(USER_AGENT, self.hub._user_agent.clone());
14328
14329                if let Some(token) = token.as_ref() {
14330                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14331                }
14332
14333                let request = req_builder
14334                    .header(CONTENT_TYPE, json_mime_type.to_string())
14335                    .header(CONTENT_LENGTH, request_size as u64)
14336                    .body(common::to_body(
14337                        request_value_reader.get_ref().clone().into(),
14338                    ));
14339
14340                client.request(request.unwrap()).await
14341            };
14342
14343            match req_result {
14344                Err(err) => {
14345                    if let common::Retry::After(d) = dlg.http_error(&err) {
14346                        sleep(d).await;
14347                        continue;
14348                    }
14349                    dlg.finished(false);
14350                    return Err(common::Error::HttpError(err));
14351                }
14352                Ok(res) => {
14353                    let (mut parts, body) = res.into_parts();
14354                    let mut body = common::Body::new(body);
14355                    if !parts.status.is_success() {
14356                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14357                        let error = serde_json::from_str(&common::to_string(&bytes));
14358                        let response = common::to_response(parts, bytes.into());
14359
14360                        if let common::Retry::After(d) =
14361                            dlg.http_failure(&response, error.as_ref().ok())
14362                        {
14363                            sleep(d).await;
14364                            continue;
14365                        }
14366
14367                        dlg.finished(false);
14368
14369                        return Err(match error {
14370                            Ok(value) => common::Error::BadRequest(value),
14371                            _ => common::Error::Failure(response),
14372                        });
14373                    }
14374                    let response = {
14375                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14376                        let encoded = common::to_string(&bytes);
14377                        match serde_json::from_str(&encoded) {
14378                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14379                            Err(error) => {
14380                                dlg.response_json_decode_error(&encoded, &error);
14381                                return Err(common::Error::JsonDecodeError(
14382                                    encoded.to_string(),
14383                                    error,
14384                                ));
14385                            }
14386                        }
14387                    };
14388
14389                    dlg.finished(true);
14390                    return Ok(response);
14391                }
14392            }
14393        }
14394    }
14395
14396    ///
14397    /// Sets the *request* property to the given value.
14398    ///
14399    /// Even though the property as already been set when instantiating this call,
14400    /// we provide this method for API completeness.
14401    pub fn request(
14402        mut self,
14403        new_value: GoogleIamV1TestIamPermissionsRequest,
14404    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
14405        self._request = new_value;
14406        self
14407    }
14408    /// 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.
14409    ///
14410    /// Sets the *resource* path property to the given value.
14411    ///
14412    /// Even though the property as already been set when instantiating this call,
14413    /// we provide this method for API completeness.
14414    pub fn resource(
14415        mut self,
14416        new_value: &str,
14417    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
14418        self._resource = new_value.to_string();
14419        self
14420    }
14421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14422    /// while executing the actual API request.
14423    ///
14424    /// ````text
14425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14426    /// ````
14427    ///
14428    /// Sets the *delegate* property to the given value.
14429    pub fn delegate(
14430        mut self,
14431        new_value: &'a mut dyn common::Delegate,
14432    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
14433        self._delegate = Some(new_value);
14434        self
14435    }
14436
14437    /// Set any additional parameter of the query string used in the request.
14438    /// It should be used to set parameters which are not yet available through their own
14439    /// setters.
14440    ///
14441    /// Please note that this method must not be used to set any of the known parameters
14442    /// which have their own setter method. If done anyway, the request will fail.
14443    ///
14444    /// # Additional Parameters
14445    ///
14446    /// * *$.xgafv* (query-string) - V1 error format.
14447    /// * *access_token* (query-string) - OAuth access token.
14448    /// * *alt* (query-string) - Data format for response.
14449    /// * *callback* (query-string) - JSONP
14450    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14451    /// * *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.
14452    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14453    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14454    /// * *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.
14455    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14456    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14457    pub fn param<T>(
14458        mut self,
14459        name: T,
14460        value: T,
14461    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
14462    where
14463        T: AsRef<str>,
14464    {
14465        self._additional_params
14466            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14467        self
14468    }
14469
14470    /// Identifies the authorization scope for the method you are building.
14471    ///
14472    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14473    /// [`Scope::CloudPlatform`].
14474    ///
14475    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14476    /// tokens for more than one scope.
14477    ///
14478    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14479    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14480    /// sufficient, a read-write scope will do as well.
14481    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
14482    where
14483        St: AsRef<str>,
14484    {
14485        self._scopes.insert(String::from(scope.as_ref()));
14486        self
14487    }
14488    /// Identifies the authorization scope(s) for the method you are building.
14489    ///
14490    /// See [`Self::add_scope()`] for details.
14491    pub fn add_scopes<I, St>(
14492        mut self,
14493        scopes: I,
14494    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
14495    where
14496        I: IntoIterator<Item = St>,
14497        St: AsRef<str>,
14498    {
14499        self._scopes
14500            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14501        self
14502    }
14503
14504    /// Removes all scopes, and no default scope will be used either.
14505    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14506    /// for details).
14507    pub fn clear_scopes(mut self) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
14508        self._scopes.clear();
14509        self
14510    }
14511}
14512
14513/// Deletes a Revision.
14514///
14515/// A builder for the *locations.workerPools.revisions.delete* method supported by a *project* resource.
14516/// It is not used directly, but through a [`ProjectMethods`] instance.
14517///
14518/// # Example
14519///
14520/// Instantiate a resource method builder
14521///
14522/// ```test_harness,no_run
14523/// # extern crate hyper;
14524/// # extern crate hyper_rustls;
14525/// # extern crate google_run2 as run2;
14526/// # async fn dox() {
14527/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14528///
14529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14530/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14531/// #     .with_native_roots()
14532/// #     .unwrap()
14533/// #     .https_only()
14534/// #     .enable_http2()
14535/// #     .build();
14536///
14537/// # let executor = hyper_util::rt::TokioExecutor::new();
14538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14539/// #     secret,
14540/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14541/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14542/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14543/// #     ),
14544/// # ).build().await.unwrap();
14545///
14546/// # let client = hyper_util::client::legacy::Client::builder(
14547/// #     hyper_util::rt::TokioExecutor::new()
14548/// # )
14549/// # .build(
14550/// #     hyper_rustls::HttpsConnectorBuilder::new()
14551/// #         .with_native_roots()
14552/// #         .unwrap()
14553/// #         .https_or_http()
14554/// #         .enable_http2()
14555/// #         .build()
14556/// # );
14557/// # let mut hub = CloudRun::new(client, auth);
14558/// // You can configure optional parameters by calling the respective setters at will, and
14559/// // execute the final call using `doit()`.
14560/// // Values shown here are possibly random and not representative !
14561/// let result = hub.projects().locations_worker_pools_revisions_delete("name")
14562///              .validate_only(false)
14563///              .etag("elitr")
14564///              .doit().await;
14565/// # }
14566/// ```
14567pub struct ProjectLocationWorkerPoolRevisionDeleteCall<'a, C>
14568where
14569    C: 'a,
14570{
14571    hub: &'a CloudRun<C>,
14572    _name: String,
14573    _validate_only: Option<bool>,
14574    _etag: Option<String>,
14575    _delegate: Option<&'a mut dyn common::Delegate>,
14576    _additional_params: HashMap<String, String>,
14577    _scopes: BTreeSet<String>,
14578}
14579
14580impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {}
14581
14582impl<'a, C> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C>
14583where
14584    C: common::Connector,
14585{
14586    /// Perform the operation you have build so far.
14587    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
14588        use std::borrow::Cow;
14589        use std::io::{Read, Seek};
14590
14591        use common::{url::Params, ToParts};
14592        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14593
14594        let mut dd = common::DefaultDelegate;
14595        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14596        dlg.begin(common::MethodInfo {
14597            id: "run.projects.locations.workerPools.revisions.delete",
14598            http_method: hyper::Method::DELETE,
14599        });
14600
14601        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
14602            if self._additional_params.contains_key(field) {
14603                dlg.finished(false);
14604                return Err(common::Error::FieldClash(field));
14605            }
14606        }
14607
14608        let mut params = Params::with_capacity(5 + self._additional_params.len());
14609        params.push("name", self._name);
14610        if let Some(value) = self._validate_only.as_ref() {
14611            params.push("validateOnly", value.to_string());
14612        }
14613        if let Some(value) = self._etag.as_ref() {
14614            params.push("etag", value);
14615        }
14616
14617        params.extend(self._additional_params.iter());
14618
14619        params.push("alt", "json");
14620        let mut url = self.hub._base_url.clone() + "v2/{+name}";
14621        if self._scopes.is_empty() {
14622            self._scopes
14623                .insert(Scope::CloudPlatform.as_ref().to_string());
14624        }
14625
14626        #[allow(clippy::single_element_loop)]
14627        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14628            url = params.uri_replacement(url, param_name, find_this, true);
14629        }
14630        {
14631            let to_remove = ["name"];
14632            params.remove_params(&to_remove);
14633        }
14634
14635        let url = params.parse_with_url(&url);
14636
14637        loop {
14638            let token = match self
14639                .hub
14640                .auth
14641                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14642                .await
14643            {
14644                Ok(token) => token,
14645                Err(e) => match dlg.token(e) {
14646                    Ok(token) => token,
14647                    Err(e) => {
14648                        dlg.finished(false);
14649                        return Err(common::Error::MissingToken(e));
14650                    }
14651                },
14652            };
14653            let mut req_result = {
14654                let client = &self.hub.client;
14655                dlg.pre_request();
14656                let mut req_builder = hyper::Request::builder()
14657                    .method(hyper::Method::DELETE)
14658                    .uri(url.as_str())
14659                    .header(USER_AGENT, self.hub._user_agent.clone());
14660
14661                if let Some(token) = token.as_ref() {
14662                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14663                }
14664
14665                let request = req_builder
14666                    .header(CONTENT_LENGTH, 0_u64)
14667                    .body(common::to_body::<String>(None));
14668
14669                client.request(request.unwrap()).await
14670            };
14671
14672            match req_result {
14673                Err(err) => {
14674                    if let common::Retry::After(d) = dlg.http_error(&err) {
14675                        sleep(d).await;
14676                        continue;
14677                    }
14678                    dlg.finished(false);
14679                    return Err(common::Error::HttpError(err));
14680                }
14681                Ok(res) => {
14682                    let (mut parts, body) = res.into_parts();
14683                    let mut body = common::Body::new(body);
14684                    if !parts.status.is_success() {
14685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14686                        let error = serde_json::from_str(&common::to_string(&bytes));
14687                        let response = common::to_response(parts, bytes.into());
14688
14689                        if let common::Retry::After(d) =
14690                            dlg.http_failure(&response, error.as_ref().ok())
14691                        {
14692                            sleep(d).await;
14693                            continue;
14694                        }
14695
14696                        dlg.finished(false);
14697
14698                        return Err(match error {
14699                            Ok(value) => common::Error::BadRequest(value),
14700                            _ => common::Error::Failure(response),
14701                        });
14702                    }
14703                    let response = {
14704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14705                        let encoded = common::to_string(&bytes);
14706                        match serde_json::from_str(&encoded) {
14707                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14708                            Err(error) => {
14709                                dlg.response_json_decode_error(&encoded, &error);
14710                                return Err(common::Error::JsonDecodeError(
14711                                    encoded.to_string(),
14712                                    error,
14713                                ));
14714                            }
14715                        }
14716                    };
14717
14718                    dlg.finished(true);
14719                    return Ok(response);
14720                }
14721            }
14722        }
14723    }
14724
14725    /// Required. The name of the Revision to delete. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
14726    ///
14727    /// Sets the *name* path property to the given value.
14728    ///
14729    /// Even though the property as already been set when instantiating this call,
14730    /// we provide this method for API completeness.
14731    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
14732        self._name = new_value.to_string();
14733        self
14734    }
14735    /// Indicates that the request should be validated without actually deleting any resources.
14736    ///
14737    /// Sets the *validate only* query property to the given value.
14738    pub fn validate_only(
14739        mut self,
14740        new_value: bool,
14741    ) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
14742        self._validate_only = Some(new_value);
14743        self
14744    }
14745    /// A system-generated fingerprint for this version of the resource. This may be used to detect modification conflict during updates.
14746    ///
14747    /// Sets the *etag* query property to the given value.
14748    pub fn etag(mut self, new_value: &str) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
14749        self._etag = Some(new_value.to_string());
14750        self
14751    }
14752    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14753    /// while executing the actual API request.
14754    ///
14755    /// ````text
14756    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14757    /// ````
14758    ///
14759    /// Sets the *delegate* property to the given value.
14760    pub fn delegate(
14761        mut self,
14762        new_value: &'a mut dyn common::Delegate,
14763    ) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
14764        self._delegate = Some(new_value);
14765        self
14766    }
14767
14768    /// Set any additional parameter of the query string used in the request.
14769    /// It should be used to set parameters which are not yet available through their own
14770    /// setters.
14771    ///
14772    /// Please note that this method must not be used to set any of the known parameters
14773    /// which have their own setter method. If done anyway, the request will fail.
14774    ///
14775    /// # Additional Parameters
14776    ///
14777    /// * *$.xgafv* (query-string) - V1 error format.
14778    /// * *access_token* (query-string) - OAuth access token.
14779    /// * *alt* (query-string) - Data format for response.
14780    /// * *callback* (query-string) - JSONP
14781    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14782    /// * *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.
14783    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14784    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14785    /// * *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.
14786    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14787    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14788    pub fn param<T>(
14789        mut self,
14790        name: T,
14791        value: T,
14792    ) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C>
14793    where
14794        T: AsRef<str>,
14795    {
14796        self._additional_params
14797            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14798        self
14799    }
14800
14801    /// Identifies the authorization scope for the method you are building.
14802    ///
14803    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14804    /// [`Scope::CloudPlatform`].
14805    ///
14806    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14807    /// tokens for more than one scope.
14808    ///
14809    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14810    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14811    /// sufficient, a read-write scope will do as well.
14812    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C>
14813    where
14814        St: AsRef<str>,
14815    {
14816        self._scopes.insert(String::from(scope.as_ref()));
14817        self
14818    }
14819    /// Identifies the authorization scope(s) for the method you are building.
14820    ///
14821    /// See [`Self::add_scope()`] for details.
14822    pub fn add_scopes<I, St>(
14823        mut self,
14824        scopes: I,
14825    ) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C>
14826    where
14827        I: IntoIterator<Item = St>,
14828        St: AsRef<str>,
14829    {
14830        self._scopes
14831            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14832        self
14833    }
14834
14835    /// Removes all scopes, and no default scope will be used either.
14836    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14837    /// for details).
14838    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolRevisionDeleteCall<'a, C> {
14839        self._scopes.clear();
14840        self
14841    }
14842}
14843
14844/// Gets information about a Revision.
14845///
14846/// A builder for the *locations.workerPools.revisions.get* method supported by a *project* resource.
14847/// It is not used directly, but through a [`ProjectMethods`] instance.
14848///
14849/// # Example
14850///
14851/// Instantiate a resource method builder
14852///
14853/// ```test_harness,no_run
14854/// # extern crate hyper;
14855/// # extern crate hyper_rustls;
14856/// # extern crate google_run2 as run2;
14857/// # async fn dox() {
14858/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14859///
14860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14861/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14862/// #     .with_native_roots()
14863/// #     .unwrap()
14864/// #     .https_only()
14865/// #     .enable_http2()
14866/// #     .build();
14867///
14868/// # let executor = hyper_util::rt::TokioExecutor::new();
14869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14870/// #     secret,
14871/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14872/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14873/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14874/// #     ),
14875/// # ).build().await.unwrap();
14876///
14877/// # let client = hyper_util::client::legacy::Client::builder(
14878/// #     hyper_util::rt::TokioExecutor::new()
14879/// # )
14880/// # .build(
14881/// #     hyper_rustls::HttpsConnectorBuilder::new()
14882/// #         .with_native_roots()
14883/// #         .unwrap()
14884/// #         .https_or_http()
14885/// #         .enable_http2()
14886/// #         .build()
14887/// # );
14888/// # let mut hub = CloudRun::new(client, auth);
14889/// // You can configure optional parameters by calling the respective setters at will, and
14890/// // execute the final call using `doit()`.
14891/// // Values shown here are possibly random and not representative !
14892/// let result = hub.projects().locations_worker_pools_revisions_get("name")
14893///              .doit().await;
14894/// # }
14895/// ```
14896pub struct ProjectLocationWorkerPoolRevisionGetCall<'a, C>
14897where
14898    C: 'a,
14899{
14900    hub: &'a CloudRun<C>,
14901    _name: String,
14902    _delegate: Option<&'a mut dyn common::Delegate>,
14903    _additional_params: HashMap<String, String>,
14904    _scopes: BTreeSet<String>,
14905}
14906
14907impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolRevisionGetCall<'a, C> {}
14908
14909impl<'a, C> ProjectLocationWorkerPoolRevisionGetCall<'a, C>
14910where
14911    C: common::Connector,
14912{
14913    /// Perform the operation you have build so far.
14914    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Revision)> {
14915        use std::borrow::Cow;
14916        use std::io::{Read, Seek};
14917
14918        use common::{url::Params, ToParts};
14919        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14920
14921        let mut dd = common::DefaultDelegate;
14922        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14923        dlg.begin(common::MethodInfo {
14924            id: "run.projects.locations.workerPools.revisions.get",
14925            http_method: hyper::Method::GET,
14926        });
14927
14928        for &field in ["alt", "name"].iter() {
14929            if self._additional_params.contains_key(field) {
14930                dlg.finished(false);
14931                return Err(common::Error::FieldClash(field));
14932            }
14933        }
14934
14935        let mut params = Params::with_capacity(3 + self._additional_params.len());
14936        params.push("name", self._name);
14937
14938        params.extend(self._additional_params.iter());
14939
14940        params.push("alt", "json");
14941        let mut url = self.hub._base_url.clone() + "v2/{+name}";
14942        if self._scopes.is_empty() {
14943            self._scopes
14944                .insert(Scope::CloudPlatform.as_ref().to_string());
14945        }
14946
14947        #[allow(clippy::single_element_loop)]
14948        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14949            url = params.uri_replacement(url, param_name, find_this, true);
14950        }
14951        {
14952            let to_remove = ["name"];
14953            params.remove_params(&to_remove);
14954        }
14955
14956        let url = params.parse_with_url(&url);
14957
14958        loop {
14959            let token = match self
14960                .hub
14961                .auth
14962                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14963                .await
14964            {
14965                Ok(token) => token,
14966                Err(e) => match dlg.token(e) {
14967                    Ok(token) => token,
14968                    Err(e) => {
14969                        dlg.finished(false);
14970                        return Err(common::Error::MissingToken(e));
14971                    }
14972                },
14973            };
14974            let mut req_result = {
14975                let client = &self.hub.client;
14976                dlg.pre_request();
14977                let mut req_builder = hyper::Request::builder()
14978                    .method(hyper::Method::GET)
14979                    .uri(url.as_str())
14980                    .header(USER_AGENT, self.hub._user_agent.clone());
14981
14982                if let Some(token) = token.as_ref() {
14983                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14984                }
14985
14986                let request = req_builder
14987                    .header(CONTENT_LENGTH, 0_u64)
14988                    .body(common::to_body::<String>(None));
14989
14990                client.request(request.unwrap()).await
14991            };
14992
14993            match req_result {
14994                Err(err) => {
14995                    if let common::Retry::After(d) = dlg.http_error(&err) {
14996                        sleep(d).await;
14997                        continue;
14998                    }
14999                    dlg.finished(false);
15000                    return Err(common::Error::HttpError(err));
15001                }
15002                Ok(res) => {
15003                    let (mut parts, body) = res.into_parts();
15004                    let mut body = common::Body::new(body);
15005                    if !parts.status.is_success() {
15006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15007                        let error = serde_json::from_str(&common::to_string(&bytes));
15008                        let response = common::to_response(parts, bytes.into());
15009
15010                        if let common::Retry::After(d) =
15011                            dlg.http_failure(&response, error.as_ref().ok())
15012                        {
15013                            sleep(d).await;
15014                            continue;
15015                        }
15016
15017                        dlg.finished(false);
15018
15019                        return Err(match error {
15020                            Ok(value) => common::Error::BadRequest(value),
15021                            _ => common::Error::Failure(response),
15022                        });
15023                    }
15024                    let response = {
15025                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15026                        let encoded = common::to_string(&bytes);
15027                        match serde_json::from_str(&encoded) {
15028                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15029                            Err(error) => {
15030                                dlg.response_json_decode_error(&encoded, &error);
15031                                return Err(common::Error::JsonDecodeError(
15032                                    encoded.to_string(),
15033                                    error,
15034                                ));
15035                            }
15036                        }
15037                    };
15038
15039                    dlg.finished(true);
15040                    return Ok(response);
15041                }
15042            }
15043        }
15044    }
15045
15046    /// Required. The full name of the Revision. Format: projects/{project}/locations/{location}/services/{service}/revisions/{revision}
15047    ///
15048    /// Sets the *name* path property to the given value.
15049    ///
15050    /// Even though the property as already been set when instantiating this call,
15051    /// we provide this method for API completeness.
15052    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C> {
15053        self._name = new_value.to_string();
15054        self
15055    }
15056    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15057    /// while executing the actual API request.
15058    ///
15059    /// ````text
15060    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15061    /// ````
15062    ///
15063    /// Sets the *delegate* property to the given value.
15064    pub fn delegate(
15065        mut self,
15066        new_value: &'a mut dyn common::Delegate,
15067    ) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C> {
15068        self._delegate = Some(new_value);
15069        self
15070    }
15071
15072    /// Set any additional parameter of the query string used in the request.
15073    /// It should be used to set parameters which are not yet available through their own
15074    /// setters.
15075    ///
15076    /// Please note that this method must not be used to set any of the known parameters
15077    /// which have their own setter method. If done anyway, the request will fail.
15078    ///
15079    /// # Additional Parameters
15080    ///
15081    /// * *$.xgafv* (query-string) - V1 error format.
15082    /// * *access_token* (query-string) - OAuth access token.
15083    /// * *alt* (query-string) - Data format for response.
15084    /// * *callback* (query-string) - JSONP
15085    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15086    /// * *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.
15087    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15088    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15089    /// * *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.
15090    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15091    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15092    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C>
15093    where
15094        T: AsRef<str>,
15095    {
15096        self._additional_params
15097            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15098        self
15099    }
15100
15101    /// Identifies the authorization scope for the method you are building.
15102    ///
15103    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15104    /// [`Scope::CloudPlatform`].
15105    ///
15106    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15107    /// tokens for more than one scope.
15108    ///
15109    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15110    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15111    /// sufficient, a read-write scope will do as well.
15112    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C>
15113    where
15114        St: AsRef<str>,
15115    {
15116        self._scopes.insert(String::from(scope.as_ref()));
15117        self
15118    }
15119    /// Identifies the authorization scope(s) for the method you are building.
15120    ///
15121    /// See [`Self::add_scope()`] for details.
15122    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C>
15123    where
15124        I: IntoIterator<Item = St>,
15125        St: AsRef<str>,
15126    {
15127        self._scopes
15128            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15129        self
15130    }
15131
15132    /// Removes all scopes, and no default scope will be used either.
15133    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15134    /// for details).
15135    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolRevisionGetCall<'a, C> {
15136        self._scopes.clear();
15137        self
15138    }
15139}
15140
15141/// Lists Revisions from a given Service, or from a given location. Results are sorted by creation time, descending.
15142///
15143/// A builder for the *locations.workerPools.revisions.list* method supported by a *project* resource.
15144/// It is not used directly, but through a [`ProjectMethods`] instance.
15145///
15146/// # Example
15147///
15148/// Instantiate a resource method builder
15149///
15150/// ```test_harness,no_run
15151/// # extern crate hyper;
15152/// # extern crate hyper_rustls;
15153/// # extern crate google_run2 as run2;
15154/// # async fn dox() {
15155/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15156///
15157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15158/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15159/// #     .with_native_roots()
15160/// #     .unwrap()
15161/// #     .https_only()
15162/// #     .enable_http2()
15163/// #     .build();
15164///
15165/// # let executor = hyper_util::rt::TokioExecutor::new();
15166/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15167/// #     secret,
15168/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15169/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15170/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15171/// #     ),
15172/// # ).build().await.unwrap();
15173///
15174/// # let client = hyper_util::client::legacy::Client::builder(
15175/// #     hyper_util::rt::TokioExecutor::new()
15176/// # )
15177/// # .build(
15178/// #     hyper_rustls::HttpsConnectorBuilder::new()
15179/// #         .with_native_roots()
15180/// #         .unwrap()
15181/// #         .https_or_http()
15182/// #         .enable_http2()
15183/// #         .build()
15184/// # );
15185/// # let mut hub = CloudRun::new(client, auth);
15186/// // You can configure optional parameters by calling the respective setters at will, and
15187/// // execute the final call using `doit()`.
15188/// // Values shown here are possibly random and not representative !
15189/// let result = hub.projects().locations_worker_pools_revisions_list("parent")
15190///              .show_deleted(false)
15191///              .page_token("At")
15192///              .page_size(-45)
15193///              .doit().await;
15194/// # }
15195/// ```
15196pub struct ProjectLocationWorkerPoolRevisionListCall<'a, C>
15197where
15198    C: 'a,
15199{
15200    hub: &'a CloudRun<C>,
15201    _parent: String,
15202    _show_deleted: Option<bool>,
15203    _page_token: Option<String>,
15204    _page_size: Option<i32>,
15205    _delegate: Option<&'a mut dyn common::Delegate>,
15206    _additional_params: HashMap<String, String>,
15207    _scopes: BTreeSet<String>,
15208}
15209
15210impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolRevisionListCall<'a, C> {}
15211
15212impl<'a, C> ProjectLocationWorkerPoolRevisionListCall<'a, C>
15213where
15214    C: common::Connector,
15215{
15216    /// Perform the operation you have build so far.
15217    pub async fn doit(
15218        mut self,
15219    ) -> common::Result<(common::Response, GoogleCloudRunV2ListRevisionsResponse)> {
15220        use std::borrow::Cow;
15221        use std::io::{Read, Seek};
15222
15223        use common::{url::Params, ToParts};
15224        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15225
15226        let mut dd = common::DefaultDelegate;
15227        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15228        dlg.begin(common::MethodInfo {
15229            id: "run.projects.locations.workerPools.revisions.list",
15230            http_method: hyper::Method::GET,
15231        });
15232
15233        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
15234            if self._additional_params.contains_key(field) {
15235                dlg.finished(false);
15236                return Err(common::Error::FieldClash(field));
15237            }
15238        }
15239
15240        let mut params = Params::with_capacity(6 + self._additional_params.len());
15241        params.push("parent", self._parent);
15242        if let Some(value) = self._show_deleted.as_ref() {
15243            params.push("showDeleted", value.to_string());
15244        }
15245        if let Some(value) = self._page_token.as_ref() {
15246            params.push("pageToken", value);
15247        }
15248        if let Some(value) = self._page_size.as_ref() {
15249            params.push("pageSize", value.to_string());
15250        }
15251
15252        params.extend(self._additional_params.iter());
15253
15254        params.push("alt", "json");
15255        let mut url = self.hub._base_url.clone() + "v2/{+parent}/revisions";
15256        if self._scopes.is_empty() {
15257            self._scopes
15258                .insert(Scope::CloudPlatform.as_ref().to_string());
15259        }
15260
15261        #[allow(clippy::single_element_loop)]
15262        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15263            url = params.uri_replacement(url, param_name, find_this, true);
15264        }
15265        {
15266            let to_remove = ["parent"];
15267            params.remove_params(&to_remove);
15268        }
15269
15270        let url = params.parse_with_url(&url);
15271
15272        loop {
15273            let token = match self
15274                .hub
15275                .auth
15276                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15277                .await
15278            {
15279                Ok(token) => token,
15280                Err(e) => match dlg.token(e) {
15281                    Ok(token) => token,
15282                    Err(e) => {
15283                        dlg.finished(false);
15284                        return Err(common::Error::MissingToken(e));
15285                    }
15286                },
15287            };
15288            let mut req_result = {
15289                let client = &self.hub.client;
15290                dlg.pre_request();
15291                let mut req_builder = hyper::Request::builder()
15292                    .method(hyper::Method::GET)
15293                    .uri(url.as_str())
15294                    .header(USER_AGENT, self.hub._user_agent.clone());
15295
15296                if let Some(token) = token.as_ref() {
15297                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15298                }
15299
15300                let request = req_builder
15301                    .header(CONTENT_LENGTH, 0_u64)
15302                    .body(common::to_body::<String>(None));
15303
15304                client.request(request.unwrap()).await
15305            };
15306
15307            match req_result {
15308                Err(err) => {
15309                    if let common::Retry::After(d) = dlg.http_error(&err) {
15310                        sleep(d).await;
15311                        continue;
15312                    }
15313                    dlg.finished(false);
15314                    return Err(common::Error::HttpError(err));
15315                }
15316                Ok(res) => {
15317                    let (mut parts, body) = res.into_parts();
15318                    let mut body = common::Body::new(body);
15319                    if !parts.status.is_success() {
15320                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15321                        let error = serde_json::from_str(&common::to_string(&bytes));
15322                        let response = common::to_response(parts, bytes.into());
15323
15324                        if let common::Retry::After(d) =
15325                            dlg.http_failure(&response, error.as_ref().ok())
15326                        {
15327                            sleep(d).await;
15328                            continue;
15329                        }
15330
15331                        dlg.finished(false);
15332
15333                        return Err(match error {
15334                            Ok(value) => common::Error::BadRequest(value),
15335                            _ => common::Error::Failure(response),
15336                        });
15337                    }
15338                    let response = {
15339                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15340                        let encoded = common::to_string(&bytes);
15341                        match serde_json::from_str(&encoded) {
15342                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15343                            Err(error) => {
15344                                dlg.response_json_decode_error(&encoded, &error);
15345                                return Err(common::Error::JsonDecodeError(
15346                                    encoded.to_string(),
15347                                    error,
15348                                ));
15349                            }
15350                        }
15351                    };
15352
15353                    dlg.finished(true);
15354                    return Ok(response);
15355                }
15356            }
15357        }
15358    }
15359
15360    /// Required. The Service from which the Revisions should be listed. To list all Revisions across Services, use "-" instead of Service name. Format: projects/{project}/locations/{location}/services/{service}
15361    ///
15362    /// Sets the *parent* path property to the given value.
15363    ///
15364    /// Even though the property as already been set when instantiating this call,
15365    /// we provide this method for API completeness.
15366    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15367        self._parent = new_value.to_string();
15368        self
15369    }
15370    /// If true, returns deleted (but unexpired) resources along with active ones.
15371    ///
15372    /// Sets the *show deleted* query property to the given value.
15373    pub fn show_deleted(
15374        mut self,
15375        new_value: bool,
15376    ) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15377        self._show_deleted = Some(new_value);
15378        self
15379    }
15380    /// A page token received from a previous call to ListRevisions. All other parameters must match.
15381    ///
15382    /// Sets the *page token* query property to the given value.
15383    pub fn page_token(
15384        mut self,
15385        new_value: &str,
15386    ) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15387        self._page_token = Some(new_value.to_string());
15388        self
15389    }
15390    /// Maximum number of revisions to return in this call.
15391    ///
15392    /// Sets the *page size* query property to the given value.
15393    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15394        self._page_size = Some(new_value);
15395        self
15396    }
15397    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15398    /// while executing the actual API request.
15399    ///
15400    /// ````text
15401    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15402    /// ````
15403    ///
15404    /// Sets the *delegate* property to the given value.
15405    pub fn delegate(
15406        mut self,
15407        new_value: &'a mut dyn common::Delegate,
15408    ) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15409        self._delegate = Some(new_value);
15410        self
15411    }
15412
15413    /// Set any additional parameter of the query string used in the request.
15414    /// It should be used to set parameters which are not yet available through their own
15415    /// setters.
15416    ///
15417    /// Please note that this method must not be used to set any of the known parameters
15418    /// which have their own setter method. If done anyway, the request will fail.
15419    ///
15420    /// # Additional Parameters
15421    ///
15422    /// * *$.xgafv* (query-string) - V1 error format.
15423    /// * *access_token* (query-string) - OAuth access token.
15424    /// * *alt* (query-string) - Data format for response.
15425    /// * *callback* (query-string) - JSONP
15426    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15427    /// * *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.
15428    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15429    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15430    /// * *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.
15431    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15432    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15433    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolRevisionListCall<'a, C>
15434    where
15435        T: AsRef<str>,
15436    {
15437        self._additional_params
15438            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15439        self
15440    }
15441
15442    /// Identifies the authorization scope for the method you are building.
15443    ///
15444    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15445    /// [`Scope::CloudPlatform`].
15446    ///
15447    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15448    /// tokens for more than one scope.
15449    ///
15450    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15451    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15452    /// sufficient, a read-write scope will do as well.
15453    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolRevisionListCall<'a, C>
15454    where
15455        St: AsRef<str>,
15456    {
15457        self._scopes.insert(String::from(scope.as_ref()));
15458        self
15459    }
15460    /// Identifies the authorization scope(s) for the method you are building.
15461    ///
15462    /// See [`Self::add_scope()`] for details.
15463    pub fn add_scopes<I, St>(
15464        mut self,
15465        scopes: I,
15466    ) -> ProjectLocationWorkerPoolRevisionListCall<'a, C>
15467    where
15468        I: IntoIterator<Item = St>,
15469        St: AsRef<str>,
15470    {
15471        self._scopes
15472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15473        self
15474    }
15475
15476    /// Removes all scopes, and no default scope will be used either.
15477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15478    /// for details).
15479    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolRevisionListCall<'a, C> {
15480        self._scopes.clear();
15481        self
15482    }
15483}
15484
15485/// Creates a new WorkerPool in a given project and location.
15486///
15487/// A builder for the *locations.workerPools.create* method supported by a *project* resource.
15488/// It is not used directly, but through a [`ProjectMethods`] instance.
15489///
15490/// # Example
15491///
15492/// Instantiate a resource method builder
15493///
15494/// ```test_harness,no_run
15495/// # extern crate hyper;
15496/// # extern crate hyper_rustls;
15497/// # extern crate google_run2 as run2;
15498/// use run2::api::GoogleCloudRunV2WorkerPool;
15499/// # async fn dox() {
15500/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15501///
15502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15503/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15504/// #     .with_native_roots()
15505/// #     .unwrap()
15506/// #     .https_only()
15507/// #     .enable_http2()
15508/// #     .build();
15509///
15510/// # let executor = hyper_util::rt::TokioExecutor::new();
15511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15512/// #     secret,
15513/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15514/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15515/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15516/// #     ),
15517/// # ).build().await.unwrap();
15518///
15519/// # let client = hyper_util::client::legacy::Client::builder(
15520/// #     hyper_util::rt::TokioExecutor::new()
15521/// # )
15522/// # .build(
15523/// #     hyper_rustls::HttpsConnectorBuilder::new()
15524/// #         .with_native_roots()
15525/// #         .unwrap()
15526/// #         .https_or_http()
15527/// #         .enable_http2()
15528/// #         .build()
15529/// # );
15530/// # let mut hub = CloudRun::new(client, auth);
15531/// // As the method needs a request, you would usually fill it with the desired information
15532/// // into the respective structure. Some of the parts shown here might not be applicable !
15533/// // Values shown here are possibly random and not representative !
15534/// let mut req = GoogleCloudRunV2WorkerPool::default();
15535///
15536/// // You can configure optional parameters by calling the respective setters at will, and
15537/// // execute the final call using `doit()`.
15538/// // Values shown here are possibly random and not representative !
15539/// let result = hub.projects().locations_worker_pools_create(req, "parent")
15540///              .worker_pool_id("dolores")
15541///              .validate_only(false)
15542///              .doit().await;
15543/// # }
15544/// ```
15545pub struct ProjectLocationWorkerPoolCreateCall<'a, C>
15546where
15547    C: 'a,
15548{
15549    hub: &'a CloudRun<C>,
15550    _request: GoogleCloudRunV2WorkerPool,
15551    _parent: String,
15552    _worker_pool_id: Option<String>,
15553    _validate_only: Option<bool>,
15554    _delegate: Option<&'a mut dyn common::Delegate>,
15555    _additional_params: HashMap<String, String>,
15556    _scopes: BTreeSet<String>,
15557}
15558
15559impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolCreateCall<'a, C> {}
15560
15561impl<'a, C> ProjectLocationWorkerPoolCreateCall<'a, C>
15562where
15563    C: common::Connector,
15564{
15565    /// Perform the operation you have build so far.
15566    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
15567        use std::borrow::Cow;
15568        use std::io::{Read, Seek};
15569
15570        use common::{url::Params, ToParts};
15571        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15572
15573        let mut dd = common::DefaultDelegate;
15574        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15575        dlg.begin(common::MethodInfo {
15576            id: "run.projects.locations.workerPools.create",
15577            http_method: hyper::Method::POST,
15578        });
15579
15580        for &field in ["alt", "parent", "workerPoolId", "validateOnly"].iter() {
15581            if self._additional_params.contains_key(field) {
15582                dlg.finished(false);
15583                return Err(common::Error::FieldClash(field));
15584            }
15585        }
15586
15587        let mut params = Params::with_capacity(6 + self._additional_params.len());
15588        params.push("parent", self._parent);
15589        if let Some(value) = self._worker_pool_id.as_ref() {
15590            params.push("workerPoolId", value);
15591        }
15592        if let Some(value) = self._validate_only.as_ref() {
15593            params.push("validateOnly", value.to_string());
15594        }
15595
15596        params.extend(self._additional_params.iter());
15597
15598        params.push("alt", "json");
15599        let mut url = self.hub._base_url.clone() + "v2/{+parent}/workerPools";
15600        if self._scopes.is_empty() {
15601            self._scopes
15602                .insert(Scope::CloudPlatform.as_ref().to_string());
15603        }
15604
15605        #[allow(clippy::single_element_loop)]
15606        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15607            url = params.uri_replacement(url, param_name, find_this, true);
15608        }
15609        {
15610            let to_remove = ["parent"];
15611            params.remove_params(&to_remove);
15612        }
15613
15614        let url = params.parse_with_url(&url);
15615
15616        let mut json_mime_type = mime::APPLICATION_JSON;
15617        let mut request_value_reader = {
15618            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15619            common::remove_json_null_values(&mut value);
15620            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15621            serde_json::to_writer(&mut dst, &value).unwrap();
15622            dst
15623        };
15624        let request_size = request_value_reader
15625            .seek(std::io::SeekFrom::End(0))
15626            .unwrap();
15627        request_value_reader
15628            .seek(std::io::SeekFrom::Start(0))
15629            .unwrap();
15630
15631        loop {
15632            let token = match self
15633                .hub
15634                .auth
15635                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15636                .await
15637            {
15638                Ok(token) => token,
15639                Err(e) => match dlg.token(e) {
15640                    Ok(token) => token,
15641                    Err(e) => {
15642                        dlg.finished(false);
15643                        return Err(common::Error::MissingToken(e));
15644                    }
15645                },
15646            };
15647            request_value_reader
15648                .seek(std::io::SeekFrom::Start(0))
15649                .unwrap();
15650            let mut req_result = {
15651                let client = &self.hub.client;
15652                dlg.pre_request();
15653                let mut req_builder = hyper::Request::builder()
15654                    .method(hyper::Method::POST)
15655                    .uri(url.as_str())
15656                    .header(USER_AGENT, self.hub._user_agent.clone());
15657
15658                if let Some(token) = token.as_ref() {
15659                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15660                }
15661
15662                let request = req_builder
15663                    .header(CONTENT_TYPE, json_mime_type.to_string())
15664                    .header(CONTENT_LENGTH, request_size as u64)
15665                    .body(common::to_body(
15666                        request_value_reader.get_ref().clone().into(),
15667                    ));
15668
15669                client.request(request.unwrap()).await
15670            };
15671
15672            match req_result {
15673                Err(err) => {
15674                    if let common::Retry::After(d) = dlg.http_error(&err) {
15675                        sleep(d).await;
15676                        continue;
15677                    }
15678                    dlg.finished(false);
15679                    return Err(common::Error::HttpError(err));
15680                }
15681                Ok(res) => {
15682                    let (mut parts, body) = res.into_parts();
15683                    let mut body = common::Body::new(body);
15684                    if !parts.status.is_success() {
15685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15686                        let error = serde_json::from_str(&common::to_string(&bytes));
15687                        let response = common::to_response(parts, bytes.into());
15688
15689                        if let common::Retry::After(d) =
15690                            dlg.http_failure(&response, error.as_ref().ok())
15691                        {
15692                            sleep(d).await;
15693                            continue;
15694                        }
15695
15696                        dlg.finished(false);
15697
15698                        return Err(match error {
15699                            Ok(value) => common::Error::BadRequest(value),
15700                            _ => common::Error::Failure(response),
15701                        });
15702                    }
15703                    let response = {
15704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15705                        let encoded = common::to_string(&bytes);
15706                        match serde_json::from_str(&encoded) {
15707                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15708                            Err(error) => {
15709                                dlg.response_json_decode_error(&encoded, &error);
15710                                return Err(common::Error::JsonDecodeError(
15711                                    encoded.to_string(),
15712                                    error,
15713                                ));
15714                            }
15715                        }
15716                    };
15717
15718                    dlg.finished(true);
15719                    return Ok(response);
15720                }
15721            }
15722        }
15723    }
15724
15725    ///
15726    /// Sets the *request* property to the given value.
15727    ///
15728    /// Even though the property as already been set when instantiating this call,
15729    /// we provide this method for API completeness.
15730    pub fn request(
15731        mut self,
15732        new_value: GoogleCloudRunV2WorkerPool,
15733    ) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15734        self._request = new_value;
15735        self
15736    }
15737    /// Required. The location and project in which this worker pool should be created. Format: `projects/{project}/locations/{location}`, where `{project}` can be project id or number. Only lowercase characters, digits, and hyphens.
15738    ///
15739    /// Sets the *parent* path property to the given value.
15740    ///
15741    /// Even though the property as already been set when instantiating this call,
15742    /// we provide this method for API completeness.
15743    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15744        self._parent = new_value.to_string();
15745        self
15746    }
15747    /// Required. The unique identifier for the WorkerPool. It must begin with letter, and cannot end with hyphen; must contain fewer than 50 characters. The name of the worker pool becomes `{parent}/workerPools/{worker_pool_id}`.
15748    ///
15749    /// Sets the *worker pool id* query property to the given value.
15750    pub fn worker_pool_id(mut self, new_value: &str) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15751        self._worker_pool_id = Some(new_value.to_string());
15752        self
15753    }
15754    /// Optional. Indicates that the request should be validated and default values populated, without persisting the request or creating any resources.
15755    ///
15756    /// Sets the *validate only* query property to the given value.
15757    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15758        self._validate_only = Some(new_value);
15759        self
15760    }
15761    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15762    /// while executing the actual API request.
15763    ///
15764    /// ````text
15765    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15766    /// ````
15767    ///
15768    /// Sets the *delegate* property to the given value.
15769    pub fn delegate(
15770        mut self,
15771        new_value: &'a mut dyn common::Delegate,
15772    ) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15773        self._delegate = Some(new_value);
15774        self
15775    }
15776
15777    /// Set any additional parameter of the query string used in the request.
15778    /// It should be used to set parameters which are not yet available through their own
15779    /// setters.
15780    ///
15781    /// Please note that this method must not be used to set any of the known parameters
15782    /// which have their own setter method. If done anyway, the request will fail.
15783    ///
15784    /// # Additional Parameters
15785    ///
15786    /// * *$.xgafv* (query-string) - V1 error format.
15787    /// * *access_token* (query-string) - OAuth access token.
15788    /// * *alt* (query-string) - Data format for response.
15789    /// * *callback* (query-string) - JSONP
15790    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15791    /// * *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.
15792    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15793    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15794    /// * *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.
15795    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15796    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15797    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolCreateCall<'a, C>
15798    where
15799        T: AsRef<str>,
15800    {
15801        self._additional_params
15802            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15803        self
15804    }
15805
15806    /// Identifies the authorization scope for the method you are building.
15807    ///
15808    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15809    /// [`Scope::CloudPlatform`].
15810    ///
15811    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15812    /// tokens for more than one scope.
15813    ///
15814    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15815    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15816    /// sufficient, a read-write scope will do as well.
15817    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolCreateCall<'a, C>
15818    where
15819        St: AsRef<str>,
15820    {
15821        self._scopes.insert(String::from(scope.as_ref()));
15822        self
15823    }
15824    /// Identifies the authorization scope(s) for the method you are building.
15825    ///
15826    /// See [`Self::add_scope()`] for details.
15827    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolCreateCall<'a, C>
15828    where
15829        I: IntoIterator<Item = St>,
15830        St: AsRef<str>,
15831    {
15832        self._scopes
15833            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15834        self
15835    }
15836
15837    /// Removes all scopes, and no default scope will be used either.
15838    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15839    /// for details).
15840    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolCreateCall<'a, C> {
15841        self._scopes.clear();
15842        self
15843    }
15844}
15845
15846/// Deletes a WorkerPool.
15847///
15848/// A builder for the *locations.workerPools.delete* method supported by a *project* resource.
15849/// It is not used directly, but through a [`ProjectMethods`] instance.
15850///
15851/// # Example
15852///
15853/// Instantiate a resource method builder
15854///
15855/// ```test_harness,no_run
15856/// # extern crate hyper;
15857/// # extern crate hyper_rustls;
15858/// # extern crate google_run2 as run2;
15859/// # async fn dox() {
15860/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15861///
15862/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15863/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15864/// #     .with_native_roots()
15865/// #     .unwrap()
15866/// #     .https_only()
15867/// #     .enable_http2()
15868/// #     .build();
15869///
15870/// # let executor = hyper_util::rt::TokioExecutor::new();
15871/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15872/// #     secret,
15873/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15874/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15875/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15876/// #     ),
15877/// # ).build().await.unwrap();
15878///
15879/// # let client = hyper_util::client::legacy::Client::builder(
15880/// #     hyper_util::rt::TokioExecutor::new()
15881/// # )
15882/// # .build(
15883/// #     hyper_rustls::HttpsConnectorBuilder::new()
15884/// #         .with_native_roots()
15885/// #         .unwrap()
15886/// #         .https_or_http()
15887/// #         .enable_http2()
15888/// #         .build()
15889/// # );
15890/// # let mut hub = CloudRun::new(client, auth);
15891/// // You can configure optional parameters by calling the respective setters at will, and
15892/// // execute the final call using `doit()`.
15893/// // Values shown here are possibly random and not representative !
15894/// let result = hub.projects().locations_worker_pools_delete("name")
15895///              .validate_only(false)
15896///              .etag("amet")
15897///              .doit().await;
15898/// # }
15899/// ```
15900pub struct ProjectLocationWorkerPoolDeleteCall<'a, C>
15901where
15902    C: 'a,
15903{
15904    hub: &'a CloudRun<C>,
15905    _name: String,
15906    _validate_only: Option<bool>,
15907    _etag: Option<String>,
15908    _delegate: Option<&'a mut dyn common::Delegate>,
15909    _additional_params: HashMap<String, String>,
15910    _scopes: BTreeSet<String>,
15911}
15912
15913impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolDeleteCall<'a, C> {}
15914
15915impl<'a, C> ProjectLocationWorkerPoolDeleteCall<'a, C>
15916where
15917    C: common::Connector,
15918{
15919    /// Perform the operation you have build so far.
15920    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
15921        use std::borrow::Cow;
15922        use std::io::{Read, Seek};
15923
15924        use common::{url::Params, ToParts};
15925        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15926
15927        let mut dd = common::DefaultDelegate;
15928        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15929        dlg.begin(common::MethodInfo {
15930            id: "run.projects.locations.workerPools.delete",
15931            http_method: hyper::Method::DELETE,
15932        });
15933
15934        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
15935            if self._additional_params.contains_key(field) {
15936                dlg.finished(false);
15937                return Err(common::Error::FieldClash(field));
15938            }
15939        }
15940
15941        let mut params = Params::with_capacity(5 + self._additional_params.len());
15942        params.push("name", self._name);
15943        if let Some(value) = self._validate_only.as_ref() {
15944            params.push("validateOnly", value.to_string());
15945        }
15946        if let Some(value) = self._etag.as_ref() {
15947            params.push("etag", value);
15948        }
15949
15950        params.extend(self._additional_params.iter());
15951
15952        params.push("alt", "json");
15953        let mut url = self.hub._base_url.clone() + "v2/{+name}";
15954        if self._scopes.is_empty() {
15955            self._scopes
15956                .insert(Scope::CloudPlatform.as_ref().to_string());
15957        }
15958
15959        #[allow(clippy::single_element_loop)]
15960        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15961            url = params.uri_replacement(url, param_name, find_this, true);
15962        }
15963        {
15964            let to_remove = ["name"];
15965            params.remove_params(&to_remove);
15966        }
15967
15968        let url = params.parse_with_url(&url);
15969
15970        loop {
15971            let token = match self
15972                .hub
15973                .auth
15974                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15975                .await
15976            {
15977                Ok(token) => token,
15978                Err(e) => match dlg.token(e) {
15979                    Ok(token) => token,
15980                    Err(e) => {
15981                        dlg.finished(false);
15982                        return Err(common::Error::MissingToken(e));
15983                    }
15984                },
15985            };
15986            let mut req_result = {
15987                let client = &self.hub.client;
15988                dlg.pre_request();
15989                let mut req_builder = hyper::Request::builder()
15990                    .method(hyper::Method::DELETE)
15991                    .uri(url.as_str())
15992                    .header(USER_AGENT, self.hub._user_agent.clone());
15993
15994                if let Some(token) = token.as_ref() {
15995                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15996                }
15997
15998                let request = req_builder
15999                    .header(CONTENT_LENGTH, 0_u64)
16000                    .body(common::to_body::<String>(None));
16001
16002                client.request(request.unwrap()).await
16003            };
16004
16005            match req_result {
16006                Err(err) => {
16007                    if let common::Retry::After(d) = dlg.http_error(&err) {
16008                        sleep(d).await;
16009                        continue;
16010                    }
16011                    dlg.finished(false);
16012                    return Err(common::Error::HttpError(err));
16013                }
16014                Ok(res) => {
16015                    let (mut parts, body) = res.into_parts();
16016                    let mut body = common::Body::new(body);
16017                    if !parts.status.is_success() {
16018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16019                        let error = serde_json::from_str(&common::to_string(&bytes));
16020                        let response = common::to_response(parts, bytes.into());
16021
16022                        if let common::Retry::After(d) =
16023                            dlg.http_failure(&response, error.as_ref().ok())
16024                        {
16025                            sleep(d).await;
16026                            continue;
16027                        }
16028
16029                        dlg.finished(false);
16030
16031                        return Err(match error {
16032                            Ok(value) => common::Error::BadRequest(value),
16033                            _ => common::Error::Failure(response),
16034                        });
16035                    }
16036                    let response = {
16037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16038                        let encoded = common::to_string(&bytes);
16039                        match serde_json::from_str(&encoded) {
16040                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16041                            Err(error) => {
16042                                dlg.response_json_decode_error(&encoded, &error);
16043                                return Err(common::Error::JsonDecodeError(
16044                                    encoded.to_string(),
16045                                    error,
16046                                ));
16047                            }
16048                        }
16049                    };
16050
16051                    dlg.finished(true);
16052                    return Ok(response);
16053                }
16054            }
16055        }
16056    }
16057
16058    /// Required. The full name of the WorkerPool. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where `{project}` can be project id or number.
16059    ///
16060    /// Sets the *name* path property to the given value.
16061    ///
16062    /// Even though the property as already been set when instantiating this call,
16063    /// we provide this method for API completeness.
16064    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
16065        self._name = new_value.to_string();
16066        self
16067    }
16068    /// Optional. Indicates that the request should be validated without actually deleting any resources.
16069    ///
16070    /// Sets the *validate only* query property to the given value.
16071    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
16072        self._validate_only = Some(new_value);
16073        self
16074    }
16075    /// A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
16076    ///
16077    /// Sets the *etag* query property to the given value.
16078    pub fn etag(mut self, new_value: &str) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
16079        self._etag = Some(new_value.to_string());
16080        self
16081    }
16082    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16083    /// while executing the actual API request.
16084    ///
16085    /// ````text
16086    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16087    /// ````
16088    ///
16089    /// Sets the *delegate* property to the given value.
16090    pub fn delegate(
16091        mut self,
16092        new_value: &'a mut dyn common::Delegate,
16093    ) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
16094        self._delegate = Some(new_value);
16095        self
16096    }
16097
16098    /// Set any additional parameter of the query string used in the request.
16099    /// It should be used to set parameters which are not yet available through their own
16100    /// setters.
16101    ///
16102    /// Please note that this method must not be used to set any of the known parameters
16103    /// which have their own setter method. If done anyway, the request will fail.
16104    ///
16105    /// # Additional Parameters
16106    ///
16107    /// * *$.xgafv* (query-string) - V1 error format.
16108    /// * *access_token* (query-string) - OAuth access token.
16109    /// * *alt* (query-string) - Data format for response.
16110    /// * *callback* (query-string) - JSONP
16111    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16112    /// * *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.
16113    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16114    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16115    /// * *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.
16116    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16117    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16118    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolDeleteCall<'a, C>
16119    where
16120        T: AsRef<str>,
16121    {
16122        self._additional_params
16123            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16124        self
16125    }
16126
16127    /// Identifies the authorization scope for the method you are building.
16128    ///
16129    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16130    /// [`Scope::CloudPlatform`].
16131    ///
16132    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16133    /// tokens for more than one scope.
16134    ///
16135    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16136    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16137    /// sufficient, a read-write scope will do as well.
16138    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolDeleteCall<'a, C>
16139    where
16140        St: AsRef<str>,
16141    {
16142        self._scopes.insert(String::from(scope.as_ref()));
16143        self
16144    }
16145    /// Identifies the authorization scope(s) for the method you are building.
16146    ///
16147    /// See [`Self::add_scope()`] for details.
16148    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolDeleteCall<'a, C>
16149    where
16150        I: IntoIterator<Item = St>,
16151        St: AsRef<str>,
16152    {
16153        self._scopes
16154            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16155        self
16156    }
16157
16158    /// Removes all scopes, and no default scope will be used either.
16159    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16160    /// for details).
16161    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolDeleteCall<'a, C> {
16162        self._scopes.clear();
16163        self
16164    }
16165}
16166
16167/// Gets information about a WorkerPool.
16168///
16169/// A builder for the *locations.workerPools.get* method supported by a *project* resource.
16170/// It is not used directly, but through a [`ProjectMethods`] instance.
16171///
16172/// # Example
16173///
16174/// Instantiate a resource method builder
16175///
16176/// ```test_harness,no_run
16177/// # extern crate hyper;
16178/// # extern crate hyper_rustls;
16179/// # extern crate google_run2 as run2;
16180/// # async fn dox() {
16181/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16182///
16183/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16184/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16185/// #     .with_native_roots()
16186/// #     .unwrap()
16187/// #     .https_only()
16188/// #     .enable_http2()
16189/// #     .build();
16190///
16191/// # let executor = hyper_util::rt::TokioExecutor::new();
16192/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16193/// #     secret,
16194/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16195/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16196/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16197/// #     ),
16198/// # ).build().await.unwrap();
16199///
16200/// # let client = hyper_util::client::legacy::Client::builder(
16201/// #     hyper_util::rt::TokioExecutor::new()
16202/// # )
16203/// # .build(
16204/// #     hyper_rustls::HttpsConnectorBuilder::new()
16205/// #         .with_native_roots()
16206/// #         .unwrap()
16207/// #         .https_or_http()
16208/// #         .enable_http2()
16209/// #         .build()
16210/// # );
16211/// # let mut hub = CloudRun::new(client, auth);
16212/// // You can configure optional parameters by calling the respective setters at will, and
16213/// // execute the final call using `doit()`.
16214/// // Values shown here are possibly random and not representative !
16215/// let result = hub.projects().locations_worker_pools_get("name")
16216///              .doit().await;
16217/// # }
16218/// ```
16219pub struct ProjectLocationWorkerPoolGetCall<'a, C>
16220where
16221    C: 'a,
16222{
16223    hub: &'a CloudRun<C>,
16224    _name: String,
16225    _delegate: Option<&'a mut dyn common::Delegate>,
16226    _additional_params: HashMap<String, String>,
16227    _scopes: BTreeSet<String>,
16228}
16229
16230impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolGetCall<'a, C> {}
16231
16232impl<'a, C> ProjectLocationWorkerPoolGetCall<'a, C>
16233where
16234    C: common::Connector,
16235{
16236    /// Perform the operation you have build so far.
16237    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2WorkerPool)> {
16238        use std::borrow::Cow;
16239        use std::io::{Read, Seek};
16240
16241        use common::{url::Params, ToParts};
16242        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16243
16244        let mut dd = common::DefaultDelegate;
16245        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16246        dlg.begin(common::MethodInfo {
16247            id: "run.projects.locations.workerPools.get",
16248            http_method: hyper::Method::GET,
16249        });
16250
16251        for &field in ["alt", "name"].iter() {
16252            if self._additional_params.contains_key(field) {
16253                dlg.finished(false);
16254                return Err(common::Error::FieldClash(field));
16255            }
16256        }
16257
16258        let mut params = Params::with_capacity(3 + self._additional_params.len());
16259        params.push("name", self._name);
16260
16261        params.extend(self._additional_params.iter());
16262
16263        params.push("alt", "json");
16264        let mut url = self.hub._base_url.clone() + "v2/{+name}";
16265        if self._scopes.is_empty() {
16266            self._scopes
16267                .insert(Scope::CloudPlatform.as_ref().to_string());
16268        }
16269
16270        #[allow(clippy::single_element_loop)]
16271        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16272            url = params.uri_replacement(url, param_name, find_this, true);
16273        }
16274        {
16275            let to_remove = ["name"];
16276            params.remove_params(&to_remove);
16277        }
16278
16279        let url = params.parse_with_url(&url);
16280
16281        loop {
16282            let token = match self
16283                .hub
16284                .auth
16285                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16286                .await
16287            {
16288                Ok(token) => token,
16289                Err(e) => match dlg.token(e) {
16290                    Ok(token) => token,
16291                    Err(e) => {
16292                        dlg.finished(false);
16293                        return Err(common::Error::MissingToken(e));
16294                    }
16295                },
16296            };
16297            let mut req_result = {
16298                let client = &self.hub.client;
16299                dlg.pre_request();
16300                let mut req_builder = hyper::Request::builder()
16301                    .method(hyper::Method::GET)
16302                    .uri(url.as_str())
16303                    .header(USER_AGENT, self.hub._user_agent.clone());
16304
16305                if let Some(token) = token.as_ref() {
16306                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16307                }
16308
16309                let request = req_builder
16310                    .header(CONTENT_LENGTH, 0_u64)
16311                    .body(common::to_body::<String>(None));
16312
16313                client.request(request.unwrap()).await
16314            };
16315
16316            match req_result {
16317                Err(err) => {
16318                    if let common::Retry::After(d) = dlg.http_error(&err) {
16319                        sleep(d).await;
16320                        continue;
16321                    }
16322                    dlg.finished(false);
16323                    return Err(common::Error::HttpError(err));
16324                }
16325                Ok(res) => {
16326                    let (mut parts, body) = res.into_parts();
16327                    let mut body = common::Body::new(body);
16328                    if !parts.status.is_success() {
16329                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16330                        let error = serde_json::from_str(&common::to_string(&bytes));
16331                        let response = common::to_response(parts, bytes.into());
16332
16333                        if let common::Retry::After(d) =
16334                            dlg.http_failure(&response, error.as_ref().ok())
16335                        {
16336                            sleep(d).await;
16337                            continue;
16338                        }
16339
16340                        dlg.finished(false);
16341
16342                        return Err(match error {
16343                            Ok(value) => common::Error::BadRequest(value),
16344                            _ => common::Error::Failure(response),
16345                        });
16346                    }
16347                    let response = {
16348                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16349                        let encoded = common::to_string(&bytes);
16350                        match serde_json::from_str(&encoded) {
16351                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16352                            Err(error) => {
16353                                dlg.response_json_decode_error(&encoded, &error);
16354                                return Err(common::Error::JsonDecodeError(
16355                                    encoded.to_string(),
16356                                    error,
16357                                ));
16358                            }
16359                        }
16360                    };
16361
16362                    dlg.finished(true);
16363                    return Ok(response);
16364                }
16365            }
16366        }
16367    }
16368
16369    /// Required. The full name of the WorkerPool. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where `{project}` can be project id or number.
16370    ///
16371    /// Sets the *name* path property to the given value.
16372    ///
16373    /// Even though the property as already been set when instantiating this call,
16374    /// we provide this method for API completeness.
16375    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkerPoolGetCall<'a, C> {
16376        self._name = new_value.to_string();
16377        self
16378    }
16379    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16380    /// while executing the actual API request.
16381    ///
16382    /// ````text
16383    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16384    /// ````
16385    ///
16386    /// Sets the *delegate* property to the given value.
16387    pub fn delegate(
16388        mut self,
16389        new_value: &'a mut dyn common::Delegate,
16390    ) -> ProjectLocationWorkerPoolGetCall<'a, C> {
16391        self._delegate = Some(new_value);
16392        self
16393    }
16394
16395    /// Set any additional parameter of the query string used in the request.
16396    /// It should be used to set parameters which are not yet available through their own
16397    /// setters.
16398    ///
16399    /// Please note that this method must not be used to set any of the known parameters
16400    /// which have their own setter method. If done anyway, the request will fail.
16401    ///
16402    /// # Additional Parameters
16403    ///
16404    /// * *$.xgafv* (query-string) - V1 error format.
16405    /// * *access_token* (query-string) - OAuth access token.
16406    /// * *alt* (query-string) - Data format for response.
16407    /// * *callback* (query-string) - JSONP
16408    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16409    /// * *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.
16410    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16411    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16412    /// * *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.
16413    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16414    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16415    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolGetCall<'a, C>
16416    where
16417        T: AsRef<str>,
16418    {
16419        self._additional_params
16420            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16421        self
16422    }
16423
16424    /// Identifies the authorization scope for the method you are building.
16425    ///
16426    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16427    /// [`Scope::CloudPlatform`].
16428    ///
16429    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16430    /// tokens for more than one scope.
16431    ///
16432    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16433    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16434    /// sufficient, a read-write scope will do as well.
16435    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolGetCall<'a, C>
16436    where
16437        St: AsRef<str>,
16438    {
16439        self._scopes.insert(String::from(scope.as_ref()));
16440        self
16441    }
16442    /// Identifies the authorization scope(s) for the method you are building.
16443    ///
16444    /// See [`Self::add_scope()`] for details.
16445    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolGetCall<'a, C>
16446    where
16447        I: IntoIterator<Item = St>,
16448        St: AsRef<str>,
16449    {
16450        self._scopes
16451            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16452        self
16453    }
16454
16455    /// Removes all scopes, and no default scope will be used either.
16456    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16457    /// for details).
16458    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolGetCall<'a, C> {
16459        self._scopes.clear();
16460        self
16461    }
16462}
16463
16464/// Gets the IAM Access Control policy currently in effect for the given Cloud Run WorkerPool. This result does not include any inherited policies.
16465///
16466/// A builder for the *locations.workerPools.getIamPolicy* method supported by a *project* resource.
16467/// It is not used directly, but through a [`ProjectMethods`] instance.
16468///
16469/// # Example
16470///
16471/// Instantiate a resource method builder
16472///
16473/// ```test_harness,no_run
16474/// # extern crate hyper;
16475/// # extern crate hyper_rustls;
16476/// # extern crate google_run2 as run2;
16477/// # async fn dox() {
16478/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16479///
16480/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16481/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16482/// #     .with_native_roots()
16483/// #     .unwrap()
16484/// #     .https_only()
16485/// #     .enable_http2()
16486/// #     .build();
16487///
16488/// # let executor = hyper_util::rt::TokioExecutor::new();
16489/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16490/// #     secret,
16491/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16492/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16493/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16494/// #     ),
16495/// # ).build().await.unwrap();
16496///
16497/// # let client = hyper_util::client::legacy::Client::builder(
16498/// #     hyper_util::rt::TokioExecutor::new()
16499/// # )
16500/// # .build(
16501/// #     hyper_rustls::HttpsConnectorBuilder::new()
16502/// #         .with_native_roots()
16503/// #         .unwrap()
16504/// #         .https_or_http()
16505/// #         .enable_http2()
16506/// #         .build()
16507/// # );
16508/// # let mut hub = CloudRun::new(client, auth);
16509/// // You can configure optional parameters by calling the respective setters at will, and
16510/// // execute the final call using `doit()`.
16511/// // Values shown here are possibly random and not representative !
16512/// let result = hub.projects().locations_worker_pools_get_iam_policy("resource")
16513///              .options_requested_policy_version(-10)
16514///              .doit().await;
16515/// # }
16516/// ```
16517pub struct ProjectLocationWorkerPoolGetIamPolicyCall<'a, C>
16518where
16519    C: 'a,
16520{
16521    hub: &'a CloudRun<C>,
16522    _resource: String,
16523    _options_requested_policy_version: Option<i32>,
16524    _delegate: Option<&'a mut dyn common::Delegate>,
16525    _additional_params: HashMap<String, String>,
16526    _scopes: BTreeSet<String>,
16527}
16528
16529impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {}
16530
16531impl<'a, C> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C>
16532where
16533    C: common::Connector,
16534{
16535    /// Perform the operation you have build so far.
16536    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
16537        use std::borrow::Cow;
16538        use std::io::{Read, Seek};
16539
16540        use common::{url::Params, ToParts};
16541        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16542
16543        let mut dd = common::DefaultDelegate;
16544        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16545        dlg.begin(common::MethodInfo {
16546            id: "run.projects.locations.workerPools.getIamPolicy",
16547            http_method: hyper::Method::GET,
16548        });
16549
16550        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16551            if self._additional_params.contains_key(field) {
16552                dlg.finished(false);
16553                return Err(common::Error::FieldClash(field));
16554            }
16555        }
16556
16557        let mut params = Params::with_capacity(4 + self._additional_params.len());
16558        params.push("resource", self._resource);
16559        if let Some(value) = self._options_requested_policy_version.as_ref() {
16560            params.push("options.requestedPolicyVersion", value.to_string());
16561        }
16562
16563        params.extend(self._additional_params.iter());
16564
16565        params.push("alt", "json");
16566        let mut url = self.hub._base_url.clone() + "v2/{+resource}:getIamPolicy";
16567        if self._scopes.is_empty() {
16568            self._scopes
16569                .insert(Scope::CloudPlatform.as_ref().to_string());
16570        }
16571
16572        #[allow(clippy::single_element_loop)]
16573        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16574            url = params.uri_replacement(url, param_name, find_this, true);
16575        }
16576        {
16577            let to_remove = ["resource"];
16578            params.remove_params(&to_remove);
16579        }
16580
16581        let url = params.parse_with_url(&url);
16582
16583        loop {
16584            let token = match self
16585                .hub
16586                .auth
16587                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16588                .await
16589            {
16590                Ok(token) => token,
16591                Err(e) => match dlg.token(e) {
16592                    Ok(token) => token,
16593                    Err(e) => {
16594                        dlg.finished(false);
16595                        return Err(common::Error::MissingToken(e));
16596                    }
16597                },
16598            };
16599            let mut req_result = {
16600                let client = &self.hub.client;
16601                dlg.pre_request();
16602                let mut req_builder = hyper::Request::builder()
16603                    .method(hyper::Method::GET)
16604                    .uri(url.as_str())
16605                    .header(USER_AGENT, self.hub._user_agent.clone());
16606
16607                if let Some(token) = token.as_ref() {
16608                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16609                }
16610
16611                let request = req_builder
16612                    .header(CONTENT_LENGTH, 0_u64)
16613                    .body(common::to_body::<String>(None));
16614
16615                client.request(request.unwrap()).await
16616            };
16617
16618            match req_result {
16619                Err(err) => {
16620                    if let common::Retry::After(d) = dlg.http_error(&err) {
16621                        sleep(d).await;
16622                        continue;
16623                    }
16624                    dlg.finished(false);
16625                    return Err(common::Error::HttpError(err));
16626                }
16627                Ok(res) => {
16628                    let (mut parts, body) = res.into_parts();
16629                    let mut body = common::Body::new(body);
16630                    if !parts.status.is_success() {
16631                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16632                        let error = serde_json::from_str(&common::to_string(&bytes));
16633                        let response = common::to_response(parts, bytes.into());
16634
16635                        if let common::Retry::After(d) =
16636                            dlg.http_failure(&response, error.as_ref().ok())
16637                        {
16638                            sleep(d).await;
16639                            continue;
16640                        }
16641
16642                        dlg.finished(false);
16643
16644                        return Err(match error {
16645                            Ok(value) => common::Error::BadRequest(value),
16646                            _ => common::Error::Failure(response),
16647                        });
16648                    }
16649                    let response = {
16650                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16651                        let encoded = common::to_string(&bytes);
16652                        match serde_json::from_str(&encoded) {
16653                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16654                            Err(error) => {
16655                                dlg.response_json_decode_error(&encoded, &error);
16656                                return Err(common::Error::JsonDecodeError(
16657                                    encoded.to_string(),
16658                                    error,
16659                                ));
16660                            }
16661                        }
16662                    };
16663
16664                    dlg.finished(true);
16665                    return Ok(response);
16666                }
16667            }
16668        }
16669    }
16670
16671    /// 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.
16672    ///
16673    /// Sets the *resource* path property to the given value.
16674    ///
16675    /// Even though the property as already been set when instantiating this call,
16676    /// we provide this method for API completeness.
16677    pub fn resource(mut self, new_value: &str) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {
16678        self._resource = new_value.to_string();
16679        self
16680    }
16681    /// 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).
16682    ///
16683    /// Sets the *options.requested policy version* query property to the given value.
16684    pub fn options_requested_policy_version(
16685        mut self,
16686        new_value: i32,
16687    ) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {
16688        self._options_requested_policy_version = Some(new_value);
16689        self
16690    }
16691    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16692    /// while executing the actual API request.
16693    ///
16694    /// ````text
16695    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16696    /// ````
16697    ///
16698    /// Sets the *delegate* property to the given value.
16699    pub fn delegate(
16700        mut self,
16701        new_value: &'a mut dyn common::Delegate,
16702    ) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {
16703        self._delegate = Some(new_value);
16704        self
16705    }
16706
16707    /// Set any additional parameter of the query string used in the request.
16708    /// It should be used to set parameters which are not yet available through their own
16709    /// setters.
16710    ///
16711    /// Please note that this method must not be used to set any of the known parameters
16712    /// which have their own setter method. If done anyway, the request will fail.
16713    ///
16714    /// # Additional Parameters
16715    ///
16716    /// * *$.xgafv* (query-string) - V1 error format.
16717    /// * *access_token* (query-string) - OAuth access token.
16718    /// * *alt* (query-string) - Data format for response.
16719    /// * *callback* (query-string) - JSONP
16720    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16721    /// * *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.
16722    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16723    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16724    /// * *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.
16725    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16726    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16727    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C>
16728    where
16729        T: AsRef<str>,
16730    {
16731        self._additional_params
16732            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16733        self
16734    }
16735
16736    /// Identifies the authorization scope for the method you are building.
16737    ///
16738    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16739    /// [`Scope::CloudPlatform`].
16740    ///
16741    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16742    /// tokens for more than one scope.
16743    ///
16744    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16745    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16746    /// sufficient, a read-write scope will do as well.
16747    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C>
16748    where
16749        St: AsRef<str>,
16750    {
16751        self._scopes.insert(String::from(scope.as_ref()));
16752        self
16753    }
16754    /// Identifies the authorization scope(s) for the method you are building.
16755    ///
16756    /// See [`Self::add_scope()`] for details.
16757    pub fn add_scopes<I, St>(
16758        mut self,
16759        scopes: I,
16760    ) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C>
16761    where
16762        I: IntoIterator<Item = St>,
16763        St: AsRef<str>,
16764    {
16765        self._scopes
16766            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16767        self
16768    }
16769
16770    /// Removes all scopes, and no default scope will be used either.
16771    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16772    /// for details).
16773    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolGetIamPolicyCall<'a, C> {
16774        self._scopes.clear();
16775        self
16776    }
16777}
16778
16779/// Lists WorkerPools. Results are sorted by creation time, descending.
16780///
16781/// A builder for the *locations.workerPools.list* method supported by a *project* resource.
16782/// It is not used directly, but through a [`ProjectMethods`] instance.
16783///
16784/// # Example
16785///
16786/// Instantiate a resource method builder
16787///
16788/// ```test_harness,no_run
16789/// # extern crate hyper;
16790/// # extern crate hyper_rustls;
16791/// # extern crate google_run2 as run2;
16792/// # async fn dox() {
16793/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16794///
16795/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16796/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16797/// #     .with_native_roots()
16798/// #     .unwrap()
16799/// #     .https_only()
16800/// #     .enable_http2()
16801/// #     .build();
16802///
16803/// # let executor = hyper_util::rt::TokioExecutor::new();
16804/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16805/// #     secret,
16806/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16807/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16808/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16809/// #     ),
16810/// # ).build().await.unwrap();
16811///
16812/// # let client = hyper_util::client::legacy::Client::builder(
16813/// #     hyper_util::rt::TokioExecutor::new()
16814/// # )
16815/// # .build(
16816/// #     hyper_rustls::HttpsConnectorBuilder::new()
16817/// #         .with_native_roots()
16818/// #         .unwrap()
16819/// #         .https_or_http()
16820/// #         .enable_http2()
16821/// #         .build()
16822/// # );
16823/// # let mut hub = CloudRun::new(client, auth);
16824/// // You can configure optional parameters by calling the respective setters at will, and
16825/// // execute the final call using `doit()`.
16826/// // Values shown here are possibly random and not representative !
16827/// let result = hub.projects().locations_worker_pools_list("parent")
16828///              .show_deleted(true)
16829///              .page_token("Stet")
16830///              .page_size(-7)
16831///              .doit().await;
16832/// # }
16833/// ```
16834pub struct ProjectLocationWorkerPoolListCall<'a, C>
16835where
16836    C: 'a,
16837{
16838    hub: &'a CloudRun<C>,
16839    _parent: String,
16840    _show_deleted: Option<bool>,
16841    _page_token: Option<String>,
16842    _page_size: Option<i32>,
16843    _delegate: Option<&'a mut dyn common::Delegate>,
16844    _additional_params: HashMap<String, String>,
16845    _scopes: BTreeSet<String>,
16846}
16847
16848impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolListCall<'a, C> {}
16849
16850impl<'a, C> ProjectLocationWorkerPoolListCall<'a, C>
16851where
16852    C: common::Connector,
16853{
16854    /// Perform the operation you have build so far.
16855    pub async fn doit(
16856        mut self,
16857    ) -> common::Result<(common::Response, GoogleCloudRunV2ListWorkerPoolsResponse)> {
16858        use std::borrow::Cow;
16859        use std::io::{Read, Seek};
16860
16861        use common::{url::Params, ToParts};
16862        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16863
16864        let mut dd = common::DefaultDelegate;
16865        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16866        dlg.begin(common::MethodInfo {
16867            id: "run.projects.locations.workerPools.list",
16868            http_method: hyper::Method::GET,
16869        });
16870
16871        for &field in ["alt", "parent", "showDeleted", "pageToken", "pageSize"].iter() {
16872            if self._additional_params.contains_key(field) {
16873                dlg.finished(false);
16874                return Err(common::Error::FieldClash(field));
16875            }
16876        }
16877
16878        let mut params = Params::with_capacity(6 + self._additional_params.len());
16879        params.push("parent", self._parent);
16880        if let Some(value) = self._show_deleted.as_ref() {
16881            params.push("showDeleted", value.to_string());
16882        }
16883        if let Some(value) = self._page_token.as_ref() {
16884            params.push("pageToken", value);
16885        }
16886        if let Some(value) = self._page_size.as_ref() {
16887            params.push("pageSize", value.to_string());
16888        }
16889
16890        params.extend(self._additional_params.iter());
16891
16892        params.push("alt", "json");
16893        let mut url = self.hub._base_url.clone() + "v2/{+parent}/workerPools";
16894        if self._scopes.is_empty() {
16895            self._scopes
16896                .insert(Scope::CloudPlatform.as_ref().to_string());
16897        }
16898
16899        #[allow(clippy::single_element_loop)]
16900        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16901            url = params.uri_replacement(url, param_name, find_this, true);
16902        }
16903        {
16904            let to_remove = ["parent"];
16905            params.remove_params(&to_remove);
16906        }
16907
16908        let url = params.parse_with_url(&url);
16909
16910        loop {
16911            let token = match self
16912                .hub
16913                .auth
16914                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16915                .await
16916            {
16917                Ok(token) => token,
16918                Err(e) => match dlg.token(e) {
16919                    Ok(token) => token,
16920                    Err(e) => {
16921                        dlg.finished(false);
16922                        return Err(common::Error::MissingToken(e));
16923                    }
16924                },
16925            };
16926            let mut req_result = {
16927                let client = &self.hub.client;
16928                dlg.pre_request();
16929                let mut req_builder = hyper::Request::builder()
16930                    .method(hyper::Method::GET)
16931                    .uri(url.as_str())
16932                    .header(USER_AGENT, self.hub._user_agent.clone());
16933
16934                if let Some(token) = token.as_ref() {
16935                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16936                }
16937
16938                let request = req_builder
16939                    .header(CONTENT_LENGTH, 0_u64)
16940                    .body(common::to_body::<String>(None));
16941
16942                client.request(request.unwrap()).await
16943            };
16944
16945            match req_result {
16946                Err(err) => {
16947                    if let common::Retry::After(d) = dlg.http_error(&err) {
16948                        sleep(d).await;
16949                        continue;
16950                    }
16951                    dlg.finished(false);
16952                    return Err(common::Error::HttpError(err));
16953                }
16954                Ok(res) => {
16955                    let (mut parts, body) = res.into_parts();
16956                    let mut body = common::Body::new(body);
16957                    if !parts.status.is_success() {
16958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16959                        let error = serde_json::from_str(&common::to_string(&bytes));
16960                        let response = common::to_response(parts, bytes.into());
16961
16962                        if let common::Retry::After(d) =
16963                            dlg.http_failure(&response, error.as_ref().ok())
16964                        {
16965                            sleep(d).await;
16966                            continue;
16967                        }
16968
16969                        dlg.finished(false);
16970
16971                        return Err(match error {
16972                            Ok(value) => common::Error::BadRequest(value),
16973                            _ => common::Error::Failure(response),
16974                        });
16975                    }
16976                    let response = {
16977                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16978                        let encoded = common::to_string(&bytes);
16979                        match serde_json::from_str(&encoded) {
16980                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16981                            Err(error) => {
16982                                dlg.response_json_decode_error(&encoded, &error);
16983                                return Err(common::Error::JsonDecodeError(
16984                                    encoded.to_string(),
16985                                    error,
16986                                ));
16987                            }
16988                        }
16989                    };
16990
16991                    dlg.finished(true);
16992                    return Ok(response);
16993                }
16994            }
16995        }
16996    }
16997
16998    /// Required. The location and project to list resources on. Location must be a valid Google Cloud region, and cannot be the "-" wildcard. Format: `projects/{project}/locations/{location}`, where `{project}` can be project id or number.
16999    ///
17000    /// Sets the *parent* path property to the given value.
17001    ///
17002    /// Even though the property as already been set when instantiating this call,
17003    /// we provide this method for API completeness.
17004    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkerPoolListCall<'a, C> {
17005        self._parent = new_value.to_string();
17006        self
17007    }
17008    /// If true, returns deleted (but unexpired) resources along with active ones.
17009    ///
17010    /// Sets the *show deleted* query property to the given value.
17011    pub fn show_deleted(mut self, new_value: bool) -> ProjectLocationWorkerPoolListCall<'a, C> {
17012        self._show_deleted = Some(new_value);
17013        self
17014    }
17015    /// A page token received from a previous call to ListWorkerPools. All other parameters must match.
17016    ///
17017    /// Sets the *page token* query property to the given value.
17018    pub fn page_token(mut self, new_value: &str) -> ProjectLocationWorkerPoolListCall<'a, C> {
17019        self._page_token = Some(new_value.to_string());
17020        self
17021    }
17022    /// Maximum number of WorkerPools to return in this call.
17023    ///
17024    /// Sets the *page size* query property to the given value.
17025    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkerPoolListCall<'a, C> {
17026        self._page_size = Some(new_value);
17027        self
17028    }
17029    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17030    /// while executing the actual API request.
17031    ///
17032    /// ````text
17033    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17034    /// ````
17035    ///
17036    /// Sets the *delegate* property to the given value.
17037    pub fn delegate(
17038        mut self,
17039        new_value: &'a mut dyn common::Delegate,
17040    ) -> ProjectLocationWorkerPoolListCall<'a, C> {
17041        self._delegate = Some(new_value);
17042        self
17043    }
17044
17045    /// Set any additional parameter of the query string used in the request.
17046    /// It should be used to set parameters which are not yet available through their own
17047    /// setters.
17048    ///
17049    /// Please note that this method must not be used to set any of the known parameters
17050    /// which have their own setter method. If done anyway, the request will fail.
17051    ///
17052    /// # Additional Parameters
17053    ///
17054    /// * *$.xgafv* (query-string) - V1 error format.
17055    /// * *access_token* (query-string) - OAuth access token.
17056    /// * *alt* (query-string) - Data format for response.
17057    /// * *callback* (query-string) - JSONP
17058    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17059    /// * *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.
17060    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17061    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17062    /// * *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.
17063    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17064    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17065    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolListCall<'a, C>
17066    where
17067        T: AsRef<str>,
17068    {
17069        self._additional_params
17070            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17071        self
17072    }
17073
17074    /// Identifies the authorization scope for the method you are building.
17075    ///
17076    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17077    /// [`Scope::CloudPlatform`].
17078    ///
17079    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17080    /// tokens for more than one scope.
17081    ///
17082    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17083    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17084    /// sufficient, a read-write scope will do as well.
17085    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolListCall<'a, C>
17086    where
17087        St: AsRef<str>,
17088    {
17089        self._scopes.insert(String::from(scope.as_ref()));
17090        self
17091    }
17092    /// Identifies the authorization scope(s) for the method you are building.
17093    ///
17094    /// See [`Self::add_scope()`] for details.
17095    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolListCall<'a, C>
17096    where
17097        I: IntoIterator<Item = St>,
17098        St: AsRef<str>,
17099    {
17100        self._scopes
17101            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17102        self
17103    }
17104
17105    /// Removes all scopes, and no default scope will be used either.
17106    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17107    /// for details).
17108    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolListCall<'a, C> {
17109        self._scopes.clear();
17110        self
17111    }
17112}
17113
17114/// Updates a WorkerPool.
17115///
17116/// A builder for the *locations.workerPools.patch* method supported by a *project* resource.
17117/// It is not used directly, but through a [`ProjectMethods`] instance.
17118///
17119/// # Example
17120///
17121/// Instantiate a resource method builder
17122///
17123/// ```test_harness,no_run
17124/// # extern crate hyper;
17125/// # extern crate hyper_rustls;
17126/// # extern crate google_run2 as run2;
17127/// use run2::api::GoogleCloudRunV2WorkerPool;
17128/// # async fn dox() {
17129/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17130///
17131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17132/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17133/// #     .with_native_roots()
17134/// #     .unwrap()
17135/// #     .https_only()
17136/// #     .enable_http2()
17137/// #     .build();
17138///
17139/// # let executor = hyper_util::rt::TokioExecutor::new();
17140/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17141/// #     secret,
17142/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17143/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17144/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17145/// #     ),
17146/// # ).build().await.unwrap();
17147///
17148/// # let client = hyper_util::client::legacy::Client::builder(
17149/// #     hyper_util::rt::TokioExecutor::new()
17150/// # )
17151/// # .build(
17152/// #     hyper_rustls::HttpsConnectorBuilder::new()
17153/// #         .with_native_roots()
17154/// #         .unwrap()
17155/// #         .https_or_http()
17156/// #         .enable_http2()
17157/// #         .build()
17158/// # );
17159/// # let mut hub = CloudRun::new(client, auth);
17160/// // As the method needs a request, you would usually fill it with the desired information
17161/// // into the respective structure. Some of the parts shown here might not be applicable !
17162/// // Values shown here are possibly random and not representative !
17163/// let mut req = GoogleCloudRunV2WorkerPool::default();
17164///
17165/// // You can configure optional parameters by calling the respective setters at will, and
17166/// // execute the final call using `doit()`.
17167/// // Values shown here are possibly random and not representative !
17168/// let result = hub.projects().locations_worker_pools_patch(req, "name")
17169///              .validate_only(false)
17170///              .update_mask(FieldMask::new::<&str>(&[]))
17171///              .force_new_revision(true)
17172///              .allow_missing(true)
17173///              .doit().await;
17174/// # }
17175/// ```
17176pub struct ProjectLocationWorkerPoolPatchCall<'a, C>
17177where
17178    C: 'a,
17179{
17180    hub: &'a CloudRun<C>,
17181    _request: GoogleCloudRunV2WorkerPool,
17182    _name: String,
17183    _validate_only: Option<bool>,
17184    _update_mask: Option<common::FieldMask>,
17185    _force_new_revision: Option<bool>,
17186    _allow_missing: Option<bool>,
17187    _delegate: Option<&'a mut dyn common::Delegate>,
17188    _additional_params: HashMap<String, String>,
17189    _scopes: BTreeSet<String>,
17190}
17191
17192impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolPatchCall<'a, C> {}
17193
17194impl<'a, C> ProjectLocationWorkerPoolPatchCall<'a, C>
17195where
17196    C: common::Connector,
17197{
17198    /// Perform the operation you have build so far.
17199    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
17200        use std::borrow::Cow;
17201        use std::io::{Read, Seek};
17202
17203        use common::{url::Params, ToParts};
17204        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17205
17206        let mut dd = common::DefaultDelegate;
17207        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17208        dlg.begin(common::MethodInfo {
17209            id: "run.projects.locations.workerPools.patch",
17210            http_method: hyper::Method::PATCH,
17211        });
17212
17213        for &field in [
17214            "alt",
17215            "name",
17216            "validateOnly",
17217            "updateMask",
17218            "forceNewRevision",
17219            "allowMissing",
17220        ]
17221        .iter()
17222        {
17223            if self._additional_params.contains_key(field) {
17224                dlg.finished(false);
17225                return Err(common::Error::FieldClash(field));
17226            }
17227        }
17228
17229        let mut params = Params::with_capacity(8 + self._additional_params.len());
17230        params.push("name", self._name);
17231        if let Some(value) = self._validate_only.as_ref() {
17232            params.push("validateOnly", value.to_string());
17233        }
17234        if let Some(value) = self._update_mask.as_ref() {
17235            params.push("updateMask", value.to_string());
17236        }
17237        if let Some(value) = self._force_new_revision.as_ref() {
17238            params.push("forceNewRevision", value.to_string());
17239        }
17240        if let Some(value) = self._allow_missing.as_ref() {
17241            params.push("allowMissing", value.to_string());
17242        }
17243
17244        params.extend(self._additional_params.iter());
17245
17246        params.push("alt", "json");
17247        let mut url = self.hub._base_url.clone() + "v2/{+name}";
17248        if self._scopes.is_empty() {
17249            self._scopes
17250                .insert(Scope::CloudPlatform.as_ref().to_string());
17251        }
17252
17253        #[allow(clippy::single_element_loop)]
17254        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17255            url = params.uri_replacement(url, param_name, find_this, true);
17256        }
17257        {
17258            let to_remove = ["name"];
17259            params.remove_params(&to_remove);
17260        }
17261
17262        let url = params.parse_with_url(&url);
17263
17264        let mut json_mime_type = mime::APPLICATION_JSON;
17265        let mut request_value_reader = {
17266            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17267            common::remove_json_null_values(&mut value);
17268            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17269            serde_json::to_writer(&mut dst, &value).unwrap();
17270            dst
17271        };
17272        let request_size = request_value_reader
17273            .seek(std::io::SeekFrom::End(0))
17274            .unwrap();
17275        request_value_reader
17276            .seek(std::io::SeekFrom::Start(0))
17277            .unwrap();
17278
17279        loop {
17280            let token = match self
17281                .hub
17282                .auth
17283                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17284                .await
17285            {
17286                Ok(token) => token,
17287                Err(e) => match dlg.token(e) {
17288                    Ok(token) => token,
17289                    Err(e) => {
17290                        dlg.finished(false);
17291                        return Err(common::Error::MissingToken(e));
17292                    }
17293                },
17294            };
17295            request_value_reader
17296                .seek(std::io::SeekFrom::Start(0))
17297                .unwrap();
17298            let mut req_result = {
17299                let client = &self.hub.client;
17300                dlg.pre_request();
17301                let mut req_builder = hyper::Request::builder()
17302                    .method(hyper::Method::PATCH)
17303                    .uri(url.as_str())
17304                    .header(USER_AGENT, self.hub._user_agent.clone());
17305
17306                if let Some(token) = token.as_ref() {
17307                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17308                }
17309
17310                let request = req_builder
17311                    .header(CONTENT_TYPE, json_mime_type.to_string())
17312                    .header(CONTENT_LENGTH, request_size as u64)
17313                    .body(common::to_body(
17314                        request_value_reader.get_ref().clone().into(),
17315                    ));
17316
17317                client.request(request.unwrap()).await
17318            };
17319
17320            match req_result {
17321                Err(err) => {
17322                    if let common::Retry::After(d) = dlg.http_error(&err) {
17323                        sleep(d).await;
17324                        continue;
17325                    }
17326                    dlg.finished(false);
17327                    return Err(common::Error::HttpError(err));
17328                }
17329                Ok(res) => {
17330                    let (mut parts, body) = res.into_parts();
17331                    let mut body = common::Body::new(body);
17332                    if !parts.status.is_success() {
17333                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17334                        let error = serde_json::from_str(&common::to_string(&bytes));
17335                        let response = common::to_response(parts, bytes.into());
17336
17337                        if let common::Retry::After(d) =
17338                            dlg.http_failure(&response, error.as_ref().ok())
17339                        {
17340                            sleep(d).await;
17341                            continue;
17342                        }
17343
17344                        dlg.finished(false);
17345
17346                        return Err(match error {
17347                            Ok(value) => common::Error::BadRequest(value),
17348                            _ => common::Error::Failure(response),
17349                        });
17350                    }
17351                    let response = {
17352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17353                        let encoded = common::to_string(&bytes);
17354                        match serde_json::from_str(&encoded) {
17355                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17356                            Err(error) => {
17357                                dlg.response_json_decode_error(&encoded, &error);
17358                                return Err(common::Error::JsonDecodeError(
17359                                    encoded.to_string(),
17360                                    error,
17361                                ));
17362                            }
17363                        }
17364                    };
17365
17366                    dlg.finished(true);
17367                    return Ok(response);
17368                }
17369            }
17370        }
17371    }
17372
17373    ///
17374    /// Sets the *request* property to the given value.
17375    ///
17376    /// Even though the property as already been set when instantiating this call,
17377    /// we provide this method for API completeness.
17378    pub fn request(
17379        mut self,
17380        new_value: GoogleCloudRunV2WorkerPool,
17381    ) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17382        self._request = new_value;
17383        self
17384    }
17385    /// The fully qualified name of this WorkerPool. In CreateWorkerPoolRequest, this field is ignored, and instead composed from CreateWorkerPoolRequest.parent and CreateWorkerPoolRequest.worker_id. Format: `projects/{project}/locations/{location}/workerPools/{worker_id}`
17386    ///
17387    /// Sets the *name* path property to the given value.
17388    ///
17389    /// Even though the property as already been set when instantiating this call,
17390    /// we provide this method for API completeness.
17391    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17392        self._name = new_value.to_string();
17393        self
17394    }
17395    /// Optional. Indicates that the request should be validated and default values populated, without persisting the request or updating any resources.
17396    ///
17397    /// Sets the *validate only* query property to the given value.
17398    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17399        self._validate_only = Some(new_value);
17400        self
17401    }
17402    /// Optional. The list of fields to be updated.
17403    ///
17404    /// Sets the *update mask* query property to the given value.
17405    pub fn update_mask(
17406        mut self,
17407        new_value: common::FieldMask,
17408    ) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17409        self._update_mask = Some(new_value);
17410        self
17411    }
17412    /// Optional. If set to true, a new revision will be created from the template even if the system doesn't detect any changes from the previously deployed revision. This may be useful for cases where the underlying resources need to be recreated or reinitialized. For example if the image is specified by label, but the underlying image digest has changed) or if the container performs deployment initialization work that needs to be performed again.
17413    ///
17414    /// Sets the *force new revision* query property to the given value.
17415    pub fn force_new_revision(
17416        mut self,
17417        new_value: bool,
17418    ) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17419        self._force_new_revision = Some(new_value);
17420        self
17421    }
17422    /// Optional. If set to true, and if the WorkerPool does not exist, it will create a new one. The caller must have 'run.workerpools.create' permissions if this is set to true and the WorkerPool does not exist.
17423    ///
17424    /// Sets the *allow missing* query property to the given value.
17425    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17426        self._allow_missing = Some(new_value);
17427        self
17428    }
17429    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17430    /// while executing the actual API request.
17431    ///
17432    /// ````text
17433    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17434    /// ````
17435    ///
17436    /// Sets the *delegate* property to the given value.
17437    pub fn delegate(
17438        mut self,
17439        new_value: &'a mut dyn common::Delegate,
17440    ) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17441        self._delegate = Some(new_value);
17442        self
17443    }
17444
17445    /// Set any additional parameter of the query string used in the request.
17446    /// It should be used to set parameters which are not yet available through their own
17447    /// setters.
17448    ///
17449    /// Please note that this method must not be used to set any of the known parameters
17450    /// which have their own setter method. If done anyway, the request will fail.
17451    ///
17452    /// # Additional Parameters
17453    ///
17454    /// * *$.xgafv* (query-string) - V1 error format.
17455    /// * *access_token* (query-string) - OAuth access token.
17456    /// * *alt* (query-string) - Data format for response.
17457    /// * *callback* (query-string) - JSONP
17458    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17459    /// * *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.
17460    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17461    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17462    /// * *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.
17463    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17464    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17465    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolPatchCall<'a, C>
17466    where
17467        T: AsRef<str>,
17468    {
17469        self._additional_params
17470            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17471        self
17472    }
17473
17474    /// Identifies the authorization scope for the method you are building.
17475    ///
17476    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17477    /// [`Scope::CloudPlatform`].
17478    ///
17479    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17480    /// tokens for more than one scope.
17481    ///
17482    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17483    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17484    /// sufficient, a read-write scope will do as well.
17485    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolPatchCall<'a, C>
17486    where
17487        St: AsRef<str>,
17488    {
17489        self._scopes.insert(String::from(scope.as_ref()));
17490        self
17491    }
17492    /// Identifies the authorization scope(s) for the method you are building.
17493    ///
17494    /// See [`Self::add_scope()`] for details.
17495    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkerPoolPatchCall<'a, C>
17496    where
17497        I: IntoIterator<Item = St>,
17498        St: AsRef<str>,
17499    {
17500        self._scopes
17501            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17502        self
17503    }
17504
17505    /// Removes all scopes, and no default scope will be used either.
17506    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17507    /// for details).
17508    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolPatchCall<'a, C> {
17509        self._scopes.clear();
17510        self
17511    }
17512}
17513
17514/// Sets the IAM Access control policy for the specified WorkerPool. Overwrites any existing policy.
17515///
17516/// A builder for the *locations.workerPools.setIamPolicy* method supported by a *project* resource.
17517/// It is not used directly, but through a [`ProjectMethods`] instance.
17518///
17519/// # Example
17520///
17521/// Instantiate a resource method builder
17522///
17523/// ```test_harness,no_run
17524/// # extern crate hyper;
17525/// # extern crate hyper_rustls;
17526/// # extern crate google_run2 as run2;
17527/// use run2::api::GoogleIamV1SetIamPolicyRequest;
17528/// # async fn dox() {
17529/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17530///
17531/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17532/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17533/// #     .with_native_roots()
17534/// #     .unwrap()
17535/// #     .https_only()
17536/// #     .enable_http2()
17537/// #     .build();
17538///
17539/// # let executor = hyper_util::rt::TokioExecutor::new();
17540/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17541/// #     secret,
17542/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17543/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17544/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17545/// #     ),
17546/// # ).build().await.unwrap();
17547///
17548/// # let client = hyper_util::client::legacy::Client::builder(
17549/// #     hyper_util::rt::TokioExecutor::new()
17550/// # )
17551/// # .build(
17552/// #     hyper_rustls::HttpsConnectorBuilder::new()
17553/// #         .with_native_roots()
17554/// #         .unwrap()
17555/// #         .https_or_http()
17556/// #         .enable_http2()
17557/// #         .build()
17558/// # );
17559/// # let mut hub = CloudRun::new(client, auth);
17560/// // As the method needs a request, you would usually fill it with the desired information
17561/// // into the respective structure. Some of the parts shown here might not be applicable !
17562/// // Values shown here are possibly random and not representative !
17563/// let mut req = GoogleIamV1SetIamPolicyRequest::default();
17564///
17565/// // You can configure optional parameters by calling the respective setters at will, and
17566/// // execute the final call using `doit()`.
17567/// // Values shown here are possibly random and not representative !
17568/// let result = hub.projects().locations_worker_pools_set_iam_policy(req, "resource")
17569///              .doit().await;
17570/// # }
17571/// ```
17572pub struct ProjectLocationWorkerPoolSetIamPolicyCall<'a, C>
17573where
17574    C: 'a,
17575{
17576    hub: &'a CloudRun<C>,
17577    _request: GoogleIamV1SetIamPolicyRequest,
17578    _resource: String,
17579    _delegate: Option<&'a mut dyn common::Delegate>,
17580    _additional_params: HashMap<String, String>,
17581    _scopes: BTreeSet<String>,
17582}
17583
17584impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {}
17585
17586impl<'a, C> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C>
17587where
17588    C: common::Connector,
17589{
17590    /// Perform the operation you have build so far.
17591    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleIamV1Policy)> {
17592        use std::borrow::Cow;
17593        use std::io::{Read, Seek};
17594
17595        use common::{url::Params, ToParts};
17596        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17597
17598        let mut dd = common::DefaultDelegate;
17599        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17600        dlg.begin(common::MethodInfo {
17601            id: "run.projects.locations.workerPools.setIamPolicy",
17602            http_method: hyper::Method::POST,
17603        });
17604
17605        for &field in ["alt", "resource"].iter() {
17606            if self._additional_params.contains_key(field) {
17607                dlg.finished(false);
17608                return Err(common::Error::FieldClash(field));
17609            }
17610        }
17611
17612        let mut params = Params::with_capacity(4 + self._additional_params.len());
17613        params.push("resource", self._resource);
17614
17615        params.extend(self._additional_params.iter());
17616
17617        params.push("alt", "json");
17618        let mut url = self.hub._base_url.clone() + "v2/{+resource}:setIamPolicy";
17619        if self._scopes.is_empty() {
17620            self._scopes
17621                .insert(Scope::CloudPlatform.as_ref().to_string());
17622        }
17623
17624        #[allow(clippy::single_element_loop)]
17625        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17626            url = params.uri_replacement(url, param_name, find_this, true);
17627        }
17628        {
17629            let to_remove = ["resource"];
17630            params.remove_params(&to_remove);
17631        }
17632
17633        let url = params.parse_with_url(&url);
17634
17635        let mut json_mime_type = mime::APPLICATION_JSON;
17636        let mut request_value_reader = {
17637            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17638            common::remove_json_null_values(&mut value);
17639            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17640            serde_json::to_writer(&mut dst, &value).unwrap();
17641            dst
17642        };
17643        let request_size = request_value_reader
17644            .seek(std::io::SeekFrom::End(0))
17645            .unwrap();
17646        request_value_reader
17647            .seek(std::io::SeekFrom::Start(0))
17648            .unwrap();
17649
17650        loop {
17651            let token = match self
17652                .hub
17653                .auth
17654                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17655                .await
17656            {
17657                Ok(token) => token,
17658                Err(e) => match dlg.token(e) {
17659                    Ok(token) => token,
17660                    Err(e) => {
17661                        dlg.finished(false);
17662                        return Err(common::Error::MissingToken(e));
17663                    }
17664                },
17665            };
17666            request_value_reader
17667                .seek(std::io::SeekFrom::Start(0))
17668                .unwrap();
17669            let mut req_result = {
17670                let client = &self.hub.client;
17671                dlg.pre_request();
17672                let mut req_builder = hyper::Request::builder()
17673                    .method(hyper::Method::POST)
17674                    .uri(url.as_str())
17675                    .header(USER_AGENT, self.hub._user_agent.clone());
17676
17677                if let Some(token) = token.as_ref() {
17678                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17679                }
17680
17681                let request = req_builder
17682                    .header(CONTENT_TYPE, json_mime_type.to_string())
17683                    .header(CONTENT_LENGTH, request_size as u64)
17684                    .body(common::to_body(
17685                        request_value_reader.get_ref().clone().into(),
17686                    ));
17687
17688                client.request(request.unwrap()).await
17689            };
17690
17691            match req_result {
17692                Err(err) => {
17693                    if let common::Retry::After(d) = dlg.http_error(&err) {
17694                        sleep(d).await;
17695                        continue;
17696                    }
17697                    dlg.finished(false);
17698                    return Err(common::Error::HttpError(err));
17699                }
17700                Ok(res) => {
17701                    let (mut parts, body) = res.into_parts();
17702                    let mut body = common::Body::new(body);
17703                    if !parts.status.is_success() {
17704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17705                        let error = serde_json::from_str(&common::to_string(&bytes));
17706                        let response = common::to_response(parts, bytes.into());
17707
17708                        if let common::Retry::After(d) =
17709                            dlg.http_failure(&response, error.as_ref().ok())
17710                        {
17711                            sleep(d).await;
17712                            continue;
17713                        }
17714
17715                        dlg.finished(false);
17716
17717                        return Err(match error {
17718                            Ok(value) => common::Error::BadRequest(value),
17719                            _ => common::Error::Failure(response),
17720                        });
17721                    }
17722                    let response = {
17723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17724                        let encoded = common::to_string(&bytes);
17725                        match serde_json::from_str(&encoded) {
17726                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17727                            Err(error) => {
17728                                dlg.response_json_decode_error(&encoded, &error);
17729                                return Err(common::Error::JsonDecodeError(
17730                                    encoded.to_string(),
17731                                    error,
17732                                ));
17733                            }
17734                        }
17735                    };
17736
17737                    dlg.finished(true);
17738                    return Ok(response);
17739                }
17740            }
17741        }
17742    }
17743
17744    ///
17745    /// Sets the *request* property to the given value.
17746    ///
17747    /// Even though the property as already been set when instantiating this call,
17748    /// we provide this method for API completeness.
17749    pub fn request(
17750        mut self,
17751        new_value: GoogleIamV1SetIamPolicyRequest,
17752    ) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {
17753        self._request = new_value;
17754        self
17755    }
17756    /// 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.
17757    ///
17758    /// Sets the *resource* path property to the given value.
17759    ///
17760    /// Even though the property as already been set when instantiating this call,
17761    /// we provide this method for API completeness.
17762    pub fn resource(mut self, new_value: &str) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {
17763        self._resource = new_value.to_string();
17764        self
17765    }
17766    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17767    /// while executing the actual API request.
17768    ///
17769    /// ````text
17770    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17771    /// ````
17772    ///
17773    /// Sets the *delegate* property to the given value.
17774    pub fn delegate(
17775        mut self,
17776        new_value: &'a mut dyn common::Delegate,
17777    ) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {
17778        self._delegate = Some(new_value);
17779        self
17780    }
17781
17782    /// Set any additional parameter of the query string used in the request.
17783    /// It should be used to set parameters which are not yet available through their own
17784    /// setters.
17785    ///
17786    /// Please note that this method must not be used to set any of the known parameters
17787    /// which have their own setter method. If done anyway, the request will fail.
17788    ///
17789    /// # Additional Parameters
17790    ///
17791    /// * *$.xgafv* (query-string) - V1 error format.
17792    /// * *access_token* (query-string) - OAuth access token.
17793    /// * *alt* (query-string) - Data format for response.
17794    /// * *callback* (query-string) - JSONP
17795    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17796    /// * *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.
17797    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17798    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17799    /// * *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.
17800    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17801    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17802    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C>
17803    where
17804        T: AsRef<str>,
17805    {
17806        self._additional_params
17807            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17808        self
17809    }
17810
17811    /// Identifies the authorization scope for the method you are building.
17812    ///
17813    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17814    /// [`Scope::CloudPlatform`].
17815    ///
17816    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17817    /// tokens for more than one scope.
17818    ///
17819    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17820    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17821    /// sufficient, a read-write scope will do as well.
17822    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C>
17823    where
17824        St: AsRef<str>,
17825    {
17826        self._scopes.insert(String::from(scope.as_ref()));
17827        self
17828    }
17829    /// Identifies the authorization scope(s) for the method you are building.
17830    ///
17831    /// See [`Self::add_scope()`] for details.
17832    pub fn add_scopes<I, St>(
17833        mut self,
17834        scopes: I,
17835    ) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C>
17836    where
17837        I: IntoIterator<Item = St>,
17838        St: AsRef<str>,
17839    {
17840        self._scopes
17841            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17842        self
17843    }
17844
17845    /// Removes all scopes, and no default scope will be used either.
17846    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17847    /// for details).
17848    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolSetIamPolicyCall<'a, C> {
17849        self._scopes.clear();
17850        self
17851    }
17852}
17853
17854/// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
17855///
17856/// A builder for the *locations.workerPools.testIamPermissions* method supported by a *project* resource.
17857/// It is not used directly, but through a [`ProjectMethods`] instance.
17858///
17859/// # Example
17860///
17861/// Instantiate a resource method builder
17862///
17863/// ```test_harness,no_run
17864/// # extern crate hyper;
17865/// # extern crate hyper_rustls;
17866/// # extern crate google_run2 as run2;
17867/// use run2::api::GoogleIamV1TestIamPermissionsRequest;
17868/// # async fn dox() {
17869/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17870///
17871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17872/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17873/// #     .with_native_roots()
17874/// #     .unwrap()
17875/// #     .https_only()
17876/// #     .enable_http2()
17877/// #     .build();
17878///
17879/// # let executor = hyper_util::rt::TokioExecutor::new();
17880/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17881/// #     secret,
17882/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17883/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17884/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17885/// #     ),
17886/// # ).build().await.unwrap();
17887///
17888/// # let client = hyper_util::client::legacy::Client::builder(
17889/// #     hyper_util::rt::TokioExecutor::new()
17890/// # )
17891/// # .build(
17892/// #     hyper_rustls::HttpsConnectorBuilder::new()
17893/// #         .with_native_roots()
17894/// #         .unwrap()
17895/// #         .https_or_http()
17896/// #         .enable_http2()
17897/// #         .build()
17898/// # );
17899/// # let mut hub = CloudRun::new(client, auth);
17900/// // As the method needs a request, you would usually fill it with the desired information
17901/// // into the respective structure. Some of the parts shown here might not be applicable !
17902/// // Values shown here are possibly random and not representative !
17903/// let mut req = GoogleIamV1TestIamPermissionsRequest::default();
17904///
17905/// // You can configure optional parameters by calling the respective setters at will, and
17906/// // execute the final call using `doit()`.
17907/// // Values shown here are possibly random and not representative !
17908/// let result = hub.projects().locations_worker_pools_test_iam_permissions(req, "resource")
17909///              .doit().await;
17910/// # }
17911/// ```
17912pub struct ProjectLocationWorkerPoolTestIamPermissionCall<'a, C>
17913where
17914    C: 'a,
17915{
17916    hub: &'a CloudRun<C>,
17917    _request: GoogleIamV1TestIamPermissionsRequest,
17918    _resource: String,
17919    _delegate: Option<&'a mut dyn common::Delegate>,
17920    _additional_params: HashMap<String, String>,
17921    _scopes: BTreeSet<String>,
17922}
17923
17924impl<'a, C> common::CallBuilder for ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {}
17925
17926impl<'a, C> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C>
17927where
17928    C: common::Connector,
17929{
17930    /// Perform the operation you have build so far.
17931    pub async fn doit(
17932        mut self,
17933    ) -> common::Result<(common::Response, GoogleIamV1TestIamPermissionsResponse)> {
17934        use std::borrow::Cow;
17935        use std::io::{Read, Seek};
17936
17937        use common::{url::Params, ToParts};
17938        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17939
17940        let mut dd = common::DefaultDelegate;
17941        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17942        dlg.begin(common::MethodInfo {
17943            id: "run.projects.locations.workerPools.testIamPermissions",
17944            http_method: hyper::Method::POST,
17945        });
17946
17947        for &field in ["alt", "resource"].iter() {
17948            if self._additional_params.contains_key(field) {
17949                dlg.finished(false);
17950                return Err(common::Error::FieldClash(field));
17951            }
17952        }
17953
17954        let mut params = Params::with_capacity(4 + self._additional_params.len());
17955        params.push("resource", self._resource);
17956
17957        params.extend(self._additional_params.iter());
17958
17959        params.push("alt", "json");
17960        let mut url = self.hub._base_url.clone() + "v2/{+resource}:testIamPermissions";
17961        if self._scopes.is_empty() {
17962            self._scopes
17963                .insert(Scope::CloudPlatform.as_ref().to_string());
17964        }
17965
17966        #[allow(clippy::single_element_loop)]
17967        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17968            url = params.uri_replacement(url, param_name, find_this, true);
17969        }
17970        {
17971            let to_remove = ["resource"];
17972            params.remove_params(&to_remove);
17973        }
17974
17975        let url = params.parse_with_url(&url);
17976
17977        let mut json_mime_type = mime::APPLICATION_JSON;
17978        let mut request_value_reader = {
17979            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17980            common::remove_json_null_values(&mut value);
17981            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17982            serde_json::to_writer(&mut dst, &value).unwrap();
17983            dst
17984        };
17985        let request_size = request_value_reader
17986            .seek(std::io::SeekFrom::End(0))
17987            .unwrap();
17988        request_value_reader
17989            .seek(std::io::SeekFrom::Start(0))
17990            .unwrap();
17991
17992        loop {
17993            let token = match self
17994                .hub
17995                .auth
17996                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17997                .await
17998            {
17999                Ok(token) => token,
18000                Err(e) => match dlg.token(e) {
18001                    Ok(token) => token,
18002                    Err(e) => {
18003                        dlg.finished(false);
18004                        return Err(common::Error::MissingToken(e));
18005                    }
18006                },
18007            };
18008            request_value_reader
18009                .seek(std::io::SeekFrom::Start(0))
18010                .unwrap();
18011            let mut req_result = {
18012                let client = &self.hub.client;
18013                dlg.pre_request();
18014                let mut req_builder = hyper::Request::builder()
18015                    .method(hyper::Method::POST)
18016                    .uri(url.as_str())
18017                    .header(USER_AGENT, self.hub._user_agent.clone());
18018
18019                if let Some(token) = token.as_ref() {
18020                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18021                }
18022
18023                let request = req_builder
18024                    .header(CONTENT_TYPE, json_mime_type.to_string())
18025                    .header(CONTENT_LENGTH, request_size as u64)
18026                    .body(common::to_body(
18027                        request_value_reader.get_ref().clone().into(),
18028                    ));
18029
18030                client.request(request.unwrap()).await
18031            };
18032
18033            match req_result {
18034                Err(err) => {
18035                    if let common::Retry::After(d) = dlg.http_error(&err) {
18036                        sleep(d).await;
18037                        continue;
18038                    }
18039                    dlg.finished(false);
18040                    return Err(common::Error::HttpError(err));
18041                }
18042                Ok(res) => {
18043                    let (mut parts, body) = res.into_parts();
18044                    let mut body = common::Body::new(body);
18045                    if !parts.status.is_success() {
18046                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18047                        let error = serde_json::from_str(&common::to_string(&bytes));
18048                        let response = common::to_response(parts, bytes.into());
18049
18050                        if let common::Retry::After(d) =
18051                            dlg.http_failure(&response, error.as_ref().ok())
18052                        {
18053                            sleep(d).await;
18054                            continue;
18055                        }
18056
18057                        dlg.finished(false);
18058
18059                        return Err(match error {
18060                            Ok(value) => common::Error::BadRequest(value),
18061                            _ => common::Error::Failure(response),
18062                        });
18063                    }
18064                    let response = {
18065                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18066                        let encoded = common::to_string(&bytes);
18067                        match serde_json::from_str(&encoded) {
18068                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18069                            Err(error) => {
18070                                dlg.response_json_decode_error(&encoded, &error);
18071                                return Err(common::Error::JsonDecodeError(
18072                                    encoded.to_string(),
18073                                    error,
18074                                ));
18075                            }
18076                        }
18077                    };
18078
18079                    dlg.finished(true);
18080                    return Ok(response);
18081                }
18082            }
18083        }
18084    }
18085
18086    ///
18087    /// Sets the *request* property to the given value.
18088    ///
18089    /// Even though the property as already been set when instantiating this call,
18090    /// we provide this method for API completeness.
18091    pub fn request(
18092        mut self,
18093        new_value: GoogleIamV1TestIamPermissionsRequest,
18094    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {
18095        self._request = new_value;
18096        self
18097    }
18098    /// 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.
18099    ///
18100    /// Sets the *resource* path property to the given value.
18101    ///
18102    /// Even though the property as already been set when instantiating this call,
18103    /// we provide this method for API completeness.
18104    pub fn resource(
18105        mut self,
18106        new_value: &str,
18107    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {
18108        self._resource = new_value.to_string();
18109        self
18110    }
18111    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18112    /// while executing the actual API request.
18113    ///
18114    /// ````text
18115    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18116    /// ````
18117    ///
18118    /// Sets the *delegate* property to the given value.
18119    pub fn delegate(
18120        mut self,
18121        new_value: &'a mut dyn common::Delegate,
18122    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {
18123        self._delegate = Some(new_value);
18124        self
18125    }
18126
18127    /// Set any additional parameter of the query string used in the request.
18128    /// It should be used to set parameters which are not yet available through their own
18129    /// setters.
18130    ///
18131    /// Please note that this method must not be used to set any of the known parameters
18132    /// which have their own setter method. If done anyway, the request will fail.
18133    ///
18134    /// # Additional Parameters
18135    ///
18136    /// * *$.xgafv* (query-string) - V1 error format.
18137    /// * *access_token* (query-string) - OAuth access token.
18138    /// * *alt* (query-string) - Data format for response.
18139    /// * *callback* (query-string) - JSONP
18140    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18141    /// * *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.
18142    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18143    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18144    /// * *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.
18145    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18146    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18147    pub fn param<T>(
18148        mut self,
18149        name: T,
18150        value: T,
18151    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C>
18152    where
18153        T: AsRef<str>,
18154    {
18155        self._additional_params
18156            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18157        self
18158    }
18159
18160    /// Identifies the authorization scope for the method you are building.
18161    ///
18162    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18163    /// [`Scope::CloudPlatform`].
18164    ///
18165    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18166    /// tokens for more than one scope.
18167    ///
18168    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18169    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18170    /// sufficient, a read-write scope will do as well.
18171    pub fn add_scope<St>(
18172        mut self,
18173        scope: St,
18174    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C>
18175    where
18176        St: AsRef<str>,
18177    {
18178        self._scopes.insert(String::from(scope.as_ref()));
18179        self
18180    }
18181    /// Identifies the authorization scope(s) for the method you are building.
18182    ///
18183    /// See [`Self::add_scope()`] for details.
18184    pub fn add_scopes<I, St>(
18185        mut self,
18186        scopes: I,
18187    ) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C>
18188    where
18189        I: IntoIterator<Item = St>,
18190        St: AsRef<str>,
18191    {
18192        self._scopes
18193            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18194        self
18195    }
18196
18197    /// Removes all scopes, and no default scope will be used either.
18198    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18199    /// for details).
18200    pub fn clear_scopes(mut self) -> ProjectLocationWorkerPoolTestIamPermissionCall<'a, C> {
18201        self._scopes.clear();
18202        self
18203    }
18204}
18205
18206/// Export image for a given resource.
18207///
18208/// A builder for the *locations.exportImage* method supported by a *project* resource.
18209/// It is not used directly, but through a [`ProjectMethods`] instance.
18210///
18211/// # Example
18212///
18213/// Instantiate a resource method builder
18214///
18215/// ```test_harness,no_run
18216/// # extern crate hyper;
18217/// # extern crate hyper_rustls;
18218/// # extern crate google_run2 as run2;
18219/// use run2::api::GoogleCloudRunV2ExportImageRequest;
18220/// # async fn dox() {
18221/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18222///
18223/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18224/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18225/// #     .with_native_roots()
18226/// #     .unwrap()
18227/// #     .https_only()
18228/// #     .enable_http2()
18229/// #     .build();
18230///
18231/// # let executor = hyper_util::rt::TokioExecutor::new();
18232/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18233/// #     secret,
18234/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18235/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18236/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18237/// #     ),
18238/// # ).build().await.unwrap();
18239///
18240/// # let client = hyper_util::client::legacy::Client::builder(
18241/// #     hyper_util::rt::TokioExecutor::new()
18242/// # )
18243/// # .build(
18244/// #     hyper_rustls::HttpsConnectorBuilder::new()
18245/// #         .with_native_roots()
18246/// #         .unwrap()
18247/// #         .https_or_http()
18248/// #         .enable_http2()
18249/// #         .build()
18250/// # );
18251/// # let mut hub = CloudRun::new(client, auth);
18252/// // As the method needs a request, you would usually fill it with the desired information
18253/// // into the respective structure. Some of the parts shown here might not be applicable !
18254/// // Values shown here are possibly random and not representative !
18255/// let mut req = GoogleCloudRunV2ExportImageRequest::default();
18256///
18257/// // You can configure optional parameters by calling the respective setters at will, and
18258/// // execute the final call using `doit()`.
18259/// // Values shown here are possibly random and not representative !
18260/// let result = hub.projects().locations_export_image(req, "name")
18261///              .doit().await;
18262/// # }
18263/// ```
18264pub struct ProjectLocationExportImageCall<'a, C>
18265where
18266    C: 'a,
18267{
18268    hub: &'a CloudRun<C>,
18269    _request: GoogleCloudRunV2ExportImageRequest,
18270    _name: String,
18271    _delegate: Option<&'a mut dyn common::Delegate>,
18272    _additional_params: HashMap<String, String>,
18273    _scopes: BTreeSet<String>,
18274}
18275
18276impl<'a, C> common::CallBuilder for ProjectLocationExportImageCall<'a, C> {}
18277
18278impl<'a, C> ProjectLocationExportImageCall<'a, C>
18279where
18280    C: common::Connector,
18281{
18282    /// Perform the operation you have build so far.
18283    pub async fn doit(
18284        mut self,
18285    ) -> common::Result<(common::Response, GoogleCloudRunV2ExportImageResponse)> {
18286        use std::borrow::Cow;
18287        use std::io::{Read, Seek};
18288
18289        use common::{url::Params, ToParts};
18290        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18291
18292        let mut dd = common::DefaultDelegate;
18293        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18294        dlg.begin(common::MethodInfo {
18295            id: "run.projects.locations.exportImage",
18296            http_method: hyper::Method::POST,
18297        });
18298
18299        for &field in ["alt", "name"].iter() {
18300            if self._additional_params.contains_key(field) {
18301                dlg.finished(false);
18302                return Err(common::Error::FieldClash(field));
18303            }
18304        }
18305
18306        let mut params = Params::with_capacity(4 + self._additional_params.len());
18307        params.push("name", self._name);
18308
18309        params.extend(self._additional_params.iter());
18310
18311        params.push("alt", "json");
18312        let mut url = self.hub._base_url.clone() + "v2/{+name}:exportImage";
18313        if self._scopes.is_empty() {
18314            self._scopes
18315                .insert(Scope::CloudPlatform.as_ref().to_string());
18316        }
18317
18318        #[allow(clippy::single_element_loop)]
18319        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18320            url = params.uri_replacement(url, param_name, find_this, true);
18321        }
18322        {
18323            let to_remove = ["name"];
18324            params.remove_params(&to_remove);
18325        }
18326
18327        let url = params.parse_with_url(&url);
18328
18329        let mut json_mime_type = mime::APPLICATION_JSON;
18330        let mut request_value_reader = {
18331            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18332            common::remove_json_null_values(&mut value);
18333            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18334            serde_json::to_writer(&mut dst, &value).unwrap();
18335            dst
18336        };
18337        let request_size = request_value_reader
18338            .seek(std::io::SeekFrom::End(0))
18339            .unwrap();
18340        request_value_reader
18341            .seek(std::io::SeekFrom::Start(0))
18342            .unwrap();
18343
18344        loop {
18345            let token = match self
18346                .hub
18347                .auth
18348                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18349                .await
18350            {
18351                Ok(token) => token,
18352                Err(e) => match dlg.token(e) {
18353                    Ok(token) => token,
18354                    Err(e) => {
18355                        dlg.finished(false);
18356                        return Err(common::Error::MissingToken(e));
18357                    }
18358                },
18359            };
18360            request_value_reader
18361                .seek(std::io::SeekFrom::Start(0))
18362                .unwrap();
18363            let mut req_result = {
18364                let client = &self.hub.client;
18365                dlg.pre_request();
18366                let mut req_builder = hyper::Request::builder()
18367                    .method(hyper::Method::POST)
18368                    .uri(url.as_str())
18369                    .header(USER_AGENT, self.hub._user_agent.clone());
18370
18371                if let Some(token) = token.as_ref() {
18372                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18373                }
18374
18375                let request = req_builder
18376                    .header(CONTENT_TYPE, json_mime_type.to_string())
18377                    .header(CONTENT_LENGTH, request_size as u64)
18378                    .body(common::to_body(
18379                        request_value_reader.get_ref().clone().into(),
18380                    ));
18381
18382                client.request(request.unwrap()).await
18383            };
18384
18385            match req_result {
18386                Err(err) => {
18387                    if let common::Retry::After(d) = dlg.http_error(&err) {
18388                        sleep(d).await;
18389                        continue;
18390                    }
18391                    dlg.finished(false);
18392                    return Err(common::Error::HttpError(err));
18393                }
18394                Ok(res) => {
18395                    let (mut parts, body) = res.into_parts();
18396                    let mut body = common::Body::new(body);
18397                    if !parts.status.is_success() {
18398                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18399                        let error = serde_json::from_str(&common::to_string(&bytes));
18400                        let response = common::to_response(parts, bytes.into());
18401
18402                        if let common::Retry::After(d) =
18403                            dlg.http_failure(&response, error.as_ref().ok())
18404                        {
18405                            sleep(d).await;
18406                            continue;
18407                        }
18408
18409                        dlg.finished(false);
18410
18411                        return Err(match error {
18412                            Ok(value) => common::Error::BadRequest(value),
18413                            _ => common::Error::Failure(response),
18414                        });
18415                    }
18416                    let response = {
18417                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18418                        let encoded = common::to_string(&bytes);
18419                        match serde_json::from_str(&encoded) {
18420                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18421                            Err(error) => {
18422                                dlg.response_json_decode_error(&encoded, &error);
18423                                return Err(common::Error::JsonDecodeError(
18424                                    encoded.to_string(),
18425                                    error,
18426                                ));
18427                            }
18428                        }
18429                    };
18430
18431                    dlg.finished(true);
18432                    return Ok(response);
18433                }
18434            }
18435        }
18436    }
18437
18438    ///
18439    /// Sets the *request* property to the given value.
18440    ///
18441    /// Even though the property as already been set when instantiating this call,
18442    /// we provide this method for API completeness.
18443    pub fn request(
18444        mut self,
18445        new_value: GoogleCloudRunV2ExportImageRequest,
18446    ) -> ProjectLocationExportImageCall<'a, C> {
18447        self._request = new_value;
18448        self
18449    }
18450    /// Required. The name of the resource of which image metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
18451    ///
18452    /// Sets the *name* path property to the given value.
18453    ///
18454    /// Even though the property as already been set when instantiating this call,
18455    /// we provide this method for API completeness.
18456    pub fn name(mut self, new_value: &str) -> ProjectLocationExportImageCall<'a, C> {
18457        self._name = new_value.to_string();
18458        self
18459    }
18460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18461    /// while executing the actual API request.
18462    ///
18463    /// ````text
18464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18465    /// ````
18466    ///
18467    /// Sets the *delegate* property to the given value.
18468    pub fn delegate(
18469        mut self,
18470        new_value: &'a mut dyn common::Delegate,
18471    ) -> ProjectLocationExportImageCall<'a, C> {
18472        self._delegate = Some(new_value);
18473        self
18474    }
18475
18476    /// Set any additional parameter of the query string used in the request.
18477    /// It should be used to set parameters which are not yet available through their own
18478    /// setters.
18479    ///
18480    /// Please note that this method must not be used to set any of the known parameters
18481    /// which have their own setter method. If done anyway, the request will fail.
18482    ///
18483    /// # Additional Parameters
18484    ///
18485    /// * *$.xgafv* (query-string) - V1 error format.
18486    /// * *access_token* (query-string) - OAuth access token.
18487    /// * *alt* (query-string) - Data format for response.
18488    /// * *callback* (query-string) - JSONP
18489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18490    /// * *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.
18491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18493    /// * *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.
18494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18496    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationExportImageCall<'a, C>
18497    where
18498        T: AsRef<str>,
18499    {
18500        self._additional_params
18501            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18502        self
18503    }
18504
18505    /// Identifies the authorization scope for the method you are building.
18506    ///
18507    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18508    /// [`Scope::CloudPlatform`].
18509    ///
18510    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18511    /// tokens for more than one scope.
18512    ///
18513    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18514    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18515    /// sufficient, a read-write scope will do as well.
18516    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationExportImageCall<'a, C>
18517    where
18518        St: AsRef<str>,
18519    {
18520        self._scopes.insert(String::from(scope.as_ref()));
18521        self
18522    }
18523    /// Identifies the authorization scope(s) for the method you are building.
18524    ///
18525    /// See [`Self::add_scope()`] for details.
18526    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationExportImageCall<'a, C>
18527    where
18528        I: IntoIterator<Item = St>,
18529        St: AsRef<str>,
18530    {
18531        self._scopes
18532            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18533        self
18534    }
18535
18536    /// Removes all scopes, and no default scope will be used either.
18537    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18538    /// for details).
18539    pub fn clear_scopes(mut self) -> ProjectLocationExportImageCall<'a, C> {
18540        self._scopes.clear();
18541        self
18542    }
18543}
18544
18545/// Export image metadata for a given resource.
18546///
18547/// A builder for the *locations.exportImageMetadata* method supported by a *project* resource.
18548/// It is not used directly, but through a [`ProjectMethods`] instance.
18549///
18550/// # Example
18551///
18552/// Instantiate a resource method builder
18553///
18554/// ```test_harness,no_run
18555/// # extern crate hyper;
18556/// # extern crate hyper_rustls;
18557/// # extern crate google_run2 as run2;
18558/// # async fn dox() {
18559/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18560///
18561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18562/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18563/// #     .with_native_roots()
18564/// #     .unwrap()
18565/// #     .https_only()
18566/// #     .enable_http2()
18567/// #     .build();
18568///
18569/// # let executor = hyper_util::rt::TokioExecutor::new();
18570/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18571/// #     secret,
18572/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18573/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18574/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18575/// #     ),
18576/// # ).build().await.unwrap();
18577///
18578/// # let client = hyper_util::client::legacy::Client::builder(
18579/// #     hyper_util::rt::TokioExecutor::new()
18580/// # )
18581/// # .build(
18582/// #     hyper_rustls::HttpsConnectorBuilder::new()
18583/// #         .with_native_roots()
18584/// #         .unwrap()
18585/// #         .https_or_http()
18586/// #         .enable_http2()
18587/// #         .build()
18588/// # );
18589/// # let mut hub = CloudRun::new(client, auth);
18590/// // You can configure optional parameters by calling the respective setters at will, and
18591/// // execute the final call using `doit()`.
18592/// // Values shown here are possibly random and not representative !
18593/// let result = hub.projects().locations_export_image_metadata("name")
18594///              .doit().await;
18595/// # }
18596/// ```
18597pub struct ProjectLocationExportImageMetadataCall<'a, C>
18598where
18599    C: 'a,
18600{
18601    hub: &'a CloudRun<C>,
18602    _name: String,
18603    _delegate: Option<&'a mut dyn common::Delegate>,
18604    _additional_params: HashMap<String, String>,
18605    _scopes: BTreeSet<String>,
18606}
18607
18608impl<'a, C> common::CallBuilder for ProjectLocationExportImageMetadataCall<'a, C> {}
18609
18610impl<'a, C> ProjectLocationExportImageMetadataCall<'a, C>
18611where
18612    C: common::Connector,
18613{
18614    /// Perform the operation you have build so far.
18615    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Metadata)> {
18616        use std::borrow::Cow;
18617        use std::io::{Read, Seek};
18618
18619        use common::{url::Params, ToParts};
18620        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18621
18622        let mut dd = common::DefaultDelegate;
18623        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18624        dlg.begin(common::MethodInfo {
18625            id: "run.projects.locations.exportImageMetadata",
18626            http_method: hyper::Method::GET,
18627        });
18628
18629        for &field in ["alt", "name"].iter() {
18630            if self._additional_params.contains_key(field) {
18631                dlg.finished(false);
18632                return Err(common::Error::FieldClash(field));
18633            }
18634        }
18635
18636        let mut params = Params::with_capacity(3 + self._additional_params.len());
18637        params.push("name", self._name);
18638
18639        params.extend(self._additional_params.iter());
18640
18641        params.push("alt", "json");
18642        let mut url = self.hub._base_url.clone() + "v2/{+name}:exportImageMetadata";
18643        if self._scopes.is_empty() {
18644            self._scopes
18645                .insert(Scope::CloudPlatform.as_ref().to_string());
18646        }
18647
18648        #[allow(clippy::single_element_loop)]
18649        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18650            url = params.uri_replacement(url, param_name, find_this, true);
18651        }
18652        {
18653            let to_remove = ["name"];
18654            params.remove_params(&to_remove);
18655        }
18656
18657        let url = params.parse_with_url(&url);
18658
18659        loop {
18660            let token = match self
18661                .hub
18662                .auth
18663                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18664                .await
18665            {
18666                Ok(token) => token,
18667                Err(e) => match dlg.token(e) {
18668                    Ok(token) => token,
18669                    Err(e) => {
18670                        dlg.finished(false);
18671                        return Err(common::Error::MissingToken(e));
18672                    }
18673                },
18674            };
18675            let mut req_result = {
18676                let client = &self.hub.client;
18677                dlg.pre_request();
18678                let mut req_builder = hyper::Request::builder()
18679                    .method(hyper::Method::GET)
18680                    .uri(url.as_str())
18681                    .header(USER_AGENT, self.hub._user_agent.clone());
18682
18683                if let Some(token) = token.as_ref() {
18684                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18685                }
18686
18687                let request = req_builder
18688                    .header(CONTENT_LENGTH, 0_u64)
18689                    .body(common::to_body::<String>(None));
18690
18691                client.request(request.unwrap()).await
18692            };
18693
18694            match req_result {
18695                Err(err) => {
18696                    if let common::Retry::After(d) = dlg.http_error(&err) {
18697                        sleep(d).await;
18698                        continue;
18699                    }
18700                    dlg.finished(false);
18701                    return Err(common::Error::HttpError(err));
18702                }
18703                Ok(res) => {
18704                    let (mut parts, body) = res.into_parts();
18705                    let mut body = common::Body::new(body);
18706                    if !parts.status.is_success() {
18707                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18708                        let error = serde_json::from_str(&common::to_string(&bytes));
18709                        let response = common::to_response(parts, bytes.into());
18710
18711                        if let common::Retry::After(d) =
18712                            dlg.http_failure(&response, error.as_ref().ok())
18713                        {
18714                            sleep(d).await;
18715                            continue;
18716                        }
18717
18718                        dlg.finished(false);
18719
18720                        return Err(match error {
18721                            Ok(value) => common::Error::BadRequest(value),
18722                            _ => common::Error::Failure(response),
18723                        });
18724                    }
18725                    let response = {
18726                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18727                        let encoded = common::to_string(&bytes);
18728                        match serde_json::from_str(&encoded) {
18729                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18730                            Err(error) => {
18731                                dlg.response_json_decode_error(&encoded, &error);
18732                                return Err(common::Error::JsonDecodeError(
18733                                    encoded.to_string(),
18734                                    error,
18735                                ));
18736                            }
18737                        }
18738                    };
18739
18740                    dlg.finished(true);
18741                    return Ok(response);
18742                }
18743            }
18744        }
18745    }
18746
18747    /// Required. The name of the resource of which image metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution
18748    ///
18749    /// Sets the *name* path property to the given value.
18750    ///
18751    /// Even though the property as already been set when instantiating this call,
18752    /// we provide this method for API completeness.
18753    pub fn name(mut self, new_value: &str) -> ProjectLocationExportImageMetadataCall<'a, C> {
18754        self._name = new_value.to_string();
18755        self
18756    }
18757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18758    /// while executing the actual API request.
18759    ///
18760    /// ````text
18761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18762    /// ````
18763    ///
18764    /// Sets the *delegate* property to the given value.
18765    pub fn delegate(
18766        mut self,
18767        new_value: &'a mut dyn common::Delegate,
18768    ) -> ProjectLocationExportImageMetadataCall<'a, C> {
18769        self._delegate = Some(new_value);
18770        self
18771    }
18772
18773    /// Set any additional parameter of the query string used in the request.
18774    /// It should be used to set parameters which are not yet available through their own
18775    /// setters.
18776    ///
18777    /// Please note that this method must not be used to set any of the known parameters
18778    /// which have their own setter method. If done anyway, the request will fail.
18779    ///
18780    /// # Additional Parameters
18781    ///
18782    /// * *$.xgafv* (query-string) - V1 error format.
18783    /// * *access_token* (query-string) - OAuth access token.
18784    /// * *alt* (query-string) - Data format for response.
18785    /// * *callback* (query-string) - JSONP
18786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18787    /// * *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.
18788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18790    /// * *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.
18791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18793    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationExportImageMetadataCall<'a, C>
18794    where
18795        T: AsRef<str>,
18796    {
18797        self._additional_params
18798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18799        self
18800    }
18801
18802    /// Identifies the authorization scope for the method you are building.
18803    ///
18804    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18805    /// [`Scope::CloudPlatform`].
18806    ///
18807    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18808    /// tokens for more than one scope.
18809    ///
18810    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18811    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18812    /// sufficient, a read-write scope will do as well.
18813    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationExportImageMetadataCall<'a, C>
18814    where
18815        St: AsRef<str>,
18816    {
18817        self._scopes.insert(String::from(scope.as_ref()));
18818        self
18819    }
18820    /// Identifies the authorization scope(s) for the method you are building.
18821    ///
18822    /// See [`Self::add_scope()`] for details.
18823    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationExportImageMetadataCall<'a, C>
18824    where
18825        I: IntoIterator<Item = St>,
18826        St: AsRef<str>,
18827    {
18828        self._scopes
18829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18830        self
18831    }
18832
18833    /// Removes all scopes, and no default scope will be used either.
18834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18835    /// for details).
18836    pub fn clear_scopes(mut self) -> ProjectLocationExportImageMetadataCall<'a, C> {
18837        self._scopes.clear();
18838        self
18839    }
18840}
18841
18842/// Export generated customer metadata for a given resource.
18843///
18844/// A builder for the *locations.exportMetadata* method supported by a *project* resource.
18845/// It is not used directly, but through a [`ProjectMethods`] instance.
18846///
18847/// # Example
18848///
18849/// Instantiate a resource method builder
18850///
18851/// ```test_harness,no_run
18852/// # extern crate hyper;
18853/// # extern crate hyper_rustls;
18854/// # extern crate google_run2 as run2;
18855/// # async fn dox() {
18856/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18857///
18858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18859/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18860/// #     .with_native_roots()
18861/// #     .unwrap()
18862/// #     .https_only()
18863/// #     .enable_http2()
18864/// #     .build();
18865///
18866/// # let executor = hyper_util::rt::TokioExecutor::new();
18867/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18868/// #     secret,
18869/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18870/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18871/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18872/// #     ),
18873/// # ).build().await.unwrap();
18874///
18875/// # let client = hyper_util::client::legacy::Client::builder(
18876/// #     hyper_util::rt::TokioExecutor::new()
18877/// # )
18878/// # .build(
18879/// #     hyper_rustls::HttpsConnectorBuilder::new()
18880/// #         .with_native_roots()
18881/// #         .unwrap()
18882/// #         .https_or_http()
18883/// #         .enable_http2()
18884/// #         .build()
18885/// # );
18886/// # let mut hub = CloudRun::new(client, auth);
18887/// // You can configure optional parameters by calling the respective setters at will, and
18888/// // execute the final call using `doit()`.
18889/// // Values shown here are possibly random and not representative !
18890/// let result = hub.projects().locations_export_metadata("name")
18891///              .doit().await;
18892/// # }
18893/// ```
18894pub struct ProjectLocationExportMetadataCall<'a, C>
18895where
18896    C: 'a,
18897{
18898    hub: &'a CloudRun<C>,
18899    _name: String,
18900    _delegate: Option<&'a mut dyn common::Delegate>,
18901    _additional_params: HashMap<String, String>,
18902    _scopes: BTreeSet<String>,
18903}
18904
18905impl<'a, C> common::CallBuilder for ProjectLocationExportMetadataCall<'a, C> {}
18906
18907impl<'a, C> ProjectLocationExportMetadataCall<'a, C>
18908where
18909    C: common::Connector,
18910{
18911    /// Perform the operation you have build so far.
18912    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Metadata)> {
18913        use std::borrow::Cow;
18914        use std::io::{Read, Seek};
18915
18916        use common::{url::Params, ToParts};
18917        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18918
18919        let mut dd = common::DefaultDelegate;
18920        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18921        dlg.begin(common::MethodInfo {
18922            id: "run.projects.locations.exportMetadata",
18923            http_method: hyper::Method::GET,
18924        });
18925
18926        for &field in ["alt", "name"].iter() {
18927            if self._additional_params.contains_key(field) {
18928                dlg.finished(false);
18929                return Err(common::Error::FieldClash(field));
18930            }
18931        }
18932
18933        let mut params = Params::with_capacity(3 + self._additional_params.len());
18934        params.push("name", self._name);
18935
18936        params.extend(self._additional_params.iter());
18937
18938        params.push("alt", "json");
18939        let mut url = self.hub._base_url.clone() + "v2/{+name}:exportMetadata";
18940        if self._scopes.is_empty() {
18941            self._scopes
18942                .insert(Scope::CloudPlatform.as_ref().to_string());
18943        }
18944
18945        #[allow(clippy::single_element_loop)]
18946        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18947            url = params.uri_replacement(url, param_name, find_this, true);
18948        }
18949        {
18950            let to_remove = ["name"];
18951            params.remove_params(&to_remove);
18952        }
18953
18954        let url = params.parse_with_url(&url);
18955
18956        loop {
18957            let token = match self
18958                .hub
18959                .auth
18960                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18961                .await
18962            {
18963                Ok(token) => token,
18964                Err(e) => match dlg.token(e) {
18965                    Ok(token) => token,
18966                    Err(e) => {
18967                        dlg.finished(false);
18968                        return Err(common::Error::MissingToken(e));
18969                    }
18970                },
18971            };
18972            let mut req_result = {
18973                let client = &self.hub.client;
18974                dlg.pre_request();
18975                let mut req_builder = hyper::Request::builder()
18976                    .method(hyper::Method::GET)
18977                    .uri(url.as_str())
18978                    .header(USER_AGENT, self.hub._user_agent.clone());
18979
18980                if let Some(token) = token.as_ref() {
18981                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18982                }
18983
18984                let request = req_builder
18985                    .header(CONTENT_LENGTH, 0_u64)
18986                    .body(common::to_body::<String>(None));
18987
18988                client.request(request.unwrap()).await
18989            };
18990
18991            match req_result {
18992                Err(err) => {
18993                    if let common::Retry::After(d) = dlg.http_error(&err) {
18994                        sleep(d).await;
18995                        continue;
18996                    }
18997                    dlg.finished(false);
18998                    return Err(common::Error::HttpError(err));
18999                }
19000                Ok(res) => {
19001                    let (mut parts, body) = res.into_parts();
19002                    let mut body = common::Body::new(body);
19003                    if !parts.status.is_success() {
19004                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19005                        let error = serde_json::from_str(&common::to_string(&bytes));
19006                        let response = common::to_response(parts, bytes.into());
19007
19008                        if let common::Retry::After(d) =
19009                            dlg.http_failure(&response, error.as_ref().ok())
19010                        {
19011                            sleep(d).await;
19012                            continue;
19013                        }
19014
19015                        dlg.finished(false);
19016
19017                        return Err(match error {
19018                            Ok(value) => common::Error::BadRequest(value),
19019                            _ => common::Error::Failure(response),
19020                        });
19021                    }
19022                    let response = {
19023                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19024                        let encoded = common::to_string(&bytes);
19025                        match serde_json::from_str(&encoded) {
19026                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19027                            Err(error) => {
19028                                dlg.response_json_decode_error(&encoded, &error);
19029                                return Err(common::Error::JsonDecodeError(
19030                                    encoded.to_string(),
19031                                    error,
19032                                ));
19033                            }
19034                        }
19035                    };
19036
19037                    dlg.finished(true);
19038                    return Ok(response);
19039                }
19040            }
19041        }
19042    }
19043
19044    /// Required. The name of the resource of which metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}/services/{service}` for Service `projects/{project_id_or_number}/locations/{location}/services/{service}/revisions/{revision}` for Revision `projects/{project_id_or_number}/locations/{location}/jobs/{job}/executions/{execution}` for Execution {project_id_or_number} may contains domain-scoped project IDs
19045    ///
19046    /// Sets the *name* path property to the given value.
19047    ///
19048    /// Even though the property as already been set when instantiating this call,
19049    /// we provide this method for API completeness.
19050    pub fn name(mut self, new_value: &str) -> ProjectLocationExportMetadataCall<'a, C> {
19051        self._name = new_value.to_string();
19052        self
19053    }
19054    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19055    /// while executing the actual API request.
19056    ///
19057    /// ````text
19058    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19059    /// ````
19060    ///
19061    /// Sets the *delegate* property to the given value.
19062    pub fn delegate(
19063        mut self,
19064        new_value: &'a mut dyn common::Delegate,
19065    ) -> ProjectLocationExportMetadataCall<'a, C> {
19066        self._delegate = Some(new_value);
19067        self
19068    }
19069
19070    /// Set any additional parameter of the query string used in the request.
19071    /// It should be used to set parameters which are not yet available through their own
19072    /// setters.
19073    ///
19074    /// Please note that this method must not be used to set any of the known parameters
19075    /// which have their own setter method. If done anyway, the request will fail.
19076    ///
19077    /// # Additional Parameters
19078    ///
19079    /// * *$.xgafv* (query-string) - V1 error format.
19080    /// * *access_token* (query-string) - OAuth access token.
19081    /// * *alt* (query-string) - Data format for response.
19082    /// * *callback* (query-string) - JSONP
19083    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19084    /// * *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.
19085    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19086    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19087    /// * *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.
19088    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19089    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19090    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationExportMetadataCall<'a, C>
19091    where
19092        T: AsRef<str>,
19093    {
19094        self._additional_params
19095            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19096        self
19097    }
19098
19099    /// Identifies the authorization scope for the method you are building.
19100    ///
19101    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19102    /// [`Scope::CloudPlatform`].
19103    ///
19104    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19105    /// tokens for more than one scope.
19106    ///
19107    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19108    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19109    /// sufficient, a read-write scope will do as well.
19110    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationExportMetadataCall<'a, C>
19111    where
19112        St: AsRef<str>,
19113    {
19114        self._scopes.insert(String::from(scope.as_ref()));
19115        self
19116    }
19117    /// Identifies the authorization scope(s) for the method you are building.
19118    ///
19119    /// See [`Self::add_scope()`] for details.
19120    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationExportMetadataCall<'a, C>
19121    where
19122        I: IntoIterator<Item = St>,
19123        St: AsRef<str>,
19124    {
19125        self._scopes
19126            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19127        self
19128    }
19129
19130    /// Removes all scopes, and no default scope will be used either.
19131    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19132    /// for details).
19133    pub fn clear_scopes(mut self) -> ProjectLocationExportMetadataCall<'a, C> {
19134        self._scopes.clear();
19135        self
19136    }
19137}
19138
19139/// Export generated customer metadata for a given project.
19140///
19141/// A builder for the *locations.exportProjectMetadata* method supported by a *project* resource.
19142/// It is not used directly, but through a [`ProjectMethods`] instance.
19143///
19144/// # Example
19145///
19146/// Instantiate a resource method builder
19147///
19148/// ```test_harness,no_run
19149/// # extern crate hyper;
19150/// # extern crate hyper_rustls;
19151/// # extern crate google_run2 as run2;
19152/// # async fn dox() {
19153/// # use run2::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19154///
19155/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19156/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19157/// #     .with_native_roots()
19158/// #     .unwrap()
19159/// #     .https_only()
19160/// #     .enable_http2()
19161/// #     .build();
19162///
19163/// # let executor = hyper_util::rt::TokioExecutor::new();
19164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19165/// #     secret,
19166/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19167/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19168/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19169/// #     ),
19170/// # ).build().await.unwrap();
19171///
19172/// # let client = hyper_util::client::legacy::Client::builder(
19173/// #     hyper_util::rt::TokioExecutor::new()
19174/// # )
19175/// # .build(
19176/// #     hyper_rustls::HttpsConnectorBuilder::new()
19177/// #         .with_native_roots()
19178/// #         .unwrap()
19179/// #         .https_or_http()
19180/// #         .enable_http2()
19181/// #         .build()
19182/// # );
19183/// # let mut hub = CloudRun::new(client, auth);
19184/// // You can configure optional parameters by calling the respective setters at will, and
19185/// // execute the final call using `doit()`.
19186/// // Values shown here are possibly random and not representative !
19187/// let result = hub.projects().locations_export_project_metadata("name")
19188///              .doit().await;
19189/// # }
19190/// ```
19191pub struct ProjectLocationExportProjectMetadataCall<'a, C>
19192where
19193    C: 'a,
19194{
19195    hub: &'a CloudRun<C>,
19196    _name: String,
19197    _delegate: Option<&'a mut dyn common::Delegate>,
19198    _additional_params: HashMap<String, String>,
19199    _scopes: BTreeSet<String>,
19200}
19201
19202impl<'a, C> common::CallBuilder for ProjectLocationExportProjectMetadataCall<'a, C> {}
19203
19204impl<'a, C> ProjectLocationExportProjectMetadataCall<'a, C>
19205where
19206    C: common::Connector,
19207{
19208    /// Perform the operation you have build so far.
19209    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleCloudRunV2Metadata)> {
19210        use std::borrow::Cow;
19211        use std::io::{Read, Seek};
19212
19213        use common::{url::Params, ToParts};
19214        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19215
19216        let mut dd = common::DefaultDelegate;
19217        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19218        dlg.begin(common::MethodInfo {
19219            id: "run.projects.locations.exportProjectMetadata",
19220            http_method: hyper::Method::GET,
19221        });
19222
19223        for &field in ["alt", "name"].iter() {
19224            if self._additional_params.contains_key(field) {
19225                dlg.finished(false);
19226                return Err(common::Error::FieldClash(field));
19227            }
19228        }
19229
19230        let mut params = Params::with_capacity(3 + self._additional_params.len());
19231        params.push("name", self._name);
19232
19233        params.extend(self._additional_params.iter());
19234
19235        params.push("alt", "json");
19236        let mut url = self.hub._base_url.clone() + "v2/{+name}:exportProjectMetadata";
19237        if self._scopes.is_empty() {
19238            self._scopes
19239                .insert(Scope::CloudPlatform.as_ref().to_string());
19240        }
19241
19242        #[allow(clippy::single_element_loop)]
19243        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19244            url = params.uri_replacement(url, param_name, find_this, true);
19245        }
19246        {
19247            let to_remove = ["name"];
19248            params.remove_params(&to_remove);
19249        }
19250
19251        let url = params.parse_with_url(&url);
19252
19253        loop {
19254            let token = match self
19255                .hub
19256                .auth
19257                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19258                .await
19259            {
19260                Ok(token) => token,
19261                Err(e) => match dlg.token(e) {
19262                    Ok(token) => token,
19263                    Err(e) => {
19264                        dlg.finished(false);
19265                        return Err(common::Error::MissingToken(e));
19266                    }
19267                },
19268            };
19269            let mut req_result = {
19270                let client = &self.hub.client;
19271                dlg.pre_request();
19272                let mut req_builder = hyper::Request::builder()
19273                    .method(hyper::Method::GET)
19274                    .uri(url.as_str())
19275                    .header(USER_AGENT, self.hub._user_agent.clone());
19276
19277                if let Some(token) = token.as_ref() {
19278                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19279                }
19280
19281                let request = req_builder
19282                    .header(CONTENT_LENGTH, 0_u64)
19283                    .body(common::to_body::<String>(None));
19284
19285                client.request(request.unwrap()).await
19286            };
19287
19288            match req_result {
19289                Err(err) => {
19290                    if let common::Retry::After(d) = dlg.http_error(&err) {
19291                        sleep(d).await;
19292                        continue;
19293                    }
19294                    dlg.finished(false);
19295                    return Err(common::Error::HttpError(err));
19296                }
19297                Ok(res) => {
19298                    let (mut parts, body) = res.into_parts();
19299                    let mut body = common::Body::new(body);
19300                    if !parts.status.is_success() {
19301                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19302                        let error = serde_json::from_str(&common::to_string(&bytes));
19303                        let response = common::to_response(parts, bytes.into());
19304
19305                        if let common::Retry::After(d) =
19306                            dlg.http_failure(&response, error.as_ref().ok())
19307                        {
19308                            sleep(d).await;
19309                            continue;
19310                        }
19311
19312                        dlg.finished(false);
19313
19314                        return Err(match error {
19315                            Ok(value) => common::Error::BadRequest(value),
19316                            _ => common::Error::Failure(response),
19317                        });
19318                    }
19319                    let response = {
19320                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19321                        let encoded = common::to_string(&bytes);
19322                        match serde_json::from_str(&encoded) {
19323                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19324                            Err(error) => {
19325                                dlg.response_json_decode_error(&encoded, &error);
19326                                return Err(common::Error::JsonDecodeError(
19327                                    encoded.to_string(),
19328                                    error,
19329                                ));
19330                            }
19331                        }
19332                    };
19333
19334                    dlg.finished(true);
19335                    return Ok(response);
19336                }
19337            }
19338        }
19339    }
19340
19341    /// Required. The name of the project of which metadata should be exported. Format: `projects/{project_id_or_number}/locations/{location}` for Project in a given location.
19342    ///
19343    /// Sets the *name* path property to the given value.
19344    ///
19345    /// Even though the property as already been set when instantiating this call,
19346    /// we provide this method for API completeness.
19347    pub fn name(mut self, new_value: &str) -> ProjectLocationExportProjectMetadataCall<'a, C> {
19348        self._name = new_value.to_string();
19349        self
19350    }
19351    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19352    /// while executing the actual API request.
19353    ///
19354    /// ````text
19355    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19356    /// ````
19357    ///
19358    /// Sets the *delegate* property to the given value.
19359    pub fn delegate(
19360        mut self,
19361        new_value: &'a mut dyn common::Delegate,
19362    ) -> ProjectLocationExportProjectMetadataCall<'a, C> {
19363        self._delegate = Some(new_value);
19364        self
19365    }
19366
19367    /// Set any additional parameter of the query string used in the request.
19368    /// It should be used to set parameters which are not yet available through their own
19369    /// setters.
19370    ///
19371    /// Please note that this method must not be used to set any of the known parameters
19372    /// which have their own setter method. If done anyway, the request will fail.
19373    ///
19374    /// # Additional Parameters
19375    ///
19376    /// * *$.xgafv* (query-string) - V1 error format.
19377    /// * *access_token* (query-string) - OAuth access token.
19378    /// * *alt* (query-string) - Data format for response.
19379    /// * *callback* (query-string) - JSONP
19380    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19381    /// * *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.
19382    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19383    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19384    /// * *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.
19385    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19386    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19387    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationExportProjectMetadataCall<'a, C>
19388    where
19389        T: AsRef<str>,
19390    {
19391        self._additional_params
19392            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19393        self
19394    }
19395
19396    /// Identifies the authorization scope for the method you are building.
19397    ///
19398    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19399    /// [`Scope::CloudPlatform`].
19400    ///
19401    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19402    /// tokens for more than one scope.
19403    ///
19404    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19405    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19406    /// sufficient, a read-write scope will do as well.
19407    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationExportProjectMetadataCall<'a, C>
19408    where
19409        St: AsRef<str>,
19410    {
19411        self._scopes.insert(String::from(scope.as_ref()));
19412        self
19413    }
19414    /// Identifies the authorization scope(s) for the method you are building.
19415    ///
19416    /// See [`Self::add_scope()`] for details.
19417    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationExportProjectMetadataCall<'a, C>
19418    where
19419        I: IntoIterator<Item = St>,
19420        St: AsRef<str>,
19421    {
19422        self._scopes
19423            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19424        self
19425    }
19426
19427    /// Removes all scopes, and no default scope will be used either.
19428    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19429    /// for details).
19430    pub fn clear_scopes(mut self) -> ProjectLocationExportProjectMetadataCall<'a, C> {
19431        self._scopes.clear();
19432        self
19433    }
19434}