google_run1/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_run1 as run1;
49/// use run1::{Result, Error};
50/// # async fn dox() {
51/// use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62/// secret,
63/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64/// ).build().await.unwrap();
65///
66/// let client = hyper_util::client::legacy::Client::builder(
67/// hyper_util::rt::TokioExecutor::new()
68/// )
69/// .build(
70/// hyper_rustls::HttpsConnectorBuilder::new()
71/// .with_native_roots()
72/// .unwrap()
73/// .https_or_http()
74/// .enable_http1()
75/// .build()
76/// );
77/// let mut hub = CloudRun::new(client, auth);
78/// // You can configure optional parameters by calling the respective setters at will, and
79/// // execute the final call using `doit()`.
80/// // Values shown here are possibly random and not representative !
81/// let result = hub.namespaces().domainmappings_delete("name")
82/// .propagation_policy("duo")
83/// .kind("ipsum")
84/// .dry_run("gubergren")
85/// .api_version("Lorem")
86/// .doit().await;
87///
88/// match result {
89/// Err(e) => match e {
90/// // The Error enum provides details about what exactly happened.
91/// // You can also just use its `Debug`, `Display` or `Error` traits
92/// Error::HttpError(_)
93/// |Error::Io(_)
94/// |Error::MissingAPIKey
95/// |Error::MissingToken(_)
96/// |Error::Cancelled
97/// |Error::UploadSizeLimitExceeded(_, _)
98/// |Error::Failure(_)
99/// |Error::BadRequest(_)
100/// |Error::FieldClash(_)
101/// |Error::JsonDecodeError(_, _) => println!("{}", e),
102/// },
103/// Ok(res) => println!("Success: {:?}", res),
104/// }
105/// # }
106/// ```
107#[derive(Clone)]
108pub struct CloudRun<C> {
109 pub client: common::Client<C>,
110 pub auth: Box<dyn common::GetToken>,
111 _user_agent: String,
112 _base_url: String,
113 _root_url: String,
114}
115
116impl<C> common::Hub for CloudRun<C> {}
117
118impl<'a, C> CloudRun<C> {
119 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudRun<C> {
120 CloudRun {
121 client,
122 auth: Box::new(auth),
123 _user_agent: "google-api-rust-client/6.0.0".to_string(),
124 _base_url: "https://run.googleapis.com/".to_string(),
125 _root_url: "https://run.googleapis.com/".to_string(),
126 }
127 }
128
129 pub fn namespaces(&'a self) -> NamespaceMethods<'a, C> {
130 NamespaceMethods { hub: self }
131 }
132 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
133 ProjectMethods { hub: self }
134 }
135
136 /// Set the user-agent header field to use in all requests to the server.
137 /// It defaults to `google-api-rust-client/6.0.0`.
138 ///
139 /// Returns the previously set user-agent.
140 pub fn user_agent(&mut self, agent_name: String) -> String {
141 std::mem::replace(&mut self._user_agent, agent_name)
142 }
143
144 /// Set the base url to use in all requests to the server.
145 /// It defaults to `https://run.googleapis.com/`.
146 ///
147 /// Returns the previously set base url.
148 pub fn base_url(&mut self, new_base_url: String) -> String {
149 std::mem::replace(&mut self._base_url, new_base_url)
150 }
151
152 /// Set the root url to use in all requests to the server.
153 /// It defaults to `https://run.googleapis.com/`.
154 ///
155 /// Returns the previously set root url.
156 pub fn root_url(&mut self, new_root_url: String) -> String {
157 std::mem::replace(&mut self._root_url, new_root_url)
158 }
159}
160
161// ############
162// SCHEMAS ###
163// ##########
164/// Information for connecting over HTTP(s).
165///
166/// This type is not used in any activity, and only used as *part* of another schema.
167///
168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
169#[serde_with::serde_as]
170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
171pub struct Addressable {
172 /// no description provided
173 pub url: Option<String>,
174}
175
176impl common::Part for Addressable {}
177
178/// 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.
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 AuditConfig {
186 /// The configuration for logging of each type of permission.
187 #[serde(rename = "auditLogConfigs")]
188 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
189 /// 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.
190 pub service: Option<String>,
191}
192
193impl common::Part for AuditConfig {}
194
195/// 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.
196///
197/// This type is not used in any activity, and only used as *part* of another schema.
198///
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct AuditLogConfig {
203 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
204 #[serde(rename = "exemptedMembers")]
205 pub exempted_members: Option<Vec<String>>,
206 /// The log type that this config enables.
207 #[serde(rename = "logType")]
208 pub log_type: Option<String>,
209}
210
211impl common::Part for AuditLogConfig {}
212
213/// A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via [Search Console](https://search.google.com/search-console/welcome).
214///
215/// This type is not used in any activity, and only used as *part* of another schema.
216///
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct AuthorizedDomain {
221 /// Relative name of the domain authorized for use. Example: `example.com`.
222 pub id: Option<String>,
223 /// Deprecated Read only. Full path to the `AuthorizedDomain` resource in the API. Example: `projects/myproject/authorizedDomains/example.com`.
224 pub name: Option<String>,
225}
226
227impl common::Part for AuthorizedDomain {}
228
229/// Associates `members`, or principals, with a `role`.
230///
231/// This type is not used in any activity, and only used as *part* of another schema.
232///
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct Binding {
237 /// 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).
238 pub condition: Option<Expr>,
239 /// 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`.
240 pub members: Option<Vec<String>>,
241 /// 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).
242 pub role: Option<String>,
243}
244
245impl common::Part for Binding {}
246
247/// Storage volume source using the Container Storage Interface.
248///
249/// This type is not used in any activity, and only used as *part* of another schema.
250///
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct CSIVolumeSource {
255 /// name of the CSI driver for the requested storage system. Cloud Run supports the following drivers: * gcsfuse.run.googleapis.com : Mount a Cloud Storage Bucket as a volume.
256 pub driver: Option<String>,
257 /// If true, mount the volume as read only. Defaults to false.
258 #[serde(rename = "readOnly")]
259 pub read_only: Option<bool>,
260 /// stores driver specific attributes. For Google Cloud Storage volumes, the following attributes are supported: * bucketName: the name of the Cloud Storage bucket to mount. The Cloud Run Service identity must have access to this bucket.
261 #[serde(rename = "volumeAttributes")]
262 pub volume_attributes: Option<HashMap<String, String>>,
263}
264
265impl common::Part for CSIVolumeSource {}
266
267/// Request message for cancelling an execution.
268///
269/// # Activities
270///
271/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
272/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
273///
274/// * [executions cancel namespaces](NamespaceExecutionCancelCall) (request)
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct CancelExecutionRequest {
279 _never_set: Option<bool>,
280}
281
282impl common::RequestValue for CancelExecutionRequest {}
283
284/// Not supported by Cloud Run. ConfigMapEnvSource selects a ConfigMap to populate the environment variables with. The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.
285///
286/// This type is not used in any activity, and only used as *part* of another schema.
287///
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct ConfigMapEnvSource {
292 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
293 #[serde(rename = "localObjectReference")]
294 pub local_object_reference: Option<LocalObjectReference>,
295 /// The ConfigMap to select from.
296 pub name: Option<String>,
297 /// Specify whether the ConfigMap must be defined.
298 pub optional: Option<bool>,
299}
300
301impl common::Part for ConfigMapEnvSource {}
302
303/// Not supported by Cloud Run.
304///
305/// This type is not used in any activity, and only used as *part* of another schema.
306///
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct ConfigMapKeySelector {
311 /// Required. Not supported by Cloud Run.
312 pub key: Option<String>,
313 /// Not supported by Cloud Run.
314 #[serde(rename = "localObjectReference")]
315 pub local_object_reference: Option<LocalObjectReference>,
316 /// Required. Not supported by Cloud Run.
317 pub name: Option<String>,
318 /// Not supported by Cloud Run.
319 pub optional: Option<bool>,
320}
321
322impl common::Part for ConfigMapKeySelector {}
323
324/// Not supported by Cloud Run. Adapts a ConfigMap into a volume. The contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct ConfigMapVolumeSource {
332 /// (Optional) Integer representation of mode bits to use on created files by default. Must be a value between 01 and 0777 (octal). If 0 or not set, it will default to 0644. 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 777 (a=rwx), set to 0777 (octal) or 511 (base-10). 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.
333 #[serde(rename = "defaultMode")]
334 pub default_mode: Option<i32>,
335 /// (Optional) If unspecified, each key-value pair in the Data field of the referenced Secret will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified that is not present in the Secret, the volume setup will error unless it is marked optional.
336 pub items: Option<Vec<KeyToPath>>,
337 /// Name of the config.
338 pub name: Option<String>,
339 /// (Optional) Specify whether the Secret or its keys must be defined.
340 pub optional: Option<bool>,
341}
342
343impl common::Part for ConfigMapVolumeSource {}
344
345/// Configuration represents the “floating HEAD” of a linear history of Revisions, and optionally how the containers those revisions reference are built. Users create new Revisions by updating the Configuration’s spec. The “latest created” revision’s name is available under status, as is the “latest ready” revision’s name.
346///
347/// # Activities
348///
349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
351///
352/// * [configurations get namespaces](NamespaceConfigurationGetCall) (response)
353/// * [locations configurations get projects](ProjectLocationConfigurationGetCall) (response)
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct Configuration {
358 /// The API version for this call such as "serving.knative.dev/v1".
359 #[serde(rename = "apiVersion")]
360 pub api_version: Option<String>,
361 /// The kind of resource, in this case always "Configuration".
362 pub kind: Option<String>,
363 /// Metadata associated with this Configuration, including name, namespace, labels, and annotations.
364 pub metadata: Option<ObjectMeta>,
365 /// Spec holds the desired state of the Configuration (from the client).
366 pub spec: Option<ConfigurationSpec>,
367 /// Status communicates the observed state of the Configuration (from the controller).
368 pub status: Option<ConfigurationStatus>,
369}
370
371impl common::ResponseResult for Configuration {}
372
373/// ConfigurationSpec holds the desired state of the Configuration (from the client).
374///
375/// This type is not used in any activity, and only used as *part* of another schema.
376///
377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
378#[serde_with::serde_as]
379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
380pub struct ConfigurationSpec {
381 /// Template holds the latest specification for the Revision to be stamped out.
382 pub template: Option<RevisionTemplate>,
383}
384
385impl common::Part for ConfigurationSpec {}
386
387/// ConfigurationStatus communicates the observed state of the Configuration (from the controller).
388///
389/// This type is not used in any activity, and only used as *part* of another schema.
390///
391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
392#[serde_with::serde_as]
393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
394pub struct ConfigurationStatus {
395 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world.
396 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
397 /// LatestCreatedRevisionName is the last revision that was created from this Configuration. It might not be ready yet, so for the latest ready revision, use LatestReadyRevisionName.
398 #[serde(rename = "latestCreatedRevisionName")]
399 pub latest_created_revision_name: Option<String>,
400 /// LatestReadyRevisionName holds the name of the latest Revision stamped out from this Configuration that has had its "Ready" condition become "True".
401 #[serde(rename = "latestReadyRevisionName")]
402 pub latest_ready_revision_name: Option<String>,
403 /// ObservedGeneration is the 'Generation' of the Configuration that was last processed by the controller. The observed generation is updated even if the controller failed to process the spec and create the Revision. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation, and the Ready condition's status is True or False.
404 #[serde(rename = "observedGeneration")]
405 pub observed_generation: Option<i32>,
406}
407
408impl common::Part for ConfigurationStatus {}
409
410/// 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 may be supplied by the system to the container at runtime.
411///
412/// This type is not used in any activity, and only used as *part* of another schema.
413///
414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
415#[serde_with::serde_as]
416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
417pub struct Container {
418 /// Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references are not supported in Cloud Run.
419 pub args: Option<Vec<String>>,
420 /// Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references are not supported in Cloud Run.
421 pub command: Option<Vec<String>>,
422 /// List of environment variables to set in the container. EnvVar with duplicate names are generally allowed; if referencing a secret, the name must be unique for the container. For non-secret EnvVar names, the Container will only get the last-declared one.
423 pub env: Option<Vec<EnvVar>>,
424 /// Not supported by Cloud Run.
425 #[serde(rename = "envFrom")]
426 pub env_from: Option<Vec<EnvFromSource>>,
427 /// Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.
428 pub image: Option<String>,
429 /// Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
430 #[serde(rename = "imagePullPolicy")]
431 pub image_pull_policy: Option<String>,
432 /// Periodic probe of container liveness. Container will be restarted if the probe fails.
433 #[serde(rename = "livenessProbe")]
434 pub liveness_probe: Option<Probe>,
435 /// Name of the container specified as a DNS_LABEL (RFC 1123).
436 pub name: Option<String>,
437 /// 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.
438 pub ports: Option<Vec<ContainerPort>>,
439 /// Not supported by Cloud Run.
440 #[serde(rename = "readinessProbe")]
441 pub readiness_probe: Option<Probe>,
442 /// Compute Resources required by this container.
443 pub resources: Option<ResourceRequirements>,
444 /// Not supported by Cloud Run.
445 #[serde(rename = "securityContext")]
446 pub security_context: Option<SecurityContext>,
447 /// Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not receive traffic if the probe fails. If not provided, a default startup probe with TCP socket action is used.
448 #[serde(rename = "startupProbe")]
449 pub startup_probe: Option<Probe>,
450 /// Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log.
451 #[serde(rename = "terminationMessagePath")]
452 pub termination_message_path: Option<String>,
453 /// Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
454 #[serde(rename = "terminationMessagePolicy")]
455 pub termination_message_policy: Option<String>,
456 /// Volume to mount into the container's filesystem. Only supports SecretVolumeSources. Pod volumes to mount into the container's filesystem.
457 #[serde(rename = "volumeMounts")]
458 pub volume_mounts: Option<Vec<VolumeMount>>,
459 /// Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.
460 #[serde(rename = "workingDir")]
461 pub working_dir: Option<String>,
462}
463
464impl common::Part for Container {}
465
466/// Per container override specification.
467///
468/// This type is not used in any activity, and only used as *part* of another schema.
469///
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct ContainerOverride {
474 /// Arguments to the entrypoint. The specified arguments replace and override any existing entrypoint arguments. Must be empty if `clear_args` is set to true.
475 pub args: Option<Vec<String>>,
476 /// Optional. Set to True to clear all existing arguments.
477 #[serde(rename = "clearArgs")]
478 pub clear_args: Option<bool>,
479 /// List of environment variables to set in the container. All specified environment variables are merged with existing environment variables. When the specified environment variables exist, these values override any existing values.
480 pub env: Option<Vec<EnvVar>>,
481 /// The name of the container specified as a DNS_LABEL.
482 pub name: Option<String>,
483}
484
485impl common::Part for ContainerOverride {}
486
487/// ContainerPort represents a network port in a single container.
488///
489/// This type is not used in any activity, and only used as *part* of another schema.
490///
491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
492#[serde_with::serde_as]
493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
494pub struct ContainerPort {
495 /// Port number the container listens on. If present, this must be a valid port number, 0 < x < 65536. If not present, it will default to port 8080. For more information, see https://cloud.google.com/run/docs/container-contract#port
496 #[serde(rename = "containerPort")]
497 pub container_port: Option<i32>,
498 /// If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c".
499 pub name: Option<String>,
500 /// Protocol for port. Must be "TCP". Defaults to "TCP".
501 pub protocol: Option<String>,
502}
503
504impl common::Part for ContainerPort {}
505
506/// Resource to hold the state and status of a user’s domain mapping. NOTE: This resource is currently in Beta.
507///
508/// # Activities
509///
510/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
511/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
512///
513/// * [domainmappings create namespaces](NamespaceDomainmappingCreateCall) (request|response)
514/// * [domainmappings get namespaces](NamespaceDomainmappingGetCall) (response)
515/// * [locations domainmappings create projects](ProjectLocationDomainmappingCreateCall) (request|response)
516/// * [locations domainmappings get projects](ProjectLocationDomainmappingGetCall) (response)
517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
518#[serde_with::serde_as]
519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
520pub struct DomainMapping {
521 /// The API version for this call such as "domains.cloudrun.com/v1".
522 #[serde(rename = "apiVersion")]
523 pub api_version: Option<String>,
524 /// The kind of resource, in this case "DomainMapping".
525 pub kind: Option<String>,
526 /// Metadata associated with this BuildTemplate.
527 pub metadata: Option<ObjectMeta>,
528 /// The spec for this DomainMapping.
529 pub spec: Option<DomainMappingSpec>,
530 /// The current status of the DomainMapping.
531 pub status: Option<DomainMappingStatus>,
532}
533
534impl common::RequestValue for DomainMapping {}
535impl common::ResponseResult for DomainMapping {}
536
537/// The desired state of the Domain Mapping.
538///
539/// This type is not used in any activity, and only used as *part* of another schema.
540///
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct DomainMappingSpec {
545 /// The mode of the certificate.
546 #[serde(rename = "certificateMode")]
547 pub certificate_mode: Option<String>,
548 /// If set, the mapping will override any mapping set before this spec was set. It is recommended that the user leaves this empty to receive an error warning about a potential conflict and only set it once the respective UI has given such a warning.
549 #[serde(rename = "forceOverride")]
550 pub force_override: Option<bool>,
551 /// The name of the Knative Route that this DomainMapping applies to. The route must exist.
552 #[serde(rename = "routeName")]
553 pub route_name: Option<String>,
554}
555
556impl common::Part for DomainMappingSpec {}
557
558/// The current state of the Domain Mapping.
559///
560/// This type is not used in any activity, and only used as *part* of another schema.
561///
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct DomainMappingStatus {
566 /// Array of observed DomainMappingConditions, indicating the current state of the DomainMapping.
567 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
568 /// The name of the route that the mapping currently points to.
569 #[serde(rename = "mappedRouteName")]
570 pub mapped_route_name: Option<String>,
571 /// ObservedGeneration is the 'Generation' of the DomainMapping that was last processed by the controller. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation and the Ready condition's status is True or False.
572 #[serde(rename = "observedGeneration")]
573 pub observed_generation: Option<i32>,
574 /// The resource records required to configure this domain mapping. These records must be added to the domain's DNS configuration in order to serve the application via this domain mapping.
575 #[serde(rename = "resourceRecords")]
576 pub resource_records: Option<Vec<ResourceRecord>>,
577 /// Optional. Not supported by Cloud Run.
578 pub url: Option<String>,
579}
580
581impl common::Part for DomainMappingStatus {}
582
583/// 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); }
584///
585/// # Activities
586///
587/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
588/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
589///
590/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
592#[serde_with::serde_as]
593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
594pub struct Empty {
595 _never_set: Option<bool>,
596}
597
598impl common::ResponseResult for Empty {}
599
600/// 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).
601///
602/// This type is not used in any activity, and only used as *part* of another schema.
603///
604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
605#[serde_with::serde_as]
606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
607pub struct EmptyDirVolumeSource {
608 /// The medium on which the data is stored. The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
609 pub medium: Option<String>,
610 /// 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
611 #[serde(rename = "sizeLimit")]
612 pub size_limit: Option<String>,
613}
614
615impl common::Part for EmptyDirVolumeSource {}
616
617/// Not supported by Cloud Run. EnvFromSource represents the source of a set of ConfigMaps
618///
619/// This type is not used in any activity, and only used as *part* of another schema.
620///
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct EnvFromSource {
625 /// The ConfigMap to select from
626 #[serde(rename = "configMapRef")]
627 pub config_map_ref: Option<ConfigMapEnvSource>,
628 /// An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.
629 pub prefix: Option<String>,
630 /// The Secret to select from
631 #[serde(rename = "secretRef")]
632 pub secret_ref: Option<SecretEnvSource>,
633}
634
635impl common::Part for EnvFromSource {}
636
637/// EnvVar represents an environment variable present in a Container.
638///
639/// This type is not used in any activity, and only used as *part* of another schema.
640///
641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
642#[serde_with::serde_as]
643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
644pub struct EnvVar {
645 /// Required. Name of the environment variable.
646 pub name: Option<String>,
647 /// Value of the environment variable. Defaults to "". Variable references are not supported in Cloud Run.
648 pub value: Option<String>,
649 /// Source for the environment variable's value. Only supports secret_key_ref. Cannot be used if value is not empty.
650 #[serde(rename = "valueFrom")]
651 pub value_from: Option<EnvVarSource>,
652}
653
654impl common::Part for EnvVar {}
655
656/// EnvVarSource represents a source for the value of an EnvVar.
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct EnvVarSource {
664 /// Not supported by Cloud Run. Not supported in Cloud Run.
665 #[serde(rename = "configMapKeyRef")]
666 pub config_map_key_ref: Option<ConfigMapKeySelector>,
667 /// Selects a key (version) of a secret in Secret Manager.
668 #[serde(rename = "secretKeyRef")]
669 pub secret_key_ref: Option<SecretKeySelector>,
670}
671
672impl common::Part for EnvVarSource {}
673
674/// Not supported by Cloud Run. ExecAction describes a "run in container" action.
675///
676/// This type is not used in any activity, and only used as *part* of another schema.
677///
678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
679#[serde_with::serde_as]
680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
681pub struct ExecAction {
682 /// Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.
683 pub command: Option<Vec<String>>,
684}
685
686impl common::Part for ExecAction {}
687
688/// Execution represents the configuration of a single execution. An execution is an immutable resource that references a container image which is run to completion.
689///
690/// # Activities
691///
692/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
693/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
694///
695/// * [executions cancel namespaces](NamespaceExecutionCancelCall) (response)
696/// * [executions get namespaces](NamespaceExecutionGetCall) (response)
697/// * [jobs run namespaces](NamespaceJobRunCall) (response)
698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
699#[serde_with::serde_as]
700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
701pub struct Execution {
702 /// Optional. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
703 #[serde(rename = "apiVersion")]
704 pub api_version: Option<String>,
705 /// Optional. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.
706 pub kind: Option<String>,
707 /// Optional. Standard object's metadata.
708 pub metadata: Option<ObjectMeta>,
709 /// Optional. Specification of the desired behavior of an execution.
710 pub spec: Option<ExecutionSpec>,
711 /// Output only. Current status of an execution.
712 pub status: Option<ExecutionStatus>,
713}
714
715impl common::ResponseResult for Execution {}
716
717/// Reference to an Execution. Use /Executions.GetExecution with the given name to get full execution including the latest status.
718///
719/// This type is not used in any activity, and only used as *part* of another schema.
720///
721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
722#[serde_with::serde_as]
723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
724pub struct ExecutionReference {
725 /// Optional. Completion timestamp of the execution.
726 #[serde(rename = "completionTimestamp")]
727 pub completion_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
728 /// Optional. Creation timestamp of the execution.
729 #[serde(rename = "creationTimestamp")]
730 pub creation_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
731 /// Optional. Name of the execution.
732 pub name: Option<String>,
733}
734
735impl common::Part for ExecutionReference {}
736
737/// ExecutionSpec describes how the execution will look.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct ExecutionSpec {
745 /// Optional. Specifies the maximum desired number of tasks the execution should run at given time. Must be <= task_count. 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, i.e. when the work left to do is less than max parallelism.
746 pub parallelism: Option<i32>,
747 /// Optional. 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.
748 #[serde(rename = "taskCount")]
749 pub task_count: Option<i32>,
750 /// Optional. The template used to create tasks for this execution.
751 pub template: Option<TaskTemplateSpec>,
752}
753
754impl common::Part for ExecutionSpec {}
755
756/// ExecutionStatus represents the current state of an Execution.
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct ExecutionStatus {
764 /// Optional. The number of tasks which reached phase Cancelled.
765 #[serde(rename = "cancelledCount")]
766 pub cancelled_count: Option<i32>,
767 /// Optional. Represents the time that the execution was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. +optional
768 #[serde(rename = "completionTime")]
769 pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
770 /// Optional. Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world. Execution-specific conditions include: * `ResourcesAvailable`: `True` when underlying resources have been provisioned. * `Started`: `True` when the execution has started to execute. * `Completed`: `True` when the execution has succeeded. `False` when the execution has failed.
771 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
772 /// Optional. The number of tasks which reached phase Failed.
773 #[serde(rename = "failedCount")]
774 pub failed_count: Option<i32>,
775 /// Optional. URI where logs for this execution can be found in Cloud Console.
776 #[serde(rename = "logUri")]
777 pub log_uri: Option<String>,
778 /// Optional. The 'generation' of the execution that was last processed by the controller.
779 #[serde(rename = "observedGeneration")]
780 pub observed_generation: Option<i32>,
781 /// Optional. The number of tasks which have retried at least once.
782 #[serde(rename = "retriedCount")]
783 pub retried_count: Option<i32>,
784 /// Optional. The number of actively running tasks.
785 #[serde(rename = "runningCount")]
786 pub running_count: Option<i32>,
787 /// Optional. Represents the time that the execution started to run. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.
788 #[serde(rename = "startTime")]
789 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
790 /// Optional. The number of tasks which reached phase Succeeded.
791 #[serde(rename = "succeededCount")]
792 pub succeeded_count: Option<i32>,
793}
794
795impl common::Part for ExecutionStatus {}
796
797/// ExecutionTemplateSpec describes the metadata and spec an Execution should have when created from a job.
798///
799/// This type is not used in any activity, and only used as *part* of another schema.
800///
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct ExecutionTemplateSpec {
805 /// Optional. Optional metadata for this Execution, including labels and annotations. The following annotation keys set properties of the created execution: * `run.googleapis.com/cloudsql-instances` sets Cloud SQL connections. Multiple values should be comma separated. * `run.googleapis.com/vpc-access-connector` sets a Serverless VPC Access connector. * `run.googleapis.com/vpc-access-egress` sets VPC egress. Supported values are `all-traffic`, `all` (deprecated), and `private-ranges-only`. `all-traffic` and `all` provide the same functionality. `all` is deprecated but will continue to be supported. Prefer `all-traffic`.
806 pub metadata: Option<ObjectMeta>,
807 /// Required. ExecutionSpec holds the desired configuration for executions of this job.
808 pub spec: Option<ExecutionSpec>,
809}
810
811impl common::Part for ExecutionTemplateSpec {}
812
813/// 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.
814///
815/// This type is not used in any activity, and only used as *part* of another schema.
816///
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct Expr {
821 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
822 pub description: Option<String>,
823 /// Textual representation of an expression in Common Expression Language syntax.
824 pub expression: Option<String>,
825 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
826 pub location: Option<String>,
827 /// 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.
828 pub title: Option<String>,
829}
830
831impl common::Part for Expr {}
832
833/// GRPCAction describes an action involving a GRPC port.
834///
835/// This type is not used in any activity, and only used as *part* of another schema.
836///
837#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
838#[serde_with::serde_as]
839#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
840pub struct GRPCAction {
841 /// Port number of the gRPC service. Number must be in the range 1 to 65535.
842 pub port: Option<i32>,
843 /// Service is the name of the service to place in the gRPC HealthCheckRequest. If this is not specified, the default behavior is defined by gRPC.
844 pub service: Option<String>,
845}
846
847impl common::Part for GRPCAction {}
848
849/// Conditions show the status of reconciliation progress on a given resource. Most resource use a top-level condition type "Ready" or "Completed" to show overall status with other conditions to checkpoint each stage of reconciliation. Note that if metadata.Generation does not equal status.ObservedGeneration, the conditions shown may not be relevant for the current spec.
850///
851/// This type is not used in any activity, and only used as *part* of another schema.
852///
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct GoogleCloudRunV1Condition {
857 /// Optional. Last time the condition transitioned from one status to another.
858 #[serde(rename = "lastTransitionTime")]
859 pub last_transition_time: Option<chrono::DateTime<chrono::offset::Utc>>,
860 /// Optional. Human readable message indicating details about the current status.
861 pub message: Option<String>,
862 /// Optional. One-word CamelCase reason for the condition's last transition. These are intended to be stable, unique values which the client may use to trigger error handling logic, whereas messages which may be changed later by the server.
863 pub reason: Option<String>,
864 /// Optional. How to interpret this condition. One of Error, Warning, or Info. Conditions of severity Info do not contribute to resource readiness.
865 pub severity: Option<String>,
866 /// Status of the condition, one of True, False, Unknown.
867 pub status: Option<String>,
868 /// type is used to communicate the status of the reconciliation process. Types common to all resources include: * "Ready" or "Completed": True when the Resource is ready.
869 #[serde(rename = "type")]
870 pub type_: Option<String>,
871}
872
873impl common::Part for GoogleCloudRunV1Condition {}
874
875/// The response message for Operations.ListOperations.
876///
877/// # Activities
878///
879/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
880/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
881///
882/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
884#[serde_with::serde_as]
885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
886pub struct GoogleLongrunningListOperationsResponse {
887 /// The standard List next-page token.
888 #[serde(rename = "nextPageToken")]
889 pub next_page_token: Option<String>,
890 /// A list of operations that matches the specified filter in the request.
891 pub operations: Option<Vec<GoogleLongrunningOperation>>,
892}
893
894impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
895
896/// This resource represents a long-running operation that is the result of a network API call.
897///
898/// # Activities
899///
900/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
901/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
902///
903/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
904/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (response)
905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
906#[serde_with::serde_as]
907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
908pub struct GoogleLongrunningOperation {
909 /// 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.
910 pub done: Option<bool>,
911 /// The error result of the operation in case of failure or cancellation.
912 pub error: Option<GoogleRpcStatus>,
913 /// 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.
914 pub metadata: Option<HashMap<String, serde_json::Value>>,
915 /// 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}`.
916 pub name: Option<String>,
917 /// 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`.
918 pub response: Option<HashMap<String, serde_json::Value>>,
919}
920
921impl common::ResponseResult for GoogleLongrunningOperation {}
922
923/// The request message for Operations.WaitOperation.
924///
925/// # Activities
926///
927/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
928/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
929///
930/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (request)
931#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
932#[serde_with::serde_as]
933#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
934pub struct GoogleLongrunningWaitOperationRequest {
935 /// 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.
936 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
937 pub timeout: Option<chrono::Duration>,
938}
939
940impl common::RequestValue for GoogleLongrunningWaitOperationRequest {}
941
942/// 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).
943///
944/// This type is not used in any activity, and only used as *part* of another schema.
945///
946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
947#[serde_with::serde_as]
948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
949pub struct GoogleRpcStatus {
950 /// The status code, which should be an enum value of google.rpc.Code.
951 pub code: Option<i32>,
952 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
953 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
954 /// 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.
955 pub message: Option<String>,
956}
957
958impl common::Part for GoogleRpcStatus {}
959
960/// HTTPGetAction describes an action based on HTTP Get requests.
961///
962/// This type is not used in any activity, and only used as *part* of another schema.
963///
964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
965#[serde_with::serde_as]
966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
967pub struct HTTPGetAction {
968 /// Not supported by Cloud Run.
969 pub host: Option<String>,
970 /// Custom headers to set in the request. HTTP allows repeated headers.
971 #[serde(rename = "httpHeaders")]
972 pub http_headers: Option<Vec<HTTPHeader>>,
973 /// Path to access on the HTTP server.
974 pub path: Option<String>,
975 /// Port number to access on the container. Number must be in the range 1 to 65535.
976 pub port: Option<i32>,
977 /// Not supported by Cloud Run.
978 pub scheme: Option<String>,
979}
980
981impl common::Part for HTTPGetAction {}
982
983/// HTTPHeader describes a custom header to be used in HTTP probes
984///
985/// This type is not used in any activity, and only used as *part* of another schema.
986///
987#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
988#[serde_with::serde_as]
989#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
990pub struct HTTPHeader {
991 /// Required. The header field name
992 pub name: Option<String>,
993 /// The header field value
994 pub value: Option<String>,
995}
996
997impl common::Part for HTTPHeader {}
998
999/// Job represents the configuration of a single job, which references a container image which is run to completion.
1000///
1001/// # Activities
1002///
1003/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1004/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1005///
1006/// * [jobs create namespaces](NamespaceJobCreateCall) (request|response)
1007/// * [jobs get namespaces](NamespaceJobGetCall) (response)
1008/// * [jobs replace job namespaces](NamespaceJobReplaceJobCall) (request|response)
1009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1010#[serde_with::serde_as]
1011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1012pub struct Job {
1013 /// Optional. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
1014 #[serde(rename = "apiVersion")]
1015 pub api_version: Option<String>,
1016 /// Optional. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.
1017 pub kind: Option<String>,
1018 /// Optional. Standard object's metadata.
1019 pub metadata: Option<ObjectMeta>,
1020 /// Optional. Specification of the desired behavior of a job.
1021 pub spec: Option<JobSpec>,
1022 /// Output only. Current status of a job.
1023 pub status: Option<JobStatus>,
1024}
1025
1026impl common::RequestValue for Job {}
1027impl common::ResponseResult for Job {}
1028
1029/// JobSpec describes how the job will look.
1030///
1031/// This type is not used in any activity, and only used as *part* of another schema.
1032///
1033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1034#[serde_with::serde_as]
1035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1036pub struct JobSpec {
1037 /// 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.
1038 #[serde(rename = "runExecutionToken")]
1039 pub run_execution_token: Option<String>,
1040 /// A unique string used as a suffix for 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.
1041 #[serde(rename = "startExecutionToken")]
1042 pub start_execution_token: Option<String>,
1043 /// Optional. Describes the execution that will be created when running a job.
1044 pub template: Option<ExecutionTemplateSpec>,
1045}
1046
1047impl common::Part for JobSpec {}
1048
1049/// JobStatus represents the current state of a Job.
1050///
1051/// This type is not used in any activity, and only used as *part* of another schema.
1052///
1053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1054#[serde_with::serde_as]
1055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1056pub struct JobStatus {
1057 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world. Job-specific conditions include: * `Ready`: `True` when the job is ready to be executed.
1058 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1059 /// Number of executions created for this job.
1060 #[serde(rename = "executionCount")]
1061 pub execution_count: Option<i32>,
1062 /// A pointer to the most recently created execution for this job. This is set regardless of the eventual state of the execution.
1063 #[serde(rename = "latestCreatedExecution")]
1064 pub latest_created_execution: Option<ExecutionReference>,
1065 /// The 'generation' of the job that was last processed by the controller.
1066 #[serde(rename = "observedGeneration")]
1067 pub observed_generation: Option<i32>,
1068}
1069
1070impl common::Part for JobStatus {}
1071
1072/// Maps a string key to a path within a volume.
1073///
1074/// This type is not used in any activity, and only used as *part* of another schema.
1075///
1076#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1077#[serde_with::serde_as]
1078#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1079pub struct KeyToPath {
1080 /// The Cloud Secret Manager secret version. Can be 'latest' for the latest value, or an integer or a secret alias for a specific version. The key to project.
1081 pub key: Option<String>,
1082 /// (Optional) 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 777 (a=rwx), set to 0777 (octal) or 511 (base-10). 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.
1083 pub mode: Option<i32>,
1084 /// The relative path of the file to map the key to. May not be an absolute path. May not contain the path element '..'. May not start with the string '..'.
1085 pub path: Option<String>,
1086}
1087
1088impl common::Part for KeyToPath {}
1089
1090/// A list of Authorized Domains.
1091///
1092/// # Activities
1093///
1094/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1095/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1096///
1097/// * [authorizeddomains list namespaces](NamespaceAuthorizeddomainListCall) (response)
1098/// * [authorizeddomains list projects](ProjectAuthorizeddomainListCall) (response)
1099/// * [locations authorizeddomains list projects](ProjectLocationAuthorizeddomainListCall) (response)
1100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1101#[serde_with::serde_as]
1102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1103pub struct ListAuthorizedDomainsResponse {
1104 /// The authorized domains belonging to the user.
1105 pub domains: Option<Vec<AuthorizedDomain>>,
1106 /// Continuation token for fetching the next page of results.
1107 #[serde(rename = "nextPageToken")]
1108 pub next_page_token: Option<String>,
1109}
1110
1111impl common::ResponseResult for ListAuthorizedDomainsResponse {}
1112
1113/// ListConfigurationsResponse is a list of Configuration resources.
1114///
1115/// # Activities
1116///
1117/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1118/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1119///
1120/// * [configurations list namespaces](NamespaceConfigurationListCall) (response)
1121/// * [locations configurations list projects](ProjectLocationConfigurationListCall) (response)
1122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1123#[serde_with::serde_as]
1124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1125pub struct ListConfigurationsResponse {
1126 /// The API version for this call such as "serving.knative.dev/v1".
1127 #[serde(rename = "apiVersion")]
1128 pub api_version: Option<String>,
1129 /// List of Configurations.
1130 pub items: Option<Vec<Configuration>>,
1131 /// The kind of this resource, in this case "ConfigurationList".
1132 pub kind: Option<String>,
1133 /// Metadata associated with this Configuration list.
1134 pub metadata: Option<ListMeta>,
1135 /// Locations that could not be reached.
1136 pub unreachable: Option<Vec<String>>,
1137}
1138
1139impl common::ResponseResult for ListConfigurationsResponse {}
1140
1141/// ListDomainMappingsResponse is a list of DomainMapping resources.
1142///
1143/// # Activities
1144///
1145/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1146/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1147///
1148/// * [domainmappings list namespaces](NamespaceDomainmappingListCall) (response)
1149/// * [locations domainmappings list projects](ProjectLocationDomainmappingListCall) (response)
1150#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1151#[serde_with::serde_as]
1152#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1153pub struct ListDomainMappingsResponse {
1154 /// The API version for this call such as "domains.cloudrun.com/v1".
1155 #[serde(rename = "apiVersion")]
1156 pub api_version: Option<String>,
1157 /// List of DomainMappings.
1158 pub items: Option<Vec<DomainMapping>>,
1159 /// The kind of this resource, in this case "DomainMappingList".
1160 pub kind: Option<String>,
1161 /// Metadata associated with this DomainMapping list.
1162 pub metadata: Option<ListMeta>,
1163 /// Locations that could not be reached.
1164 pub unreachable: Option<Vec<String>>,
1165}
1166
1167impl common::ResponseResult for ListDomainMappingsResponse {}
1168
1169/// ListExecutionsResponse is a list of Executions resources.
1170///
1171/// # Activities
1172///
1173/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1174/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1175///
1176/// * [executions list namespaces](NamespaceExecutionListCall) (response)
1177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1178#[serde_with::serde_as]
1179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1180pub struct ListExecutionsResponse {
1181 /// The API version for this call such as "run.googleapis.com/v1".
1182 #[serde(rename = "apiVersion")]
1183 pub api_version: Option<String>,
1184 /// List of Executions.
1185 pub items: Option<Vec<Execution>>,
1186 /// The kind of this resource, in this case "ExecutionsList".
1187 pub kind: Option<String>,
1188 /// Metadata associated with this executions list.
1189 pub metadata: Option<ListMeta>,
1190 /// Locations that could not be reached.
1191 pub unreachable: Option<Vec<String>>,
1192}
1193
1194impl common::ResponseResult for ListExecutionsResponse {}
1195
1196/// ListJobsResponse is a list of Jobs resources.
1197///
1198/// # Activities
1199///
1200/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1201/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1202///
1203/// * [jobs list namespaces](NamespaceJobListCall) (response)
1204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1205#[serde_with::serde_as]
1206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1207pub struct ListJobsResponse {
1208 /// The API version for this call such as "run.googleapis.com/v1".
1209 #[serde(rename = "apiVersion")]
1210 pub api_version: Option<String>,
1211 /// List of Jobs.
1212 pub items: Option<Vec<Job>>,
1213 /// The kind of this resource, in this case "JobsList".
1214 pub kind: Option<String>,
1215 /// Metadata associated with this jobs list.
1216 pub metadata: Option<ListMeta>,
1217 /// Locations that could not be reached.
1218 pub unreachable: Option<Vec<String>>,
1219}
1220
1221impl common::ResponseResult for ListJobsResponse {}
1222
1223/// The response message for Locations.ListLocations.
1224///
1225/// # Activities
1226///
1227/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1228/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1229///
1230/// * [locations list projects](ProjectLocationListCall) (response)
1231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1232#[serde_with::serde_as]
1233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1234pub struct ListLocationsResponse {
1235 /// A list of locations that matches the specified filter in the request.
1236 pub locations: Option<Vec<Location>>,
1237 /// The standard List next-page token.
1238 #[serde(rename = "nextPageToken")]
1239 pub next_page_token: Option<String>,
1240}
1241
1242impl common::ResponseResult for ListLocationsResponse {}
1243
1244/// Metadata for synthetic resources like List. In Cloud Run, all List Resources Responses will have a ListMeta instead of ObjectMeta.
1245///
1246/// This type is not used in any activity, and only used as *part* of another schema.
1247///
1248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1249#[serde_with::serde_as]
1250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1251pub struct ListMeta {
1252 /// Continuation token is a value emitted when the count of items is larger than the user/system limit. To retrieve the next page of items, pass the value of `continue` as the next request's `page_token`.
1253 #[serde(rename = "continue")]
1254 pub continue_: Option<String>,
1255 /// Opaque string that identifies the server's internal version of this object. It can be used by clients to determine when objects have changed. If the message is passed back to the server, it must be left unmodified.
1256 #[serde(rename = "resourceVersion")]
1257 pub resource_version: Option<String>,
1258 /// URL representing this object.
1259 #[serde(rename = "selfLink")]
1260 pub self_link: Option<String>,
1261}
1262
1263impl common::Part for ListMeta {}
1264
1265/// ListRevisionsResponse is a list of Revision resources.
1266///
1267/// # Activities
1268///
1269/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1270/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1271///
1272/// * [revisions list namespaces](NamespaceRevisionListCall) (response)
1273/// * [locations revisions list projects](ProjectLocationRevisionListCall) (response)
1274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1275#[serde_with::serde_as]
1276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1277pub struct ListRevisionsResponse {
1278 /// The API version for this call such as "serving.knative.dev/v1".
1279 #[serde(rename = "apiVersion")]
1280 pub api_version: Option<String>,
1281 /// List of Revisions.
1282 pub items: Option<Vec<Revision>>,
1283 /// The kind of this resource, in this case "RevisionList".
1284 pub kind: Option<String>,
1285 /// Metadata associated with this revision list.
1286 pub metadata: Option<ListMeta>,
1287 /// Locations that could not be reached.
1288 pub unreachable: Option<Vec<String>>,
1289}
1290
1291impl common::ResponseResult for ListRevisionsResponse {}
1292
1293/// ListRoutesResponse is a list of Route resources.
1294///
1295/// # Activities
1296///
1297/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1298/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1299///
1300/// * [routes list namespaces](NamespaceRouteListCall) (response)
1301/// * [locations routes list projects](ProjectLocationRouteListCall) (response)
1302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1303#[serde_with::serde_as]
1304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1305pub struct ListRoutesResponse {
1306 /// The API version for this call such as "serving.knative.dev/v1".
1307 #[serde(rename = "apiVersion")]
1308 pub api_version: Option<String>,
1309 /// List of Routes.
1310 pub items: Option<Vec<Route>>,
1311 /// The kind of this resource, in this case always "RouteList".
1312 pub kind: Option<String>,
1313 /// Metadata associated with this Route list.
1314 pub metadata: Option<ListMeta>,
1315 /// Locations that could not be reached.
1316 pub unreachable: Option<Vec<String>>,
1317}
1318
1319impl common::ResponseResult for ListRoutesResponse {}
1320
1321/// A list of Service resources.
1322///
1323/// # Activities
1324///
1325/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1326/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1327///
1328/// * [services list namespaces](NamespaceServiceListCall) (response)
1329/// * [locations services list projects](ProjectLocationServiceListCall) (response)
1330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1331#[serde_with::serde_as]
1332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1333pub struct ListServicesResponse {
1334 /// The API version for this call; returns "serving.knative.dev/v1".
1335 #[serde(rename = "apiVersion")]
1336 pub api_version: Option<String>,
1337 /// List of Services.
1338 pub items: Option<Vec<Service>>,
1339 /// The kind of this resource; returns "ServiceList".
1340 pub kind: Option<String>,
1341 /// Metadata associated with this Service list.
1342 pub metadata: Option<ListMeta>,
1343 /// For calls against the global endpoint, returns the list of Cloud locations that could not be reached. For regional calls, this field is not used.
1344 pub unreachable: Option<Vec<String>>,
1345}
1346
1347impl common::ResponseResult for ListServicesResponse {}
1348
1349/// ListTasksResponse is a list of Tasks resources.
1350///
1351/// # Activities
1352///
1353/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1354/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1355///
1356/// * [tasks list namespaces](NamespaceTaskListCall) (response)
1357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1358#[serde_with::serde_as]
1359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1360pub struct ListTasksResponse {
1361 /// The API version for this call such as "run.googleapis.com/v1".
1362 #[serde(rename = "apiVersion")]
1363 pub api_version: Option<String>,
1364 /// List of Tasks.
1365 pub items: Option<Vec<Task>>,
1366 /// The kind of this resource, in this case "TasksList".
1367 pub kind: Option<String>,
1368 /// Metadata associated with this tasks list.
1369 pub metadata: Option<ListMeta>,
1370 /// Locations that could not be reached.
1371 pub unreachable: Option<Vec<String>>,
1372}
1373
1374impl common::ResponseResult for ListTasksResponse {}
1375
1376/// Not supported by Cloud Run. LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
1377///
1378/// This type is not used in any activity, and only used as *part* of another schema.
1379///
1380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1381#[serde_with::serde_as]
1382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1383pub struct LocalObjectReference {
1384 /// Name of the referent.
1385 pub name: Option<String>,
1386}
1387
1388impl common::Part for LocalObjectReference {}
1389
1390/// A resource that represents a Google Cloud location.
1391///
1392/// This type is not used in any activity, and only used as *part* of another schema.
1393///
1394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1395#[serde_with::serde_as]
1396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1397pub struct Location {
1398 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1399 #[serde(rename = "displayName")]
1400 pub display_name: Option<String>,
1401 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1402 pub labels: Option<HashMap<String, String>>,
1403 /// The canonical id for this location. For example: `"us-east1"`.
1404 #[serde(rename = "locationId")]
1405 pub location_id: Option<String>,
1406 /// Service-specific metadata. For example the available capacity at the given location.
1407 pub metadata: Option<HashMap<String, serde_json::Value>>,
1408 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1409 pub name: Option<String>,
1410}
1411
1412impl common::Part for Location {}
1413
1414/// Represents a persistent volume that will be mounted using NFS. This volume will be shared between all instances of the resource and data will not be deleted when the instance is shut down.
1415///
1416/// This type is not used in any activity, and only used as *part* of another schema.
1417///
1418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1419#[serde_with::serde_as]
1420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1421pub struct NFSVolumeSource {
1422 /// Path that is exported by the NFS server.
1423 pub path: Option<String>,
1424 /// If true, mount the NFS volume as read only. Defaults to false.
1425 #[serde(rename = "readOnly")]
1426 pub read_only: Option<bool>,
1427 /// Hostname or IP address of the NFS server.
1428 pub server: Option<String>,
1429}
1430
1431impl common::Part for NFSVolumeSource {}
1432
1433/// google.cloud.run.meta.v1.ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
1434///
1435/// This type is not used in any activity, and only used as *part* of another schema.
1436///
1437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1438#[serde_with::serde_as]
1439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1440pub struct ObjectMeta {
1441 /// Unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. In Cloud Run, annotations with 'run.googleapis.com/' and 'autoscaling.knative.dev' are restricted, and the accepted annotations will be different depending on the resource type. * `autoscaling.knative.dev/maxScale`: Revision. * `autoscaling.knative.dev/minScale`: Revision. * `run.googleapis.com/binary-authorization-breakglass`: Service, Job, * `run.googleapis.com/binary-authorization`: Service, Job, Execution. * `run.googleapis.com/client-name`: All resources. * `run.googleapis.com/cloudsql-instances`: Revision, Execution. * `run.googleapis.com/container-dependencies`: Revision . * `run.googleapis.com/cpu-throttling`: Revision. * `run.googleapis.com/custom-audiences`: Service. * `run.googleapis.com/default-url-disabled`: Service. * `run.googleapis.com/description`: Service. * `run.googleapis.com/encryption-key-shutdown-hours`: Revision * `run.googleapis.com/encryption-key`: Revision, Execution. * `run.googleapis.com/execution-environment`: Revision, Execution. * `run.googleapis.com/gc-traffic-tags`: Service. * `run.googleapis.com/ingress`: Service. * `run.googleapis.com/launch-stage`: Service, Job. * `run.googleapis.com/minScale`: Service (ALPHA) * `run.googleapis.com/network-interfaces`: Revision, Execution. * `run.googleapis.com/post-key-revocation-action-type`: Revision. * `run.googleapis.com/secrets`: Revision, Execution. * `run.googleapis.com/secure-session-agent`: Revision. * `run.googleapis.com/sessionAffinity`: Revision. * `run.googleapis.com/startup-cpu-boost`: Revision. * `run.googleapis.com/vpc-access-connector`: Revision, Execution. * `run.googleapis.com/vpc-access-egress`: Revision, Execution.
1442 pub annotations: Option<HashMap<String, String>>,
1443 /// Not supported by Cloud Run
1444 #[serde(rename = "clusterName")]
1445 pub cluster_name: Option<String>,
1446 /// UTC timestamp representing the server time when this object was created.
1447 #[serde(rename = "creationTimestamp")]
1448 pub creation_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1449 /// Not supported by Cloud Run
1450 #[serde(rename = "deletionGracePeriodSeconds")]
1451 pub deletion_grace_period_seconds: Option<i32>,
1452 /// The read-only soft deletion timestamp for this resource. In Cloud Run, users are not able to set this field. Instead, they must call the corresponding Delete API.
1453 #[serde(rename = "deletionTimestamp")]
1454 pub deletion_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1455 /// Not supported by Cloud Run
1456 pub finalizers: Option<Vec<String>>,
1457 /// Not supported by Cloud Run
1458 #[serde(rename = "generateName")]
1459 pub generate_name: Option<String>,
1460 /// A system-provided sequence number representing a specific generation of the desired state.
1461 pub generation: Option<i32>,
1462 /// Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and routes.
1463 pub labels: Option<HashMap<String, String>>,
1464 /// Required. The name of the resource. Name is required when creating top-level resources (Service, Job), must be unique within a Cloud Run project/region, and cannot be changed once created.
1465 pub name: Option<String>,
1466 /// Required. Defines the space within each name must be unique within a Cloud Run region. In Cloud Run, it must be project ID or number.
1467 pub namespace: Option<String>,
1468 /// Not supported by Cloud Run
1469 #[serde(rename = "ownerReferences")]
1470 pub owner_references: Option<Vec<OwnerReference>>,
1471 /// Opaque, system-generated value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server or omit the value to disable conflict-detection.
1472 #[serde(rename = "resourceVersion")]
1473 pub resource_version: Option<String>,
1474 /// URL representing this object.
1475 #[serde(rename = "selfLink")]
1476 pub self_link: Option<String>,
1477 /// Unique, system-generated identifier for this resource.
1478 pub uid: Option<String>,
1479}
1480
1481impl common::Part for ObjectMeta {}
1482
1483/// RunJob Overrides that contains Execution fields to be overridden on the go.
1484///
1485/// This type is not used in any activity, and only used as *part* of another schema.
1486///
1487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1488#[serde_with::serde_as]
1489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1490pub struct Overrides {
1491 /// Per container override specification.
1492 #[serde(rename = "containerOverrides")]
1493 pub container_overrides: Option<Vec<ContainerOverride>>,
1494 /// The desired number of tasks the execution should run. Will replace existing task_count value.
1495 #[serde(rename = "taskCount")]
1496 pub task_count: Option<i32>,
1497 /// 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.
1498 #[serde(rename = "timeoutSeconds")]
1499 pub timeout_seconds: Option<i32>,
1500}
1501
1502impl common::Part for Overrides {}
1503
1504/// This is not supported or used by Cloud Run.
1505///
1506/// This type is not used in any activity, and only used as *part* of another schema.
1507///
1508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1509#[serde_with::serde_as]
1510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1511pub struct OwnerReference {
1512 /// This is not supported or used by Cloud Run.
1513 #[serde(rename = "apiVersion")]
1514 pub api_version: Option<String>,
1515 /// This is not supported or used by Cloud Run.
1516 #[serde(rename = "blockOwnerDeletion")]
1517 pub block_owner_deletion: Option<bool>,
1518 /// This is not supported or used by Cloud Run.
1519 pub controller: Option<bool>,
1520 /// This is not supported or used by Cloud Run.
1521 pub kind: Option<String>,
1522 /// This is not supported or used by Cloud Run.
1523 pub name: Option<String>,
1524 /// This is not supported or used by Cloud Run.
1525 pub uid: Option<String>,
1526}
1527
1528impl common::Part for OwnerReference {}
1529
1530/// 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/).
1531///
1532/// # Activities
1533///
1534/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1535/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1536///
1537/// * [locations jobs get iam policy projects](ProjectLocationJobGetIamPolicyCall) (response)
1538/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (response)
1539/// * [locations services get iam policy projects](ProjectLocationServiceGetIamPolicyCall) (response)
1540/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (response)
1541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1542#[serde_with::serde_as]
1543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1544pub struct Policy {
1545 /// Specifies cloud audit logging configuration for this policy.
1546 #[serde(rename = "auditConfigs")]
1547 pub audit_configs: Option<Vec<AuditConfig>>,
1548 /// 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`.
1549 pub bindings: Option<Vec<Binding>>,
1550 /// `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.
1551 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1552 pub etag: Option<Vec<u8>>,
1553 /// 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).
1554 pub version: Option<i32>,
1555}
1556
1557impl common::ResponseResult for Policy {}
1558
1559/// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
1560///
1561/// This type is not used in any activity, and only used as *part* of another schema.
1562///
1563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1564#[serde_with::serde_as]
1565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1566pub struct Probe {
1567 /// Not supported by Cloud Run.
1568 pub exec: Option<ExecAction>,
1569 /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.
1570 #[serde(rename = "failureThreshold")]
1571 pub failure_threshold: Option<i32>,
1572 /// GRPCAction specifies an action involving a GRPC port.
1573 pub grpc: Option<GRPCAction>,
1574 /// HTTPGet specifies the http request to perform.
1575 #[serde(rename = "httpGet")]
1576 pub http_get: Option<HTTPGetAction>,
1577 /// 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.
1578 #[serde(rename = "initialDelaySeconds")]
1579 pub initial_delay_seconds: Option<i32>,
1580 /// 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.
1581 #[serde(rename = "periodSeconds")]
1582 pub period_seconds: Option<i32>,
1583 /// Minimum consecutive successes for the probe to be considered successful after having failed. Must be 1 if set.
1584 #[serde(rename = "successThreshold")]
1585 pub success_threshold: Option<i32>,
1586 /// TCPSocket specifies an action involving a TCP port.
1587 #[serde(rename = "tcpSocket")]
1588 pub tcp_socket: Option<TCPSocketAction>,
1589 /// 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; if period_seconds is not set, must be less or equal than 10.
1590 #[serde(rename = "timeoutSeconds")]
1591 pub timeout_seconds: Option<i32>,
1592}
1593
1594impl common::Part for Probe {}
1595
1596/// A DNS resource record.
1597///
1598/// This type is not used in any activity, and only used as *part* of another schema.
1599///
1600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1601#[serde_with::serde_as]
1602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1603pub struct ResourceRecord {
1604 /// Relative name of the object affected by this record. Only applicable for `CNAME` records. Example: 'www'.
1605 pub name: Option<String>,
1606 /// Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).
1607 pub rrdata: Option<String>,
1608 /// Resource record type. Example: `AAAA`.
1609 #[serde(rename = "type")]
1610 pub type_: Option<String>,
1611}
1612
1613impl common::Part for ResourceRecord {}
1614
1615/// ResourceRequirements describes the compute resource requirements.
1616///
1617/// This type is not used in any activity, and only used as *part* of another schema.
1618///
1619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1620#[serde_with::serde_as]
1621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1622pub struct ResourceRequirements {
1623 /// Limits describes the maximum amount of compute resources allowed. Only 'cpu' and 'memory' keys are supported. * For supported 'cpu' values, 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
1624 pub limits: Option<HashMap<String, String>>,
1625 /// Requests describes the minimum amount of compute resources required. Only `cpu` and `memory` are supported. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. * For supported 'cpu' values, 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
1626 pub requests: Option<HashMap<String, String>>,
1627}
1628
1629impl common::Part for ResourceRequirements {}
1630
1631/// Revision is an immutable snapshot of code and configuration. A revision references a container image. Revisions are created by updates to a Configuration. See also: https://github.com/knative/specs/blob/main/specs/serving/overview.md#revision
1632///
1633/// # Activities
1634///
1635/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1636/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1637///
1638/// * [revisions get namespaces](NamespaceRevisionGetCall) (response)
1639/// * [locations revisions get projects](ProjectLocationRevisionGetCall) (response)
1640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1641#[serde_with::serde_as]
1642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1643pub struct Revision {
1644 /// The API version for this call such as "serving.knative.dev/v1".
1645 #[serde(rename = "apiVersion")]
1646 pub api_version: Option<String>,
1647 /// The kind of this resource, in this case "Revision".
1648 pub kind: Option<String>,
1649 /// Metadata associated with this Revision, including name, namespace, labels, and annotations.
1650 pub metadata: Option<ObjectMeta>,
1651 /// Spec holds the desired state of the Revision (from the client).
1652 pub spec: Option<RevisionSpec>,
1653 /// Status communicates the observed state of the Revision (from the controller).
1654 pub status: Option<RevisionStatus>,
1655}
1656
1657impl common::ResponseResult for Revision {}
1658
1659/// RevisionSpec holds the desired state of the Revision (from the client).
1660///
1661/// This type is not used in any activity, and only used as *part* of another schema.
1662///
1663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1664#[serde_with::serde_as]
1665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1666pub struct RevisionSpec {
1667 /// ContainerConcurrency specifies the maximum allowed in-flight (concurrent) requests per container instance of the Revision. If not specified, defaults to 80.
1668 #[serde(rename = "containerConcurrency")]
1669 pub container_concurrency: Option<i32>,
1670 /// Required. Containers holds the single container that defines the unit of execution for this Revision. In the context of a Revision, we disallow a number of fields on this Container, including: name and lifecycle. In Cloud Run, only a single container may be provided.
1671 pub containers: Option<Vec<Container>>,
1672 /// Not supported by Cloud Run.
1673 #[serde(rename = "enableServiceLinks")]
1674 pub enable_service_links: Option<bool>,
1675 /// Not supported by Cloud Run.
1676 #[serde(rename = "imagePullSecrets")]
1677 pub image_pull_secrets: Option<Vec<LocalObjectReference>>,
1678 /// Optional. The Node Selector configuration. Map of selector key to a value which matches a node.
1679 #[serde(rename = "nodeSelector")]
1680 pub node_selector: Option<HashMap<String, String>>,
1681 /// Runtime. Leave unset for default.
1682 #[serde(rename = "runtimeClassName")]
1683 pub runtime_class_name: Option<String>,
1684 /// 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.
1685 #[serde(rename = "serviceAccountName")]
1686 pub service_account_name: Option<String>,
1687 /// TimeoutSeconds holds the max duration the instance is allowed for responding to a request. Cloud Run: defaults to 300 seconds (5 minutes). Maximum allowed value is 3600 seconds (1 hour).
1688 #[serde(rename = "timeoutSeconds")]
1689 pub timeout_seconds: Option<i32>,
1690 /// no description provided
1691 pub volumes: Option<Vec<Volume>>,
1692}
1693
1694impl common::Part for RevisionSpec {}
1695
1696/// RevisionStatus communicates the observed state of the Revision (from the controller).
1697///
1698/// This type is not used in any activity, and only used as *part* of another schema.
1699///
1700#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1701#[serde_with::serde_as]
1702#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1703pub struct RevisionStatus {
1704 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world. As a Revision is being prepared, it will incrementally update conditions. Revision-specific conditions include: * `ResourcesAvailable`: `True` when underlying resources have been provisioned. * `ContainerHealthy`: `True` when the Revision readiness check completes. * `Active`: `True` when the Revision may receive traffic.
1705 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1706 /// Output only. The configured number of instances running this revision. For Cloud Run, this only includes instances provisioned using the minScale annotation. It does not include instances created by autoscaling.
1707 #[serde(rename = "desiredReplicas")]
1708 pub desired_replicas: Option<i32>,
1709 /// ImageDigest holds the resolved digest for the image specified within .Spec.Container.Image. The digest is resolved during the creation of Revision. This field holds the digest value regardless of whether a tag or digest was originally specified in the Container object.
1710 #[serde(rename = "imageDigest")]
1711 pub image_digest: Option<String>,
1712 /// Optional. Specifies the generated logging url for this particular revision based on the revision url template specified in the controller's config.
1713 #[serde(rename = "logUrl")]
1714 pub log_url: Option<String>,
1715 /// ObservedGeneration is the 'Generation' of the Revision that was last processed by the controller. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation, and the Ready condition's status is True or False.
1716 #[serde(rename = "observedGeneration")]
1717 pub observed_generation: Option<i32>,
1718 /// Not currently used by Cloud Run.
1719 #[serde(rename = "serviceName")]
1720 pub service_name: Option<String>,
1721}
1722
1723impl common::Part for RevisionStatus {}
1724
1725/// RevisionTemplateSpec describes the data a revision should have when created from a template.
1726///
1727/// This type is not used in any activity, and only used as *part* of another schema.
1728///
1729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1730#[serde_with::serde_as]
1731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1732pub struct RevisionTemplate {
1733 /// Optional metadata for this Revision, including labels and annotations. Name will be generated by the Configuration. The following annotation keys set properties of the created revision: * `autoscaling.knative.dev/minScale` sets the minimum number of instances. * `autoscaling.knative.dev/maxScale` sets the maximum number of instances. * `run.googleapis.com/cloudsql-instances` sets Cloud SQL connections. Multiple values should be comma separated. * `run.googleapis.com/vpc-access-connector` sets a Serverless VPC Access connector. * `run.googleapis.com/vpc-access-egress` sets VPC egress. Supported values are `all-traffic`, `all` (deprecated), and `private-ranges-only`. `all-traffic` and `all` provide the same functionality. `all` is deprecated but will continue to be supported. Prefer `all-traffic`.
1734 pub metadata: Option<ObjectMeta>,
1735 /// RevisionSpec holds the desired state of the Revision (from the client).
1736 pub spec: Option<RevisionSpec>,
1737}
1738
1739impl common::Part for RevisionTemplate {}
1740
1741/// Route is responsible for configuring ingress over a collection of Revisions. Some of the Revisions a Route distributes traffic over may be specified by referencing the Configuration responsible for creating them; in these cases the Route is additionally responsible for monitoring the Configuration for “latest ready” revision changes, and smoothly rolling out latest revisions. Cloud Run currently supports referencing a single Configuration to automatically deploy the “latest ready” Revision from that Configuration.
1742///
1743/// # Activities
1744///
1745/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1746/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1747///
1748/// * [routes get namespaces](NamespaceRouteGetCall) (response)
1749/// * [locations routes get projects](ProjectLocationRouteGetCall) (response)
1750#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1751#[serde_with::serde_as]
1752#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1753pub struct Route {
1754 /// The API version for this call such as "serving.knative.dev/v1".
1755 #[serde(rename = "apiVersion")]
1756 pub api_version: Option<String>,
1757 /// The kind of this resource, in this case always "Route".
1758 pub kind: Option<String>,
1759 /// Metadata associated with this Route, including name, namespace, labels, and annotations.
1760 pub metadata: Option<ObjectMeta>,
1761 /// Spec holds the desired state of the Route (from the client).
1762 pub spec: Option<RouteSpec>,
1763 /// Status communicates the observed state of the Route (from the controller).
1764 pub status: Option<RouteStatus>,
1765}
1766
1767impl common::ResponseResult for Route {}
1768
1769/// RouteSpec holds the desired state of the Route (from the client).
1770///
1771/// This type is not used in any activity, and only used as *part* of another schema.
1772///
1773#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1774#[serde_with::serde_as]
1775#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1776pub struct RouteSpec {
1777 /// Traffic specifies how to distribute traffic over a collection of Knative Revisions and Configurations. Cloud Run currently supports a single configurationName.
1778 pub traffic: Option<Vec<TrafficTarget>>,
1779}
1780
1781impl common::Part for RouteSpec {}
1782
1783/// RouteStatus communicates the observed state of the Route (from the controller).
1784///
1785/// This type is not used in any activity, and only used as *part* of another schema.
1786///
1787#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1788#[serde_with::serde_as]
1789#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1790pub struct RouteStatus {
1791 /// Similar to url, information on where the service is available on HTTP.
1792 pub address: Option<Addressable>,
1793 /// Conditions communicates information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world.
1794 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1795 /// ObservedGeneration is the 'Generation' of the Route that was last processed by the controller. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation and the Ready condition's status is True or False. Note that providing a TrafficTarget that has latest_revision=True will result in a Route that does not increment either its metadata.generation or its observedGeneration, as new "latest ready" revisions from the Configuration are processed without an update to the Route's spec.
1796 #[serde(rename = "observedGeneration")]
1797 pub observed_generation: Option<i32>,
1798 /// Traffic holds the configured traffic distribution. These entries will always contain RevisionName references. When ConfigurationName appears in the spec, this will hold the LatestReadyRevisionName that was last observed.
1799 pub traffic: Option<Vec<TrafficTarget>>,
1800 /// URL holds the url that will distribute traffic over the provided traffic targets. It generally has the form: `https://{route-hash}-{project-hash}-{cluster-level-suffix}.a.run.app`
1801 pub url: Option<String>,
1802}
1803
1804impl common::Part for RouteStatus {}
1805
1806/// Request message for creating a new execution of a job.
1807///
1808/// # Activities
1809///
1810/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1811/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1812///
1813/// * [jobs run namespaces](NamespaceJobRunCall) (request)
1814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1815#[serde_with::serde_as]
1816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1817pub struct RunJobRequest {
1818 /// Optional. Overrides existing job configuration for one specific new job execution only, using the specified values to update the job configuration for the new execution.
1819 pub overrides: Option<Overrides>,
1820}
1821
1822impl common::RequestValue for RunJobRequest {}
1823
1824/// Not supported by Cloud Run. SecretEnvSource selects a Secret to populate the environment variables with. The contents of the target Secret's Data field will represent the key-value pairs as environment variables.
1825///
1826/// This type is not used in any activity, and only used as *part* of another schema.
1827///
1828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1829#[serde_with::serde_as]
1830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1831pub struct SecretEnvSource {
1832 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
1833 #[serde(rename = "localObjectReference")]
1834 pub local_object_reference: Option<LocalObjectReference>,
1835 /// The Secret to select from.
1836 pub name: Option<String>,
1837 /// Specify whether the Secret must be defined
1838 pub optional: Option<bool>,
1839}
1840
1841impl common::Part for SecretEnvSource {}
1842
1843/// SecretKeySelector selects a key of a Secret.
1844///
1845/// This type is not used in any activity, and only used as *part* of another schema.
1846///
1847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1848#[serde_with::serde_as]
1849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1850pub struct SecretKeySelector {
1851 /// Required. A Cloud Secret Manager secret version. Must be 'latest' for the latest version, an integer for a specific version, or a version alias. The key of the secret to select from. Must be a valid secret key.
1852 pub key: Option<String>,
1853 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
1854 #[serde(rename = "localObjectReference")]
1855 pub local_object_reference: Option<LocalObjectReference>,
1856 /// The name of the secret in Cloud Secret Manager. By default, the secret is assumed to be in the same project. If the secret is in another project, you must define an alias. An alias definition has the form: :projects//secrets/. If multiple alias definitions are needed, they must be separated by commas. The alias definitions must be set on the run.googleapis.com/secrets annotation. The name of the secret in the pod's namespace to select from.
1857 pub name: Option<String>,
1858 /// Specify whether the Secret or its key must be defined.
1859 pub optional: Option<bool>,
1860}
1861
1862impl common::Part for SecretKeySelector {}
1863
1864/// A volume representing a secret stored in Google Secret Manager. 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_name. The contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names.
1865///
1866/// This type is not used in any activity, and only used as *part* of another schema.
1867///
1868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1869#[serde_with::serde_as]
1870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1871pub struct SecretVolumeSource {
1872 /// Integer representation of mode bits to use on created files by default. Must be a value between 01 and 0777 (octal). If 0 or not set, it will default 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 777 (a=rwx), set to 0777 (octal) or 511 (base-10). 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.
1873 #[serde(rename = "defaultMode")]
1874 pub default_mode: Option<i32>,
1875 /// A list of secret versions to mount in the volume. If no items are specified, the volume will expose a file with the same name as the secret name. The contents of the file will be the data in the latest version of the secret. If items are 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 both a key and a path.
1876 pub items: Option<Vec<KeyToPath>>,
1877 /// Not supported by Cloud Run.
1878 pub optional: Option<bool>,
1879 /// The name of the secret in Cloud Secret Manager. By default, the secret is assumed to be in the same project. If the secret is in another project, you must define an alias. An alias definition has the form: :projects//secrets/. If multiple alias definitions are needed, they must be separated by commas. The alias definitions must be set on the run.googleapis.com/secrets annotation. Name of the secret in the container's namespace to use.
1880 #[serde(rename = "secretName")]
1881 pub secret_name: Option<String>,
1882}
1883
1884impl common::Part for SecretVolumeSource {}
1885
1886/// Not supported by Cloud Run. SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.
1887///
1888/// This type is not used in any activity, and only used as *part* of another schema.
1889///
1890#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1891#[serde_with::serde_as]
1892#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1893pub struct SecurityContext {
1894 /// The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
1895 #[serde(rename = "runAsUser")]
1896 pub run_as_user: Option<i32>,
1897}
1898
1899impl common::Part for SecurityContext {}
1900
1901/// Service acts as a top-level container that manages a set of Routes and Configurations 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. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets). The Service’s controller will track the statuses of its owned Configuration and Route, reflecting their statuses and conditions as its own.
1902///
1903/// # Activities
1904///
1905/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1906/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1907///
1908/// * [services create namespaces](NamespaceServiceCreateCall) (request|response)
1909/// * [services get namespaces](NamespaceServiceGetCall) (response)
1910/// * [services replace service namespaces](NamespaceServiceReplaceServiceCall) (request|response)
1911/// * [locations services create projects](ProjectLocationServiceCreateCall) (request|response)
1912/// * [locations services get projects](ProjectLocationServiceGetCall) (response)
1913/// * [locations services replace service projects](ProjectLocationServiceReplaceServiceCall) (request|response)
1914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1915#[serde_with::serde_as]
1916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1917pub struct Service {
1918 /// The API version for this call. It must be "serving.knative.dev/v1".
1919 #[serde(rename = "apiVersion")]
1920 pub api_version: Option<String>,
1921 /// The kind of resource. It must be "Service".
1922 pub kind: Option<String>,
1923 /// Metadata associated with this Service, including name, namespace, labels, and annotations. In Cloud Run, annotations with ‘run.googleapis.com/’ and ‘autoscaling.knative.dev’ are restricted, and the accepted annotations will be different depending on the resource type. The following Cloud Run-specific annotations are accepted in Service.metadata.annotations. * `run.googleapis.com/binary-authorization-breakglass` * `run.googleapis.com/binary-authorization` * `run.googleapis.com/client-name` * `run.googleapis.com/custom-audiences` * `run.googleapis.com/default-url-disabled` * `run.googleapis.com/description` * `run.googleapis.com/gc-traffic-tags` * `run.googleapis.com/ingress` * `run.googleapis.com/ingress` sets the ingress settings for the Service. See [the ingress settings documentation](https://cloud.google.com/run/docs/securing/ingress) for details on configuring ingress settings. * `run.googleapis.com/ingress-status` is output-only and contains the currently active ingress settings for the Service. `run.googleapis.com/ingress-status` may differ from `run.googleapis.com/ingress` while the system is processing a change to `run.googleapis.com/ingress` or if the system failed to process a change to `run.googleapis.com/ingress`. When the system has processed all changes successfully `run.googleapis.com/ingress-status` and `run.googleapis.com/ingress` are equal.
1924 pub metadata: Option<ObjectMeta>,
1925 /// Holds the desired state of the Service (from the client).
1926 pub spec: Option<ServiceSpec>,
1927 /// Communicates the system-controlled state of the Service.
1928 pub status: Option<ServiceStatus>,
1929}
1930
1931impl common::RequestValue for Service {}
1932impl common::ResponseResult for Service {}
1933
1934/// ServiceSpec holds the desired state of the Route (from the client), which is used to manipulate the underlying Route and Configuration(s).
1935///
1936/// This type is not used in any activity, and only used as *part* of another schema.
1937///
1938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1939#[serde_with::serde_as]
1940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1941pub struct ServiceSpec {
1942 /// Holds the latest specification for the Revision to be stamped out.
1943 pub template: Option<RevisionTemplate>,
1944 /// Specifies how to distribute traffic over a collection of Knative Revisions and Configurations to the Service's main URL.
1945 pub traffic: Option<Vec<TrafficTarget>>,
1946}
1947
1948impl common::Part for ServiceSpec {}
1949
1950/// The current state of the Service. Output only.
1951///
1952/// This type is not used in any activity, and only used as *part* of another schema.
1953///
1954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1955#[serde_with::serde_as]
1956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1957pub struct ServiceStatus {
1958 /// Similar to url, information on where the service is available on HTTP.
1959 pub address: Option<Addressable>,
1960 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the `spec` inline with the observed state of the world. Service-specific conditions include: * `ConfigurationsReady`: `True` when the underlying Configuration is ready. * `RoutesReady`: `True` when the underlying Route is ready. * `Ready`: `True` when all underlying resources are ready.
1961 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1962 /// Name of the last revision that was created from this Service's Configuration. It might not be ready yet, for that use LatestReadyRevisionName.
1963 #[serde(rename = "latestCreatedRevisionName")]
1964 pub latest_created_revision_name: Option<String>,
1965 /// Name of the latest Revision from this Service's Configuration that has had its `Ready` condition become `True`.
1966 #[serde(rename = "latestReadyRevisionName")]
1967 pub latest_ready_revision_name: Option<String>,
1968 /// Returns the generation last seen by the system. Clients polling for completed reconciliation should poll until observedGeneration = metadata.generation and the Ready condition's status is True or False.
1969 #[serde(rename = "observedGeneration")]
1970 pub observed_generation: Option<i32>,
1971 /// Holds the configured traffic distribution. These entries will always contain RevisionName references. When ConfigurationName appears in the spec, this will hold the LatestReadyRevisionName that we last observed.
1972 pub traffic: Option<Vec<TrafficTarget>>,
1973 /// URL that will distribute traffic over the provided traffic targets. It generally has the form `https://{route-hash}-{project-hash}-{cluster-level-suffix}.a.run.app`
1974 pub url: Option<String>,
1975}
1976
1977impl common::Part for ServiceStatus {}
1978
1979/// Request message for `SetIamPolicy` method.
1980///
1981/// # Activities
1982///
1983/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1984/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1985///
1986/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (request)
1987/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (request)
1988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1989#[serde_with::serde_as]
1990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1991pub struct SetIamPolicyRequest {
1992 /// 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.
1993 pub policy: Option<Policy>,
1994 /// 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"`
1995 #[serde(rename = "updateMask")]
1996 pub update_mask: Option<common::FieldMask>,
1997}
1998
1999impl common::RequestValue for SetIamPolicyRequest {}
2000
2001/// Status is a return value for calls that don’t return other objects.
2002///
2003/// # Activities
2004///
2005/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2006/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2007///
2008/// * [domainmappings delete namespaces](NamespaceDomainmappingDeleteCall) (response)
2009/// * [executions delete namespaces](NamespaceExecutionDeleteCall) (response)
2010/// * [jobs delete namespaces](NamespaceJobDeleteCall) (response)
2011/// * [revisions delete namespaces](NamespaceRevisionDeleteCall) (response)
2012/// * [services delete namespaces](NamespaceServiceDeleteCall) (response)
2013/// * [locations domainmappings delete projects](ProjectLocationDomainmappingDeleteCall) (response)
2014/// * [locations revisions delete projects](ProjectLocationRevisionDeleteCall) (response)
2015/// * [locations services delete projects](ProjectLocationServiceDeleteCall) (response)
2016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2017#[serde_with::serde_as]
2018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2019pub struct Status {
2020 /// Suggested HTTP return code for this status, 0 if not set.
2021 pub code: Option<i32>,
2022 /// Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.
2023 pub details: Option<StatusDetails>,
2024 /// A human-readable description of the status of this operation.
2025 pub message: Option<String>,
2026 /// Standard list metadata.
2027 pub metadata: Option<ListMeta>,
2028 /// A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.
2029 pub reason: Option<String>,
2030 /// Status of the operation. One of: "Success" or "Failure".
2031 pub status: Option<String>,
2032}
2033
2034impl common::ResponseResult for Status {}
2035
2036/// StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.
2037///
2038/// This type is not used in any activity, and only used as *part* of another schema.
2039///
2040#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2041#[serde_with::serde_as]
2042#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2043pub struct StatusCause {
2044 /// The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Examples: "name" - the field "name" on the current resource "items[0].name" - the field "name" on the first array entry in "items"
2045 pub field: Option<String>,
2046 /// A human-readable description of the cause of the error. This field may be presented as-is to a reader.
2047 pub message: Option<String>,
2048 /// A machine-readable description of the cause of the error. If this value is empty there is no information available.
2049 pub reason: Option<String>,
2050}
2051
2052impl common::Part for StatusCause {}
2053
2054/// StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.
2055///
2056/// This type is not used in any activity, and only used as *part* of another schema.
2057///
2058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2059#[serde_with::serde_as]
2060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2061pub struct StatusDetails {
2062 /// The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.
2063 pub causes: Option<Vec<StatusCause>>,
2064 /// The group attribute of the resource associated with the status StatusReason.
2065 pub group: Option<String>,
2066 /// The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind.
2067 pub kind: Option<String>,
2068 /// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
2069 pub name: Option<String>,
2070 /// If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.
2071 #[serde(rename = "retryAfterSeconds")]
2072 pub retry_after_seconds: Option<i32>,
2073 /// UID of the resource. (when there is a single resource which can be described).
2074 pub uid: Option<String>,
2075}
2076
2077impl common::Part for StatusDetails {}
2078
2079/// TCPSocketAction describes an action based on opening a socket
2080///
2081/// This type is not used in any activity, and only used as *part* of another schema.
2082///
2083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2084#[serde_with::serde_as]
2085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2086pub struct TCPSocketAction {
2087 /// Not supported by Cloud Run.
2088 pub host: Option<String>,
2089 /// Port number to access on the container. Number must be in the range 1 to 65535.
2090 pub port: Option<i32>,
2091}
2092
2093impl common::Part for TCPSocketAction {}
2094
2095/// Task represents a single run of a container to completion.
2096///
2097/// # Activities
2098///
2099/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2100/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2101///
2102/// * [tasks get namespaces](NamespaceTaskGetCall) (response)
2103#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2104#[serde_with::serde_as]
2105#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2106pub struct Task {
2107 /// Optional. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
2108 #[serde(rename = "apiVersion")]
2109 pub api_version: Option<String>,
2110 /// Optional. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.
2111 pub kind: Option<String>,
2112 /// Optional. Standard object's metadata.
2113 pub metadata: Option<ObjectMeta>,
2114 /// Optional. Specification of the desired behavior of a task.
2115 pub spec: Option<TaskSpec>,
2116 /// Output only. Current status of a task.
2117 pub status: Option<TaskStatus>,
2118}
2119
2120impl common::ResponseResult for Task {}
2121
2122/// Result of a task attempt.
2123///
2124/// This type is not used in any activity, and only used as *part* of another schema.
2125///
2126#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2127#[serde_with::serde_as]
2128#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2129pub struct TaskAttemptResult {
2130 /// Optional. 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.
2131 #[serde(rename = "exitCode")]
2132 pub exit_code: Option<i32>,
2133 /// Optional. The status of this attempt. If the status code is OK, then the attempt succeeded.
2134 pub status: Option<GoogleRpcStatus>,
2135}
2136
2137impl common::Part for TaskAttemptResult {}
2138
2139/// TaskSpec is a description of a task.
2140///
2141/// This type is not used in any activity, and only used as *part* of another schema.
2142///
2143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2144#[serde_with::serde_as]
2145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2146pub struct TaskSpec {
2147 /// Optional. List of containers belonging to the task. We disallow a number of fields on this Container.
2148 pub containers: Option<Vec<Container>>,
2149 /// Optional. Number of retries allowed per task, before marking this job failed. Defaults to 3.
2150 #[serde(rename = "maxRetries")]
2151 pub max_retries: Option<i32>,
2152 /// Optional. Email address of the IAM service account associated with the task of a job execution. 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.
2153 #[serde(rename = "serviceAccountName")]
2154 pub service_account_name: Option<String>,
2155 /// Optional. Duration in seconds 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.
2156 #[serde(rename = "timeoutSeconds")]
2157 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2158 pub timeout_seconds: Option<i64>,
2159 /// Optional. List of volumes that can be mounted by containers belonging to the task.
2160 pub volumes: Option<Vec<Volume>>,
2161}
2162
2163impl common::Part for TaskSpec {}
2164
2165/// TaskStatus represents the status of a task.
2166///
2167/// This type is not used in any activity, and only used as *part* of another schema.
2168///
2169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2170#[serde_with::serde_as]
2171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2172pub struct TaskStatus {
2173 /// Optional. Represents time when the task was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.
2174 #[serde(rename = "completionTime")]
2175 pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2176 /// Optional. Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world. Task-specific conditions include: * `Started`: `True` when the task has started to execute. * `Completed`: `True` when the task has succeeded. `False` when the task has failed.
2177 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
2178 /// Required. Index of the task, unique per execution, and beginning at 0.
2179 pub index: Option<i32>,
2180 /// Optional. Result of the last attempt of this task.
2181 #[serde(rename = "lastAttemptResult")]
2182 pub last_attempt_result: Option<TaskAttemptResult>,
2183 /// Optional. URI where logs for this task can be found in Cloud Console.
2184 #[serde(rename = "logUri")]
2185 pub log_uri: Option<String>,
2186 /// Optional. The 'generation' of the task that was last processed by the controller.
2187 #[serde(rename = "observedGeneration")]
2188 pub observed_generation: Option<i32>,
2189 /// Optional. The number of times this task was retried. Instances are retried when they fail up to the maxRetries limit.
2190 pub retried: Option<i32>,
2191 /// Optional. Represents time when the task started to run. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.
2192 #[serde(rename = "startTime")]
2193 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2194}
2195
2196impl common::Part for TaskStatus {}
2197
2198/// TaskTemplateSpec describes the data a task should have when created from a template.
2199///
2200/// This type is not used in any activity, and only used as *part* of another schema.
2201///
2202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2203#[serde_with::serde_as]
2204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2205pub struct TaskTemplateSpec {
2206 /// Optional. Specification of the desired behavior of the task.
2207 pub spec: Option<TaskSpec>,
2208}
2209
2210impl common::Part for TaskTemplateSpec {}
2211
2212/// Request message for `TestIamPermissions` method.
2213///
2214/// # Activities
2215///
2216/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2217/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2218///
2219/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (request)
2220/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (request)
2221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2222#[serde_with::serde_as]
2223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2224pub struct TestIamPermissionsRequest {
2225 /// 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).
2226 pub permissions: Option<Vec<String>>,
2227}
2228
2229impl common::RequestValue for TestIamPermissionsRequest {}
2230
2231/// Response message for `TestIamPermissions` method.
2232///
2233/// # Activities
2234///
2235/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2236/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2237///
2238/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (response)
2239/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (response)
2240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2241#[serde_with::serde_as]
2242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2243pub struct TestIamPermissionsResponse {
2244 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2245 pub permissions: Option<Vec<String>>,
2246}
2247
2248impl common::ResponseResult for TestIamPermissionsResponse {}
2249
2250/// TrafficTarget holds a single entry of the routing table for a Route.
2251///
2252/// This type is not used in any activity, and only used as *part* of another schema.
2253///
2254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2255#[serde_with::serde_as]
2256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2257pub struct TrafficTarget {
2258 /// [Deprecated] Not supported in Cloud Run. It must be empty.
2259 #[serde(rename = "configurationName")]
2260 pub configuration_name: Option<String>,
2261 /// Uses the "status.latestReadyRevisionName" of the Service to determine the traffic target. When it changes, traffic will automatically migrate from the prior "latest ready" revision to the new one. This field must be false if RevisionName is set. This field defaults to true otherwise. If the field is set to true on Status, this means that the Revision was resolved from the Service's latest ready revision.
2262 #[serde(rename = "latestRevision")]
2263 pub latest_revision: Option<bool>,
2264 /// Percent specifies percent of the traffic to this Revision or Configuration. This defaults to zero if unspecified.
2265 pub percent: Option<i32>,
2266 /// Points this traffic target to a specific Revision. This field is mutually exclusive with latest_revision.
2267 #[serde(rename = "revisionName")]
2268 pub revision_name: Option<String>,
2269 /// Tag is used to expose a dedicated url for referencing this target exclusively.
2270 pub tag: Option<String>,
2271 /// Output only. URL displays the URL for accessing tagged traffic targets. URL is displayed in status, and is disallowed on spec. URL must contain a scheme (e.g. https://) and a hostname, but may not contain anything else (e.g. basic auth, url path, etc.)
2272 pub url: Option<String>,
2273}
2274
2275impl common::Part for TrafficTarget {}
2276
2277/// Volume represents a named volume in a container.
2278///
2279/// This type is not used in any activity, and only used as *part* of another schema.
2280///
2281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2282#[serde_with::serde_as]
2283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2284pub struct Volume {
2285 /// Not supported in Cloud Run.
2286 #[serde(rename = "configMap")]
2287 pub config_map: Option<ConfigMapVolumeSource>,
2288 /// Volume specified by the Container Storage Interface driver
2289 pub csi: Option<CSIVolumeSource>,
2290 /// Ephemeral storage used as a shared volume.
2291 #[serde(rename = "emptyDir")]
2292 pub empty_dir: Option<EmptyDirVolumeSource>,
2293 /// Volume's name. In Cloud Run Fully Managed, the name 'cloudsql' is reserved.
2294 pub name: Option<String>,
2295 /// no description provided
2296 pub nfs: Option<NFSVolumeSource>,
2297 /// 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 secretName.
2298 pub secret: Option<SecretVolumeSource>,
2299}
2300
2301impl common::Part for Volume {}
2302
2303/// VolumeMount describes a mounting of a Volume within a container.
2304///
2305/// This type is not used in any activity, and only used as *part* of another schema.
2306///
2307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2308#[serde_with::serde_as]
2309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2310pub struct VolumeMount {
2311 /// Required. Path within the container at which the volume should be mounted. Must not contain ':'.
2312 #[serde(rename = "mountPath")]
2313 pub mount_path: Option<String>,
2314 /// Required. The name of the volume. There must be a corresponding Volume with the same name.
2315 pub name: Option<String>,
2316 /// Sets the mount to be read-only or read-write. Not used by Cloud Run.
2317 #[serde(rename = "readOnly")]
2318 pub read_only: Option<bool>,
2319 /// Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
2320 #[serde(rename = "subPath")]
2321 pub sub_path: Option<String>,
2322}
2323
2324impl common::Part for VolumeMount {}
2325
2326// ###################
2327// MethodBuilders ###
2328// #################
2329
2330/// A builder providing access to all methods supported on *namespace* resources.
2331/// It is not used directly, but through the [`CloudRun`] hub.
2332///
2333/// # Example
2334///
2335/// Instantiate a resource builder
2336///
2337/// ```test_harness,no_run
2338/// extern crate hyper;
2339/// extern crate hyper_rustls;
2340/// extern crate google_run1 as run1;
2341///
2342/// # async fn dox() {
2343/// use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2344///
2345/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2346/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2347/// secret,
2348/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2349/// ).build().await.unwrap();
2350///
2351/// let client = hyper_util::client::legacy::Client::builder(
2352/// hyper_util::rt::TokioExecutor::new()
2353/// )
2354/// .build(
2355/// hyper_rustls::HttpsConnectorBuilder::new()
2356/// .with_native_roots()
2357/// .unwrap()
2358/// .https_or_http()
2359/// .enable_http1()
2360/// .build()
2361/// );
2362/// let mut hub = CloudRun::new(client, auth);
2363/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2364/// // like `authorizeddomains_list(...)`, `configurations_get(...)`, `configurations_list(...)`, `domainmappings_create(...)`, `domainmappings_delete(...)`, `domainmappings_get(...)`, `domainmappings_list(...)`, `executions_cancel(...)`, `executions_delete(...)`, `executions_get(...)`, `executions_list(...)`, `jobs_create(...)`, `jobs_delete(...)`, `jobs_get(...)`, `jobs_list(...)`, `jobs_replace_job(...)`, `jobs_run(...)`, `revisions_delete(...)`, `revisions_get(...)`, `revisions_list(...)`, `routes_get(...)`, `routes_list(...)`, `services_create(...)`, `services_delete(...)`, `services_get(...)`, `services_list(...)`, `services_replace_service(...)`, `tasks_get(...)` and `tasks_list(...)`
2365/// // to build up your call.
2366/// let rb = hub.namespaces();
2367/// # }
2368/// ```
2369pub struct NamespaceMethods<'a, C>
2370where
2371 C: 'a,
2372{
2373 hub: &'a CloudRun<C>,
2374}
2375
2376impl<'a, C> common::MethodsBuilder for NamespaceMethods<'a, C> {}
2377
2378impl<'a, C> NamespaceMethods<'a, C> {
2379 /// Create a builder to help you perform the following task:
2380 ///
2381 /// List authorized domains.
2382 ///
2383 /// # Arguments
2384 ///
2385 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
2386 pub fn authorizeddomains_list(&self, parent: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
2387 NamespaceAuthorizeddomainListCall {
2388 hub: self.hub,
2389 _parent: parent.to_string(),
2390 _page_token: Default::default(),
2391 _page_size: Default::default(),
2392 _delegate: Default::default(),
2393 _additional_params: Default::default(),
2394 _scopes: Default::default(),
2395 }
2396 }
2397
2398 /// Create a builder to help you perform the following task:
2399 ///
2400 /// Get information about a configuration.
2401 ///
2402 /// # Arguments
2403 ///
2404 /// * `name` - The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
2405 pub fn configurations_get(&self, name: &str) -> NamespaceConfigurationGetCall<'a, C> {
2406 NamespaceConfigurationGetCall {
2407 hub: self.hub,
2408 _name: name.to_string(),
2409 _delegate: Default::default(),
2410 _additional_params: Default::default(),
2411 _scopes: Default::default(),
2412 }
2413 }
2414
2415 /// Create a builder to help you perform the following task:
2416 ///
2417 /// List configurations. Results are sorted by creation time, descending.
2418 ///
2419 /// # Arguments
2420 ///
2421 /// * `parent` - The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
2422 pub fn configurations_list(&self, parent: &str) -> NamespaceConfigurationListCall<'a, C> {
2423 NamespaceConfigurationListCall {
2424 hub: self.hub,
2425 _parent: parent.to_string(),
2426 _watch: Default::default(),
2427 _resource_version: Default::default(),
2428 _limit: Default::default(),
2429 _label_selector: Default::default(),
2430 _include_uninitialized: Default::default(),
2431 _field_selector: Default::default(),
2432 _continue_: Default::default(),
2433 _delegate: Default::default(),
2434 _additional_params: Default::default(),
2435 _scopes: Default::default(),
2436 }
2437 }
2438
2439 /// Create a builder to help you perform the following task:
2440 ///
2441 /// Create a new domain mapping.
2442 ///
2443 /// # Arguments
2444 ///
2445 /// * `request` - No description provided.
2446 /// * `parent` - Required. The namespace in which the domain mapping should be created. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2447 pub fn domainmappings_create(
2448 &self,
2449 request: DomainMapping,
2450 parent: &str,
2451 ) -> NamespaceDomainmappingCreateCall<'a, C> {
2452 NamespaceDomainmappingCreateCall {
2453 hub: self.hub,
2454 _request: request,
2455 _parent: parent.to_string(),
2456 _dry_run: Default::default(),
2457 _delegate: Default::default(),
2458 _additional_params: Default::default(),
2459 _scopes: Default::default(),
2460 }
2461 }
2462
2463 /// Create a builder to help you perform the following task:
2464 ///
2465 /// Delete a domain mapping.
2466 ///
2467 /// # Arguments
2468 ///
2469 /// * `name` - Required. The name of the domain mapping to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2470 pub fn domainmappings_delete(&self, name: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
2471 NamespaceDomainmappingDeleteCall {
2472 hub: self.hub,
2473 _name: name.to_string(),
2474 _propagation_policy: Default::default(),
2475 _kind: Default::default(),
2476 _dry_run: Default::default(),
2477 _api_version: Default::default(),
2478 _delegate: Default::default(),
2479 _additional_params: Default::default(),
2480 _scopes: Default::default(),
2481 }
2482 }
2483
2484 /// Create a builder to help you perform the following task:
2485 ///
2486 /// Get information about a domain mapping.
2487 ///
2488 /// # Arguments
2489 ///
2490 /// * `name` - Required. The name of the domain mapping to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2491 pub fn domainmappings_get(&self, name: &str) -> NamespaceDomainmappingGetCall<'a, C> {
2492 NamespaceDomainmappingGetCall {
2493 hub: self.hub,
2494 _name: name.to_string(),
2495 _delegate: Default::default(),
2496 _additional_params: Default::default(),
2497 _scopes: Default::default(),
2498 }
2499 }
2500
2501 /// Create a builder to help you perform the following task:
2502 ///
2503 /// List all domain mappings.
2504 ///
2505 /// # Arguments
2506 ///
2507 /// * `parent` - Required. The namespace from which the domain mappings should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2508 pub fn domainmappings_list(&self, parent: &str) -> NamespaceDomainmappingListCall<'a, C> {
2509 NamespaceDomainmappingListCall {
2510 hub: self.hub,
2511 _parent: parent.to_string(),
2512 _watch: Default::default(),
2513 _resource_version: Default::default(),
2514 _limit: Default::default(),
2515 _label_selector: Default::default(),
2516 _include_uninitialized: Default::default(),
2517 _field_selector: Default::default(),
2518 _continue_: Default::default(),
2519 _delegate: Default::default(),
2520 _additional_params: Default::default(),
2521 _scopes: Default::default(),
2522 }
2523 }
2524
2525 /// Create a builder to help you perform the following task:
2526 ///
2527 /// Cancel an execution.
2528 ///
2529 /// # Arguments
2530 ///
2531 /// * `request` - No description provided.
2532 /// * `name` - Required. The name of the execution to cancel. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2533 pub fn executions_cancel(
2534 &self,
2535 request: CancelExecutionRequest,
2536 name: &str,
2537 ) -> NamespaceExecutionCancelCall<'a, C> {
2538 NamespaceExecutionCancelCall {
2539 hub: self.hub,
2540 _request: request,
2541 _name: name.to_string(),
2542 _delegate: Default::default(),
2543 _additional_params: Default::default(),
2544 _scopes: Default::default(),
2545 }
2546 }
2547
2548 /// Create a builder to help you perform the following task:
2549 ///
2550 /// Delete an execution.
2551 ///
2552 /// # Arguments
2553 ///
2554 /// * `name` - Required. The name of the execution to delete. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2555 pub fn executions_delete(&self, name: &str) -> NamespaceExecutionDeleteCall<'a, C> {
2556 NamespaceExecutionDeleteCall {
2557 hub: self.hub,
2558 _name: name.to_string(),
2559 _propagation_policy: Default::default(),
2560 _kind: Default::default(),
2561 _api_version: Default::default(),
2562 _delegate: Default::default(),
2563 _additional_params: Default::default(),
2564 _scopes: Default::default(),
2565 }
2566 }
2567
2568 /// Create a builder to help you perform the following task:
2569 ///
2570 /// Get information about an execution.
2571 ///
2572 /// # Arguments
2573 ///
2574 /// * `name` - Required. The name of the execution to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2575 pub fn executions_get(&self, name: &str) -> NamespaceExecutionGetCall<'a, C> {
2576 NamespaceExecutionGetCall {
2577 hub: self.hub,
2578 _name: name.to_string(),
2579 _delegate: Default::default(),
2580 _additional_params: Default::default(),
2581 _scopes: Default::default(),
2582 }
2583 }
2584
2585 /// Create a builder to help you perform the following task:
2586 ///
2587 /// List executions. Results are sorted by creation time, descending.
2588 ///
2589 /// # Arguments
2590 ///
2591 /// * `parent` - Required. The namespace from which the executions should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2592 pub fn executions_list(&self, parent: &str) -> NamespaceExecutionListCall<'a, C> {
2593 NamespaceExecutionListCall {
2594 hub: self.hub,
2595 _parent: parent.to_string(),
2596 _watch: Default::default(),
2597 _resource_version: Default::default(),
2598 _limit: Default::default(),
2599 _label_selector: Default::default(),
2600 _include_uninitialized: Default::default(),
2601 _field_selector: Default::default(),
2602 _continue_: Default::default(),
2603 _delegate: Default::default(),
2604 _additional_params: Default::default(),
2605 _scopes: Default::default(),
2606 }
2607 }
2608
2609 /// Create a builder to help you perform the following task:
2610 ///
2611 /// Create a job.
2612 ///
2613 /// # Arguments
2614 ///
2615 /// * `request` - No description provided.
2616 /// * `parent` - Required. The namespace in which the job should be created. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2617 pub fn jobs_create(&self, request: Job, parent: &str) -> NamespaceJobCreateCall<'a, C> {
2618 NamespaceJobCreateCall {
2619 hub: self.hub,
2620 _request: request,
2621 _parent: parent.to_string(),
2622 _delegate: Default::default(),
2623 _additional_params: Default::default(),
2624 _scopes: Default::default(),
2625 }
2626 }
2627
2628 /// Create a builder to help you perform the following task:
2629 ///
2630 /// Delete a job.
2631 ///
2632 /// # Arguments
2633 ///
2634 /// * `name` - Required. The name of the job to delete. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2635 pub fn jobs_delete(&self, name: &str) -> NamespaceJobDeleteCall<'a, C> {
2636 NamespaceJobDeleteCall {
2637 hub: self.hub,
2638 _name: name.to_string(),
2639 _propagation_policy: Default::default(),
2640 _kind: Default::default(),
2641 _api_version: Default::default(),
2642 _delegate: Default::default(),
2643 _additional_params: Default::default(),
2644 _scopes: Default::default(),
2645 }
2646 }
2647
2648 /// Create a builder to help you perform the following task:
2649 ///
2650 /// Get information about a job.
2651 ///
2652 /// # Arguments
2653 ///
2654 /// * `name` - Required. The name of the job to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2655 pub fn jobs_get(&self, name: &str) -> NamespaceJobGetCall<'a, C> {
2656 NamespaceJobGetCall {
2657 hub: self.hub,
2658 _name: name.to_string(),
2659 _delegate: Default::default(),
2660 _additional_params: Default::default(),
2661 _scopes: Default::default(),
2662 }
2663 }
2664
2665 /// Create a builder to help you perform the following task:
2666 ///
2667 /// List jobs. Results are sorted by creation time, descending.
2668 ///
2669 /// # Arguments
2670 ///
2671 /// * `parent` - Required. The namespace from which the jobs should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2672 pub fn jobs_list(&self, parent: &str) -> NamespaceJobListCall<'a, C> {
2673 NamespaceJobListCall {
2674 hub: self.hub,
2675 _parent: parent.to_string(),
2676 _watch: Default::default(),
2677 _resource_version: Default::default(),
2678 _limit: Default::default(),
2679 _label_selector: Default::default(),
2680 _include_uninitialized: Default::default(),
2681 _field_selector: Default::default(),
2682 _continue_: Default::default(),
2683 _delegate: Default::default(),
2684 _additional_params: Default::default(),
2685 _scopes: Default::default(),
2686 }
2687 }
2688
2689 /// Create a builder to help you perform the following task:
2690 ///
2691 /// Replace a job. Only the spec and metadata labels and annotations are modifiable. After the Replace request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
2692 ///
2693 /// # Arguments
2694 ///
2695 /// * `request` - No description provided.
2696 /// * `name` - Required. The name of the job being replaced. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2697 pub fn jobs_replace_job(&self, request: Job, name: &str) -> NamespaceJobReplaceJobCall<'a, C> {
2698 NamespaceJobReplaceJobCall {
2699 hub: self.hub,
2700 _request: request,
2701 _name: name.to_string(),
2702 _delegate: Default::default(),
2703 _additional_params: Default::default(),
2704 _scopes: Default::default(),
2705 }
2706 }
2707
2708 /// Create a builder to help you perform the following task:
2709 ///
2710 /// Trigger creation of a new execution of this job.
2711 ///
2712 /// # Arguments
2713 ///
2714 /// * `request` - No description provided.
2715 /// * `name` - Required. The name of the job to run. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2716 pub fn jobs_run(&self, request: RunJobRequest, name: &str) -> NamespaceJobRunCall<'a, C> {
2717 NamespaceJobRunCall {
2718 hub: self.hub,
2719 _request: request,
2720 _name: name.to_string(),
2721 _delegate: Default::default(),
2722 _additional_params: Default::default(),
2723 _scopes: Default::default(),
2724 }
2725 }
2726
2727 /// Create a builder to help you perform the following task:
2728 ///
2729 /// Delete a revision.
2730 ///
2731 /// # Arguments
2732 ///
2733 /// * `name` - The name of the revision to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2734 pub fn revisions_delete(&self, name: &str) -> NamespaceRevisionDeleteCall<'a, C> {
2735 NamespaceRevisionDeleteCall {
2736 hub: self.hub,
2737 _name: name.to_string(),
2738 _propagation_policy: Default::default(),
2739 _kind: Default::default(),
2740 _dry_run: Default::default(),
2741 _api_version: Default::default(),
2742 _delegate: Default::default(),
2743 _additional_params: Default::default(),
2744 _scopes: Default::default(),
2745 }
2746 }
2747
2748 /// Create a builder to help you perform the following task:
2749 ///
2750 /// Get information about a revision.
2751 ///
2752 /// # Arguments
2753 ///
2754 /// * `name` - The name of the revision to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2755 pub fn revisions_get(&self, name: &str) -> NamespaceRevisionGetCall<'a, C> {
2756 NamespaceRevisionGetCall {
2757 hub: self.hub,
2758 _name: name.to_string(),
2759 _delegate: Default::default(),
2760 _additional_params: Default::default(),
2761 _scopes: Default::default(),
2762 }
2763 }
2764
2765 /// Create a builder to help you perform the following task:
2766 ///
2767 /// List revisions. Results are sorted by creation time, descending.
2768 ///
2769 /// # Arguments
2770 ///
2771 /// * `parent` - The namespace from which the revisions should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2772 pub fn revisions_list(&self, parent: &str) -> NamespaceRevisionListCall<'a, C> {
2773 NamespaceRevisionListCall {
2774 hub: self.hub,
2775 _parent: parent.to_string(),
2776 _watch: Default::default(),
2777 _resource_version: Default::default(),
2778 _limit: Default::default(),
2779 _label_selector: Default::default(),
2780 _include_uninitialized: Default::default(),
2781 _field_selector: Default::default(),
2782 _continue_: Default::default(),
2783 _delegate: Default::default(),
2784 _additional_params: Default::default(),
2785 _scopes: Default::default(),
2786 }
2787 }
2788
2789 /// Create a builder to help you perform the following task:
2790 ///
2791 /// Get information about a route.
2792 ///
2793 /// # Arguments
2794 ///
2795 /// * `name` - The name of the route to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2796 pub fn routes_get(&self, name: &str) -> NamespaceRouteGetCall<'a, C> {
2797 NamespaceRouteGetCall {
2798 hub: self.hub,
2799 _name: name.to_string(),
2800 _delegate: Default::default(),
2801 _additional_params: Default::default(),
2802 _scopes: Default::default(),
2803 }
2804 }
2805
2806 /// Create a builder to help you perform the following task:
2807 ///
2808 /// List routes. Results are sorted by creation time, descending.
2809 ///
2810 /// # Arguments
2811 ///
2812 /// * `parent` - The namespace from which the routes should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2813 pub fn routes_list(&self, parent: &str) -> NamespaceRouteListCall<'a, C> {
2814 NamespaceRouteListCall {
2815 hub: self.hub,
2816 _parent: parent.to_string(),
2817 _watch: Default::default(),
2818 _resource_version: Default::default(),
2819 _limit: Default::default(),
2820 _label_selector: Default::default(),
2821 _include_uninitialized: Default::default(),
2822 _field_selector: Default::default(),
2823 _continue_: Default::default(),
2824 _delegate: Default::default(),
2825 _additional_params: Default::default(),
2826 _scopes: Default::default(),
2827 }
2828 }
2829
2830 /// Create a builder to help you perform the following task:
2831 ///
2832 /// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
2833 ///
2834 /// # Arguments
2835 ///
2836 /// * `request` - No description provided.
2837 /// * `parent` - Required. The resource's parent. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
2838 pub fn services_create(
2839 &self,
2840 request: Service,
2841 parent: &str,
2842 ) -> NamespaceServiceCreateCall<'a, C> {
2843 NamespaceServiceCreateCall {
2844 hub: self.hub,
2845 _request: request,
2846 _parent: parent.to_string(),
2847 _dry_run: Default::default(),
2848 _delegate: Default::default(),
2849 _additional_params: Default::default(),
2850 _scopes: Default::default(),
2851 }
2852 }
2853
2854 /// Create a builder to help you perform the following task:
2855 ///
2856 /// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
2857 ///
2858 /// # Arguments
2859 ///
2860 /// * `name` - Required. The fully qualified name of the service to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
2861 pub fn services_delete(&self, name: &str) -> NamespaceServiceDeleteCall<'a, C> {
2862 NamespaceServiceDeleteCall {
2863 hub: self.hub,
2864 _name: name.to_string(),
2865 _propagation_policy: Default::default(),
2866 _kind: Default::default(),
2867 _dry_run: Default::default(),
2868 _api_version: Default::default(),
2869 _delegate: Default::default(),
2870 _additional_params: Default::default(),
2871 _scopes: Default::default(),
2872 }
2873 }
2874
2875 /// Create a builder to help you perform the following task:
2876 ///
2877 /// Gets information about a service.
2878 ///
2879 /// # Arguments
2880 ///
2881 /// * `name` - Required. The fully qualified name of the service to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
2882 pub fn services_get(&self, name: &str) -> NamespaceServiceGetCall<'a, C> {
2883 NamespaceServiceGetCall {
2884 hub: self.hub,
2885 _name: name.to_string(),
2886 _delegate: Default::default(),
2887 _additional_params: Default::default(),
2888 _scopes: Default::default(),
2889 }
2890 }
2891
2892 /// Create a builder to help you perform the following task:
2893 ///
2894 /// Lists services for the given project and region. Results are sorted by creation time, descending.
2895 ///
2896 /// # Arguments
2897 ///
2898 /// * `parent` - Required. The parent from where the resources should be listed. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
2899 pub fn services_list(&self, parent: &str) -> NamespaceServiceListCall<'a, C> {
2900 NamespaceServiceListCall {
2901 hub: self.hub,
2902 _parent: parent.to_string(),
2903 _watch: Default::default(),
2904 _resource_version: Default::default(),
2905 _limit: Default::default(),
2906 _label_selector: Default::default(),
2907 _include_uninitialized: Default::default(),
2908 _field_selector: Default::default(),
2909 _continue_: Default::default(),
2910 _delegate: Default::default(),
2911 _additional_params: Default::default(),
2912 _scopes: Default::default(),
2913 }
2914 }
2915
2916 /// Create a builder to help you perform the following task:
2917 ///
2918 /// Replaces a service. Only the spec and metadata labels and annotations are modifiable. After the Update request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
2919 ///
2920 /// # Arguments
2921 ///
2922 /// * `request` - No description provided.
2923 /// * `name` - Required. The fully qualified name of the service to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
2924 pub fn services_replace_service(
2925 &self,
2926 request: Service,
2927 name: &str,
2928 ) -> NamespaceServiceReplaceServiceCall<'a, C> {
2929 NamespaceServiceReplaceServiceCall {
2930 hub: self.hub,
2931 _request: request,
2932 _name: name.to_string(),
2933 _dry_run: Default::default(),
2934 _delegate: Default::default(),
2935 _additional_params: Default::default(),
2936 _scopes: Default::default(),
2937 }
2938 }
2939
2940 /// Create a builder to help you perform the following task:
2941 ///
2942 /// Get information about a task.
2943 ///
2944 /// # Arguments
2945 ///
2946 /// * `name` - Required. The name of the task to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2947 pub fn tasks_get(&self, name: &str) -> NamespaceTaskGetCall<'a, C> {
2948 NamespaceTaskGetCall {
2949 hub: self.hub,
2950 _name: name.to_string(),
2951 _delegate: Default::default(),
2952 _additional_params: Default::default(),
2953 _scopes: Default::default(),
2954 }
2955 }
2956
2957 /// Create a builder to help you perform the following task:
2958 ///
2959 /// List tasks.
2960 ///
2961 /// # Arguments
2962 ///
2963 /// * `parent` - Required. The namespace from which the tasks should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
2964 pub fn tasks_list(&self, parent: &str) -> NamespaceTaskListCall<'a, C> {
2965 NamespaceTaskListCall {
2966 hub: self.hub,
2967 _parent: parent.to_string(),
2968 _watch: Default::default(),
2969 _resource_version: Default::default(),
2970 _limit: Default::default(),
2971 _label_selector: Default::default(),
2972 _include_uninitialized: Default::default(),
2973 _field_selector: Default::default(),
2974 _continue_: Default::default(),
2975 _delegate: Default::default(),
2976 _additional_params: Default::default(),
2977 _scopes: Default::default(),
2978 }
2979 }
2980}
2981
2982/// A builder providing access to all methods supported on *project* resources.
2983/// It is not used directly, but through the [`CloudRun`] hub.
2984///
2985/// # Example
2986///
2987/// Instantiate a resource builder
2988///
2989/// ```test_harness,no_run
2990/// extern crate hyper;
2991/// extern crate hyper_rustls;
2992/// extern crate google_run1 as run1;
2993///
2994/// # async fn dox() {
2995/// use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2996///
2997/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2998/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2999/// secret,
3000/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3001/// ).build().await.unwrap();
3002///
3003/// let client = hyper_util::client::legacy::Client::builder(
3004/// hyper_util::rt::TokioExecutor::new()
3005/// )
3006/// .build(
3007/// hyper_rustls::HttpsConnectorBuilder::new()
3008/// .with_native_roots()
3009/// .unwrap()
3010/// .https_or_http()
3011/// .enable_http1()
3012/// .build()
3013/// );
3014/// let mut hub = CloudRun::new(client, auth);
3015/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3016/// // like `authorizeddomains_list(...)`, `locations_authorizeddomains_list(...)`, `locations_configurations_get(...)`, `locations_configurations_list(...)`, `locations_domainmappings_create(...)`, `locations_domainmappings_delete(...)`, `locations_domainmappings_get(...)`, `locations_domainmappings_list(...)`, `locations_jobs_get_iam_policy(...)`, `locations_jobs_set_iam_policy(...)`, `locations_jobs_test_iam_permissions(...)`, `locations_list(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_operations_wait(...)`, `locations_revisions_delete(...)`, `locations_revisions_get(...)`, `locations_revisions_list(...)`, `locations_routes_get(...)`, `locations_routes_list(...)`, `locations_services_create(...)`, `locations_services_delete(...)`, `locations_services_get(...)`, `locations_services_get_iam_policy(...)`, `locations_services_list(...)`, `locations_services_replace_service(...)`, `locations_services_set_iam_policy(...)` and `locations_services_test_iam_permissions(...)`
3017/// // to build up your call.
3018/// let rb = hub.projects();
3019/// # }
3020/// ```
3021pub struct ProjectMethods<'a, C>
3022where
3023 C: 'a,
3024{
3025 hub: &'a CloudRun<C>,
3026}
3027
3028impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3029
3030impl<'a, C> ProjectMethods<'a, C> {
3031 /// Create a builder to help you perform the following task:
3032 ///
3033 /// List authorized domains.
3034 ///
3035 /// # Arguments
3036 ///
3037 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
3038 pub fn authorizeddomains_list(&self, parent: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
3039 ProjectAuthorizeddomainListCall {
3040 hub: self.hub,
3041 _parent: parent.to_string(),
3042 _page_token: Default::default(),
3043 _page_size: Default::default(),
3044 _delegate: Default::default(),
3045 _additional_params: Default::default(),
3046 _scopes: Default::default(),
3047 }
3048 }
3049
3050 /// Create a builder to help you perform the following task:
3051 ///
3052 /// List authorized domains.
3053 ///
3054 /// # Arguments
3055 ///
3056 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
3057 pub fn locations_authorizeddomains_list(
3058 &self,
3059 parent: &str,
3060 ) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
3061 ProjectLocationAuthorizeddomainListCall {
3062 hub: self.hub,
3063 _parent: parent.to_string(),
3064 _page_token: Default::default(),
3065 _page_size: Default::default(),
3066 _delegate: Default::default(),
3067 _additional_params: Default::default(),
3068 _scopes: Default::default(),
3069 }
3070 }
3071
3072 /// Create a builder to help you perform the following task:
3073 ///
3074 /// Get information about a configuration.
3075 ///
3076 /// # Arguments
3077 ///
3078 /// * `name` - The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
3079 pub fn locations_configurations_get(
3080 &self,
3081 name: &str,
3082 ) -> ProjectLocationConfigurationGetCall<'a, C> {
3083 ProjectLocationConfigurationGetCall {
3084 hub: self.hub,
3085 _name: name.to_string(),
3086 _delegate: Default::default(),
3087 _additional_params: Default::default(),
3088 _scopes: Default::default(),
3089 }
3090 }
3091
3092 /// Create a builder to help you perform the following task:
3093 ///
3094 /// List configurations. Results are sorted by creation time, descending.
3095 ///
3096 /// # Arguments
3097 ///
3098 /// * `parent` - The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
3099 pub fn locations_configurations_list(
3100 &self,
3101 parent: &str,
3102 ) -> ProjectLocationConfigurationListCall<'a, C> {
3103 ProjectLocationConfigurationListCall {
3104 hub: self.hub,
3105 _parent: parent.to_string(),
3106 _watch: Default::default(),
3107 _resource_version: Default::default(),
3108 _limit: Default::default(),
3109 _label_selector: Default::default(),
3110 _include_uninitialized: Default::default(),
3111 _field_selector: Default::default(),
3112 _continue_: Default::default(),
3113 _delegate: Default::default(),
3114 _additional_params: Default::default(),
3115 _scopes: Default::default(),
3116 }
3117 }
3118
3119 /// Create a builder to help you perform the following task:
3120 ///
3121 /// Create a new domain mapping.
3122 ///
3123 /// # Arguments
3124 ///
3125 /// * `request` - No description provided.
3126 /// * `parent` - Required. The namespace in which the domain mapping should be created. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3127 pub fn locations_domainmappings_create(
3128 &self,
3129 request: DomainMapping,
3130 parent: &str,
3131 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
3132 ProjectLocationDomainmappingCreateCall {
3133 hub: self.hub,
3134 _request: request,
3135 _parent: parent.to_string(),
3136 _dry_run: Default::default(),
3137 _delegate: Default::default(),
3138 _additional_params: Default::default(),
3139 _scopes: Default::default(),
3140 }
3141 }
3142
3143 /// Create a builder to help you perform the following task:
3144 ///
3145 /// Delete a domain mapping.
3146 ///
3147 /// # Arguments
3148 ///
3149 /// * `name` - Required. The name of the domain mapping to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3150 pub fn locations_domainmappings_delete(
3151 &self,
3152 name: &str,
3153 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
3154 ProjectLocationDomainmappingDeleteCall {
3155 hub: self.hub,
3156 _name: name.to_string(),
3157 _propagation_policy: Default::default(),
3158 _kind: Default::default(),
3159 _dry_run: Default::default(),
3160 _api_version: Default::default(),
3161 _delegate: Default::default(),
3162 _additional_params: Default::default(),
3163 _scopes: Default::default(),
3164 }
3165 }
3166
3167 /// Create a builder to help you perform the following task:
3168 ///
3169 /// Get information about a domain mapping.
3170 ///
3171 /// # Arguments
3172 ///
3173 /// * `name` - Required. The name of the domain mapping to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3174 pub fn locations_domainmappings_get(
3175 &self,
3176 name: &str,
3177 ) -> ProjectLocationDomainmappingGetCall<'a, C> {
3178 ProjectLocationDomainmappingGetCall {
3179 hub: self.hub,
3180 _name: name.to_string(),
3181 _delegate: Default::default(),
3182 _additional_params: Default::default(),
3183 _scopes: Default::default(),
3184 }
3185 }
3186
3187 /// Create a builder to help you perform the following task:
3188 ///
3189 /// List all domain mappings.
3190 ///
3191 /// # Arguments
3192 ///
3193 /// * `parent` - Required. The namespace from which the domain mappings should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3194 pub fn locations_domainmappings_list(
3195 &self,
3196 parent: &str,
3197 ) -> ProjectLocationDomainmappingListCall<'a, C> {
3198 ProjectLocationDomainmappingListCall {
3199 hub: self.hub,
3200 _parent: parent.to_string(),
3201 _watch: Default::default(),
3202 _resource_version: Default::default(),
3203 _limit: Default::default(),
3204 _label_selector: Default::default(),
3205 _include_uninitialized: Default::default(),
3206 _field_selector: Default::default(),
3207 _continue_: Default::default(),
3208 _delegate: Default::default(),
3209 _additional_params: Default::default(),
3210 _scopes: Default::default(),
3211 }
3212 }
3213
3214 /// Create a builder to help you perform the following task:
3215 ///
3216 /// Get the IAM Access Control policy currently in effect for the given job. This result does not include any inherited policies.
3217 ///
3218 /// # Arguments
3219 ///
3220 /// * `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.
3221 pub fn locations_jobs_get_iam_policy(
3222 &self,
3223 resource: &str,
3224 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
3225 ProjectLocationJobGetIamPolicyCall {
3226 hub: self.hub,
3227 _resource: resource.to_string(),
3228 _options_requested_policy_version: Default::default(),
3229 _delegate: Default::default(),
3230 _additional_params: Default::default(),
3231 _scopes: Default::default(),
3232 }
3233 }
3234
3235 /// Create a builder to help you perform the following task:
3236 ///
3237 /// Sets the IAM Access control policy for the specified job. Overwrites any existing policy.
3238 ///
3239 /// # Arguments
3240 ///
3241 /// * `request` - No description provided.
3242 /// * `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.
3243 pub fn locations_jobs_set_iam_policy(
3244 &self,
3245 request: SetIamPolicyRequest,
3246 resource: &str,
3247 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
3248 ProjectLocationJobSetIamPolicyCall {
3249 hub: self.hub,
3250 _request: request,
3251 _resource: resource.to_string(),
3252 _delegate: Default::default(),
3253 _additional_params: Default::default(),
3254 _scopes: Default::default(),
3255 }
3256 }
3257
3258 /// Create a builder to help you perform the following task:
3259 ///
3260 /// Returns permissions that a caller has on the specified job. There are no permissions required for making this API call.
3261 ///
3262 /// # Arguments
3263 ///
3264 /// * `request` - No description provided.
3265 /// * `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.
3266 pub fn locations_jobs_test_iam_permissions(
3267 &self,
3268 request: TestIamPermissionsRequest,
3269 resource: &str,
3270 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
3271 ProjectLocationJobTestIamPermissionCall {
3272 hub: self.hub,
3273 _request: request,
3274 _resource: resource.to_string(),
3275 _delegate: Default::default(),
3276 _additional_params: Default::default(),
3277 _scopes: Default::default(),
3278 }
3279 }
3280
3281 /// Create a builder to help you perform the following task:
3282 ///
3283 /// 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`.
3284 ///
3285 /// # Arguments
3286 ///
3287 /// * `name` - The name of the operation resource to be deleted.
3288 pub fn locations_operations_delete(
3289 &self,
3290 name: &str,
3291 ) -> ProjectLocationOperationDeleteCall<'a, C> {
3292 ProjectLocationOperationDeleteCall {
3293 hub: self.hub,
3294 _name: name.to_string(),
3295 _delegate: Default::default(),
3296 _additional_params: Default::default(),
3297 _scopes: Default::default(),
3298 }
3299 }
3300
3301 /// Create a builder to help you perform the following task:
3302 ///
3303 /// 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.
3304 ///
3305 /// # Arguments
3306 ///
3307 /// * `name` - The name of the operation resource.
3308 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3309 ProjectLocationOperationGetCall {
3310 hub: self.hub,
3311 _name: name.to_string(),
3312 _delegate: Default::default(),
3313 _additional_params: Default::default(),
3314 _scopes: Default::default(),
3315 }
3316 }
3317
3318 /// Create a builder to help you perform the following task:
3319 ///
3320 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3321 ///
3322 /// # Arguments
3323 ///
3324 /// * `name` - Required. To query for all of the operations for a project.
3325 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3326 ProjectLocationOperationListCall {
3327 hub: self.hub,
3328 _name: name.to_string(),
3329 _page_token: Default::default(),
3330 _page_size: Default::default(),
3331 _filter: Default::default(),
3332 _delegate: Default::default(),
3333 _additional_params: Default::default(),
3334 _scopes: Default::default(),
3335 }
3336 }
3337
3338 /// Create a builder to help you perform the following task:
3339 ///
3340 /// 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.
3341 ///
3342 /// # Arguments
3343 ///
3344 /// * `request` - No description provided.
3345 /// * `name` - The name of the operation resource to wait on.
3346 pub fn locations_operations_wait(
3347 &self,
3348 request: GoogleLongrunningWaitOperationRequest,
3349 name: &str,
3350 ) -> ProjectLocationOperationWaitCall<'a, C> {
3351 ProjectLocationOperationWaitCall {
3352 hub: self.hub,
3353 _request: request,
3354 _name: name.to_string(),
3355 _delegate: Default::default(),
3356 _additional_params: Default::default(),
3357 _scopes: Default::default(),
3358 }
3359 }
3360
3361 /// Create a builder to help you perform the following task:
3362 ///
3363 /// Delete a revision.
3364 ///
3365 /// # Arguments
3366 ///
3367 /// * `name` - The name of the revision to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3368 pub fn locations_revisions_delete(
3369 &self,
3370 name: &str,
3371 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
3372 ProjectLocationRevisionDeleteCall {
3373 hub: self.hub,
3374 _name: name.to_string(),
3375 _propagation_policy: Default::default(),
3376 _kind: Default::default(),
3377 _dry_run: Default::default(),
3378 _api_version: Default::default(),
3379 _delegate: Default::default(),
3380 _additional_params: Default::default(),
3381 _scopes: Default::default(),
3382 }
3383 }
3384
3385 /// Create a builder to help you perform the following task:
3386 ///
3387 /// Get information about a revision.
3388 ///
3389 /// # Arguments
3390 ///
3391 /// * `name` - The name of the revision to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3392 pub fn locations_revisions_get(&self, name: &str) -> ProjectLocationRevisionGetCall<'a, C> {
3393 ProjectLocationRevisionGetCall {
3394 hub: self.hub,
3395 _name: name.to_string(),
3396 _delegate: Default::default(),
3397 _additional_params: Default::default(),
3398 _scopes: Default::default(),
3399 }
3400 }
3401
3402 /// Create a builder to help you perform the following task:
3403 ///
3404 /// List revisions. Results are sorted by creation time, descending.
3405 ///
3406 /// # Arguments
3407 ///
3408 /// * `parent` - The namespace from which the revisions should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3409 pub fn locations_revisions_list(&self, parent: &str) -> ProjectLocationRevisionListCall<'a, C> {
3410 ProjectLocationRevisionListCall {
3411 hub: self.hub,
3412 _parent: parent.to_string(),
3413 _watch: Default::default(),
3414 _resource_version: Default::default(),
3415 _limit: Default::default(),
3416 _label_selector: Default::default(),
3417 _include_uninitialized: Default::default(),
3418 _field_selector: Default::default(),
3419 _continue_: Default::default(),
3420 _delegate: Default::default(),
3421 _additional_params: Default::default(),
3422 _scopes: Default::default(),
3423 }
3424 }
3425
3426 /// Create a builder to help you perform the following task:
3427 ///
3428 /// Get information about a route.
3429 ///
3430 /// # Arguments
3431 ///
3432 /// * `name` - The name of the route to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3433 pub fn locations_routes_get(&self, name: &str) -> ProjectLocationRouteGetCall<'a, C> {
3434 ProjectLocationRouteGetCall {
3435 hub: self.hub,
3436 _name: name.to_string(),
3437 _delegate: Default::default(),
3438 _additional_params: Default::default(),
3439 _scopes: Default::default(),
3440 }
3441 }
3442
3443 /// Create a builder to help you perform the following task:
3444 ///
3445 /// List routes. Results are sorted by creation time, descending.
3446 ///
3447 /// # Arguments
3448 ///
3449 /// * `parent` - The namespace from which the routes should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
3450 pub fn locations_routes_list(&self, parent: &str) -> ProjectLocationRouteListCall<'a, C> {
3451 ProjectLocationRouteListCall {
3452 hub: self.hub,
3453 _parent: parent.to_string(),
3454 _watch: Default::default(),
3455 _resource_version: Default::default(),
3456 _limit: Default::default(),
3457 _label_selector: Default::default(),
3458 _include_uninitialized: Default::default(),
3459 _field_selector: Default::default(),
3460 _continue_: Default::default(),
3461 _delegate: Default::default(),
3462 _additional_params: Default::default(),
3463 _scopes: Default::default(),
3464 }
3465 }
3466
3467 /// Create a builder to help you perform the following task:
3468 ///
3469 /// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
3470 ///
3471 /// # Arguments
3472 ///
3473 /// * `request` - No description provided.
3474 /// * `parent` - Required. The resource's parent. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
3475 pub fn locations_services_create(
3476 &self,
3477 request: Service,
3478 parent: &str,
3479 ) -> ProjectLocationServiceCreateCall<'a, C> {
3480 ProjectLocationServiceCreateCall {
3481 hub: self.hub,
3482 _request: request,
3483 _parent: parent.to_string(),
3484 _dry_run: Default::default(),
3485 _delegate: Default::default(),
3486 _additional_params: Default::default(),
3487 _scopes: Default::default(),
3488 }
3489 }
3490
3491 /// Create a builder to help you perform the following task:
3492 ///
3493 /// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
3494 ///
3495 /// # Arguments
3496 ///
3497 /// * `name` - Required. The fully qualified name of the service to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
3498 pub fn locations_services_delete(&self, name: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
3499 ProjectLocationServiceDeleteCall {
3500 hub: self.hub,
3501 _name: name.to_string(),
3502 _propagation_policy: Default::default(),
3503 _kind: Default::default(),
3504 _dry_run: Default::default(),
3505 _api_version: Default::default(),
3506 _delegate: Default::default(),
3507 _additional_params: Default::default(),
3508 _scopes: Default::default(),
3509 }
3510 }
3511
3512 /// Create a builder to help you perform the following task:
3513 ///
3514 /// Gets information about a service.
3515 ///
3516 /// # Arguments
3517 ///
3518 /// * `name` - Required. The fully qualified name of the service to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
3519 pub fn locations_services_get(&self, name: &str) -> ProjectLocationServiceGetCall<'a, C> {
3520 ProjectLocationServiceGetCall {
3521 hub: self.hub,
3522 _name: name.to_string(),
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 /// Gets the IAM Access Control policy currently in effect for the given Cloud Run service. This result does not include any inherited policies.
3532 ///
3533 /// # Arguments
3534 ///
3535 /// * `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.
3536 pub fn locations_services_get_iam_policy(
3537 &self,
3538 resource: &str,
3539 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
3540 ProjectLocationServiceGetIamPolicyCall {
3541 hub: self.hub,
3542 _resource: resource.to_string(),
3543 _options_requested_policy_version: Default::default(),
3544 _delegate: Default::default(),
3545 _additional_params: Default::default(),
3546 _scopes: Default::default(),
3547 }
3548 }
3549
3550 /// Create a builder to help you perform the following task:
3551 ///
3552 /// Lists services for the given project and region. Results are sorted by creation time, descending.
3553 ///
3554 /// # Arguments
3555 ///
3556 /// * `parent` - Required. The parent from where the resources should be listed. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
3557 pub fn locations_services_list(&self, parent: &str) -> ProjectLocationServiceListCall<'a, C> {
3558 ProjectLocationServiceListCall {
3559 hub: self.hub,
3560 _parent: parent.to_string(),
3561 _watch: Default::default(),
3562 _resource_version: Default::default(),
3563 _limit: Default::default(),
3564 _label_selector: Default::default(),
3565 _include_uninitialized: Default::default(),
3566 _field_selector: Default::default(),
3567 _continue_: Default::default(),
3568 _delegate: Default::default(),
3569 _additional_params: Default::default(),
3570 _scopes: Default::default(),
3571 }
3572 }
3573
3574 /// Create a builder to help you perform the following task:
3575 ///
3576 /// Replaces a service. Only the spec and metadata labels and annotations are modifiable. After the Update request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
3577 ///
3578 /// # Arguments
3579 ///
3580 /// * `request` - No description provided.
3581 /// * `name` - Required. The fully qualified name of the service to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
3582 pub fn locations_services_replace_service(
3583 &self,
3584 request: Service,
3585 name: &str,
3586 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
3587 ProjectLocationServiceReplaceServiceCall {
3588 hub: self.hub,
3589 _request: request,
3590 _name: name.to_string(),
3591 _dry_run: Default::default(),
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 /// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
3601 ///
3602 /// # Arguments
3603 ///
3604 /// * `request` - No description provided.
3605 /// * `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.
3606 pub fn locations_services_set_iam_policy(
3607 &self,
3608 request: SetIamPolicyRequest,
3609 resource: &str,
3610 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
3611 ProjectLocationServiceSetIamPolicyCall {
3612 hub: self.hub,
3613 _request: request,
3614 _resource: resource.to_string(),
3615 _delegate: Default::default(),
3616 _additional_params: Default::default(),
3617 _scopes: Default::default(),
3618 }
3619 }
3620
3621 /// Create a builder to help you perform the following task:
3622 ///
3623 /// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
3624 ///
3625 /// # Arguments
3626 ///
3627 /// * `request` - No description provided.
3628 /// * `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.
3629 pub fn locations_services_test_iam_permissions(
3630 &self,
3631 request: TestIamPermissionsRequest,
3632 resource: &str,
3633 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
3634 ProjectLocationServiceTestIamPermissionCall {
3635 hub: self.hub,
3636 _request: request,
3637 _resource: resource.to_string(),
3638 _delegate: Default::default(),
3639 _additional_params: Default::default(),
3640 _scopes: Default::default(),
3641 }
3642 }
3643
3644 /// Create a builder to help you perform the following task:
3645 ///
3646 /// Lists information about the supported locations for this service.
3647 ///
3648 /// # Arguments
3649 ///
3650 /// * `name` - The resource that owns the locations collection, if applicable.
3651 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
3652 ProjectLocationListCall {
3653 hub: self.hub,
3654 _name: name.to_string(),
3655 _page_token: Default::default(),
3656 _page_size: Default::default(),
3657 _filter: Default::default(),
3658 _delegate: Default::default(),
3659 _additional_params: Default::default(),
3660 _scopes: Default::default(),
3661 }
3662 }
3663}
3664
3665// ###################
3666// CallBuilders ###
3667// #################
3668
3669/// List authorized domains.
3670///
3671/// A builder for the *authorizeddomains.list* method supported by a *namespace* resource.
3672/// It is not used directly, but through a [`NamespaceMethods`] instance.
3673///
3674/// # Example
3675///
3676/// Instantiate a resource method builder
3677///
3678/// ```test_harness,no_run
3679/// # extern crate hyper;
3680/// # extern crate hyper_rustls;
3681/// # extern crate google_run1 as run1;
3682/// # async fn dox() {
3683/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3684///
3685/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3686/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3687/// # secret,
3688/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3689/// # ).build().await.unwrap();
3690///
3691/// # let client = hyper_util::client::legacy::Client::builder(
3692/// # hyper_util::rt::TokioExecutor::new()
3693/// # )
3694/// # .build(
3695/// # hyper_rustls::HttpsConnectorBuilder::new()
3696/// # .with_native_roots()
3697/// # .unwrap()
3698/// # .https_or_http()
3699/// # .enable_http1()
3700/// # .build()
3701/// # );
3702/// # let mut hub = CloudRun::new(client, auth);
3703/// // You can configure optional parameters by calling the respective setters at will, and
3704/// // execute the final call using `doit()`.
3705/// // Values shown here are possibly random and not representative !
3706/// let result = hub.namespaces().authorizeddomains_list("parent")
3707/// .page_token("eos")
3708/// .page_size(-4)
3709/// .doit().await;
3710/// # }
3711/// ```
3712pub struct NamespaceAuthorizeddomainListCall<'a, C>
3713where
3714 C: 'a,
3715{
3716 hub: &'a CloudRun<C>,
3717 _parent: String,
3718 _page_token: Option<String>,
3719 _page_size: Option<i32>,
3720 _delegate: Option<&'a mut dyn common::Delegate>,
3721 _additional_params: HashMap<String, String>,
3722 _scopes: BTreeSet<String>,
3723}
3724
3725impl<'a, C> common::CallBuilder for NamespaceAuthorizeddomainListCall<'a, C> {}
3726
3727impl<'a, C> NamespaceAuthorizeddomainListCall<'a, C>
3728where
3729 C: common::Connector,
3730{
3731 /// Perform the operation you have build so far.
3732 pub async fn doit(
3733 mut self,
3734 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
3735 use std::borrow::Cow;
3736 use std::io::{Read, Seek};
3737
3738 use common::{url::Params, ToParts};
3739 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3740
3741 let mut dd = common::DefaultDelegate;
3742 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3743 dlg.begin(common::MethodInfo {
3744 id: "run.namespaces.authorizeddomains.list",
3745 http_method: hyper::Method::GET,
3746 });
3747
3748 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3749 if self._additional_params.contains_key(field) {
3750 dlg.finished(false);
3751 return Err(common::Error::FieldClash(field));
3752 }
3753 }
3754
3755 let mut params = Params::with_capacity(5 + self._additional_params.len());
3756 params.push("parent", self._parent);
3757 if let Some(value) = self._page_token.as_ref() {
3758 params.push("pageToken", value);
3759 }
3760 if let Some(value) = self._page_size.as_ref() {
3761 params.push("pageSize", value.to_string());
3762 }
3763
3764 params.extend(self._additional_params.iter());
3765
3766 params.push("alt", "json");
3767 let mut url =
3768 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/authorizeddomains";
3769 if self._scopes.is_empty() {
3770 self._scopes
3771 .insert(Scope::CloudPlatform.as_ref().to_string());
3772 }
3773
3774 #[allow(clippy::single_element_loop)]
3775 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3776 url = params.uri_replacement(url, param_name, find_this, true);
3777 }
3778 {
3779 let to_remove = ["parent"];
3780 params.remove_params(&to_remove);
3781 }
3782
3783 let url = params.parse_with_url(&url);
3784
3785 loop {
3786 let token = match self
3787 .hub
3788 .auth
3789 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3790 .await
3791 {
3792 Ok(token) => token,
3793 Err(e) => match dlg.token(e) {
3794 Ok(token) => token,
3795 Err(e) => {
3796 dlg.finished(false);
3797 return Err(common::Error::MissingToken(e));
3798 }
3799 },
3800 };
3801 let mut req_result = {
3802 let client = &self.hub.client;
3803 dlg.pre_request();
3804 let mut req_builder = hyper::Request::builder()
3805 .method(hyper::Method::GET)
3806 .uri(url.as_str())
3807 .header(USER_AGENT, self.hub._user_agent.clone());
3808
3809 if let Some(token) = token.as_ref() {
3810 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3811 }
3812
3813 let request = req_builder
3814 .header(CONTENT_LENGTH, 0_u64)
3815 .body(common::to_body::<String>(None));
3816
3817 client.request(request.unwrap()).await
3818 };
3819
3820 match req_result {
3821 Err(err) => {
3822 if let common::Retry::After(d) = dlg.http_error(&err) {
3823 sleep(d).await;
3824 continue;
3825 }
3826 dlg.finished(false);
3827 return Err(common::Error::HttpError(err));
3828 }
3829 Ok(res) => {
3830 let (mut parts, body) = res.into_parts();
3831 let mut body = common::Body::new(body);
3832 if !parts.status.is_success() {
3833 let bytes = common::to_bytes(body).await.unwrap_or_default();
3834 let error = serde_json::from_str(&common::to_string(&bytes));
3835 let response = common::to_response(parts, bytes.into());
3836
3837 if let common::Retry::After(d) =
3838 dlg.http_failure(&response, error.as_ref().ok())
3839 {
3840 sleep(d).await;
3841 continue;
3842 }
3843
3844 dlg.finished(false);
3845
3846 return Err(match error {
3847 Ok(value) => common::Error::BadRequest(value),
3848 _ => common::Error::Failure(response),
3849 });
3850 }
3851 let response = {
3852 let bytes = common::to_bytes(body).await.unwrap_or_default();
3853 let encoded = common::to_string(&bytes);
3854 match serde_json::from_str(&encoded) {
3855 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3856 Err(error) => {
3857 dlg.response_json_decode_error(&encoded, &error);
3858 return Err(common::Error::JsonDecodeError(
3859 encoded.to_string(),
3860 error,
3861 ));
3862 }
3863 }
3864 };
3865
3866 dlg.finished(true);
3867 return Ok(response);
3868 }
3869 }
3870 }
3871 }
3872
3873 /// Name of the parent Project resource. Example: `projects/myproject`.
3874 ///
3875 /// Sets the *parent* path property to the given value.
3876 ///
3877 /// Even though the property as already been set when instantiating this call,
3878 /// we provide this method for API completeness.
3879 pub fn parent(mut self, new_value: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
3880 self._parent = new_value.to_string();
3881 self
3882 }
3883 /// Continuation token for fetching the next page of results.
3884 ///
3885 /// Sets the *page token* query property to the given value.
3886 pub fn page_token(mut self, new_value: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
3887 self._page_token = Some(new_value.to_string());
3888 self
3889 }
3890 /// Maximum results to return per page.
3891 ///
3892 /// Sets the *page size* query property to the given value.
3893 pub fn page_size(mut self, new_value: i32) -> NamespaceAuthorizeddomainListCall<'a, C> {
3894 self._page_size = Some(new_value);
3895 self
3896 }
3897 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3898 /// while executing the actual API request.
3899 ///
3900 /// ````text
3901 /// It should be used to handle progress information, and to implement a certain level of resilience.
3902 /// ````
3903 ///
3904 /// Sets the *delegate* property to the given value.
3905 pub fn delegate(
3906 mut self,
3907 new_value: &'a mut dyn common::Delegate,
3908 ) -> NamespaceAuthorizeddomainListCall<'a, C> {
3909 self._delegate = Some(new_value);
3910 self
3911 }
3912
3913 /// Set any additional parameter of the query string used in the request.
3914 /// It should be used to set parameters which are not yet available through their own
3915 /// setters.
3916 ///
3917 /// Please note that this method must not be used to set any of the known parameters
3918 /// which have their own setter method. If done anyway, the request will fail.
3919 ///
3920 /// # Additional Parameters
3921 ///
3922 /// * *$.xgafv* (query-string) - V1 error format.
3923 /// * *access_token* (query-string) - OAuth access token.
3924 /// * *alt* (query-string) - Data format for response.
3925 /// * *callback* (query-string) - JSONP
3926 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3927 /// * *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.
3928 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3929 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3930 /// * *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.
3931 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3932 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3933 pub fn param<T>(mut self, name: T, value: T) -> NamespaceAuthorizeddomainListCall<'a, C>
3934 where
3935 T: AsRef<str>,
3936 {
3937 self._additional_params
3938 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3939 self
3940 }
3941
3942 /// Identifies the authorization scope for the method you are building.
3943 ///
3944 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3945 /// [`Scope::CloudPlatform`].
3946 ///
3947 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3948 /// tokens for more than one scope.
3949 ///
3950 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3951 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3952 /// sufficient, a read-write scope will do as well.
3953 pub fn add_scope<St>(mut self, scope: St) -> NamespaceAuthorizeddomainListCall<'a, C>
3954 where
3955 St: AsRef<str>,
3956 {
3957 self._scopes.insert(String::from(scope.as_ref()));
3958 self
3959 }
3960 /// Identifies the authorization scope(s) for the method you are building.
3961 ///
3962 /// See [`Self::add_scope()`] for details.
3963 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceAuthorizeddomainListCall<'a, C>
3964 where
3965 I: IntoIterator<Item = St>,
3966 St: AsRef<str>,
3967 {
3968 self._scopes
3969 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3970 self
3971 }
3972
3973 /// Removes all scopes, and no default scope will be used either.
3974 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3975 /// for details).
3976 pub fn clear_scopes(mut self) -> NamespaceAuthorizeddomainListCall<'a, C> {
3977 self._scopes.clear();
3978 self
3979 }
3980}
3981
3982/// Get information about a configuration.
3983///
3984/// A builder for the *configurations.get* method supported by a *namespace* resource.
3985/// It is not used directly, but through a [`NamespaceMethods`] instance.
3986///
3987/// # Example
3988///
3989/// Instantiate a resource method builder
3990///
3991/// ```test_harness,no_run
3992/// # extern crate hyper;
3993/// # extern crate hyper_rustls;
3994/// # extern crate google_run1 as run1;
3995/// # async fn dox() {
3996/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3997///
3998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4000/// # secret,
4001/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4002/// # ).build().await.unwrap();
4003///
4004/// # let client = hyper_util::client::legacy::Client::builder(
4005/// # hyper_util::rt::TokioExecutor::new()
4006/// # )
4007/// # .build(
4008/// # hyper_rustls::HttpsConnectorBuilder::new()
4009/// # .with_native_roots()
4010/// # .unwrap()
4011/// # .https_or_http()
4012/// # .enable_http1()
4013/// # .build()
4014/// # );
4015/// # let mut hub = CloudRun::new(client, auth);
4016/// // You can configure optional parameters by calling the respective setters at will, and
4017/// // execute the final call using `doit()`.
4018/// // Values shown here are possibly random and not representative !
4019/// let result = hub.namespaces().configurations_get("name")
4020/// .doit().await;
4021/// # }
4022/// ```
4023pub struct NamespaceConfigurationGetCall<'a, C>
4024where
4025 C: 'a,
4026{
4027 hub: &'a CloudRun<C>,
4028 _name: String,
4029 _delegate: Option<&'a mut dyn common::Delegate>,
4030 _additional_params: HashMap<String, String>,
4031 _scopes: BTreeSet<String>,
4032}
4033
4034impl<'a, C> common::CallBuilder for NamespaceConfigurationGetCall<'a, C> {}
4035
4036impl<'a, C> NamespaceConfigurationGetCall<'a, C>
4037where
4038 C: common::Connector,
4039{
4040 /// Perform the operation you have build so far.
4041 pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
4042 use std::borrow::Cow;
4043 use std::io::{Read, Seek};
4044
4045 use common::{url::Params, ToParts};
4046 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4047
4048 let mut dd = common::DefaultDelegate;
4049 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4050 dlg.begin(common::MethodInfo {
4051 id: "run.namespaces.configurations.get",
4052 http_method: hyper::Method::GET,
4053 });
4054
4055 for &field in ["alt", "name"].iter() {
4056 if self._additional_params.contains_key(field) {
4057 dlg.finished(false);
4058 return Err(common::Error::FieldClash(field));
4059 }
4060 }
4061
4062 let mut params = Params::with_capacity(3 + self._additional_params.len());
4063 params.push("name", self._name);
4064
4065 params.extend(self._additional_params.iter());
4066
4067 params.push("alt", "json");
4068 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
4069 if self._scopes.is_empty() {
4070 self._scopes
4071 .insert(Scope::CloudPlatform.as_ref().to_string());
4072 }
4073
4074 #[allow(clippy::single_element_loop)]
4075 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4076 url = params.uri_replacement(url, param_name, find_this, true);
4077 }
4078 {
4079 let to_remove = ["name"];
4080 params.remove_params(&to_remove);
4081 }
4082
4083 let url = params.parse_with_url(&url);
4084
4085 loop {
4086 let token = match self
4087 .hub
4088 .auth
4089 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4090 .await
4091 {
4092 Ok(token) => token,
4093 Err(e) => match dlg.token(e) {
4094 Ok(token) => token,
4095 Err(e) => {
4096 dlg.finished(false);
4097 return Err(common::Error::MissingToken(e));
4098 }
4099 },
4100 };
4101 let mut req_result = {
4102 let client = &self.hub.client;
4103 dlg.pre_request();
4104 let mut req_builder = hyper::Request::builder()
4105 .method(hyper::Method::GET)
4106 .uri(url.as_str())
4107 .header(USER_AGENT, self.hub._user_agent.clone());
4108
4109 if let Some(token) = token.as_ref() {
4110 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4111 }
4112
4113 let request = req_builder
4114 .header(CONTENT_LENGTH, 0_u64)
4115 .body(common::to_body::<String>(None));
4116
4117 client.request(request.unwrap()).await
4118 };
4119
4120 match req_result {
4121 Err(err) => {
4122 if let common::Retry::After(d) = dlg.http_error(&err) {
4123 sleep(d).await;
4124 continue;
4125 }
4126 dlg.finished(false);
4127 return Err(common::Error::HttpError(err));
4128 }
4129 Ok(res) => {
4130 let (mut parts, body) = res.into_parts();
4131 let mut body = common::Body::new(body);
4132 if !parts.status.is_success() {
4133 let bytes = common::to_bytes(body).await.unwrap_or_default();
4134 let error = serde_json::from_str(&common::to_string(&bytes));
4135 let response = common::to_response(parts, bytes.into());
4136
4137 if let common::Retry::After(d) =
4138 dlg.http_failure(&response, error.as_ref().ok())
4139 {
4140 sleep(d).await;
4141 continue;
4142 }
4143
4144 dlg.finished(false);
4145
4146 return Err(match error {
4147 Ok(value) => common::Error::BadRequest(value),
4148 _ => common::Error::Failure(response),
4149 });
4150 }
4151 let response = {
4152 let bytes = common::to_bytes(body).await.unwrap_or_default();
4153 let encoded = common::to_string(&bytes);
4154 match serde_json::from_str(&encoded) {
4155 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4156 Err(error) => {
4157 dlg.response_json_decode_error(&encoded, &error);
4158 return Err(common::Error::JsonDecodeError(
4159 encoded.to_string(),
4160 error,
4161 ));
4162 }
4163 }
4164 };
4165
4166 dlg.finished(true);
4167 return Ok(response);
4168 }
4169 }
4170 }
4171 }
4172
4173 /// The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
4174 ///
4175 /// Sets the *name* path property to the given value.
4176 ///
4177 /// Even though the property as already been set when instantiating this call,
4178 /// we provide this method for API completeness.
4179 pub fn name(mut self, new_value: &str) -> NamespaceConfigurationGetCall<'a, C> {
4180 self._name = new_value.to_string();
4181 self
4182 }
4183 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4184 /// while executing the actual API request.
4185 ///
4186 /// ````text
4187 /// It should be used to handle progress information, and to implement a certain level of resilience.
4188 /// ````
4189 ///
4190 /// Sets the *delegate* property to the given value.
4191 pub fn delegate(
4192 mut self,
4193 new_value: &'a mut dyn common::Delegate,
4194 ) -> NamespaceConfigurationGetCall<'a, C> {
4195 self._delegate = Some(new_value);
4196 self
4197 }
4198
4199 /// Set any additional parameter of the query string used in the request.
4200 /// It should be used to set parameters which are not yet available through their own
4201 /// setters.
4202 ///
4203 /// Please note that this method must not be used to set any of the known parameters
4204 /// which have their own setter method. If done anyway, the request will fail.
4205 ///
4206 /// # Additional Parameters
4207 ///
4208 /// * *$.xgafv* (query-string) - V1 error format.
4209 /// * *access_token* (query-string) - OAuth access token.
4210 /// * *alt* (query-string) - Data format for response.
4211 /// * *callback* (query-string) - JSONP
4212 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4213 /// * *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.
4214 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4215 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4216 /// * *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.
4217 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4218 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4219 pub fn param<T>(mut self, name: T, value: T) -> NamespaceConfigurationGetCall<'a, C>
4220 where
4221 T: AsRef<str>,
4222 {
4223 self._additional_params
4224 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4225 self
4226 }
4227
4228 /// Identifies the authorization scope for the method you are building.
4229 ///
4230 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4231 /// [`Scope::CloudPlatform`].
4232 ///
4233 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4234 /// tokens for more than one scope.
4235 ///
4236 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4237 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4238 /// sufficient, a read-write scope will do as well.
4239 pub fn add_scope<St>(mut self, scope: St) -> NamespaceConfigurationGetCall<'a, C>
4240 where
4241 St: AsRef<str>,
4242 {
4243 self._scopes.insert(String::from(scope.as_ref()));
4244 self
4245 }
4246 /// Identifies the authorization scope(s) for the method you are building.
4247 ///
4248 /// See [`Self::add_scope()`] for details.
4249 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceConfigurationGetCall<'a, C>
4250 where
4251 I: IntoIterator<Item = St>,
4252 St: AsRef<str>,
4253 {
4254 self._scopes
4255 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4256 self
4257 }
4258
4259 /// Removes all scopes, and no default scope will be used either.
4260 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4261 /// for details).
4262 pub fn clear_scopes(mut self) -> NamespaceConfigurationGetCall<'a, C> {
4263 self._scopes.clear();
4264 self
4265 }
4266}
4267
4268/// List configurations. Results are sorted by creation time, descending.
4269///
4270/// A builder for the *configurations.list* method supported by a *namespace* resource.
4271/// It is not used directly, but through a [`NamespaceMethods`] instance.
4272///
4273/// # Example
4274///
4275/// Instantiate a resource method builder
4276///
4277/// ```test_harness,no_run
4278/// # extern crate hyper;
4279/// # extern crate hyper_rustls;
4280/// # extern crate google_run1 as run1;
4281/// # async fn dox() {
4282/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4283///
4284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4285/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4286/// # secret,
4287/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4288/// # ).build().await.unwrap();
4289///
4290/// # let client = hyper_util::client::legacy::Client::builder(
4291/// # hyper_util::rt::TokioExecutor::new()
4292/// # )
4293/// # .build(
4294/// # hyper_rustls::HttpsConnectorBuilder::new()
4295/// # .with_native_roots()
4296/// # .unwrap()
4297/// # .https_or_http()
4298/// # .enable_http1()
4299/// # .build()
4300/// # );
4301/// # let mut hub = CloudRun::new(client, auth);
4302/// // You can configure optional parameters by calling the respective setters at will, and
4303/// // execute the final call using `doit()`.
4304/// // Values shown here are possibly random and not representative !
4305/// let result = hub.namespaces().configurations_list("parent")
4306/// .watch(false)
4307/// .resource_version("amet")
4308/// .limit(-20)
4309/// .label_selector("ipsum")
4310/// .include_uninitialized(false)
4311/// .field_selector("ut")
4312/// .continue_("gubergren")
4313/// .doit().await;
4314/// # }
4315/// ```
4316pub struct NamespaceConfigurationListCall<'a, C>
4317where
4318 C: 'a,
4319{
4320 hub: &'a CloudRun<C>,
4321 _parent: String,
4322 _watch: Option<bool>,
4323 _resource_version: Option<String>,
4324 _limit: Option<i32>,
4325 _label_selector: Option<String>,
4326 _include_uninitialized: Option<bool>,
4327 _field_selector: Option<String>,
4328 _continue_: Option<String>,
4329 _delegate: Option<&'a mut dyn common::Delegate>,
4330 _additional_params: HashMap<String, String>,
4331 _scopes: BTreeSet<String>,
4332}
4333
4334impl<'a, C> common::CallBuilder for NamespaceConfigurationListCall<'a, C> {}
4335
4336impl<'a, C> NamespaceConfigurationListCall<'a, C>
4337where
4338 C: common::Connector,
4339{
4340 /// Perform the operation you have build so far.
4341 pub async fn doit(mut self) -> common::Result<(common::Response, ListConfigurationsResponse)> {
4342 use std::borrow::Cow;
4343 use std::io::{Read, Seek};
4344
4345 use common::{url::Params, ToParts};
4346 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4347
4348 let mut dd = common::DefaultDelegate;
4349 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4350 dlg.begin(common::MethodInfo {
4351 id: "run.namespaces.configurations.list",
4352 http_method: hyper::Method::GET,
4353 });
4354
4355 for &field in [
4356 "alt",
4357 "parent",
4358 "watch",
4359 "resourceVersion",
4360 "limit",
4361 "labelSelector",
4362 "includeUninitialized",
4363 "fieldSelector",
4364 "continue",
4365 ]
4366 .iter()
4367 {
4368 if self._additional_params.contains_key(field) {
4369 dlg.finished(false);
4370 return Err(common::Error::FieldClash(field));
4371 }
4372 }
4373
4374 let mut params = Params::with_capacity(10 + self._additional_params.len());
4375 params.push("parent", self._parent);
4376 if let Some(value) = self._watch.as_ref() {
4377 params.push("watch", value.to_string());
4378 }
4379 if let Some(value) = self._resource_version.as_ref() {
4380 params.push("resourceVersion", value);
4381 }
4382 if let Some(value) = self._limit.as_ref() {
4383 params.push("limit", value.to_string());
4384 }
4385 if let Some(value) = self._label_selector.as_ref() {
4386 params.push("labelSelector", value);
4387 }
4388 if let Some(value) = self._include_uninitialized.as_ref() {
4389 params.push("includeUninitialized", value.to_string());
4390 }
4391 if let Some(value) = self._field_selector.as_ref() {
4392 params.push("fieldSelector", value);
4393 }
4394 if let Some(value) = self._continue_.as_ref() {
4395 params.push("continue", value);
4396 }
4397
4398 params.extend(self._additional_params.iter());
4399
4400 params.push("alt", "json");
4401 let mut url =
4402 self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/configurations";
4403 if self._scopes.is_empty() {
4404 self._scopes
4405 .insert(Scope::CloudPlatform.as_ref().to_string());
4406 }
4407
4408 #[allow(clippy::single_element_loop)]
4409 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4410 url = params.uri_replacement(url, param_name, find_this, true);
4411 }
4412 {
4413 let to_remove = ["parent"];
4414 params.remove_params(&to_remove);
4415 }
4416
4417 let url = params.parse_with_url(&url);
4418
4419 loop {
4420 let token = match self
4421 .hub
4422 .auth
4423 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4424 .await
4425 {
4426 Ok(token) => token,
4427 Err(e) => match dlg.token(e) {
4428 Ok(token) => token,
4429 Err(e) => {
4430 dlg.finished(false);
4431 return Err(common::Error::MissingToken(e));
4432 }
4433 },
4434 };
4435 let mut req_result = {
4436 let client = &self.hub.client;
4437 dlg.pre_request();
4438 let mut req_builder = hyper::Request::builder()
4439 .method(hyper::Method::GET)
4440 .uri(url.as_str())
4441 .header(USER_AGENT, self.hub._user_agent.clone());
4442
4443 if let Some(token) = token.as_ref() {
4444 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4445 }
4446
4447 let request = req_builder
4448 .header(CONTENT_LENGTH, 0_u64)
4449 .body(common::to_body::<String>(None));
4450
4451 client.request(request.unwrap()).await
4452 };
4453
4454 match req_result {
4455 Err(err) => {
4456 if let common::Retry::After(d) = dlg.http_error(&err) {
4457 sleep(d).await;
4458 continue;
4459 }
4460 dlg.finished(false);
4461 return Err(common::Error::HttpError(err));
4462 }
4463 Ok(res) => {
4464 let (mut parts, body) = res.into_parts();
4465 let mut body = common::Body::new(body);
4466 if !parts.status.is_success() {
4467 let bytes = common::to_bytes(body).await.unwrap_or_default();
4468 let error = serde_json::from_str(&common::to_string(&bytes));
4469 let response = common::to_response(parts, bytes.into());
4470
4471 if let common::Retry::After(d) =
4472 dlg.http_failure(&response, error.as_ref().ok())
4473 {
4474 sleep(d).await;
4475 continue;
4476 }
4477
4478 dlg.finished(false);
4479
4480 return Err(match error {
4481 Ok(value) => common::Error::BadRequest(value),
4482 _ => common::Error::Failure(response),
4483 });
4484 }
4485 let response = {
4486 let bytes = common::to_bytes(body).await.unwrap_or_default();
4487 let encoded = common::to_string(&bytes);
4488 match serde_json::from_str(&encoded) {
4489 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4490 Err(error) => {
4491 dlg.response_json_decode_error(&encoded, &error);
4492 return Err(common::Error::JsonDecodeError(
4493 encoded.to_string(),
4494 error,
4495 ));
4496 }
4497 }
4498 };
4499
4500 dlg.finished(true);
4501 return Ok(response);
4502 }
4503 }
4504 }
4505 }
4506
4507 /// The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
4508 ///
4509 /// Sets the *parent* path property to the given value.
4510 ///
4511 /// Even though the property as already been set when instantiating this call,
4512 /// we provide this method for API completeness.
4513 pub fn parent(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4514 self._parent = new_value.to_string();
4515 self
4516 }
4517 /// Not supported by Cloud Run.
4518 ///
4519 /// Sets the *watch* query property to the given value.
4520 pub fn watch(mut self, new_value: bool) -> NamespaceConfigurationListCall<'a, C> {
4521 self._watch = Some(new_value);
4522 self
4523 }
4524 /// Not supported by Cloud Run.
4525 ///
4526 /// Sets the *resource version* query property to the given value.
4527 pub fn resource_version(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4528 self._resource_version = Some(new_value.to_string());
4529 self
4530 }
4531 /// Optional. The maximum number of the records that should be returned.
4532 ///
4533 /// Sets the *limit* query property to the given value.
4534 pub fn limit(mut self, new_value: i32) -> NamespaceConfigurationListCall<'a, C> {
4535 self._limit = Some(new_value);
4536 self
4537 }
4538 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
4539 ///
4540 /// Sets the *label selector* query property to the given value.
4541 pub fn label_selector(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4542 self._label_selector = Some(new_value.to_string());
4543 self
4544 }
4545 /// Not supported by Cloud Run.
4546 ///
4547 /// Sets the *include uninitialized* query property to the given value.
4548 pub fn include_uninitialized(
4549 mut self,
4550 new_value: bool,
4551 ) -> NamespaceConfigurationListCall<'a, C> {
4552 self._include_uninitialized = Some(new_value);
4553 self
4554 }
4555 /// Not supported by Cloud Run.
4556 ///
4557 /// Sets the *field selector* query property to the given value.
4558 pub fn field_selector(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4559 self._field_selector = Some(new_value.to_string());
4560 self
4561 }
4562 /// Optional. Encoded string to continue paging.
4563 ///
4564 /// Sets the *continue* query property to the given value.
4565 pub fn continue_(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4566 self._continue_ = Some(new_value.to_string());
4567 self
4568 }
4569 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4570 /// while executing the actual API request.
4571 ///
4572 /// ````text
4573 /// It should be used to handle progress information, and to implement a certain level of resilience.
4574 /// ````
4575 ///
4576 /// Sets the *delegate* property to the given value.
4577 pub fn delegate(
4578 mut self,
4579 new_value: &'a mut dyn common::Delegate,
4580 ) -> NamespaceConfigurationListCall<'a, C> {
4581 self._delegate = Some(new_value);
4582 self
4583 }
4584
4585 /// Set any additional parameter of the query string used in the request.
4586 /// It should be used to set parameters which are not yet available through their own
4587 /// setters.
4588 ///
4589 /// Please note that this method must not be used to set any of the known parameters
4590 /// which have their own setter method. If done anyway, the request will fail.
4591 ///
4592 /// # Additional Parameters
4593 ///
4594 /// * *$.xgafv* (query-string) - V1 error format.
4595 /// * *access_token* (query-string) - OAuth access token.
4596 /// * *alt* (query-string) - Data format for response.
4597 /// * *callback* (query-string) - JSONP
4598 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4599 /// * *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.
4600 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4601 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4602 /// * *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.
4603 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4604 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4605 pub fn param<T>(mut self, name: T, value: T) -> NamespaceConfigurationListCall<'a, C>
4606 where
4607 T: AsRef<str>,
4608 {
4609 self._additional_params
4610 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4611 self
4612 }
4613
4614 /// Identifies the authorization scope for the method you are building.
4615 ///
4616 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4617 /// [`Scope::CloudPlatform`].
4618 ///
4619 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4620 /// tokens for more than one scope.
4621 ///
4622 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4623 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4624 /// sufficient, a read-write scope will do as well.
4625 pub fn add_scope<St>(mut self, scope: St) -> NamespaceConfigurationListCall<'a, C>
4626 where
4627 St: AsRef<str>,
4628 {
4629 self._scopes.insert(String::from(scope.as_ref()));
4630 self
4631 }
4632 /// Identifies the authorization scope(s) for the method you are building.
4633 ///
4634 /// See [`Self::add_scope()`] for details.
4635 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceConfigurationListCall<'a, C>
4636 where
4637 I: IntoIterator<Item = St>,
4638 St: AsRef<str>,
4639 {
4640 self._scopes
4641 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4642 self
4643 }
4644
4645 /// Removes all scopes, and no default scope will be used either.
4646 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4647 /// for details).
4648 pub fn clear_scopes(mut self) -> NamespaceConfigurationListCall<'a, C> {
4649 self._scopes.clear();
4650 self
4651 }
4652}
4653
4654/// Create a new domain mapping.
4655///
4656/// A builder for the *domainmappings.create* method supported by a *namespace* resource.
4657/// It is not used directly, but through a [`NamespaceMethods`] instance.
4658///
4659/// # Example
4660///
4661/// Instantiate a resource method builder
4662///
4663/// ```test_harness,no_run
4664/// # extern crate hyper;
4665/// # extern crate hyper_rustls;
4666/// # extern crate google_run1 as run1;
4667/// use run1::api::DomainMapping;
4668/// # async fn dox() {
4669/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4670///
4671/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4672/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4673/// # secret,
4674/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4675/// # ).build().await.unwrap();
4676///
4677/// # let client = hyper_util::client::legacy::Client::builder(
4678/// # hyper_util::rt::TokioExecutor::new()
4679/// # )
4680/// # .build(
4681/// # hyper_rustls::HttpsConnectorBuilder::new()
4682/// # .with_native_roots()
4683/// # .unwrap()
4684/// # .https_or_http()
4685/// # .enable_http1()
4686/// # .build()
4687/// # );
4688/// # let mut hub = CloudRun::new(client, auth);
4689/// // As the method needs a request, you would usually fill it with the desired information
4690/// // into the respective structure. Some of the parts shown here might not be applicable !
4691/// // Values shown here are possibly random and not representative !
4692/// let mut req = DomainMapping::default();
4693///
4694/// // You can configure optional parameters by calling the respective setters at will, and
4695/// // execute the final call using `doit()`.
4696/// // Values shown here are possibly random and not representative !
4697/// let result = hub.namespaces().domainmappings_create(req, "parent")
4698/// .dry_run("est")
4699/// .doit().await;
4700/// # }
4701/// ```
4702pub struct NamespaceDomainmappingCreateCall<'a, C>
4703where
4704 C: 'a,
4705{
4706 hub: &'a CloudRun<C>,
4707 _request: DomainMapping,
4708 _parent: String,
4709 _dry_run: Option<String>,
4710 _delegate: Option<&'a mut dyn common::Delegate>,
4711 _additional_params: HashMap<String, String>,
4712 _scopes: BTreeSet<String>,
4713}
4714
4715impl<'a, C> common::CallBuilder for NamespaceDomainmappingCreateCall<'a, C> {}
4716
4717impl<'a, C> NamespaceDomainmappingCreateCall<'a, C>
4718where
4719 C: common::Connector,
4720{
4721 /// Perform the operation you have build so far.
4722 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
4723 use std::borrow::Cow;
4724 use std::io::{Read, Seek};
4725
4726 use common::{url::Params, ToParts};
4727 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4728
4729 let mut dd = common::DefaultDelegate;
4730 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4731 dlg.begin(common::MethodInfo {
4732 id: "run.namespaces.domainmappings.create",
4733 http_method: hyper::Method::POST,
4734 });
4735
4736 for &field in ["alt", "parent", "dryRun"].iter() {
4737 if self._additional_params.contains_key(field) {
4738 dlg.finished(false);
4739 return Err(common::Error::FieldClash(field));
4740 }
4741 }
4742
4743 let mut params = Params::with_capacity(5 + self._additional_params.len());
4744 params.push("parent", self._parent);
4745 if let Some(value) = self._dry_run.as_ref() {
4746 params.push("dryRun", value);
4747 }
4748
4749 params.extend(self._additional_params.iter());
4750
4751 params.push("alt", "json");
4752 let mut url =
4753 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/domainmappings";
4754 if self._scopes.is_empty() {
4755 self._scopes
4756 .insert(Scope::CloudPlatform.as_ref().to_string());
4757 }
4758
4759 #[allow(clippy::single_element_loop)]
4760 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4761 url = params.uri_replacement(url, param_name, find_this, true);
4762 }
4763 {
4764 let to_remove = ["parent"];
4765 params.remove_params(&to_remove);
4766 }
4767
4768 let url = params.parse_with_url(&url);
4769
4770 let mut json_mime_type = mime::APPLICATION_JSON;
4771 let mut request_value_reader = {
4772 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4773 common::remove_json_null_values(&mut value);
4774 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4775 serde_json::to_writer(&mut dst, &value).unwrap();
4776 dst
4777 };
4778 let request_size = request_value_reader
4779 .seek(std::io::SeekFrom::End(0))
4780 .unwrap();
4781 request_value_reader
4782 .seek(std::io::SeekFrom::Start(0))
4783 .unwrap();
4784
4785 loop {
4786 let token = match self
4787 .hub
4788 .auth
4789 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4790 .await
4791 {
4792 Ok(token) => token,
4793 Err(e) => match dlg.token(e) {
4794 Ok(token) => token,
4795 Err(e) => {
4796 dlg.finished(false);
4797 return Err(common::Error::MissingToken(e));
4798 }
4799 },
4800 };
4801 request_value_reader
4802 .seek(std::io::SeekFrom::Start(0))
4803 .unwrap();
4804 let mut req_result = {
4805 let client = &self.hub.client;
4806 dlg.pre_request();
4807 let mut req_builder = hyper::Request::builder()
4808 .method(hyper::Method::POST)
4809 .uri(url.as_str())
4810 .header(USER_AGENT, self.hub._user_agent.clone());
4811
4812 if let Some(token) = token.as_ref() {
4813 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4814 }
4815
4816 let request = req_builder
4817 .header(CONTENT_TYPE, json_mime_type.to_string())
4818 .header(CONTENT_LENGTH, request_size as u64)
4819 .body(common::to_body(
4820 request_value_reader.get_ref().clone().into(),
4821 ));
4822
4823 client.request(request.unwrap()).await
4824 };
4825
4826 match req_result {
4827 Err(err) => {
4828 if let common::Retry::After(d) = dlg.http_error(&err) {
4829 sleep(d).await;
4830 continue;
4831 }
4832 dlg.finished(false);
4833 return Err(common::Error::HttpError(err));
4834 }
4835 Ok(res) => {
4836 let (mut parts, body) = res.into_parts();
4837 let mut body = common::Body::new(body);
4838 if !parts.status.is_success() {
4839 let bytes = common::to_bytes(body).await.unwrap_or_default();
4840 let error = serde_json::from_str(&common::to_string(&bytes));
4841 let response = common::to_response(parts, bytes.into());
4842
4843 if let common::Retry::After(d) =
4844 dlg.http_failure(&response, error.as_ref().ok())
4845 {
4846 sleep(d).await;
4847 continue;
4848 }
4849
4850 dlg.finished(false);
4851
4852 return Err(match error {
4853 Ok(value) => common::Error::BadRequest(value),
4854 _ => common::Error::Failure(response),
4855 });
4856 }
4857 let response = {
4858 let bytes = common::to_bytes(body).await.unwrap_or_default();
4859 let encoded = common::to_string(&bytes);
4860 match serde_json::from_str(&encoded) {
4861 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4862 Err(error) => {
4863 dlg.response_json_decode_error(&encoded, &error);
4864 return Err(common::Error::JsonDecodeError(
4865 encoded.to_string(),
4866 error,
4867 ));
4868 }
4869 }
4870 };
4871
4872 dlg.finished(true);
4873 return Ok(response);
4874 }
4875 }
4876 }
4877 }
4878
4879 ///
4880 /// Sets the *request* property to the given value.
4881 ///
4882 /// Even though the property as already been set when instantiating this call,
4883 /// we provide this method for API completeness.
4884 pub fn request(mut self, new_value: DomainMapping) -> NamespaceDomainmappingCreateCall<'a, C> {
4885 self._request = new_value;
4886 self
4887 }
4888 /// Required. The namespace in which the domain mapping should be created. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
4889 ///
4890 /// Sets the *parent* path property to the given value.
4891 ///
4892 /// Even though the property as already been set when instantiating this call,
4893 /// we provide this method for API completeness.
4894 pub fn parent(mut self, new_value: &str) -> NamespaceDomainmappingCreateCall<'a, C> {
4895 self._parent = new_value.to_string();
4896 self
4897 }
4898 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
4899 ///
4900 /// Sets the *dry run* query property to the given value.
4901 pub fn dry_run(mut self, new_value: &str) -> NamespaceDomainmappingCreateCall<'a, C> {
4902 self._dry_run = Some(new_value.to_string());
4903 self
4904 }
4905 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4906 /// while executing the actual API request.
4907 ///
4908 /// ````text
4909 /// It should be used to handle progress information, and to implement a certain level of resilience.
4910 /// ````
4911 ///
4912 /// Sets the *delegate* property to the given value.
4913 pub fn delegate(
4914 mut self,
4915 new_value: &'a mut dyn common::Delegate,
4916 ) -> NamespaceDomainmappingCreateCall<'a, C> {
4917 self._delegate = Some(new_value);
4918 self
4919 }
4920
4921 /// Set any additional parameter of the query string used in the request.
4922 /// It should be used to set parameters which are not yet available through their own
4923 /// setters.
4924 ///
4925 /// Please note that this method must not be used to set any of the known parameters
4926 /// which have their own setter method. If done anyway, the request will fail.
4927 ///
4928 /// # Additional Parameters
4929 ///
4930 /// * *$.xgafv* (query-string) - V1 error format.
4931 /// * *access_token* (query-string) - OAuth access token.
4932 /// * *alt* (query-string) - Data format for response.
4933 /// * *callback* (query-string) - JSONP
4934 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4935 /// * *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.
4936 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4937 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4938 /// * *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.
4939 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4940 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4941 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingCreateCall<'a, C>
4942 where
4943 T: AsRef<str>,
4944 {
4945 self._additional_params
4946 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4947 self
4948 }
4949
4950 /// Identifies the authorization scope for the method you are building.
4951 ///
4952 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4953 /// [`Scope::CloudPlatform`].
4954 ///
4955 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4956 /// tokens for more than one scope.
4957 ///
4958 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4959 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4960 /// sufficient, a read-write scope will do as well.
4961 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingCreateCall<'a, C>
4962 where
4963 St: AsRef<str>,
4964 {
4965 self._scopes.insert(String::from(scope.as_ref()));
4966 self
4967 }
4968 /// Identifies the authorization scope(s) for the method you are building.
4969 ///
4970 /// See [`Self::add_scope()`] for details.
4971 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingCreateCall<'a, C>
4972 where
4973 I: IntoIterator<Item = St>,
4974 St: AsRef<str>,
4975 {
4976 self._scopes
4977 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4978 self
4979 }
4980
4981 /// Removes all scopes, and no default scope will be used either.
4982 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4983 /// for details).
4984 pub fn clear_scopes(mut self) -> NamespaceDomainmappingCreateCall<'a, C> {
4985 self._scopes.clear();
4986 self
4987 }
4988}
4989
4990/// Delete a domain mapping.
4991///
4992/// A builder for the *domainmappings.delete* method supported by a *namespace* resource.
4993/// It is not used directly, but through a [`NamespaceMethods`] instance.
4994///
4995/// # Example
4996///
4997/// Instantiate a resource method builder
4998///
4999/// ```test_harness,no_run
5000/// # extern crate hyper;
5001/// # extern crate hyper_rustls;
5002/// # extern crate google_run1 as run1;
5003/// # async fn dox() {
5004/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5005///
5006/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5008/// # secret,
5009/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5010/// # ).build().await.unwrap();
5011///
5012/// # let client = hyper_util::client::legacy::Client::builder(
5013/// # hyper_util::rt::TokioExecutor::new()
5014/// # )
5015/// # .build(
5016/// # hyper_rustls::HttpsConnectorBuilder::new()
5017/// # .with_native_roots()
5018/// # .unwrap()
5019/// # .https_or_http()
5020/// # .enable_http1()
5021/// # .build()
5022/// # );
5023/// # let mut hub = CloudRun::new(client, auth);
5024/// // You can configure optional parameters by calling the respective setters at will, and
5025/// // execute the final call using `doit()`.
5026/// // Values shown here are possibly random and not representative !
5027/// let result = hub.namespaces().domainmappings_delete("name")
5028/// .propagation_policy("ipsum")
5029/// .kind("est")
5030/// .dry_run("gubergren")
5031/// .api_version("ea")
5032/// .doit().await;
5033/// # }
5034/// ```
5035pub struct NamespaceDomainmappingDeleteCall<'a, C>
5036where
5037 C: 'a,
5038{
5039 hub: &'a CloudRun<C>,
5040 _name: String,
5041 _propagation_policy: Option<String>,
5042 _kind: Option<String>,
5043 _dry_run: Option<String>,
5044 _api_version: Option<String>,
5045 _delegate: Option<&'a mut dyn common::Delegate>,
5046 _additional_params: HashMap<String, String>,
5047 _scopes: BTreeSet<String>,
5048}
5049
5050impl<'a, C> common::CallBuilder for NamespaceDomainmappingDeleteCall<'a, C> {}
5051
5052impl<'a, C> NamespaceDomainmappingDeleteCall<'a, C>
5053where
5054 C: common::Connector,
5055{
5056 /// Perform the operation you have build so far.
5057 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
5058 use std::borrow::Cow;
5059 use std::io::{Read, Seek};
5060
5061 use common::{url::Params, ToParts};
5062 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5063
5064 let mut dd = common::DefaultDelegate;
5065 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5066 dlg.begin(common::MethodInfo {
5067 id: "run.namespaces.domainmappings.delete",
5068 http_method: hyper::Method::DELETE,
5069 });
5070
5071 for &field in [
5072 "alt",
5073 "name",
5074 "propagationPolicy",
5075 "kind",
5076 "dryRun",
5077 "apiVersion",
5078 ]
5079 .iter()
5080 {
5081 if self._additional_params.contains_key(field) {
5082 dlg.finished(false);
5083 return Err(common::Error::FieldClash(field));
5084 }
5085 }
5086
5087 let mut params = Params::with_capacity(7 + self._additional_params.len());
5088 params.push("name", self._name);
5089 if let Some(value) = self._propagation_policy.as_ref() {
5090 params.push("propagationPolicy", value);
5091 }
5092 if let Some(value) = self._kind.as_ref() {
5093 params.push("kind", value);
5094 }
5095 if let Some(value) = self._dry_run.as_ref() {
5096 params.push("dryRun", value);
5097 }
5098 if let Some(value) = self._api_version.as_ref() {
5099 params.push("apiVersion", value);
5100 }
5101
5102 params.extend(self._additional_params.iter());
5103
5104 params.push("alt", "json");
5105 let mut url = self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+name}";
5106 if self._scopes.is_empty() {
5107 self._scopes
5108 .insert(Scope::CloudPlatform.as_ref().to_string());
5109 }
5110
5111 #[allow(clippy::single_element_loop)]
5112 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5113 url = params.uri_replacement(url, param_name, find_this, true);
5114 }
5115 {
5116 let to_remove = ["name"];
5117 params.remove_params(&to_remove);
5118 }
5119
5120 let url = params.parse_with_url(&url);
5121
5122 loop {
5123 let token = match self
5124 .hub
5125 .auth
5126 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5127 .await
5128 {
5129 Ok(token) => token,
5130 Err(e) => match dlg.token(e) {
5131 Ok(token) => token,
5132 Err(e) => {
5133 dlg.finished(false);
5134 return Err(common::Error::MissingToken(e));
5135 }
5136 },
5137 };
5138 let mut req_result = {
5139 let client = &self.hub.client;
5140 dlg.pre_request();
5141 let mut req_builder = hyper::Request::builder()
5142 .method(hyper::Method::DELETE)
5143 .uri(url.as_str())
5144 .header(USER_AGENT, self.hub._user_agent.clone());
5145
5146 if let Some(token) = token.as_ref() {
5147 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5148 }
5149
5150 let request = req_builder
5151 .header(CONTENT_LENGTH, 0_u64)
5152 .body(common::to_body::<String>(None));
5153
5154 client.request(request.unwrap()).await
5155 };
5156
5157 match req_result {
5158 Err(err) => {
5159 if let common::Retry::After(d) = dlg.http_error(&err) {
5160 sleep(d).await;
5161 continue;
5162 }
5163 dlg.finished(false);
5164 return Err(common::Error::HttpError(err));
5165 }
5166 Ok(res) => {
5167 let (mut parts, body) = res.into_parts();
5168 let mut body = common::Body::new(body);
5169 if !parts.status.is_success() {
5170 let bytes = common::to_bytes(body).await.unwrap_or_default();
5171 let error = serde_json::from_str(&common::to_string(&bytes));
5172 let response = common::to_response(parts, bytes.into());
5173
5174 if let common::Retry::After(d) =
5175 dlg.http_failure(&response, error.as_ref().ok())
5176 {
5177 sleep(d).await;
5178 continue;
5179 }
5180
5181 dlg.finished(false);
5182
5183 return Err(match error {
5184 Ok(value) => common::Error::BadRequest(value),
5185 _ => common::Error::Failure(response),
5186 });
5187 }
5188 let response = {
5189 let bytes = common::to_bytes(body).await.unwrap_or_default();
5190 let encoded = common::to_string(&bytes);
5191 match serde_json::from_str(&encoded) {
5192 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5193 Err(error) => {
5194 dlg.response_json_decode_error(&encoded, &error);
5195 return Err(common::Error::JsonDecodeError(
5196 encoded.to_string(),
5197 error,
5198 ));
5199 }
5200 }
5201 };
5202
5203 dlg.finished(true);
5204 return Ok(response);
5205 }
5206 }
5207 }
5208 }
5209
5210 /// Required. The name of the domain mapping to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
5211 ///
5212 /// Sets the *name* path property to the given value.
5213 ///
5214 /// Even though the property as already been set when instantiating this call,
5215 /// we provide this method for API completeness.
5216 pub fn name(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5217 self._name = new_value.to_string();
5218 self
5219 }
5220 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background. Please see kubernetes.io/docs/concepts/architecture/garbage-collection/ for more information.
5221 ///
5222 /// Sets the *propagation policy* query property to the given value.
5223 pub fn propagation_policy(
5224 mut self,
5225 new_value: &str,
5226 ) -> NamespaceDomainmappingDeleteCall<'a, C> {
5227 self._propagation_policy = Some(new_value.to_string());
5228 self
5229 }
5230 /// Cloud Run currently ignores this parameter.
5231 ///
5232 /// Sets the *kind* query property to the given value.
5233 pub fn kind(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5234 self._kind = Some(new_value.to_string());
5235 self
5236 }
5237 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
5238 ///
5239 /// Sets the *dry run* query property to the given value.
5240 pub fn dry_run(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5241 self._dry_run = Some(new_value.to_string());
5242 self
5243 }
5244 /// Cloud Run currently ignores this parameter.
5245 ///
5246 /// Sets the *api version* query property to the given value.
5247 pub fn api_version(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5248 self._api_version = Some(new_value.to_string());
5249 self
5250 }
5251 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5252 /// while executing the actual API request.
5253 ///
5254 /// ````text
5255 /// It should be used to handle progress information, and to implement a certain level of resilience.
5256 /// ````
5257 ///
5258 /// Sets the *delegate* property to the given value.
5259 pub fn delegate(
5260 mut self,
5261 new_value: &'a mut dyn common::Delegate,
5262 ) -> NamespaceDomainmappingDeleteCall<'a, C> {
5263 self._delegate = Some(new_value);
5264 self
5265 }
5266
5267 /// Set any additional parameter of the query string used in the request.
5268 /// It should be used to set parameters which are not yet available through their own
5269 /// setters.
5270 ///
5271 /// Please note that this method must not be used to set any of the known parameters
5272 /// which have their own setter method. If done anyway, the request will fail.
5273 ///
5274 /// # Additional Parameters
5275 ///
5276 /// * *$.xgafv* (query-string) - V1 error format.
5277 /// * *access_token* (query-string) - OAuth access token.
5278 /// * *alt* (query-string) - Data format for response.
5279 /// * *callback* (query-string) - JSONP
5280 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5281 /// * *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.
5282 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5283 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5284 /// * *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.
5285 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5286 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5287 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingDeleteCall<'a, C>
5288 where
5289 T: AsRef<str>,
5290 {
5291 self._additional_params
5292 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5293 self
5294 }
5295
5296 /// Identifies the authorization scope for the method you are building.
5297 ///
5298 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5299 /// [`Scope::CloudPlatform`].
5300 ///
5301 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5302 /// tokens for more than one scope.
5303 ///
5304 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5305 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5306 /// sufficient, a read-write scope will do as well.
5307 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingDeleteCall<'a, C>
5308 where
5309 St: AsRef<str>,
5310 {
5311 self._scopes.insert(String::from(scope.as_ref()));
5312 self
5313 }
5314 /// Identifies the authorization scope(s) for the method you are building.
5315 ///
5316 /// See [`Self::add_scope()`] for details.
5317 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingDeleteCall<'a, C>
5318 where
5319 I: IntoIterator<Item = St>,
5320 St: AsRef<str>,
5321 {
5322 self._scopes
5323 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5324 self
5325 }
5326
5327 /// Removes all scopes, and no default scope will be used either.
5328 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5329 /// for details).
5330 pub fn clear_scopes(mut self) -> NamespaceDomainmappingDeleteCall<'a, C> {
5331 self._scopes.clear();
5332 self
5333 }
5334}
5335
5336/// Get information about a domain mapping.
5337///
5338/// A builder for the *domainmappings.get* method supported by a *namespace* resource.
5339/// It is not used directly, but through a [`NamespaceMethods`] instance.
5340///
5341/// # Example
5342///
5343/// Instantiate a resource method builder
5344///
5345/// ```test_harness,no_run
5346/// # extern crate hyper;
5347/// # extern crate hyper_rustls;
5348/// # extern crate google_run1 as run1;
5349/// # async fn dox() {
5350/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5351///
5352/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5353/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5354/// # secret,
5355/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5356/// # ).build().await.unwrap();
5357///
5358/// # let client = hyper_util::client::legacy::Client::builder(
5359/// # hyper_util::rt::TokioExecutor::new()
5360/// # )
5361/// # .build(
5362/// # hyper_rustls::HttpsConnectorBuilder::new()
5363/// # .with_native_roots()
5364/// # .unwrap()
5365/// # .https_or_http()
5366/// # .enable_http1()
5367/// # .build()
5368/// # );
5369/// # let mut hub = CloudRun::new(client, auth);
5370/// // You can configure optional parameters by calling the respective setters at will, and
5371/// // execute the final call using `doit()`.
5372/// // Values shown here are possibly random and not representative !
5373/// let result = hub.namespaces().domainmappings_get("name")
5374/// .doit().await;
5375/// # }
5376/// ```
5377pub struct NamespaceDomainmappingGetCall<'a, C>
5378where
5379 C: 'a,
5380{
5381 hub: &'a CloudRun<C>,
5382 _name: String,
5383 _delegate: Option<&'a mut dyn common::Delegate>,
5384 _additional_params: HashMap<String, String>,
5385 _scopes: BTreeSet<String>,
5386}
5387
5388impl<'a, C> common::CallBuilder for NamespaceDomainmappingGetCall<'a, C> {}
5389
5390impl<'a, C> NamespaceDomainmappingGetCall<'a, C>
5391where
5392 C: common::Connector,
5393{
5394 /// Perform the operation you have build so far.
5395 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
5396 use std::borrow::Cow;
5397 use std::io::{Read, Seek};
5398
5399 use common::{url::Params, ToParts};
5400 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5401
5402 let mut dd = common::DefaultDelegate;
5403 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5404 dlg.begin(common::MethodInfo {
5405 id: "run.namespaces.domainmappings.get",
5406 http_method: hyper::Method::GET,
5407 });
5408
5409 for &field in ["alt", "name"].iter() {
5410 if self._additional_params.contains_key(field) {
5411 dlg.finished(false);
5412 return Err(common::Error::FieldClash(field));
5413 }
5414 }
5415
5416 let mut params = Params::with_capacity(3 + self._additional_params.len());
5417 params.push("name", self._name);
5418
5419 params.extend(self._additional_params.iter());
5420
5421 params.push("alt", "json");
5422 let mut url = self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+name}";
5423 if self._scopes.is_empty() {
5424 self._scopes
5425 .insert(Scope::CloudPlatform.as_ref().to_string());
5426 }
5427
5428 #[allow(clippy::single_element_loop)]
5429 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5430 url = params.uri_replacement(url, param_name, find_this, true);
5431 }
5432 {
5433 let to_remove = ["name"];
5434 params.remove_params(&to_remove);
5435 }
5436
5437 let url = params.parse_with_url(&url);
5438
5439 loop {
5440 let token = match self
5441 .hub
5442 .auth
5443 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5444 .await
5445 {
5446 Ok(token) => token,
5447 Err(e) => match dlg.token(e) {
5448 Ok(token) => token,
5449 Err(e) => {
5450 dlg.finished(false);
5451 return Err(common::Error::MissingToken(e));
5452 }
5453 },
5454 };
5455 let mut req_result = {
5456 let client = &self.hub.client;
5457 dlg.pre_request();
5458 let mut req_builder = hyper::Request::builder()
5459 .method(hyper::Method::GET)
5460 .uri(url.as_str())
5461 .header(USER_AGENT, self.hub._user_agent.clone());
5462
5463 if let Some(token) = token.as_ref() {
5464 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5465 }
5466
5467 let request = req_builder
5468 .header(CONTENT_LENGTH, 0_u64)
5469 .body(common::to_body::<String>(None));
5470
5471 client.request(request.unwrap()).await
5472 };
5473
5474 match req_result {
5475 Err(err) => {
5476 if let common::Retry::After(d) = dlg.http_error(&err) {
5477 sleep(d).await;
5478 continue;
5479 }
5480 dlg.finished(false);
5481 return Err(common::Error::HttpError(err));
5482 }
5483 Ok(res) => {
5484 let (mut parts, body) = res.into_parts();
5485 let mut body = common::Body::new(body);
5486 if !parts.status.is_success() {
5487 let bytes = common::to_bytes(body).await.unwrap_or_default();
5488 let error = serde_json::from_str(&common::to_string(&bytes));
5489 let response = common::to_response(parts, bytes.into());
5490
5491 if let common::Retry::After(d) =
5492 dlg.http_failure(&response, error.as_ref().ok())
5493 {
5494 sleep(d).await;
5495 continue;
5496 }
5497
5498 dlg.finished(false);
5499
5500 return Err(match error {
5501 Ok(value) => common::Error::BadRequest(value),
5502 _ => common::Error::Failure(response),
5503 });
5504 }
5505 let response = {
5506 let bytes = common::to_bytes(body).await.unwrap_or_default();
5507 let encoded = common::to_string(&bytes);
5508 match serde_json::from_str(&encoded) {
5509 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5510 Err(error) => {
5511 dlg.response_json_decode_error(&encoded, &error);
5512 return Err(common::Error::JsonDecodeError(
5513 encoded.to_string(),
5514 error,
5515 ));
5516 }
5517 }
5518 };
5519
5520 dlg.finished(true);
5521 return Ok(response);
5522 }
5523 }
5524 }
5525 }
5526
5527 /// Required. The name of the domain mapping to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
5528 ///
5529 /// Sets the *name* path property to the given value.
5530 ///
5531 /// Even though the property as already been set when instantiating this call,
5532 /// we provide this method for API completeness.
5533 pub fn name(mut self, new_value: &str) -> NamespaceDomainmappingGetCall<'a, C> {
5534 self._name = new_value.to_string();
5535 self
5536 }
5537 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5538 /// while executing the actual API request.
5539 ///
5540 /// ````text
5541 /// It should be used to handle progress information, and to implement a certain level of resilience.
5542 /// ````
5543 ///
5544 /// Sets the *delegate* property to the given value.
5545 pub fn delegate(
5546 mut self,
5547 new_value: &'a mut dyn common::Delegate,
5548 ) -> NamespaceDomainmappingGetCall<'a, C> {
5549 self._delegate = Some(new_value);
5550 self
5551 }
5552
5553 /// Set any additional parameter of the query string used in the request.
5554 /// It should be used to set parameters which are not yet available through their own
5555 /// setters.
5556 ///
5557 /// Please note that this method must not be used to set any of the known parameters
5558 /// which have their own setter method. If done anyway, the request will fail.
5559 ///
5560 /// # Additional Parameters
5561 ///
5562 /// * *$.xgafv* (query-string) - V1 error format.
5563 /// * *access_token* (query-string) - OAuth access token.
5564 /// * *alt* (query-string) - Data format for response.
5565 /// * *callback* (query-string) - JSONP
5566 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5567 /// * *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.
5568 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5569 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5570 /// * *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.
5571 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5572 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5573 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingGetCall<'a, C>
5574 where
5575 T: AsRef<str>,
5576 {
5577 self._additional_params
5578 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5579 self
5580 }
5581
5582 /// Identifies the authorization scope for the method you are building.
5583 ///
5584 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5585 /// [`Scope::CloudPlatform`].
5586 ///
5587 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5588 /// tokens for more than one scope.
5589 ///
5590 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5591 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5592 /// sufficient, a read-write scope will do as well.
5593 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingGetCall<'a, C>
5594 where
5595 St: AsRef<str>,
5596 {
5597 self._scopes.insert(String::from(scope.as_ref()));
5598 self
5599 }
5600 /// Identifies the authorization scope(s) for the method you are building.
5601 ///
5602 /// See [`Self::add_scope()`] for details.
5603 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingGetCall<'a, C>
5604 where
5605 I: IntoIterator<Item = St>,
5606 St: AsRef<str>,
5607 {
5608 self._scopes
5609 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5610 self
5611 }
5612
5613 /// Removes all scopes, and no default scope will be used either.
5614 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5615 /// for details).
5616 pub fn clear_scopes(mut self) -> NamespaceDomainmappingGetCall<'a, C> {
5617 self._scopes.clear();
5618 self
5619 }
5620}
5621
5622/// List all domain mappings.
5623///
5624/// A builder for the *domainmappings.list* method supported by a *namespace* resource.
5625/// It is not used directly, but through a [`NamespaceMethods`] instance.
5626///
5627/// # Example
5628///
5629/// Instantiate a resource method builder
5630///
5631/// ```test_harness,no_run
5632/// # extern crate hyper;
5633/// # extern crate hyper_rustls;
5634/// # extern crate google_run1 as run1;
5635/// # async fn dox() {
5636/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5637///
5638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5640/// # secret,
5641/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5642/// # ).build().await.unwrap();
5643///
5644/// # let client = hyper_util::client::legacy::Client::builder(
5645/// # hyper_util::rt::TokioExecutor::new()
5646/// # )
5647/// # .build(
5648/// # hyper_rustls::HttpsConnectorBuilder::new()
5649/// # .with_native_roots()
5650/// # .unwrap()
5651/// # .https_or_http()
5652/// # .enable_http1()
5653/// # .build()
5654/// # );
5655/// # let mut hub = CloudRun::new(client, auth);
5656/// // You can configure optional parameters by calling the respective setters at will, and
5657/// // execute the final call using `doit()`.
5658/// // Values shown here are possibly random and not representative !
5659/// let result = hub.namespaces().domainmappings_list("parent")
5660/// .watch(false)
5661/// .resource_version("sed")
5662/// .limit(-70)
5663/// .label_selector("sed")
5664/// .include_uninitialized(true)
5665/// .field_selector("Stet")
5666/// .continue_("kasd")
5667/// .doit().await;
5668/// # }
5669/// ```
5670pub struct NamespaceDomainmappingListCall<'a, C>
5671where
5672 C: 'a,
5673{
5674 hub: &'a CloudRun<C>,
5675 _parent: String,
5676 _watch: Option<bool>,
5677 _resource_version: Option<String>,
5678 _limit: Option<i32>,
5679 _label_selector: Option<String>,
5680 _include_uninitialized: Option<bool>,
5681 _field_selector: Option<String>,
5682 _continue_: Option<String>,
5683 _delegate: Option<&'a mut dyn common::Delegate>,
5684 _additional_params: HashMap<String, String>,
5685 _scopes: BTreeSet<String>,
5686}
5687
5688impl<'a, C> common::CallBuilder for NamespaceDomainmappingListCall<'a, C> {}
5689
5690impl<'a, C> NamespaceDomainmappingListCall<'a, C>
5691where
5692 C: common::Connector,
5693{
5694 /// Perform the operation you have build so far.
5695 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
5696 use std::borrow::Cow;
5697 use std::io::{Read, Seek};
5698
5699 use common::{url::Params, ToParts};
5700 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5701
5702 let mut dd = common::DefaultDelegate;
5703 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5704 dlg.begin(common::MethodInfo {
5705 id: "run.namespaces.domainmappings.list",
5706 http_method: hyper::Method::GET,
5707 });
5708
5709 for &field in [
5710 "alt",
5711 "parent",
5712 "watch",
5713 "resourceVersion",
5714 "limit",
5715 "labelSelector",
5716 "includeUninitialized",
5717 "fieldSelector",
5718 "continue",
5719 ]
5720 .iter()
5721 {
5722 if self._additional_params.contains_key(field) {
5723 dlg.finished(false);
5724 return Err(common::Error::FieldClash(field));
5725 }
5726 }
5727
5728 let mut params = Params::with_capacity(10 + self._additional_params.len());
5729 params.push("parent", self._parent);
5730 if let Some(value) = self._watch.as_ref() {
5731 params.push("watch", value.to_string());
5732 }
5733 if let Some(value) = self._resource_version.as_ref() {
5734 params.push("resourceVersion", value);
5735 }
5736 if let Some(value) = self._limit.as_ref() {
5737 params.push("limit", value.to_string());
5738 }
5739 if let Some(value) = self._label_selector.as_ref() {
5740 params.push("labelSelector", value);
5741 }
5742 if let Some(value) = self._include_uninitialized.as_ref() {
5743 params.push("includeUninitialized", value.to_string());
5744 }
5745 if let Some(value) = self._field_selector.as_ref() {
5746 params.push("fieldSelector", value);
5747 }
5748 if let Some(value) = self._continue_.as_ref() {
5749 params.push("continue", value);
5750 }
5751
5752 params.extend(self._additional_params.iter());
5753
5754 params.push("alt", "json");
5755 let mut url =
5756 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/domainmappings";
5757 if self._scopes.is_empty() {
5758 self._scopes
5759 .insert(Scope::CloudPlatform.as_ref().to_string());
5760 }
5761
5762 #[allow(clippy::single_element_loop)]
5763 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5764 url = params.uri_replacement(url, param_name, find_this, true);
5765 }
5766 {
5767 let to_remove = ["parent"];
5768 params.remove_params(&to_remove);
5769 }
5770
5771 let url = params.parse_with_url(&url);
5772
5773 loop {
5774 let token = match self
5775 .hub
5776 .auth
5777 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5778 .await
5779 {
5780 Ok(token) => token,
5781 Err(e) => match dlg.token(e) {
5782 Ok(token) => token,
5783 Err(e) => {
5784 dlg.finished(false);
5785 return Err(common::Error::MissingToken(e));
5786 }
5787 },
5788 };
5789 let mut req_result = {
5790 let client = &self.hub.client;
5791 dlg.pre_request();
5792 let mut req_builder = hyper::Request::builder()
5793 .method(hyper::Method::GET)
5794 .uri(url.as_str())
5795 .header(USER_AGENT, self.hub._user_agent.clone());
5796
5797 if let Some(token) = token.as_ref() {
5798 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5799 }
5800
5801 let request = req_builder
5802 .header(CONTENT_LENGTH, 0_u64)
5803 .body(common::to_body::<String>(None));
5804
5805 client.request(request.unwrap()).await
5806 };
5807
5808 match req_result {
5809 Err(err) => {
5810 if let common::Retry::After(d) = dlg.http_error(&err) {
5811 sleep(d).await;
5812 continue;
5813 }
5814 dlg.finished(false);
5815 return Err(common::Error::HttpError(err));
5816 }
5817 Ok(res) => {
5818 let (mut parts, body) = res.into_parts();
5819 let mut body = common::Body::new(body);
5820 if !parts.status.is_success() {
5821 let bytes = common::to_bytes(body).await.unwrap_or_default();
5822 let error = serde_json::from_str(&common::to_string(&bytes));
5823 let response = common::to_response(parts, bytes.into());
5824
5825 if let common::Retry::After(d) =
5826 dlg.http_failure(&response, error.as_ref().ok())
5827 {
5828 sleep(d).await;
5829 continue;
5830 }
5831
5832 dlg.finished(false);
5833
5834 return Err(match error {
5835 Ok(value) => common::Error::BadRequest(value),
5836 _ => common::Error::Failure(response),
5837 });
5838 }
5839 let response = {
5840 let bytes = common::to_bytes(body).await.unwrap_or_default();
5841 let encoded = common::to_string(&bytes);
5842 match serde_json::from_str(&encoded) {
5843 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5844 Err(error) => {
5845 dlg.response_json_decode_error(&encoded, &error);
5846 return Err(common::Error::JsonDecodeError(
5847 encoded.to_string(),
5848 error,
5849 ));
5850 }
5851 }
5852 };
5853
5854 dlg.finished(true);
5855 return Ok(response);
5856 }
5857 }
5858 }
5859 }
5860
5861 /// Required. The namespace from which the domain mappings should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
5862 ///
5863 /// Sets the *parent* path property to the given value.
5864 ///
5865 /// Even though the property as already been set when instantiating this call,
5866 /// we provide this method for API completeness.
5867 pub fn parent(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
5868 self._parent = new_value.to_string();
5869 self
5870 }
5871 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
5872 ///
5873 /// Sets the *watch* query property to the given value.
5874 pub fn watch(mut self, new_value: bool) -> NamespaceDomainmappingListCall<'a, C> {
5875 self._watch = Some(new_value);
5876 self
5877 }
5878 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
5879 ///
5880 /// Sets the *resource version* query property to the given value.
5881 pub fn resource_version(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
5882 self._resource_version = Some(new_value.to_string());
5883 self
5884 }
5885 /// Optional. The maximum number of records that should be returned.
5886 ///
5887 /// Sets the *limit* query property to the given value.
5888 pub fn limit(mut self, new_value: i32) -> NamespaceDomainmappingListCall<'a, C> {
5889 self._limit = Some(new_value);
5890 self
5891 }
5892 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
5893 ///
5894 /// Sets the *label selector* query property to the given value.
5895 pub fn label_selector(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
5896 self._label_selector = Some(new_value.to_string());
5897 self
5898 }
5899 /// Not currently used by Cloud Run.
5900 ///
5901 /// Sets the *include uninitialized* query property to the given value.
5902 pub fn include_uninitialized(
5903 mut self,
5904 new_value: bool,
5905 ) -> NamespaceDomainmappingListCall<'a, C> {
5906 self._include_uninitialized = Some(new_value);
5907 self
5908 }
5909 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
5910 ///
5911 /// Sets the *field selector* query property to the given value.
5912 pub fn field_selector(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
5913 self._field_selector = Some(new_value.to_string());
5914 self
5915 }
5916 /// Optional. Encoded string to continue paging.
5917 ///
5918 /// Sets the *continue* query property to the given value.
5919 pub fn continue_(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
5920 self._continue_ = Some(new_value.to_string());
5921 self
5922 }
5923 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5924 /// while executing the actual API request.
5925 ///
5926 /// ````text
5927 /// It should be used to handle progress information, and to implement a certain level of resilience.
5928 /// ````
5929 ///
5930 /// Sets the *delegate* property to the given value.
5931 pub fn delegate(
5932 mut self,
5933 new_value: &'a mut dyn common::Delegate,
5934 ) -> NamespaceDomainmappingListCall<'a, C> {
5935 self._delegate = Some(new_value);
5936 self
5937 }
5938
5939 /// Set any additional parameter of the query string used in the request.
5940 /// It should be used to set parameters which are not yet available through their own
5941 /// setters.
5942 ///
5943 /// Please note that this method must not be used to set any of the known parameters
5944 /// which have their own setter method. If done anyway, the request will fail.
5945 ///
5946 /// # Additional Parameters
5947 ///
5948 /// * *$.xgafv* (query-string) - V1 error format.
5949 /// * *access_token* (query-string) - OAuth access token.
5950 /// * *alt* (query-string) - Data format for response.
5951 /// * *callback* (query-string) - JSONP
5952 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5953 /// * *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.
5954 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5955 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5956 /// * *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.
5957 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5958 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5959 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingListCall<'a, C>
5960 where
5961 T: AsRef<str>,
5962 {
5963 self._additional_params
5964 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5965 self
5966 }
5967
5968 /// Identifies the authorization scope for the method you are building.
5969 ///
5970 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5971 /// [`Scope::CloudPlatform`].
5972 ///
5973 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5974 /// tokens for more than one scope.
5975 ///
5976 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5977 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5978 /// sufficient, a read-write scope will do as well.
5979 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingListCall<'a, C>
5980 where
5981 St: AsRef<str>,
5982 {
5983 self._scopes.insert(String::from(scope.as_ref()));
5984 self
5985 }
5986 /// Identifies the authorization scope(s) for the method you are building.
5987 ///
5988 /// See [`Self::add_scope()`] for details.
5989 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingListCall<'a, C>
5990 where
5991 I: IntoIterator<Item = St>,
5992 St: AsRef<str>,
5993 {
5994 self._scopes
5995 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5996 self
5997 }
5998
5999 /// Removes all scopes, and no default scope will be used either.
6000 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6001 /// for details).
6002 pub fn clear_scopes(mut self) -> NamespaceDomainmappingListCall<'a, C> {
6003 self._scopes.clear();
6004 self
6005 }
6006}
6007
6008/// Cancel an execution.
6009///
6010/// A builder for the *executions.cancel* method supported by a *namespace* resource.
6011/// It is not used directly, but through a [`NamespaceMethods`] instance.
6012///
6013/// # Example
6014///
6015/// Instantiate a resource method builder
6016///
6017/// ```test_harness,no_run
6018/// # extern crate hyper;
6019/// # extern crate hyper_rustls;
6020/// # extern crate google_run1 as run1;
6021/// use run1::api::CancelExecutionRequest;
6022/// # async fn dox() {
6023/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6024///
6025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6027/// # secret,
6028/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6029/// # ).build().await.unwrap();
6030///
6031/// # let client = hyper_util::client::legacy::Client::builder(
6032/// # hyper_util::rt::TokioExecutor::new()
6033/// # )
6034/// # .build(
6035/// # hyper_rustls::HttpsConnectorBuilder::new()
6036/// # .with_native_roots()
6037/// # .unwrap()
6038/// # .https_or_http()
6039/// # .enable_http1()
6040/// # .build()
6041/// # );
6042/// # let mut hub = CloudRun::new(client, auth);
6043/// // As the method needs a request, you would usually fill it with the desired information
6044/// // into the respective structure. Some of the parts shown here might not be applicable !
6045/// // Values shown here are possibly random and not representative !
6046/// let mut req = CancelExecutionRequest::default();
6047///
6048/// // You can configure optional parameters by calling the respective setters at will, and
6049/// // execute the final call using `doit()`.
6050/// // Values shown here are possibly random and not representative !
6051/// let result = hub.namespaces().executions_cancel(req, "name")
6052/// .doit().await;
6053/// # }
6054/// ```
6055pub struct NamespaceExecutionCancelCall<'a, C>
6056where
6057 C: 'a,
6058{
6059 hub: &'a CloudRun<C>,
6060 _request: CancelExecutionRequest,
6061 _name: String,
6062 _delegate: Option<&'a mut dyn common::Delegate>,
6063 _additional_params: HashMap<String, String>,
6064 _scopes: BTreeSet<String>,
6065}
6066
6067impl<'a, C> common::CallBuilder for NamespaceExecutionCancelCall<'a, C> {}
6068
6069impl<'a, C> NamespaceExecutionCancelCall<'a, C>
6070where
6071 C: common::Connector,
6072{
6073 /// Perform the operation you have build so far.
6074 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
6075 use std::borrow::Cow;
6076 use std::io::{Read, Seek};
6077
6078 use common::{url::Params, ToParts};
6079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6080
6081 let mut dd = common::DefaultDelegate;
6082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6083 dlg.begin(common::MethodInfo {
6084 id: "run.namespaces.executions.cancel",
6085 http_method: hyper::Method::POST,
6086 });
6087
6088 for &field in ["alt", "name"].iter() {
6089 if self._additional_params.contains_key(field) {
6090 dlg.finished(false);
6091 return Err(common::Error::FieldClash(field));
6092 }
6093 }
6094
6095 let mut params = Params::with_capacity(4 + self._additional_params.len());
6096 params.push("name", self._name);
6097
6098 params.extend(self._additional_params.iter());
6099
6100 params.push("alt", "json");
6101 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}:cancel";
6102 if self._scopes.is_empty() {
6103 self._scopes
6104 .insert(Scope::CloudPlatform.as_ref().to_string());
6105 }
6106
6107 #[allow(clippy::single_element_loop)]
6108 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6109 url = params.uri_replacement(url, param_name, find_this, true);
6110 }
6111 {
6112 let to_remove = ["name"];
6113 params.remove_params(&to_remove);
6114 }
6115
6116 let url = params.parse_with_url(&url);
6117
6118 let mut json_mime_type = mime::APPLICATION_JSON;
6119 let mut request_value_reader = {
6120 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6121 common::remove_json_null_values(&mut value);
6122 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6123 serde_json::to_writer(&mut dst, &value).unwrap();
6124 dst
6125 };
6126 let request_size = request_value_reader
6127 .seek(std::io::SeekFrom::End(0))
6128 .unwrap();
6129 request_value_reader
6130 .seek(std::io::SeekFrom::Start(0))
6131 .unwrap();
6132
6133 loop {
6134 let token = match self
6135 .hub
6136 .auth
6137 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6138 .await
6139 {
6140 Ok(token) => token,
6141 Err(e) => match dlg.token(e) {
6142 Ok(token) => token,
6143 Err(e) => {
6144 dlg.finished(false);
6145 return Err(common::Error::MissingToken(e));
6146 }
6147 },
6148 };
6149 request_value_reader
6150 .seek(std::io::SeekFrom::Start(0))
6151 .unwrap();
6152 let mut req_result = {
6153 let client = &self.hub.client;
6154 dlg.pre_request();
6155 let mut req_builder = hyper::Request::builder()
6156 .method(hyper::Method::POST)
6157 .uri(url.as_str())
6158 .header(USER_AGENT, self.hub._user_agent.clone());
6159
6160 if let Some(token) = token.as_ref() {
6161 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6162 }
6163
6164 let request = req_builder
6165 .header(CONTENT_TYPE, json_mime_type.to_string())
6166 .header(CONTENT_LENGTH, request_size as u64)
6167 .body(common::to_body(
6168 request_value_reader.get_ref().clone().into(),
6169 ));
6170
6171 client.request(request.unwrap()).await
6172 };
6173
6174 match req_result {
6175 Err(err) => {
6176 if let common::Retry::After(d) = dlg.http_error(&err) {
6177 sleep(d).await;
6178 continue;
6179 }
6180 dlg.finished(false);
6181 return Err(common::Error::HttpError(err));
6182 }
6183 Ok(res) => {
6184 let (mut parts, body) = res.into_parts();
6185 let mut body = common::Body::new(body);
6186 if !parts.status.is_success() {
6187 let bytes = common::to_bytes(body).await.unwrap_or_default();
6188 let error = serde_json::from_str(&common::to_string(&bytes));
6189 let response = common::to_response(parts, bytes.into());
6190
6191 if let common::Retry::After(d) =
6192 dlg.http_failure(&response, error.as_ref().ok())
6193 {
6194 sleep(d).await;
6195 continue;
6196 }
6197
6198 dlg.finished(false);
6199
6200 return Err(match error {
6201 Ok(value) => common::Error::BadRequest(value),
6202 _ => common::Error::Failure(response),
6203 });
6204 }
6205 let response = {
6206 let bytes = common::to_bytes(body).await.unwrap_or_default();
6207 let encoded = common::to_string(&bytes);
6208 match serde_json::from_str(&encoded) {
6209 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6210 Err(error) => {
6211 dlg.response_json_decode_error(&encoded, &error);
6212 return Err(common::Error::JsonDecodeError(
6213 encoded.to_string(),
6214 error,
6215 ));
6216 }
6217 }
6218 };
6219
6220 dlg.finished(true);
6221 return Ok(response);
6222 }
6223 }
6224 }
6225 }
6226
6227 ///
6228 /// Sets the *request* property to the given value.
6229 ///
6230 /// Even though the property as already been set when instantiating this call,
6231 /// we provide this method for API completeness.
6232 pub fn request(
6233 mut self,
6234 new_value: CancelExecutionRequest,
6235 ) -> NamespaceExecutionCancelCall<'a, C> {
6236 self._request = new_value;
6237 self
6238 }
6239 /// Required. The name of the execution to cancel. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
6240 ///
6241 /// Sets the *name* path property to the given value.
6242 ///
6243 /// Even though the property as already been set when instantiating this call,
6244 /// we provide this method for API completeness.
6245 pub fn name(mut self, new_value: &str) -> NamespaceExecutionCancelCall<'a, C> {
6246 self._name = new_value.to_string();
6247 self
6248 }
6249 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6250 /// while executing the actual API request.
6251 ///
6252 /// ````text
6253 /// It should be used to handle progress information, and to implement a certain level of resilience.
6254 /// ````
6255 ///
6256 /// Sets the *delegate* property to the given value.
6257 pub fn delegate(
6258 mut self,
6259 new_value: &'a mut dyn common::Delegate,
6260 ) -> NamespaceExecutionCancelCall<'a, C> {
6261 self._delegate = Some(new_value);
6262 self
6263 }
6264
6265 /// Set any additional parameter of the query string used in the request.
6266 /// It should be used to set parameters which are not yet available through their own
6267 /// setters.
6268 ///
6269 /// Please note that this method must not be used to set any of the known parameters
6270 /// which have their own setter method. If done anyway, the request will fail.
6271 ///
6272 /// # Additional Parameters
6273 ///
6274 /// * *$.xgafv* (query-string) - V1 error format.
6275 /// * *access_token* (query-string) - OAuth access token.
6276 /// * *alt* (query-string) - Data format for response.
6277 /// * *callback* (query-string) - JSONP
6278 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6279 /// * *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.
6280 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6281 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6282 /// * *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.
6283 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6284 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6285 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionCancelCall<'a, C>
6286 where
6287 T: AsRef<str>,
6288 {
6289 self._additional_params
6290 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6291 self
6292 }
6293
6294 /// Identifies the authorization scope for the method you are building.
6295 ///
6296 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6297 /// [`Scope::CloudPlatform`].
6298 ///
6299 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6300 /// tokens for more than one scope.
6301 ///
6302 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6303 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6304 /// sufficient, a read-write scope will do as well.
6305 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionCancelCall<'a, C>
6306 where
6307 St: AsRef<str>,
6308 {
6309 self._scopes.insert(String::from(scope.as_ref()));
6310 self
6311 }
6312 /// Identifies the authorization scope(s) for the method you are building.
6313 ///
6314 /// See [`Self::add_scope()`] for details.
6315 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionCancelCall<'a, C>
6316 where
6317 I: IntoIterator<Item = St>,
6318 St: AsRef<str>,
6319 {
6320 self._scopes
6321 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6322 self
6323 }
6324
6325 /// Removes all scopes, and no default scope will be used either.
6326 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6327 /// for details).
6328 pub fn clear_scopes(mut self) -> NamespaceExecutionCancelCall<'a, C> {
6329 self._scopes.clear();
6330 self
6331 }
6332}
6333
6334/// Delete an execution.
6335///
6336/// A builder for the *executions.delete* method supported by a *namespace* resource.
6337/// It is not used directly, but through a [`NamespaceMethods`] instance.
6338///
6339/// # Example
6340///
6341/// Instantiate a resource method builder
6342///
6343/// ```test_harness,no_run
6344/// # extern crate hyper;
6345/// # extern crate hyper_rustls;
6346/// # extern crate google_run1 as run1;
6347/// # async fn dox() {
6348/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6349///
6350/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6351/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6352/// # secret,
6353/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6354/// # ).build().await.unwrap();
6355///
6356/// # let client = hyper_util::client::legacy::Client::builder(
6357/// # hyper_util::rt::TokioExecutor::new()
6358/// # )
6359/// # .build(
6360/// # hyper_rustls::HttpsConnectorBuilder::new()
6361/// # .with_native_roots()
6362/// # .unwrap()
6363/// # .https_or_http()
6364/// # .enable_http1()
6365/// # .build()
6366/// # );
6367/// # let mut hub = CloudRun::new(client, auth);
6368/// // You can configure optional parameters by calling the respective setters at will, and
6369/// // execute the final call using `doit()`.
6370/// // Values shown here are possibly random and not representative !
6371/// let result = hub.namespaces().executions_delete("name")
6372/// .propagation_policy("et")
6373/// .kind("et")
6374/// .api_version("vero")
6375/// .doit().await;
6376/// # }
6377/// ```
6378pub struct NamespaceExecutionDeleteCall<'a, C>
6379where
6380 C: 'a,
6381{
6382 hub: &'a CloudRun<C>,
6383 _name: String,
6384 _propagation_policy: Option<String>,
6385 _kind: Option<String>,
6386 _api_version: Option<String>,
6387 _delegate: Option<&'a mut dyn common::Delegate>,
6388 _additional_params: HashMap<String, String>,
6389 _scopes: BTreeSet<String>,
6390}
6391
6392impl<'a, C> common::CallBuilder for NamespaceExecutionDeleteCall<'a, C> {}
6393
6394impl<'a, C> NamespaceExecutionDeleteCall<'a, C>
6395where
6396 C: common::Connector,
6397{
6398 /// Perform the operation you have build so far.
6399 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
6400 use std::borrow::Cow;
6401 use std::io::{Read, Seek};
6402
6403 use common::{url::Params, ToParts};
6404 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6405
6406 let mut dd = common::DefaultDelegate;
6407 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6408 dlg.begin(common::MethodInfo {
6409 id: "run.namespaces.executions.delete",
6410 http_method: hyper::Method::DELETE,
6411 });
6412
6413 for &field in ["alt", "name", "propagationPolicy", "kind", "apiVersion"].iter() {
6414 if self._additional_params.contains_key(field) {
6415 dlg.finished(false);
6416 return Err(common::Error::FieldClash(field));
6417 }
6418 }
6419
6420 let mut params = Params::with_capacity(6 + self._additional_params.len());
6421 params.push("name", self._name);
6422 if let Some(value) = self._propagation_policy.as_ref() {
6423 params.push("propagationPolicy", value);
6424 }
6425 if let Some(value) = self._kind.as_ref() {
6426 params.push("kind", value);
6427 }
6428 if let Some(value) = self._api_version.as_ref() {
6429 params.push("apiVersion", value);
6430 }
6431
6432 params.extend(self._additional_params.iter());
6433
6434 params.push("alt", "json");
6435 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
6436 if self._scopes.is_empty() {
6437 self._scopes
6438 .insert(Scope::CloudPlatform.as_ref().to_string());
6439 }
6440
6441 #[allow(clippy::single_element_loop)]
6442 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6443 url = params.uri_replacement(url, param_name, find_this, true);
6444 }
6445 {
6446 let to_remove = ["name"];
6447 params.remove_params(&to_remove);
6448 }
6449
6450 let url = params.parse_with_url(&url);
6451
6452 loop {
6453 let token = match self
6454 .hub
6455 .auth
6456 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6457 .await
6458 {
6459 Ok(token) => token,
6460 Err(e) => match dlg.token(e) {
6461 Ok(token) => token,
6462 Err(e) => {
6463 dlg.finished(false);
6464 return Err(common::Error::MissingToken(e));
6465 }
6466 },
6467 };
6468 let mut req_result = {
6469 let client = &self.hub.client;
6470 dlg.pre_request();
6471 let mut req_builder = hyper::Request::builder()
6472 .method(hyper::Method::DELETE)
6473 .uri(url.as_str())
6474 .header(USER_AGENT, self.hub._user_agent.clone());
6475
6476 if let Some(token) = token.as_ref() {
6477 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6478 }
6479
6480 let request = req_builder
6481 .header(CONTENT_LENGTH, 0_u64)
6482 .body(common::to_body::<String>(None));
6483
6484 client.request(request.unwrap()).await
6485 };
6486
6487 match req_result {
6488 Err(err) => {
6489 if let common::Retry::After(d) = dlg.http_error(&err) {
6490 sleep(d).await;
6491 continue;
6492 }
6493 dlg.finished(false);
6494 return Err(common::Error::HttpError(err));
6495 }
6496 Ok(res) => {
6497 let (mut parts, body) = res.into_parts();
6498 let mut body = common::Body::new(body);
6499 if !parts.status.is_success() {
6500 let bytes = common::to_bytes(body).await.unwrap_or_default();
6501 let error = serde_json::from_str(&common::to_string(&bytes));
6502 let response = common::to_response(parts, bytes.into());
6503
6504 if let common::Retry::After(d) =
6505 dlg.http_failure(&response, error.as_ref().ok())
6506 {
6507 sleep(d).await;
6508 continue;
6509 }
6510
6511 dlg.finished(false);
6512
6513 return Err(match error {
6514 Ok(value) => common::Error::BadRequest(value),
6515 _ => common::Error::Failure(response),
6516 });
6517 }
6518 let response = {
6519 let bytes = common::to_bytes(body).await.unwrap_or_default();
6520 let encoded = common::to_string(&bytes);
6521 match serde_json::from_str(&encoded) {
6522 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6523 Err(error) => {
6524 dlg.response_json_decode_error(&encoded, &error);
6525 return Err(common::Error::JsonDecodeError(
6526 encoded.to_string(),
6527 error,
6528 ));
6529 }
6530 }
6531 };
6532
6533 dlg.finished(true);
6534 return Ok(response);
6535 }
6536 }
6537 }
6538 }
6539
6540 /// Required. The name of the execution to delete. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
6541 ///
6542 /// Sets the *name* path property to the given value.
6543 ///
6544 /// Even though the property as already been set when instantiating this call,
6545 /// we provide this method for API completeness.
6546 pub fn name(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6547 self._name = new_value.to_string();
6548 self
6549 }
6550 /// Optional. Specifies the propagation policy of delete. Cloud Run currently ignores this setting.
6551 ///
6552 /// Sets the *propagation policy* query property to the given value.
6553 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6554 self._propagation_policy = Some(new_value.to_string());
6555 self
6556 }
6557 /// Optional. Cloud Run currently ignores this parameter.
6558 ///
6559 /// Sets the *kind* query property to the given value.
6560 pub fn kind(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6561 self._kind = Some(new_value.to_string());
6562 self
6563 }
6564 /// Optional. Cloud Run currently ignores this parameter.
6565 ///
6566 /// Sets the *api version* query property to the given value.
6567 pub fn api_version(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6568 self._api_version = Some(new_value.to_string());
6569 self
6570 }
6571 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6572 /// while executing the actual API request.
6573 ///
6574 /// ````text
6575 /// It should be used to handle progress information, and to implement a certain level of resilience.
6576 /// ````
6577 ///
6578 /// Sets the *delegate* property to the given value.
6579 pub fn delegate(
6580 mut self,
6581 new_value: &'a mut dyn common::Delegate,
6582 ) -> NamespaceExecutionDeleteCall<'a, C> {
6583 self._delegate = Some(new_value);
6584 self
6585 }
6586
6587 /// Set any additional parameter of the query string used in the request.
6588 /// It should be used to set parameters which are not yet available through their own
6589 /// setters.
6590 ///
6591 /// Please note that this method must not be used to set any of the known parameters
6592 /// which have their own setter method. If done anyway, the request will fail.
6593 ///
6594 /// # Additional Parameters
6595 ///
6596 /// * *$.xgafv* (query-string) - V1 error format.
6597 /// * *access_token* (query-string) - OAuth access token.
6598 /// * *alt* (query-string) - Data format for response.
6599 /// * *callback* (query-string) - JSONP
6600 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6601 /// * *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.
6602 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6603 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6604 /// * *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.
6605 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6606 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6607 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionDeleteCall<'a, C>
6608 where
6609 T: AsRef<str>,
6610 {
6611 self._additional_params
6612 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6613 self
6614 }
6615
6616 /// Identifies the authorization scope for the method you are building.
6617 ///
6618 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6619 /// [`Scope::CloudPlatform`].
6620 ///
6621 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6622 /// tokens for more than one scope.
6623 ///
6624 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6625 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6626 /// sufficient, a read-write scope will do as well.
6627 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionDeleteCall<'a, C>
6628 where
6629 St: AsRef<str>,
6630 {
6631 self._scopes.insert(String::from(scope.as_ref()));
6632 self
6633 }
6634 /// Identifies the authorization scope(s) for the method you are building.
6635 ///
6636 /// See [`Self::add_scope()`] for details.
6637 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionDeleteCall<'a, C>
6638 where
6639 I: IntoIterator<Item = St>,
6640 St: AsRef<str>,
6641 {
6642 self._scopes
6643 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6644 self
6645 }
6646
6647 /// Removes all scopes, and no default scope will be used either.
6648 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6649 /// for details).
6650 pub fn clear_scopes(mut self) -> NamespaceExecutionDeleteCall<'a, C> {
6651 self._scopes.clear();
6652 self
6653 }
6654}
6655
6656/// Get information about an execution.
6657///
6658/// A builder for the *executions.get* method supported by a *namespace* resource.
6659/// It is not used directly, but through a [`NamespaceMethods`] instance.
6660///
6661/// # Example
6662///
6663/// Instantiate a resource method builder
6664///
6665/// ```test_harness,no_run
6666/// # extern crate hyper;
6667/// # extern crate hyper_rustls;
6668/// # extern crate google_run1 as run1;
6669/// # async fn dox() {
6670/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6671///
6672/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6674/// # secret,
6675/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6676/// # ).build().await.unwrap();
6677///
6678/// # let client = hyper_util::client::legacy::Client::builder(
6679/// # hyper_util::rt::TokioExecutor::new()
6680/// # )
6681/// # .build(
6682/// # hyper_rustls::HttpsConnectorBuilder::new()
6683/// # .with_native_roots()
6684/// # .unwrap()
6685/// # .https_or_http()
6686/// # .enable_http1()
6687/// # .build()
6688/// # );
6689/// # let mut hub = CloudRun::new(client, auth);
6690/// // You can configure optional parameters by calling the respective setters at will, and
6691/// // execute the final call using `doit()`.
6692/// // Values shown here are possibly random and not representative !
6693/// let result = hub.namespaces().executions_get("name")
6694/// .doit().await;
6695/// # }
6696/// ```
6697pub struct NamespaceExecutionGetCall<'a, C>
6698where
6699 C: 'a,
6700{
6701 hub: &'a CloudRun<C>,
6702 _name: String,
6703 _delegate: Option<&'a mut dyn common::Delegate>,
6704 _additional_params: HashMap<String, String>,
6705 _scopes: BTreeSet<String>,
6706}
6707
6708impl<'a, C> common::CallBuilder for NamespaceExecutionGetCall<'a, C> {}
6709
6710impl<'a, C> NamespaceExecutionGetCall<'a, C>
6711where
6712 C: common::Connector,
6713{
6714 /// Perform the operation you have build so far.
6715 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
6716 use std::borrow::Cow;
6717 use std::io::{Read, Seek};
6718
6719 use common::{url::Params, ToParts};
6720 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6721
6722 let mut dd = common::DefaultDelegate;
6723 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6724 dlg.begin(common::MethodInfo {
6725 id: "run.namespaces.executions.get",
6726 http_method: hyper::Method::GET,
6727 });
6728
6729 for &field in ["alt", "name"].iter() {
6730 if self._additional_params.contains_key(field) {
6731 dlg.finished(false);
6732 return Err(common::Error::FieldClash(field));
6733 }
6734 }
6735
6736 let mut params = Params::with_capacity(3 + self._additional_params.len());
6737 params.push("name", self._name);
6738
6739 params.extend(self._additional_params.iter());
6740
6741 params.push("alt", "json");
6742 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
6743 if self._scopes.is_empty() {
6744 self._scopes
6745 .insert(Scope::CloudPlatform.as_ref().to_string());
6746 }
6747
6748 #[allow(clippy::single_element_loop)]
6749 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6750 url = params.uri_replacement(url, param_name, find_this, true);
6751 }
6752 {
6753 let to_remove = ["name"];
6754 params.remove_params(&to_remove);
6755 }
6756
6757 let url = params.parse_with_url(&url);
6758
6759 loop {
6760 let token = match self
6761 .hub
6762 .auth
6763 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6764 .await
6765 {
6766 Ok(token) => token,
6767 Err(e) => match dlg.token(e) {
6768 Ok(token) => token,
6769 Err(e) => {
6770 dlg.finished(false);
6771 return Err(common::Error::MissingToken(e));
6772 }
6773 },
6774 };
6775 let mut req_result = {
6776 let client = &self.hub.client;
6777 dlg.pre_request();
6778 let mut req_builder = hyper::Request::builder()
6779 .method(hyper::Method::GET)
6780 .uri(url.as_str())
6781 .header(USER_AGENT, self.hub._user_agent.clone());
6782
6783 if let Some(token) = token.as_ref() {
6784 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6785 }
6786
6787 let request = req_builder
6788 .header(CONTENT_LENGTH, 0_u64)
6789 .body(common::to_body::<String>(None));
6790
6791 client.request(request.unwrap()).await
6792 };
6793
6794 match req_result {
6795 Err(err) => {
6796 if let common::Retry::After(d) = dlg.http_error(&err) {
6797 sleep(d).await;
6798 continue;
6799 }
6800 dlg.finished(false);
6801 return Err(common::Error::HttpError(err));
6802 }
6803 Ok(res) => {
6804 let (mut parts, body) = res.into_parts();
6805 let mut body = common::Body::new(body);
6806 if !parts.status.is_success() {
6807 let bytes = common::to_bytes(body).await.unwrap_or_default();
6808 let error = serde_json::from_str(&common::to_string(&bytes));
6809 let response = common::to_response(parts, bytes.into());
6810
6811 if let common::Retry::After(d) =
6812 dlg.http_failure(&response, error.as_ref().ok())
6813 {
6814 sleep(d).await;
6815 continue;
6816 }
6817
6818 dlg.finished(false);
6819
6820 return Err(match error {
6821 Ok(value) => common::Error::BadRequest(value),
6822 _ => common::Error::Failure(response),
6823 });
6824 }
6825 let response = {
6826 let bytes = common::to_bytes(body).await.unwrap_or_default();
6827 let encoded = common::to_string(&bytes);
6828 match serde_json::from_str(&encoded) {
6829 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6830 Err(error) => {
6831 dlg.response_json_decode_error(&encoded, &error);
6832 return Err(common::Error::JsonDecodeError(
6833 encoded.to_string(),
6834 error,
6835 ));
6836 }
6837 }
6838 };
6839
6840 dlg.finished(true);
6841 return Ok(response);
6842 }
6843 }
6844 }
6845 }
6846
6847 /// Required. The name of the execution to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
6848 ///
6849 /// Sets the *name* path property to the given value.
6850 ///
6851 /// Even though the property as already been set when instantiating this call,
6852 /// we provide this method for API completeness.
6853 pub fn name(mut self, new_value: &str) -> NamespaceExecutionGetCall<'a, C> {
6854 self._name = new_value.to_string();
6855 self
6856 }
6857 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6858 /// while executing the actual API request.
6859 ///
6860 /// ````text
6861 /// It should be used to handle progress information, and to implement a certain level of resilience.
6862 /// ````
6863 ///
6864 /// Sets the *delegate* property to the given value.
6865 pub fn delegate(
6866 mut self,
6867 new_value: &'a mut dyn common::Delegate,
6868 ) -> NamespaceExecutionGetCall<'a, C> {
6869 self._delegate = Some(new_value);
6870 self
6871 }
6872
6873 /// Set any additional parameter of the query string used in the request.
6874 /// It should be used to set parameters which are not yet available through their own
6875 /// setters.
6876 ///
6877 /// Please note that this method must not be used to set any of the known parameters
6878 /// which have their own setter method. If done anyway, the request will fail.
6879 ///
6880 /// # Additional Parameters
6881 ///
6882 /// * *$.xgafv* (query-string) - V1 error format.
6883 /// * *access_token* (query-string) - OAuth access token.
6884 /// * *alt* (query-string) - Data format for response.
6885 /// * *callback* (query-string) - JSONP
6886 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6887 /// * *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.
6888 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6889 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6890 /// * *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.
6891 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6892 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6893 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionGetCall<'a, C>
6894 where
6895 T: AsRef<str>,
6896 {
6897 self._additional_params
6898 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6899 self
6900 }
6901
6902 /// Identifies the authorization scope for the method you are building.
6903 ///
6904 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6905 /// [`Scope::CloudPlatform`].
6906 ///
6907 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6908 /// tokens for more than one scope.
6909 ///
6910 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6911 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6912 /// sufficient, a read-write scope will do as well.
6913 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionGetCall<'a, C>
6914 where
6915 St: AsRef<str>,
6916 {
6917 self._scopes.insert(String::from(scope.as_ref()));
6918 self
6919 }
6920 /// Identifies the authorization scope(s) for the method you are building.
6921 ///
6922 /// See [`Self::add_scope()`] for details.
6923 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionGetCall<'a, C>
6924 where
6925 I: IntoIterator<Item = St>,
6926 St: AsRef<str>,
6927 {
6928 self._scopes
6929 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6930 self
6931 }
6932
6933 /// Removes all scopes, and no default scope will be used either.
6934 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6935 /// for details).
6936 pub fn clear_scopes(mut self) -> NamespaceExecutionGetCall<'a, C> {
6937 self._scopes.clear();
6938 self
6939 }
6940}
6941
6942/// List executions. Results are sorted by creation time, descending.
6943///
6944/// A builder for the *executions.list* method supported by a *namespace* resource.
6945/// It is not used directly, but through a [`NamespaceMethods`] instance.
6946///
6947/// # Example
6948///
6949/// Instantiate a resource method builder
6950///
6951/// ```test_harness,no_run
6952/// # extern crate hyper;
6953/// # extern crate hyper_rustls;
6954/// # extern crate google_run1 as run1;
6955/// # async fn dox() {
6956/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6957///
6958/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6959/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6960/// # secret,
6961/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6962/// # ).build().await.unwrap();
6963///
6964/// # let client = hyper_util::client::legacy::Client::builder(
6965/// # hyper_util::rt::TokioExecutor::new()
6966/// # )
6967/// # .build(
6968/// # hyper_rustls::HttpsConnectorBuilder::new()
6969/// # .with_native_roots()
6970/// # .unwrap()
6971/// # .https_or_http()
6972/// # .enable_http1()
6973/// # .build()
6974/// # );
6975/// # let mut hub = CloudRun::new(client, auth);
6976/// // You can configure optional parameters by calling the respective setters at will, and
6977/// // execute the final call using `doit()`.
6978/// // Values shown here are possibly random and not representative !
6979/// let result = hub.namespaces().executions_list("parent")
6980/// .watch(false)
6981/// .resource_version("diam")
6982/// .limit(-49)
6983/// .label_selector("et")
6984/// .include_uninitialized(false)
6985/// .field_selector("Stet")
6986/// .continue_("dolor")
6987/// .doit().await;
6988/// # }
6989/// ```
6990pub struct NamespaceExecutionListCall<'a, C>
6991where
6992 C: 'a,
6993{
6994 hub: &'a CloudRun<C>,
6995 _parent: String,
6996 _watch: Option<bool>,
6997 _resource_version: Option<String>,
6998 _limit: Option<i32>,
6999 _label_selector: Option<String>,
7000 _include_uninitialized: Option<bool>,
7001 _field_selector: Option<String>,
7002 _continue_: Option<String>,
7003 _delegate: Option<&'a mut dyn common::Delegate>,
7004 _additional_params: HashMap<String, String>,
7005 _scopes: BTreeSet<String>,
7006}
7007
7008impl<'a, C> common::CallBuilder for NamespaceExecutionListCall<'a, C> {}
7009
7010impl<'a, C> NamespaceExecutionListCall<'a, C>
7011where
7012 C: common::Connector,
7013{
7014 /// Perform the operation you have build so far.
7015 pub async fn doit(mut self) -> common::Result<(common::Response, ListExecutionsResponse)> {
7016 use std::borrow::Cow;
7017 use std::io::{Read, Seek};
7018
7019 use common::{url::Params, ToParts};
7020 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7021
7022 let mut dd = common::DefaultDelegate;
7023 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7024 dlg.begin(common::MethodInfo {
7025 id: "run.namespaces.executions.list",
7026 http_method: hyper::Method::GET,
7027 });
7028
7029 for &field in [
7030 "alt",
7031 "parent",
7032 "watch",
7033 "resourceVersion",
7034 "limit",
7035 "labelSelector",
7036 "includeUninitialized",
7037 "fieldSelector",
7038 "continue",
7039 ]
7040 .iter()
7041 {
7042 if self._additional_params.contains_key(field) {
7043 dlg.finished(false);
7044 return Err(common::Error::FieldClash(field));
7045 }
7046 }
7047
7048 let mut params = Params::with_capacity(10 + self._additional_params.len());
7049 params.push("parent", self._parent);
7050 if let Some(value) = self._watch.as_ref() {
7051 params.push("watch", value.to_string());
7052 }
7053 if let Some(value) = self._resource_version.as_ref() {
7054 params.push("resourceVersion", value);
7055 }
7056 if let Some(value) = self._limit.as_ref() {
7057 params.push("limit", value.to_string());
7058 }
7059 if let Some(value) = self._label_selector.as_ref() {
7060 params.push("labelSelector", value);
7061 }
7062 if let Some(value) = self._include_uninitialized.as_ref() {
7063 params.push("includeUninitialized", value.to_string());
7064 }
7065 if let Some(value) = self._field_selector.as_ref() {
7066 params.push("fieldSelector", value);
7067 }
7068 if let Some(value) = self._continue_.as_ref() {
7069 params.push("continue", value);
7070 }
7071
7072 params.extend(self._additional_params.iter());
7073
7074 params.push("alt", "json");
7075 let mut url =
7076 self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/executions";
7077 if self._scopes.is_empty() {
7078 self._scopes
7079 .insert(Scope::CloudPlatform.as_ref().to_string());
7080 }
7081
7082 #[allow(clippy::single_element_loop)]
7083 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7084 url = params.uri_replacement(url, param_name, find_this, true);
7085 }
7086 {
7087 let to_remove = ["parent"];
7088 params.remove_params(&to_remove);
7089 }
7090
7091 let url = params.parse_with_url(&url);
7092
7093 loop {
7094 let token = match self
7095 .hub
7096 .auth
7097 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7098 .await
7099 {
7100 Ok(token) => token,
7101 Err(e) => match dlg.token(e) {
7102 Ok(token) => token,
7103 Err(e) => {
7104 dlg.finished(false);
7105 return Err(common::Error::MissingToken(e));
7106 }
7107 },
7108 };
7109 let mut req_result = {
7110 let client = &self.hub.client;
7111 dlg.pre_request();
7112 let mut req_builder = hyper::Request::builder()
7113 .method(hyper::Method::GET)
7114 .uri(url.as_str())
7115 .header(USER_AGENT, self.hub._user_agent.clone());
7116
7117 if let Some(token) = token.as_ref() {
7118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7119 }
7120
7121 let request = req_builder
7122 .header(CONTENT_LENGTH, 0_u64)
7123 .body(common::to_body::<String>(None));
7124
7125 client.request(request.unwrap()).await
7126 };
7127
7128 match req_result {
7129 Err(err) => {
7130 if let common::Retry::After(d) = dlg.http_error(&err) {
7131 sleep(d).await;
7132 continue;
7133 }
7134 dlg.finished(false);
7135 return Err(common::Error::HttpError(err));
7136 }
7137 Ok(res) => {
7138 let (mut parts, body) = res.into_parts();
7139 let mut body = common::Body::new(body);
7140 if !parts.status.is_success() {
7141 let bytes = common::to_bytes(body).await.unwrap_or_default();
7142 let error = serde_json::from_str(&common::to_string(&bytes));
7143 let response = common::to_response(parts, bytes.into());
7144
7145 if let common::Retry::After(d) =
7146 dlg.http_failure(&response, error.as_ref().ok())
7147 {
7148 sleep(d).await;
7149 continue;
7150 }
7151
7152 dlg.finished(false);
7153
7154 return Err(match error {
7155 Ok(value) => common::Error::BadRequest(value),
7156 _ => common::Error::Failure(response),
7157 });
7158 }
7159 let response = {
7160 let bytes = common::to_bytes(body).await.unwrap_or_default();
7161 let encoded = common::to_string(&bytes);
7162 match serde_json::from_str(&encoded) {
7163 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7164 Err(error) => {
7165 dlg.response_json_decode_error(&encoded, &error);
7166 return Err(common::Error::JsonDecodeError(
7167 encoded.to_string(),
7168 error,
7169 ));
7170 }
7171 }
7172 };
7173
7174 dlg.finished(true);
7175 return Ok(response);
7176 }
7177 }
7178 }
7179 }
7180
7181 /// Required. The namespace from which the executions should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
7182 ///
7183 /// Sets the *parent* path property to the given value.
7184 ///
7185 /// Even though the property as already been set when instantiating this call,
7186 /// we provide this method for API completeness.
7187 pub fn parent(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7188 self._parent = new_value.to_string();
7189 self
7190 }
7191 /// Optional. Not supported by Cloud Run.
7192 ///
7193 /// Sets the *watch* query property to the given value.
7194 pub fn watch(mut self, new_value: bool) -> NamespaceExecutionListCall<'a, C> {
7195 self._watch = Some(new_value);
7196 self
7197 }
7198 /// Optional. Not supported by Cloud Run.
7199 ///
7200 /// Sets the *resource version* query property to the given value.
7201 pub fn resource_version(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7202 self._resource_version = Some(new_value.to_string());
7203 self
7204 }
7205 /// Optional. The maximum number of the records that should be returned.
7206 ///
7207 /// Sets the *limit* query property to the given value.
7208 pub fn limit(mut self, new_value: i32) -> NamespaceExecutionListCall<'a, C> {
7209 self._limit = Some(new_value);
7210 self
7211 }
7212 /// Optional. Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
7213 ///
7214 /// Sets the *label selector* query property to the given value.
7215 pub fn label_selector(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7216 self._label_selector = Some(new_value.to_string());
7217 self
7218 }
7219 /// Optional. Not supported by Cloud Run.
7220 ///
7221 /// Sets the *include uninitialized* query property to the given value.
7222 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceExecutionListCall<'a, C> {
7223 self._include_uninitialized = Some(new_value);
7224 self
7225 }
7226 /// Optional. Not supported by Cloud Run.
7227 ///
7228 /// Sets the *field selector* query property to the given value.
7229 pub fn field_selector(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7230 self._field_selector = Some(new_value.to_string());
7231 self
7232 }
7233 /// Optional. Optional encoded string to continue paging.
7234 ///
7235 /// Sets the *continue* query property to the given value.
7236 pub fn continue_(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7237 self._continue_ = Some(new_value.to_string());
7238 self
7239 }
7240 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7241 /// while executing the actual API request.
7242 ///
7243 /// ````text
7244 /// It should be used to handle progress information, and to implement a certain level of resilience.
7245 /// ````
7246 ///
7247 /// Sets the *delegate* property to the given value.
7248 pub fn delegate(
7249 mut self,
7250 new_value: &'a mut dyn common::Delegate,
7251 ) -> NamespaceExecutionListCall<'a, C> {
7252 self._delegate = Some(new_value);
7253 self
7254 }
7255
7256 /// Set any additional parameter of the query string used in the request.
7257 /// It should be used to set parameters which are not yet available through their own
7258 /// setters.
7259 ///
7260 /// Please note that this method must not be used to set any of the known parameters
7261 /// which have their own setter method. If done anyway, the request will fail.
7262 ///
7263 /// # Additional Parameters
7264 ///
7265 /// * *$.xgafv* (query-string) - V1 error format.
7266 /// * *access_token* (query-string) - OAuth access token.
7267 /// * *alt* (query-string) - Data format for response.
7268 /// * *callback* (query-string) - JSONP
7269 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7270 /// * *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.
7271 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7272 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7273 /// * *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.
7274 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7275 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7276 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionListCall<'a, C>
7277 where
7278 T: AsRef<str>,
7279 {
7280 self._additional_params
7281 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7282 self
7283 }
7284
7285 /// Identifies the authorization scope for the method you are building.
7286 ///
7287 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7288 /// [`Scope::CloudPlatform`].
7289 ///
7290 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7291 /// tokens for more than one scope.
7292 ///
7293 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7294 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7295 /// sufficient, a read-write scope will do as well.
7296 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionListCall<'a, C>
7297 where
7298 St: AsRef<str>,
7299 {
7300 self._scopes.insert(String::from(scope.as_ref()));
7301 self
7302 }
7303 /// Identifies the authorization scope(s) for the method you are building.
7304 ///
7305 /// See [`Self::add_scope()`] for details.
7306 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionListCall<'a, C>
7307 where
7308 I: IntoIterator<Item = St>,
7309 St: AsRef<str>,
7310 {
7311 self._scopes
7312 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7313 self
7314 }
7315
7316 /// Removes all scopes, and no default scope will be used either.
7317 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7318 /// for details).
7319 pub fn clear_scopes(mut self) -> NamespaceExecutionListCall<'a, C> {
7320 self._scopes.clear();
7321 self
7322 }
7323}
7324
7325/// Create a job.
7326///
7327/// A builder for the *jobs.create* method supported by a *namespace* resource.
7328/// It is not used directly, but through a [`NamespaceMethods`] instance.
7329///
7330/// # Example
7331///
7332/// Instantiate a resource method builder
7333///
7334/// ```test_harness,no_run
7335/// # extern crate hyper;
7336/// # extern crate hyper_rustls;
7337/// # extern crate google_run1 as run1;
7338/// use run1::api::Job;
7339/// # async fn dox() {
7340/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7341///
7342/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7343/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7344/// # secret,
7345/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7346/// # ).build().await.unwrap();
7347///
7348/// # let client = hyper_util::client::legacy::Client::builder(
7349/// # hyper_util::rt::TokioExecutor::new()
7350/// # )
7351/// # .build(
7352/// # hyper_rustls::HttpsConnectorBuilder::new()
7353/// # .with_native_roots()
7354/// # .unwrap()
7355/// # .https_or_http()
7356/// # .enable_http1()
7357/// # .build()
7358/// # );
7359/// # let mut hub = CloudRun::new(client, auth);
7360/// // As the method needs a request, you would usually fill it with the desired information
7361/// // into the respective structure. Some of the parts shown here might not be applicable !
7362/// // Values shown here are possibly random and not representative !
7363/// let mut req = Job::default();
7364///
7365/// // You can configure optional parameters by calling the respective setters at will, and
7366/// // execute the final call using `doit()`.
7367/// // Values shown here are possibly random and not representative !
7368/// let result = hub.namespaces().jobs_create(req, "parent")
7369/// .doit().await;
7370/// # }
7371/// ```
7372pub struct NamespaceJobCreateCall<'a, C>
7373where
7374 C: 'a,
7375{
7376 hub: &'a CloudRun<C>,
7377 _request: Job,
7378 _parent: String,
7379 _delegate: Option<&'a mut dyn common::Delegate>,
7380 _additional_params: HashMap<String, String>,
7381 _scopes: BTreeSet<String>,
7382}
7383
7384impl<'a, C> common::CallBuilder for NamespaceJobCreateCall<'a, C> {}
7385
7386impl<'a, C> NamespaceJobCreateCall<'a, C>
7387where
7388 C: common::Connector,
7389{
7390 /// Perform the operation you have build so far.
7391 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
7392 use std::borrow::Cow;
7393 use std::io::{Read, Seek};
7394
7395 use common::{url::Params, ToParts};
7396 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7397
7398 let mut dd = common::DefaultDelegate;
7399 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7400 dlg.begin(common::MethodInfo {
7401 id: "run.namespaces.jobs.create",
7402 http_method: hyper::Method::POST,
7403 });
7404
7405 for &field in ["alt", "parent"].iter() {
7406 if self._additional_params.contains_key(field) {
7407 dlg.finished(false);
7408 return Err(common::Error::FieldClash(field));
7409 }
7410 }
7411
7412 let mut params = Params::with_capacity(4 + self._additional_params.len());
7413 params.push("parent", self._parent);
7414
7415 params.extend(self._additional_params.iter());
7416
7417 params.push("alt", "json");
7418 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/jobs";
7419 if self._scopes.is_empty() {
7420 self._scopes
7421 .insert(Scope::CloudPlatform.as_ref().to_string());
7422 }
7423
7424 #[allow(clippy::single_element_loop)]
7425 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7426 url = params.uri_replacement(url, param_name, find_this, true);
7427 }
7428 {
7429 let to_remove = ["parent"];
7430 params.remove_params(&to_remove);
7431 }
7432
7433 let url = params.parse_with_url(&url);
7434
7435 let mut json_mime_type = mime::APPLICATION_JSON;
7436 let mut request_value_reader = {
7437 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7438 common::remove_json_null_values(&mut value);
7439 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7440 serde_json::to_writer(&mut dst, &value).unwrap();
7441 dst
7442 };
7443 let request_size = request_value_reader
7444 .seek(std::io::SeekFrom::End(0))
7445 .unwrap();
7446 request_value_reader
7447 .seek(std::io::SeekFrom::Start(0))
7448 .unwrap();
7449
7450 loop {
7451 let token = match self
7452 .hub
7453 .auth
7454 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7455 .await
7456 {
7457 Ok(token) => token,
7458 Err(e) => match dlg.token(e) {
7459 Ok(token) => token,
7460 Err(e) => {
7461 dlg.finished(false);
7462 return Err(common::Error::MissingToken(e));
7463 }
7464 },
7465 };
7466 request_value_reader
7467 .seek(std::io::SeekFrom::Start(0))
7468 .unwrap();
7469 let mut req_result = {
7470 let client = &self.hub.client;
7471 dlg.pre_request();
7472 let mut req_builder = hyper::Request::builder()
7473 .method(hyper::Method::POST)
7474 .uri(url.as_str())
7475 .header(USER_AGENT, self.hub._user_agent.clone());
7476
7477 if let Some(token) = token.as_ref() {
7478 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7479 }
7480
7481 let request = req_builder
7482 .header(CONTENT_TYPE, json_mime_type.to_string())
7483 .header(CONTENT_LENGTH, request_size as u64)
7484 .body(common::to_body(
7485 request_value_reader.get_ref().clone().into(),
7486 ));
7487
7488 client.request(request.unwrap()).await
7489 };
7490
7491 match req_result {
7492 Err(err) => {
7493 if let common::Retry::After(d) = dlg.http_error(&err) {
7494 sleep(d).await;
7495 continue;
7496 }
7497 dlg.finished(false);
7498 return Err(common::Error::HttpError(err));
7499 }
7500 Ok(res) => {
7501 let (mut parts, body) = res.into_parts();
7502 let mut body = common::Body::new(body);
7503 if !parts.status.is_success() {
7504 let bytes = common::to_bytes(body).await.unwrap_or_default();
7505 let error = serde_json::from_str(&common::to_string(&bytes));
7506 let response = common::to_response(parts, bytes.into());
7507
7508 if let common::Retry::After(d) =
7509 dlg.http_failure(&response, error.as_ref().ok())
7510 {
7511 sleep(d).await;
7512 continue;
7513 }
7514
7515 dlg.finished(false);
7516
7517 return Err(match error {
7518 Ok(value) => common::Error::BadRequest(value),
7519 _ => common::Error::Failure(response),
7520 });
7521 }
7522 let response = {
7523 let bytes = common::to_bytes(body).await.unwrap_or_default();
7524 let encoded = common::to_string(&bytes);
7525 match serde_json::from_str(&encoded) {
7526 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7527 Err(error) => {
7528 dlg.response_json_decode_error(&encoded, &error);
7529 return Err(common::Error::JsonDecodeError(
7530 encoded.to_string(),
7531 error,
7532 ));
7533 }
7534 }
7535 };
7536
7537 dlg.finished(true);
7538 return Ok(response);
7539 }
7540 }
7541 }
7542 }
7543
7544 ///
7545 /// Sets the *request* property to the given value.
7546 ///
7547 /// Even though the property as already been set when instantiating this call,
7548 /// we provide this method for API completeness.
7549 pub fn request(mut self, new_value: Job) -> NamespaceJobCreateCall<'a, C> {
7550 self._request = new_value;
7551 self
7552 }
7553 /// Required. The namespace in which the job should be created. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
7554 ///
7555 /// Sets the *parent* path property to the given value.
7556 ///
7557 /// Even though the property as already been set when instantiating this call,
7558 /// we provide this method for API completeness.
7559 pub fn parent(mut self, new_value: &str) -> NamespaceJobCreateCall<'a, C> {
7560 self._parent = new_value.to_string();
7561 self
7562 }
7563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7564 /// while executing the actual API request.
7565 ///
7566 /// ````text
7567 /// It should be used to handle progress information, and to implement a certain level of resilience.
7568 /// ````
7569 ///
7570 /// Sets the *delegate* property to the given value.
7571 pub fn delegate(
7572 mut self,
7573 new_value: &'a mut dyn common::Delegate,
7574 ) -> NamespaceJobCreateCall<'a, C> {
7575 self._delegate = Some(new_value);
7576 self
7577 }
7578
7579 /// Set any additional parameter of the query string used in the request.
7580 /// It should be used to set parameters which are not yet available through their own
7581 /// setters.
7582 ///
7583 /// Please note that this method must not be used to set any of the known parameters
7584 /// which have their own setter method. If done anyway, the request will fail.
7585 ///
7586 /// # Additional Parameters
7587 ///
7588 /// * *$.xgafv* (query-string) - V1 error format.
7589 /// * *access_token* (query-string) - OAuth access token.
7590 /// * *alt* (query-string) - Data format for response.
7591 /// * *callback* (query-string) - JSONP
7592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7593 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7596 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7599 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobCreateCall<'a, C>
7600 where
7601 T: AsRef<str>,
7602 {
7603 self._additional_params
7604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7605 self
7606 }
7607
7608 /// Identifies the authorization scope for the method you are building.
7609 ///
7610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7611 /// [`Scope::CloudPlatform`].
7612 ///
7613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7614 /// tokens for more than one scope.
7615 ///
7616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7618 /// sufficient, a read-write scope will do as well.
7619 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobCreateCall<'a, C>
7620 where
7621 St: AsRef<str>,
7622 {
7623 self._scopes.insert(String::from(scope.as_ref()));
7624 self
7625 }
7626 /// Identifies the authorization scope(s) for the method you are building.
7627 ///
7628 /// See [`Self::add_scope()`] for details.
7629 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobCreateCall<'a, C>
7630 where
7631 I: IntoIterator<Item = St>,
7632 St: AsRef<str>,
7633 {
7634 self._scopes
7635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7636 self
7637 }
7638
7639 /// Removes all scopes, and no default scope will be used either.
7640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7641 /// for details).
7642 pub fn clear_scopes(mut self) -> NamespaceJobCreateCall<'a, C> {
7643 self._scopes.clear();
7644 self
7645 }
7646}
7647
7648/// Delete a job.
7649///
7650/// A builder for the *jobs.delete* method supported by a *namespace* resource.
7651/// It is not used directly, but through a [`NamespaceMethods`] instance.
7652///
7653/// # Example
7654///
7655/// Instantiate a resource method builder
7656///
7657/// ```test_harness,no_run
7658/// # extern crate hyper;
7659/// # extern crate hyper_rustls;
7660/// # extern crate google_run1 as run1;
7661/// # async fn dox() {
7662/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7663///
7664/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7665/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7666/// # secret,
7667/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7668/// # ).build().await.unwrap();
7669///
7670/// # let client = hyper_util::client::legacy::Client::builder(
7671/// # hyper_util::rt::TokioExecutor::new()
7672/// # )
7673/// # .build(
7674/// # hyper_rustls::HttpsConnectorBuilder::new()
7675/// # .with_native_roots()
7676/// # .unwrap()
7677/// # .https_or_http()
7678/// # .enable_http1()
7679/// # .build()
7680/// # );
7681/// # let mut hub = CloudRun::new(client, auth);
7682/// // You can configure optional parameters by calling the respective setters at will, and
7683/// // execute the final call using `doit()`.
7684/// // Values shown here are possibly random and not representative !
7685/// let result = hub.namespaces().jobs_delete("name")
7686/// .propagation_policy("vero")
7687/// .kind("invidunt")
7688/// .api_version("Stet")
7689/// .doit().await;
7690/// # }
7691/// ```
7692pub struct NamespaceJobDeleteCall<'a, C>
7693where
7694 C: 'a,
7695{
7696 hub: &'a CloudRun<C>,
7697 _name: String,
7698 _propagation_policy: Option<String>,
7699 _kind: Option<String>,
7700 _api_version: Option<String>,
7701 _delegate: Option<&'a mut dyn common::Delegate>,
7702 _additional_params: HashMap<String, String>,
7703 _scopes: BTreeSet<String>,
7704}
7705
7706impl<'a, C> common::CallBuilder for NamespaceJobDeleteCall<'a, C> {}
7707
7708impl<'a, C> NamespaceJobDeleteCall<'a, C>
7709where
7710 C: common::Connector,
7711{
7712 /// Perform the operation you have build so far.
7713 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
7714 use std::borrow::Cow;
7715 use std::io::{Read, Seek};
7716
7717 use common::{url::Params, ToParts};
7718 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7719
7720 let mut dd = common::DefaultDelegate;
7721 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7722 dlg.begin(common::MethodInfo {
7723 id: "run.namespaces.jobs.delete",
7724 http_method: hyper::Method::DELETE,
7725 });
7726
7727 for &field in ["alt", "name", "propagationPolicy", "kind", "apiVersion"].iter() {
7728 if self._additional_params.contains_key(field) {
7729 dlg.finished(false);
7730 return Err(common::Error::FieldClash(field));
7731 }
7732 }
7733
7734 let mut params = Params::with_capacity(6 + self._additional_params.len());
7735 params.push("name", self._name);
7736 if let Some(value) = self._propagation_policy.as_ref() {
7737 params.push("propagationPolicy", value);
7738 }
7739 if let Some(value) = self._kind.as_ref() {
7740 params.push("kind", value);
7741 }
7742 if let Some(value) = self._api_version.as_ref() {
7743 params.push("apiVersion", value);
7744 }
7745
7746 params.extend(self._additional_params.iter());
7747
7748 params.push("alt", "json");
7749 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
7750 if self._scopes.is_empty() {
7751 self._scopes
7752 .insert(Scope::CloudPlatform.as_ref().to_string());
7753 }
7754
7755 #[allow(clippy::single_element_loop)]
7756 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7757 url = params.uri_replacement(url, param_name, find_this, true);
7758 }
7759 {
7760 let to_remove = ["name"];
7761 params.remove_params(&to_remove);
7762 }
7763
7764 let url = params.parse_with_url(&url);
7765
7766 loop {
7767 let token = match self
7768 .hub
7769 .auth
7770 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7771 .await
7772 {
7773 Ok(token) => token,
7774 Err(e) => match dlg.token(e) {
7775 Ok(token) => token,
7776 Err(e) => {
7777 dlg.finished(false);
7778 return Err(common::Error::MissingToken(e));
7779 }
7780 },
7781 };
7782 let mut req_result = {
7783 let client = &self.hub.client;
7784 dlg.pre_request();
7785 let mut req_builder = hyper::Request::builder()
7786 .method(hyper::Method::DELETE)
7787 .uri(url.as_str())
7788 .header(USER_AGENT, self.hub._user_agent.clone());
7789
7790 if let Some(token) = token.as_ref() {
7791 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7792 }
7793
7794 let request = req_builder
7795 .header(CONTENT_LENGTH, 0_u64)
7796 .body(common::to_body::<String>(None));
7797
7798 client.request(request.unwrap()).await
7799 };
7800
7801 match req_result {
7802 Err(err) => {
7803 if let common::Retry::After(d) = dlg.http_error(&err) {
7804 sleep(d).await;
7805 continue;
7806 }
7807 dlg.finished(false);
7808 return Err(common::Error::HttpError(err));
7809 }
7810 Ok(res) => {
7811 let (mut parts, body) = res.into_parts();
7812 let mut body = common::Body::new(body);
7813 if !parts.status.is_success() {
7814 let bytes = common::to_bytes(body).await.unwrap_or_default();
7815 let error = serde_json::from_str(&common::to_string(&bytes));
7816 let response = common::to_response(parts, bytes.into());
7817
7818 if let common::Retry::After(d) =
7819 dlg.http_failure(&response, error.as_ref().ok())
7820 {
7821 sleep(d).await;
7822 continue;
7823 }
7824
7825 dlg.finished(false);
7826
7827 return Err(match error {
7828 Ok(value) => common::Error::BadRequest(value),
7829 _ => common::Error::Failure(response),
7830 });
7831 }
7832 let response = {
7833 let bytes = common::to_bytes(body).await.unwrap_or_default();
7834 let encoded = common::to_string(&bytes);
7835 match serde_json::from_str(&encoded) {
7836 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7837 Err(error) => {
7838 dlg.response_json_decode_error(&encoded, &error);
7839 return Err(common::Error::JsonDecodeError(
7840 encoded.to_string(),
7841 error,
7842 ));
7843 }
7844 }
7845 };
7846
7847 dlg.finished(true);
7848 return Ok(response);
7849 }
7850 }
7851 }
7852 }
7853
7854 /// Required. The name of the job to delete. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
7855 ///
7856 /// Sets the *name* path property to the given value.
7857 ///
7858 /// Even though the property as already been set when instantiating this call,
7859 /// we provide this method for API completeness.
7860 pub fn name(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
7861 self._name = new_value.to_string();
7862 self
7863 }
7864 /// Optional. Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background. Please see kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/ for more information.
7865 ///
7866 /// Sets the *propagation policy* query property to the given value.
7867 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
7868 self._propagation_policy = Some(new_value.to_string());
7869 self
7870 }
7871 /// Optional. Cloud Run currently ignores this parameter.
7872 ///
7873 /// Sets the *kind* query property to the given value.
7874 pub fn kind(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
7875 self._kind = Some(new_value.to_string());
7876 self
7877 }
7878 /// Optional. Cloud Run currently ignores this parameter.
7879 ///
7880 /// Sets the *api version* query property to the given value.
7881 pub fn api_version(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
7882 self._api_version = Some(new_value.to_string());
7883 self
7884 }
7885 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7886 /// while executing the actual API request.
7887 ///
7888 /// ````text
7889 /// It should be used to handle progress information, and to implement a certain level of resilience.
7890 /// ````
7891 ///
7892 /// Sets the *delegate* property to the given value.
7893 pub fn delegate(
7894 mut self,
7895 new_value: &'a mut dyn common::Delegate,
7896 ) -> NamespaceJobDeleteCall<'a, C> {
7897 self._delegate = Some(new_value);
7898 self
7899 }
7900
7901 /// Set any additional parameter of the query string used in the request.
7902 /// It should be used to set parameters which are not yet available through their own
7903 /// setters.
7904 ///
7905 /// Please note that this method must not be used to set any of the known parameters
7906 /// which have their own setter method. If done anyway, the request will fail.
7907 ///
7908 /// # Additional Parameters
7909 ///
7910 /// * *$.xgafv* (query-string) - V1 error format.
7911 /// * *access_token* (query-string) - OAuth access token.
7912 /// * *alt* (query-string) - Data format for response.
7913 /// * *callback* (query-string) - JSONP
7914 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7915 /// * *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.
7916 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7917 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7918 /// * *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.
7919 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7920 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7921 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobDeleteCall<'a, C>
7922 where
7923 T: AsRef<str>,
7924 {
7925 self._additional_params
7926 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7927 self
7928 }
7929
7930 /// Identifies the authorization scope for the method you are building.
7931 ///
7932 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7933 /// [`Scope::CloudPlatform`].
7934 ///
7935 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7936 /// tokens for more than one scope.
7937 ///
7938 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7939 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7940 /// sufficient, a read-write scope will do as well.
7941 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobDeleteCall<'a, C>
7942 where
7943 St: AsRef<str>,
7944 {
7945 self._scopes.insert(String::from(scope.as_ref()));
7946 self
7947 }
7948 /// Identifies the authorization scope(s) for the method you are building.
7949 ///
7950 /// See [`Self::add_scope()`] for details.
7951 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobDeleteCall<'a, C>
7952 where
7953 I: IntoIterator<Item = St>,
7954 St: AsRef<str>,
7955 {
7956 self._scopes
7957 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7958 self
7959 }
7960
7961 /// Removes all scopes, and no default scope will be used either.
7962 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7963 /// for details).
7964 pub fn clear_scopes(mut self) -> NamespaceJobDeleteCall<'a, C> {
7965 self._scopes.clear();
7966 self
7967 }
7968}
7969
7970/// Get information about a job.
7971///
7972/// A builder for the *jobs.get* method supported by a *namespace* resource.
7973/// It is not used directly, but through a [`NamespaceMethods`] instance.
7974///
7975/// # Example
7976///
7977/// Instantiate a resource method builder
7978///
7979/// ```test_harness,no_run
7980/// # extern crate hyper;
7981/// # extern crate hyper_rustls;
7982/// # extern crate google_run1 as run1;
7983/// # async fn dox() {
7984/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7985///
7986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7988/// # secret,
7989/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7990/// # ).build().await.unwrap();
7991///
7992/// # let client = hyper_util::client::legacy::Client::builder(
7993/// # hyper_util::rt::TokioExecutor::new()
7994/// # )
7995/// # .build(
7996/// # hyper_rustls::HttpsConnectorBuilder::new()
7997/// # .with_native_roots()
7998/// # .unwrap()
7999/// # .https_or_http()
8000/// # .enable_http1()
8001/// # .build()
8002/// # );
8003/// # let mut hub = CloudRun::new(client, auth);
8004/// // You can configure optional parameters by calling the respective setters at will, and
8005/// // execute the final call using `doit()`.
8006/// // Values shown here are possibly random and not representative !
8007/// let result = hub.namespaces().jobs_get("name")
8008/// .doit().await;
8009/// # }
8010/// ```
8011pub struct NamespaceJobGetCall<'a, C>
8012where
8013 C: 'a,
8014{
8015 hub: &'a CloudRun<C>,
8016 _name: String,
8017 _delegate: Option<&'a mut dyn common::Delegate>,
8018 _additional_params: HashMap<String, String>,
8019 _scopes: BTreeSet<String>,
8020}
8021
8022impl<'a, C> common::CallBuilder for NamespaceJobGetCall<'a, C> {}
8023
8024impl<'a, C> NamespaceJobGetCall<'a, C>
8025where
8026 C: common::Connector,
8027{
8028 /// Perform the operation you have build so far.
8029 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
8030 use std::borrow::Cow;
8031 use std::io::{Read, Seek};
8032
8033 use common::{url::Params, ToParts};
8034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8035
8036 let mut dd = common::DefaultDelegate;
8037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8038 dlg.begin(common::MethodInfo {
8039 id: "run.namespaces.jobs.get",
8040 http_method: hyper::Method::GET,
8041 });
8042
8043 for &field in ["alt", "name"].iter() {
8044 if self._additional_params.contains_key(field) {
8045 dlg.finished(false);
8046 return Err(common::Error::FieldClash(field));
8047 }
8048 }
8049
8050 let mut params = Params::with_capacity(3 + self._additional_params.len());
8051 params.push("name", self._name);
8052
8053 params.extend(self._additional_params.iter());
8054
8055 params.push("alt", "json");
8056 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
8057 if self._scopes.is_empty() {
8058 self._scopes
8059 .insert(Scope::CloudPlatform.as_ref().to_string());
8060 }
8061
8062 #[allow(clippy::single_element_loop)]
8063 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8064 url = params.uri_replacement(url, param_name, find_this, true);
8065 }
8066 {
8067 let to_remove = ["name"];
8068 params.remove_params(&to_remove);
8069 }
8070
8071 let url = params.parse_with_url(&url);
8072
8073 loop {
8074 let token = match self
8075 .hub
8076 .auth
8077 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8078 .await
8079 {
8080 Ok(token) => token,
8081 Err(e) => match dlg.token(e) {
8082 Ok(token) => token,
8083 Err(e) => {
8084 dlg.finished(false);
8085 return Err(common::Error::MissingToken(e));
8086 }
8087 },
8088 };
8089 let mut req_result = {
8090 let client = &self.hub.client;
8091 dlg.pre_request();
8092 let mut req_builder = hyper::Request::builder()
8093 .method(hyper::Method::GET)
8094 .uri(url.as_str())
8095 .header(USER_AGENT, self.hub._user_agent.clone());
8096
8097 if let Some(token) = token.as_ref() {
8098 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8099 }
8100
8101 let request = req_builder
8102 .header(CONTENT_LENGTH, 0_u64)
8103 .body(common::to_body::<String>(None));
8104
8105 client.request(request.unwrap()).await
8106 };
8107
8108 match req_result {
8109 Err(err) => {
8110 if let common::Retry::After(d) = dlg.http_error(&err) {
8111 sleep(d).await;
8112 continue;
8113 }
8114 dlg.finished(false);
8115 return Err(common::Error::HttpError(err));
8116 }
8117 Ok(res) => {
8118 let (mut parts, body) = res.into_parts();
8119 let mut body = common::Body::new(body);
8120 if !parts.status.is_success() {
8121 let bytes = common::to_bytes(body).await.unwrap_or_default();
8122 let error = serde_json::from_str(&common::to_string(&bytes));
8123 let response = common::to_response(parts, bytes.into());
8124
8125 if let common::Retry::After(d) =
8126 dlg.http_failure(&response, error.as_ref().ok())
8127 {
8128 sleep(d).await;
8129 continue;
8130 }
8131
8132 dlg.finished(false);
8133
8134 return Err(match error {
8135 Ok(value) => common::Error::BadRequest(value),
8136 _ => common::Error::Failure(response),
8137 });
8138 }
8139 let response = {
8140 let bytes = common::to_bytes(body).await.unwrap_or_default();
8141 let encoded = common::to_string(&bytes);
8142 match serde_json::from_str(&encoded) {
8143 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8144 Err(error) => {
8145 dlg.response_json_decode_error(&encoded, &error);
8146 return Err(common::Error::JsonDecodeError(
8147 encoded.to_string(),
8148 error,
8149 ));
8150 }
8151 }
8152 };
8153
8154 dlg.finished(true);
8155 return Ok(response);
8156 }
8157 }
8158 }
8159 }
8160
8161 /// Required. The name of the job to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
8162 ///
8163 /// Sets the *name* path property to the given value.
8164 ///
8165 /// Even though the property as already been set when instantiating this call,
8166 /// we provide this method for API completeness.
8167 pub fn name(mut self, new_value: &str) -> NamespaceJobGetCall<'a, C> {
8168 self._name = new_value.to_string();
8169 self
8170 }
8171 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8172 /// while executing the actual API request.
8173 ///
8174 /// ````text
8175 /// It should be used to handle progress information, and to implement a certain level of resilience.
8176 /// ````
8177 ///
8178 /// Sets the *delegate* property to the given value.
8179 pub fn delegate(
8180 mut self,
8181 new_value: &'a mut dyn common::Delegate,
8182 ) -> NamespaceJobGetCall<'a, C> {
8183 self._delegate = Some(new_value);
8184 self
8185 }
8186
8187 /// Set any additional parameter of the query string used in the request.
8188 /// It should be used to set parameters which are not yet available through their own
8189 /// setters.
8190 ///
8191 /// Please note that this method must not be used to set any of the known parameters
8192 /// which have their own setter method. If done anyway, the request will fail.
8193 ///
8194 /// # Additional Parameters
8195 ///
8196 /// * *$.xgafv* (query-string) - V1 error format.
8197 /// * *access_token* (query-string) - OAuth access token.
8198 /// * *alt* (query-string) - Data format for response.
8199 /// * *callback* (query-string) - JSONP
8200 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8201 /// * *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.
8202 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8203 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8204 /// * *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.
8205 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8206 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8207 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobGetCall<'a, C>
8208 where
8209 T: AsRef<str>,
8210 {
8211 self._additional_params
8212 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8213 self
8214 }
8215
8216 /// Identifies the authorization scope for the method you are building.
8217 ///
8218 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8219 /// [`Scope::CloudPlatform`].
8220 ///
8221 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8222 /// tokens for more than one scope.
8223 ///
8224 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8225 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8226 /// sufficient, a read-write scope will do as well.
8227 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobGetCall<'a, C>
8228 where
8229 St: AsRef<str>,
8230 {
8231 self._scopes.insert(String::from(scope.as_ref()));
8232 self
8233 }
8234 /// Identifies the authorization scope(s) for the method you are building.
8235 ///
8236 /// See [`Self::add_scope()`] for details.
8237 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobGetCall<'a, C>
8238 where
8239 I: IntoIterator<Item = St>,
8240 St: AsRef<str>,
8241 {
8242 self._scopes
8243 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8244 self
8245 }
8246
8247 /// Removes all scopes, and no default scope will be used either.
8248 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8249 /// for details).
8250 pub fn clear_scopes(mut self) -> NamespaceJobGetCall<'a, C> {
8251 self._scopes.clear();
8252 self
8253 }
8254}
8255
8256/// List jobs. Results are sorted by creation time, descending.
8257///
8258/// A builder for the *jobs.list* method supported by a *namespace* resource.
8259/// It is not used directly, but through a [`NamespaceMethods`] instance.
8260///
8261/// # Example
8262///
8263/// Instantiate a resource method builder
8264///
8265/// ```test_harness,no_run
8266/// # extern crate hyper;
8267/// # extern crate hyper_rustls;
8268/// # extern crate google_run1 as run1;
8269/// # async fn dox() {
8270/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8271///
8272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8274/// # secret,
8275/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8276/// # ).build().await.unwrap();
8277///
8278/// # let client = hyper_util::client::legacy::Client::builder(
8279/// # hyper_util::rt::TokioExecutor::new()
8280/// # )
8281/// # .build(
8282/// # hyper_rustls::HttpsConnectorBuilder::new()
8283/// # .with_native_roots()
8284/// # .unwrap()
8285/// # .https_or_http()
8286/// # .enable_http1()
8287/// # .build()
8288/// # );
8289/// # let mut hub = CloudRun::new(client, auth);
8290/// // You can configure optional parameters by calling the respective setters at will, and
8291/// // execute the final call using `doit()`.
8292/// // Values shown here are possibly random and not representative !
8293/// let result = hub.namespaces().jobs_list("parent")
8294/// .watch(true)
8295/// .resource_version("ipsum")
8296/// .limit(-23)
8297/// .label_selector("takimata")
8298/// .include_uninitialized(true)
8299/// .field_selector("voluptua.")
8300/// .continue_("et")
8301/// .doit().await;
8302/// # }
8303/// ```
8304pub struct NamespaceJobListCall<'a, C>
8305where
8306 C: 'a,
8307{
8308 hub: &'a CloudRun<C>,
8309 _parent: String,
8310 _watch: Option<bool>,
8311 _resource_version: Option<String>,
8312 _limit: Option<i32>,
8313 _label_selector: Option<String>,
8314 _include_uninitialized: Option<bool>,
8315 _field_selector: Option<String>,
8316 _continue_: Option<String>,
8317 _delegate: Option<&'a mut dyn common::Delegate>,
8318 _additional_params: HashMap<String, String>,
8319 _scopes: BTreeSet<String>,
8320}
8321
8322impl<'a, C> common::CallBuilder for NamespaceJobListCall<'a, C> {}
8323
8324impl<'a, C> NamespaceJobListCall<'a, C>
8325where
8326 C: common::Connector,
8327{
8328 /// Perform the operation you have build so far.
8329 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
8330 use std::borrow::Cow;
8331 use std::io::{Read, Seek};
8332
8333 use common::{url::Params, ToParts};
8334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8335
8336 let mut dd = common::DefaultDelegate;
8337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8338 dlg.begin(common::MethodInfo {
8339 id: "run.namespaces.jobs.list",
8340 http_method: hyper::Method::GET,
8341 });
8342
8343 for &field in [
8344 "alt",
8345 "parent",
8346 "watch",
8347 "resourceVersion",
8348 "limit",
8349 "labelSelector",
8350 "includeUninitialized",
8351 "fieldSelector",
8352 "continue",
8353 ]
8354 .iter()
8355 {
8356 if self._additional_params.contains_key(field) {
8357 dlg.finished(false);
8358 return Err(common::Error::FieldClash(field));
8359 }
8360 }
8361
8362 let mut params = Params::with_capacity(10 + self._additional_params.len());
8363 params.push("parent", self._parent);
8364 if let Some(value) = self._watch.as_ref() {
8365 params.push("watch", value.to_string());
8366 }
8367 if let Some(value) = self._resource_version.as_ref() {
8368 params.push("resourceVersion", value);
8369 }
8370 if let Some(value) = self._limit.as_ref() {
8371 params.push("limit", value.to_string());
8372 }
8373 if let Some(value) = self._label_selector.as_ref() {
8374 params.push("labelSelector", value);
8375 }
8376 if let Some(value) = self._include_uninitialized.as_ref() {
8377 params.push("includeUninitialized", value.to_string());
8378 }
8379 if let Some(value) = self._field_selector.as_ref() {
8380 params.push("fieldSelector", value);
8381 }
8382 if let Some(value) = self._continue_.as_ref() {
8383 params.push("continue", value);
8384 }
8385
8386 params.extend(self._additional_params.iter());
8387
8388 params.push("alt", "json");
8389 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/jobs";
8390 if self._scopes.is_empty() {
8391 self._scopes
8392 .insert(Scope::CloudPlatform.as_ref().to_string());
8393 }
8394
8395 #[allow(clippy::single_element_loop)]
8396 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8397 url = params.uri_replacement(url, param_name, find_this, true);
8398 }
8399 {
8400 let to_remove = ["parent"];
8401 params.remove_params(&to_remove);
8402 }
8403
8404 let url = params.parse_with_url(&url);
8405
8406 loop {
8407 let token = match self
8408 .hub
8409 .auth
8410 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8411 .await
8412 {
8413 Ok(token) => token,
8414 Err(e) => match dlg.token(e) {
8415 Ok(token) => token,
8416 Err(e) => {
8417 dlg.finished(false);
8418 return Err(common::Error::MissingToken(e));
8419 }
8420 },
8421 };
8422 let mut req_result = {
8423 let client = &self.hub.client;
8424 dlg.pre_request();
8425 let mut req_builder = hyper::Request::builder()
8426 .method(hyper::Method::GET)
8427 .uri(url.as_str())
8428 .header(USER_AGENT, self.hub._user_agent.clone());
8429
8430 if let Some(token) = token.as_ref() {
8431 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8432 }
8433
8434 let request = req_builder
8435 .header(CONTENT_LENGTH, 0_u64)
8436 .body(common::to_body::<String>(None));
8437
8438 client.request(request.unwrap()).await
8439 };
8440
8441 match req_result {
8442 Err(err) => {
8443 if let common::Retry::After(d) = dlg.http_error(&err) {
8444 sleep(d).await;
8445 continue;
8446 }
8447 dlg.finished(false);
8448 return Err(common::Error::HttpError(err));
8449 }
8450 Ok(res) => {
8451 let (mut parts, body) = res.into_parts();
8452 let mut body = common::Body::new(body);
8453 if !parts.status.is_success() {
8454 let bytes = common::to_bytes(body).await.unwrap_or_default();
8455 let error = serde_json::from_str(&common::to_string(&bytes));
8456 let response = common::to_response(parts, bytes.into());
8457
8458 if let common::Retry::After(d) =
8459 dlg.http_failure(&response, error.as_ref().ok())
8460 {
8461 sleep(d).await;
8462 continue;
8463 }
8464
8465 dlg.finished(false);
8466
8467 return Err(match error {
8468 Ok(value) => common::Error::BadRequest(value),
8469 _ => common::Error::Failure(response),
8470 });
8471 }
8472 let response = {
8473 let bytes = common::to_bytes(body).await.unwrap_or_default();
8474 let encoded = common::to_string(&bytes);
8475 match serde_json::from_str(&encoded) {
8476 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8477 Err(error) => {
8478 dlg.response_json_decode_error(&encoded, &error);
8479 return Err(common::Error::JsonDecodeError(
8480 encoded.to_string(),
8481 error,
8482 ));
8483 }
8484 }
8485 };
8486
8487 dlg.finished(true);
8488 return Ok(response);
8489 }
8490 }
8491 }
8492 }
8493
8494 /// Required. The namespace from which the jobs should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
8495 ///
8496 /// Sets the *parent* path property to the given value.
8497 ///
8498 /// Even though the property as already been set when instantiating this call,
8499 /// we provide this method for API completeness.
8500 pub fn parent(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
8501 self._parent = new_value.to_string();
8502 self
8503 }
8504 /// Optional. Not supported by Cloud Run.
8505 ///
8506 /// Sets the *watch* query property to the given value.
8507 pub fn watch(mut self, new_value: bool) -> NamespaceJobListCall<'a, C> {
8508 self._watch = Some(new_value);
8509 self
8510 }
8511 /// Optional. Not supported by Cloud Run.
8512 ///
8513 /// Sets the *resource version* query property to the given value.
8514 pub fn resource_version(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
8515 self._resource_version = Some(new_value.to_string());
8516 self
8517 }
8518 /// Optional. The maximum number of records that should be returned.
8519 ///
8520 /// Sets the *limit* query property to the given value.
8521 pub fn limit(mut self, new_value: i32) -> NamespaceJobListCall<'a, C> {
8522 self._limit = Some(new_value);
8523 self
8524 }
8525 /// Optional. Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
8526 ///
8527 /// Sets the *label selector* query property to the given value.
8528 pub fn label_selector(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
8529 self._label_selector = Some(new_value.to_string());
8530 self
8531 }
8532 /// Optional. Not supported by Cloud Run.
8533 ///
8534 /// Sets the *include uninitialized* query property to the given value.
8535 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceJobListCall<'a, C> {
8536 self._include_uninitialized = Some(new_value);
8537 self
8538 }
8539 /// Optional. Not supported by Cloud Run.
8540 ///
8541 /// Sets the *field selector* query property to the given value.
8542 pub fn field_selector(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
8543 self._field_selector = Some(new_value.to_string());
8544 self
8545 }
8546 /// Optional. Optional encoded string to continue paging.
8547 ///
8548 /// Sets the *continue* query property to the given value.
8549 pub fn continue_(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
8550 self._continue_ = Some(new_value.to_string());
8551 self
8552 }
8553 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8554 /// while executing the actual API request.
8555 ///
8556 /// ````text
8557 /// It should be used to handle progress information, and to implement a certain level of resilience.
8558 /// ````
8559 ///
8560 /// Sets the *delegate* property to the given value.
8561 pub fn delegate(
8562 mut self,
8563 new_value: &'a mut dyn common::Delegate,
8564 ) -> NamespaceJobListCall<'a, C> {
8565 self._delegate = Some(new_value);
8566 self
8567 }
8568
8569 /// Set any additional parameter of the query string used in the request.
8570 /// It should be used to set parameters which are not yet available through their own
8571 /// setters.
8572 ///
8573 /// Please note that this method must not be used to set any of the known parameters
8574 /// which have their own setter method. If done anyway, the request will fail.
8575 ///
8576 /// # Additional Parameters
8577 ///
8578 /// * *$.xgafv* (query-string) - V1 error format.
8579 /// * *access_token* (query-string) - OAuth access token.
8580 /// * *alt* (query-string) - Data format for response.
8581 /// * *callback* (query-string) - JSONP
8582 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8583 /// * *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.
8584 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8585 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8586 /// * *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.
8587 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8588 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8589 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobListCall<'a, C>
8590 where
8591 T: AsRef<str>,
8592 {
8593 self._additional_params
8594 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8595 self
8596 }
8597
8598 /// Identifies the authorization scope for the method you are building.
8599 ///
8600 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8601 /// [`Scope::CloudPlatform`].
8602 ///
8603 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8604 /// tokens for more than one scope.
8605 ///
8606 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8607 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8608 /// sufficient, a read-write scope will do as well.
8609 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobListCall<'a, C>
8610 where
8611 St: AsRef<str>,
8612 {
8613 self._scopes.insert(String::from(scope.as_ref()));
8614 self
8615 }
8616 /// Identifies the authorization scope(s) for the method you are building.
8617 ///
8618 /// See [`Self::add_scope()`] for details.
8619 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobListCall<'a, C>
8620 where
8621 I: IntoIterator<Item = St>,
8622 St: AsRef<str>,
8623 {
8624 self._scopes
8625 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8626 self
8627 }
8628
8629 /// Removes all scopes, and no default scope will be used either.
8630 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8631 /// for details).
8632 pub fn clear_scopes(mut self) -> NamespaceJobListCall<'a, C> {
8633 self._scopes.clear();
8634 self
8635 }
8636}
8637
8638/// Replace a job. Only the spec and metadata labels and annotations are modifiable. After the Replace request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
8639///
8640/// A builder for the *jobs.replaceJob* method supported by a *namespace* resource.
8641/// It is not used directly, but through a [`NamespaceMethods`] instance.
8642///
8643/// # Example
8644///
8645/// Instantiate a resource method builder
8646///
8647/// ```test_harness,no_run
8648/// # extern crate hyper;
8649/// # extern crate hyper_rustls;
8650/// # extern crate google_run1 as run1;
8651/// use run1::api::Job;
8652/// # async fn dox() {
8653/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8654///
8655/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8656/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8657/// # secret,
8658/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8659/// # ).build().await.unwrap();
8660///
8661/// # let client = hyper_util::client::legacy::Client::builder(
8662/// # hyper_util::rt::TokioExecutor::new()
8663/// # )
8664/// # .build(
8665/// # hyper_rustls::HttpsConnectorBuilder::new()
8666/// # .with_native_roots()
8667/// # .unwrap()
8668/// # .https_or_http()
8669/// # .enable_http1()
8670/// # .build()
8671/// # );
8672/// # let mut hub = CloudRun::new(client, auth);
8673/// // As the method needs a request, you would usually fill it with the desired information
8674/// // into the respective structure. Some of the parts shown here might not be applicable !
8675/// // Values shown here are possibly random and not representative !
8676/// let mut req = Job::default();
8677///
8678/// // You can configure optional parameters by calling the respective setters at will, and
8679/// // execute the final call using `doit()`.
8680/// // Values shown here are possibly random and not representative !
8681/// let result = hub.namespaces().jobs_replace_job(req, "name")
8682/// .doit().await;
8683/// # }
8684/// ```
8685pub struct NamespaceJobReplaceJobCall<'a, C>
8686where
8687 C: 'a,
8688{
8689 hub: &'a CloudRun<C>,
8690 _request: Job,
8691 _name: String,
8692 _delegate: Option<&'a mut dyn common::Delegate>,
8693 _additional_params: HashMap<String, String>,
8694 _scopes: BTreeSet<String>,
8695}
8696
8697impl<'a, C> common::CallBuilder for NamespaceJobReplaceJobCall<'a, C> {}
8698
8699impl<'a, C> NamespaceJobReplaceJobCall<'a, C>
8700where
8701 C: common::Connector,
8702{
8703 /// Perform the operation you have build so far.
8704 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
8705 use std::borrow::Cow;
8706 use std::io::{Read, Seek};
8707
8708 use common::{url::Params, ToParts};
8709 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8710
8711 let mut dd = common::DefaultDelegate;
8712 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8713 dlg.begin(common::MethodInfo {
8714 id: "run.namespaces.jobs.replaceJob",
8715 http_method: hyper::Method::PUT,
8716 });
8717
8718 for &field in ["alt", "name"].iter() {
8719 if self._additional_params.contains_key(field) {
8720 dlg.finished(false);
8721 return Err(common::Error::FieldClash(field));
8722 }
8723 }
8724
8725 let mut params = Params::with_capacity(4 + self._additional_params.len());
8726 params.push("name", self._name);
8727
8728 params.extend(self._additional_params.iter());
8729
8730 params.push("alt", "json");
8731 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
8732 if self._scopes.is_empty() {
8733 self._scopes
8734 .insert(Scope::CloudPlatform.as_ref().to_string());
8735 }
8736
8737 #[allow(clippy::single_element_loop)]
8738 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8739 url = params.uri_replacement(url, param_name, find_this, true);
8740 }
8741 {
8742 let to_remove = ["name"];
8743 params.remove_params(&to_remove);
8744 }
8745
8746 let url = params.parse_with_url(&url);
8747
8748 let mut json_mime_type = mime::APPLICATION_JSON;
8749 let mut request_value_reader = {
8750 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8751 common::remove_json_null_values(&mut value);
8752 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8753 serde_json::to_writer(&mut dst, &value).unwrap();
8754 dst
8755 };
8756 let request_size = request_value_reader
8757 .seek(std::io::SeekFrom::End(0))
8758 .unwrap();
8759 request_value_reader
8760 .seek(std::io::SeekFrom::Start(0))
8761 .unwrap();
8762
8763 loop {
8764 let token = match self
8765 .hub
8766 .auth
8767 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8768 .await
8769 {
8770 Ok(token) => token,
8771 Err(e) => match dlg.token(e) {
8772 Ok(token) => token,
8773 Err(e) => {
8774 dlg.finished(false);
8775 return Err(common::Error::MissingToken(e));
8776 }
8777 },
8778 };
8779 request_value_reader
8780 .seek(std::io::SeekFrom::Start(0))
8781 .unwrap();
8782 let mut req_result = {
8783 let client = &self.hub.client;
8784 dlg.pre_request();
8785 let mut req_builder = hyper::Request::builder()
8786 .method(hyper::Method::PUT)
8787 .uri(url.as_str())
8788 .header(USER_AGENT, self.hub._user_agent.clone());
8789
8790 if let Some(token) = token.as_ref() {
8791 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8792 }
8793
8794 let request = req_builder
8795 .header(CONTENT_TYPE, json_mime_type.to_string())
8796 .header(CONTENT_LENGTH, request_size as u64)
8797 .body(common::to_body(
8798 request_value_reader.get_ref().clone().into(),
8799 ));
8800
8801 client.request(request.unwrap()).await
8802 };
8803
8804 match req_result {
8805 Err(err) => {
8806 if let common::Retry::After(d) = dlg.http_error(&err) {
8807 sleep(d).await;
8808 continue;
8809 }
8810 dlg.finished(false);
8811 return Err(common::Error::HttpError(err));
8812 }
8813 Ok(res) => {
8814 let (mut parts, body) = res.into_parts();
8815 let mut body = common::Body::new(body);
8816 if !parts.status.is_success() {
8817 let bytes = common::to_bytes(body).await.unwrap_or_default();
8818 let error = serde_json::from_str(&common::to_string(&bytes));
8819 let response = common::to_response(parts, bytes.into());
8820
8821 if let common::Retry::After(d) =
8822 dlg.http_failure(&response, error.as_ref().ok())
8823 {
8824 sleep(d).await;
8825 continue;
8826 }
8827
8828 dlg.finished(false);
8829
8830 return Err(match error {
8831 Ok(value) => common::Error::BadRequest(value),
8832 _ => common::Error::Failure(response),
8833 });
8834 }
8835 let response = {
8836 let bytes = common::to_bytes(body).await.unwrap_or_default();
8837 let encoded = common::to_string(&bytes);
8838 match serde_json::from_str(&encoded) {
8839 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8840 Err(error) => {
8841 dlg.response_json_decode_error(&encoded, &error);
8842 return Err(common::Error::JsonDecodeError(
8843 encoded.to_string(),
8844 error,
8845 ));
8846 }
8847 }
8848 };
8849
8850 dlg.finished(true);
8851 return Ok(response);
8852 }
8853 }
8854 }
8855 }
8856
8857 ///
8858 /// Sets the *request* property to the given value.
8859 ///
8860 /// Even though the property as already been set when instantiating this call,
8861 /// we provide this method for API completeness.
8862 pub fn request(mut self, new_value: Job) -> NamespaceJobReplaceJobCall<'a, C> {
8863 self._request = new_value;
8864 self
8865 }
8866 /// Required. The name of the job being replaced. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
8867 ///
8868 /// Sets the *name* path property to the given value.
8869 ///
8870 /// Even though the property as already been set when instantiating this call,
8871 /// we provide this method for API completeness.
8872 pub fn name(mut self, new_value: &str) -> NamespaceJobReplaceJobCall<'a, C> {
8873 self._name = new_value.to_string();
8874 self
8875 }
8876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8877 /// while executing the actual API request.
8878 ///
8879 /// ````text
8880 /// It should be used to handle progress information, and to implement a certain level of resilience.
8881 /// ````
8882 ///
8883 /// Sets the *delegate* property to the given value.
8884 pub fn delegate(
8885 mut self,
8886 new_value: &'a mut dyn common::Delegate,
8887 ) -> NamespaceJobReplaceJobCall<'a, C> {
8888 self._delegate = Some(new_value);
8889 self
8890 }
8891
8892 /// Set any additional parameter of the query string used in the request.
8893 /// It should be used to set parameters which are not yet available through their own
8894 /// setters.
8895 ///
8896 /// Please note that this method must not be used to set any of the known parameters
8897 /// which have their own setter method. If done anyway, the request will fail.
8898 ///
8899 /// # Additional Parameters
8900 ///
8901 /// * *$.xgafv* (query-string) - V1 error format.
8902 /// * *access_token* (query-string) - OAuth access token.
8903 /// * *alt* (query-string) - Data format for response.
8904 /// * *callback* (query-string) - JSONP
8905 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8906 /// * *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.
8907 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8908 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8909 /// * *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.
8910 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8911 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8912 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobReplaceJobCall<'a, C>
8913 where
8914 T: AsRef<str>,
8915 {
8916 self._additional_params
8917 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8918 self
8919 }
8920
8921 /// Identifies the authorization scope for the method you are building.
8922 ///
8923 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8924 /// [`Scope::CloudPlatform`].
8925 ///
8926 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8927 /// tokens for more than one scope.
8928 ///
8929 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8930 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8931 /// sufficient, a read-write scope will do as well.
8932 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobReplaceJobCall<'a, C>
8933 where
8934 St: AsRef<str>,
8935 {
8936 self._scopes.insert(String::from(scope.as_ref()));
8937 self
8938 }
8939 /// Identifies the authorization scope(s) for the method you are building.
8940 ///
8941 /// See [`Self::add_scope()`] for details.
8942 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobReplaceJobCall<'a, C>
8943 where
8944 I: IntoIterator<Item = St>,
8945 St: AsRef<str>,
8946 {
8947 self._scopes
8948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8949 self
8950 }
8951
8952 /// Removes all scopes, and no default scope will be used either.
8953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8954 /// for details).
8955 pub fn clear_scopes(mut self) -> NamespaceJobReplaceJobCall<'a, C> {
8956 self._scopes.clear();
8957 self
8958 }
8959}
8960
8961/// Trigger creation of a new execution of this job.
8962///
8963/// A builder for the *jobs.run* method supported by a *namespace* resource.
8964/// It is not used directly, but through a [`NamespaceMethods`] instance.
8965///
8966/// # Example
8967///
8968/// Instantiate a resource method builder
8969///
8970/// ```test_harness,no_run
8971/// # extern crate hyper;
8972/// # extern crate hyper_rustls;
8973/// # extern crate google_run1 as run1;
8974/// use run1::api::RunJobRequest;
8975/// # async fn dox() {
8976/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8977///
8978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8979/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8980/// # secret,
8981/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8982/// # ).build().await.unwrap();
8983///
8984/// # let client = hyper_util::client::legacy::Client::builder(
8985/// # hyper_util::rt::TokioExecutor::new()
8986/// # )
8987/// # .build(
8988/// # hyper_rustls::HttpsConnectorBuilder::new()
8989/// # .with_native_roots()
8990/// # .unwrap()
8991/// # .https_or_http()
8992/// # .enable_http1()
8993/// # .build()
8994/// # );
8995/// # let mut hub = CloudRun::new(client, auth);
8996/// // As the method needs a request, you would usually fill it with the desired information
8997/// // into the respective structure. Some of the parts shown here might not be applicable !
8998/// // Values shown here are possibly random and not representative !
8999/// let mut req = RunJobRequest::default();
9000///
9001/// // You can configure optional parameters by calling the respective setters at will, and
9002/// // execute the final call using `doit()`.
9003/// // Values shown here are possibly random and not representative !
9004/// let result = hub.namespaces().jobs_run(req, "name")
9005/// .doit().await;
9006/// # }
9007/// ```
9008pub struct NamespaceJobRunCall<'a, C>
9009where
9010 C: 'a,
9011{
9012 hub: &'a CloudRun<C>,
9013 _request: RunJobRequest,
9014 _name: String,
9015 _delegate: Option<&'a mut dyn common::Delegate>,
9016 _additional_params: HashMap<String, String>,
9017 _scopes: BTreeSet<String>,
9018}
9019
9020impl<'a, C> common::CallBuilder for NamespaceJobRunCall<'a, C> {}
9021
9022impl<'a, C> NamespaceJobRunCall<'a, C>
9023where
9024 C: common::Connector,
9025{
9026 /// Perform the operation you have build so far.
9027 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
9028 use std::borrow::Cow;
9029 use std::io::{Read, Seek};
9030
9031 use common::{url::Params, ToParts};
9032 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9033
9034 let mut dd = common::DefaultDelegate;
9035 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9036 dlg.begin(common::MethodInfo {
9037 id: "run.namespaces.jobs.run",
9038 http_method: hyper::Method::POST,
9039 });
9040
9041 for &field in ["alt", "name"].iter() {
9042 if self._additional_params.contains_key(field) {
9043 dlg.finished(false);
9044 return Err(common::Error::FieldClash(field));
9045 }
9046 }
9047
9048 let mut params = Params::with_capacity(4 + self._additional_params.len());
9049 params.push("name", self._name);
9050
9051 params.extend(self._additional_params.iter());
9052
9053 params.push("alt", "json");
9054 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}:run";
9055 if self._scopes.is_empty() {
9056 self._scopes
9057 .insert(Scope::CloudPlatform.as_ref().to_string());
9058 }
9059
9060 #[allow(clippy::single_element_loop)]
9061 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9062 url = params.uri_replacement(url, param_name, find_this, true);
9063 }
9064 {
9065 let to_remove = ["name"];
9066 params.remove_params(&to_remove);
9067 }
9068
9069 let url = params.parse_with_url(&url);
9070
9071 let mut json_mime_type = mime::APPLICATION_JSON;
9072 let mut request_value_reader = {
9073 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9074 common::remove_json_null_values(&mut value);
9075 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9076 serde_json::to_writer(&mut dst, &value).unwrap();
9077 dst
9078 };
9079 let request_size = request_value_reader
9080 .seek(std::io::SeekFrom::End(0))
9081 .unwrap();
9082 request_value_reader
9083 .seek(std::io::SeekFrom::Start(0))
9084 .unwrap();
9085
9086 loop {
9087 let token = match self
9088 .hub
9089 .auth
9090 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9091 .await
9092 {
9093 Ok(token) => token,
9094 Err(e) => match dlg.token(e) {
9095 Ok(token) => token,
9096 Err(e) => {
9097 dlg.finished(false);
9098 return Err(common::Error::MissingToken(e));
9099 }
9100 },
9101 };
9102 request_value_reader
9103 .seek(std::io::SeekFrom::Start(0))
9104 .unwrap();
9105 let mut req_result = {
9106 let client = &self.hub.client;
9107 dlg.pre_request();
9108 let mut req_builder = hyper::Request::builder()
9109 .method(hyper::Method::POST)
9110 .uri(url.as_str())
9111 .header(USER_AGENT, self.hub._user_agent.clone());
9112
9113 if let Some(token) = token.as_ref() {
9114 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9115 }
9116
9117 let request = req_builder
9118 .header(CONTENT_TYPE, json_mime_type.to_string())
9119 .header(CONTENT_LENGTH, request_size as u64)
9120 .body(common::to_body(
9121 request_value_reader.get_ref().clone().into(),
9122 ));
9123
9124 client.request(request.unwrap()).await
9125 };
9126
9127 match req_result {
9128 Err(err) => {
9129 if let common::Retry::After(d) = dlg.http_error(&err) {
9130 sleep(d).await;
9131 continue;
9132 }
9133 dlg.finished(false);
9134 return Err(common::Error::HttpError(err));
9135 }
9136 Ok(res) => {
9137 let (mut parts, body) = res.into_parts();
9138 let mut body = common::Body::new(body);
9139 if !parts.status.is_success() {
9140 let bytes = common::to_bytes(body).await.unwrap_or_default();
9141 let error = serde_json::from_str(&common::to_string(&bytes));
9142 let response = common::to_response(parts, bytes.into());
9143
9144 if let common::Retry::After(d) =
9145 dlg.http_failure(&response, error.as_ref().ok())
9146 {
9147 sleep(d).await;
9148 continue;
9149 }
9150
9151 dlg.finished(false);
9152
9153 return Err(match error {
9154 Ok(value) => common::Error::BadRequest(value),
9155 _ => common::Error::Failure(response),
9156 });
9157 }
9158 let response = {
9159 let bytes = common::to_bytes(body).await.unwrap_or_default();
9160 let encoded = common::to_string(&bytes);
9161 match serde_json::from_str(&encoded) {
9162 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9163 Err(error) => {
9164 dlg.response_json_decode_error(&encoded, &error);
9165 return Err(common::Error::JsonDecodeError(
9166 encoded.to_string(),
9167 error,
9168 ));
9169 }
9170 }
9171 };
9172
9173 dlg.finished(true);
9174 return Ok(response);
9175 }
9176 }
9177 }
9178 }
9179
9180 ///
9181 /// Sets the *request* property to the given value.
9182 ///
9183 /// Even though the property as already been set when instantiating this call,
9184 /// we provide this method for API completeness.
9185 pub fn request(mut self, new_value: RunJobRequest) -> NamespaceJobRunCall<'a, C> {
9186 self._request = new_value;
9187 self
9188 }
9189 /// Required. The name of the job to run. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
9190 ///
9191 /// Sets the *name* path property to the given value.
9192 ///
9193 /// Even though the property as already been set when instantiating this call,
9194 /// we provide this method for API completeness.
9195 pub fn name(mut self, new_value: &str) -> NamespaceJobRunCall<'a, C> {
9196 self._name = new_value.to_string();
9197 self
9198 }
9199 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9200 /// while executing the actual API request.
9201 ///
9202 /// ````text
9203 /// It should be used to handle progress information, and to implement a certain level of resilience.
9204 /// ````
9205 ///
9206 /// Sets the *delegate* property to the given value.
9207 pub fn delegate(
9208 mut self,
9209 new_value: &'a mut dyn common::Delegate,
9210 ) -> NamespaceJobRunCall<'a, C> {
9211 self._delegate = Some(new_value);
9212 self
9213 }
9214
9215 /// Set any additional parameter of the query string used in the request.
9216 /// It should be used to set parameters which are not yet available through their own
9217 /// setters.
9218 ///
9219 /// Please note that this method must not be used to set any of the known parameters
9220 /// which have their own setter method. If done anyway, the request will fail.
9221 ///
9222 /// # Additional Parameters
9223 ///
9224 /// * *$.xgafv* (query-string) - V1 error format.
9225 /// * *access_token* (query-string) - OAuth access token.
9226 /// * *alt* (query-string) - Data format for response.
9227 /// * *callback* (query-string) - JSONP
9228 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9229 /// * *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.
9230 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9231 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9232 /// * *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.
9233 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9234 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9235 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobRunCall<'a, C>
9236 where
9237 T: AsRef<str>,
9238 {
9239 self._additional_params
9240 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9241 self
9242 }
9243
9244 /// Identifies the authorization scope for the method you are building.
9245 ///
9246 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9247 /// [`Scope::CloudPlatform`].
9248 ///
9249 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9250 /// tokens for more than one scope.
9251 ///
9252 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9253 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9254 /// sufficient, a read-write scope will do as well.
9255 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobRunCall<'a, C>
9256 where
9257 St: AsRef<str>,
9258 {
9259 self._scopes.insert(String::from(scope.as_ref()));
9260 self
9261 }
9262 /// Identifies the authorization scope(s) for the method you are building.
9263 ///
9264 /// See [`Self::add_scope()`] for details.
9265 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobRunCall<'a, C>
9266 where
9267 I: IntoIterator<Item = St>,
9268 St: AsRef<str>,
9269 {
9270 self._scopes
9271 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9272 self
9273 }
9274
9275 /// Removes all scopes, and no default scope will be used either.
9276 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9277 /// for details).
9278 pub fn clear_scopes(mut self) -> NamespaceJobRunCall<'a, C> {
9279 self._scopes.clear();
9280 self
9281 }
9282}
9283
9284/// Delete a revision.
9285///
9286/// A builder for the *revisions.delete* method supported by a *namespace* resource.
9287/// It is not used directly, but through a [`NamespaceMethods`] instance.
9288///
9289/// # Example
9290///
9291/// Instantiate a resource method builder
9292///
9293/// ```test_harness,no_run
9294/// # extern crate hyper;
9295/// # extern crate hyper_rustls;
9296/// # extern crate google_run1 as run1;
9297/// # async fn dox() {
9298/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9299///
9300/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9301/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9302/// # secret,
9303/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9304/// # ).build().await.unwrap();
9305///
9306/// # let client = hyper_util::client::legacy::Client::builder(
9307/// # hyper_util::rt::TokioExecutor::new()
9308/// # )
9309/// # .build(
9310/// # hyper_rustls::HttpsConnectorBuilder::new()
9311/// # .with_native_roots()
9312/// # .unwrap()
9313/// # .https_or_http()
9314/// # .enable_http1()
9315/// # .build()
9316/// # );
9317/// # let mut hub = CloudRun::new(client, auth);
9318/// // You can configure optional parameters by calling the respective setters at will, and
9319/// // execute the final call using `doit()`.
9320/// // Values shown here are possibly random and not representative !
9321/// let result = hub.namespaces().revisions_delete("name")
9322/// .propagation_policy("sed")
9323/// .kind("takimata")
9324/// .dry_run("dolores")
9325/// .api_version("gubergren")
9326/// .doit().await;
9327/// # }
9328/// ```
9329pub struct NamespaceRevisionDeleteCall<'a, C>
9330where
9331 C: 'a,
9332{
9333 hub: &'a CloudRun<C>,
9334 _name: String,
9335 _propagation_policy: Option<String>,
9336 _kind: Option<String>,
9337 _dry_run: Option<String>,
9338 _api_version: Option<String>,
9339 _delegate: Option<&'a mut dyn common::Delegate>,
9340 _additional_params: HashMap<String, String>,
9341 _scopes: BTreeSet<String>,
9342}
9343
9344impl<'a, C> common::CallBuilder for NamespaceRevisionDeleteCall<'a, C> {}
9345
9346impl<'a, C> NamespaceRevisionDeleteCall<'a, C>
9347where
9348 C: common::Connector,
9349{
9350 /// Perform the operation you have build so far.
9351 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
9352 use std::borrow::Cow;
9353 use std::io::{Read, Seek};
9354
9355 use common::{url::Params, ToParts};
9356 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9357
9358 let mut dd = common::DefaultDelegate;
9359 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9360 dlg.begin(common::MethodInfo {
9361 id: "run.namespaces.revisions.delete",
9362 http_method: hyper::Method::DELETE,
9363 });
9364
9365 for &field in [
9366 "alt",
9367 "name",
9368 "propagationPolicy",
9369 "kind",
9370 "dryRun",
9371 "apiVersion",
9372 ]
9373 .iter()
9374 {
9375 if self._additional_params.contains_key(field) {
9376 dlg.finished(false);
9377 return Err(common::Error::FieldClash(field));
9378 }
9379 }
9380
9381 let mut params = Params::with_capacity(7 + self._additional_params.len());
9382 params.push("name", self._name);
9383 if let Some(value) = self._propagation_policy.as_ref() {
9384 params.push("propagationPolicy", value);
9385 }
9386 if let Some(value) = self._kind.as_ref() {
9387 params.push("kind", value);
9388 }
9389 if let Some(value) = self._dry_run.as_ref() {
9390 params.push("dryRun", value);
9391 }
9392 if let Some(value) = self._api_version.as_ref() {
9393 params.push("apiVersion", value);
9394 }
9395
9396 params.extend(self._additional_params.iter());
9397
9398 params.push("alt", "json");
9399 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
9400 if self._scopes.is_empty() {
9401 self._scopes
9402 .insert(Scope::CloudPlatform.as_ref().to_string());
9403 }
9404
9405 #[allow(clippy::single_element_loop)]
9406 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9407 url = params.uri_replacement(url, param_name, find_this, true);
9408 }
9409 {
9410 let to_remove = ["name"];
9411 params.remove_params(&to_remove);
9412 }
9413
9414 let url = params.parse_with_url(&url);
9415
9416 loop {
9417 let token = match self
9418 .hub
9419 .auth
9420 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9421 .await
9422 {
9423 Ok(token) => token,
9424 Err(e) => match dlg.token(e) {
9425 Ok(token) => token,
9426 Err(e) => {
9427 dlg.finished(false);
9428 return Err(common::Error::MissingToken(e));
9429 }
9430 },
9431 };
9432 let mut req_result = {
9433 let client = &self.hub.client;
9434 dlg.pre_request();
9435 let mut req_builder = hyper::Request::builder()
9436 .method(hyper::Method::DELETE)
9437 .uri(url.as_str())
9438 .header(USER_AGENT, self.hub._user_agent.clone());
9439
9440 if let Some(token) = token.as_ref() {
9441 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9442 }
9443
9444 let request = req_builder
9445 .header(CONTENT_LENGTH, 0_u64)
9446 .body(common::to_body::<String>(None));
9447
9448 client.request(request.unwrap()).await
9449 };
9450
9451 match req_result {
9452 Err(err) => {
9453 if let common::Retry::After(d) = dlg.http_error(&err) {
9454 sleep(d).await;
9455 continue;
9456 }
9457 dlg.finished(false);
9458 return Err(common::Error::HttpError(err));
9459 }
9460 Ok(res) => {
9461 let (mut parts, body) = res.into_parts();
9462 let mut body = common::Body::new(body);
9463 if !parts.status.is_success() {
9464 let bytes = common::to_bytes(body).await.unwrap_or_default();
9465 let error = serde_json::from_str(&common::to_string(&bytes));
9466 let response = common::to_response(parts, bytes.into());
9467
9468 if let common::Retry::After(d) =
9469 dlg.http_failure(&response, error.as_ref().ok())
9470 {
9471 sleep(d).await;
9472 continue;
9473 }
9474
9475 dlg.finished(false);
9476
9477 return Err(match error {
9478 Ok(value) => common::Error::BadRequest(value),
9479 _ => common::Error::Failure(response),
9480 });
9481 }
9482 let response = {
9483 let bytes = common::to_bytes(body).await.unwrap_or_default();
9484 let encoded = common::to_string(&bytes);
9485 match serde_json::from_str(&encoded) {
9486 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9487 Err(error) => {
9488 dlg.response_json_decode_error(&encoded, &error);
9489 return Err(common::Error::JsonDecodeError(
9490 encoded.to_string(),
9491 error,
9492 ));
9493 }
9494 }
9495 };
9496
9497 dlg.finished(true);
9498 return Ok(response);
9499 }
9500 }
9501 }
9502 }
9503
9504 /// The name of the revision to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
9505 ///
9506 /// Sets the *name* path property to the given value.
9507 ///
9508 /// Even though the property as already been set when instantiating this call,
9509 /// we provide this method for API completeness.
9510 pub fn name(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
9511 self._name = new_value.to_string();
9512 self
9513 }
9514 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background.
9515 ///
9516 /// Sets the *propagation policy* query property to the given value.
9517 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
9518 self._propagation_policy = Some(new_value.to_string());
9519 self
9520 }
9521 /// Cloud Run currently ignores this parameter.
9522 ///
9523 /// Sets the *kind* query property to the given value.
9524 pub fn kind(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
9525 self._kind = Some(new_value.to_string());
9526 self
9527 }
9528 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
9529 ///
9530 /// Sets the *dry run* query property to the given value.
9531 pub fn dry_run(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
9532 self._dry_run = Some(new_value.to_string());
9533 self
9534 }
9535 /// Cloud Run currently ignores this parameter.
9536 ///
9537 /// Sets the *api version* query property to the given value.
9538 pub fn api_version(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
9539 self._api_version = Some(new_value.to_string());
9540 self
9541 }
9542 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9543 /// while executing the actual API request.
9544 ///
9545 /// ````text
9546 /// It should be used to handle progress information, and to implement a certain level of resilience.
9547 /// ````
9548 ///
9549 /// Sets the *delegate* property to the given value.
9550 pub fn delegate(
9551 mut self,
9552 new_value: &'a mut dyn common::Delegate,
9553 ) -> NamespaceRevisionDeleteCall<'a, C> {
9554 self._delegate = Some(new_value);
9555 self
9556 }
9557
9558 /// Set any additional parameter of the query string used in the request.
9559 /// It should be used to set parameters which are not yet available through their own
9560 /// setters.
9561 ///
9562 /// Please note that this method must not be used to set any of the known parameters
9563 /// which have their own setter method. If done anyway, the request will fail.
9564 ///
9565 /// # Additional Parameters
9566 ///
9567 /// * *$.xgafv* (query-string) - V1 error format.
9568 /// * *access_token* (query-string) - OAuth access token.
9569 /// * *alt* (query-string) - Data format for response.
9570 /// * *callback* (query-string) - JSONP
9571 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9572 /// * *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.
9573 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9574 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9575 /// * *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.
9576 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9577 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9578 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionDeleteCall<'a, C>
9579 where
9580 T: AsRef<str>,
9581 {
9582 self._additional_params
9583 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9584 self
9585 }
9586
9587 /// Identifies the authorization scope for the method you are building.
9588 ///
9589 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9590 /// [`Scope::CloudPlatform`].
9591 ///
9592 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9593 /// tokens for more than one scope.
9594 ///
9595 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9596 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9597 /// sufficient, a read-write scope will do as well.
9598 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionDeleteCall<'a, C>
9599 where
9600 St: AsRef<str>,
9601 {
9602 self._scopes.insert(String::from(scope.as_ref()));
9603 self
9604 }
9605 /// Identifies the authorization scope(s) for the method you are building.
9606 ///
9607 /// See [`Self::add_scope()`] for details.
9608 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionDeleteCall<'a, C>
9609 where
9610 I: IntoIterator<Item = St>,
9611 St: AsRef<str>,
9612 {
9613 self._scopes
9614 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9615 self
9616 }
9617
9618 /// Removes all scopes, and no default scope will be used either.
9619 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9620 /// for details).
9621 pub fn clear_scopes(mut self) -> NamespaceRevisionDeleteCall<'a, C> {
9622 self._scopes.clear();
9623 self
9624 }
9625}
9626
9627/// Get information about a revision.
9628///
9629/// A builder for the *revisions.get* method supported by a *namespace* resource.
9630/// It is not used directly, but through a [`NamespaceMethods`] instance.
9631///
9632/// # Example
9633///
9634/// Instantiate a resource method builder
9635///
9636/// ```test_harness,no_run
9637/// # extern crate hyper;
9638/// # extern crate hyper_rustls;
9639/// # extern crate google_run1 as run1;
9640/// # async fn dox() {
9641/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9642///
9643/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9644/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9645/// # secret,
9646/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9647/// # ).build().await.unwrap();
9648///
9649/// # let client = hyper_util::client::legacy::Client::builder(
9650/// # hyper_util::rt::TokioExecutor::new()
9651/// # )
9652/// # .build(
9653/// # hyper_rustls::HttpsConnectorBuilder::new()
9654/// # .with_native_roots()
9655/// # .unwrap()
9656/// # .https_or_http()
9657/// # .enable_http1()
9658/// # .build()
9659/// # );
9660/// # let mut hub = CloudRun::new(client, auth);
9661/// // You can configure optional parameters by calling the respective setters at will, and
9662/// // execute the final call using `doit()`.
9663/// // Values shown here are possibly random and not representative !
9664/// let result = hub.namespaces().revisions_get("name")
9665/// .doit().await;
9666/// # }
9667/// ```
9668pub struct NamespaceRevisionGetCall<'a, C>
9669where
9670 C: 'a,
9671{
9672 hub: &'a CloudRun<C>,
9673 _name: String,
9674 _delegate: Option<&'a mut dyn common::Delegate>,
9675 _additional_params: HashMap<String, String>,
9676 _scopes: BTreeSet<String>,
9677}
9678
9679impl<'a, C> common::CallBuilder for NamespaceRevisionGetCall<'a, C> {}
9680
9681impl<'a, C> NamespaceRevisionGetCall<'a, C>
9682where
9683 C: common::Connector,
9684{
9685 /// Perform the operation you have build so far.
9686 pub async fn doit(mut self) -> common::Result<(common::Response, Revision)> {
9687 use std::borrow::Cow;
9688 use std::io::{Read, Seek};
9689
9690 use common::{url::Params, ToParts};
9691 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9692
9693 let mut dd = common::DefaultDelegate;
9694 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9695 dlg.begin(common::MethodInfo {
9696 id: "run.namespaces.revisions.get",
9697 http_method: hyper::Method::GET,
9698 });
9699
9700 for &field in ["alt", "name"].iter() {
9701 if self._additional_params.contains_key(field) {
9702 dlg.finished(false);
9703 return Err(common::Error::FieldClash(field));
9704 }
9705 }
9706
9707 let mut params = Params::with_capacity(3 + self._additional_params.len());
9708 params.push("name", self._name);
9709
9710 params.extend(self._additional_params.iter());
9711
9712 params.push("alt", "json");
9713 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
9714 if self._scopes.is_empty() {
9715 self._scopes
9716 .insert(Scope::CloudPlatform.as_ref().to_string());
9717 }
9718
9719 #[allow(clippy::single_element_loop)]
9720 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9721 url = params.uri_replacement(url, param_name, find_this, true);
9722 }
9723 {
9724 let to_remove = ["name"];
9725 params.remove_params(&to_remove);
9726 }
9727
9728 let url = params.parse_with_url(&url);
9729
9730 loop {
9731 let token = match self
9732 .hub
9733 .auth
9734 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9735 .await
9736 {
9737 Ok(token) => token,
9738 Err(e) => match dlg.token(e) {
9739 Ok(token) => token,
9740 Err(e) => {
9741 dlg.finished(false);
9742 return Err(common::Error::MissingToken(e));
9743 }
9744 },
9745 };
9746 let mut req_result = {
9747 let client = &self.hub.client;
9748 dlg.pre_request();
9749 let mut req_builder = hyper::Request::builder()
9750 .method(hyper::Method::GET)
9751 .uri(url.as_str())
9752 .header(USER_AGENT, self.hub._user_agent.clone());
9753
9754 if let Some(token) = token.as_ref() {
9755 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9756 }
9757
9758 let request = req_builder
9759 .header(CONTENT_LENGTH, 0_u64)
9760 .body(common::to_body::<String>(None));
9761
9762 client.request(request.unwrap()).await
9763 };
9764
9765 match req_result {
9766 Err(err) => {
9767 if let common::Retry::After(d) = dlg.http_error(&err) {
9768 sleep(d).await;
9769 continue;
9770 }
9771 dlg.finished(false);
9772 return Err(common::Error::HttpError(err));
9773 }
9774 Ok(res) => {
9775 let (mut parts, body) = res.into_parts();
9776 let mut body = common::Body::new(body);
9777 if !parts.status.is_success() {
9778 let bytes = common::to_bytes(body).await.unwrap_or_default();
9779 let error = serde_json::from_str(&common::to_string(&bytes));
9780 let response = common::to_response(parts, bytes.into());
9781
9782 if let common::Retry::After(d) =
9783 dlg.http_failure(&response, error.as_ref().ok())
9784 {
9785 sleep(d).await;
9786 continue;
9787 }
9788
9789 dlg.finished(false);
9790
9791 return Err(match error {
9792 Ok(value) => common::Error::BadRequest(value),
9793 _ => common::Error::Failure(response),
9794 });
9795 }
9796 let response = {
9797 let bytes = common::to_bytes(body).await.unwrap_or_default();
9798 let encoded = common::to_string(&bytes);
9799 match serde_json::from_str(&encoded) {
9800 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9801 Err(error) => {
9802 dlg.response_json_decode_error(&encoded, &error);
9803 return Err(common::Error::JsonDecodeError(
9804 encoded.to_string(),
9805 error,
9806 ));
9807 }
9808 }
9809 };
9810
9811 dlg.finished(true);
9812 return Ok(response);
9813 }
9814 }
9815 }
9816 }
9817
9818 /// The name of the revision to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
9819 ///
9820 /// Sets the *name* path property to the given value.
9821 ///
9822 /// Even though the property as already been set when instantiating this call,
9823 /// we provide this method for API completeness.
9824 pub fn name(mut self, new_value: &str) -> NamespaceRevisionGetCall<'a, C> {
9825 self._name = new_value.to_string();
9826 self
9827 }
9828 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9829 /// while executing the actual API request.
9830 ///
9831 /// ````text
9832 /// It should be used to handle progress information, and to implement a certain level of resilience.
9833 /// ````
9834 ///
9835 /// Sets the *delegate* property to the given value.
9836 pub fn delegate(
9837 mut self,
9838 new_value: &'a mut dyn common::Delegate,
9839 ) -> NamespaceRevisionGetCall<'a, C> {
9840 self._delegate = Some(new_value);
9841 self
9842 }
9843
9844 /// Set any additional parameter of the query string used in the request.
9845 /// It should be used to set parameters which are not yet available through their own
9846 /// setters.
9847 ///
9848 /// Please note that this method must not be used to set any of the known parameters
9849 /// which have their own setter method. If done anyway, the request will fail.
9850 ///
9851 /// # Additional Parameters
9852 ///
9853 /// * *$.xgafv* (query-string) - V1 error format.
9854 /// * *access_token* (query-string) - OAuth access token.
9855 /// * *alt* (query-string) - Data format for response.
9856 /// * *callback* (query-string) - JSONP
9857 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9858 /// * *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.
9859 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9860 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9861 /// * *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.
9862 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9863 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9864 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionGetCall<'a, C>
9865 where
9866 T: AsRef<str>,
9867 {
9868 self._additional_params
9869 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9870 self
9871 }
9872
9873 /// Identifies the authorization scope for the method you are building.
9874 ///
9875 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9876 /// [`Scope::CloudPlatform`].
9877 ///
9878 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9879 /// tokens for more than one scope.
9880 ///
9881 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9882 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9883 /// sufficient, a read-write scope will do as well.
9884 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionGetCall<'a, C>
9885 where
9886 St: AsRef<str>,
9887 {
9888 self._scopes.insert(String::from(scope.as_ref()));
9889 self
9890 }
9891 /// Identifies the authorization scope(s) for the method you are building.
9892 ///
9893 /// See [`Self::add_scope()`] for details.
9894 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionGetCall<'a, C>
9895 where
9896 I: IntoIterator<Item = St>,
9897 St: AsRef<str>,
9898 {
9899 self._scopes
9900 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9901 self
9902 }
9903
9904 /// Removes all scopes, and no default scope will be used either.
9905 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9906 /// for details).
9907 pub fn clear_scopes(mut self) -> NamespaceRevisionGetCall<'a, C> {
9908 self._scopes.clear();
9909 self
9910 }
9911}
9912
9913/// List revisions. Results are sorted by creation time, descending.
9914///
9915/// A builder for the *revisions.list* method supported by a *namespace* resource.
9916/// It is not used directly, but through a [`NamespaceMethods`] instance.
9917///
9918/// # Example
9919///
9920/// Instantiate a resource method builder
9921///
9922/// ```test_harness,no_run
9923/// # extern crate hyper;
9924/// # extern crate hyper_rustls;
9925/// # extern crate google_run1 as run1;
9926/// # async fn dox() {
9927/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9928///
9929/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9931/// # secret,
9932/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9933/// # ).build().await.unwrap();
9934///
9935/// # let client = hyper_util::client::legacy::Client::builder(
9936/// # hyper_util::rt::TokioExecutor::new()
9937/// # )
9938/// # .build(
9939/// # hyper_rustls::HttpsConnectorBuilder::new()
9940/// # .with_native_roots()
9941/// # .unwrap()
9942/// # .https_or_http()
9943/// # .enable_http1()
9944/// # .build()
9945/// # );
9946/// # let mut hub = CloudRun::new(client, auth);
9947/// // You can configure optional parameters by calling the respective setters at will, and
9948/// // execute the final call using `doit()`.
9949/// // Values shown here are possibly random and not representative !
9950/// let result = hub.namespaces().revisions_list("parent")
9951/// .watch(false)
9952/// .resource_version("dolore")
9953/// .limit(-34)
9954/// .label_selector("dolore")
9955/// .include_uninitialized(false)
9956/// .field_selector("amet.")
9957/// .continue_("ea")
9958/// .doit().await;
9959/// # }
9960/// ```
9961pub struct NamespaceRevisionListCall<'a, C>
9962where
9963 C: 'a,
9964{
9965 hub: &'a CloudRun<C>,
9966 _parent: String,
9967 _watch: Option<bool>,
9968 _resource_version: Option<String>,
9969 _limit: Option<i32>,
9970 _label_selector: Option<String>,
9971 _include_uninitialized: Option<bool>,
9972 _field_selector: Option<String>,
9973 _continue_: Option<String>,
9974 _delegate: Option<&'a mut dyn common::Delegate>,
9975 _additional_params: HashMap<String, String>,
9976 _scopes: BTreeSet<String>,
9977}
9978
9979impl<'a, C> common::CallBuilder for NamespaceRevisionListCall<'a, C> {}
9980
9981impl<'a, C> NamespaceRevisionListCall<'a, C>
9982where
9983 C: common::Connector,
9984{
9985 /// Perform the operation you have build so far.
9986 pub async fn doit(mut self) -> common::Result<(common::Response, ListRevisionsResponse)> {
9987 use std::borrow::Cow;
9988 use std::io::{Read, Seek};
9989
9990 use common::{url::Params, ToParts};
9991 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9992
9993 let mut dd = common::DefaultDelegate;
9994 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9995 dlg.begin(common::MethodInfo {
9996 id: "run.namespaces.revisions.list",
9997 http_method: hyper::Method::GET,
9998 });
9999
10000 for &field in [
10001 "alt",
10002 "parent",
10003 "watch",
10004 "resourceVersion",
10005 "limit",
10006 "labelSelector",
10007 "includeUninitialized",
10008 "fieldSelector",
10009 "continue",
10010 ]
10011 .iter()
10012 {
10013 if self._additional_params.contains_key(field) {
10014 dlg.finished(false);
10015 return Err(common::Error::FieldClash(field));
10016 }
10017 }
10018
10019 let mut params = Params::with_capacity(10 + self._additional_params.len());
10020 params.push("parent", self._parent);
10021 if let Some(value) = self._watch.as_ref() {
10022 params.push("watch", value.to_string());
10023 }
10024 if let Some(value) = self._resource_version.as_ref() {
10025 params.push("resourceVersion", value);
10026 }
10027 if let Some(value) = self._limit.as_ref() {
10028 params.push("limit", value.to_string());
10029 }
10030 if let Some(value) = self._label_selector.as_ref() {
10031 params.push("labelSelector", value);
10032 }
10033 if let Some(value) = self._include_uninitialized.as_ref() {
10034 params.push("includeUninitialized", value.to_string());
10035 }
10036 if let Some(value) = self._field_selector.as_ref() {
10037 params.push("fieldSelector", value);
10038 }
10039 if let Some(value) = self._continue_.as_ref() {
10040 params.push("continue", value);
10041 }
10042
10043 params.extend(self._additional_params.iter());
10044
10045 params.push("alt", "json");
10046 let mut url =
10047 self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/revisions";
10048 if self._scopes.is_empty() {
10049 self._scopes
10050 .insert(Scope::CloudPlatform.as_ref().to_string());
10051 }
10052
10053 #[allow(clippy::single_element_loop)]
10054 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10055 url = params.uri_replacement(url, param_name, find_this, true);
10056 }
10057 {
10058 let to_remove = ["parent"];
10059 params.remove_params(&to_remove);
10060 }
10061
10062 let url = params.parse_with_url(&url);
10063
10064 loop {
10065 let token = match self
10066 .hub
10067 .auth
10068 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10069 .await
10070 {
10071 Ok(token) => token,
10072 Err(e) => match dlg.token(e) {
10073 Ok(token) => token,
10074 Err(e) => {
10075 dlg.finished(false);
10076 return Err(common::Error::MissingToken(e));
10077 }
10078 },
10079 };
10080 let mut req_result = {
10081 let client = &self.hub.client;
10082 dlg.pre_request();
10083 let mut req_builder = hyper::Request::builder()
10084 .method(hyper::Method::GET)
10085 .uri(url.as_str())
10086 .header(USER_AGENT, self.hub._user_agent.clone());
10087
10088 if let Some(token) = token.as_ref() {
10089 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10090 }
10091
10092 let request = req_builder
10093 .header(CONTENT_LENGTH, 0_u64)
10094 .body(common::to_body::<String>(None));
10095
10096 client.request(request.unwrap()).await
10097 };
10098
10099 match req_result {
10100 Err(err) => {
10101 if let common::Retry::After(d) = dlg.http_error(&err) {
10102 sleep(d).await;
10103 continue;
10104 }
10105 dlg.finished(false);
10106 return Err(common::Error::HttpError(err));
10107 }
10108 Ok(res) => {
10109 let (mut parts, body) = res.into_parts();
10110 let mut body = common::Body::new(body);
10111 if !parts.status.is_success() {
10112 let bytes = common::to_bytes(body).await.unwrap_or_default();
10113 let error = serde_json::from_str(&common::to_string(&bytes));
10114 let response = common::to_response(parts, bytes.into());
10115
10116 if let common::Retry::After(d) =
10117 dlg.http_failure(&response, error.as_ref().ok())
10118 {
10119 sleep(d).await;
10120 continue;
10121 }
10122
10123 dlg.finished(false);
10124
10125 return Err(match error {
10126 Ok(value) => common::Error::BadRequest(value),
10127 _ => common::Error::Failure(response),
10128 });
10129 }
10130 let response = {
10131 let bytes = common::to_bytes(body).await.unwrap_or_default();
10132 let encoded = common::to_string(&bytes);
10133 match serde_json::from_str(&encoded) {
10134 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10135 Err(error) => {
10136 dlg.response_json_decode_error(&encoded, &error);
10137 return Err(common::Error::JsonDecodeError(
10138 encoded.to_string(),
10139 error,
10140 ));
10141 }
10142 }
10143 };
10144
10145 dlg.finished(true);
10146 return Ok(response);
10147 }
10148 }
10149 }
10150 }
10151
10152 /// The namespace from which the revisions should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
10153 ///
10154 /// Sets the *parent* path property to the given value.
10155 ///
10156 /// Even though the property as already been set when instantiating this call,
10157 /// we provide this method for API completeness.
10158 pub fn parent(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10159 self._parent = new_value.to_string();
10160 self
10161 }
10162 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
10163 ///
10164 /// Sets the *watch* query property to the given value.
10165 pub fn watch(mut self, new_value: bool) -> NamespaceRevisionListCall<'a, C> {
10166 self._watch = Some(new_value);
10167 self
10168 }
10169 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
10170 ///
10171 /// Sets the *resource version* query property to the given value.
10172 pub fn resource_version(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10173 self._resource_version = Some(new_value.to_string());
10174 self
10175 }
10176 /// Optional. The maximum number of records that should be returned.
10177 ///
10178 /// Sets the *limit* query property to the given value.
10179 pub fn limit(mut self, new_value: i32) -> NamespaceRevisionListCall<'a, C> {
10180 self._limit = Some(new_value);
10181 self
10182 }
10183 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
10184 ///
10185 /// Sets the *label selector* query property to the given value.
10186 pub fn label_selector(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10187 self._label_selector = Some(new_value.to_string());
10188 self
10189 }
10190 /// Not currently used by Cloud Run.
10191 ///
10192 /// Sets the *include uninitialized* query property to the given value.
10193 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceRevisionListCall<'a, C> {
10194 self._include_uninitialized = Some(new_value);
10195 self
10196 }
10197 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
10198 ///
10199 /// Sets the *field selector* query property to the given value.
10200 pub fn field_selector(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10201 self._field_selector = Some(new_value.to_string());
10202 self
10203 }
10204 /// Optional. Encoded string to continue paging.
10205 ///
10206 /// Sets the *continue* query property to the given value.
10207 pub fn continue_(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10208 self._continue_ = Some(new_value.to_string());
10209 self
10210 }
10211 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10212 /// while executing the actual API request.
10213 ///
10214 /// ````text
10215 /// It should be used to handle progress information, and to implement a certain level of resilience.
10216 /// ````
10217 ///
10218 /// Sets the *delegate* property to the given value.
10219 pub fn delegate(
10220 mut self,
10221 new_value: &'a mut dyn common::Delegate,
10222 ) -> NamespaceRevisionListCall<'a, C> {
10223 self._delegate = Some(new_value);
10224 self
10225 }
10226
10227 /// Set any additional parameter of the query string used in the request.
10228 /// It should be used to set parameters which are not yet available through their own
10229 /// setters.
10230 ///
10231 /// Please note that this method must not be used to set any of the known parameters
10232 /// which have their own setter method. If done anyway, the request will fail.
10233 ///
10234 /// # Additional Parameters
10235 ///
10236 /// * *$.xgafv* (query-string) - V1 error format.
10237 /// * *access_token* (query-string) - OAuth access token.
10238 /// * *alt* (query-string) - Data format for response.
10239 /// * *callback* (query-string) - JSONP
10240 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10241 /// * *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.
10242 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10243 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10244 /// * *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.
10245 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10246 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10247 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionListCall<'a, C>
10248 where
10249 T: AsRef<str>,
10250 {
10251 self._additional_params
10252 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10253 self
10254 }
10255
10256 /// Identifies the authorization scope for the method you are building.
10257 ///
10258 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10259 /// [`Scope::CloudPlatform`].
10260 ///
10261 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10262 /// tokens for more than one scope.
10263 ///
10264 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10265 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10266 /// sufficient, a read-write scope will do as well.
10267 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionListCall<'a, C>
10268 where
10269 St: AsRef<str>,
10270 {
10271 self._scopes.insert(String::from(scope.as_ref()));
10272 self
10273 }
10274 /// Identifies the authorization scope(s) for the method you are building.
10275 ///
10276 /// See [`Self::add_scope()`] for details.
10277 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionListCall<'a, C>
10278 where
10279 I: IntoIterator<Item = St>,
10280 St: AsRef<str>,
10281 {
10282 self._scopes
10283 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10284 self
10285 }
10286
10287 /// Removes all scopes, and no default scope will be used either.
10288 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10289 /// for details).
10290 pub fn clear_scopes(mut self) -> NamespaceRevisionListCall<'a, C> {
10291 self._scopes.clear();
10292 self
10293 }
10294}
10295
10296/// Get information about a route.
10297///
10298/// A builder for the *routes.get* method supported by a *namespace* resource.
10299/// It is not used directly, but through a [`NamespaceMethods`] instance.
10300///
10301/// # Example
10302///
10303/// Instantiate a resource method builder
10304///
10305/// ```test_harness,no_run
10306/// # extern crate hyper;
10307/// # extern crate hyper_rustls;
10308/// # extern crate google_run1 as run1;
10309/// # async fn dox() {
10310/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10311///
10312/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10313/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10314/// # secret,
10315/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10316/// # ).build().await.unwrap();
10317///
10318/// # let client = hyper_util::client::legacy::Client::builder(
10319/// # hyper_util::rt::TokioExecutor::new()
10320/// # )
10321/// # .build(
10322/// # hyper_rustls::HttpsConnectorBuilder::new()
10323/// # .with_native_roots()
10324/// # .unwrap()
10325/// # .https_or_http()
10326/// # .enable_http1()
10327/// # .build()
10328/// # );
10329/// # let mut hub = CloudRun::new(client, auth);
10330/// // You can configure optional parameters by calling the respective setters at will, and
10331/// // execute the final call using `doit()`.
10332/// // Values shown here are possibly random and not representative !
10333/// let result = hub.namespaces().routes_get("name")
10334/// .doit().await;
10335/// # }
10336/// ```
10337pub struct NamespaceRouteGetCall<'a, C>
10338where
10339 C: 'a,
10340{
10341 hub: &'a CloudRun<C>,
10342 _name: String,
10343 _delegate: Option<&'a mut dyn common::Delegate>,
10344 _additional_params: HashMap<String, String>,
10345 _scopes: BTreeSet<String>,
10346}
10347
10348impl<'a, C> common::CallBuilder for NamespaceRouteGetCall<'a, C> {}
10349
10350impl<'a, C> NamespaceRouteGetCall<'a, C>
10351where
10352 C: common::Connector,
10353{
10354 /// Perform the operation you have build so far.
10355 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
10356 use std::borrow::Cow;
10357 use std::io::{Read, Seek};
10358
10359 use common::{url::Params, ToParts};
10360 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10361
10362 let mut dd = common::DefaultDelegate;
10363 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10364 dlg.begin(common::MethodInfo {
10365 id: "run.namespaces.routes.get",
10366 http_method: hyper::Method::GET,
10367 });
10368
10369 for &field in ["alt", "name"].iter() {
10370 if self._additional_params.contains_key(field) {
10371 dlg.finished(false);
10372 return Err(common::Error::FieldClash(field));
10373 }
10374 }
10375
10376 let mut params = Params::with_capacity(3 + self._additional_params.len());
10377 params.push("name", self._name);
10378
10379 params.extend(self._additional_params.iter());
10380
10381 params.push("alt", "json");
10382 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
10383 if self._scopes.is_empty() {
10384 self._scopes
10385 .insert(Scope::CloudPlatform.as_ref().to_string());
10386 }
10387
10388 #[allow(clippy::single_element_loop)]
10389 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10390 url = params.uri_replacement(url, param_name, find_this, true);
10391 }
10392 {
10393 let to_remove = ["name"];
10394 params.remove_params(&to_remove);
10395 }
10396
10397 let url = params.parse_with_url(&url);
10398
10399 loop {
10400 let token = match self
10401 .hub
10402 .auth
10403 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10404 .await
10405 {
10406 Ok(token) => token,
10407 Err(e) => match dlg.token(e) {
10408 Ok(token) => token,
10409 Err(e) => {
10410 dlg.finished(false);
10411 return Err(common::Error::MissingToken(e));
10412 }
10413 },
10414 };
10415 let mut req_result = {
10416 let client = &self.hub.client;
10417 dlg.pre_request();
10418 let mut req_builder = hyper::Request::builder()
10419 .method(hyper::Method::GET)
10420 .uri(url.as_str())
10421 .header(USER_AGENT, self.hub._user_agent.clone());
10422
10423 if let Some(token) = token.as_ref() {
10424 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10425 }
10426
10427 let request = req_builder
10428 .header(CONTENT_LENGTH, 0_u64)
10429 .body(common::to_body::<String>(None));
10430
10431 client.request(request.unwrap()).await
10432 };
10433
10434 match req_result {
10435 Err(err) => {
10436 if let common::Retry::After(d) = dlg.http_error(&err) {
10437 sleep(d).await;
10438 continue;
10439 }
10440 dlg.finished(false);
10441 return Err(common::Error::HttpError(err));
10442 }
10443 Ok(res) => {
10444 let (mut parts, body) = res.into_parts();
10445 let mut body = common::Body::new(body);
10446 if !parts.status.is_success() {
10447 let bytes = common::to_bytes(body).await.unwrap_or_default();
10448 let error = serde_json::from_str(&common::to_string(&bytes));
10449 let response = common::to_response(parts, bytes.into());
10450
10451 if let common::Retry::After(d) =
10452 dlg.http_failure(&response, error.as_ref().ok())
10453 {
10454 sleep(d).await;
10455 continue;
10456 }
10457
10458 dlg.finished(false);
10459
10460 return Err(match error {
10461 Ok(value) => common::Error::BadRequest(value),
10462 _ => common::Error::Failure(response),
10463 });
10464 }
10465 let response = {
10466 let bytes = common::to_bytes(body).await.unwrap_or_default();
10467 let encoded = common::to_string(&bytes);
10468 match serde_json::from_str(&encoded) {
10469 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10470 Err(error) => {
10471 dlg.response_json_decode_error(&encoded, &error);
10472 return Err(common::Error::JsonDecodeError(
10473 encoded.to_string(),
10474 error,
10475 ));
10476 }
10477 }
10478 };
10479
10480 dlg.finished(true);
10481 return Ok(response);
10482 }
10483 }
10484 }
10485 }
10486
10487 /// The name of the route to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
10488 ///
10489 /// Sets the *name* path property to the given value.
10490 ///
10491 /// Even though the property as already been set when instantiating this call,
10492 /// we provide this method for API completeness.
10493 pub fn name(mut self, new_value: &str) -> NamespaceRouteGetCall<'a, C> {
10494 self._name = new_value.to_string();
10495 self
10496 }
10497 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10498 /// while executing the actual API request.
10499 ///
10500 /// ````text
10501 /// It should be used to handle progress information, and to implement a certain level of resilience.
10502 /// ````
10503 ///
10504 /// Sets the *delegate* property to the given value.
10505 pub fn delegate(
10506 mut self,
10507 new_value: &'a mut dyn common::Delegate,
10508 ) -> NamespaceRouteGetCall<'a, C> {
10509 self._delegate = Some(new_value);
10510 self
10511 }
10512
10513 /// Set any additional parameter of the query string used in the request.
10514 /// It should be used to set parameters which are not yet available through their own
10515 /// setters.
10516 ///
10517 /// Please note that this method must not be used to set any of the known parameters
10518 /// which have their own setter method. If done anyway, the request will fail.
10519 ///
10520 /// # Additional Parameters
10521 ///
10522 /// * *$.xgafv* (query-string) - V1 error format.
10523 /// * *access_token* (query-string) - OAuth access token.
10524 /// * *alt* (query-string) - Data format for response.
10525 /// * *callback* (query-string) - JSONP
10526 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10527 /// * *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.
10528 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10529 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10530 /// * *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.
10531 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10532 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10533 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRouteGetCall<'a, C>
10534 where
10535 T: AsRef<str>,
10536 {
10537 self._additional_params
10538 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10539 self
10540 }
10541
10542 /// Identifies the authorization scope for the method you are building.
10543 ///
10544 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10545 /// [`Scope::CloudPlatform`].
10546 ///
10547 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10548 /// tokens for more than one scope.
10549 ///
10550 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10551 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10552 /// sufficient, a read-write scope will do as well.
10553 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRouteGetCall<'a, C>
10554 where
10555 St: AsRef<str>,
10556 {
10557 self._scopes.insert(String::from(scope.as_ref()));
10558 self
10559 }
10560 /// Identifies the authorization scope(s) for the method you are building.
10561 ///
10562 /// See [`Self::add_scope()`] for details.
10563 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRouteGetCall<'a, C>
10564 where
10565 I: IntoIterator<Item = St>,
10566 St: AsRef<str>,
10567 {
10568 self._scopes
10569 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10570 self
10571 }
10572
10573 /// Removes all scopes, and no default scope will be used either.
10574 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10575 /// for details).
10576 pub fn clear_scopes(mut self) -> NamespaceRouteGetCall<'a, C> {
10577 self._scopes.clear();
10578 self
10579 }
10580}
10581
10582/// List routes. Results are sorted by creation time, descending.
10583///
10584/// A builder for the *routes.list* method supported by a *namespace* resource.
10585/// It is not used directly, but through a [`NamespaceMethods`] instance.
10586///
10587/// # Example
10588///
10589/// Instantiate a resource method builder
10590///
10591/// ```test_harness,no_run
10592/// # extern crate hyper;
10593/// # extern crate hyper_rustls;
10594/// # extern crate google_run1 as run1;
10595/// # async fn dox() {
10596/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10597///
10598/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10599/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10600/// # secret,
10601/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10602/// # ).build().await.unwrap();
10603///
10604/// # let client = hyper_util::client::legacy::Client::builder(
10605/// # hyper_util::rt::TokioExecutor::new()
10606/// # )
10607/// # .build(
10608/// # hyper_rustls::HttpsConnectorBuilder::new()
10609/// # .with_native_roots()
10610/// # .unwrap()
10611/// # .https_or_http()
10612/// # .enable_http1()
10613/// # .build()
10614/// # );
10615/// # let mut hub = CloudRun::new(client, auth);
10616/// // You can configure optional parameters by calling the respective setters at will, and
10617/// // execute the final call using `doit()`.
10618/// // Values shown here are possibly random and not representative !
10619/// let result = hub.namespaces().routes_list("parent")
10620/// .watch(true)
10621/// .resource_version("no")
10622/// .limit(-7)
10623/// .label_selector("At")
10624/// .include_uninitialized(true)
10625/// .field_selector("sit")
10626/// .continue_("et")
10627/// .doit().await;
10628/// # }
10629/// ```
10630pub struct NamespaceRouteListCall<'a, C>
10631where
10632 C: 'a,
10633{
10634 hub: &'a CloudRun<C>,
10635 _parent: String,
10636 _watch: Option<bool>,
10637 _resource_version: Option<String>,
10638 _limit: Option<i32>,
10639 _label_selector: Option<String>,
10640 _include_uninitialized: Option<bool>,
10641 _field_selector: Option<String>,
10642 _continue_: Option<String>,
10643 _delegate: Option<&'a mut dyn common::Delegate>,
10644 _additional_params: HashMap<String, String>,
10645 _scopes: BTreeSet<String>,
10646}
10647
10648impl<'a, C> common::CallBuilder for NamespaceRouteListCall<'a, C> {}
10649
10650impl<'a, C> NamespaceRouteListCall<'a, C>
10651where
10652 C: common::Connector,
10653{
10654 /// Perform the operation you have build so far.
10655 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
10656 use std::borrow::Cow;
10657 use std::io::{Read, Seek};
10658
10659 use common::{url::Params, ToParts};
10660 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10661
10662 let mut dd = common::DefaultDelegate;
10663 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10664 dlg.begin(common::MethodInfo {
10665 id: "run.namespaces.routes.list",
10666 http_method: hyper::Method::GET,
10667 });
10668
10669 for &field in [
10670 "alt",
10671 "parent",
10672 "watch",
10673 "resourceVersion",
10674 "limit",
10675 "labelSelector",
10676 "includeUninitialized",
10677 "fieldSelector",
10678 "continue",
10679 ]
10680 .iter()
10681 {
10682 if self._additional_params.contains_key(field) {
10683 dlg.finished(false);
10684 return Err(common::Error::FieldClash(field));
10685 }
10686 }
10687
10688 let mut params = Params::with_capacity(10 + self._additional_params.len());
10689 params.push("parent", self._parent);
10690 if let Some(value) = self._watch.as_ref() {
10691 params.push("watch", value.to_string());
10692 }
10693 if let Some(value) = self._resource_version.as_ref() {
10694 params.push("resourceVersion", value);
10695 }
10696 if let Some(value) = self._limit.as_ref() {
10697 params.push("limit", value.to_string());
10698 }
10699 if let Some(value) = self._label_selector.as_ref() {
10700 params.push("labelSelector", value);
10701 }
10702 if let Some(value) = self._include_uninitialized.as_ref() {
10703 params.push("includeUninitialized", value.to_string());
10704 }
10705 if let Some(value) = self._field_selector.as_ref() {
10706 params.push("fieldSelector", value);
10707 }
10708 if let Some(value) = self._continue_.as_ref() {
10709 params.push("continue", value);
10710 }
10711
10712 params.extend(self._additional_params.iter());
10713
10714 params.push("alt", "json");
10715 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/routes";
10716 if self._scopes.is_empty() {
10717 self._scopes
10718 .insert(Scope::CloudPlatform.as_ref().to_string());
10719 }
10720
10721 #[allow(clippy::single_element_loop)]
10722 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10723 url = params.uri_replacement(url, param_name, find_this, true);
10724 }
10725 {
10726 let to_remove = ["parent"];
10727 params.remove_params(&to_remove);
10728 }
10729
10730 let url = params.parse_with_url(&url);
10731
10732 loop {
10733 let token = match self
10734 .hub
10735 .auth
10736 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10737 .await
10738 {
10739 Ok(token) => token,
10740 Err(e) => match dlg.token(e) {
10741 Ok(token) => token,
10742 Err(e) => {
10743 dlg.finished(false);
10744 return Err(common::Error::MissingToken(e));
10745 }
10746 },
10747 };
10748 let mut req_result = {
10749 let client = &self.hub.client;
10750 dlg.pre_request();
10751 let mut req_builder = hyper::Request::builder()
10752 .method(hyper::Method::GET)
10753 .uri(url.as_str())
10754 .header(USER_AGENT, self.hub._user_agent.clone());
10755
10756 if let Some(token) = token.as_ref() {
10757 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10758 }
10759
10760 let request = req_builder
10761 .header(CONTENT_LENGTH, 0_u64)
10762 .body(common::to_body::<String>(None));
10763
10764 client.request(request.unwrap()).await
10765 };
10766
10767 match req_result {
10768 Err(err) => {
10769 if let common::Retry::After(d) = dlg.http_error(&err) {
10770 sleep(d).await;
10771 continue;
10772 }
10773 dlg.finished(false);
10774 return Err(common::Error::HttpError(err));
10775 }
10776 Ok(res) => {
10777 let (mut parts, body) = res.into_parts();
10778 let mut body = common::Body::new(body);
10779 if !parts.status.is_success() {
10780 let bytes = common::to_bytes(body).await.unwrap_or_default();
10781 let error = serde_json::from_str(&common::to_string(&bytes));
10782 let response = common::to_response(parts, bytes.into());
10783
10784 if let common::Retry::After(d) =
10785 dlg.http_failure(&response, error.as_ref().ok())
10786 {
10787 sleep(d).await;
10788 continue;
10789 }
10790
10791 dlg.finished(false);
10792
10793 return Err(match error {
10794 Ok(value) => common::Error::BadRequest(value),
10795 _ => common::Error::Failure(response),
10796 });
10797 }
10798 let response = {
10799 let bytes = common::to_bytes(body).await.unwrap_or_default();
10800 let encoded = common::to_string(&bytes);
10801 match serde_json::from_str(&encoded) {
10802 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10803 Err(error) => {
10804 dlg.response_json_decode_error(&encoded, &error);
10805 return Err(common::Error::JsonDecodeError(
10806 encoded.to_string(),
10807 error,
10808 ));
10809 }
10810 }
10811 };
10812
10813 dlg.finished(true);
10814 return Ok(response);
10815 }
10816 }
10817 }
10818 }
10819
10820 /// The namespace from which the routes should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
10821 ///
10822 /// Sets the *parent* path property to the given value.
10823 ///
10824 /// Even though the property as already been set when instantiating this call,
10825 /// we provide this method for API completeness.
10826 pub fn parent(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
10827 self._parent = new_value.to_string();
10828 self
10829 }
10830 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
10831 ///
10832 /// Sets the *watch* query property to the given value.
10833 pub fn watch(mut self, new_value: bool) -> NamespaceRouteListCall<'a, C> {
10834 self._watch = Some(new_value);
10835 self
10836 }
10837 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
10838 ///
10839 /// Sets the *resource version* query property to the given value.
10840 pub fn resource_version(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
10841 self._resource_version = Some(new_value.to_string());
10842 self
10843 }
10844 /// Optional. The maximum number of records that should be returned.
10845 ///
10846 /// Sets the *limit* query property to the given value.
10847 pub fn limit(mut self, new_value: i32) -> NamespaceRouteListCall<'a, C> {
10848 self._limit = Some(new_value);
10849 self
10850 }
10851 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
10852 ///
10853 /// Sets the *label selector* query property to the given value.
10854 pub fn label_selector(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
10855 self._label_selector = Some(new_value.to_string());
10856 self
10857 }
10858 /// Not currently used by Cloud Run.
10859 ///
10860 /// Sets the *include uninitialized* query property to the given value.
10861 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceRouteListCall<'a, C> {
10862 self._include_uninitialized = Some(new_value);
10863 self
10864 }
10865 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
10866 ///
10867 /// Sets the *field selector* query property to the given value.
10868 pub fn field_selector(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
10869 self._field_selector = Some(new_value.to_string());
10870 self
10871 }
10872 /// Optional. Encoded string to continue paging.
10873 ///
10874 /// Sets the *continue* query property to the given value.
10875 pub fn continue_(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
10876 self._continue_ = Some(new_value.to_string());
10877 self
10878 }
10879 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10880 /// while executing the actual API request.
10881 ///
10882 /// ````text
10883 /// It should be used to handle progress information, and to implement a certain level of resilience.
10884 /// ````
10885 ///
10886 /// Sets the *delegate* property to the given value.
10887 pub fn delegate(
10888 mut self,
10889 new_value: &'a mut dyn common::Delegate,
10890 ) -> NamespaceRouteListCall<'a, C> {
10891 self._delegate = Some(new_value);
10892 self
10893 }
10894
10895 /// Set any additional parameter of the query string used in the request.
10896 /// It should be used to set parameters which are not yet available through their own
10897 /// setters.
10898 ///
10899 /// Please note that this method must not be used to set any of the known parameters
10900 /// which have their own setter method. If done anyway, the request will fail.
10901 ///
10902 /// # Additional Parameters
10903 ///
10904 /// * *$.xgafv* (query-string) - V1 error format.
10905 /// * *access_token* (query-string) - OAuth access token.
10906 /// * *alt* (query-string) - Data format for response.
10907 /// * *callback* (query-string) - JSONP
10908 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10909 /// * *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.
10910 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10911 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10912 /// * *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.
10913 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10914 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10915 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRouteListCall<'a, C>
10916 where
10917 T: AsRef<str>,
10918 {
10919 self._additional_params
10920 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10921 self
10922 }
10923
10924 /// Identifies the authorization scope for the method you are building.
10925 ///
10926 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10927 /// [`Scope::CloudPlatform`].
10928 ///
10929 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10930 /// tokens for more than one scope.
10931 ///
10932 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10933 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10934 /// sufficient, a read-write scope will do as well.
10935 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRouteListCall<'a, C>
10936 where
10937 St: AsRef<str>,
10938 {
10939 self._scopes.insert(String::from(scope.as_ref()));
10940 self
10941 }
10942 /// Identifies the authorization scope(s) for the method you are building.
10943 ///
10944 /// See [`Self::add_scope()`] for details.
10945 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRouteListCall<'a, C>
10946 where
10947 I: IntoIterator<Item = St>,
10948 St: AsRef<str>,
10949 {
10950 self._scopes
10951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10952 self
10953 }
10954
10955 /// Removes all scopes, and no default scope will be used either.
10956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10957 /// for details).
10958 pub fn clear_scopes(mut self) -> NamespaceRouteListCall<'a, C> {
10959 self._scopes.clear();
10960 self
10961 }
10962}
10963
10964/// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
10965///
10966/// A builder for the *services.create* method supported by a *namespace* resource.
10967/// It is not used directly, but through a [`NamespaceMethods`] instance.
10968///
10969/// # Example
10970///
10971/// Instantiate a resource method builder
10972///
10973/// ```test_harness,no_run
10974/// # extern crate hyper;
10975/// # extern crate hyper_rustls;
10976/// # extern crate google_run1 as run1;
10977/// use run1::api::Service;
10978/// # async fn dox() {
10979/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10980///
10981/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10982/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10983/// # secret,
10984/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10985/// # ).build().await.unwrap();
10986///
10987/// # let client = hyper_util::client::legacy::Client::builder(
10988/// # hyper_util::rt::TokioExecutor::new()
10989/// # )
10990/// # .build(
10991/// # hyper_rustls::HttpsConnectorBuilder::new()
10992/// # .with_native_roots()
10993/// # .unwrap()
10994/// # .https_or_http()
10995/// # .enable_http1()
10996/// # .build()
10997/// # );
10998/// # let mut hub = CloudRun::new(client, auth);
10999/// // As the method needs a request, you would usually fill it with the desired information
11000/// // into the respective structure. Some of the parts shown here might not be applicable !
11001/// // Values shown here are possibly random and not representative !
11002/// let mut req = Service::default();
11003///
11004/// // You can configure optional parameters by calling the respective setters at will, and
11005/// // execute the final call using `doit()`.
11006/// // Values shown here are possibly random and not representative !
11007/// let result = hub.namespaces().services_create(req, "parent")
11008/// .dry_run("aliquyam")
11009/// .doit().await;
11010/// # }
11011/// ```
11012pub struct NamespaceServiceCreateCall<'a, C>
11013where
11014 C: 'a,
11015{
11016 hub: &'a CloudRun<C>,
11017 _request: Service,
11018 _parent: String,
11019 _dry_run: Option<String>,
11020 _delegate: Option<&'a mut dyn common::Delegate>,
11021 _additional_params: HashMap<String, String>,
11022 _scopes: BTreeSet<String>,
11023}
11024
11025impl<'a, C> common::CallBuilder for NamespaceServiceCreateCall<'a, C> {}
11026
11027impl<'a, C> NamespaceServiceCreateCall<'a, C>
11028where
11029 C: common::Connector,
11030{
11031 /// Perform the operation you have build so far.
11032 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
11033 use std::borrow::Cow;
11034 use std::io::{Read, Seek};
11035
11036 use common::{url::Params, ToParts};
11037 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11038
11039 let mut dd = common::DefaultDelegate;
11040 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11041 dlg.begin(common::MethodInfo {
11042 id: "run.namespaces.services.create",
11043 http_method: hyper::Method::POST,
11044 });
11045
11046 for &field in ["alt", "parent", "dryRun"].iter() {
11047 if self._additional_params.contains_key(field) {
11048 dlg.finished(false);
11049 return Err(common::Error::FieldClash(field));
11050 }
11051 }
11052
11053 let mut params = Params::with_capacity(5 + self._additional_params.len());
11054 params.push("parent", self._parent);
11055 if let Some(value) = self._dry_run.as_ref() {
11056 params.push("dryRun", value);
11057 }
11058
11059 params.extend(self._additional_params.iter());
11060
11061 params.push("alt", "json");
11062 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/services";
11063 if self._scopes.is_empty() {
11064 self._scopes
11065 .insert(Scope::CloudPlatform.as_ref().to_string());
11066 }
11067
11068 #[allow(clippy::single_element_loop)]
11069 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11070 url = params.uri_replacement(url, param_name, find_this, true);
11071 }
11072 {
11073 let to_remove = ["parent"];
11074 params.remove_params(&to_remove);
11075 }
11076
11077 let url = params.parse_with_url(&url);
11078
11079 let mut json_mime_type = mime::APPLICATION_JSON;
11080 let mut request_value_reader = {
11081 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11082 common::remove_json_null_values(&mut value);
11083 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11084 serde_json::to_writer(&mut dst, &value).unwrap();
11085 dst
11086 };
11087 let request_size = request_value_reader
11088 .seek(std::io::SeekFrom::End(0))
11089 .unwrap();
11090 request_value_reader
11091 .seek(std::io::SeekFrom::Start(0))
11092 .unwrap();
11093
11094 loop {
11095 let token = match self
11096 .hub
11097 .auth
11098 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11099 .await
11100 {
11101 Ok(token) => token,
11102 Err(e) => match dlg.token(e) {
11103 Ok(token) => token,
11104 Err(e) => {
11105 dlg.finished(false);
11106 return Err(common::Error::MissingToken(e));
11107 }
11108 },
11109 };
11110 request_value_reader
11111 .seek(std::io::SeekFrom::Start(0))
11112 .unwrap();
11113 let mut req_result = {
11114 let client = &self.hub.client;
11115 dlg.pre_request();
11116 let mut req_builder = hyper::Request::builder()
11117 .method(hyper::Method::POST)
11118 .uri(url.as_str())
11119 .header(USER_AGENT, self.hub._user_agent.clone());
11120
11121 if let Some(token) = token.as_ref() {
11122 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11123 }
11124
11125 let request = req_builder
11126 .header(CONTENT_TYPE, json_mime_type.to_string())
11127 .header(CONTENT_LENGTH, request_size as u64)
11128 .body(common::to_body(
11129 request_value_reader.get_ref().clone().into(),
11130 ));
11131
11132 client.request(request.unwrap()).await
11133 };
11134
11135 match req_result {
11136 Err(err) => {
11137 if let common::Retry::After(d) = dlg.http_error(&err) {
11138 sleep(d).await;
11139 continue;
11140 }
11141 dlg.finished(false);
11142 return Err(common::Error::HttpError(err));
11143 }
11144 Ok(res) => {
11145 let (mut parts, body) = res.into_parts();
11146 let mut body = common::Body::new(body);
11147 if !parts.status.is_success() {
11148 let bytes = common::to_bytes(body).await.unwrap_or_default();
11149 let error = serde_json::from_str(&common::to_string(&bytes));
11150 let response = common::to_response(parts, bytes.into());
11151
11152 if let common::Retry::After(d) =
11153 dlg.http_failure(&response, error.as_ref().ok())
11154 {
11155 sleep(d).await;
11156 continue;
11157 }
11158
11159 dlg.finished(false);
11160
11161 return Err(match error {
11162 Ok(value) => common::Error::BadRequest(value),
11163 _ => common::Error::Failure(response),
11164 });
11165 }
11166 let response = {
11167 let bytes = common::to_bytes(body).await.unwrap_or_default();
11168 let encoded = common::to_string(&bytes);
11169 match serde_json::from_str(&encoded) {
11170 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11171 Err(error) => {
11172 dlg.response_json_decode_error(&encoded, &error);
11173 return Err(common::Error::JsonDecodeError(
11174 encoded.to_string(),
11175 error,
11176 ));
11177 }
11178 }
11179 };
11180
11181 dlg.finished(true);
11182 return Ok(response);
11183 }
11184 }
11185 }
11186 }
11187
11188 ///
11189 /// Sets the *request* property to the given value.
11190 ///
11191 /// Even though the property as already been set when instantiating this call,
11192 /// we provide this method for API completeness.
11193 pub fn request(mut self, new_value: Service) -> NamespaceServiceCreateCall<'a, C> {
11194 self._request = new_value;
11195 self
11196 }
11197 /// Required. The resource's parent. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
11198 ///
11199 /// Sets the *parent* path property to the given value.
11200 ///
11201 /// Even though the property as already been set when instantiating this call,
11202 /// we provide this method for API completeness.
11203 pub fn parent(mut self, new_value: &str) -> NamespaceServiceCreateCall<'a, C> {
11204 self._parent = new_value.to_string();
11205 self
11206 }
11207 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
11208 ///
11209 /// Sets the *dry run* query property to the given value.
11210 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceCreateCall<'a, C> {
11211 self._dry_run = Some(new_value.to_string());
11212 self
11213 }
11214 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11215 /// while executing the actual API request.
11216 ///
11217 /// ````text
11218 /// It should be used to handle progress information, and to implement a certain level of resilience.
11219 /// ````
11220 ///
11221 /// Sets the *delegate* property to the given value.
11222 pub fn delegate(
11223 mut self,
11224 new_value: &'a mut dyn common::Delegate,
11225 ) -> NamespaceServiceCreateCall<'a, C> {
11226 self._delegate = Some(new_value);
11227 self
11228 }
11229
11230 /// Set any additional parameter of the query string used in the request.
11231 /// It should be used to set parameters which are not yet available through their own
11232 /// setters.
11233 ///
11234 /// Please note that this method must not be used to set any of the known parameters
11235 /// which have their own setter method. If done anyway, the request will fail.
11236 ///
11237 /// # Additional Parameters
11238 ///
11239 /// * *$.xgafv* (query-string) - V1 error format.
11240 /// * *access_token* (query-string) - OAuth access token.
11241 /// * *alt* (query-string) - Data format for response.
11242 /// * *callback* (query-string) - JSONP
11243 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11244 /// * *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.
11245 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11246 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11247 /// * *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.
11248 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11249 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11250 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceCreateCall<'a, C>
11251 where
11252 T: AsRef<str>,
11253 {
11254 self._additional_params
11255 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11256 self
11257 }
11258
11259 /// Identifies the authorization scope for the method you are building.
11260 ///
11261 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11262 /// [`Scope::CloudPlatform`].
11263 ///
11264 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11265 /// tokens for more than one scope.
11266 ///
11267 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11268 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11269 /// sufficient, a read-write scope will do as well.
11270 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceCreateCall<'a, C>
11271 where
11272 St: AsRef<str>,
11273 {
11274 self._scopes.insert(String::from(scope.as_ref()));
11275 self
11276 }
11277 /// Identifies the authorization scope(s) for the method you are building.
11278 ///
11279 /// See [`Self::add_scope()`] for details.
11280 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceCreateCall<'a, C>
11281 where
11282 I: IntoIterator<Item = St>,
11283 St: AsRef<str>,
11284 {
11285 self._scopes
11286 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11287 self
11288 }
11289
11290 /// Removes all scopes, and no default scope will be used either.
11291 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11292 /// for details).
11293 pub fn clear_scopes(mut self) -> NamespaceServiceCreateCall<'a, C> {
11294 self._scopes.clear();
11295 self
11296 }
11297}
11298
11299/// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
11300///
11301/// A builder for the *services.delete* method supported by a *namespace* resource.
11302/// It is not used directly, but through a [`NamespaceMethods`] instance.
11303///
11304/// # Example
11305///
11306/// Instantiate a resource method builder
11307///
11308/// ```test_harness,no_run
11309/// # extern crate hyper;
11310/// # extern crate hyper_rustls;
11311/// # extern crate google_run1 as run1;
11312/// # async fn dox() {
11313/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11314///
11315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11317/// # secret,
11318/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11319/// # ).build().await.unwrap();
11320///
11321/// # let client = hyper_util::client::legacy::Client::builder(
11322/// # hyper_util::rt::TokioExecutor::new()
11323/// # )
11324/// # .build(
11325/// # hyper_rustls::HttpsConnectorBuilder::new()
11326/// # .with_native_roots()
11327/// # .unwrap()
11328/// # .https_or_http()
11329/// # .enable_http1()
11330/// # .build()
11331/// # );
11332/// # let mut hub = CloudRun::new(client, auth);
11333/// // You can configure optional parameters by calling the respective setters at will, and
11334/// // execute the final call using `doit()`.
11335/// // Values shown here are possibly random and not representative !
11336/// let result = hub.namespaces().services_delete("name")
11337/// .propagation_policy("et")
11338/// .kind("sanctus")
11339/// .dry_run("Lorem")
11340/// .api_version("est")
11341/// .doit().await;
11342/// # }
11343/// ```
11344pub struct NamespaceServiceDeleteCall<'a, C>
11345where
11346 C: 'a,
11347{
11348 hub: &'a CloudRun<C>,
11349 _name: String,
11350 _propagation_policy: Option<String>,
11351 _kind: Option<String>,
11352 _dry_run: Option<String>,
11353 _api_version: Option<String>,
11354 _delegate: Option<&'a mut dyn common::Delegate>,
11355 _additional_params: HashMap<String, String>,
11356 _scopes: BTreeSet<String>,
11357}
11358
11359impl<'a, C> common::CallBuilder for NamespaceServiceDeleteCall<'a, C> {}
11360
11361impl<'a, C> NamespaceServiceDeleteCall<'a, C>
11362where
11363 C: common::Connector,
11364{
11365 /// Perform the operation you have build so far.
11366 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
11367 use std::borrow::Cow;
11368 use std::io::{Read, Seek};
11369
11370 use common::{url::Params, ToParts};
11371 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11372
11373 let mut dd = common::DefaultDelegate;
11374 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11375 dlg.begin(common::MethodInfo {
11376 id: "run.namespaces.services.delete",
11377 http_method: hyper::Method::DELETE,
11378 });
11379
11380 for &field in [
11381 "alt",
11382 "name",
11383 "propagationPolicy",
11384 "kind",
11385 "dryRun",
11386 "apiVersion",
11387 ]
11388 .iter()
11389 {
11390 if self._additional_params.contains_key(field) {
11391 dlg.finished(false);
11392 return Err(common::Error::FieldClash(field));
11393 }
11394 }
11395
11396 let mut params = Params::with_capacity(7 + self._additional_params.len());
11397 params.push("name", self._name);
11398 if let Some(value) = self._propagation_policy.as_ref() {
11399 params.push("propagationPolicy", value);
11400 }
11401 if let Some(value) = self._kind.as_ref() {
11402 params.push("kind", value);
11403 }
11404 if let Some(value) = self._dry_run.as_ref() {
11405 params.push("dryRun", value);
11406 }
11407 if let Some(value) = self._api_version.as_ref() {
11408 params.push("apiVersion", value);
11409 }
11410
11411 params.extend(self._additional_params.iter());
11412
11413 params.push("alt", "json");
11414 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
11415 if self._scopes.is_empty() {
11416 self._scopes
11417 .insert(Scope::CloudPlatform.as_ref().to_string());
11418 }
11419
11420 #[allow(clippy::single_element_loop)]
11421 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11422 url = params.uri_replacement(url, param_name, find_this, true);
11423 }
11424 {
11425 let to_remove = ["name"];
11426 params.remove_params(&to_remove);
11427 }
11428
11429 let url = params.parse_with_url(&url);
11430
11431 loop {
11432 let token = match self
11433 .hub
11434 .auth
11435 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11436 .await
11437 {
11438 Ok(token) => token,
11439 Err(e) => match dlg.token(e) {
11440 Ok(token) => token,
11441 Err(e) => {
11442 dlg.finished(false);
11443 return Err(common::Error::MissingToken(e));
11444 }
11445 },
11446 };
11447 let mut req_result = {
11448 let client = &self.hub.client;
11449 dlg.pre_request();
11450 let mut req_builder = hyper::Request::builder()
11451 .method(hyper::Method::DELETE)
11452 .uri(url.as_str())
11453 .header(USER_AGENT, self.hub._user_agent.clone());
11454
11455 if let Some(token) = token.as_ref() {
11456 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11457 }
11458
11459 let request = req_builder
11460 .header(CONTENT_LENGTH, 0_u64)
11461 .body(common::to_body::<String>(None));
11462
11463 client.request(request.unwrap()).await
11464 };
11465
11466 match req_result {
11467 Err(err) => {
11468 if let common::Retry::After(d) = dlg.http_error(&err) {
11469 sleep(d).await;
11470 continue;
11471 }
11472 dlg.finished(false);
11473 return Err(common::Error::HttpError(err));
11474 }
11475 Ok(res) => {
11476 let (mut parts, body) = res.into_parts();
11477 let mut body = common::Body::new(body);
11478 if !parts.status.is_success() {
11479 let bytes = common::to_bytes(body).await.unwrap_or_default();
11480 let error = serde_json::from_str(&common::to_string(&bytes));
11481 let response = common::to_response(parts, bytes.into());
11482
11483 if let common::Retry::After(d) =
11484 dlg.http_failure(&response, error.as_ref().ok())
11485 {
11486 sleep(d).await;
11487 continue;
11488 }
11489
11490 dlg.finished(false);
11491
11492 return Err(match error {
11493 Ok(value) => common::Error::BadRequest(value),
11494 _ => common::Error::Failure(response),
11495 });
11496 }
11497 let response = {
11498 let bytes = common::to_bytes(body).await.unwrap_or_default();
11499 let encoded = common::to_string(&bytes);
11500 match serde_json::from_str(&encoded) {
11501 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11502 Err(error) => {
11503 dlg.response_json_decode_error(&encoded, &error);
11504 return Err(common::Error::JsonDecodeError(
11505 encoded.to_string(),
11506 error,
11507 ));
11508 }
11509 }
11510 };
11511
11512 dlg.finished(true);
11513 return Ok(response);
11514 }
11515 }
11516 }
11517 }
11518
11519 /// Required. The fully qualified name of the service to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
11520 ///
11521 /// Sets the *name* path property to the given value.
11522 ///
11523 /// Even though the property as already been set when instantiating this call,
11524 /// we provide this method for API completeness.
11525 pub fn name(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
11526 self._name = new_value.to_string();
11527 self
11528 }
11529 /// Not supported, and ignored by Cloud Run.
11530 ///
11531 /// Sets the *propagation policy* query property to the given value.
11532 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
11533 self._propagation_policy = Some(new_value.to_string());
11534 self
11535 }
11536 /// Not supported, and ignored by Cloud Run.
11537 ///
11538 /// Sets the *kind* query property to the given value.
11539 pub fn kind(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
11540 self._kind = Some(new_value.to_string());
11541 self
11542 }
11543 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
11544 ///
11545 /// Sets the *dry run* query property to the given value.
11546 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
11547 self._dry_run = Some(new_value.to_string());
11548 self
11549 }
11550 /// Not supported, and ignored by Cloud Run.
11551 ///
11552 /// Sets the *api version* query property to the given value.
11553 pub fn api_version(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
11554 self._api_version = Some(new_value.to_string());
11555 self
11556 }
11557 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11558 /// while executing the actual API request.
11559 ///
11560 /// ````text
11561 /// It should be used to handle progress information, and to implement a certain level of resilience.
11562 /// ````
11563 ///
11564 /// Sets the *delegate* property to the given value.
11565 pub fn delegate(
11566 mut self,
11567 new_value: &'a mut dyn common::Delegate,
11568 ) -> NamespaceServiceDeleteCall<'a, C> {
11569 self._delegate = Some(new_value);
11570 self
11571 }
11572
11573 /// Set any additional parameter of the query string used in the request.
11574 /// It should be used to set parameters which are not yet available through their own
11575 /// setters.
11576 ///
11577 /// Please note that this method must not be used to set any of the known parameters
11578 /// which have their own setter method. If done anyway, the request will fail.
11579 ///
11580 /// # Additional Parameters
11581 ///
11582 /// * *$.xgafv* (query-string) - V1 error format.
11583 /// * *access_token* (query-string) - OAuth access token.
11584 /// * *alt* (query-string) - Data format for response.
11585 /// * *callback* (query-string) - JSONP
11586 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11587 /// * *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.
11588 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11589 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11590 /// * *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.
11591 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11592 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11593 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceDeleteCall<'a, C>
11594 where
11595 T: AsRef<str>,
11596 {
11597 self._additional_params
11598 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11599 self
11600 }
11601
11602 /// Identifies the authorization scope for the method you are building.
11603 ///
11604 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11605 /// [`Scope::CloudPlatform`].
11606 ///
11607 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11608 /// tokens for more than one scope.
11609 ///
11610 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11611 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11612 /// sufficient, a read-write scope will do as well.
11613 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceDeleteCall<'a, C>
11614 where
11615 St: AsRef<str>,
11616 {
11617 self._scopes.insert(String::from(scope.as_ref()));
11618 self
11619 }
11620 /// Identifies the authorization scope(s) for the method you are building.
11621 ///
11622 /// See [`Self::add_scope()`] for details.
11623 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceDeleteCall<'a, C>
11624 where
11625 I: IntoIterator<Item = St>,
11626 St: AsRef<str>,
11627 {
11628 self._scopes
11629 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11630 self
11631 }
11632
11633 /// Removes all scopes, and no default scope will be used either.
11634 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11635 /// for details).
11636 pub fn clear_scopes(mut self) -> NamespaceServiceDeleteCall<'a, C> {
11637 self._scopes.clear();
11638 self
11639 }
11640}
11641
11642/// Gets information about a service.
11643///
11644/// A builder for the *services.get* method supported by a *namespace* resource.
11645/// It is not used directly, but through a [`NamespaceMethods`] instance.
11646///
11647/// # Example
11648///
11649/// Instantiate a resource method builder
11650///
11651/// ```test_harness,no_run
11652/// # extern crate hyper;
11653/// # extern crate hyper_rustls;
11654/// # extern crate google_run1 as run1;
11655/// # async fn dox() {
11656/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11657///
11658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11660/// # secret,
11661/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11662/// # ).build().await.unwrap();
11663///
11664/// # let client = hyper_util::client::legacy::Client::builder(
11665/// # hyper_util::rt::TokioExecutor::new()
11666/// # )
11667/// # .build(
11668/// # hyper_rustls::HttpsConnectorBuilder::new()
11669/// # .with_native_roots()
11670/// # .unwrap()
11671/// # .https_or_http()
11672/// # .enable_http1()
11673/// # .build()
11674/// # );
11675/// # let mut hub = CloudRun::new(client, auth);
11676/// // You can configure optional parameters by calling the respective setters at will, and
11677/// // execute the final call using `doit()`.
11678/// // Values shown here are possibly random and not representative !
11679/// let result = hub.namespaces().services_get("name")
11680/// .doit().await;
11681/// # }
11682/// ```
11683pub struct NamespaceServiceGetCall<'a, C>
11684where
11685 C: 'a,
11686{
11687 hub: &'a CloudRun<C>,
11688 _name: String,
11689 _delegate: Option<&'a mut dyn common::Delegate>,
11690 _additional_params: HashMap<String, String>,
11691 _scopes: BTreeSet<String>,
11692}
11693
11694impl<'a, C> common::CallBuilder for NamespaceServiceGetCall<'a, C> {}
11695
11696impl<'a, C> NamespaceServiceGetCall<'a, C>
11697where
11698 C: common::Connector,
11699{
11700 /// Perform the operation you have build so far.
11701 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
11702 use std::borrow::Cow;
11703 use std::io::{Read, Seek};
11704
11705 use common::{url::Params, ToParts};
11706 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11707
11708 let mut dd = common::DefaultDelegate;
11709 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11710 dlg.begin(common::MethodInfo {
11711 id: "run.namespaces.services.get",
11712 http_method: hyper::Method::GET,
11713 });
11714
11715 for &field in ["alt", "name"].iter() {
11716 if self._additional_params.contains_key(field) {
11717 dlg.finished(false);
11718 return Err(common::Error::FieldClash(field));
11719 }
11720 }
11721
11722 let mut params = Params::with_capacity(3 + self._additional_params.len());
11723 params.push("name", self._name);
11724
11725 params.extend(self._additional_params.iter());
11726
11727 params.push("alt", "json");
11728 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
11729 if self._scopes.is_empty() {
11730 self._scopes
11731 .insert(Scope::CloudPlatform.as_ref().to_string());
11732 }
11733
11734 #[allow(clippy::single_element_loop)]
11735 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11736 url = params.uri_replacement(url, param_name, find_this, true);
11737 }
11738 {
11739 let to_remove = ["name"];
11740 params.remove_params(&to_remove);
11741 }
11742
11743 let url = params.parse_with_url(&url);
11744
11745 loop {
11746 let token = match self
11747 .hub
11748 .auth
11749 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11750 .await
11751 {
11752 Ok(token) => token,
11753 Err(e) => match dlg.token(e) {
11754 Ok(token) => token,
11755 Err(e) => {
11756 dlg.finished(false);
11757 return Err(common::Error::MissingToken(e));
11758 }
11759 },
11760 };
11761 let mut req_result = {
11762 let client = &self.hub.client;
11763 dlg.pre_request();
11764 let mut req_builder = hyper::Request::builder()
11765 .method(hyper::Method::GET)
11766 .uri(url.as_str())
11767 .header(USER_AGENT, self.hub._user_agent.clone());
11768
11769 if let Some(token) = token.as_ref() {
11770 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11771 }
11772
11773 let request = req_builder
11774 .header(CONTENT_LENGTH, 0_u64)
11775 .body(common::to_body::<String>(None));
11776
11777 client.request(request.unwrap()).await
11778 };
11779
11780 match req_result {
11781 Err(err) => {
11782 if let common::Retry::After(d) = dlg.http_error(&err) {
11783 sleep(d).await;
11784 continue;
11785 }
11786 dlg.finished(false);
11787 return Err(common::Error::HttpError(err));
11788 }
11789 Ok(res) => {
11790 let (mut parts, body) = res.into_parts();
11791 let mut body = common::Body::new(body);
11792 if !parts.status.is_success() {
11793 let bytes = common::to_bytes(body).await.unwrap_or_default();
11794 let error = serde_json::from_str(&common::to_string(&bytes));
11795 let response = common::to_response(parts, bytes.into());
11796
11797 if let common::Retry::After(d) =
11798 dlg.http_failure(&response, error.as_ref().ok())
11799 {
11800 sleep(d).await;
11801 continue;
11802 }
11803
11804 dlg.finished(false);
11805
11806 return Err(match error {
11807 Ok(value) => common::Error::BadRequest(value),
11808 _ => common::Error::Failure(response),
11809 });
11810 }
11811 let response = {
11812 let bytes = common::to_bytes(body).await.unwrap_or_default();
11813 let encoded = common::to_string(&bytes);
11814 match serde_json::from_str(&encoded) {
11815 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11816 Err(error) => {
11817 dlg.response_json_decode_error(&encoded, &error);
11818 return Err(common::Error::JsonDecodeError(
11819 encoded.to_string(),
11820 error,
11821 ));
11822 }
11823 }
11824 };
11825
11826 dlg.finished(true);
11827 return Ok(response);
11828 }
11829 }
11830 }
11831 }
11832
11833 /// Required. The fully qualified name of the service to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
11834 ///
11835 /// Sets the *name* path property to the given value.
11836 ///
11837 /// Even though the property as already been set when instantiating this call,
11838 /// we provide this method for API completeness.
11839 pub fn name(mut self, new_value: &str) -> NamespaceServiceGetCall<'a, C> {
11840 self._name = new_value.to_string();
11841 self
11842 }
11843 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11844 /// while executing the actual API request.
11845 ///
11846 /// ````text
11847 /// It should be used to handle progress information, and to implement a certain level of resilience.
11848 /// ````
11849 ///
11850 /// Sets the *delegate* property to the given value.
11851 pub fn delegate(
11852 mut self,
11853 new_value: &'a mut dyn common::Delegate,
11854 ) -> NamespaceServiceGetCall<'a, C> {
11855 self._delegate = Some(new_value);
11856 self
11857 }
11858
11859 /// Set any additional parameter of the query string used in the request.
11860 /// It should be used to set parameters which are not yet available through their own
11861 /// setters.
11862 ///
11863 /// Please note that this method must not be used to set any of the known parameters
11864 /// which have their own setter method. If done anyway, the request will fail.
11865 ///
11866 /// # Additional Parameters
11867 ///
11868 /// * *$.xgafv* (query-string) - V1 error format.
11869 /// * *access_token* (query-string) - OAuth access token.
11870 /// * *alt* (query-string) - Data format for response.
11871 /// * *callback* (query-string) - JSONP
11872 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11873 /// * *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.
11874 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11875 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11876 /// * *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.
11877 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11878 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11879 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceGetCall<'a, C>
11880 where
11881 T: AsRef<str>,
11882 {
11883 self._additional_params
11884 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11885 self
11886 }
11887
11888 /// Identifies the authorization scope for the method you are building.
11889 ///
11890 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11891 /// [`Scope::CloudPlatform`].
11892 ///
11893 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11894 /// tokens for more than one scope.
11895 ///
11896 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11897 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11898 /// sufficient, a read-write scope will do as well.
11899 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceGetCall<'a, C>
11900 where
11901 St: AsRef<str>,
11902 {
11903 self._scopes.insert(String::from(scope.as_ref()));
11904 self
11905 }
11906 /// Identifies the authorization scope(s) for the method you are building.
11907 ///
11908 /// See [`Self::add_scope()`] for details.
11909 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceGetCall<'a, C>
11910 where
11911 I: IntoIterator<Item = St>,
11912 St: AsRef<str>,
11913 {
11914 self._scopes
11915 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11916 self
11917 }
11918
11919 /// Removes all scopes, and no default scope will be used either.
11920 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11921 /// for details).
11922 pub fn clear_scopes(mut self) -> NamespaceServiceGetCall<'a, C> {
11923 self._scopes.clear();
11924 self
11925 }
11926}
11927
11928/// Lists services for the given project and region. Results are sorted by creation time, descending.
11929///
11930/// A builder for the *services.list* method supported by a *namespace* resource.
11931/// It is not used directly, but through a [`NamespaceMethods`] instance.
11932///
11933/// # Example
11934///
11935/// Instantiate a resource method builder
11936///
11937/// ```test_harness,no_run
11938/// # extern crate hyper;
11939/// # extern crate hyper_rustls;
11940/// # extern crate google_run1 as run1;
11941/// # async fn dox() {
11942/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11943///
11944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11946/// # secret,
11947/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11948/// # ).build().await.unwrap();
11949///
11950/// # let client = hyper_util::client::legacy::Client::builder(
11951/// # hyper_util::rt::TokioExecutor::new()
11952/// # )
11953/// # .build(
11954/// # hyper_rustls::HttpsConnectorBuilder::new()
11955/// # .with_native_roots()
11956/// # .unwrap()
11957/// # .https_or_http()
11958/// # .enable_http1()
11959/// # .build()
11960/// # );
11961/// # let mut hub = CloudRun::new(client, auth);
11962/// // You can configure optional parameters by calling the respective setters at will, and
11963/// // execute the final call using `doit()`.
11964/// // Values shown here are possibly random and not representative !
11965/// let result = hub.namespaces().services_list("parent")
11966/// .watch(true)
11967/// .resource_version("et")
11968/// .limit(-93)
11969/// .label_selector("no")
11970/// .include_uninitialized(false)
11971/// .field_selector("elitr")
11972/// .continue_("sed")
11973/// .doit().await;
11974/// # }
11975/// ```
11976pub struct NamespaceServiceListCall<'a, C>
11977where
11978 C: 'a,
11979{
11980 hub: &'a CloudRun<C>,
11981 _parent: String,
11982 _watch: Option<bool>,
11983 _resource_version: Option<String>,
11984 _limit: Option<i32>,
11985 _label_selector: Option<String>,
11986 _include_uninitialized: Option<bool>,
11987 _field_selector: Option<String>,
11988 _continue_: Option<String>,
11989 _delegate: Option<&'a mut dyn common::Delegate>,
11990 _additional_params: HashMap<String, String>,
11991 _scopes: BTreeSet<String>,
11992}
11993
11994impl<'a, C> common::CallBuilder for NamespaceServiceListCall<'a, C> {}
11995
11996impl<'a, C> NamespaceServiceListCall<'a, C>
11997where
11998 C: common::Connector,
11999{
12000 /// Perform the operation you have build so far.
12001 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
12002 use std::borrow::Cow;
12003 use std::io::{Read, Seek};
12004
12005 use common::{url::Params, ToParts};
12006 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12007
12008 let mut dd = common::DefaultDelegate;
12009 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12010 dlg.begin(common::MethodInfo {
12011 id: "run.namespaces.services.list",
12012 http_method: hyper::Method::GET,
12013 });
12014
12015 for &field in [
12016 "alt",
12017 "parent",
12018 "watch",
12019 "resourceVersion",
12020 "limit",
12021 "labelSelector",
12022 "includeUninitialized",
12023 "fieldSelector",
12024 "continue",
12025 ]
12026 .iter()
12027 {
12028 if self._additional_params.contains_key(field) {
12029 dlg.finished(false);
12030 return Err(common::Error::FieldClash(field));
12031 }
12032 }
12033
12034 let mut params = Params::with_capacity(10 + self._additional_params.len());
12035 params.push("parent", self._parent);
12036 if let Some(value) = self._watch.as_ref() {
12037 params.push("watch", value.to_string());
12038 }
12039 if let Some(value) = self._resource_version.as_ref() {
12040 params.push("resourceVersion", value);
12041 }
12042 if let Some(value) = self._limit.as_ref() {
12043 params.push("limit", value.to_string());
12044 }
12045 if let Some(value) = self._label_selector.as_ref() {
12046 params.push("labelSelector", value);
12047 }
12048 if let Some(value) = self._include_uninitialized.as_ref() {
12049 params.push("includeUninitialized", value.to_string());
12050 }
12051 if let Some(value) = self._field_selector.as_ref() {
12052 params.push("fieldSelector", value);
12053 }
12054 if let Some(value) = self._continue_.as_ref() {
12055 params.push("continue", value);
12056 }
12057
12058 params.extend(self._additional_params.iter());
12059
12060 params.push("alt", "json");
12061 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/services";
12062 if self._scopes.is_empty() {
12063 self._scopes
12064 .insert(Scope::CloudPlatform.as_ref().to_string());
12065 }
12066
12067 #[allow(clippy::single_element_loop)]
12068 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12069 url = params.uri_replacement(url, param_name, find_this, true);
12070 }
12071 {
12072 let to_remove = ["parent"];
12073 params.remove_params(&to_remove);
12074 }
12075
12076 let url = params.parse_with_url(&url);
12077
12078 loop {
12079 let token = match self
12080 .hub
12081 .auth
12082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12083 .await
12084 {
12085 Ok(token) => token,
12086 Err(e) => match dlg.token(e) {
12087 Ok(token) => token,
12088 Err(e) => {
12089 dlg.finished(false);
12090 return Err(common::Error::MissingToken(e));
12091 }
12092 },
12093 };
12094 let mut req_result = {
12095 let client = &self.hub.client;
12096 dlg.pre_request();
12097 let mut req_builder = hyper::Request::builder()
12098 .method(hyper::Method::GET)
12099 .uri(url.as_str())
12100 .header(USER_AGENT, self.hub._user_agent.clone());
12101
12102 if let Some(token) = token.as_ref() {
12103 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12104 }
12105
12106 let request = req_builder
12107 .header(CONTENT_LENGTH, 0_u64)
12108 .body(common::to_body::<String>(None));
12109
12110 client.request(request.unwrap()).await
12111 };
12112
12113 match req_result {
12114 Err(err) => {
12115 if let common::Retry::After(d) = dlg.http_error(&err) {
12116 sleep(d).await;
12117 continue;
12118 }
12119 dlg.finished(false);
12120 return Err(common::Error::HttpError(err));
12121 }
12122 Ok(res) => {
12123 let (mut parts, body) = res.into_parts();
12124 let mut body = common::Body::new(body);
12125 if !parts.status.is_success() {
12126 let bytes = common::to_bytes(body).await.unwrap_or_default();
12127 let error = serde_json::from_str(&common::to_string(&bytes));
12128 let response = common::to_response(parts, bytes.into());
12129
12130 if let common::Retry::After(d) =
12131 dlg.http_failure(&response, error.as_ref().ok())
12132 {
12133 sleep(d).await;
12134 continue;
12135 }
12136
12137 dlg.finished(false);
12138
12139 return Err(match error {
12140 Ok(value) => common::Error::BadRequest(value),
12141 _ => common::Error::Failure(response),
12142 });
12143 }
12144 let response = {
12145 let bytes = common::to_bytes(body).await.unwrap_or_default();
12146 let encoded = common::to_string(&bytes);
12147 match serde_json::from_str(&encoded) {
12148 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12149 Err(error) => {
12150 dlg.response_json_decode_error(&encoded, &error);
12151 return Err(common::Error::JsonDecodeError(
12152 encoded.to_string(),
12153 error,
12154 ));
12155 }
12156 }
12157 };
12158
12159 dlg.finished(true);
12160 return Ok(response);
12161 }
12162 }
12163 }
12164 }
12165
12166 /// Required. The parent from where the resources should be listed. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
12167 ///
12168 /// Sets the *parent* path property to the given value.
12169 ///
12170 /// Even though the property as already been set when instantiating this call,
12171 /// we provide this method for API completeness.
12172 pub fn parent(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12173 self._parent = new_value.to_string();
12174 self
12175 }
12176 /// Not supported, and ignored by Cloud Run.
12177 ///
12178 /// Sets the *watch* query property to the given value.
12179 pub fn watch(mut self, new_value: bool) -> NamespaceServiceListCall<'a, C> {
12180 self._watch = Some(new_value);
12181 self
12182 }
12183 /// Not supported, and ignored by Cloud Run.
12184 ///
12185 /// Sets the *resource version* query property to the given value.
12186 pub fn resource_version(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12187 self._resource_version = Some(new_value.to_string());
12188 self
12189 }
12190 /// The maximum number of records that should be returned.
12191 ///
12192 /// Sets the *limit* query property to the given value.
12193 pub fn limit(mut self, new_value: i32) -> NamespaceServiceListCall<'a, C> {
12194 self._limit = Some(new_value);
12195 self
12196 }
12197 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
12198 ///
12199 /// Sets the *label selector* query property to the given value.
12200 pub fn label_selector(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12201 self._label_selector = Some(new_value.to_string());
12202 self
12203 }
12204 /// Not supported, and ignored by Cloud Run.
12205 ///
12206 /// Sets the *include uninitialized* query property to the given value.
12207 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceServiceListCall<'a, C> {
12208 self._include_uninitialized = Some(new_value);
12209 self
12210 }
12211 /// Not supported, and ignored by Cloud Run.
12212 ///
12213 /// Sets the *field selector* query property to the given value.
12214 pub fn field_selector(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12215 self._field_selector = Some(new_value.to_string());
12216 self
12217 }
12218 /// Encoded string to continue paging.
12219 ///
12220 /// Sets the *continue* query property to the given value.
12221 pub fn continue_(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12222 self._continue_ = Some(new_value.to_string());
12223 self
12224 }
12225 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12226 /// while executing the actual API request.
12227 ///
12228 /// ````text
12229 /// It should be used to handle progress information, and to implement a certain level of resilience.
12230 /// ````
12231 ///
12232 /// Sets the *delegate* property to the given value.
12233 pub fn delegate(
12234 mut self,
12235 new_value: &'a mut dyn common::Delegate,
12236 ) -> NamespaceServiceListCall<'a, C> {
12237 self._delegate = Some(new_value);
12238 self
12239 }
12240
12241 /// Set any additional parameter of the query string used in the request.
12242 /// It should be used to set parameters which are not yet available through their own
12243 /// setters.
12244 ///
12245 /// Please note that this method must not be used to set any of the known parameters
12246 /// which have their own setter method. If done anyway, the request will fail.
12247 ///
12248 /// # Additional Parameters
12249 ///
12250 /// * *$.xgafv* (query-string) - V1 error format.
12251 /// * *access_token* (query-string) - OAuth access token.
12252 /// * *alt* (query-string) - Data format for response.
12253 /// * *callback* (query-string) - JSONP
12254 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12255 /// * *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.
12256 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12257 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12258 /// * *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.
12259 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12260 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12261 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceListCall<'a, C>
12262 where
12263 T: AsRef<str>,
12264 {
12265 self._additional_params
12266 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12267 self
12268 }
12269
12270 /// Identifies the authorization scope for the method you are building.
12271 ///
12272 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12273 /// [`Scope::CloudPlatform`].
12274 ///
12275 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12276 /// tokens for more than one scope.
12277 ///
12278 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12279 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12280 /// sufficient, a read-write scope will do as well.
12281 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceListCall<'a, C>
12282 where
12283 St: AsRef<str>,
12284 {
12285 self._scopes.insert(String::from(scope.as_ref()));
12286 self
12287 }
12288 /// Identifies the authorization scope(s) for the method you are building.
12289 ///
12290 /// See [`Self::add_scope()`] for details.
12291 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceListCall<'a, C>
12292 where
12293 I: IntoIterator<Item = St>,
12294 St: AsRef<str>,
12295 {
12296 self._scopes
12297 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12298 self
12299 }
12300
12301 /// Removes all scopes, and no default scope will be used either.
12302 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12303 /// for details).
12304 pub fn clear_scopes(mut self) -> NamespaceServiceListCall<'a, C> {
12305 self._scopes.clear();
12306 self
12307 }
12308}
12309
12310/// Replaces a service. Only the spec and metadata labels and annotations are modifiable. After the Update request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
12311///
12312/// A builder for the *services.replaceService* method supported by a *namespace* resource.
12313/// It is not used directly, but through a [`NamespaceMethods`] instance.
12314///
12315/// # Example
12316///
12317/// Instantiate a resource method builder
12318///
12319/// ```test_harness,no_run
12320/// # extern crate hyper;
12321/// # extern crate hyper_rustls;
12322/// # extern crate google_run1 as run1;
12323/// use run1::api::Service;
12324/// # async fn dox() {
12325/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12326///
12327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12328/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12329/// # secret,
12330/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12331/// # ).build().await.unwrap();
12332///
12333/// # let client = hyper_util::client::legacy::Client::builder(
12334/// # hyper_util::rt::TokioExecutor::new()
12335/// # )
12336/// # .build(
12337/// # hyper_rustls::HttpsConnectorBuilder::new()
12338/// # .with_native_roots()
12339/// # .unwrap()
12340/// # .https_or_http()
12341/// # .enable_http1()
12342/// # .build()
12343/// # );
12344/// # let mut hub = CloudRun::new(client, auth);
12345/// // As the method needs a request, you would usually fill it with the desired information
12346/// // into the respective structure. Some of the parts shown here might not be applicable !
12347/// // Values shown here are possibly random and not representative !
12348/// let mut req = Service::default();
12349///
12350/// // You can configure optional parameters by calling the respective setters at will, and
12351/// // execute the final call using `doit()`.
12352/// // Values shown here are possibly random and not representative !
12353/// let result = hub.namespaces().services_replace_service(req, "name")
12354/// .dry_run("nonumy")
12355/// .doit().await;
12356/// # }
12357/// ```
12358pub struct NamespaceServiceReplaceServiceCall<'a, C>
12359where
12360 C: 'a,
12361{
12362 hub: &'a CloudRun<C>,
12363 _request: Service,
12364 _name: String,
12365 _dry_run: Option<String>,
12366 _delegate: Option<&'a mut dyn common::Delegate>,
12367 _additional_params: HashMap<String, String>,
12368 _scopes: BTreeSet<String>,
12369}
12370
12371impl<'a, C> common::CallBuilder for NamespaceServiceReplaceServiceCall<'a, C> {}
12372
12373impl<'a, C> NamespaceServiceReplaceServiceCall<'a, C>
12374where
12375 C: common::Connector,
12376{
12377 /// Perform the operation you have build so far.
12378 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
12379 use std::borrow::Cow;
12380 use std::io::{Read, Seek};
12381
12382 use common::{url::Params, ToParts};
12383 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12384
12385 let mut dd = common::DefaultDelegate;
12386 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12387 dlg.begin(common::MethodInfo {
12388 id: "run.namespaces.services.replaceService",
12389 http_method: hyper::Method::PUT,
12390 });
12391
12392 for &field in ["alt", "name", "dryRun"].iter() {
12393 if self._additional_params.contains_key(field) {
12394 dlg.finished(false);
12395 return Err(common::Error::FieldClash(field));
12396 }
12397 }
12398
12399 let mut params = Params::with_capacity(5 + self._additional_params.len());
12400 params.push("name", self._name);
12401 if let Some(value) = self._dry_run.as_ref() {
12402 params.push("dryRun", value);
12403 }
12404
12405 params.extend(self._additional_params.iter());
12406
12407 params.push("alt", "json");
12408 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
12409 if self._scopes.is_empty() {
12410 self._scopes
12411 .insert(Scope::CloudPlatform.as_ref().to_string());
12412 }
12413
12414 #[allow(clippy::single_element_loop)]
12415 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12416 url = params.uri_replacement(url, param_name, find_this, true);
12417 }
12418 {
12419 let to_remove = ["name"];
12420 params.remove_params(&to_remove);
12421 }
12422
12423 let url = params.parse_with_url(&url);
12424
12425 let mut json_mime_type = mime::APPLICATION_JSON;
12426 let mut request_value_reader = {
12427 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12428 common::remove_json_null_values(&mut value);
12429 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12430 serde_json::to_writer(&mut dst, &value).unwrap();
12431 dst
12432 };
12433 let request_size = request_value_reader
12434 .seek(std::io::SeekFrom::End(0))
12435 .unwrap();
12436 request_value_reader
12437 .seek(std::io::SeekFrom::Start(0))
12438 .unwrap();
12439
12440 loop {
12441 let token = match self
12442 .hub
12443 .auth
12444 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12445 .await
12446 {
12447 Ok(token) => token,
12448 Err(e) => match dlg.token(e) {
12449 Ok(token) => token,
12450 Err(e) => {
12451 dlg.finished(false);
12452 return Err(common::Error::MissingToken(e));
12453 }
12454 },
12455 };
12456 request_value_reader
12457 .seek(std::io::SeekFrom::Start(0))
12458 .unwrap();
12459 let mut req_result = {
12460 let client = &self.hub.client;
12461 dlg.pre_request();
12462 let mut req_builder = hyper::Request::builder()
12463 .method(hyper::Method::PUT)
12464 .uri(url.as_str())
12465 .header(USER_AGENT, self.hub._user_agent.clone());
12466
12467 if let Some(token) = token.as_ref() {
12468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12469 }
12470
12471 let request = req_builder
12472 .header(CONTENT_TYPE, json_mime_type.to_string())
12473 .header(CONTENT_LENGTH, request_size as u64)
12474 .body(common::to_body(
12475 request_value_reader.get_ref().clone().into(),
12476 ));
12477
12478 client.request(request.unwrap()).await
12479 };
12480
12481 match req_result {
12482 Err(err) => {
12483 if let common::Retry::After(d) = dlg.http_error(&err) {
12484 sleep(d).await;
12485 continue;
12486 }
12487 dlg.finished(false);
12488 return Err(common::Error::HttpError(err));
12489 }
12490 Ok(res) => {
12491 let (mut parts, body) = res.into_parts();
12492 let mut body = common::Body::new(body);
12493 if !parts.status.is_success() {
12494 let bytes = common::to_bytes(body).await.unwrap_or_default();
12495 let error = serde_json::from_str(&common::to_string(&bytes));
12496 let response = common::to_response(parts, bytes.into());
12497
12498 if let common::Retry::After(d) =
12499 dlg.http_failure(&response, error.as_ref().ok())
12500 {
12501 sleep(d).await;
12502 continue;
12503 }
12504
12505 dlg.finished(false);
12506
12507 return Err(match error {
12508 Ok(value) => common::Error::BadRequest(value),
12509 _ => common::Error::Failure(response),
12510 });
12511 }
12512 let response = {
12513 let bytes = common::to_bytes(body).await.unwrap_or_default();
12514 let encoded = common::to_string(&bytes);
12515 match serde_json::from_str(&encoded) {
12516 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12517 Err(error) => {
12518 dlg.response_json_decode_error(&encoded, &error);
12519 return Err(common::Error::JsonDecodeError(
12520 encoded.to_string(),
12521 error,
12522 ));
12523 }
12524 }
12525 };
12526
12527 dlg.finished(true);
12528 return Ok(response);
12529 }
12530 }
12531 }
12532 }
12533
12534 ///
12535 /// Sets the *request* property to the given value.
12536 ///
12537 /// Even though the property as already been set when instantiating this call,
12538 /// we provide this method for API completeness.
12539 pub fn request(mut self, new_value: Service) -> NamespaceServiceReplaceServiceCall<'a, C> {
12540 self._request = new_value;
12541 self
12542 }
12543 /// Required. The fully qualified name of the service to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
12544 ///
12545 /// Sets the *name* path property to the given value.
12546 ///
12547 /// Even though the property as already been set when instantiating this call,
12548 /// we provide this method for API completeness.
12549 pub fn name(mut self, new_value: &str) -> NamespaceServiceReplaceServiceCall<'a, C> {
12550 self._name = new_value.to_string();
12551 self
12552 }
12553 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
12554 ///
12555 /// Sets the *dry run* query property to the given value.
12556 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceReplaceServiceCall<'a, C> {
12557 self._dry_run = Some(new_value.to_string());
12558 self
12559 }
12560 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12561 /// while executing the actual API request.
12562 ///
12563 /// ````text
12564 /// It should be used to handle progress information, and to implement a certain level of resilience.
12565 /// ````
12566 ///
12567 /// Sets the *delegate* property to the given value.
12568 pub fn delegate(
12569 mut self,
12570 new_value: &'a mut dyn common::Delegate,
12571 ) -> NamespaceServiceReplaceServiceCall<'a, C> {
12572 self._delegate = Some(new_value);
12573 self
12574 }
12575
12576 /// Set any additional parameter of the query string used in the request.
12577 /// It should be used to set parameters which are not yet available through their own
12578 /// setters.
12579 ///
12580 /// Please note that this method must not be used to set any of the known parameters
12581 /// which have their own setter method. If done anyway, the request will fail.
12582 ///
12583 /// # Additional Parameters
12584 ///
12585 /// * *$.xgafv* (query-string) - V1 error format.
12586 /// * *access_token* (query-string) - OAuth access token.
12587 /// * *alt* (query-string) - Data format for response.
12588 /// * *callback* (query-string) - JSONP
12589 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12590 /// * *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.
12591 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12592 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12593 /// * *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.
12594 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12595 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12596 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceReplaceServiceCall<'a, C>
12597 where
12598 T: AsRef<str>,
12599 {
12600 self._additional_params
12601 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12602 self
12603 }
12604
12605 /// Identifies the authorization scope for the method you are building.
12606 ///
12607 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12608 /// [`Scope::CloudPlatform`].
12609 ///
12610 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12611 /// tokens for more than one scope.
12612 ///
12613 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12614 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12615 /// sufficient, a read-write scope will do as well.
12616 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceReplaceServiceCall<'a, C>
12617 where
12618 St: AsRef<str>,
12619 {
12620 self._scopes.insert(String::from(scope.as_ref()));
12621 self
12622 }
12623 /// Identifies the authorization scope(s) for the method you are building.
12624 ///
12625 /// See [`Self::add_scope()`] for details.
12626 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceReplaceServiceCall<'a, C>
12627 where
12628 I: IntoIterator<Item = St>,
12629 St: AsRef<str>,
12630 {
12631 self._scopes
12632 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12633 self
12634 }
12635
12636 /// Removes all scopes, and no default scope will be used either.
12637 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12638 /// for details).
12639 pub fn clear_scopes(mut self) -> NamespaceServiceReplaceServiceCall<'a, C> {
12640 self._scopes.clear();
12641 self
12642 }
12643}
12644
12645/// Get information about a task.
12646///
12647/// A builder for the *tasks.get* method supported by a *namespace* resource.
12648/// It is not used directly, but through a [`NamespaceMethods`] instance.
12649///
12650/// # Example
12651///
12652/// Instantiate a resource method builder
12653///
12654/// ```test_harness,no_run
12655/// # extern crate hyper;
12656/// # extern crate hyper_rustls;
12657/// # extern crate google_run1 as run1;
12658/// # async fn dox() {
12659/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12660///
12661/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12662/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12663/// # secret,
12664/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12665/// # ).build().await.unwrap();
12666///
12667/// # let client = hyper_util::client::legacy::Client::builder(
12668/// # hyper_util::rt::TokioExecutor::new()
12669/// # )
12670/// # .build(
12671/// # hyper_rustls::HttpsConnectorBuilder::new()
12672/// # .with_native_roots()
12673/// # .unwrap()
12674/// # .https_or_http()
12675/// # .enable_http1()
12676/// # .build()
12677/// # );
12678/// # let mut hub = CloudRun::new(client, auth);
12679/// // You can configure optional parameters by calling the respective setters at will, and
12680/// // execute the final call using `doit()`.
12681/// // Values shown here are possibly random and not representative !
12682/// let result = hub.namespaces().tasks_get("name")
12683/// .doit().await;
12684/// # }
12685/// ```
12686pub struct NamespaceTaskGetCall<'a, C>
12687where
12688 C: 'a,
12689{
12690 hub: &'a CloudRun<C>,
12691 _name: String,
12692 _delegate: Option<&'a mut dyn common::Delegate>,
12693 _additional_params: HashMap<String, String>,
12694 _scopes: BTreeSet<String>,
12695}
12696
12697impl<'a, C> common::CallBuilder for NamespaceTaskGetCall<'a, C> {}
12698
12699impl<'a, C> NamespaceTaskGetCall<'a, C>
12700where
12701 C: common::Connector,
12702{
12703 /// Perform the operation you have build so far.
12704 pub async fn doit(mut self) -> common::Result<(common::Response, Task)> {
12705 use std::borrow::Cow;
12706 use std::io::{Read, Seek};
12707
12708 use common::{url::Params, ToParts};
12709 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12710
12711 let mut dd = common::DefaultDelegate;
12712 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12713 dlg.begin(common::MethodInfo {
12714 id: "run.namespaces.tasks.get",
12715 http_method: hyper::Method::GET,
12716 });
12717
12718 for &field in ["alt", "name"].iter() {
12719 if self._additional_params.contains_key(field) {
12720 dlg.finished(false);
12721 return Err(common::Error::FieldClash(field));
12722 }
12723 }
12724
12725 let mut params = Params::with_capacity(3 + self._additional_params.len());
12726 params.push("name", self._name);
12727
12728 params.extend(self._additional_params.iter());
12729
12730 params.push("alt", "json");
12731 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
12732 if self._scopes.is_empty() {
12733 self._scopes
12734 .insert(Scope::CloudPlatform.as_ref().to_string());
12735 }
12736
12737 #[allow(clippy::single_element_loop)]
12738 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12739 url = params.uri_replacement(url, param_name, find_this, true);
12740 }
12741 {
12742 let to_remove = ["name"];
12743 params.remove_params(&to_remove);
12744 }
12745
12746 let url = params.parse_with_url(&url);
12747
12748 loop {
12749 let token = match self
12750 .hub
12751 .auth
12752 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12753 .await
12754 {
12755 Ok(token) => token,
12756 Err(e) => match dlg.token(e) {
12757 Ok(token) => token,
12758 Err(e) => {
12759 dlg.finished(false);
12760 return Err(common::Error::MissingToken(e));
12761 }
12762 },
12763 };
12764 let mut req_result = {
12765 let client = &self.hub.client;
12766 dlg.pre_request();
12767 let mut req_builder = hyper::Request::builder()
12768 .method(hyper::Method::GET)
12769 .uri(url.as_str())
12770 .header(USER_AGENT, self.hub._user_agent.clone());
12771
12772 if let Some(token) = token.as_ref() {
12773 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12774 }
12775
12776 let request = req_builder
12777 .header(CONTENT_LENGTH, 0_u64)
12778 .body(common::to_body::<String>(None));
12779
12780 client.request(request.unwrap()).await
12781 };
12782
12783 match req_result {
12784 Err(err) => {
12785 if let common::Retry::After(d) = dlg.http_error(&err) {
12786 sleep(d).await;
12787 continue;
12788 }
12789 dlg.finished(false);
12790 return Err(common::Error::HttpError(err));
12791 }
12792 Ok(res) => {
12793 let (mut parts, body) = res.into_parts();
12794 let mut body = common::Body::new(body);
12795 if !parts.status.is_success() {
12796 let bytes = common::to_bytes(body).await.unwrap_or_default();
12797 let error = serde_json::from_str(&common::to_string(&bytes));
12798 let response = common::to_response(parts, bytes.into());
12799
12800 if let common::Retry::After(d) =
12801 dlg.http_failure(&response, error.as_ref().ok())
12802 {
12803 sleep(d).await;
12804 continue;
12805 }
12806
12807 dlg.finished(false);
12808
12809 return Err(match error {
12810 Ok(value) => common::Error::BadRequest(value),
12811 _ => common::Error::Failure(response),
12812 });
12813 }
12814 let response = {
12815 let bytes = common::to_bytes(body).await.unwrap_or_default();
12816 let encoded = common::to_string(&bytes);
12817 match serde_json::from_str(&encoded) {
12818 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12819 Err(error) => {
12820 dlg.response_json_decode_error(&encoded, &error);
12821 return Err(common::Error::JsonDecodeError(
12822 encoded.to_string(),
12823 error,
12824 ));
12825 }
12826 }
12827 };
12828
12829 dlg.finished(true);
12830 return Ok(response);
12831 }
12832 }
12833 }
12834 }
12835
12836 /// Required. The name of the task to retrieve. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
12837 ///
12838 /// Sets the *name* path property to the given value.
12839 ///
12840 /// Even though the property as already been set when instantiating this call,
12841 /// we provide this method for API completeness.
12842 pub fn name(mut self, new_value: &str) -> NamespaceTaskGetCall<'a, C> {
12843 self._name = new_value.to_string();
12844 self
12845 }
12846 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12847 /// while executing the actual API request.
12848 ///
12849 /// ````text
12850 /// It should be used to handle progress information, and to implement a certain level of resilience.
12851 /// ````
12852 ///
12853 /// Sets the *delegate* property to the given value.
12854 pub fn delegate(
12855 mut self,
12856 new_value: &'a mut dyn common::Delegate,
12857 ) -> NamespaceTaskGetCall<'a, C> {
12858 self._delegate = Some(new_value);
12859 self
12860 }
12861
12862 /// Set any additional parameter of the query string used in the request.
12863 /// It should be used to set parameters which are not yet available through their own
12864 /// setters.
12865 ///
12866 /// Please note that this method must not be used to set any of the known parameters
12867 /// which have their own setter method. If done anyway, the request will fail.
12868 ///
12869 /// # Additional Parameters
12870 ///
12871 /// * *$.xgafv* (query-string) - V1 error format.
12872 /// * *access_token* (query-string) - OAuth access token.
12873 /// * *alt* (query-string) - Data format for response.
12874 /// * *callback* (query-string) - JSONP
12875 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12876 /// * *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.
12877 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12878 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12879 /// * *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.
12880 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12881 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12882 pub fn param<T>(mut self, name: T, value: T) -> NamespaceTaskGetCall<'a, C>
12883 where
12884 T: AsRef<str>,
12885 {
12886 self._additional_params
12887 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12888 self
12889 }
12890
12891 /// Identifies the authorization scope for the method you are building.
12892 ///
12893 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12894 /// [`Scope::CloudPlatform`].
12895 ///
12896 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12897 /// tokens for more than one scope.
12898 ///
12899 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12900 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12901 /// sufficient, a read-write scope will do as well.
12902 pub fn add_scope<St>(mut self, scope: St) -> NamespaceTaskGetCall<'a, C>
12903 where
12904 St: AsRef<str>,
12905 {
12906 self._scopes.insert(String::from(scope.as_ref()));
12907 self
12908 }
12909 /// Identifies the authorization scope(s) for the method you are building.
12910 ///
12911 /// See [`Self::add_scope()`] for details.
12912 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceTaskGetCall<'a, C>
12913 where
12914 I: IntoIterator<Item = St>,
12915 St: AsRef<str>,
12916 {
12917 self._scopes
12918 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12919 self
12920 }
12921
12922 /// Removes all scopes, and no default scope will be used either.
12923 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12924 /// for details).
12925 pub fn clear_scopes(mut self) -> NamespaceTaskGetCall<'a, C> {
12926 self._scopes.clear();
12927 self
12928 }
12929}
12930
12931/// List tasks.
12932///
12933/// A builder for the *tasks.list* method supported by a *namespace* resource.
12934/// It is not used directly, but through a [`NamespaceMethods`] instance.
12935///
12936/// # Example
12937///
12938/// Instantiate a resource method builder
12939///
12940/// ```test_harness,no_run
12941/// # extern crate hyper;
12942/// # extern crate hyper_rustls;
12943/// # extern crate google_run1 as run1;
12944/// # async fn dox() {
12945/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12946///
12947/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12948/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12949/// # secret,
12950/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12951/// # ).build().await.unwrap();
12952///
12953/// # let client = hyper_util::client::legacy::Client::builder(
12954/// # hyper_util::rt::TokioExecutor::new()
12955/// # )
12956/// # .build(
12957/// # hyper_rustls::HttpsConnectorBuilder::new()
12958/// # .with_native_roots()
12959/// # .unwrap()
12960/// # .https_or_http()
12961/// # .enable_http1()
12962/// # .build()
12963/// # );
12964/// # let mut hub = CloudRun::new(client, auth);
12965/// // You can configure optional parameters by calling the respective setters at will, and
12966/// // execute the final call using `doit()`.
12967/// // Values shown here are possibly random and not representative !
12968/// let result = hub.namespaces().tasks_list("parent")
12969/// .watch(true)
12970/// .resource_version("sadipscing")
12971/// .limit(-31)
12972/// .label_selector("aliquyam")
12973/// .include_uninitialized(true)
12974/// .field_selector("est")
12975/// .continue_("et")
12976/// .doit().await;
12977/// # }
12978/// ```
12979pub struct NamespaceTaskListCall<'a, C>
12980where
12981 C: 'a,
12982{
12983 hub: &'a CloudRun<C>,
12984 _parent: String,
12985 _watch: Option<bool>,
12986 _resource_version: Option<String>,
12987 _limit: Option<i32>,
12988 _label_selector: Option<String>,
12989 _include_uninitialized: Option<bool>,
12990 _field_selector: Option<String>,
12991 _continue_: Option<String>,
12992 _delegate: Option<&'a mut dyn common::Delegate>,
12993 _additional_params: HashMap<String, String>,
12994 _scopes: BTreeSet<String>,
12995}
12996
12997impl<'a, C> common::CallBuilder for NamespaceTaskListCall<'a, C> {}
12998
12999impl<'a, C> NamespaceTaskListCall<'a, C>
13000where
13001 C: common::Connector,
13002{
13003 /// Perform the operation you have build so far.
13004 pub async fn doit(mut self) -> common::Result<(common::Response, ListTasksResponse)> {
13005 use std::borrow::Cow;
13006 use std::io::{Read, Seek};
13007
13008 use common::{url::Params, ToParts};
13009 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13010
13011 let mut dd = common::DefaultDelegate;
13012 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13013 dlg.begin(common::MethodInfo {
13014 id: "run.namespaces.tasks.list",
13015 http_method: hyper::Method::GET,
13016 });
13017
13018 for &field in [
13019 "alt",
13020 "parent",
13021 "watch",
13022 "resourceVersion",
13023 "limit",
13024 "labelSelector",
13025 "includeUninitialized",
13026 "fieldSelector",
13027 "continue",
13028 ]
13029 .iter()
13030 {
13031 if self._additional_params.contains_key(field) {
13032 dlg.finished(false);
13033 return Err(common::Error::FieldClash(field));
13034 }
13035 }
13036
13037 let mut params = Params::with_capacity(10 + self._additional_params.len());
13038 params.push("parent", self._parent);
13039 if let Some(value) = self._watch.as_ref() {
13040 params.push("watch", value.to_string());
13041 }
13042 if let Some(value) = self._resource_version.as_ref() {
13043 params.push("resourceVersion", value);
13044 }
13045 if let Some(value) = self._limit.as_ref() {
13046 params.push("limit", value.to_string());
13047 }
13048 if let Some(value) = self._label_selector.as_ref() {
13049 params.push("labelSelector", value);
13050 }
13051 if let Some(value) = self._include_uninitialized.as_ref() {
13052 params.push("includeUninitialized", value.to_string());
13053 }
13054 if let Some(value) = self._field_selector.as_ref() {
13055 params.push("fieldSelector", value);
13056 }
13057 if let Some(value) = self._continue_.as_ref() {
13058 params.push("continue", value);
13059 }
13060
13061 params.extend(self._additional_params.iter());
13062
13063 params.push("alt", "json");
13064 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/tasks";
13065 if self._scopes.is_empty() {
13066 self._scopes
13067 .insert(Scope::CloudPlatform.as_ref().to_string());
13068 }
13069
13070 #[allow(clippy::single_element_loop)]
13071 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13072 url = params.uri_replacement(url, param_name, find_this, true);
13073 }
13074 {
13075 let to_remove = ["parent"];
13076 params.remove_params(&to_remove);
13077 }
13078
13079 let url = params.parse_with_url(&url);
13080
13081 loop {
13082 let token = match self
13083 .hub
13084 .auth
13085 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13086 .await
13087 {
13088 Ok(token) => token,
13089 Err(e) => match dlg.token(e) {
13090 Ok(token) => token,
13091 Err(e) => {
13092 dlg.finished(false);
13093 return Err(common::Error::MissingToken(e));
13094 }
13095 },
13096 };
13097 let mut req_result = {
13098 let client = &self.hub.client;
13099 dlg.pre_request();
13100 let mut req_builder = hyper::Request::builder()
13101 .method(hyper::Method::GET)
13102 .uri(url.as_str())
13103 .header(USER_AGENT, self.hub._user_agent.clone());
13104
13105 if let Some(token) = token.as_ref() {
13106 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13107 }
13108
13109 let request = req_builder
13110 .header(CONTENT_LENGTH, 0_u64)
13111 .body(common::to_body::<String>(None));
13112
13113 client.request(request.unwrap()).await
13114 };
13115
13116 match req_result {
13117 Err(err) => {
13118 if let common::Retry::After(d) = dlg.http_error(&err) {
13119 sleep(d).await;
13120 continue;
13121 }
13122 dlg.finished(false);
13123 return Err(common::Error::HttpError(err));
13124 }
13125 Ok(res) => {
13126 let (mut parts, body) = res.into_parts();
13127 let mut body = common::Body::new(body);
13128 if !parts.status.is_success() {
13129 let bytes = common::to_bytes(body).await.unwrap_or_default();
13130 let error = serde_json::from_str(&common::to_string(&bytes));
13131 let response = common::to_response(parts, bytes.into());
13132
13133 if let common::Retry::After(d) =
13134 dlg.http_failure(&response, error.as_ref().ok())
13135 {
13136 sleep(d).await;
13137 continue;
13138 }
13139
13140 dlg.finished(false);
13141
13142 return Err(match error {
13143 Ok(value) => common::Error::BadRequest(value),
13144 _ => common::Error::Failure(response),
13145 });
13146 }
13147 let response = {
13148 let bytes = common::to_bytes(body).await.unwrap_or_default();
13149 let encoded = common::to_string(&bytes);
13150 match serde_json::from_str(&encoded) {
13151 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13152 Err(error) => {
13153 dlg.response_json_decode_error(&encoded, &error);
13154 return Err(common::Error::JsonDecodeError(
13155 encoded.to_string(),
13156 error,
13157 ));
13158 }
13159 }
13160 };
13161
13162 dlg.finished(true);
13163 return Ok(response);
13164 }
13165 }
13166 }
13167 }
13168
13169 /// Required. The namespace from which the tasks should be listed. Replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
13170 ///
13171 /// Sets the *parent* path property to the given value.
13172 ///
13173 /// Even though the property as already been set when instantiating this call,
13174 /// we provide this method for API completeness.
13175 pub fn parent(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13176 self._parent = new_value.to_string();
13177 self
13178 }
13179 /// Optional. Not supported by Cloud Run.
13180 ///
13181 /// Sets the *watch* query property to the given value.
13182 pub fn watch(mut self, new_value: bool) -> NamespaceTaskListCall<'a, C> {
13183 self._watch = Some(new_value);
13184 self
13185 }
13186 /// Optional. Not supported by Cloud Run.
13187 ///
13188 /// Sets the *resource version* query property to the given value.
13189 pub fn resource_version(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13190 self._resource_version = Some(new_value.to_string());
13191 self
13192 }
13193 /// Optional. The maximum number of records that should be returned.
13194 ///
13195 /// Sets the *limit* query property to the given value.
13196 pub fn limit(mut self, new_value: i32) -> NamespaceTaskListCall<'a, C> {
13197 self._limit = Some(new_value);
13198 self
13199 }
13200 /// Optional. Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn. For example, to list all tasks of execution "foo" in succeeded state: `run.googleapis.com/execution=foo,run.googleapis.com/runningState=Succeeded`. Supported states are: * `Pending`: Initial state of all tasks. The task has not yet started but eventually will. * `Running`: Container instances for this task are running or will be running shortly. * `Succeeded`: No more container instances to run for the task, and the last attempt succeeded. * `Failed`: No more container instances to run for the task, and the last attempt failed. This task has run out of retry attempts. * `Cancelled`: Task was running but got stopped because its parent execution has been aborted. * `Abandoned`: The task has not yet started and never will because its parent execution has been aborted.
13201 ///
13202 /// Sets the *label selector* query property to the given value.
13203 pub fn label_selector(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13204 self._label_selector = Some(new_value.to_string());
13205 self
13206 }
13207 /// Optional. Not supported by Cloud Run.
13208 ///
13209 /// Sets the *include uninitialized* query property to the given value.
13210 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceTaskListCall<'a, C> {
13211 self._include_uninitialized = Some(new_value);
13212 self
13213 }
13214 /// Optional. Not supported by Cloud Run.
13215 ///
13216 /// Sets the *field selector* query property to the given value.
13217 pub fn field_selector(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13218 self._field_selector = Some(new_value.to_string());
13219 self
13220 }
13221 /// Optional. Optional encoded string to continue paging.
13222 ///
13223 /// Sets the *continue* query property to the given value.
13224 pub fn continue_(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13225 self._continue_ = Some(new_value.to_string());
13226 self
13227 }
13228 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13229 /// while executing the actual API request.
13230 ///
13231 /// ````text
13232 /// It should be used to handle progress information, and to implement a certain level of resilience.
13233 /// ````
13234 ///
13235 /// Sets the *delegate* property to the given value.
13236 pub fn delegate(
13237 mut self,
13238 new_value: &'a mut dyn common::Delegate,
13239 ) -> NamespaceTaskListCall<'a, C> {
13240 self._delegate = Some(new_value);
13241 self
13242 }
13243
13244 /// Set any additional parameter of the query string used in the request.
13245 /// It should be used to set parameters which are not yet available through their own
13246 /// setters.
13247 ///
13248 /// Please note that this method must not be used to set any of the known parameters
13249 /// which have their own setter method. If done anyway, the request will fail.
13250 ///
13251 /// # Additional Parameters
13252 ///
13253 /// * *$.xgafv* (query-string) - V1 error format.
13254 /// * *access_token* (query-string) - OAuth access token.
13255 /// * *alt* (query-string) - Data format for response.
13256 /// * *callback* (query-string) - JSONP
13257 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13258 /// * *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.
13259 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13260 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13261 /// * *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.
13262 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13263 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13264 pub fn param<T>(mut self, name: T, value: T) -> NamespaceTaskListCall<'a, C>
13265 where
13266 T: AsRef<str>,
13267 {
13268 self._additional_params
13269 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13270 self
13271 }
13272
13273 /// Identifies the authorization scope for the method you are building.
13274 ///
13275 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13276 /// [`Scope::CloudPlatform`].
13277 ///
13278 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13279 /// tokens for more than one scope.
13280 ///
13281 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13282 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13283 /// sufficient, a read-write scope will do as well.
13284 pub fn add_scope<St>(mut self, scope: St) -> NamespaceTaskListCall<'a, C>
13285 where
13286 St: AsRef<str>,
13287 {
13288 self._scopes.insert(String::from(scope.as_ref()));
13289 self
13290 }
13291 /// Identifies the authorization scope(s) for the method you are building.
13292 ///
13293 /// See [`Self::add_scope()`] for details.
13294 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceTaskListCall<'a, C>
13295 where
13296 I: IntoIterator<Item = St>,
13297 St: AsRef<str>,
13298 {
13299 self._scopes
13300 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13301 self
13302 }
13303
13304 /// Removes all scopes, and no default scope will be used either.
13305 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13306 /// for details).
13307 pub fn clear_scopes(mut self) -> NamespaceTaskListCall<'a, C> {
13308 self._scopes.clear();
13309 self
13310 }
13311}
13312
13313/// List authorized domains.
13314///
13315/// A builder for the *authorizeddomains.list* method supported by a *project* resource.
13316/// It is not used directly, but through a [`ProjectMethods`] instance.
13317///
13318/// # Example
13319///
13320/// Instantiate a resource method builder
13321///
13322/// ```test_harness,no_run
13323/// # extern crate hyper;
13324/// # extern crate hyper_rustls;
13325/// # extern crate google_run1 as run1;
13326/// # async fn dox() {
13327/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13328///
13329/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13330/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13331/// # secret,
13332/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13333/// # ).build().await.unwrap();
13334///
13335/// # let client = hyper_util::client::legacy::Client::builder(
13336/// # hyper_util::rt::TokioExecutor::new()
13337/// # )
13338/// # .build(
13339/// # hyper_rustls::HttpsConnectorBuilder::new()
13340/// # .with_native_roots()
13341/// # .unwrap()
13342/// # .https_or_http()
13343/// # .enable_http1()
13344/// # .build()
13345/// # );
13346/// # let mut hub = CloudRun::new(client, auth);
13347/// // You can configure optional parameters by calling the respective setters at will, and
13348/// // execute the final call using `doit()`.
13349/// // Values shown here are possibly random and not representative !
13350/// let result = hub.projects().authorizeddomains_list("parent")
13351/// .page_token("consetetur")
13352/// .page_size(-46)
13353/// .doit().await;
13354/// # }
13355/// ```
13356pub struct ProjectAuthorizeddomainListCall<'a, C>
13357where
13358 C: 'a,
13359{
13360 hub: &'a CloudRun<C>,
13361 _parent: String,
13362 _page_token: Option<String>,
13363 _page_size: Option<i32>,
13364 _delegate: Option<&'a mut dyn common::Delegate>,
13365 _additional_params: HashMap<String, String>,
13366 _scopes: BTreeSet<String>,
13367}
13368
13369impl<'a, C> common::CallBuilder for ProjectAuthorizeddomainListCall<'a, C> {}
13370
13371impl<'a, C> ProjectAuthorizeddomainListCall<'a, C>
13372where
13373 C: common::Connector,
13374{
13375 /// Perform the operation you have build so far.
13376 pub async fn doit(
13377 mut self,
13378 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
13379 use std::borrow::Cow;
13380 use std::io::{Read, Seek};
13381
13382 use common::{url::Params, ToParts};
13383 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13384
13385 let mut dd = common::DefaultDelegate;
13386 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13387 dlg.begin(common::MethodInfo {
13388 id: "run.projects.authorizeddomains.list",
13389 http_method: hyper::Method::GET,
13390 });
13391
13392 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
13393 if self._additional_params.contains_key(field) {
13394 dlg.finished(false);
13395 return Err(common::Error::FieldClash(field));
13396 }
13397 }
13398
13399 let mut params = Params::with_capacity(5 + self._additional_params.len());
13400 params.push("parent", self._parent);
13401 if let Some(value) = self._page_token.as_ref() {
13402 params.push("pageToken", value);
13403 }
13404 if let Some(value) = self._page_size.as_ref() {
13405 params.push("pageSize", value.to_string());
13406 }
13407
13408 params.extend(self._additional_params.iter());
13409
13410 params.push("alt", "json");
13411 let mut url = self.hub._base_url.clone() + "v1/{+parent}/authorizeddomains";
13412 if self._scopes.is_empty() {
13413 self._scopes
13414 .insert(Scope::CloudPlatform.as_ref().to_string());
13415 }
13416
13417 #[allow(clippy::single_element_loop)]
13418 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13419 url = params.uri_replacement(url, param_name, find_this, true);
13420 }
13421 {
13422 let to_remove = ["parent"];
13423 params.remove_params(&to_remove);
13424 }
13425
13426 let url = params.parse_with_url(&url);
13427
13428 loop {
13429 let token = match self
13430 .hub
13431 .auth
13432 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13433 .await
13434 {
13435 Ok(token) => token,
13436 Err(e) => match dlg.token(e) {
13437 Ok(token) => token,
13438 Err(e) => {
13439 dlg.finished(false);
13440 return Err(common::Error::MissingToken(e));
13441 }
13442 },
13443 };
13444 let mut req_result = {
13445 let client = &self.hub.client;
13446 dlg.pre_request();
13447 let mut req_builder = hyper::Request::builder()
13448 .method(hyper::Method::GET)
13449 .uri(url.as_str())
13450 .header(USER_AGENT, self.hub._user_agent.clone());
13451
13452 if let Some(token) = token.as_ref() {
13453 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13454 }
13455
13456 let request = req_builder
13457 .header(CONTENT_LENGTH, 0_u64)
13458 .body(common::to_body::<String>(None));
13459
13460 client.request(request.unwrap()).await
13461 };
13462
13463 match req_result {
13464 Err(err) => {
13465 if let common::Retry::After(d) = dlg.http_error(&err) {
13466 sleep(d).await;
13467 continue;
13468 }
13469 dlg.finished(false);
13470 return Err(common::Error::HttpError(err));
13471 }
13472 Ok(res) => {
13473 let (mut parts, body) = res.into_parts();
13474 let mut body = common::Body::new(body);
13475 if !parts.status.is_success() {
13476 let bytes = common::to_bytes(body).await.unwrap_or_default();
13477 let error = serde_json::from_str(&common::to_string(&bytes));
13478 let response = common::to_response(parts, bytes.into());
13479
13480 if let common::Retry::After(d) =
13481 dlg.http_failure(&response, error.as_ref().ok())
13482 {
13483 sleep(d).await;
13484 continue;
13485 }
13486
13487 dlg.finished(false);
13488
13489 return Err(match error {
13490 Ok(value) => common::Error::BadRequest(value),
13491 _ => common::Error::Failure(response),
13492 });
13493 }
13494 let response = {
13495 let bytes = common::to_bytes(body).await.unwrap_or_default();
13496 let encoded = common::to_string(&bytes);
13497 match serde_json::from_str(&encoded) {
13498 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13499 Err(error) => {
13500 dlg.response_json_decode_error(&encoded, &error);
13501 return Err(common::Error::JsonDecodeError(
13502 encoded.to_string(),
13503 error,
13504 ));
13505 }
13506 }
13507 };
13508
13509 dlg.finished(true);
13510 return Ok(response);
13511 }
13512 }
13513 }
13514 }
13515
13516 /// Name of the parent Project resource. Example: `projects/myproject`.
13517 ///
13518 /// Sets the *parent* path property to the given value.
13519 ///
13520 /// Even though the property as already been set when instantiating this call,
13521 /// we provide this method for API completeness.
13522 pub fn parent(mut self, new_value: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
13523 self._parent = new_value.to_string();
13524 self
13525 }
13526 /// Continuation token for fetching the next page of results.
13527 ///
13528 /// Sets the *page token* query property to the given value.
13529 pub fn page_token(mut self, new_value: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
13530 self._page_token = Some(new_value.to_string());
13531 self
13532 }
13533 /// Maximum results to return per page.
13534 ///
13535 /// Sets the *page size* query property to the given value.
13536 pub fn page_size(mut self, new_value: i32) -> ProjectAuthorizeddomainListCall<'a, C> {
13537 self._page_size = Some(new_value);
13538 self
13539 }
13540 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13541 /// while executing the actual API request.
13542 ///
13543 /// ````text
13544 /// It should be used to handle progress information, and to implement a certain level of resilience.
13545 /// ````
13546 ///
13547 /// Sets the *delegate* property to the given value.
13548 pub fn delegate(
13549 mut self,
13550 new_value: &'a mut dyn common::Delegate,
13551 ) -> ProjectAuthorizeddomainListCall<'a, C> {
13552 self._delegate = Some(new_value);
13553 self
13554 }
13555
13556 /// Set any additional parameter of the query string used in the request.
13557 /// It should be used to set parameters which are not yet available through their own
13558 /// setters.
13559 ///
13560 /// Please note that this method must not be used to set any of the known parameters
13561 /// which have their own setter method. If done anyway, the request will fail.
13562 ///
13563 /// # Additional Parameters
13564 ///
13565 /// * *$.xgafv* (query-string) - V1 error format.
13566 /// * *access_token* (query-string) - OAuth access token.
13567 /// * *alt* (query-string) - Data format for response.
13568 /// * *callback* (query-string) - JSONP
13569 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13570 /// * *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.
13571 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13572 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13573 /// * *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.
13574 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13575 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13576 pub fn param<T>(mut self, name: T, value: T) -> ProjectAuthorizeddomainListCall<'a, C>
13577 where
13578 T: AsRef<str>,
13579 {
13580 self._additional_params
13581 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13582 self
13583 }
13584
13585 /// Identifies the authorization scope for the method you are building.
13586 ///
13587 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13588 /// [`Scope::CloudPlatform`].
13589 ///
13590 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13591 /// tokens for more than one scope.
13592 ///
13593 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13594 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13595 /// sufficient, a read-write scope will do as well.
13596 pub fn add_scope<St>(mut self, scope: St) -> ProjectAuthorizeddomainListCall<'a, C>
13597 where
13598 St: AsRef<str>,
13599 {
13600 self._scopes.insert(String::from(scope.as_ref()));
13601 self
13602 }
13603 /// Identifies the authorization scope(s) for the method you are building.
13604 ///
13605 /// See [`Self::add_scope()`] for details.
13606 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAuthorizeddomainListCall<'a, C>
13607 where
13608 I: IntoIterator<Item = St>,
13609 St: AsRef<str>,
13610 {
13611 self._scopes
13612 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13613 self
13614 }
13615
13616 /// Removes all scopes, and no default scope will be used either.
13617 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13618 /// for details).
13619 pub fn clear_scopes(mut self) -> ProjectAuthorizeddomainListCall<'a, C> {
13620 self._scopes.clear();
13621 self
13622 }
13623}
13624
13625/// List authorized domains.
13626///
13627/// A builder for the *locations.authorizeddomains.list* method supported by a *project* resource.
13628/// It is not used directly, but through a [`ProjectMethods`] instance.
13629///
13630/// # Example
13631///
13632/// Instantiate a resource method builder
13633///
13634/// ```test_harness,no_run
13635/// # extern crate hyper;
13636/// # extern crate hyper_rustls;
13637/// # extern crate google_run1 as run1;
13638/// # async fn dox() {
13639/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13640///
13641/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13642/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13643/// # secret,
13644/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13645/// # ).build().await.unwrap();
13646///
13647/// # let client = hyper_util::client::legacy::Client::builder(
13648/// # hyper_util::rt::TokioExecutor::new()
13649/// # )
13650/// # .build(
13651/// # hyper_rustls::HttpsConnectorBuilder::new()
13652/// # .with_native_roots()
13653/// # .unwrap()
13654/// # .https_or_http()
13655/// # .enable_http1()
13656/// # .build()
13657/// # );
13658/// # let mut hub = CloudRun::new(client, auth);
13659/// // You can configure optional parameters by calling the respective setters at will, and
13660/// // execute the final call using `doit()`.
13661/// // Values shown here are possibly random and not representative !
13662/// let result = hub.projects().locations_authorizeddomains_list("parent")
13663/// .page_token("est")
13664/// .page_size(-82)
13665/// .doit().await;
13666/// # }
13667/// ```
13668pub struct ProjectLocationAuthorizeddomainListCall<'a, C>
13669where
13670 C: 'a,
13671{
13672 hub: &'a CloudRun<C>,
13673 _parent: String,
13674 _page_token: Option<String>,
13675 _page_size: Option<i32>,
13676 _delegate: Option<&'a mut dyn common::Delegate>,
13677 _additional_params: HashMap<String, String>,
13678 _scopes: BTreeSet<String>,
13679}
13680
13681impl<'a, C> common::CallBuilder for ProjectLocationAuthorizeddomainListCall<'a, C> {}
13682
13683impl<'a, C> ProjectLocationAuthorizeddomainListCall<'a, C>
13684where
13685 C: common::Connector,
13686{
13687 /// Perform the operation you have build so far.
13688 pub async fn doit(
13689 mut self,
13690 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
13691 use std::borrow::Cow;
13692 use std::io::{Read, Seek};
13693
13694 use common::{url::Params, ToParts};
13695 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13696
13697 let mut dd = common::DefaultDelegate;
13698 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13699 dlg.begin(common::MethodInfo {
13700 id: "run.projects.locations.authorizeddomains.list",
13701 http_method: hyper::Method::GET,
13702 });
13703
13704 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
13705 if self._additional_params.contains_key(field) {
13706 dlg.finished(false);
13707 return Err(common::Error::FieldClash(field));
13708 }
13709 }
13710
13711 let mut params = Params::with_capacity(5 + self._additional_params.len());
13712 params.push("parent", self._parent);
13713 if let Some(value) = self._page_token.as_ref() {
13714 params.push("pageToken", value);
13715 }
13716 if let Some(value) = self._page_size.as_ref() {
13717 params.push("pageSize", value.to_string());
13718 }
13719
13720 params.extend(self._additional_params.iter());
13721
13722 params.push("alt", "json");
13723 let mut url = self.hub._base_url.clone() + "v1/{+parent}/authorizeddomains";
13724 if self._scopes.is_empty() {
13725 self._scopes
13726 .insert(Scope::CloudPlatform.as_ref().to_string());
13727 }
13728
13729 #[allow(clippy::single_element_loop)]
13730 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13731 url = params.uri_replacement(url, param_name, find_this, true);
13732 }
13733 {
13734 let to_remove = ["parent"];
13735 params.remove_params(&to_remove);
13736 }
13737
13738 let url = params.parse_with_url(&url);
13739
13740 loop {
13741 let token = match self
13742 .hub
13743 .auth
13744 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13745 .await
13746 {
13747 Ok(token) => token,
13748 Err(e) => match dlg.token(e) {
13749 Ok(token) => token,
13750 Err(e) => {
13751 dlg.finished(false);
13752 return Err(common::Error::MissingToken(e));
13753 }
13754 },
13755 };
13756 let mut req_result = {
13757 let client = &self.hub.client;
13758 dlg.pre_request();
13759 let mut req_builder = hyper::Request::builder()
13760 .method(hyper::Method::GET)
13761 .uri(url.as_str())
13762 .header(USER_AGENT, self.hub._user_agent.clone());
13763
13764 if let Some(token) = token.as_ref() {
13765 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13766 }
13767
13768 let request = req_builder
13769 .header(CONTENT_LENGTH, 0_u64)
13770 .body(common::to_body::<String>(None));
13771
13772 client.request(request.unwrap()).await
13773 };
13774
13775 match req_result {
13776 Err(err) => {
13777 if let common::Retry::After(d) = dlg.http_error(&err) {
13778 sleep(d).await;
13779 continue;
13780 }
13781 dlg.finished(false);
13782 return Err(common::Error::HttpError(err));
13783 }
13784 Ok(res) => {
13785 let (mut parts, body) = res.into_parts();
13786 let mut body = common::Body::new(body);
13787 if !parts.status.is_success() {
13788 let bytes = common::to_bytes(body).await.unwrap_or_default();
13789 let error = serde_json::from_str(&common::to_string(&bytes));
13790 let response = common::to_response(parts, bytes.into());
13791
13792 if let common::Retry::After(d) =
13793 dlg.http_failure(&response, error.as_ref().ok())
13794 {
13795 sleep(d).await;
13796 continue;
13797 }
13798
13799 dlg.finished(false);
13800
13801 return Err(match error {
13802 Ok(value) => common::Error::BadRequest(value),
13803 _ => common::Error::Failure(response),
13804 });
13805 }
13806 let response = {
13807 let bytes = common::to_bytes(body).await.unwrap_or_default();
13808 let encoded = common::to_string(&bytes);
13809 match serde_json::from_str(&encoded) {
13810 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13811 Err(error) => {
13812 dlg.response_json_decode_error(&encoded, &error);
13813 return Err(common::Error::JsonDecodeError(
13814 encoded.to_string(),
13815 error,
13816 ));
13817 }
13818 }
13819 };
13820
13821 dlg.finished(true);
13822 return Ok(response);
13823 }
13824 }
13825 }
13826 }
13827
13828 /// Name of the parent Project resource. Example: `projects/myproject`.
13829 ///
13830 /// Sets the *parent* path property to the given value.
13831 ///
13832 /// Even though the property as already been set when instantiating this call,
13833 /// we provide this method for API completeness.
13834 pub fn parent(mut self, new_value: &str) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
13835 self._parent = new_value.to_string();
13836 self
13837 }
13838 /// Continuation token for fetching the next page of results.
13839 ///
13840 /// Sets the *page token* query property to the given value.
13841 pub fn page_token(mut self, new_value: &str) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
13842 self._page_token = Some(new_value.to_string());
13843 self
13844 }
13845 /// Maximum results to return per page.
13846 ///
13847 /// Sets the *page size* query property to the given value.
13848 pub fn page_size(mut self, new_value: i32) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
13849 self._page_size = Some(new_value);
13850 self
13851 }
13852 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13853 /// while executing the actual API request.
13854 ///
13855 /// ````text
13856 /// It should be used to handle progress information, and to implement a certain level of resilience.
13857 /// ````
13858 ///
13859 /// Sets the *delegate* property to the given value.
13860 pub fn delegate(
13861 mut self,
13862 new_value: &'a mut dyn common::Delegate,
13863 ) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
13864 self._delegate = Some(new_value);
13865 self
13866 }
13867
13868 /// Set any additional parameter of the query string used in the request.
13869 /// It should be used to set parameters which are not yet available through their own
13870 /// setters.
13871 ///
13872 /// Please note that this method must not be used to set any of the known parameters
13873 /// which have their own setter method. If done anyway, the request will fail.
13874 ///
13875 /// # Additional Parameters
13876 ///
13877 /// * *$.xgafv* (query-string) - V1 error format.
13878 /// * *access_token* (query-string) - OAuth access token.
13879 /// * *alt* (query-string) - Data format for response.
13880 /// * *callback* (query-string) - JSONP
13881 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13882 /// * *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.
13883 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13884 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13885 /// * *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.
13886 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13887 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13888 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationAuthorizeddomainListCall<'a, C>
13889 where
13890 T: AsRef<str>,
13891 {
13892 self._additional_params
13893 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13894 self
13895 }
13896
13897 /// Identifies the authorization scope for the method you are building.
13898 ///
13899 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13900 /// [`Scope::CloudPlatform`].
13901 ///
13902 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13903 /// tokens for more than one scope.
13904 ///
13905 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13906 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13907 /// sufficient, a read-write scope will do as well.
13908 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAuthorizeddomainListCall<'a, C>
13909 where
13910 St: AsRef<str>,
13911 {
13912 self._scopes.insert(String::from(scope.as_ref()));
13913 self
13914 }
13915 /// Identifies the authorization scope(s) for the method you are building.
13916 ///
13917 /// See [`Self::add_scope()`] for details.
13918 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationAuthorizeddomainListCall<'a, C>
13919 where
13920 I: IntoIterator<Item = St>,
13921 St: AsRef<str>,
13922 {
13923 self._scopes
13924 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13925 self
13926 }
13927
13928 /// Removes all scopes, and no default scope will be used either.
13929 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13930 /// for details).
13931 pub fn clear_scopes(mut self) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
13932 self._scopes.clear();
13933 self
13934 }
13935}
13936
13937/// Get information about a configuration.
13938///
13939/// A builder for the *locations.configurations.get* method supported by a *project* resource.
13940/// It is not used directly, but through a [`ProjectMethods`] instance.
13941///
13942/// # Example
13943///
13944/// Instantiate a resource method builder
13945///
13946/// ```test_harness,no_run
13947/// # extern crate hyper;
13948/// # extern crate hyper_rustls;
13949/// # extern crate google_run1 as run1;
13950/// # async fn dox() {
13951/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13952///
13953/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13954/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13955/// # secret,
13956/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13957/// # ).build().await.unwrap();
13958///
13959/// # let client = hyper_util::client::legacy::Client::builder(
13960/// # hyper_util::rt::TokioExecutor::new()
13961/// # )
13962/// # .build(
13963/// # hyper_rustls::HttpsConnectorBuilder::new()
13964/// # .with_native_roots()
13965/// # .unwrap()
13966/// # .https_or_http()
13967/// # .enable_http1()
13968/// # .build()
13969/// # );
13970/// # let mut hub = CloudRun::new(client, auth);
13971/// // You can configure optional parameters by calling the respective setters at will, and
13972/// // execute the final call using `doit()`.
13973/// // Values shown here are possibly random and not representative !
13974/// let result = hub.projects().locations_configurations_get("name")
13975/// .doit().await;
13976/// # }
13977/// ```
13978pub struct ProjectLocationConfigurationGetCall<'a, C>
13979where
13980 C: 'a,
13981{
13982 hub: &'a CloudRun<C>,
13983 _name: String,
13984 _delegate: Option<&'a mut dyn common::Delegate>,
13985 _additional_params: HashMap<String, String>,
13986 _scopes: BTreeSet<String>,
13987}
13988
13989impl<'a, C> common::CallBuilder for ProjectLocationConfigurationGetCall<'a, C> {}
13990
13991impl<'a, C> ProjectLocationConfigurationGetCall<'a, C>
13992where
13993 C: common::Connector,
13994{
13995 /// Perform the operation you have build so far.
13996 pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
13997 use std::borrow::Cow;
13998 use std::io::{Read, Seek};
13999
14000 use common::{url::Params, ToParts};
14001 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14002
14003 let mut dd = common::DefaultDelegate;
14004 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14005 dlg.begin(common::MethodInfo {
14006 id: "run.projects.locations.configurations.get",
14007 http_method: hyper::Method::GET,
14008 });
14009
14010 for &field in ["alt", "name"].iter() {
14011 if self._additional_params.contains_key(field) {
14012 dlg.finished(false);
14013 return Err(common::Error::FieldClash(field));
14014 }
14015 }
14016
14017 let mut params = Params::with_capacity(3 + self._additional_params.len());
14018 params.push("name", self._name);
14019
14020 params.extend(self._additional_params.iter());
14021
14022 params.push("alt", "json");
14023 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14024 if self._scopes.is_empty() {
14025 self._scopes
14026 .insert(Scope::CloudPlatform.as_ref().to_string());
14027 }
14028
14029 #[allow(clippy::single_element_loop)]
14030 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14031 url = params.uri_replacement(url, param_name, find_this, true);
14032 }
14033 {
14034 let to_remove = ["name"];
14035 params.remove_params(&to_remove);
14036 }
14037
14038 let url = params.parse_with_url(&url);
14039
14040 loop {
14041 let token = match self
14042 .hub
14043 .auth
14044 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14045 .await
14046 {
14047 Ok(token) => token,
14048 Err(e) => match dlg.token(e) {
14049 Ok(token) => token,
14050 Err(e) => {
14051 dlg.finished(false);
14052 return Err(common::Error::MissingToken(e));
14053 }
14054 },
14055 };
14056 let mut req_result = {
14057 let client = &self.hub.client;
14058 dlg.pre_request();
14059 let mut req_builder = hyper::Request::builder()
14060 .method(hyper::Method::GET)
14061 .uri(url.as_str())
14062 .header(USER_AGENT, self.hub._user_agent.clone());
14063
14064 if let Some(token) = token.as_ref() {
14065 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14066 }
14067
14068 let request = req_builder
14069 .header(CONTENT_LENGTH, 0_u64)
14070 .body(common::to_body::<String>(None));
14071
14072 client.request(request.unwrap()).await
14073 };
14074
14075 match req_result {
14076 Err(err) => {
14077 if let common::Retry::After(d) = dlg.http_error(&err) {
14078 sleep(d).await;
14079 continue;
14080 }
14081 dlg.finished(false);
14082 return Err(common::Error::HttpError(err));
14083 }
14084 Ok(res) => {
14085 let (mut parts, body) = res.into_parts();
14086 let mut body = common::Body::new(body);
14087 if !parts.status.is_success() {
14088 let bytes = common::to_bytes(body).await.unwrap_or_default();
14089 let error = serde_json::from_str(&common::to_string(&bytes));
14090 let response = common::to_response(parts, bytes.into());
14091
14092 if let common::Retry::After(d) =
14093 dlg.http_failure(&response, error.as_ref().ok())
14094 {
14095 sleep(d).await;
14096 continue;
14097 }
14098
14099 dlg.finished(false);
14100
14101 return Err(match error {
14102 Ok(value) => common::Error::BadRequest(value),
14103 _ => common::Error::Failure(response),
14104 });
14105 }
14106 let response = {
14107 let bytes = common::to_bytes(body).await.unwrap_or_default();
14108 let encoded = common::to_string(&bytes);
14109 match serde_json::from_str(&encoded) {
14110 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14111 Err(error) => {
14112 dlg.response_json_decode_error(&encoded, &error);
14113 return Err(common::Error::JsonDecodeError(
14114 encoded.to_string(),
14115 error,
14116 ));
14117 }
14118 }
14119 };
14120
14121 dlg.finished(true);
14122 return Ok(response);
14123 }
14124 }
14125 }
14126 }
14127
14128 /// The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
14129 ///
14130 /// Sets the *name* path property to the given value.
14131 ///
14132 /// Even though the property as already been set when instantiating this call,
14133 /// we provide this method for API completeness.
14134 pub fn name(mut self, new_value: &str) -> ProjectLocationConfigurationGetCall<'a, C> {
14135 self._name = new_value.to_string();
14136 self
14137 }
14138 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14139 /// while executing the actual API request.
14140 ///
14141 /// ````text
14142 /// It should be used to handle progress information, and to implement a certain level of resilience.
14143 /// ````
14144 ///
14145 /// Sets the *delegate* property to the given value.
14146 pub fn delegate(
14147 mut self,
14148 new_value: &'a mut dyn common::Delegate,
14149 ) -> ProjectLocationConfigurationGetCall<'a, C> {
14150 self._delegate = Some(new_value);
14151 self
14152 }
14153
14154 /// Set any additional parameter of the query string used in the request.
14155 /// It should be used to set parameters which are not yet available through their own
14156 /// setters.
14157 ///
14158 /// Please note that this method must not be used to set any of the known parameters
14159 /// which have their own setter method. If done anyway, the request will fail.
14160 ///
14161 /// # Additional Parameters
14162 ///
14163 /// * *$.xgafv* (query-string) - V1 error format.
14164 /// * *access_token* (query-string) - OAuth access token.
14165 /// * *alt* (query-string) - Data format for response.
14166 /// * *callback* (query-string) - JSONP
14167 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14168 /// * *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.
14169 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14170 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14171 /// * *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.
14172 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14173 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14174 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConfigurationGetCall<'a, C>
14175 where
14176 T: AsRef<str>,
14177 {
14178 self._additional_params
14179 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14180 self
14181 }
14182
14183 /// Identifies the authorization scope for the method you are building.
14184 ///
14185 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14186 /// [`Scope::CloudPlatform`].
14187 ///
14188 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14189 /// tokens for more than one scope.
14190 ///
14191 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14192 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14193 /// sufficient, a read-write scope will do as well.
14194 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConfigurationGetCall<'a, C>
14195 where
14196 St: AsRef<str>,
14197 {
14198 self._scopes.insert(String::from(scope.as_ref()));
14199 self
14200 }
14201 /// Identifies the authorization scope(s) for the method you are building.
14202 ///
14203 /// See [`Self::add_scope()`] for details.
14204 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConfigurationGetCall<'a, C>
14205 where
14206 I: IntoIterator<Item = St>,
14207 St: AsRef<str>,
14208 {
14209 self._scopes
14210 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14211 self
14212 }
14213
14214 /// Removes all scopes, and no default scope will be used either.
14215 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14216 /// for details).
14217 pub fn clear_scopes(mut self) -> ProjectLocationConfigurationGetCall<'a, C> {
14218 self._scopes.clear();
14219 self
14220 }
14221}
14222
14223/// List configurations. Results are sorted by creation time, descending.
14224///
14225/// A builder for the *locations.configurations.list* method supported by a *project* resource.
14226/// It is not used directly, but through a [`ProjectMethods`] instance.
14227///
14228/// # Example
14229///
14230/// Instantiate a resource method builder
14231///
14232/// ```test_harness,no_run
14233/// # extern crate hyper;
14234/// # extern crate hyper_rustls;
14235/// # extern crate google_run1 as run1;
14236/// # async fn dox() {
14237/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14238///
14239/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14241/// # secret,
14242/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14243/// # ).build().await.unwrap();
14244///
14245/// # let client = hyper_util::client::legacy::Client::builder(
14246/// # hyper_util::rt::TokioExecutor::new()
14247/// # )
14248/// # .build(
14249/// # hyper_rustls::HttpsConnectorBuilder::new()
14250/// # .with_native_roots()
14251/// # .unwrap()
14252/// # .https_or_http()
14253/// # .enable_http1()
14254/// # .build()
14255/// # );
14256/// # let mut hub = CloudRun::new(client, auth);
14257/// // You can configure optional parameters by calling the respective setters at will, and
14258/// // execute the final call using `doit()`.
14259/// // Values shown here are possibly random and not representative !
14260/// let result = hub.projects().locations_configurations_list("parent")
14261/// .watch(true)
14262/// .resource_version("est")
14263/// .limit(-53)
14264/// .label_selector("sed")
14265/// .include_uninitialized(false)
14266/// .field_selector("Lorem")
14267/// .continue_("ea")
14268/// .doit().await;
14269/// # }
14270/// ```
14271pub struct ProjectLocationConfigurationListCall<'a, C>
14272where
14273 C: 'a,
14274{
14275 hub: &'a CloudRun<C>,
14276 _parent: String,
14277 _watch: Option<bool>,
14278 _resource_version: Option<String>,
14279 _limit: Option<i32>,
14280 _label_selector: Option<String>,
14281 _include_uninitialized: Option<bool>,
14282 _field_selector: Option<String>,
14283 _continue_: Option<String>,
14284 _delegate: Option<&'a mut dyn common::Delegate>,
14285 _additional_params: HashMap<String, String>,
14286 _scopes: BTreeSet<String>,
14287}
14288
14289impl<'a, C> common::CallBuilder for ProjectLocationConfigurationListCall<'a, C> {}
14290
14291impl<'a, C> ProjectLocationConfigurationListCall<'a, C>
14292where
14293 C: common::Connector,
14294{
14295 /// Perform the operation you have build so far.
14296 pub async fn doit(mut self) -> common::Result<(common::Response, ListConfigurationsResponse)> {
14297 use std::borrow::Cow;
14298 use std::io::{Read, Seek};
14299
14300 use common::{url::Params, ToParts};
14301 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14302
14303 let mut dd = common::DefaultDelegate;
14304 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14305 dlg.begin(common::MethodInfo {
14306 id: "run.projects.locations.configurations.list",
14307 http_method: hyper::Method::GET,
14308 });
14309
14310 for &field in [
14311 "alt",
14312 "parent",
14313 "watch",
14314 "resourceVersion",
14315 "limit",
14316 "labelSelector",
14317 "includeUninitialized",
14318 "fieldSelector",
14319 "continue",
14320 ]
14321 .iter()
14322 {
14323 if self._additional_params.contains_key(field) {
14324 dlg.finished(false);
14325 return Err(common::Error::FieldClash(field));
14326 }
14327 }
14328
14329 let mut params = Params::with_capacity(10 + self._additional_params.len());
14330 params.push("parent", self._parent);
14331 if let Some(value) = self._watch.as_ref() {
14332 params.push("watch", value.to_string());
14333 }
14334 if let Some(value) = self._resource_version.as_ref() {
14335 params.push("resourceVersion", value);
14336 }
14337 if let Some(value) = self._limit.as_ref() {
14338 params.push("limit", value.to_string());
14339 }
14340 if let Some(value) = self._label_selector.as_ref() {
14341 params.push("labelSelector", value);
14342 }
14343 if let Some(value) = self._include_uninitialized.as_ref() {
14344 params.push("includeUninitialized", value.to_string());
14345 }
14346 if let Some(value) = self._field_selector.as_ref() {
14347 params.push("fieldSelector", value);
14348 }
14349 if let Some(value) = self._continue_.as_ref() {
14350 params.push("continue", value);
14351 }
14352
14353 params.extend(self._additional_params.iter());
14354
14355 params.push("alt", "json");
14356 let mut url = self.hub._base_url.clone() + "v1/{+parent}/configurations";
14357 if self._scopes.is_empty() {
14358 self._scopes
14359 .insert(Scope::CloudPlatform.as_ref().to_string());
14360 }
14361
14362 #[allow(clippy::single_element_loop)]
14363 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14364 url = params.uri_replacement(url, param_name, find_this, true);
14365 }
14366 {
14367 let to_remove = ["parent"];
14368 params.remove_params(&to_remove);
14369 }
14370
14371 let url = params.parse_with_url(&url);
14372
14373 loop {
14374 let token = match self
14375 .hub
14376 .auth
14377 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14378 .await
14379 {
14380 Ok(token) => token,
14381 Err(e) => match dlg.token(e) {
14382 Ok(token) => token,
14383 Err(e) => {
14384 dlg.finished(false);
14385 return Err(common::Error::MissingToken(e));
14386 }
14387 },
14388 };
14389 let mut req_result = {
14390 let client = &self.hub.client;
14391 dlg.pre_request();
14392 let mut req_builder = hyper::Request::builder()
14393 .method(hyper::Method::GET)
14394 .uri(url.as_str())
14395 .header(USER_AGENT, self.hub._user_agent.clone());
14396
14397 if let Some(token) = token.as_ref() {
14398 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14399 }
14400
14401 let request = req_builder
14402 .header(CONTENT_LENGTH, 0_u64)
14403 .body(common::to_body::<String>(None));
14404
14405 client.request(request.unwrap()).await
14406 };
14407
14408 match req_result {
14409 Err(err) => {
14410 if let common::Retry::After(d) = dlg.http_error(&err) {
14411 sleep(d).await;
14412 continue;
14413 }
14414 dlg.finished(false);
14415 return Err(common::Error::HttpError(err));
14416 }
14417 Ok(res) => {
14418 let (mut parts, body) = res.into_parts();
14419 let mut body = common::Body::new(body);
14420 if !parts.status.is_success() {
14421 let bytes = common::to_bytes(body).await.unwrap_or_default();
14422 let error = serde_json::from_str(&common::to_string(&bytes));
14423 let response = common::to_response(parts, bytes.into());
14424
14425 if let common::Retry::After(d) =
14426 dlg.http_failure(&response, error.as_ref().ok())
14427 {
14428 sleep(d).await;
14429 continue;
14430 }
14431
14432 dlg.finished(false);
14433
14434 return Err(match error {
14435 Ok(value) => common::Error::BadRequest(value),
14436 _ => common::Error::Failure(response),
14437 });
14438 }
14439 let response = {
14440 let bytes = common::to_bytes(body).await.unwrap_or_default();
14441 let encoded = common::to_string(&bytes);
14442 match serde_json::from_str(&encoded) {
14443 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14444 Err(error) => {
14445 dlg.response_json_decode_error(&encoded, &error);
14446 return Err(common::Error::JsonDecodeError(
14447 encoded.to_string(),
14448 error,
14449 ));
14450 }
14451 }
14452 };
14453
14454 dlg.finished(true);
14455 return Ok(response);
14456 }
14457 }
14458 }
14459 }
14460
14461 /// The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
14462 ///
14463 /// Sets the *parent* path property to the given value.
14464 ///
14465 /// Even though the property as already been set when instantiating this call,
14466 /// we provide this method for API completeness.
14467 pub fn parent(mut self, new_value: &str) -> ProjectLocationConfigurationListCall<'a, C> {
14468 self._parent = new_value.to_string();
14469 self
14470 }
14471 /// Not supported by Cloud Run.
14472 ///
14473 /// Sets the *watch* query property to the given value.
14474 pub fn watch(mut self, new_value: bool) -> ProjectLocationConfigurationListCall<'a, C> {
14475 self._watch = Some(new_value);
14476 self
14477 }
14478 /// Not supported by Cloud Run.
14479 ///
14480 /// Sets the *resource version* query property to the given value.
14481 pub fn resource_version(
14482 mut self,
14483 new_value: &str,
14484 ) -> ProjectLocationConfigurationListCall<'a, C> {
14485 self._resource_version = Some(new_value.to_string());
14486 self
14487 }
14488 /// Optional. The maximum number of the records that should be returned.
14489 ///
14490 /// Sets the *limit* query property to the given value.
14491 pub fn limit(mut self, new_value: i32) -> ProjectLocationConfigurationListCall<'a, C> {
14492 self._limit = Some(new_value);
14493 self
14494 }
14495 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
14496 ///
14497 /// Sets the *label selector* query property to the given value.
14498 pub fn label_selector(
14499 mut self,
14500 new_value: &str,
14501 ) -> ProjectLocationConfigurationListCall<'a, C> {
14502 self._label_selector = Some(new_value.to_string());
14503 self
14504 }
14505 /// Not supported by Cloud Run.
14506 ///
14507 /// Sets the *include uninitialized* query property to the given value.
14508 pub fn include_uninitialized(
14509 mut self,
14510 new_value: bool,
14511 ) -> ProjectLocationConfigurationListCall<'a, C> {
14512 self._include_uninitialized = Some(new_value);
14513 self
14514 }
14515 /// Not supported by Cloud Run.
14516 ///
14517 /// Sets the *field selector* query property to the given value.
14518 pub fn field_selector(
14519 mut self,
14520 new_value: &str,
14521 ) -> ProjectLocationConfigurationListCall<'a, C> {
14522 self._field_selector = Some(new_value.to_string());
14523 self
14524 }
14525 /// Optional. Encoded string to continue paging.
14526 ///
14527 /// Sets the *continue* query property to the given value.
14528 pub fn continue_(mut self, new_value: &str) -> ProjectLocationConfigurationListCall<'a, C> {
14529 self._continue_ = Some(new_value.to_string());
14530 self
14531 }
14532 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14533 /// while executing the actual API request.
14534 ///
14535 /// ````text
14536 /// It should be used to handle progress information, and to implement a certain level of resilience.
14537 /// ````
14538 ///
14539 /// Sets the *delegate* property to the given value.
14540 pub fn delegate(
14541 mut self,
14542 new_value: &'a mut dyn common::Delegate,
14543 ) -> ProjectLocationConfigurationListCall<'a, C> {
14544 self._delegate = Some(new_value);
14545 self
14546 }
14547
14548 /// Set any additional parameter of the query string used in the request.
14549 /// It should be used to set parameters which are not yet available through their own
14550 /// setters.
14551 ///
14552 /// Please note that this method must not be used to set any of the known parameters
14553 /// which have their own setter method. If done anyway, the request will fail.
14554 ///
14555 /// # Additional Parameters
14556 ///
14557 /// * *$.xgafv* (query-string) - V1 error format.
14558 /// * *access_token* (query-string) - OAuth access token.
14559 /// * *alt* (query-string) - Data format for response.
14560 /// * *callback* (query-string) - JSONP
14561 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14562 /// * *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.
14563 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14564 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14565 /// * *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.
14566 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14567 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14568 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConfigurationListCall<'a, C>
14569 where
14570 T: AsRef<str>,
14571 {
14572 self._additional_params
14573 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14574 self
14575 }
14576
14577 /// Identifies the authorization scope for the method you are building.
14578 ///
14579 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14580 /// [`Scope::CloudPlatform`].
14581 ///
14582 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14583 /// tokens for more than one scope.
14584 ///
14585 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14586 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14587 /// sufficient, a read-write scope will do as well.
14588 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConfigurationListCall<'a, C>
14589 where
14590 St: AsRef<str>,
14591 {
14592 self._scopes.insert(String::from(scope.as_ref()));
14593 self
14594 }
14595 /// Identifies the authorization scope(s) for the method you are building.
14596 ///
14597 /// See [`Self::add_scope()`] for details.
14598 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConfigurationListCall<'a, C>
14599 where
14600 I: IntoIterator<Item = St>,
14601 St: AsRef<str>,
14602 {
14603 self._scopes
14604 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14605 self
14606 }
14607
14608 /// Removes all scopes, and no default scope will be used either.
14609 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14610 /// for details).
14611 pub fn clear_scopes(mut self) -> ProjectLocationConfigurationListCall<'a, C> {
14612 self._scopes.clear();
14613 self
14614 }
14615}
14616
14617/// Create a new domain mapping.
14618///
14619/// A builder for the *locations.domainmappings.create* method supported by a *project* resource.
14620/// It is not used directly, but through a [`ProjectMethods`] instance.
14621///
14622/// # Example
14623///
14624/// Instantiate a resource method builder
14625///
14626/// ```test_harness,no_run
14627/// # extern crate hyper;
14628/// # extern crate hyper_rustls;
14629/// # extern crate google_run1 as run1;
14630/// use run1::api::DomainMapping;
14631/// # async fn dox() {
14632/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14633///
14634/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14635/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14636/// # secret,
14637/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14638/// # ).build().await.unwrap();
14639///
14640/// # let client = hyper_util::client::legacy::Client::builder(
14641/// # hyper_util::rt::TokioExecutor::new()
14642/// # )
14643/// # .build(
14644/// # hyper_rustls::HttpsConnectorBuilder::new()
14645/// # .with_native_roots()
14646/// # .unwrap()
14647/// # .https_or_http()
14648/// # .enable_http1()
14649/// # .build()
14650/// # );
14651/// # let mut hub = CloudRun::new(client, auth);
14652/// // As the method needs a request, you would usually fill it with the desired information
14653/// // into the respective structure. Some of the parts shown here might not be applicable !
14654/// // Values shown here are possibly random and not representative !
14655/// let mut req = DomainMapping::default();
14656///
14657/// // You can configure optional parameters by calling the respective setters at will, and
14658/// // execute the final call using `doit()`.
14659/// // Values shown here are possibly random and not representative !
14660/// let result = hub.projects().locations_domainmappings_create(req, "parent")
14661/// .dry_run("dolores")
14662/// .doit().await;
14663/// # }
14664/// ```
14665pub struct ProjectLocationDomainmappingCreateCall<'a, C>
14666where
14667 C: 'a,
14668{
14669 hub: &'a CloudRun<C>,
14670 _request: DomainMapping,
14671 _parent: String,
14672 _dry_run: Option<String>,
14673 _delegate: Option<&'a mut dyn common::Delegate>,
14674 _additional_params: HashMap<String, String>,
14675 _scopes: BTreeSet<String>,
14676}
14677
14678impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingCreateCall<'a, C> {}
14679
14680impl<'a, C> ProjectLocationDomainmappingCreateCall<'a, C>
14681where
14682 C: common::Connector,
14683{
14684 /// Perform the operation you have build so far.
14685 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
14686 use std::borrow::Cow;
14687 use std::io::{Read, Seek};
14688
14689 use common::{url::Params, ToParts};
14690 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14691
14692 let mut dd = common::DefaultDelegate;
14693 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14694 dlg.begin(common::MethodInfo {
14695 id: "run.projects.locations.domainmappings.create",
14696 http_method: hyper::Method::POST,
14697 });
14698
14699 for &field in ["alt", "parent", "dryRun"].iter() {
14700 if self._additional_params.contains_key(field) {
14701 dlg.finished(false);
14702 return Err(common::Error::FieldClash(field));
14703 }
14704 }
14705
14706 let mut params = Params::with_capacity(5 + self._additional_params.len());
14707 params.push("parent", self._parent);
14708 if let Some(value) = self._dry_run.as_ref() {
14709 params.push("dryRun", value);
14710 }
14711
14712 params.extend(self._additional_params.iter());
14713
14714 params.push("alt", "json");
14715 let mut url = self.hub._base_url.clone() + "v1/{+parent}/domainmappings";
14716 if self._scopes.is_empty() {
14717 self._scopes
14718 .insert(Scope::CloudPlatform.as_ref().to_string());
14719 }
14720
14721 #[allow(clippy::single_element_loop)]
14722 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14723 url = params.uri_replacement(url, param_name, find_this, true);
14724 }
14725 {
14726 let to_remove = ["parent"];
14727 params.remove_params(&to_remove);
14728 }
14729
14730 let url = params.parse_with_url(&url);
14731
14732 let mut json_mime_type = mime::APPLICATION_JSON;
14733 let mut request_value_reader = {
14734 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14735 common::remove_json_null_values(&mut value);
14736 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14737 serde_json::to_writer(&mut dst, &value).unwrap();
14738 dst
14739 };
14740 let request_size = request_value_reader
14741 .seek(std::io::SeekFrom::End(0))
14742 .unwrap();
14743 request_value_reader
14744 .seek(std::io::SeekFrom::Start(0))
14745 .unwrap();
14746
14747 loop {
14748 let token = match self
14749 .hub
14750 .auth
14751 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14752 .await
14753 {
14754 Ok(token) => token,
14755 Err(e) => match dlg.token(e) {
14756 Ok(token) => token,
14757 Err(e) => {
14758 dlg.finished(false);
14759 return Err(common::Error::MissingToken(e));
14760 }
14761 },
14762 };
14763 request_value_reader
14764 .seek(std::io::SeekFrom::Start(0))
14765 .unwrap();
14766 let mut req_result = {
14767 let client = &self.hub.client;
14768 dlg.pre_request();
14769 let mut req_builder = hyper::Request::builder()
14770 .method(hyper::Method::POST)
14771 .uri(url.as_str())
14772 .header(USER_AGENT, self.hub._user_agent.clone());
14773
14774 if let Some(token) = token.as_ref() {
14775 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14776 }
14777
14778 let request = req_builder
14779 .header(CONTENT_TYPE, json_mime_type.to_string())
14780 .header(CONTENT_LENGTH, request_size as u64)
14781 .body(common::to_body(
14782 request_value_reader.get_ref().clone().into(),
14783 ));
14784
14785 client.request(request.unwrap()).await
14786 };
14787
14788 match req_result {
14789 Err(err) => {
14790 if let common::Retry::After(d) = dlg.http_error(&err) {
14791 sleep(d).await;
14792 continue;
14793 }
14794 dlg.finished(false);
14795 return Err(common::Error::HttpError(err));
14796 }
14797 Ok(res) => {
14798 let (mut parts, body) = res.into_parts();
14799 let mut body = common::Body::new(body);
14800 if !parts.status.is_success() {
14801 let bytes = common::to_bytes(body).await.unwrap_or_default();
14802 let error = serde_json::from_str(&common::to_string(&bytes));
14803 let response = common::to_response(parts, bytes.into());
14804
14805 if let common::Retry::After(d) =
14806 dlg.http_failure(&response, error.as_ref().ok())
14807 {
14808 sleep(d).await;
14809 continue;
14810 }
14811
14812 dlg.finished(false);
14813
14814 return Err(match error {
14815 Ok(value) => common::Error::BadRequest(value),
14816 _ => common::Error::Failure(response),
14817 });
14818 }
14819 let response = {
14820 let bytes = common::to_bytes(body).await.unwrap_or_default();
14821 let encoded = common::to_string(&bytes);
14822 match serde_json::from_str(&encoded) {
14823 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14824 Err(error) => {
14825 dlg.response_json_decode_error(&encoded, &error);
14826 return Err(common::Error::JsonDecodeError(
14827 encoded.to_string(),
14828 error,
14829 ));
14830 }
14831 }
14832 };
14833
14834 dlg.finished(true);
14835 return Ok(response);
14836 }
14837 }
14838 }
14839 }
14840
14841 ///
14842 /// Sets the *request* property to the given value.
14843 ///
14844 /// Even though the property as already been set when instantiating this call,
14845 /// we provide this method for API completeness.
14846 pub fn request(
14847 mut self,
14848 new_value: DomainMapping,
14849 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
14850 self._request = new_value;
14851 self
14852 }
14853 /// Required. The namespace in which the domain mapping should be created. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
14854 ///
14855 /// Sets the *parent* path property to the given value.
14856 ///
14857 /// Even though the property as already been set when instantiating this call,
14858 /// we provide this method for API completeness.
14859 pub fn parent(mut self, new_value: &str) -> ProjectLocationDomainmappingCreateCall<'a, C> {
14860 self._parent = new_value.to_string();
14861 self
14862 }
14863 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
14864 ///
14865 /// Sets the *dry run* query property to the given value.
14866 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationDomainmappingCreateCall<'a, C> {
14867 self._dry_run = Some(new_value.to_string());
14868 self
14869 }
14870 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14871 /// while executing the actual API request.
14872 ///
14873 /// ````text
14874 /// It should be used to handle progress information, and to implement a certain level of resilience.
14875 /// ````
14876 ///
14877 /// Sets the *delegate* property to the given value.
14878 pub fn delegate(
14879 mut self,
14880 new_value: &'a mut dyn common::Delegate,
14881 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
14882 self._delegate = Some(new_value);
14883 self
14884 }
14885
14886 /// Set any additional parameter of the query string used in the request.
14887 /// It should be used to set parameters which are not yet available through their own
14888 /// setters.
14889 ///
14890 /// Please note that this method must not be used to set any of the known parameters
14891 /// which have their own setter method. If done anyway, the request will fail.
14892 ///
14893 /// # Additional Parameters
14894 ///
14895 /// * *$.xgafv* (query-string) - V1 error format.
14896 /// * *access_token* (query-string) - OAuth access token.
14897 /// * *alt* (query-string) - Data format for response.
14898 /// * *callback* (query-string) - JSONP
14899 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14900 /// * *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.
14901 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14902 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14903 /// * *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.
14904 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14905 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14906 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingCreateCall<'a, C>
14907 where
14908 T: AsRef<str>,
14909 {
14910 self._additional_params
14911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14912 self
14913 }
14914
14915 /// Identifies the authorization scope for the method you are building.
14916 ///
14917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14918 /// [`Scope::CloudPlatform`].
14919 ///
14920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14921 /// tokens for more than one scope.
14922 ///
14923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14925 /// sufficient, a read-write scope will do as well.
14926 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingCreateCall<'a, C>
14927 where
14928 St: AsRef<str>,
14929 {
14930 self._scopes.insert(String::from(scope.as_ref()));
14931 self
14932 }
14933 /// Identifies the authorization scope(s) for the method you are building.
14934 ///
14935 /// See [`Self::add_scope()`] for details.
14936 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingCreateCall<'a, C>
14937 where
14938 I: IntoIterator<Item = St>,
14939 St: AsRef<str>,
14940 {
14941 self._scopes
14942 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14943 self
14944 }
14945
14946 /// Removes all scopes, and no default scope will be used either.
14947 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14948 /// for details).
14949 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingCreateCall<'a, C> {
14950 self._scopes.clear();
14951 self
14952 }
14953}
14954
14955/// Delete a domain mapping.
14956///
14957/// A builder for the *locations.domainmappings.delete* method supported by a *project* resource.
14958/// It is not used directly, but through a [`ProjectMethods`] instance.
14959///
14960/// # Example
14961///
14962/// Instantiate a resource method builder
14963///
14964/// ```test_harness,no_run
14965/// # extern crate hyper;
14966/// # extern crate hyper_rustls;
14967/// # extern crate google_run1 as run1;
14968/// # async fn dox() {
14969/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14970///
14971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14972/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14973/// # secret,
14974/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14975/// # ).build().await.unwrap();
14976///
14977/// # let client = hyper_util::client::legacy::Client::builder(
14978/// # hyper_util::rt::TokioExecutor::new()
14979/// # )
14980/// # .build(
14981/// # hyper_rustls::HttpsConnectorBuilder::new()
14982/// # .with_native_roots()
14983/// # .unwrap()
14984/// # .https_or_http()
14985/// # .enable_http1()
14986/// # .build()
14987/// # );
14988/// # let mut hub = CloudRun::new(client, auth);
14989/// // You can configure optional parameters by calling the respective setters at will, and
14990/// // execute the final call using `doit()`.
14991/// // Values shown here are possibly random and not representative !
14992/// let result = hub.projects().locations_domainmappings_delete("name")
14993/// .propagation_policy("et")
14994/// .kind("sea")
14995/// .dry_run("et")
14996/// .api_version("At")
14997/// .doit().await;
14998/// # }
14999/// ```
15000pub struct ProjectLocationDomainmappingDeleteCall<'a, C>
15001where
15002 C: 'a,
15003{
15004 hub: &'a CloudRun<C>,
15005 _name: String,
15006 _propagation_policy: Option<String>,
15007 _kind: Option<String>,
15008 _dry_run: Option<String>,
15009 _api_version: Option<String>,
15010 _delegate: Option<&'a mut dyn common::Delegate>,
15011 _additional_params: HashMap<String, String>,
15012 _scopes: BTreeSet<String>,
15013}
15014
15015impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingDeleteCall<'a, C> {}
15016
15017impl<'a, C> ProjectLocationDomainmappingDeleteCall<'a, C>
15018where
15019 C: common::Connector,
15020{
15021 /// Perform the operation you have build so far.
15022 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
15023 use std::borrow::Cow;
15024 use std::io::{Read, Seek};
15025
15026 use common::{url::Params, ToParts};
15027 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15028
15029 let mut dd = common::DefaultDelegate;
15030 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15031 dlg.begin(common::MethodInfo {
15032 id: "run.projects.locations.domainmappings.delete",
15033 http_method: hyper::Method::DELETE,
15034 });
15035
15036 for &field in [
15037 "alt",
15038 "name",
15039 "propagationPolicy",
15040 "kind",
15041 "dryRun",
15042 "apiVersion",
15043 ]
15044 .iter()
15045 {
15046 if self._additional_params.contains_key(field) {
15047 dlg.finished(false);
15048 return Err(common::Error::FieldClash(field));
15049 }
15050 }
15051
15052 let mut params = Params::with_capacity(7 + self._additional_params.len());
15053 params.push("name", self._name);
15054 if let Some(value) = self._propagation_policy.as_ref() {
15055 params.push("propagationPolicy", value);
15056 }
15057 if let Some(value) = self._kind.as_ref() {
15058 params.push("kind", value);
15059 }
15060 if let Some(value) = self._dry_run.as_ref() {
15061 params.push("dryRun", value);
15062 }
15063 if let Some(value) = self._api_version.as_ref() {
15064 params.push("apiVersion", value);
15065 }
15066
15067 params.extend(self._additional_params.iter());
15068
15069 params.push("alt", "json");
15070 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15071 if self._scopes.is_empty() {
15072 self._scopes
15073 .insert(Scope::CloudPlatform.as_ref().to_string());
15074 }
15075
15076 #[allow(clippy::single_element_loop)]
15077 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15078 url = params.uri_replacement(url, param_name, find_this, true);
15079 }
15080 {
15081 let to_remove = ["name"];
15082 params.remove_params(&to_remove);
15083 }
15084
15085 let url = params.parse_with_url(&url);
15086
15087 loop {
15088 let token = match self
15089 .hub
15090 .auth
15091 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15092 .await
15093 {
15094 Ok(token) => token,
15095 Err(e) => match dlg.token(e) {
15096 Ok(token) => token,
15097 Err(e) => {
15098 dlg.finished(false);
15099 return Err(common::Error::MissingToken(e));
15100 }
15101 },
15102 };
15103 let mut req_result = {
15104 let client = &self.hub.client;
15105 dlg.pre_request();
15106 let mut req_builder = hyper::Request::builder()
15107 .method(hyper::Method::DELETE)
15108 .uri(url.as_str())
15109 .header(USER_AGENT, self.hub._user_agent.clone());
15110
15111 if let Some(token) = token.as_ref() {
15112 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15113 }
15114
15115 let request = req_builder
15116 .header(CONTENT_LENGTH, 0_u64)
15117 .body(common::to_body::<String>(None));
15118
15119 client.request(request.unwrap()).await
15120 };
15121
15122 match req_result {
15123 Err(err) => {
15124 if let common::Retry::After(d) = dlg.http_error(&err) {
15125 sleep(d).await;
15126 continue;
15127 }
15128 dlg.finished(false);
15129 return Err(common::Error::HttpError(err));
15130 }
15131 Ok(res) => {
15132 let (mut parts, body) = res.into_parts();
15133 let mut body = common::Body::new(body);
15134 if !parts.status.is_success() {
15135 let bytes = common::to_bytes(body).await.unwrap_or_default();
15136 let error = serde_json::from_str(&common::to_string(&bytes));
15137 let response = common::to_response(parts, bytes.into());
15138
15139 if let common::Retry::After(d) =
15140 dlg.http_failure(&response, error.as_ref().ok())
15141 {
15142 sleep(d).await;
15143 continue;
15144 }
15145
15146 dlg.finished(false);
15147
15148 return Err(match error {
15149 Ok(value) => common::Error::BadRequest(value),
15150 _ => common::Error::Failure(response),
15151 });
15152 }
15153 let response = {
15154 let bytes = common::to_bytes(body).await.unwrap_or_default();
15155 let encoded = common::to_string(&bytes);
15156 match serde_json::from_str(&encoded) {
15157 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15158 Err(error) => {
15159 dlg.response_json_decode_error(&encoded, &error);
15160 return Err(common::Error::JsonDecodeError(
15161 encoded.to_string(),
15162 error,
15163 ));
15164 }
15165 }
15166 };
15167
15168 dlg.finished(true);
15169 return Ok(response);
15170 }
15171 }
15172 }
15173 }
15174
15175 /// Required. The name of the domain mapping to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
15176 ///
15177 /// Sets the *name* path property to the given value.
15178 ///
15179 /// Even though the property as already been set when instantiating this call,
15180 /// we provide this method for API completeness.
15181 pub fn name(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15182 self._name = new_value.to_string();
15183 self
15184 }
15185 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background. Please see kubernetes.io/docs/concepts/architecture/garbage-collection/ for more information.
15186 ///
15187 /// Sets the *propagation policy* query property to the given value.
15188 pub fn propagation_policy(
15189 mut self,
15190 new_value: &str,
15191 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15192 self._propagation_policy = Some(new_value.to_string());
15193 self
15194 }
15195 /// Cloud Run currently ignores this parameter.
15196 ///
15197 /// Sets the *kind* query property to the given value.
15198 pub fn kind(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15199 self._kind = Some(new_value.to_string());
15200 self
15201 }
15202 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
15203 ///
15204 /// Sets the *dry run* query property to the given value.
15205 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15206 self._dry_run = Some(new_value.to_string());
15207 self
15208 }
15209 /// Cloud Run currently ignores this parameter.
15210 ///
15211 /// Sets the *api version* query property to the given value.
15212 pub fn api_version(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15213 self._api_version = Some(new_value.to_string());
15214 self
15215 }
15216 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15217 /// while executing the actual API request.
15218 ///
15219 /// ````text
15220 /// It should be used to handle progress information, and to implement a certain level of resilience.
15221 /// ````
15222 ///
15223 /// Sets the *delegate* property to the given value.
15224 pub fn delegate(
15225 mut self,
15226 new_value: &'a mut dyn common::Delegate,
15227 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15228 self._delegate = Some(new_value);
15229 self
15230 }
15231
15232 /// Set any additional parameter of the query string used in the request.
15233 /// It should be used to set parameters which are not yet available through their own
15234 /// setters.
15235 ///
15236 /// Please note that this method must not be used to set any of the known parameters
15237 /// which have their own setter method. If done anyway, the request will fail.
15238 ///
15239 /// # Additional Parameters
15240 ///
15241 /// * *$.xgafv* (query-string) - V1 error format.
15242 /// * *access_token* (query-string) - OAuth access token.
15243 /// * *alt* (query-string) - Data format for response.
15244 /// * *callback* (query-string) - JSONP
15245 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15246 /// * *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.
15247 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15248 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15249 /// * *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.
15250 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15251 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15252 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingDeleteCall<'a, C>
15253 where
15254 T: AsRef<str>,
15255 {
15256 self._additional_params
15257 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15258 self
15259 }
15260
15261 /// Identifies the authorization scope for the method you are building.
15262 ///
15263 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15264 /// [`Scope::CloudPlatform`].
15265 ///
15266 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15267 /// tokens for more than one scope.
15268 ///
15269 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15270 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15271 /// sufficient, a read-write scope will do as well.
15272 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingDeleteCall<'a, C>
15273 where
15274 St: AsRef<str>,
15275 {
15276 self._scopes.insert(String::from(scope.as_ref()));
15277 self
15278 }
15279 /// Identifies the authorization scope(s) for the method you are building.
15280 ///
15281 /// See [`Self::add_scope()`] for details.
15282 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingDeleteCall<'a, C>
15283 where
15284 I: IntoIterator<Item = St>,
15285 St: AsRef<str>,
15286 {
15287 self._scopes
15288 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15289 self
15290 }
15291
15292 /// Removes all scopes, and no default scope will be used either.
15293 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15294 /// for details).
15295 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
15296 self._scopes.clear();
15297 self
15298 }
15299}
15300
15301/// Get information about a domain mapping.
15302///
15303/// A builder for the *locations.domainmappings.get* method supported by a *project* resource.
15304/// It is not used directly, but through a [`ProjectMethods`] instance.
15305///
15306/// # Example
15307///
15308/// Instantiate a resource method builder
15309///
15310/// ```test_harness,no_run
15311/// # extern crate hyper;
15312/// # extern crate hyper_rustls;
15313/// # extern crate google_run1 as run1;
15314/// # async fn dox() {
15315/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15316///
15317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15319/// # secret,
15320/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15321/// # ).build().await.unwrap();
15322///
15323/// # let client = hyper_util::client::legacy::Client::builder(
15324/// # hyper_util::rt::TokioExecutor::new()
15325/// # )
15326/// # .build(
15327/// # hyper_rustls::HttpsConnectorBuilder::new()
15328/// # .with_native_roots()
15329/// # .unwrap()
15330/// # .https_or_http()
15331/// # .enable_http1()
15332/// # .build()
15333/// # );
15334/// # let mut hub = CloudRun::new(client, auth);
15335/// // You can configure optional parameters by calling the respective setters at will, and
15336/// // execute the final call using `doit()`.
15337/// // Values shown here are possibly random and not representative !
15338/// let result = hub.projects().locations_domainmappings_get("name")
15339/// .doit().await;
15340/// # }
15341/// ```
15342pub struct ProjectLocationDomainmappingGetCall<'a, C>
15343where
15344 C: 'a,
15345{
15346 hub: &'a CloudRun<C>,
15347 _name: String,
15348 _delegate: Option<&'a mut dyn common::Delegate>,
15349 _additional_params: HashMap<String, String>,
15350 _scopes: BTreeSet<String>,
15351}
15352
15353impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingGetCall<'a, C> {}
15354
15355impl<'a, C> ProjectLocationDomainmappingGetCall<'a, C>
15356where
15357 C: common::Connector,
15358{
15359 /// Perform the operation you have build so far.
15360 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
15361 use std::borrow::Cow;
15362 use std::io::{Read, Seek};
15363
15364 use common::{url::Params, ToParts};
15365 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15366
15367 let mut dd = common::DefaultDelegate;
15368 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15369 dlg.begin(common::MethodInfo {
15370 id: "run.projects.locations.domainmappings.get",
15371 http_method: hyper::Method::GET,
15372 });
15373
15374 for &field in ["alt", "name"].iter() {
15375 if self._additional_params.contains_key(field) {
15376 dlg.finished(false);
15377 return Err(common::Error::FieldClash(field));
15378 }
15379 }
15380
15381 let mut params = Params::with_capacity(3 + self._additional_params.len());
15382 params.push("name", self._name);
15383
15384 params.extend(self._additional_params.iter());
15385
15386 params.push("alt", "json");
15387 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15388 if self._scopes.is_empty() {
15389 self._scopes
15390 .insert(Scope::CloudPlatform.as_ref().to_string());
15391 }
15392
15393 #[allow(clippy::single_element_loop)]
15394 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15395 url = params.uri_replacement(url, param_name, find_this, true);
15396 }
15397 {
15398 let to_remove = ["name"];
15399 params.remove_params(&to_remove);
15400 }
15401
15402 let url = params.parse_with_url(&url);
15403
15404 loop {
15405 let token = match self
15406 .hub
15407 .auth
15408 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15409 .await
15410 {
15411 Ok(token) => token,
15412 Err(e) => match dlg.token(e) {
15413 Ok(token) => token,
15414 Err(e) => {
15415 dlg.finished(false);
15416 return Err(common::Error::MissingToken(e));
15417 }
15418 },
15419 };
15420 let mut req_result = {
15421 let client = &self.hub.client;
15422 dlg.pre_request();
15423 let mut req_builder = hyper::Request::builder()
15424 .method(hyper::Method::GET)
15425 .uri(url.as_str())
15426 .header(USER_AGENT, self.hub._user_agent.clone());
15427
15428 if let Some(token) = token.as_ref() {
15429 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15430 }
15431
15432 let request = req_builder
15433 .header(CONTENT_LENGTH, 0_u64)
15434 .body(common::to_body::<String>(None));
15435
15436 client.request(request.unwrap()).await
15437 };
15438
15439 match req_result {
15440 Err(err) => {
15441 if let common::Retry::After(d) = dlg.http_error(&err) {
15442 sleep(d).await;
15443 continue;
15444 }
15445 dlg.finished(false);
15446 return Err(common::Error::HttpError(err));
15447 }
15448 Ok(res) => {
15449 let (mut parts, body) = res.into_parts();
15450 let mut body = common::Body::new(body);
15451 if !parts.status.is_success() {
15452 let bytes = common::to_bytes(body).await.unwrap_or_default();
15453 let error = serde_json::from_str(&common::to_string(&bytes));
15454 let response = common::to_response(parts, bytes.into());
15455
15456 if let common::Retry::After(d) =
15457 dlg.http_failure(&response, error.as_ref().ok())
15458 {
15459 sleep(d).await;
15460 continue;
15461 }
15462
15463 dlg.finished(false);
15464
15465 return Err(match error {
15466 Ok(value) => common::Error::BadRequest(value),
15467 _ => common::Error::Failure(response),
15468 });
15469 }
15470 let response = {
15471 let bytes = common::to_bytes(body).await.unwrap_or_default();
15472 let encoded = common::to_string(&bytes);
15473 match serde_json::from_str(&encoded) {
15474 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15475 Err(error) => {
15476 dlg.response_json_decode_error(&encoded, &error);
15477 return Err(common::Error::JsonDecodeError(
15478 encoded.to_string(),
15479 error,
15480 ));
15481 }
15482 }
15483 };
15484
15485 dlg.finished(true);
15486 return Ok(response);
15487 }
15488 }
15489 }
15490 }
15491
15492 /// Required. The name of the domain mapping to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
15493 ///
15494 /// Sets the *name* path property to the given value.
15495 ///
15496 /// Even though the property as already been set when instantiating this call,
15497 /// we provide this method for API completeness.
15498 pub fn name(mut self, new_value: &str) -> ProjectLocationDomainmappingGetCall<'a, C> {
15499 self._name = new_value.to_string();
15500 self
15501 }
15502 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15503 /// while executing the actual API request.
15504 ///
15505 /// ````text
15506 /// It should be used to handle progress information, and to implement a certain level of resilience.
15507 /// ````
15508 ///
15509 /// Sets the *delegate* property to the given value.
15510 pub fn delegate(
15511 mut self,
15512 new_value: &'a mut dyn common::Delegate,
15513 ) -> ProjectLocationDomainmappingGetCall<'a, C> {
15514 self._delegate = Some(new_value);
15515 self
15516 }
15517
15518 /// Set any additional parameter of the query string used in the request.
15519 /// It should be used to set parameters which are not yet available through their own
15520 /// setters.
15521 ///
15522 /// Please note that this method must not be used to set any of the known parameters
15523 /// which have their own setter method. If done anyway, the request will fail.
15524 ///
15525 /// # Additional Parameters
15526 ///
15527 /// * *$.xgafv* (query-string) - V1 error format.
15528 /// * *access_token* (query-string) - OAuth access token.
15529 /// * *alt* (query-string) - Data format for response.
15530 /// * *callback* (query-string) - JSONP
15531 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15532 /// * *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.
15533 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15534 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15535 /// * *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.
15536 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15537 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15538 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingGetCall<'a, C>
15539 where
15540 T: AsRef<str>,
15541 {
15542 self._additional_params
15543 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15544 self
15545 }
15546
15547 /// Identifies the authorization scope for the method you are building.
15548 ///
15549 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15550 /// [`Scope::CloudPlatform`].
15551 ///
15552 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15553 /// tokens for more than one scope.
15554 ///
15555 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15556 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15557 /// sufficient, a read-write scope will do as well.
15558 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingGetCall<'a, C>
15559 where
15560 St: AsRef<str>,
15561 {
15562 self._scopes.insert(String::from(scope.as_ref()));
15563 self
15564 }
15565 /// Identifies the authorization scope(s) for the method you are building.
15566 ///
15567 /// See [`Self::add_scope()`] for details.
15568 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingGetCall<'a, C>
15569 where
15570 I: IntoIterator<Item = St>,
15571 St: AsRef<str>,
15572 {
15573 self._scopes
15574 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15575 self
15576 }
15577
15578 /// Removes all scopes, and no default scope will be used either.
15579 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15580 /// for details).
15581 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingGetCall<'a, C> {
15582 self._scopes.clear();
15583 self
15584 }
15585}
15586
15587/// List all domain mappings.
15588///
15589/// A builder for the *locations.domainmappings.list* method supported by a *project* resource.
15590/// It is not used directly, but through a [`ProjectMethods`] instance.
15591///
15592/// # Example
15593///
15594/// Instantiate a resource method builder
15595///
15596/// ```test_harness,no_run
15597/// # extern crate hyper;
15598/// # extern crate hyper_rustls;
15599/// # extern crate google_run1 as run1;
15600/// # async fn dox() {
15601/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15602///
15603/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15604/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15605/// # secret,
15606/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15607/// # ).build().await.unwrap();
15608///
15609/// # let client = hyper_util::client::legacy::Client::builder(
15610/// # hyper_util::rt::TokioExecutor::new()
15611/// # )
15612/// # .build(
15613/// # hyper_rustls::HttpsConnectorBuilder::new()
15614/// # .with_native_roots()
15615/// # .unwrap()
15616/// # .https_or_http()
15617/// # .enable_http1()
15618/// # .build()
15619/// # );
15620/// # let mut hub = CloudRun::new(client, auth);
15621/// // You can configure optional parameters by calling the respective setters at will, and
15622/// // execute the final call using `doit()`.
15623/// // Values shown here are possibly random and not representative !
15624/// let result = hub.projects().locations_domainmappings_list("parent")
15625/// .watch(true)
15626/// .resource_version("accusam")
15627/// .limit(-47)
15628/// .label_selector("erat")
15629/// .include_uninitialized(true)
15630/// .field_selector("erat")
15631/// .continue_("accusam")
15632/// .doit().await;
15633/// # }
15634/// ```
15635pub struct ProjectLocationDomainmappingListCall<'a, C>
15636where
15637 C: 'a,
15638{
15639 hub: &'a CloudRun<C>,
15640 _parent: String,
15641 _watch: Option<bool>,
15642 _resource_version: Option<String>,
15643 _limit: Option<i32>,
15644 _label_selector: Option<String>,
15645 _include_uninitialized: Option<bool>,
15646 _field_selector: Option<String>,
15647 _continue_: Option<String>,
15648 _delegate: Option<&'a mut dyn common::Delegate>,
15649 _additional_params: HashMap<String, String>,
15650 _scopes: BTreeSet<String>,
15651}
15652
15653impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingListCall<'a, C> {}
15654
15655impl<'a, C> ProjectLocationDomainmappingListCall<'a, C>
15656where
15657 C: common::Connector,
15658{
15659 /// Perform the operation you have build so far.
15660 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
15661 use std::borrow::Cow;
15662 use std::io::{Read, Seek};
15663
15664 use common::{url::Params, ToParts};
15665 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15666
15667 let mut dd = common::DefaultDelegate;
15668 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15669 dlg.begin(common::MethodInfo {
15670 id: "run.projects.locations.domainmappings.list",
15671 http_method: hyper::Method::GET,
15672 });
15673
15674 for &field in [
15675 "alt",
15676 "parent",
15677 "watch",
15678 "resourceVersion",
15679 "limit",
15680 "labelSelector",
15681 "includeUninitialized",
15682 "fieldSelector",
15683 "continue",
15684 ]
15685 .iter()
15686 {
15687 if self._additional_params.contains_key(field) {
15688 dlg.finished(false);
15689 return Err(common::Error::FieldClash(field));
15690 }
15691 }
15692
15693 let mut params = Params::with_capacity(10 + self._additional_params.len());
15694 params.push("parent", self._parent);
15695 if let Some(value) = self._watch.as_ref() {
15696 params.push("watch", value.to_string());
15697 }
15698 if let Some(value) = self._resource_version.as_ref() {
15699 params.push("resourceVersion", value);
15700 }
15701 if let Some(value) = self._limit.as_ref() {
15702 params.push("limit", value.to_string());
15703 }
15704 if let Some(value) = self._label_selector.as_ref() {
15705 params.push("labelSelector", value);
15706 }
15707 if let Some(value) = self._include_uninitialized.as_ref() {
15708 params.push("includeUninitialized", value.to_string());
15709 }
15710 if let Some(value) = self._field_selector.as_ref() {
15711 params.push("fieldSelector", value);
15712 }
15713 if let Some(value) = self._continue_.as_ref() {
15714 params.push("continue", value);
15715 }
15716
15717 params.extend(self._additional_params.iter());
15718
15719 params.push("alt", "json");
15720 let mut url = self.hub._base_url.clone() + "v1/{+parent}/domainmappings";
15721 if self._scopes.is_empty() {
15722 self._scopes
15723 .insert(Scope::CloudPlatform.as_ref().to_string());
15724 }
15725
15726 #[allow(clippy::single_element_loop)]
15727 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15728 url = params.uri_replacement(url, param_name, find_this, true);
15729 }
15730 {
15731 let to_remove = ["parent"];
15732 params.remove_params(&to_remove);
15733 }
15734
15735 let url = params.parse_with_url(&url);
15736
15737 loop {
15738 let token = match self
15739 .hub
15740 .auth
15741 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15742 .await
15743 {
15744 Ok(token) => token,
15745 Err(e) => match dlg.token(e) {
15746 Ok(token) => token,
15747 Err(e) => {
15748 dlg.finished(false);
15749 return Err(common::Error::MissingToken(e));
15750 }
15751 },
15752 };
15753 let mut req_result = {
15754 let client = &self.hub.client;
15755 dlg.pre_request();
15756 let mut req_builder = hyper::Request::builder()
15757 .method(hyper::Method::GET)
15758 .uri(url.as_str())
15759 .header(USER_AGENT, self.hub._user_agent.clone());
15760
15761 if let Some(token) = token.as_ref() {
15762 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15763 }
15764
15765 let request = req_builder
15766 .header(CONTENT_LENGTH, 0_u64)
15767 .body(common::to_body::<String>(None));
15768
15769 client.request(request.unwrap()).await
15770 };
15771
15772 match req_result {
15773 Err(err) => {
15774 if let common::Retry::After(d) = dlg.http_error(&err) {
15775 sleep(d).await;
15776 continue;
15777 }
15778 dlg.finished(false);
15779 return Err(common::Error::HttpError(err));
15780 }
15781 Ok(res) => {
15782 let (mut parts, body) = res.into_parts();
15783 let mut body = common::Body::new(body);
15784 if !parts.status.is_success() {
15785 let bytes = common::to_bytes(body).await.unwrap_or_default();
15786 let error = serde_json::from_str(&common::to_string(&bytes));
15787 let response = common::to_response(parts, bytes.into());
15788
15789 if let common::Retry::After(d) =
15790 dlg.http_failure(&response, error.as_ref().ok())
15791 {
15792 sleep(d).await;
15793 continue;
15794 }
15795
15796 dlg.finished(false);
15797
15798 return Err(match error {
15799 Ok(value) => common::Error::BadRequest(value),
15800 _ => common::Error::Failure(response),
15801 });
15802 }
15803 let response = {
15804 let bytes = common::to_bytes(body).await.unwrap_or_default();
15805 let encoded = common::to_string(&bytes);
15806 match serde_json::from_str(&encoded) {
15807 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15808 Err(error) => {
15809 dlg.response_json_decode_error(&encoded, &error);
15810 return Err(common::Error::JsonDecodeError(
15811 encoded.to_string(),
15812 error,
15813 ));
15814 }
15815 }
15816 };
15817
15818 dlg.finished(true);
15819 return Ok(response);
15820 }
15821 }
15822 }
15823 }
15824
15825 /// Required. The namespace from which the domain mappings should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
15826 ///
15827 /// Sets the *parent* path property to the given value.
15828 ///
15829 /// Even though the property as already been set when instantiating this call,
15830 /// we provide this method for API completeness.
15831 pub fn parent(mut self, new_value: &str) -> ProjectLocationDomainmappingListCall<'a, C> {
15832 self._parent = new_value.to_string();
15833 self
15834 }
15835 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
15836 ///
15837 /// Sets the *watch* query property to the given value.
15838 pub fn watch(mut self, new_value: bool) -> ProjectLocationDomainmappingListCall<'a, C> {
15839 self._watch = Some(new_value);
15840 self
15841 }
15842 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
15843 ///
15844 /// Sets the *resource version* query property to the given value.
15845 pub fn resource_version(
15846 mut self,
15847 new_value: &str,
15848 ) -> ProjectLocationDomainmappingListCall<'a, C> {
15849 self._resource_version = Some(new_value.to_string());
15850 self
15851 }
15852 /// Optional. The maximum number of records that should be returned.
15853 ///
15854 /// Sets the *limit* query property to the given value.
15855 pub fn limit(mut self, new_value: i32) -> ProjectLocationDomainmappingListCall<'a, C> {
15856 self._limit = Some(new_value);
15857 self
15858 }
15859 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
15860 ///
15861 /// Sets the *label selector* query property to the given value.
15862 pub fn label_selector(
15863 mut self,
15864 new_value: &str,
15865 ) -> ProjectLocationDomainmappingListCall<'a, C> {
15866 self._label_selector = Some(new_value.to_string());
15867 self
15868 }
15869 /// Not currently used by Cloud Run.
15870 ///
15871 /// Sets the *include uninitialized* query property to the given value.
15872 pub fn include_uninitialized(
15873 mut self,
15874 new_value: bool,
15875 ) -> ProjectLocationDomainmappingListCall<'a, C> {
15876 self._include_uninitialized = Some(new_value);
15877 self
15878 }
15879 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
15880 ///
15881 /// Sets the *field selector* query property to the given value.
15882 pub fn field_selector(
15883 mut self,
15884 new_value: &str,
15885 ) -> ProjectLocationDomainmappingListCall<'a, C> {
15886 self._field_selector = Some(new_value.to_string());
15887 self
15888 }
15889 /// Optional. Encoded string to continue paging.
15890 ///
15891 /// Sets the *continue* query property to the given value.
15892 pub fn continue_(mut self, new_value: &str) -> ProjectLocationDomainmappingListCall<'a, C> {
15893 self._continue_ = Some(new_value.to_string());
15894 self
15895 }
15896 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15897 /// while executing the actual API request.
15898 ///
15899 /// ````text
15900 /// It should be used to handle progress information, and to implement a certain level of resilience.
15901 /// ````
15902 ///
15903 /// Sets the *delegate* property to the given value.
15904 pub fn delegate(
15905 mut self,
15906 new_value: &'a mut dyn common::Delegate,
15907 ) -> ProjectLocationDomainmappingListCall<'a, C> {
15908 self._delegate = Some(new_value);
15909 self
15910 }
15911
15912 /// Set any additional parameter of the query string used in the request.
15913 /// It should be used to set parameters which are not yet available through their own
15914 /// setters.
15915 ///
15916 /// Please note that this method must not be used to set any of the known parameters
15917 /// which have their own setter method. If done anyway, the request will fail.
15918 ///
15919 /// # Additional Parameters
15920 ///
15921 /// * *$.xgafv* (query-string) - V1 error format.
15922 /// * *access_token* (query-string) - OAuth access token.
15923 /// * *alt* (query-string) - Data format for response.
15924 /// * *callback* (query-string) - JSONP
15925 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15926 /// * *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.
15927 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15928 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15929 /// * *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.
15930 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15931 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15932 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingListCall<'a, C>
15933 where
15934 T: AsRef<str>,
15935 {
15936 self._additional_params
15937 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15938 self
15939 }
15940
15941 /// Identifies the authorization scope for the method you are building.
15942 ///
15943 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15944 /// [`Scope::CloudPlatform`].
15945 ///
15946 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15947 /// tokens for more than one scope.
15948 ///
15949 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15950 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15951 /// sufficient, a read-write scope will do as well.
15952 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingListCall<'a, C>
15953 where
15954 St: AsRef<str>,
15955 {
15956 self._scopes.insert(String::from(scope.as_ref()));
15957 self
15958 }
15959 /// Identifies the authorization scope(s) for the method you are building.
15960 ///
15961 /// See [`Self::add_scope()`] for details.
15962 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingListCall<'a, C>
15963 where
15964 I: IntoIterator<Item = St>,
15965 St: AsRef<str>,
15966 {
15967 self._scopes
15968 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15969 self
15970 }
15971
15972 /// Removes all scopes, and no default scope will be used either.
15973 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15974 /// for details).
15975 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingListCall<'a, C> {
15976 self._scopes.clear();
15977 self
15978 }
15979}
15980
15981/// Get the IAM Access Control policy currently in effect for the given job. This result does not include any inherited policies.
15982///
15983/// A builder for the *locations.jobs.getIamPolicy* method supported by a *project* resource.
15984/// It is not used directly, but through a [`ProjectMethods`] instance.
15985///
15986/// # Example
15987///
15988/// Instantiate a resource method builder
15989///
15990/// ```test_harness,no_run
15991/// # extern crate hyper;
15992/// # extern crate hyper_rustls;
15993/// # extern crate google_run1 as run1;
15994/// # async fn dox() {
15995/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15996///
15997/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15998/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15999/// # secret,
16000/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16001/// # ).build().await.unwrap();
16002///
16003/// # let client = hyper_util::client::legacy::Client::builder(
16004/// # hyper_util::rt::TokioExecutor::new()
16005/// # )
16006/// # .build(
16007/// # hyper_rustls::HttpsConnectorBuilder::new()
16008/// # .with_native_roots()
16009/// # .unwrap()
16010/// # .https_or_http()
16011/// # .enable_http1()
16012/// # .build()
16013/// # );
16014/// # let mut hub = CloudRun::new(client, auth);
16015/// // You can configure optional parameters by calling the respective setters at will, and
16016/// // execute the final call using `doit()`.
16017/// // Values shown here are possibly random and not representative !
16018/// let result = hub.projects().locations_jobs_get_iam_policy("resource")
16019/// .options_requested_policy_version(-59)
16020/// .doit().await;
16021/// # }
16022/// ```
16023pub struct ProjectLocationJobGetIamPolicyCall<'a, C>
16024where
16025 C: 'a,
16026{
16027 hub: &'a CloudRun<C>,
16028 _resource: String,
16029 _options_requested_policy_version: Option<i32>,
16030 _delegate: Option<&'a mut dyn common::Delegate>,
16031 _additional_params: HashMap<String, String>,
16032 _scopes: BTreeSet<String>,
16033}
16034
16035impl<'a, C> common::CallBuilder for ProjectLocationJobGetIamPolicyCall<'a, C> {}
16036
16037impl<'a, C> ProjectLocationJobGetIamPolicyCall<'a, C>
16038where
16039 C: common::Connector,
16040{
16041 /// Perform the operation you have build so far.
16042 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16043 use std::borrow::Cow;
16044 use std::io::{Read, Seek};
16045
16046 use common::{url::Params, ToParts};
16047 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16048
16049 let mut dd = common::DefaultDelegate;
16050 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16051 dlg.begin(common::MethodInfo {
16052 id: "run.projects.locations.jobs.getIamPolicy",
16053 http_method: hyper::Method::GET,
16054 });
16055
16056 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16057 if self._additional_params.contains_key(field) {
16058 dlg.finished(false);
16059 return Err(common::Error::FieldClash(field));
16060 }
16061 }
16062
16063 let mut params = Params::with_capacity(4 + self._additional_params.len());
16064 params.push("resource", self._resource);
16065 if let Some(value) = self._options_requested_policy_version.as_ref() {
16066 params.push("options.requestedPolicyVersion", value.to_string());
16067 }
16068
16069 params.extend(self._additional_params.iter());
16070
16071 params.push("alt", "json");
16072 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
16073 if self._scopes.is_empty() {
16074 self._scopes
16075 .insert(Scope::CloudPlatform.as_ref().to_string());
16076 }
16077
16078 #[allow(clippy::single_element_loop)]
16079 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16080 url = params.uri_replacement(url, param_name, find_this, true);
16081 }
16082 {
16083 let to_remove = ["resource"];
16084 params.remove_params(&to_remove);
16085 }
16086
16087 let url = params.parse_with_url(&url);
16088
16089 loop {
16090 let token = match self
16091 .hub
16092 .auth
16093 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16094 .await
16095 {
16096 Ok(token) => token,
16097 Err(e) => match dlg.token(e) {
16098 Ok(token) => token,
16099 Err(e) => {
16100 dlg.finished(false);
16101 return Err(common::Error::MissingToken(e));
16102 }
16103 },
16104 };
16105 let mut req_result = {
16106 let client = &self.hub.client;
16107 dlg.pre_request();
16108 let mut req_builder = hyper::Request::builder()
16109 .method(hyper::Method::GET)
16110 .uri(url.as_str())
16111 .header(USER_AGENT, self.hub._user_agent.clone());
16112
16113 if let Some(token) = token.as_ref() {
16114 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16115 }
16116
16117 let request = req_builder
16118 .header(CONTENT_LENGTH, 0_u64)
16119 .body(common::to_body::<String>(None));
16120
16121 client.request(request.unwrap()).await
16122 };
16123
16124 match req_result {
16125 Err(err) => {
16126 if let common::Retry::After(d) = dlg.http_error(&err) {
16127 sleep(d).await;
16128 continue;
16129 }
16130 dlg.finished(false);
16131 return Err(common::Error::HttpError(err));
16132 }
16133 Ok(res) => {
16134 let (mut parts, body) = res.into_parts();
16135 let mut body = common::Body::new(body);
16136 if !parts.status.is_success() {
16137 let bytes = common::to_bytes(body).await.unwrap_or_default();
16138 let error = serde_json::from_str(&common::to_string(&bytes));
16139 let response = common::to_response(parts, bytes.into());
16140
16141 if let common::Retry::After(d) =
16142 dlg.http_failure(&response, error.as_ref().ok())
16143 {
16144 sleep(d).await;
16145 continue;
16146 }
16147
16148 dlg.finished(false);
16149
16150 return Err(match error {
16151 Ok(value) => common::Error::BadRequest(value),
16152 _ => common::Error::Failure(response),
16153 });
16154 }
16155 let response = {
16156 let bytes = common::to_bytes(body).await.unwrap_or_default();
16157 let encoded = common::to_string(&bytes);
16158 match serde_json::from_str(&encoded) {
16159 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16160 Err(error) => {
16161 dlg.response_json_decode_error(&encoded, &error);
16162 return Err(common::Error::JsonDecodeError(
16163 encoded.to_string(),
16164 error,
16165 ));
16166 }
16167 }
16168 };
16169
16170 dlg.finished(true);
16171 return Ok(response);
16172 }
16173 }
16174 }
16175 }
16176
16177 /// 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.
16178 ///
16179 /// Sets the *resource* path property to the given value.
16180 ///
16181 /// Even though the property as already been set when instantiating this call,
16182 /// we provide this method for API completeness.
16183 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
16184 self._resource = new_value.to_string();
16185 self
16186 }
16187 /// 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).
16188 ///
16189 /// Sets the *options.requested policy version* query property to the given value.
16190 pub fn options_requested_policy_version(
16191 mut self,
16192 new_value: i32,
16193 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
16194 self._options_requested_policy_version = Some(new_value);
16195 self
16196 }
16197 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16198 /// while executing the actual API request.
16199 ///
16200 /// ````text
16201 /// It should be used to handle progress information, and to implement a certain level of resilience.
16202 /// ````
16203 ///
16204 /// Sets the *delegate* property to the given value.
16205 pub fn delegate(
16206 mut self,
16207 new_value: &'a mut dyn common::Delegate,
16208 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
16209 self._delegate = Some(new_value);
16210 self
16211 }
16212
16213 /// Set any additional parameter of the query string used in the request.
16214 /// It should be used to set parameters which are not yet available through their own
16215 /// setters.
16216 ///
16217 /// Please note that this method must not be used to set any of the known parameters
16218 /// which have their own setter method. If done anyway, the request will fail.
16219 ///
16220 /// # Additional Parameters
16221 ///
16222 /// * *$.xgafv* (query-string) - V1 error format.
16223 /// * *access_token* (query-string) - OAuth access token.
16224 /// * *alt* (query-string) - Data format for response.
16225 /// * *callback* (query-string) - JSONP
16226 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16227 /// * *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.
16228 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16229 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16230 /// * *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.
16231 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16232 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16233 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetIamPolicyCall<'a, C>
16234 where
16235 T: AsRef<str>,
16236 {
16237 self._additional_params
16238 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16239 self
16240 }
16241
16242 /// Identifies the authorization scope for the method you are building.
16243 ///
16244 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16245 /// [`Scope::CloudPlatform`].
16246 ///
16247 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16248 /// tokens for more than one scope.
16249 ///
16250 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16251 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16252 /// sufficient, a read-write scope will do as well.
16253 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetIamPolicyCall<'a, C>
16254 where
16255 St: AsRef<str>,
16256 {
16257 self._scopes.insert(String::from(scope.as_ref()));
16258 self
16259 }
16260 /// Identifies the authorization scope(s) for the method you are building.
16261 ///
16262 /// See [`Self::add_scope()`] for details.
16263 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetIamPolicyCall<'a, C>
16264 where
16265 I: IntoIterator<Item = St>,
16266 St: AsRef<str>,
16267 {
16268 self._scopes
16269 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16270 self
16271 }
16272
16273 /// Removes all scopes, and no default scope will be used either.
16274 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16275 /// for details).
16276 pub fn clear_scopes(mut self) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
16277 self._scopes.clear();
16278 self
16279 }
16280}
16281
16282/// Sets the IAM Access control policy for the specified job. Overwrites any existing policy.
16283///
16284/// A builder for the *locations.jobs.setIamPolicy* method supported by a *project* resource.
16285/// It is not used directly, but through a [`ProjectMethods`] instance.
16286///
16287/// # Example
16288///
16289/// Instantiate a resource method builder
16290///
16291/// ```test_harness,no_run
16292/// # extern crate hyper;
16293/// # extern crate hyper_rustls;
16294/// # extern crate google_run1 as run1;
16295/// use run1::api::SetIamPolicyRequest;
16296/// # async fn dox() {
16297/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16298///
16299/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16300/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16301/// # secret,
16302/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16303/// # ).build().await.unwrap();
16304///
16305/// # let client = hyper_util::client::legacy::Client::builder(
16306/// # hyper_util::rt::TokioExecutor::new()
16307/// # )
16308/// # .build(
16309/// # hyper_rustls::HttpsConnectorBuilder::new()
16310/// # .with_native_roots()
16311/// # .unwrap()
16312/// # .https_or_http()
16313/// # .enable_http1()
16314/// # .build()
16315/// # );
16316/// # let mut hub = CloudRun::new(client, auth);
16317/// // As the method needs a request, you would usually fill it with the desired information
16318/// // into the respective structure. Some of the parts shown here might not be applicable !
16319/// // Values shown here are possibly random and not representative !
16320/// let mut req = SetIamPolicyRequest::default();
16321///
16322/// // You can configure optional parameters by calling the respective setters at will, and
16323/// // execute the final call using `doit()`.
16324/// // Values shown here are possibly random and not representative !
16325/// let result = hub.projects().locations_jobs_set_iam_policy(req, "resource")
16326/// .doit().await;
16327/// # }
16328/// ```
16329pub struct ProjectLocationJobSetIamPolicyCall<'a, C>
16330where
16331 C: 'a,
16332{
16333 hub: &'a CloudRun<C>,
16334 _request: SetIamPolicyRequest,
16335 _resource: String,
16336 _delegate: Option<&'a mut dyn common::Delegate>,
16337 _additional_params: HashMap<String, String>,
16338 _scopes: BTreeSet<String>,
16339}
16340
16341impl<'a, C> common::CallBuilder for ProjectLocationJobSetIamPolicyCall<'a, C> {}
16342
16343impl<'a, C> ProjectLocationJobSetIamPolicyCall<'a, C>
16344where
16345 C: common::Connector,
16346{
16347 /// Perform the operation you have build so far.
16348 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16349 use std::borrow::Cow;
16350 use std::io::{Read, Seek};
16351
16352 use common::{url::Params, ToParts};
16353 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16354
16355 let mut dd = common::DefaultDelegate;
16356 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16357 dlg.begin(common::MethodInfo {
16358 id: "run.projects.locations.jobs.setIamPolicy",
16359 http_method: hyper::Method::POST,
16360 });
16361
16362 for &field in ["alt", "resource"].iter() {
16363 if self._additional_params.contains_key(field) {
16364 dlg.finished(false);
16365 return Err(common::Error::FieldClash(field));
16366 }
16367 }
16368
16369 let mut params = Params::with_capacity(4 + self._additional_params.len());
16370 params.push("resource", self._resource);
16371
16372 params.extend(self._additional_params.iter());
16373
16374 params.push("alt", "json");
16375 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
16376 if self._scopes.is_empty() {
16377 self._scopes
16378 .insert(Scope::CloudPlatform.as_ref().to_string());
16379 }
16380
16381 #[allow(clippy::single_element_loop)]
16382 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16383 url = params.uri_replacement(url, param_name, find_this, true);
16384 }
16385 {
16386 let to_remove = ["resource"];
16387 params.remove_params(&to_remove);
16388 }
16389
16390 let url = params.parse_with_url(&url);
16391
16392 let mut json_mime_type = mime::APPLICATION_JSON;
16393 let mut request_value_reader = {
16394 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16395 common::remove_json_null_values(&mut value);
16396 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16397 serde_json::to_writer(&mut dst, &value).unwrap();
16398 dst
16399 };
16400 let request_size = request_value_reader
16401 .seek(std::io::SeekFrom::End(0))
16402 .unwrap();
16403 request_value_reader
16404 .seek(std::io::SeekFrom::Start(0))
16405 .unwrap();
16406
16407 loop {
16408 let token = match self
16409 .hub
16410 .auth
16411 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16412 .await
16413 {
16414 Ok(token) => token,
16415 Err(e) => match dlg.token(e) {
16416 Ok(token) => token,
16417 Err(e) => {
16418 dlg.finished(false);
16419 return Err(common::Error::MissingToken(e));
16420 }
16421 },
16422 };
16423 request_value_reader
16424 .seek(std::io::SeekFrom::Start(0))
16425 .unwrap();
16426 let mut req_result = {
16427 let client = &self.hub.client;
16428 dlg.pre_request();
16429 let mut req_builder = hyper::Request::builder()
16430 .method(hyper::Method::POST)
16431 .uri(url.as_str())
16432 .header(USER_AGENT, self.hub._user_agent.clone());
16433
16434 if let Some(token) = token.as_ref() {
16435 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16436 }
16437
16438 let request = req_builder
16439 .header(CONTENT_TYPE, json_mime_type.to_string())
16440 .header(CONTENT_LENGTH, request_size as u64)
16441 .body(common::to_body(
16442 request_value_reader.get_ref().clone().into(),
16443 ));
16444
16445 client.request(request.unwrap()).await
16446 };
16447
16448 match req_result {
16449 Err(err) => {
16450 if let common::Retry::After(d) = dlg.http_error(&err) {
16451 sleep(d).await;
16452 continue;
16453 }
16454 dlg.finished(false);
16455 return Err(common::Error::HttpError(err));
16456 }
16457 Ok(res) => {
16458 let (mut parts, body) = res.into_parts();
16459 let mut body = common::Body::new(body);
16460 if !parts.status.is_success() {
16461 let bytes = common::to_bytes(body).await.unwrap_or_default();
16462 let error = serde_json::from_str(&common::to_string(&bytes));
16463 let response = common::to_response(parts, bytes.into());
16464
16465 if let common::Retry::After(d) =
16466 dlg.http_failure(&response, error.as_ref().ok())
16467 {
16468 sleep(d).await;
16469 continue;
16470 }
16471
16472 dlg.finished(false);
16473
16474 return Err(match error {
16475 Ok(value) => common::Error::BadRequest(value),
16476 _ => common::Error::Failure(response),
16477 });
16478 }
16479 let response = {
16480 let bytes = common::to_bytes(body).await.unwrap_or_default();
16481 let encoded = common::to_string(&bytes);
16482 match serde_json::from_str(&encoded) {
16483 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16484 Err(error) => {
16485 dlg.response_json_decode_error(&encoded, &error);
16486 return Err(common::Error::JsonDecodeError(
16487 encoded.to_string(),
16488 error,
16489 ));
16490 }
16491 }
16492 };
16493
16494 dlg.finished(true);
16495 return Ok(response);
16496 }
16497 }
16498 }
16499 }
16500
16501 ///
16502 /// Sets the *request* property to the given value.
16503 ///
16504 /// Even though the property as already been set when instantiating this call,
16505 /// we provide this method for API completeness.
16506 pub fn request(
16507 mut self,
16508 new_value: SetIamPolicyRequest,
16509 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
16510 self._request = new_value;
16511 self
16512 }
16513 /// 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.
16514 ///
16515 /// Sets the *resource* path property to the given value.
16516 ///
16517 /// Even though the property as already been set when instantiating this call,
16518 /// we provide this method for API completeness.
16519 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
16520 self._resource = new_value.to_string();
16521 self
16522 }
16523 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16524 /// while executing the actual API request.
16525 ///
16526 /// ````text
16527 /// It should be used to handle progress information, and to implement a certain level of resilience.
16528 /// ````
16529 ///
16530 /// Sets the *delegate* property to the given value.
16531 pub fn delegate(
16532 mut self,
16533 new_value: &'a mut dyn common::Delegate,
16534 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
16535 self._delegate = Some(new_value);
16536 self
16537 }
16538
16539 /// Set any additional parameter of the query string used in the request.
16540 /// It should be used to set parameters which are not yet available through their own
16541 /// setters.
16542 ///
16543 /// Please note that this method must not be used to set any of the known parameters
16544 /// which have their own setter method. If done anyway, the request will fail.
16545 ///
16546 /// # Additional Parameters
16547 ///
16548 /// * *$.xgafv* (query-string) - V1 error format.
16549 /// * *access_token* (query-string) - OAuth access token.
16550 /// * *alt* (query-string) - Data format for response.
16551 /// * *callback* (query-string) - JSONP
16552 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16553 /// * *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.
16554 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16555 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16556 /// * *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.
16557 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16558 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16559 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobSetIamPolicyCall<'a, C>
16560 where
16561 T: AsRef<str>,
16562 {
16563 self._additional_params
16564 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16565 self
16566 }
16567
16568 /// Identifies the authorization scope for the method you are building.
16569 ///
16570 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16571 /// [`Scope::CloudPlatform`].
16572 ///
16573 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16574 /// tokens for more than one scope.
16575 ///
16576 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16577 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16578 /// sufficient, a read-write scope will do as well.
16579 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobSetIamPolicyCall<'a, C>
16580 where
16581 St: AsRef<str>,
16582 {
16583 self._scopes.insert(String::from(scope.as_ref()));
16584 self
16585 }
16586 /// Identifies the authorization scope(s) for the method you are building.
16587 ///
16588 /// See [`Self::add_scope()`] for details.
16589 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobSetIamPolicyCall<'a, C>
16590 where
16591 I: IntoIterator<Item = St>,
16592 St: AsRef<str>,
16593 {
16594 self._scopes
16595 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16596 self
16597 }
16598
16599 /// Removes all scopes, and no default scope will be used either.
16600 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16601 /// for details).
16602 pub fn clear_scopes(mut self) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
16603 self._scopes.clear();
16604 self
16605 }
16606}
16607
16608/// Returns permissions that a caller has on the specified job. There are no permissions required for making this API call.
16609///
16610/// A builder for the *locations.jobs.testIamPermissions* method supported by a *project* resource.
16611/// It is not used directly, but through a [`ProjectMethods`] instance.
16612///
16613/// # Example
16614///
16615/// Instantiate a resource method builder
16616///
16617/// ```test_harness,no_run
16618/// # extern crate hyper;
16619/// # extern crate hyper_rustls;
16620/// # extern crate google_run1 as run1;
16621/// use run1::api::TestIamPermissionsRequest;
16622/// # async fn dox() {
16623/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16624///
16625/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16626/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16627/// # secret,
16628/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16629/// # ).build().await.unwrap();
16630///
16631/// # let client = hyper_util::client::legacy::Client::builder(
16632/// # hyper_util::rt::TokioExecutor::new()
16633/// # )
16634/// # .build(
16635/// # hyper_rustls::HttpsConnectorBuilder::new()
16636/// # .with_native_roots()
16637/// # .unwrap()
16638/// # .https_or_http()
16639/// # .enable_http1()
16640/// # .build()
16641/// # );
16642/// # let mut hub = CloudRun::new(client, auth);
16643/// // As the method needs a request, you would usually fill it with the desired information
16644/// // into the respective structure. Some of the parts shown here might not be applicable !
16645/// // Values shown here are possibly random and not representative !
16646/// let mut req = TestIamPermissionsRequest::default();
16647///
16648/// // You can configure optional parameters by calling the respective setters at will, and
16649/// // execute the final call using `doit()`.
16650/// // Values shown here are possibly random and not representative !
16651/// let result = hub.projects().locations_jobs_test_iam_permissions(req, "resource")
16652/// .doit().await;
16653/// # }
16654/// ```
16655pub struct ProjectLocationJobTestIamPermissionCall<'a, C>
16656where
16657 C: 'a,
16658{
16659 hub: &'a CloudRun<C>,
16660 _request: TestIamPermissionsRequest,
16661 _resource: String,
16662 _delegate: Option<&'a mut dyn common::Delegate>,
16663 _additional_params: HashMap<String, String>,
16664 _scopes: BTreeSet<String>,
16665}
16666
16667impl<'a, C> common::CallBuilder for ProjectLocationJobTestIamPermissionCall<'a, C> {}
16668
16669impl<'a, C> ProjectLocationJobTestIamPermissionCall<'a, C>
16670where
16671 C: common::Connector,
16672{
16673 /// Perform the operation you have build so far.
16674 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
16675 use std::borrow::Cow;
16676 use std::io::{Read, Seek};
16677
16678 use common::{url::Params, ToParts};
16679 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16680
16681 let mut dd = common::DefaultDelegate;
16682 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16683 dlg.begin(common::MethodInfo {
16684 id: "run.projects.locations.jobs.testIamPermissions",
16685 http_method: hyper::Method::POST,
16686 });
16687
16688 for &field in ["alt", "resource"].iter() {
16689 if self._additional_params.contains_key(field) {
16690 dlg.finished(false);
16691 return Err(common::Error::FieldClash(field));
16692 }
16693 }
16694
16695 let mut params = Params::with_capacity(4 + self._additional_params.len());
16696 params.push("resource", self._resource);
16697
16698 params.extend(self._additional_params.iter());
16699
16700 params.push("alt", "json");
16701 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
16702 if self._scopes.is_empty() {
16703 self._scopes
16704 .insert(Scope::CloudPlatform.as_ref().to_string());
16705 }
16706
16707 #[allow(clippy::single_element_loop)]
16708 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16709 url = params.uri_replacement(url, param_name, find_this, true);
16710 }
16711 {
16712 let to_remove = ["resource"];
16713 params.remove_params(&to_remove);
16714 }
16715
16716 let url = params.parse_with_url(&url);
16717
16718 let mut json_mime_type = mime::APPLICATION_JSON;
16719 let mut request_value_reader = {
16720 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16721 common::remove_json_null_values(&mut value);
16722 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16723 serde_json::to_writer(&mut dst, &value).unwrap();
16724 dst
16725 };
16726 let request_size = request_value_reader
16727 .seek(std::io::SeekFrom::End(0))
16728 .unwrap();
16729 request_value_reader
16730 .seek(std::io::SeekFrom::Start(0))
16731 .unwrap();
16732
16733 loop {
16734 let token = match self
16735 .hub
16736 .auth
16737 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16738 .await
16739 {
16740 Ok(token) => token,
16741 Err(e) => match dlg.token(e) {
16742 Ok(token) => token,
16743 Err(e) => {
16744 dlg.finished(false);
16745 return Err(common::Error::MissingToken(e));
16746 }
16747 },
16748 };
16749 request_value_reader
16750 .seek(std::io::SeekFrom::Start(0))
16751 .unwrap();
16752 let mut req_result = {
16753 let client = &self.hub.client;
16754 dlg.pre_request();
16755 let mut req_builder = hyper::Request::builder()
16756 .method(hyper::Method::POST)
16757 .uri(url.as_str())
16758 .header(USER_AGENT, self.hub._user_agent.clone());
16759
16760 if let Some(token) = token.as_ref() {
16761 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16762 }
16763
16764 let request = req_builder
16765 .header(CONTENT_TYPE, json_mime_type.to_string())
16766 .header(CONTENT_LENGTH, request_size as u64)
16767 .body(common::to_body(
16768 request_value_reader.get_ref().clone().into(),
16769 ));
16770
16771 client.request(request.unwrap()).await
16772 };
16773
16774 match req_result {
16775 Err(err) => {
16776 if let common::Retry::After(d) = dlg.http_error(&err) {
16777 sleep(d).await;
16778 continue;
16779 }
16780 dlg.finished(false);
16781 return Err(common::Error::HttpError(err));
16782 }
16783 Ok(res) => {
16784 let (mut parts, body) = res.into_parts();
16785 let mut body = common::Body::new(body);
16786 if !parts.status.is_success() {
16787 let bytes = common::to_bytes(body).await.unwrap_or_default();
16788 let error = serde_json::from_str(&common::to_string(&bytes));
16789 let response = common::to_response(parts, bytes.into());
16790
16791 if let common::Retry::After(d) =
16792 dlg.http_failure(&response, error.as_ref().ok())
16793 {
16794 sleep(d).await;
16795 continue;
16796 }
16797
16798 dlg.finished(false);
16799
16800 return Err(match error {
16801 Ok(value) => common::Error::BadRequest(value),
16802 _ => common::Error::Failure(response),
16803 });
16804 }
16805 let response = {
16806 let bytes = common::to_bytes(body).await.unwrap_or_default();
16807 let encoded = common::to_string(&bytes);
16808 match serde_json::from_str(&encoded) {
16809 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16810 Err(error) => {
16811 dlg.response_json_decode_error(&encoded, &error);
16812 return Err(common::Error::JsonDecodeError(
16813 encoded.to_string(),
16814 error,
16815 ));
16816 }
16817 }
16818 };
16819
16820 dlg.finished(true);
16821 return Ok(response);
16822 }
16823 }
16824 }
16825 }
16826
16827 ///
16828 /// Sets the *request* property to the given value.
16829 ///
16830 /// Even though the property as already been set when instantiating this call,
16831 /// we provide this method for API completeness.
16832 pub fn request(
16833 mut self,
16834 new_value: TestIamPermissionsRequest,
16835 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
16836 self._request = new_value;
16837 self
16838 }
16839 /// 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.
16840 ///
16841 /// Sets the *resource* path property to the given value.
16842 ///
16843 /// Even though the property as already been set when instantiating this call,
16844 /// we provide this method for API completeness.
16845 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
16846 self._resource = new_value.to_string();
16847 self
16848 }
16849 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16850 /// while executing the actual API request.
16851 ///
16852 /// ````text
16853 /// It should be used to handle progress information, and to implement a certain level of resilience.
16854 /// ````
16855 ///
16856 /// Sets the *delegate* property to the given value.
16857 pub fn delegate(
16858 mut self,
16859 new_value: &'a mut dyn common::Delegate,
16860 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
16861 self._delegate = Some(new_value);
16862 self
16863 }
16864
16865 /// Set any additional parameter of the query string used in the request.
16866 /// It should be used to set parameters which are not yet available through their own
16867 /// setters.
16868 ///
16869 /// Please note that this method must not be used to set any of the known parameters
16870 /// which have their own setter method. If done anyway, the request will fail.
16871 ///
16872 /// # Additional Parameters
16873 ///
16874 /// * *$.xgafv* (query-string) - V1 error format.
16875 /// * *access_token* (query-string) - OAuth access token.
16876 /// * *alt* (query-string) - Data format for response.
16877 /// * *callback* (query-string) - JSONP
16878 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16879 /// * *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.
16880 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16881 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16882 /// * *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.
16883 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16884 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16885 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTestIamPermissionCall<'a, C>
16886 where
16887 T: AsRef<str>,
16888 {
16889 self._additional_params
16890 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16891 self
16892 }
16893
16894 /// Identifies the authorization scope for the method you are building.
16895 ///
16896 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16897 /// [`Scope::CloudPlatform`].
16898 ///
16899 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16900 /// tokens for more than one scope.
16901 ///
16902 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16903 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16904 /// sufficient, a read-write scope will do as well.
16905 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTestIamPermissionCall<'a, C>
16906 where
16907 St: AsRef<str>,
16908 {
16909 self._scopes.insert(String::from(scope.as_ref()));
16910 self
16911 }
16912 /// Identifies the authorization scope(s) for the method you are building.
16913 ///
16914 /// See [`Self::add_scope()`] for details.
16915 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTestIamPermissionCall<'a, C>
16916 where
16917 I: IntoIterator<Item = St>,
16918 St: AsRef<str>,
16919 {
16920 self._scopes
16921 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16922 self
16923 }
16924
16925 /// Removes all scopes, and no default scope will be used either.
16926 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16927 /// for details).
16928 pub fn clear_scopes(mut self) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
16929 self._scopes.clear();
16930 self
16931 }
16932}
16933
16934/// 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`.
16935///
16936/// A builder for the *locations.operations.delete* method supported by a *project* resource.
16937/// It is not used directly, but through a [`ProjectMethods`] instance.
16938///
16939/// # Example
16940///
16941/// Instantiate a resource method builder
16942///
16943/// ```test_harness,no_run
16944/// # extern crate hyper;
16945/// # extern crate hyper_rustls;
16946/// # extern crate google_run1 as run1;
16947/// # async fn dox() {
16948/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16949///
16950/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16952/// # secret,
16953/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16954/// # ).build().await.unwrap();
16955///
16956/// # let client = hyper_util::client::legacy::Client::builder(
16957/// # hyper_util::rt::TokioExecutor::new()
16958/// # )
16959/// # .build(
16960/// # hyper_rustls::HttpsConnectorBuilder::new()
16961/// # .with_native_roots()
16962/// # .unwrap()
16963/// # .https_or_http()
16964/// # .enable_http1()
16965/// # .build()
16966/// # );
16967/// # let mut hub = CloudRun::new(client, auth);
16968/// // You can configure optional parameters by calling the respective setters at will, and
16969/// // execute the final call using `doit()`.
16970/// // Values shown here are possibly random and not representative !
16971/// let result = hub.projects().locations_operations_delete("name")
16972/// .doit().await;
16973/// # }
16974/// ```
16975pub struct ProjectLocationOperationDeleteCall<'a, C>
16976where
16977 C: 'a,
16978{
16979 hub: &'a CloudRun<C>,
16980 _name: String,
16981 _delegate: Option<&'a mut dyn common::Delegate>,
16982 _additional_params: HashMap<String, String>,
16983 _scopes: BTreeSet<String>,
16984}
16985
16986impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
16987
16988impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
16989where
16990 C: common::Connector,
16991{
16992 /// Perform the operation you have build so far.
16993 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16994 use std::borrow::Cow;
16995 use std::io::{Read, Seek};
16996
16997 use common::{url::Params, ToParts};
16998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16999
17000 let mut dd = common::DefaultDelegate;
17001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17002 dlg.begin(common::MethodInfo {
17003 id: "run.projects.locations.operations.delete",
17004 http_method: hyper::Method::DELETE,
17005 });
17006
17007 for &field in ["alt", "name"].iter() {
17008 if self._additional_params.contains_key(field) {
17009 dlg.finished(false);
17010 return Err(common::Error::FieldClash(field));
17011 }
17012 }
17013
17014 let mut params = Params::with_capacity(3 + self._additional_params.len());
17015 params.push("name", self._name);
17016
17017 params.extend(self._additional_params.iter());
17018
17019 params.push("alt", "json");
17020 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17021 if self._scopes.is_empty() {
17022 self._scopes
17023 .insert(Scope::CloudPlatform.as_ref().to_string());
17024 }
17025
17026 #[allow(clippy::single_element_loop)]
17027 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17028 url = params.uri_replacement(url, param_name, find_this, true);
17029 }
17030 {
17031 let to_remove = ["name"];
17032 params.remove_params(&to_remove);
17033 }
17034
17035 let url = params.parse_with_url(&url);
17036
17037 loop {
17038 let token = match self
17039 .hub
17040 .auth
17041 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17042 .await
17043 {
17044 Ok(token) => token,
17045 Err(e) => match dlg.token(e) {
17046 Ok(token) => token,
17047 Err(e) => {
17048 dlg.finished(false);
17049 return Err(common::Error::MissingToken(e));
17050 }
17051 },
17052 };
17053 let mut req_result = {
17054 let client = &self.hub.client;
17055 dlg.pre_request();
17056 let mut req_builder = hyper::Request::builder()
17057 .method(hyper::Method::DELETE)
17058 .uri(url.as_str())
17059 .header(USER_AGENT, self.hub._user_agent.clone());
17060
17061 if let Some(token) = token.as_ref() {
17062 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17063 }
17064
17065 let request = req_builder
17066 .header(CONTENT_LENGTH, 0_u64)
17067 .body(common::to_body::<String>(None));
17068
17069 client.request(request.unwrap()).await
17070 };
17071
17072 match req_result {
17073 Err(err) => {
17074 if let common::Retry::After(d) = dlg.http_error(&err) {
17075 sleep(d).await;
17076 continue;
17077 }
17078 dlg.finished(false);
17079 return Err(common::Error::HttpError(err));
17080 }
17081 Ok(res) => {
17082 let (mut parts, body) = res.into_parts();
17083 let mut body = common::Body::new(body);
17084 if !parts.status.is_success() {
17085 let bytes = common::to_bytes(body).await.unwrap_or_default();
17086 let error = serde_json::from_str(&common::to_string(&bytes));
17087 let response = common::to_response(parts, bytes.into());
17088
17089 if let common::Retry::After(d) =
17090 dlg.http_failure(&response, error.as_ref().ok())
17091 {
17092 sleep(d).await;
17093 continue;
17094 }
17095
17096 dlg.finished(false);
17097
17098 return Err(match error {
17099 Ok(value) => common::Error::BadRequest(value),
17100 _ => common::Error::Failure(response),
17101 });
17102 }
17103 let response = {
17104 let bytes = common::to_bytes(body).await.unwrap_or_default();
17105 let encoded = common::to_string(&bytes);
17106 match serde_json::from_str(&encoded) {
17107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17108 Err(error) => {
17109 dlg.response_json_decode_error(&encoded, &error);
17110 return Err(common::Error::JsonDecodeError(
17111 encoded.to_string(),
17112 error,
17113 ));
17114 }
17115 }
17116 };
17117
17118 dlg.finished(true);
17119 return Ok(response);
17120 }
17121 }
17122 }
17123 }
17124
17125 /// The name of the operation resource to be deleted.
17126 ///
17127 /// Sets the *name* path property to the given value.
17128 ///
17129 /// Even though the property as already been set when instantiating this call,
17130 /// we provide this method for API completeness.
17131 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
17132 self._name = new_value.to_string();
17133 self
17134 }
17135 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17136 /// while executing the actual API request.
17137 ///
17138 /// ````text
17139 /// It should be used to handle progress information, and to implement a certain level of resilience.
17140 /// ````
17141 ///
17142 /// Sets the *delegate* property to the given value.
17143 pub fn delegate(
17144 mut self,
17145 new_value: &'a mut dyn common::Delegate,
17146 ) -> ProjectLocationOperationDeleteCall<'a, C> {
17147 self._delegate = Some(new_value);
17148 self
17149 }
17150
17151 /// Set any additional parameter of the query string used in the request.
17152 /// It should be used to set parameters which are not yet available through their own
17153 /// setters.
17154 ///
17155 /// Please note that this method must not be used to set any of the known parameters
17156 /// which have their own setter method. If done anyway, the request will fail.
17157 ///
17158 /// # Additional Parameters
17159 ///
17160 /// * *$.xgafv* (query-string) - V1 error format.
17161 /// * *access_token* (query-string) - OAuth access token.
17162 /// * *alt* (query-string) - Data format for response.
17163 /// * *callback* (query-string) - JSONP
17164 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17165 /// * *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.
17166 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17167 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17168 /// * *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.
17169 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17170 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17171 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
17172 where
17173 T: AsRef<str>,
17174 {
17175 self._additional_params
17176 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17177 self
17178 }
17179
17180 /// Identifies the authorization scope for the method you are building.
17181 ///
17182 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17183 /// [`Scope::CloudPlatform`].
17184 ///
17185 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17186 /// tokens for more than one scope.
17187 ///
17188 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17189 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17190 /// sufficient, a read-write scope will do as well.
17191 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
17192 where
17193 St: AsRef<str>,
17194 {
17195 self._scopes.insert(String::from(scope.as_ref()));
17196 self
17197 }
17198 /// Identifies the authorization scope(s) for the method you are building.
17199 ///
17200 /// See [`Self::add_scope()`] for details.
17201 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
17202 where
17203 I: IntoIterator<Item = St>,
17204 St: AsRef<str>,
17205 {
17206 self._scopes
17207 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17208 self
17209 }
17210
17211 /// Removes all scopes, and no default scope will be used either.
17212 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17213 /// for details).
17214 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
17215 self._scopes.clear();
17216 self
17217 }
17218}
17219
17220/// 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.
17221///
17222/// A builder for the *locations.operations.get* method supported by a *project* resource.
17223/// It is not used directly, but through a [`ProjectMethods`] instance.
17224///
17225/// # Example
17226///
17227/// Instantiate a resource method builder
17228///
17229/// ```test_harness,no_run
17230/// # extern crate hyper;
17231/// # extern crate hyper_rustls;
17232/// # extern crate google_run1 as run1;
17233/// # async fn dox() {
17234/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17235///
17236/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17237/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17238/// # secret,
17239/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17240/// # ).build().await.unwrap();
17241///
17242/// # let client = hyper_util::client::legacy::Client::builder(
17243/// # hyper_util::rt::TokioExecutor::new()
17244/// # )
17245/// # .build(
17246/// # hyper_rustls::HttpsConnectorBuilder::new()
17247/// # .with_native_roots()
17248/// # .unwrap()
17249/// # .https_or_http()
17250/// # .enable_http1()
17251/// # .build()
17252/// # );
17253/// # let mut hub = CloudRun::new(client, auth);
17254/// // You can configure optional parameters by calling the respective setters at will, and
17255/// // execute the final call using `doit()`.
17256/// // Values shown here are possibly random and not representative !
17257/// let result = hub.projects().locations_operations_get("name")
17258/// .doit().await;
17259/// # }
17260/// ```
17261pub struct ProjectLocationOperationGetCall<'a, C>
17262where
17263 C: 'a,
17264{
17265 hub: &'a CloudRun<C>,
17266 _name: String,
17267 _delegate: Option<&'a mut dyn common::Delegate>,
17268 _additional_params: HashMap<String, String>,
17269 _scopes: BTreeSet<String>,
17270}
17271
17272impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
17273
17274impl<'a, C> ProjectLocationOperationGetCall<'a, C>
17275where
17276 C: common::Connector,
17277{
17278 /// Perform the operation you have build so far.
17279 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
17280 use std::borrow::Cow;
17281 use std::io::{Read, Seek};
17282
17283 use common::{url::Params, ToParts};
17284 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17285
17286 let mut dd = common::DefaultDelegate;
17287 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17288 dlg.begin(common::MethodInfo {
17289 id: "run.projects.locations.operations.get",
17290 http_method: hyper::Method::GET,
17291 });
17292
17293 for &field in ["alt", "name"].iter() {
17294 if self._additional_params.contains_key(field) {
17295 dlg.finished(false);
17296 return Err(common::Error::FieldClash(field));
17297 }
17298 }
17299
17300 let mut params = Params::with_capacity(3 + self._additional_params.len());
17301 params.push("name", self._name);
17302
17303 params.extend(self._additional_params.iter());
17304
17305 params.push("alt", "json");
17306 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17307 if self._scopes.is_empty() {
17308 self._scopes
17309 .insert(Scope::CloudPlatform.as_ref().to_string());
17310 }
17311
17312 #[allow(clippy::single_element_loop)]
17313 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17314 url = params.uri_replacement(url, param_name, find_this, true);
17315 }
17316 {
17317 let to_remove = ["name"];
17318 params.remove_params(&to_remove);
17319 }
17320
17321 let url = params.parse_with_url(&url);
17322
17323 loop {
17324 let token = match self
17325 .hub
17326 .auth
17327 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17328 .await
17329 {
17330 Ok(token) => token,
17331 Err(e) => match dlg.token(e) {
17332 Ok(token) => token,
17333 Err(e) => {
17334 dlg.finished(false);
17335 return Err(common::Error::MissingToken(e));
17336 }
17337 },
17338 };
17339 let mut req_result = {
17340 let client = &self.hub.client;
17341 dlg.pre_request();
17342 let mut req_builder = hyper::Request::builder()
17343 .method(hyper::Method::GET)
17344 .uri(url.as_str())
17345 .header(USER_AGENT, self.hub._user_agent.clone());
17346
17347 if let Some(token) = token.as_ref() {
17348 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17349 }
17350
17351 let request = req_builder
17352 .header(CONTENT_LENGTH, 0_u64)
17353 .body(common::to_body::<String>(None));
17354
17355 client.request(request.unwrap()).await
17356 };
17357
17358 match req_result {
17359 Err(err) => {
17360 if let common::Retry::After(d) = dlg.http_error(&err) {
17361 sleep(d).await;
17362 continue;
17363 }
17364 dlg.finished(false);
17365 return Err(common::Error::HttpError(err));
17366 }
17367 Ok(res) => {
17368 let (mut parts, body) = res.into_parts();
17369 let mut body = common::Body::new(body);
17370 if !parts.status.is_success() {
17371 let bytes = common::to_bytes(body).await.unwrap_or_default();
17372 let error = serde_json::from_str(&common::to_string(&bytes));
17373 let response = common::to_response(parts, bytes.into());
17374
17375 if let common::Retry::After(d) =
17376 dlg.http_failure(&response, error.as_ref().ok())
17377 {
17378 sleep(d).await;
17379 continue;
17380 }
17381
17382 dlg.finished(false);
17383
17384 return Err(match error {
17385 Ok(value) => common::Error::BadRequest(value),
17386 _ => common::Error::Failure(response),
17387 });
17388 }
17389 let response = {
17390 let bytes = common::to_bytes(body).await.unwrap_or_default();
17391 let encoded = common::to_string(&bytes);
17392 match serde_json::from_str(&encoded) {
17393 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17394 Err(error) => {
17395 dlg.response_json_decode_error(&encoded, &error);
17396 return Err(common::Error::JsonDecodeError(
17397 encoded.to_string(),
17398 error,
17399 ));
17400 }
17401 }
17402 };
17403
17404 dlg.finished(true);
17405 return Ok(response);
17406 }
17407 }
17408 }
17409 }
17410
17411 /// The name of the operation resource.
17412 ///
17413 /// Sets the *name* path property to the given value.
17414 ///
17415 /// Even though the property as already been set when instantiating this call,
17416 /// we provide this method for API completeness.
17417 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
17418 self._name = new_value.to_string();
17419 self
17420 }
17421 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17422 /// while executing the actual API request.
17423 ///
17424 /// ````text
17425 /// It should be used to handle progress information, and to implement a certain level of resilience.
17426 /// ````
17427 ///
17428 /// Sets the *delegate* property to the given value.
17429 pub fn delegate(
17430 mut self,
17431 new_value: &'a mut dyn common::Delegate,
17432 ) -> ProjectLocationOperationGetCall<'a, C> {
17433 self._delegate = Some(new_value);
17434 self
17435 }
17436
17437 /// Set any additional parameter of the query string used in the request.
17438 /// It should be used to set parameters which are not yet available through their own
17439 /// setters.
17440 ///
17441 /// Please note that this method must not be used to set any of the known parameters
17442 /// which have their own setter method. If done anyway, the request will fail.
17443 ///
17444 /// # Additional Parameters
17445 ///
17446 /// * *$.xgafv* (query-string) - V1 error format.
17447 /// * *access_token* (query-string) - OAuth access token.
17448 /// * *alt* (query-string) - Data format for response.
17449 /// * *callback* (query-string) - JSONP
17450 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17451 /// * *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.
17452 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17453 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17454 /// * *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.
17455 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17456 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17457 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
17458 where
17459 T: AsRef<str>,
17460 {
17461 self._additional_params
17462 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17463 self
17464 }
17465
17466 /// Identifies the authorization scope for the method you are building.
17467 ///
17468 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17469 /// [`Scope::CloudPlatform`].
17470 ///
17471 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17472 /// tokens for more than one scope.
17473 ///
17474 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17475 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17476 /// sufficient, a read-write scope will do as well.
17477 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
17478 where
17479 St: AsRef<str>,
17480 {
17481 self._scopes.insert(String::from(scope.as_ref()));
17482 self
17483 }
17484 /// Identifies the authorization scope(s) for the method you are building.
17485 ///
17486 /// See [`Self::add_scope()`] for details.
17487 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
17488 where
17489 I: IntoIterator<Item = St>,
17490 St: AsRef<str>,
17491 {
17492 self._scopes
17493 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17494 self
17495 }
17496
17497 /// Removes all scopes, and no default scope will be used either.
17498 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17499 /// for details).
17500 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
17501 self._scopes.clear();
17502 self
17503 }
17504}
17505
17506/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
17507///
17508/// A builder for the *locations.operations.list* method supported by a *project* resource.
17509/// It is not used directly, but through a [`ProjectMethods`] instance.
17510///
17511/// # Example
17512///
17513/// Instantiate a resource method builder
17514///
17515/// ```test_harness,no_run
17516/// # extern crate hyper;
17517/// # extern crate hyper_rustls;
17518/// # extern crate google_run1 as run1;
17519/// # async fn dox() {
17520/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17521///
17522/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17524/// # secret,
17525/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17526/// # ).build().await.unwrap();
17527///
17528/// # let client = hyper_util::client::legacy::Client::builder(
17529/// # hyper_util::rt::TokioExecutor::new()
17530/// # )
17531/// # .build(
17532/// # hyper_rustls::HttpsConnectorBuilder::new()
17533/// # .with_native_roots()
17534/// # .unwrap()
17535/// # .https_or_http()
17536/// # .enable_http1()
17537/// # .build()
17538/// # );
17539/// # let mut hub = CloudRun::new(client, auth);
17540/// // You can configure optional parameters by calling the respective setters at will, and
17541/// // execute the final call using `doit()`.
17542/// // Values shown here are possibly random and not representative !
17543/// let result = hub.projects().locations_operations_list("name")
17544/// .page_token("sit")
17545/// .page_size(-81)
17546/// .filter("sea")
17547/// .doit().await;
17548/// # }
17549/// ```
17550pub struct ProjectLocationOperationListCall<'a, C>
17551where
17552 C: 'a,
17553{
17554 hub: &'a CloudRun<C>,
17555 _name: String,
17556 _page_token: Option<String>,
17557 _page_size: Option<i32>,
17558 _filter: Option<String>,
17559 _delegate: Option<&'a mut dyn common::Delegate>,
17560 _additional_params: HashMap<String, String>,
17561 _scopes: BTreeSet<String>,
17562}
17563
17564impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
17565
17566impl<'a, C> ProjectLocationOperationListCall<'a, C>
17567where
17568 C: common::Connector,
17569{
17570 /// Perform the operation you have build so far.
17571 pub async fn doit(
17572 mut self,
17573 ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
17574 use std::borrow::Cow;
17575 use std::io::{Read, Seek};
17576
17577 use common::{url::Params, ToParts};
17578 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17579
17580 let mut dd = common::DefaultDelegate;
17581 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17582 dlg.begin(common::MethodInfo {
17583 id: "run.projects.locations.operations.list",
17584 http_method: hyper::Method::GET,
17585 });
17586
17587 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
17588 if self._additional_params.contains_key(field) {
17589 dlg.finished(false);
17590 return Err(common::Error::FieldClash(field));
17591 }
17592 }
17593
17594 let mut params = Params::with_capacity(6 + self._additional_params.len());
17595 params.push("name", self._name);
17596 if let Some(value) = self._page_token.as_ref() {
17597 params.push("pageToken", value);
17598 }
17599 if let Some(value) = self._page_size.as_ref() {
17600 params.push("pageSize", value.to_string());
17601 }
17602 if let Some(value) = self._filter.as_ref() {
17603 params.push("filter", value);
17604 }
17605
17606 params.extend(self._additional_params.iter());
17607
17608 params.push("alt", "json");
17609 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
17610 if self._scopes.is_empty() {
17611 self._scopes
17612 .insert(Scope::CloudPlatform.as_ref().to_string());
17613 }
17614
17615 #[allow(clippy::single_element_loop)]
17616 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17617 url = params.uri_replacement(url, param_name, find_this, true);
17618 }
17619 {
17620 let to_remove = ["name"];
17621 params.remove_params(&to_remove);
17622 }
17623
17624 let url = params.parse_with_url(&url);
17625
17626 loop {
17627 let token = match self
17628 .hub
17629 .auth
17630 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17631 .await
17632 {
17633 Ok(token) => token,
17634 Err(e) => match dlg.token(e) {
17635 Ok(token) => token,
17636 Err(e) => {
17637 dlg.finished(false);
17638 return Err(common::Error::MissingToken(e));
17639 }
17640 },
17641 };
17642 let mut req_result = {
17643 let client = &self.hub.client;
17644 dlg.pre_request();
17645 let mut req_builder = hyper::Request::builder()
17646 .method(hyper::Method::GET)
17647 .uri(url.as_str())
17648 .header(USER_AGENT, self.hub._user_agent.clone());
17649
17650 if let Some(token) = token.as_ref() {
17651 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17652 }
17653
17654 let request = req_builder
17655 .header(CONTENT_LENGTH, 0_u64)
17656 .body(common::to_body::<String>(None));
17657
17658 client.request(request.unwrap()).await
17659 };
17660
17661 match req_result {
17662 Err(err) => {
17663 if let common::Retry::After(d) = dlg.http_error(&err) {
17664 sleep(d).await;
17665 continue;
17666 }
17667 dlg.finished(false);
17668 return Err(common::Error::HttpError(err));
17669 }
17670 Ok(res) => {
17671 let (mut parts, body) = res.into_parts();
17672 let mut body = common::Body::new(body);
17673 if !parts.status.is_success() {
17674 let bytes = common::to_bytes(body).await.unwrap_or_default();
17675 let error = serde_json::from_str(&common::to_string(&bytes));
17676 let response = common::to_response(parts, bytes.into());
17677
17678 if let common::Retry::After(d) =
17679 dlg.http_failure(&response, error.as_ref().ok())
17680 {
17681 sleep(d).await;
17682 continue;
17683 }
17684
17685 dlg.finished(false);
17686
17687 return Err(match error {
17688 Ok(value) => common::Error::BadRequest(value),
17689 _ => common::Error::Failure(response),
17690 });
17691 }
17692 let response = {
17693 let bytes = common::to_bytes(body).await.unwrap_or_default();
17694 let encoded = common::to_string(&bytes);
17695 match serde_json::from_str(&encoded) {
17696 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17697 Err(error) => {
17698 dlg.response_json_decode_error(&encoded, &error);
17699 return Err(common::Error::JsonDecodeError(
17700 encoded.to_string(),
17701 error,
17702 ));
17703 }
17704 }
17705 };
17706
17707 dlg.finished(true);
17708 return Ok(response);
17709 }
17710 }
17711 }
17712 }
17713
17714 /// Required. To query for all of the operations for a project.
17715 ///
17716 /// Sets the *name* path property to the given value.
17717 ///
17718 /// Even though the property as already been set when instantiating this call,
17719 /// we provide this method for API completeness.
17720 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17721 self._name = new_value.to_string();
17722 self
17723 }
17724 /// Token identifying which result to start with, which is returned by a previous list call.
17725 ///
17726 /// Sets the *page token* query property to the given value.
17727 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17728 self._page_token = Some(new_value.to_string());
17729 self
17730 }
17731 /// 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. .
17732 ///
17733 /// Sets the *page size* query property to the given value.
17734 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
17735 self._page_size = Some(new_value);
17736 self
17737 }
17738 /// 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.
17739 ///
17740 /// Sets the *filter* query property to the given value.
17741 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17742 self._filter = Some(new_value.to_string());
17743 self
17744 }
17745 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17746 /// while executing the actual API request.
17747 ///
17748 /// ````text
17749 /// It should be used to handle progress information, and to implement a certain level of resilience.
17750 /// ````
17751 ///
17752 /// Sets the *delegate* property to the given value.
17753 pub fn delegate(
17754 mut self,
17755 new_value: &'a mut dyn common::Delegate,
17756 ) -> ProjectLocationOperationListCall<'a, C> {
17757 self._delegate = Some(new_value);
17758 self
17759 }
17760
17761 /// Set any additional parameter of the query string used in the request.
17762 /// It should be used to set parameters which are not yet available through their own
17763 /// setters.
17764 ///
17765 /// Please note that this method must not be used to set any of the known parameters
17766 /// which have their own setter method. If done anyway, the request will fail.
17767 ///
17768 /// # Additional Parameters
17769 ///
17770 /// * *$.xgafv* (query-string) - V1 error format.
17771 /// * *access_token* (query-string) - OAuth access token.
17772 /// * *alt* (query-string) - Data format for response.
17773 /// * *callback* (query-string) - JSONP
17774 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17775 /// * *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.
17776 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17777 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17778 /// * *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.
17779 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17780 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17781 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
17782 where
17783 T: AsRef<str>,
17784 {
17785 self._additional_params
17786 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17787 self
17788 }
17789
17790 /// Identifies the authorization scope for the method you are building.
17791 ///
17792 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17793 /// [`Scope::CloudPlatform`].
17794 ///
17795 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17796 /// tokens for more than one scope.
17797 ///
17798 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17799 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17800 /// sufficient, a read-write scope will do as well.
17801 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
17802 where
17803 St: AsRef<str>,
17804 {
17805 self._scopes.insert(String::from(scope.as_ref()));
17806 self
17807 }
17808 /// Identifies the authorization scope(s) for the method you are building.
17809 ///
17810 /// See [`Self::add_scope()`] for details.
17811 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
17812 where
17813 I: IntoIterator<Item = St>,
17814 St: AsRef<str>,
17815 {
17816 self._scopes
17817 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17818 self
17819 }
17820
17821 /// Removes all scopes, and no default scope will be used either.
17822 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17823 /// for details).
17824 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
17825 self._scopes.clear();
17826 self
17827 }
17828}
17829
17830/// 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.
17831///
17832/// A builder for the *locations.operations.wait* method supported by a *project* resource.
17833/// It is not used directly, but through a [`ProjectMethods`] instance.
17834///
17835/// # Example
17836///
17837/// Instantiate a resource method builder
17838///
17839/// ```test_harness,no_run
17840/// # extern crate hyper;
17841/// # extern crate hyper_rustls;
17842/// # extern crate google_run1 as run1;
17843/// use run1::api::GoogleLongrunningWaitOperationRequest;
17844/// # async fn dox() {
17845/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17846///
17847/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17848/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17849/// # secret,
17850/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17851/// # ).build().await.unwrap();
17852///
17853/// # let client = hyper_util::client::legacy::Client::builder(
17854/// # hyper_util::rt::TokioExecutor::new()
17855/// # )
17856/// # .build(
17857/// # hyper_rustls::HttpsConnectorBuilder::new()
17858/// # .with_native_roots()
17859/// # .unwrap()
17860/// # .https_or_http()
17861/// # .enable_http1()
17862/// # .build()
17863/// # );
17864/// # let mut hub = CloudRun::new(client, auth);
17865/// // As the method needs a request, you would usually fill it with the desired information
17866/// // into the respective structure. Some of the parts shown here might not be applicable !
17867/// // Values shown here are possibly random and not representative !
17868/// let mut req = GoogleLongrunningWaitOperationRequest::default();
17869///
17870/// // You can configure optional parameters by calling the respective setters at will, and
17871/// // execute the final call using `doit()`.
17872/// // Values shown here are possibly random and not representative !
17873/// let result = hub.projects().locations_operations_wait(req, "name")
17874/// .doit().await;
17875/// # }
17876/// ```
17877pub struct ProjectLocationOperationWaitCall<'a, C>
17878where
17879 C: 'a,
17880{
17881 hub: &'a CloudRun<C>,
17882 _request: GoogleLongrunningWaitOperationRequest,
17883 _name: String,
17884 _delegate: Option<&'a mut dyn common::Delegate>,
17885 _additional_params: HashMap<String, String>,
17886 _scopes: BTreeSet<String>,
17887}
17888
17889impl<'a, C> common::CallBuilder for ProjectLocationOperationWaitCall<'a, C> {}
17890
17891impl<'a, C> ProjectLocationOperationWaitCall<'a, C>
17892where
17893 C: common::Connector,
17894{
17895 /// Perform the operation you have build so far.
17896 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
17897 use std::borrow::Cow;
17898 use std::io::{Read, Seek};
17899
17900 use common::{url::Params, ToParts};
17901 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17902
17903 let mut dd = common::DefaultDelegate;
17904 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17905 dlg.begin(common::MethodInfo {
17906 id: "run.projects.locations.operations.wait",
17907 http_method: hyper::Method::POST,
17908 });
17909
17910 for &field in ["alt", "name"].iter() {
17911 if self._additional_params.contains_key(field) {
17912 dlg.finished(false);
17913 return Err(common::Error::FieldClash(field));
17914 }
17915 }
17916
17917 let mut params = Params::with_capacity(4 + self._additional_params.len());
17918 params.push("name", self._name);
17919
17920 params.extend(self._additional_params.iter());
17921
17922 params.push("alt", "json");
17923 let mut url = self.hub._base_url.clone() + "v1/{+name}:wait";
17924 if self._scopes.is_empty() {
17925 self._scopes
17926 .insert(Scope::CloudPlatform.as_ref().to_string());
17927 }
17928
17929 #[allow(clippy::single_element_loop)]
17930 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17931 url = params.uri_replacement(url, param_name, find_this, true);
17932 }
17933 {
17934 let to_remove = ["name"];
17935 params.remove_params(&to_remove);
17936 }
17937
17938 let url = params.parse_with_url(&url);
17939
17940 let mut json_mime_type = mime::APPLICATION_JSON;
17941 let mut request_value_reader = {
17942 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17943 common::remove_json_null_values(&mut value);
17944 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17945 serde_json::to_writer(&mut dst, &value).unwrap();
17946 dst
17947 };
17948 let request_size = request_value_reader
17949 .seek(std::io::SeekFrom::End(0))
17950 .unwrap();
17951 request_value_reader
17952 .seek(std::io::SeekFrom::Start(0))
17953 .unwrap();
17954
17955 loop {
17956 let token = match self
17957 .hub
17958 .auth
17959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17960 .await
17961 {
17962 Ok(token) => token,
17963 Err(e) => match dlg.token(e) {
17964 Ok(token) => token,
17965 Err(e) => {
17966 dlg.finished(false);
17967 return Err(common::Error::MissingToken(e));
17968 }
17969 },
17970 };
17971 request_value_reader
17972 .seek(std::io::SeekFrom::Start(0))
17973 .unwrap();
17974 let mut req_result = {
17975 let client = &self.hub.client;
17976 dlg.pre_request();
17977 let mut req_builder = hyper::Request::builder()
17978 .method(hyper::Method::POST)
17979 .uri(url.as_str())
17980 .header(USER_AGENT, self.hub._user_agent.clone());
17981
17982 if let Some(token) = token.as_ref() {
17983 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17984 }
17985
17986 let request = req_builder
17987 .header(CONTENT_TYPE, json_mime_type.to_string())
17988 .header(CONTENT_LENGTH, request_size as u64)
17989 .body(common::to_body(
17990 request_value_reader.get_ref().clone().into(),
17991 ));
17992
17993 client.request(request.unwrap()).await
17994 };
17995
17996 match req_result {
17997 Err(err) => {
17998 if let common::Retry::After(d) = dlg.http_error(&err) {
17999 sleep(d).await;
18000 continue;
18001 }
18002 dlg.finished(false);
18003 return Err(common::Error::HttpError(err));
18004 }
18005 Ok(res) => {
18006 let (mut parts, body) = res.into_parts();
18007 let mut body = common::Body::new(body);
18008 if !parts.status.is_success() {
18009 let bytes = common::to_bytes(body).await.unwrap_or_default();
18010 let error = serde_json::from_str(&common::to_string(&bytes));
18011 let response = common::to_response(parts, bytes.into());
18012
18013 if let common::Retry::After(d) =
18014 dlg.http_failure(&response, error.as_ref().ok())
18015 {
18016 sleep(d).await;
18017 continue;
18018 }
18019
18020 dlg.finished(false);
18021
18022 return Err(match error {
18023 Ok(value) => common::Error::BadRequest(value),
18024 _ => common::Error::Failure(response),
18025 });
18026 }
18027 let response = {
18028 let bytes = common::to_bytes(body).await.unwrap_or_default();
18029 let encoded = common::to_string(&bytes);
18030 match serde_json::from_str(&encoded) {
18031 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18032 Err(error) => {
18033 dlg.response_json_decode_error(&encoded, &error);
18034 return Err(common::Error::JsonDecodeError(
18035 encoded.to_string(),
18036 error,
18037 ));
18038 }
18039 }
18040 };
18041
18042 dlg.finished(true);
18043 return Ok(response);
18044 }
18045 }
18046 }
18047 }
18048
18049 ///
18050 /// Sets the *request* property to the given value.
18051 ///
18052 /// Even though the property as already been set when instantiating this call,
18053 /// we provide this method for API completeness.
18054 pub fn request(
18055 mut self,
18056 new_value: GoogleLongrunningWaitOperationRequest,
18057 ) -> ProjectLocationOperationWaitCall<'a, C> {
18058 self._request = new_value;
18059 self
18060 }
18061 /// The name of the operation resource to wait on.
18062 ///
18063 /// Sets the *name* path property to the given value.
18064 ///
18065 /// Even though the property as already been set when instantiating this call,
18066 /// we provide this method for API completeness.
18067 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationWaitCall<'a, C> {
18068 self._name = new_value.to_string();
18069 self
18070 }
18071 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18072 /// while executing the actual API request.
18073 ///
18074 /// ````text
18075 /// It should be used to handle progress information, and to implement a certain level of resilience.
18076 /// ````
18077 ///
18078 /// Sets the *delegate* property to the given value.
18079 pub fn delegate(
18080 mut self,
18081 new_value: &'a mut dyn common::Delegate,
18082 ) -> ProjectLocationOperationWaitCall<'a, C> {
18083 self._delegate = Some(new_value);
18084 self
18085 }
18086
18087 /// Set any additional parameter of the query string used in the request.
18088 /// It should be used to set parameters which are not yet available through their own
18089 /// setters.
18090 ///
18091 /// Please note that this method must not be used to set any of the known parameters
18092 /// which have their own setter method. If done anyway, the request will fail.
18093 ///
18094 /// # Additional Parameters
18095 ///
18096 /// * *$.xgafv* (query-string) - V1 error format.
18097 /// * *access_token* (query-string) - OAuth access token.
18098 /// * *alt* (query-string) - Data format for response.
18099 /// * *callback* (query-string) - JSONP
18100 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18101 /// * *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.
18102 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18103 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18104 /// * *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.
18105 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18106 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18107 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationWaitCall<'a, C>
18108 where
18109 T: AsRef<str>,
18110 {
18111 self._additional_params
18112 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18113 self
18114 }
18115
18116 /// Identifies the authorization scope for the method you are building.
18117 ///
18118 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18119 /// [`Scope::CloudPlatform`].
18120 ///
18121 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18122 /// tokens for more than one scope.
18123 ///
18124 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18125 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18126 /// sufficient, a read-write scope will do as well.
18127 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationWaitCall<'a, C>
18128 where
18129 St: AsRef<str>,
18130 {
18131 self._scopes.insert(String::from(scope.as_ref()));
18132 self
18133 }
18134 /// Identifies the authorization scope(s) for the method you are building.
18135 ///
18136 /// See [`Self::add_scope()`] for details.
18137 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationWaitCall<'a, C>
18138 where
18139 I: IntoIterator<Item = St>,
18140 St: AsRef<str>,
18141 {
18142 self._scopes
18143 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18144 self
18145 }
18146
18147 /// Removes all scopes, and no default scope will be used either.
18148 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18149 /// for details).
18150 pub fn clear_scopes(mut self) -> ProjectLocationOperationWaitCall<'a, C> {
18151 self._scopes.clear();
18152 self
18153 }
18154}
18155
18156/// Delete a revision.
18157///
18158/// A builder for the *locations.revisions.delete* method supported by a *project* resource.
18159/// It is not used directly, but through a [`ProjectMethods`] instance.
18160///
18161/// # Example
18162///
18163/// Instantiate a resource method builder
18164///
18165/// ```test_harness,no_run
18166/// # extern crate hyper;
18167/// # extern crate hyper_rustls;
18168/// # extern crate google_run1 as run1;
18169/// # async fn dox() {
18170/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18171///
18172/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18174/// # secret,
18175/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18176/// # ).build().await.unwrap();
18177///
18178/// # let client = hyper_util::client::legacy::Client::builder(
18179/// # hyper_util::rt::TokioExecutor::new()
18180/// # )
18181/// # .build(
18182/// # hyper_rustls::HttpsConnectorBuilder::new()
18183/// # .with_native_roots()
18184/// # .unwrap()
18185/// # .https_or_http()
18186/// # .enable_http1()
18187/// # .build()
18188/// # );
18189/// # let mut hub = CloudRun::new(client, auth);
18190/// // You can configure optional parameters by calling the respective setters at will, and
18191/// // execute the final call using `doit()`.
18192/// // Values shown here are possibly random and not representative !
18193/// let result = hub.projects().locations_revisions_delete("name")
18194/// .propagation_policy("gubergren")
18195/// .kind("justo")
18196/// .dry_run("sea")
18197/// .api_version("consetetur")
18198/// .doit().await;
18199/// # }
18200/// ```
18201pub struct ProjectLocationRevisionDeleteCall<'a, C>
18202where
18203 C: 'a,
18204{
18205 hub: &'a CloudRun<C>,
18206 _name: String,
18207 _propagation_policy: Option<String>,
18208 _kind: Option<String>,
18209 _dry_run: Option<String>,
18210 _api_version: Option<String>,
18211 _delegate: Option<&'a mut dyn common::Delegate>,
18212 _additional_params: HashMap<String, String>,
18213 _scopes: BTreeSet<String>,
18214}
18215
18216impl<'a, C> common::CallBuilder for ProjectLocationRevisionDeleteCall<'a, C> {}
18217
18218impl<'a, C> ProjectLocationRevisionDeleteCall<'a, C>
18219where
18220 C: common::Connector,
18221{
18222 /// Perform the operation you have build so far.
18223 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
18224 use std::borrow::Cow;
18225 use std::io::{Read, Seek};
18226
18227 use common::{url::Params, ToParts};
18228 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18229
18230 let mut dd = common::DefaultDelegate;
18231 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18232 dlg.begin(common::MethodInfo {
18233 id: "run.projects.locations.revisions.delete",
18234 http_method: hyper::Method::DELETE,
18235 });
18236
18237 for &field in [
18238 "alt",
18239 "name",
18240 "propagationPolicy",
18241 "kind",
18242 "dryRun",
18243 "apiVersion",
18244 ]
18245 .iter()
18246 {
18247 if self._additional_params.contains_key(field) {
18248 dlg.finished(false);
18249 return Err(common::Error::FieldClash(field));
18250 }
18251 }
18252
18253 let mut params = Params::with_capacity(7 + self._additional_params.len());
18254 params.push("name", self._name);
18255 if let Some(value) = self._propagation_policy.as_ref() {
18256 params.push("propagationPolicy", value);
18257 }
18258 if let Some(value) = self._kind.as_ref() {
18259 params.push("kind", value);
18260 }
18261 if let Some(value) = self._dry_run.as_ref() {
18262 params.push("dryRun", value);
18263 }
18264 if let Some(value) = self._api_version.as_ref() {
18265 params.push("apiVersion", value);
18266 }
18267
18268 params.extend(self._additional_params.iter());
18269
18270 params.push("alt", "json");
18271 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18272 if self._scopes.is_empty() {
18273 self._scopes
18274 .insert(Scope::CloudPlatform.as_ref().to_string());
18275 }
18276
18277 #[allow(clippy::single_element_loop)]
18278 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18279 url = params.uri_replacement(url, param_name, find_this, true);
18280 }
18281 {
18282 let to_remove = ["name"];
18283 params.remove_params(&to_remove);
18284 }
18285
18286 let url = params.parse_with_url(&url);
18287
18288 loop {
18289 let token = match self
18290 .hub
18291 .auth
18292 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18293 .await
18294 {
18295 Ok(token) => token,
18296 Err(e) => match dlg.token(e) {
18297 Ok(token) => token,
18298 Err(e) => {
18299 dlg.finished(false);
18300 return Err(common::Error::MissingToken(e));
18301 }
18302 },
18303 };
18304 let mut req_result = {
18305 let client = &self.hub.client;
18306 dlg.pre_request();
18307 let mut req_builder = hyper::Request::builder()
18308 .method(hyper::Method::DELETE)
18309 .uri(url.as_str())
18310 .header(USER_AGENT, self.hub._user_agent.clone());
18311
18312 if let Some(token) = token.as_ref() {
18313 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18314 }
18315
18316 let request = req_builder
18317 .header(CONTENT_LENGTH, 0_u64)
18318 .body(common::to_body::<String>(None));
18319
18320 client.request(request.unwrap()).await
18321 };
18322
18323 match req_result {
18324 Err(err) => {
18325 if let common::Retry::After(d) = dlg.http_error(&err) {
18326 sleep(d).await;
18327 continue;
18328 }
18329 dlg.finished(false);
18330 return Err(common::Error::HttpError(err));
18331 }
18332 Ok(res) => {
18333 let (mut parts, body) = res.into_parts();
18334 let mut body = common::Body::new(body);
18335 if !parts.status.is_success() {
18336 let bytes = common::to_bytes(body).await.unwrap_or_default();
18337 let error = serde_json::from_str(&common::to_string(&bytes));
18338 let response = common::to_response(parts, bytes.into());
18339
18340 if let common::Retry::After(d) =
18341 dlg.http_failure(&response, error.as_ref().ok())
18342 {
18343 sleep(d).await;
18344 continue;
18345 }
18346
18347 dlg.finished(false);
18348
18349 return Err(match error {
18350 Ok(value) => common::Error::BadRequest(value),
18351 _ => common::Error::Failure(response),
18352 });
18353 }
18354 let response = {
18355 let bytes = common::to_bytes(body).await.unwrap_or_default();
18356 let encoded = common::to_string(&bytes);
18357 match serde_json::from_str(&encoded) {
18358 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18359 Err(error) => {
18360 dlg.response_json_decode_error(&encoded, &error);
18361 return Err(common::Error::JsonDecodeError(
18362 encoded.to_string(),
18363 error,
18364 ));
18365 }
18366 }
18367 };
18368
18369 dlg.finished(true);
18370 return Ok(response);
18371 }
18372 }
18373 }
18374 }
18375
18376 /// The name of the revision to delete. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
18377 ///
18378 /// Sets the *name* path property to the given value.
18379 ///
18380 /// Even though the property as already been set when instantiating this call,
18381 /// we provide this method for API completeness.
18382 pub fn name(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
18383 self._name = new_value.to_string();
18384 self
18385 }
18386 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background.
18387 ///
18388 /// Sets the *propagation policy* query property to the given value.
18389 pub fn propagation_policy(
18390 mut self,
18391 new_value: &str,
18392 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
18393 self._propagation_policy = Some(new_value.to_string());
18394 self
18395 }
18396 /// Cloud Run currently ignores this parameter.
18397 ///
18398 /// Sets the *kind* query property to the given value.
18399 pub fn kind(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
18400 self._kind = Some(new_value.to_string());
18401 self
18402 }
18403 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
18404 ///
18405 /// Sets the *dry run* query property to the given value.
18406 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
18407 self._dry_run = Some(new_value.to_string());
18408 self
18409 }
18410 /// Cloud Run currently ignores this parameter.
18411 ///
18412 /// Sets the *api version* query property to the given value.
18413 pub fn api_version(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
18414 self._api_version = Some(new_value.to_string());
18415 self
18416 }
18417 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18418 /// while executing the actual API request.
18419 ///
18420 /// ````text
18421 /// It should be used to handle progress information, and to implement a certain level of resilience.
18422 /// ````
18423 ///
18424 /// Sets the *delegate* property to the given value.
18425 pub fn delegate(
18426 mut self,
18427 new_value: &'a mut dyn common::Delegate,
18428 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
18429 self._delegate = Some(new_value);
18430 self
18431 }
18432
18433 /// Set any additional parameter of the query string used in the request.
18434 /// It should be used to set parameters which are not yet available through their own
18435 /// setters.
18436 ///
18437 /// Please note that this method must not be used to set any of the known parameters
18438 /// which have their own setter method. If done anyway, the request will fail.
18439 ///
18440 /// # Additional Parameters
18441 ///
18442 /// * *$.xgafv* (query-string) - V1 error format.
18443 /// * *access_token* (query-string) - OAuth access token.
18444 /// * *alt* (query-string) - Data format for response.
18445 /// * *callback* (query-string) - JSONP
18446 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18447 /// * *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.
18448 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18449 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18450 /// * *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.
18451 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18452 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18453 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionDeleteCall<'a, C>
18454 where
18455 T: AsRef<str>,
18456 {
18457 self._additional_params
18458 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18459 self
18460 }
18461
18462 /// Identifies the authorization scope for the method you are building.
18463 ///
18464 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18465 /// [`Scope::CloudPlatform`].
18466 ///
18467 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18468 /// tokens for more than one scope.
18469 ///
18470 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18471 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18472 /// sufficient, a read-write scope will do as well.
18473 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionDeleteCall<'a, C>
18474 where
18475 St: AsRef<str>,
18476 {
18477 self._scopes.insert(String::from(scope.as_ref()));
18478 self
18479 }
18480 /// Identifies the authorization scope(s) for the method you are building.
18481 ///
18482 /// See [`Self::add_scope()`] for details.
18483 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionDeleteCall<'a, C>
18484 where
18485 I: IntoIterator<Item = St>,
18486 St: AsRef<str>,
18487 {
18488 self._scopes
18489 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18490 self
18491 }
18492
18493 /// Removes all scopes, and no default scope will be used either.
18494 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18495 /// for details).
18496 pub fn clear_scopes(mut self) -> ProjectLocationRevisionDeleteCall<'a, C> {
18497 self._scopes.clear();
18498 self
18499 }
18500}
18501
18502/// Get information about a revision.
18503///
18504/// A builder for the *locations.revisions.get* method supported by a *project* resource.
18505/// It is not used directly, but through a [`ProjectMethods`] instance.
18506///
18507/// # Example
18508///
18509/// Instantiate a resource method builder
18510///
18511/// ```test_harness,no_run
18512/// # extern crate hyper;
18513/// # extern crate hyper_rustls;
18514/// # extern crate google_run1 as run1;
18515/// # async fn dox() {
18516/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18517///
18518/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18519/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18520/// # secret,
18521/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18522/// # ).build().await.unwrap();
18523///
18524/// # let client = hyper_util::client::legacy::Client::builder(
18525/// # hyper_util::rt::TokioExecutor::new()
18526/// # )
18527/// # .build(
18528/// # hyper_rustls::HttpsConnectorBuilder::new()
18529/// # .with_native_roots()
18530/// # .unwrap()
18531/// # .https_or_http()
18532/// # .enable_http1()
18533/// # .build()
18534/// # );
18535/// # let mut hub = CloudRun::new(client, auth);
18536/// // You can configure optional parameters by calling the respective setters at will, and
18537/// // execute the final call using `doit()`.
18538/// // Values shown here are possibly random and not representative !
18539/// let result = hub.projects().locations_revisions_get("name")
18540/// .doit().await;
18541/// # }
18542/// ```
18543pub struct ProjectLocationRevisionGetCall<'a, C>
18544where
18545 C: 'a,
18546{
18547 hub: &'a CloudRun<C>,
18548 _name: String,
18549 _delegate: Option<&'a mut dyn common::Delegate>,
18550 _additional_params: HashMap<String, String>,
18551 _scopes: BTreeSet<String>,
18552}
18553
18554impl<'a, C> common::CallBuilder for ProjectLocationRevisionGetCall<'a, C> {}
18555
18556impl<'a, C> ProjectLocationRevisionGetCall<'a, C>
18557where
18558 C: common::Connector,
18559{
18560 /// Perform the operation you have build so far.
18561 pub async fn doit(mut self) -> common::Result<(common::Response, Revision)> {
18562 use std::borrow::Cow;
18563 use std::io::{Read, Seek};
18564
18565 use common::{url::Params, ToParts};
18566 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18567
18568 let mut dd = common::DefaultDelegate;
18569 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18570 dlg.begin(common::MethodInfo {
18571 id: "run.projects.locations.revisions.get",
18572 http_method: hyper::Method::GET,
18573 });
18574
18575 for &field in ["alt", "name"].iter() {
18576 if self._additional_params.contains_key(field) {
18577 dlg.finished(false);
18578 return Err(common::Error::FieldClash(field));
18579 }
18580 }
18581
18582 let mut params = Params::with_capacity(3 + self._additional_params.len());
18583 params.push("name", self._name);
18584
18585 params.extend(self._additional_params.iter());
18586
18587 params.push("alt", "json");
18588 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18589 if self._scopes.is_empty() {
18590 self._scopes
18591 .insert(Scope::CloudPlatform.as_ref().to_string());
18592 }
18593
18594 #[allow(clippy::single_element_loop)]
18595 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18596 url = params.uri_replacement(url, param_name, find_this, true);
18597 }
18598 {
18599 let to_remove = ["name"];
18600 params.remove_params(&to_remove);
18601 }
18602
18603 let url = params.parse_with_url(&url);
18604
18605 loop {
18606 let token = match self
18607 .hub
18608 .auth
18609 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18610 .await
18611 {
18612 Ok(token) => token,
18613 Err(e) => match dlg.token(e) {
18614 Ok(token) => token,
18615 Err(e) => {
18616 dlg.finished(false);
18617 return Err(common::Error::MissingToken(e));
18618 }
18619 },
18620 };
18621 let mut req_result = {
18622 let client = &self.hub.client;
18623 dlg.pre_request();
18624 let mut req_builder = hyper::Request::builder()
18625 .method(hyper::Method::GET)
18626 .uri(url.as_str())
18627 .header(USER_AGENT, self.hub._user_agent.clone());
18628
18629 if let Some(token) = token.as_ref() {
18630 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18631 }
18632
18633 let request = req_builder
18634 .header(CONTENT_LENGTH, 0_u64)
18635 .body(common::to_body::<String>(None));
18636
18637 client.request(request.unwrap()).await
18638 };
18639
18640 match req_result {
18641 Err(err) => {
18642 if let common::Retry::After(d) = dlg.http_error(&err) {
18643 sleep(d).await;
18644 continue;
18645 }
18646 dlg.finished(false);
18647 return Err(common::Error::HttpError(err));
18648 }
18649 Ok(res) => {
18650 let (mut parts, body) = res.into_parts();
18651 let mut body = common::Body::new(body);
18652 if !parts.status.is_success() {
18653 let bytes = common::to_bytes(body).await.unwrap_or_default();
18654 let error = serde_json::from_str(&common::to_string(&bytes));
18655 let response = common::to_response(parts, bytes.into());
18656
18657 if let common::Retry::After(d) =
18658 dlg.http_failure(&response, error.as_ref().ok())
18659 {
18660 sleep(d).await;
18661 continue;
18662 }
18663
18664 dlg.finished(false);
18665
18666 return Err(match error {
18667 Ok(value) => common::Error::BadRequest(value),
18668 _ => common::Error::Failure(response),
18669 });
18670 }
18671 let response = {
18672 let bytes = common::to_bytes(body).await.unwrap_or_default();
18673 let encoded = common::to_string(&bytes);
18674 match serde_json::from_str(&encoded) {
18675 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18676 Err(error) => {
18677 dlg.response_json_decode_error(&encoded, &error);
18678 return Err(common::Error::JsonDecodeError(
18679 encoded.to_string(),
18680 error,
18681 ));
18682 }
18683 }
18684 };
18685
18686 dlg.finished(true);
18687 return Ok(response);
18688 }
18689 }
18690 }
18691 }
18692
18693 /// The name of the revision to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
18694 ///
18695 /// Sets the *name* path property to the given value.
18696 ///
18697 /// Even though the property as already been set when instantiating this call,
18698 /// we provide this method for API completeness.
18699 pub fn name(mut self, new_value: &str) -> ProjectLocationRevisionGetCall<'a, C> {
18700 self._name = new_value.to_string();
18701 self
18702 }
18703 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18704 /// while executing the actual API request.
18705 ///
18706 /// ````text
18707 /// It should be used to handle progress information, and to implement a certain level of resilience.
18708 /// ````
18709 ///
18710 /// Sets the *delegate* property to the given value.
18711 pub fn delegate(
18712 mut self,
18713 new_value: &'a mut dyn common::Delegate,
18714 ) -> ProjectLocationRevisionGetCall<'a, C> {
18715 self._delegate = Some(new_value);
18716 self
18717 }
18718
18719 /// Set any additional parameter of the query string used in the request.
18720 /// It should be used to set parameters which are not yet available through their own
18721 /// setters.
18722 ///
18723 /// Please note that this method must not be used to set any of the known parameters
18724 /// which have their own setter method. If done anyway, the request will fail.
18725 ///
18726 /// # Additional Parameters
18727 ///
18728 /// * *$.xgafv* (query-string) - V1 error format.
18729 /// * *access_token* (query-string) - OAuth access token.
18730 /// * *alt* (query-string) - Data format for response.
18731 /// * *callback* (query-string) - JSONP
18732 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18733 /// * *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.
18734 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18735 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18736 /// * *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.
18737 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18738 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18739 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionGetCall<'a, C>
18740 where
18741 T: AsRef<str>,
18742 {
18743 self._additional_params
18744 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18745 self
18746 }
18747
18748 /// Identifies the authorization scope for the method you are building.
18749 ///
18750 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18751 /// [`Scope::CloudPlatform`].
18752 ///
18753 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18754 /// tokens for more than one scope.
18755 ///
18756 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18757 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18758 /// sufficient, a read-write scope will do as well.
18759 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionGetCall<'a, C>
18760 where
18761 St: AsRef<str>,
18762 {
18763 self._scopes.insert(String::from(scope.as_ref()));
18764 self
18765 }
18766 /// Identifies the authorization scope(s) for the method you are building.
18767 ///
18768 /// See [`Self::add_scope()`] for details.
18769 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionGetCall<'a, C>
18770 where
18771 I: IntoIterator<Item = St>,
18772 St: AsRef<str>,
18773 {
18774 self._scopes
18775 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18776 self
18777 }
18778
18779 /// Removes all scopes, and no default scope will be used either.
18780 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18781 /// for details).
18782 pub fn clear_scopes(mut self) -> ProjectLocationRevisionGetCall<'a, C> {
18783 self._scopes.clear();
18784 self
18785 }
18786}
18787
18788/// List revisions. Results are sorted by creation time, descending.
18789///
18790/// A builder for the *locations.revisions.list* method supported by a *project* resource.
18791/// It is not used directly, but through a [`ProjectMethods`] instance.
18792///
18793/// # Example
18794///
18795/// Instantiate a resource method builder
18796///
18797/// ```test_harness,no_run
18798/// # extern crate hyper;
18799/// # extern crate hyper_rustls;
18800/// # extern crate google_run1 as run1;
18801/// # async fn dox() {
18802/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18803///
18804/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18806/// # secret,
18807/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18808/// # ).build().await.unwrap();
18809///
18810/// # let client = hyper_util::client::legacy::Client::builder(
18811/// # hyper_util::rt::TokioExecutor::new()
18812/// # )
18813/// # .build(
18814/// # hyper_rustls::HttpsConnectorBuilder::new()
18815/// # .with_native_roots()
18816/// # .unwrap()
18817/// # .https_or_http()
18818/// # .enable_http1()
18819/// # .build()
18820/// # );
18821/// # let mut hub = CloudRun::new(client, auth);
18822/// // You can configure optional parameters by calling the respective setters at will, and
18823/// // execute the final call using `doit()`.
18824/// // Values shown here are possibly random and not representative !
18825/// let result = hub.projects().locations_revisions_list("parent")
18826/// .watch(false)
18827/// .resource_version("dolores")
18828/// .limit(-46)
18829/// .label_selector("gubergren")
18830/// .include_uninitialized(true)
18831/// .field_selector("amet.")
18832/// .continue_("ipsum")
18833/// .doit().await;
18834/// # }
18835/// ```
18836pub struct ProjectLocationRevisionListCall<'a, C>
18837where
18838 C: 'a,
18839{
18840 hub: &'a CloudRun<C>,
18841 _parent: String,
18842 _watch: Option<bool>,
18843 _resource_version: Option<String>,
18844 _limit: Option<i32>,
18845 _label_selector: Option<String>,
18846 _include_uninitialized: Option<bool>,
18847 _field_selector: Option<String>,
18848 _continue_: Option<String>,
18849 _delegate: Option<&'a mut dyn common::Delegate>,
18850 _additional_params: HashMap<String, String>,
18851 _scopes: BTreeSet<String>,
18852}
18853
18854impl<'a, C> common::CallBuilder for ProjectLocationRevisionListCall<'a, C> {}
18855
18856impl<'a, C> ProjectLocationRevisionListCall<'a, C>
18857where
18858 C: common::Connector,
18859{
18860 /// Perform the operation you have build so far.
18861 pub async fn doit(mut self) -> common::Result<(common::Response, ListRevisionsResponse)> {
18862 use std::borrow::Cow;
18863 use std::io::{Read, Seek};
18864
18865 use common::{url::Params, ToParts};
18866 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18867
18868 let mut dd = common::DefaultDelegate;
18869 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18870 dlg.begin(common::MethodInfo {
18871 id: "run.projects.locations.revisions.list",
18872 http_method: hyper::Method::GET,
18873 });
18874
18875 for &field in [
18876 "alt",
18877 "parent",
18878 "watch",
18879 "resourceVersion",
18880 "limit",
18881 "labelSelector",
18882 "includeUninitialized",
18883 "fieldSelector",
18884 "continue",
18885 ]
18886 .iter()
18887 {
18888 if self._additional_params.contains_key(field) {
18889 dlg.finished(false);
18890 return Err(common::Error::FieldClash(field));
18891 }
18892 }
18893
18894 let mut params = Params::with_capacity(10 + self._additional_params.len());
18895 params.push("parent", self._parent);
18896 if let Some(value) = self._watch.as_ref() {
18897 params.push("watch", value.to_string());
18898 }
18899 if let Some(value) = self._resource_version.as_ref() {
18900 params.push("resourceVersion", value);
18901 }
18902 if let Some(value) = self._limit.as_ref() {
18903 params.push("limit", value.to_string());
18904 }
18905 if let Some(value) = self._label_selector.as_ref() {
18906 params.push("labelSelector", value);
18907 }
18908 if let Some(value) = self._include_uninitialized.as_ref() {
18909 params.push("includeUninitialized", value.to_string());
18910 }
18911 if let Some(value) = self._field_selector.as_ref() {
18912 params.push("fieldSelector", value);
18913 }
18914 if let Some(value) = self._continue_.as_ref() {
18915 params.push("continue", value);
18916 }
18917
18918 params.extend(self._additional_params.iter());
18919
18920 params.push("alt", "json");
18921 let mut url = self.hub._base_url.clone() + "v1/{+parent}/revisions";
18922 if self._scopes.is_empty() {
18923 self._scopes
18924 .insert(Scope::CloudPlatform.as_ref().to_string());
18925 }
18926
18927 #[allow(clippy::single_element_loop)]
18928 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18929 url = params.uri_replacement(url, param_name, find_this, true);
18930 }
18931 {
18932 let to_remove = ["parent"];
18933 params.remove_params(&to_remove);
18934 }
18935
18936 let url = params.parse_with_url(&url);
18937
18938 loop {
18939 let token = match self
18940 .hub
18941 .auth
18942 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18943 .await
18944 {
18945 Ok(token) => token,
18946 Err(e) => match dlg.token(e) {
18947 Ok(token) => token,
18948 Err(e) => {
18949 dlg.finished(false);
18950 return Err(common::Error::MissingToken(e));
18951 }
18952 },
18953 };
18954 let mut req_result = {
18955 let client = &self.hub.client;
18956 dlg.pre_request();
18957 let mut req_builder = hyper::Request::builder()
18958 .method(hyper::Method::GET)
18959 .uri(url.as_str())
18960 .header(USER_AGENT, self.hub._user_agent.clone());
18961
18962 if let Some(token) = token.as_ref() {
18963 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18964 }
18965
18966 let request = req_builder
18967 .header(CONTENT_LENGTH, 0_u64)
18968 .body(common::to_body::<String>(None));
18969
18970 client.request(request.unwrap()).await
18971 };
18972
18973 match req_result {
18974 Err(err) => {
18975 if let common::Retry::After(d) = dlg.http_error(&err) {
18976 sleep(d).await;
18977 continue;
18978 }
18979 dlg.finished(false);
18980 return Err(common::Error::HttpError(err));
18981 }
18982 Ok(res) => {
18983 let (mut parts, body) = res.into_parts();
18984 let mut body = common::Body::new(body);
18985 if !parts.status.is_success() {
18986 let bytes = common::to_bytes(body).await.unwrap_or_default();
18987 let error = serde_json::from_str(&common::to_string(&bytes));
18988 let response = common::to_response(parts, bytes.into());
18989
18990 if let common::Retry::After(d) =
18991 dlg.http_failure(&response, error.as_ref().ok())
18992 {
18993 sleep(d).await;
18994 continue;
18995 }
18996
18997 dlg.finished(false);
18998
18999 return Err(match error {
19000 Ok(value) => common::Error::BadRequest(value),
19001 _ => common::Error::Failure(response),
19002 });
19003 }
19004 let response = {
19005 let bytes = common::to_bytes(body).await.unwrap_or_default();
19006 let encoded = common::to_string(&bytes);
19007 match serde_json::from_str(&encoded) {
19008 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19009 Err(error) => {
19010 dlg.response_json_decode_error(&encoded, &error);
19011 return Err(common::Error::JsonDecodeError(
19012 encoded.to_string(),
19013 error,
19014 ));
19015 }
19016 }
19017 };
19018
19019 dlg.finished(true);
19020 return Ok(response);
19021 }
19022 }
19023 }
19024 }
19025
19026 /// The namespace from which the revisions should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
19027 ///
19028 /// Sets the *parent* path property to the given value.
19029 ///
19030 /// Even though the property as already been set when instantiating this call,
19031 /// we provide this method for API completeness.
19032 pub fn parent(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
19033 self._parent = new_value.to_string();
19034 self
19035 }
19036 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
19037 ///
19038 /// Sets the *watch* query property to the given value.
19039 pub fn watch(mut self, new_value: bool) -> ProjectLocationRevisionListCall<'a, C> {
19040 self._watch = Some(new_value);
19041 self
19042 }
19043 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
19044 ///
19045 /// Sets the *resource version* query property to the given value.
19046 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
19047 self._resource_version = Some(new_value.to_string());
19048 self
19049 }
19050 /// Optional. The maximum number of records that should be returned.
19051 ///
19052 /// Sets the *limit* query property to the given value.
19053 pub fn limit(mut self, new_value: i32) -> ProjectLocationRevisionListCall<'a, C> {
19054 self._limit = Some(new_value);
19055 self
19056 }
19057 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
19058 ///
19059 /// Sets the *label selector* query property to the given value.
19060 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
19061 self._label_selector = Some(new_value.to_string());
19062 self
19063 }
19064 /// Not currently used by Cloud Run.
19065 ///
19066 /// Sets the *include uninitialized* query property to the given value.
19067 pub fn include_uninitialized(
19068 mut self,
19069 new_value: bool,
19070 ) -> ProjectLocationRevisionListCall<'a, C> {
19071 self._include_uninitialized = Some(new_value);
19072 self
19073 }
19074 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
19075 ///
19076 /// Sets the *field selector* query property to the given value.
19077 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
19078 self._field_selector = Some(new_value.to_string());
19079 self
19080 }
19081 /// Optional. Encoded string to continue paging.
19082 ///
19083 /// Sets the *continue* query property to the given value.
19084 pub fn continue_(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
19085 self._continue_ = Some(new_value.to_string());
19086 self
19087 }
19088 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19089 /// while executing the actual API request.
19090 ///
19091 /// ````text
19092 /// It should be used to handle progress information, and to implement a certain level of resilience.
19093 /// ````
19094 ///
19095 /// Sets the *delegate* property to the given value.
19096 pub fn delegate(
19097 mut self,
19098 new_value: &'a mut dyn common::Delegate,
19099 ) -> ProjectLocationRevisionListCall<'a, C> {
19100 self._delegate = Some(new_value);
19101 self
19102 }
19103
19104 /// Set any additional parameter of the query string used in the request.
19105 /// It should be used to set parameters which are not yet available through their own
19106 /// setters.
19107 ///
19108 /// Please note that this method must not be used to set any of the known parameters
19109 /// which have their own setter method. If done anyway, the request will fail.
19110 ///
19111 /// # Additional Parameters
19112 ///
19113 /// * *$.xgafv* (query-string) - V1 error format.
19114 /// * *access_token* (query-string) - OAuth access token.
19115 /// * *alt* (query-string) - Data format for response.
19116 /// * *callback* (query-string) - JSONP
19117 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19118 /// * *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.
19119 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19120 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19121 /// * *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.
19122 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19123 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19124 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionListCall<'a, C>
19125 where
19126 T: AsRef<str>,
19127 {
19128 self._additional_params
19129 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19130 self
19131 }
19132
19133 /// Identifies the authorization scope for the method you are building.
19134 ///
19135 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19136 /// [`Scope::CloudPlatform`].
19137 ///
19138 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19139 /// tokens for more than one scope.
19140 ///
19141 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19142 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19143 /// sufficient, a read-write scope will do as well.
19144 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionListCall<'a, C>
19145 where
19146 St: AsRef<str>,
19147 {
19148 self._scopes.insert(String::from(scope.as_ref()));
19149 self
19150 }
19151 /// Identifies the authorization scope(s) for the method you are building.
19152 ///
19153 /// See [`Self::add_scope()`] for details.
19154 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionListCall<'a, C>
19155 where
19156 I: IntoIterator<Item = St>,
19157 St: AsRef<str>,
19158 {
19159 self._scopes
19160 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19161 self
19162 }
19163
19164 /// Removes all scopes, and no default scope will be used either.
19165 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19166 /// for details).
19167 pub fn clear_scopes(mut self) -> ProjectLocationRevisionListCall<'a, C> {
19168 self._scopes.clear();
19169 self
19170 }
19171}
19172
19173/// Get information about a route.
19174///
19175/// A builder for the *locations.routes.get* method supported by a *project* resource.
19176/// It is not used directly, but through a [`ProjectMethods`] instance.
19177///
19178/// # Example
19179///
19180/// Instantiate a resource method builder
19181///
19182/// ```test_harness,no_run
19183/// # extern crate hyper;
19184/// # extern crate hyper_rustls;
19185/// # extern crate google_run1 as run1;
19186/// # async fn dox() {
19187/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19188///
19189/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19190/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19191/// # secret,
19192/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19193/// # ).build().await.unwrap();
19194///
19195/// # let client = hyper_util::client::legacy::Client::builder(
19196/// # hyper_util::rt::TokioExecutor::new()
19197/// # )
19198/// # .build(
19199/// # hyper_rustls::HttpsConnectorBuilder::new()
19200/// # .with_native_roots()
19201/// # .unwrap()
19202/// # .https_or_http()
19203/// # .enable_http1()
19204/// # .build()
19205/// # );
19206/// # let mut hub = CloudRun::new(client, auth);
19207/// // You can configure optional parameters by calling the respective setters at will, and
19208/// // execute the final call using `doit()`.
19209/// // Values shown here are possibly random and not representative !
19210/// let result = hub.projects().locations_routes_get("name")
19211/// .doit().await;
19212/// # }
19213/// ```
19214pub struct ProjectLocationRouteGetCall<'a, C>
19215where
19216 C: 'a,
19217{
19218 hub: &'a CloudRun<C>,
19219 _name: String,
19220 _delegate: Option<&'a mut dyn common::Delegate>,
19221 _additional_params: HashMap<String, String>,
19222 _scopes: BTreeSet<String>,
19223}
19224
19225impl<'a, C> common::CallBuilder for ProjectLocationRouteGetCall<'a, C> {}
19226
19227impl<'a, C> ProjectLocationRouteGetCall<'a, C>
19228where
19229 C: common::Connector,
19230{
19231 /// Perform the operation you have build so far.
19232 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
19233 use std::borrow::Cow;
19234 use std::io::{Read, Seek};
19235
19236 use common::{url::Params, ToParts};
19237 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19238
19239 let mut dd = common::DefaultDelegate;
19240 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19241 dlg.begin(common::MethodInfo {
19242 id: "run.projects.locations.routes.get",
19243 http_method: hyper::Method::GET,
19244 });
19245
19246 for &field in ["alt", "name"].iter() {
19247 if self._additional_params.contains_key(field) {
19248 dlg.finished(false);
19249 return Err(common::Error::FieldClash(field));
19250 }
19251 }
19252
19253 let mut params = Params::with_capacity(3 + self._additional_params.len());
19254 params.push("name", self._name);
19255
19256 params.extend(self._additional_params.iter());
19257
19258 params.push("alt", "json");
19259 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19260 if self._scopes.is_empty() {
19261 self._scopes
19262 .insert(Scope::CloudPlatform.as_ref().to_string());
19263 }
19264
19265 #[allow(clippy::single_element_loop)]
19266 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19267 url = params.uri_replacement(url, param_name, find_this, true);
19268 }
19269 {
19270 let to_remove = ["name"];
19271 params.remove_params(&to_remove);
19272 }
19273
19274 let url = params.parse_with_url(&url);
19275
19276 loop {
19277 let token = match self
19278 .hub
19279 .auth
19280 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19281 .await
19282 {
19283 Ok(token) => token,
19284 Err(e) => match dlg.token(e) {
19285 Ok(token) => token,
19286 Err(e) => {
19287 dlg.finished(false);
19288 return Err(common::Error::MissingToken(e));
19289 }
19290 },
19291 };
19292 let mut req_result = {
19293 let client = &self.hub.client;
19294 dlg.pre_request();
19295 let mut req_builder = hyper::Request::builder()
19296 .method(hyper::Method::GET)
19297 .uri(url.as_str())
19298 .header(USER_AGENT, self.hub._user_agent.clone());
19299
19300 if let Some(token) = token.as_ref() {
19301 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19302 }
19303
19304 let request = req_builder
19305 .header(CONTENT_LENGTH, 0_u64)
19306 .body(common::to_body::<String>(None));
19307
19308 client.request(request.unwrap()).await
19309 };
19310
19311 match req_result {
19312 Err(err) => {
19313 if let common::Retry::After(d) = dlg.http_error(&err) {
19314 sleep(d).await;
19315 continue;
19316 }
19317 dlg.finished(false);
19318 return Err(common::Error::HttpError(err));
19319 }
19320 Ok(res) => {
19321 let (mut parts, body) = res.into_parts();
19322 let mut body = common::Body::new(body);
19323 if !parts.status.is_success() {
19324 let bytes = common::to_bytes(body).await.unwrap_or_default();
19325 let error = serde_json::from_str(&common::to_string(&bytes));
19326 let response = common::to_response(parts, bytes.into());
19327
19328 if let common::Retry::After(d) =
19329 dlg.http_failure(&response, error.as_ref().ok())
19330 {
19331 sleep(d).await;
19332 continue;
19333 }
19334
19335 dlg.finished(false);
19336
19337 return Err(match error {
19338 Ok(value) => common::Error::BadRequest(value),
19339 _ => common::Error::Failure(response),
19340 });
19341 }
19342 let response = {
19343 let bytes = common::to_bytes(body).await.unwrap_or_default();
19344 let encoded = common::to_string(&bytes);
19345 match serde_json::from_str(&encoded) {
19346 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19347 Err(error) => {
19348 dlg.response_json_decode_error(&encoded, &error);
19349 return Err(common::Error::JsonDecodeError(
19350 encoded.to_string(),
19351 error,
19352 ));
19353 }
19354 }
19355 };
19356
19357 dlg.finished(true);
19358 return Ok(response);
19359 }
19360 }
19361 }
19362 }
19363
19364 /// The name of the route to retrieve. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
19365 ///
19366 /// Sets the *name* path property to the given value.
19367 ///
19368 /// Even though the property as already been set when instantiating this call,
19369 /// we provide this method for API completeness.
19370 pub fn name(mut self, new_value: &str) -> ProjectLocationRouteGetCall<'a, C> {
19371 self._name = new_value.to_string();
19372 self
19373 }
19374 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19375 /// while executing the actual API request.
19376 ///
19377 /// ````text
19378 /// It should be used to handle progress information, and to implement a certain level of resilience.
19379 /// ````
19380 ///
19381 /// Sets the *delegate* property to the given value.
19382 pub fn delegate(
19383 mut self,
19384 new_value: &'a mut dyn common::Delegate,
19385 ) -> ProjectLocationRouteGetCall<'a, C> {
19386 self._delegate = Some(new_value);
19387 self
19388 }
19389
19390 /// Set any additional parameter of the query string used in the request.
19391 /// It should be used to set parameters which are not yet available through their own
19392 /// setters.
19393 ///
19394 /// Please note that this method must not be used to set any of the known parameters
19395 /// which have their own setter method. If done anyway, the request will fail.
19396 ///
19397 /// # Additional Parameters
19398 ///
19399 /// * *$.xgafv* (query-string) - V1 error format.
19400 /// * *access_token* (query-string) - OAuth access token.
19401 /// * *alt* (query-string) - Data format for response.
19402 /// * *callback* (query-string) - JSONP
19403 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19404 /// * *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.
19405 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19406 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19407 /// * *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.
19408 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19409 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19410 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRouteGetCall<'a, C>
19411 where
19412 T: AsRef<str>,
19413 {
19414 self._additional_params
19415 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19416 self
19417 }
19418
19419 /// Identifies the authorization scope for the method you are building.
19420 ///
19421 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19422 /// [`Scope::CloudPlatform`].
19423 ///
19424 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19425 /// tokens for more than one scope.
19426 ///
19427 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19428 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19429 /// sufficient, a read-write scope will do as well.
19430 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRouteGetCall<'a, C>
19431 where
19432 St: AsRef<str>,
19433 {
19434 self._scopes.insert(String::from(scope.as_ref()));
19435 self
19436 }
19437 /// Identifies the authorization scope(s) for the method you are building.
19438 ///
19439 /// See [`Self::add_scope()`] for details.
19440 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRouteGetCall<'a, C>
19441 where
19442 I: IntoIterator<Item = St>,
19443 St: AsRef<str>,
19444 {
19445 self._scopes
19446 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19447 self
19448 }
19449
19450 /// Removes all scopes, and no default scope will be used either.
19451 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19452 /// for details).
19453 pub fn clear_scopes(mut self) -> ProjectLocationRouteGetCall<'a, C> {
19454 self._scopes.clear();
19455 self
19456 }
19457}
19458
19459/// List routes. Results are sorted by creation time, descending.
19460///
19461/// A builder for the *locations.routes.list* method supported by a *project* resource.
19462/// It is not used directly, but through a [`ProjectMethods`] instance.
19463///
19464/// # Example
19465///
19466/// Instantiate a resource method builder
19467///
19468/// ```test_harness,no_run
19469/// # extern crate hyper;
19470/// # extern crate hyper_rustls;
19471/// # extern crate google_run1 as run1;
19472/// # async fn dox() {
19473/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19474///
19475/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19476/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19477/// # secret,
19478/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19479/// # ).build().await.unwrap();
19480///
19481/// # let client = hyper_util::client::legacy::Client::builder(
19482/// # hyper_util::rt::TokioExecutor::new()
19483/// # )
19484/// # .build(
19485/// # hyper_rustls::HttpsConnectorBuilder::new()
19486/// # .with_native_roots()
19487/// # .unwrap()
19488/// # .https_or_http()
19489/// # .enable_http1()
19490/// # .build()
19491/// # );
19492/// # let mut hub = CloudRun::new(client, auth);
19493/// // You can configure optional parameters by calling the respective setters at will, and
19494/// // execute the final call using `doit()`.
19495/// // Values shown here are possibly random and not representative !
19496/// let result = hub.projects().locations_routes_list("parent")
19497/// .watch(true)
19498/// .resource_version("sadipscing")
19499/// .limit(-27)
19500/// .label_selector("sit")
19501/// .include_uninitialized(true)
19502/// .field_selector("magna")
19503/// .continue_("et")
19504/// .doit().await;
19505/// # }
19506/// ```
19507pub struct ProjectLocationRouteListCall<'a, C>
19508where
19509 C: 'a,
19510{
19511 hub: &'a CloudRun<C>,
19512 _parent: String,
19513 _watch: Option<bool>,
19514 _resource_version: Option<String>,
19515 _limit: Option<i32>,
19516 _label_selector: Option<String>,
19517 _include_uninitialized: Option<bool>,
19518 _field_selector: Option<String>,
19519 _continue_: Option<String>,
19520 _delegate: Option<&'a mut dyn common::Delegate>,
19521 _additional_params: HashMap<String, String>,
19522 _scopes: BTreeSet<String>,
19523}
19524
19525impl<'a, C> common::CallBuilder for ProjectLocationRouteListCall<'a, C> {}
19526
19527impl<'a, C> ProjectLocationRouteListCall<'a, C>
19528where
19529 C: common::Connector,
19530{
19531 /// Perform the operation you have build so far.
19532 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
19533 use std::borrow::Cow;
19534 use std::io::{Read, Seek};
19535
19536 use common::{url::Params, ToParts};
19537 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19538
19539 let mut dd = common::DefaultDelegate;
19540 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19541 dlg.begin(common::MethodInfo {
19542 id: "run.projects.locations.routes.list",
19543 http_method: hyper::Method::GET,
19544 });
19545
19546 for &field in [
19547 "alt",
19548 "parent",
19549 "watch",
19550 "resourceVersion",
19551 "limit",
19552 "labelSelector",
19553 "includeUninitialized",
19554 "fieldSelector",
19555 "continue",
19556 ]
19557 .iter()
19558 {
19559 if self._additional_params.contains_key(field) {
19560 dlg.finished(false);
19561 return Err(common::Error::FieldClash(field));
19562 }
19563 }
19564
19565 let mut params = Params::with_capacity(10 + self._additional_params.len());
19566 params.push("parent", self._parent);
19567 if let Some(value) = self._watch.as_ref() {
19568 params.push("watch", value.to_string());
19569 }
19570 if let Some(value) = self._resource_version.as_ref() {
19571 params.push("resourceVersion", value);
19572 }
19573 if let Some(value) = self._limit.as_ref() {
19574 params.push("limit", value.to_string());
19575 }
19576 if let Some(value) = self._label_selector.as_ref() {
19577 params.push("labelSelector", value);
19578 }
19579 if let Some(value) = self._include_uninitialized.as_ref() {
19580 params.push("includeUninitialized", value.to_string());
19581 }
19582 if let Some(value) = self._field_selector.as_ref() {
19583 params.push("fieldSelector", value);
19584 }
19585 if let Some(value) = self._continue_.as_ref() {
19586 params.push("continue", value);
19587 }
19588
19589 params.extend(self._additional_params.iter());
19590
19591 params.push("alt", "json");
19592 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
19593 if self._scopes.is_empty() {
19594 self._scopes
19595 .insert(Scope::CloudPlatform.as_ref().to_string());
19596 }
19597
19598 #[allow(clippy::single_element_loop)]
19599 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19600 url = params.uri_replacement(url, param_name, find_this, true);
19601 }
19602 {
19603 let to_remove = ["parent"];
19604 params.remove_params(&to_remove);
19605 }
19606
19607 let url = params.parse_with_url(&url);
19608
19609 loop {
19610 let token = match self
19611 .hub
19612 .auth
19613 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19614 .await
19615 {
19616 Ok(token) => token,
19617 Err(e) => match dlg.token(e) {
19618 Ok(token) => token,
19619 Err(e) => {
19620 dlg.finished(false);
19621 return Err(common::Error::MissingToken(e));
19622 }
19623 },
19624 };
19625 let mut req_result = {
19626 let client = &self.hub.client;
19627 dlg.pre_request();
19628 let mut req_builder = hyper::Request::builder()
19629 .method(hyper::Method::GET)
19630 .uri(url.as_str())
19631 .header(USER_AGENT, self.hub._user_agent.clone());
19632
19633 if let Some(token) = token.as_ref() {
19634 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19635 }
19636
19637 let request = req_builder
19638 .header(CONTENT_LENGTH, 0_u64)
19639 .body(common::to_body::<String>(None));
19640
19641 client.request(request.unwrap()).await
19642 };
19643
19644 match req_result {
19645 Err(err) => {
19646 if let common::Retry::After(d) = dlg.http_error(&err) {
19647 sleep(d).await;
19648 continue;
19649 }
19650 dlg.finished(false);
19651 return Err(common::Error::HttpError(err));
19652 }
19653 Ok(res) => {
19654 let (mut parts, body) = res.into_parts();
19655 let mut body = common::Body::new(body);
19656 if !parts.status.is_success() {
19657 let bytes = common::to_bytes(body).await.unwrap_or_default();
19658 let error = serde_json::from_str(&common::to_string(&bytes));
19659 let response = common::to_response(parts, bytes.into());
19660
19661 if let common::Retry::After(d) =
19662 dlg.http_failure(&response, error.as_ref().ok())
19663 {
19664 sleep(d).await;
19665 continue;
19666 }
19667
19668 dlg.finished(false);
19669
19670 return Err(match error {
19671 Ok(value) => common::Error::BadRequest(value),
19672 _ => common::Error::Failure(response),
19673 });
19674 }
19675 let response = {
19676 let bytes = common::to_bytes(body).await.unwrap_or_default();
19677 let encoded = common::to_string(&bytes);
19678 match serde_json::from_str(&encoded) {
19679 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19680 Err(error) => {
19681 dlg.response_json_decode_error(&encoded, &error);
19682 return Err(common::Error::JsonDecodeError(
19683 encoded.to_string(),
19684 error,
19685 ));
19686 }
19687 }
19688 };
19689
19690 dlg.finished(true);
19691 return Ok(response);
19692 }
19693 }
19694 }
19695 }
19696
19697 /// The namespace from which the routes should be listed. For Cloud Run (fully managed), replace {namespace} with the project ID or number. It takes the form namespaces/{namespace}. For example: namespaces/PROJECT_ID
19698 ///
19699 /// Sets the *parent* path property to the given value.
19700 ///
19701 /// Even though the property as already been set when instantiating this call,
19702 /// we provide this method for API completeness.
19703 pub fn parent(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
19704 self._parent = new_value.to_string();
19705 self
19706 }
19707 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
19708 ///
19709 /// Sets the *watch* query property to the given value.
19710 pub fn watch(mut self, new_value: bool) -> ProjectLocationRouteListCall<'a, C> {
19711 self._watch = Some(new_value);
19712 self
19713 }
19714 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
19715 ///
19716 /// Sets the *resource version* query property to the given value.
19717 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
19718 self._resource_version = Some(new_value.to_string());
19719 self
19720 }
19721 /// Optional. The maximum number of records that should be returned.
19722 ///
19723 /// Sets the *limit* query property to the given value.
19724 pub fn limit(mut self, new_value: i32) -> ProjectLocationRouteListCall<'a, C> {
19725 self._limit = Some(new_value);
19726 self
19727 }
19728 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
19729 ///
19730 /// Sets the *label selector* query property to the given value.
19731 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
19732 self._label_selector = Some(new_value.to_string());
19733 self
19734 }
19735 /// Not currently used by Cloud Run.
19736 ///
19737 /// Sets the *include uninitialized* query property to the given value.
19738 pub fn include_uninitialized(mut self, new_value: bool) -> ProjectLocationRouteListCall<'a, C> {
19739 self._include_uninitialized = Some(new_value);
19740 self
19741 }
19742 /// Allows to filter resources based on a specific value for a field name. Send this in a query string format. i.e. 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
19743 ///
19744 /// Sets the *field selector* query property to the given value.
19745 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
19746 self._field_selector = Some(new_value.to_string());
19747 self
19748 }
19749 /// Optional. Encoded string to continue paging.
19750 ///
19751 /// Sets the *continue* query property to the given value.
19752 pub fn continue_(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
19753 self._continue_ = Some(new_value.to_string());
19754 self
19755 }
19756 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19757 /// while executing the actual API request.
19758 ///
19759 /// ````text
19760 /// It should be used to handle progress information, and to implement a certain level of resilience.
19761 /// ````
19762 ///
19763 /// Sets the *delegate* property to the given value.
19764 pub fn delegate(
19765 mut self,
19766 new_value: &'a mut dyn common::Delegate,
19767 ) -> ProjectLocationRouteListCall<'a, C> {
19768 self._delegate = Some(new_value);
19769 self
19770 }
19771
19772 /// Set any additional parameter of the query string used in the request.
19773 /// It should be used to set parameters which are not yet available through their own
19774 /// setters.
19775 ///
19776 /// Please note that this method must not be used to set any of the known parameters
19777 /// which have their own setter method. If done anyway, the request will fail.
19778 ///
19779 /// # Additional Parameters
19780 ///
19781 /// * *$.xgafv* (query-string) - V1 error format.
19782 /// * *access_token* (query-string) - OAuth access token.
19783 /// * *alt* (query-string) - Data format for response.
19784 /// * *callback* (query-string) - JSONP
19785 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19786 /// * *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.
19787 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19788 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19789 /// * *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.
19790 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19791 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19792 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRouteListCall<'a, C>
19793 where
19794 T: AsRef<str>,
19795 {
19796 self._additional_params
19797 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19798 self
19799 }
19800
19801 /// Identifies the authorization scope for the method you are building.
19802 ///
19803 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19804 /// [`Scope::CloudPlatform`].
19805 ///
19806 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19807 /// tokens for more than one scope.
19808 ///
19809 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19810 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19811 /// sufficient, a read-write scope will do as well.
19812 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRouteListCall<'a, C>
19813 where
19814 St: AsRef<str>,
19815 {
19816 self._scopes.insert(String::from(scope.as_ref()));
19817 self
19818 }
19819 /// Identifies the authorization scope(s) for the method you are building.
19820 ///
19821 /// See [`Self::add_scope()`] for details.
19822 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRouteListCall<'a, C>
19823 where
19824 I: IntoIterator<Item = St>,
19825 St: AsRef<str>,
19826 {
19827 self._scopes
19828 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19829 self
19830 }
19831
19832 /// Removes all scopes, and no default scope will be used either.
19833 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19834 /// for details).
19835 pub fn clear_scopes(mut self) -> ProjectLocationRouteListCall<'a, C> {
19836 self._scopes.clear();
19837 self
19838 }
19839}
19840
19841/// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
19842///
19843/// A builder for the *locations.services.create* method supported by a *project* resource.
19844/// It is not used directly, but through a [`ProjectMethods`] instance.
19845///
19846/// # Example
19847///
19848/// Instantiate a resource method builder
19849///
19850/// ```test_harness,no_run
19851/// # extern crate hyper;
19852/// # extern crate hyper_rustls;
19853/// # extern crate google_run1 as run1;
19854/// use run1::api::Service;
19855/// # async fn dox() {
19856/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19857///
19858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19860/// # secret,
19861/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19862/// # ).build().await.unwrap();
19863///
19864/// # let client = hyper_util::client::legacy::Client::builder(
19865/// # hyper_util::rt::TokioExecutor::new()
19866/// # )
19867/// # .build(
19868/// # hyper_rustls::HttpsConnectorBuilder::new()
19869/// # .with_native_roots()
19870/// # .unwrap()
19871/// # .https_or_http()
19872/// # .enable_http1()
19873/// # .build()
19874/// # );
19875/// # let mut hub = CloudRun::new(client, auth);
19876/// // As the method needs a request, you would usually fill it with the desired information
19877/// // into the respective structure. Some of the parts shown here might not be applicable !
19878/// // Values shown here are possibly random and not representative !
19879/// let mut req = Service::default();
19880///
19881/// // You can configure optional parameters by calling the respective setters at will, and
19882/// // execute the final call using `doit()`.
19883/// // Values shown here are possibly random and not representative !
19884/// let result = hub.projects().locations_services_create(req, "parent")
19885/// .dry_run("dolor")
19886/// .doit().await;
19887/// # }
19888/// ```
19889pub struct ProjectLocationServiceCreateCall<'a, C>
19890where
19891 C: 'a,
19892{
19893 hub: &'a CloudRun<C>,
19894 _request: Service,
19895 _parent: String,
19896 _dry_run: Option<String>,
19897 _delegate: Option<&'a mut dyn common::Delegate>,
19898 _additional_params: HashMap<String, String>,
19899 _scopes: BTreeSet<String>,
19900}
19901
19902impl<'a, C> common::CallBuilder for ProjectLocationServiceCreateCall<'a, C> {}
19903
19904impl<'a, C> ProjectLocationServiceCreateCall<'a, C>
19905where
19906 C: common::Connector,
19907{
19908 /// Perform the operation you have build so far.
19909 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
19910 use std::borrow::Cow;
19911 use std::io::{Read, Seek};
19912
19913 use common::{url::Params, ToParts};
19914 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19915
19916 let mut dd = common::DefaultDelegate;
19917 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19918 dlg.begin(common::MethodInfo {
19919 id: "run.projects.locations.services.create",
19920 http_method: hyper::Method::POST,
19921 });
19922
19923 for &field in ["alt", "parent", "dryRun"].iter() {
19924 if self._additional_params.contains_key(field) {
19925 dlg.finished(false);
19926 return Err(common::Error::FieldClash(field));
19927 }
19928 }
19929
19930 let mut params = Params::with_capacity(5 + self._additional_params.len());
19931 params.push("parent", self._parent);
19932 if let Some(value) = self._dry_run.as_ref() {
19933 params.push("dryRun", value);
19934 }
19935
19936 params.extend(self._additional_params.iter());
19937
19938 params.push("alt", "json");
19939 let mut url = self.hub._base_url.clone() + "v1/{+parent}/services";
19940 if self._scopes.is_empty() {
19941 self._scopes
19942 .insert(Scope::CloudPlatform.as_ref().to_string());
19943 }
19944
19945 #[allow(clippy::single_element_loop)]
19946 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19947 url = params.uri_replacement(url, param_name, find_this, true);
19948 }
19949 {
19950 let to_remove = ["parent"];
19951 params.remove_params(&to_remove);
19952 }
19953
19954 let url = params.parse_with_url(&url);
19955
19956 let mut json_mime_type = mime::APPLICATION_JSON;
19957 let mut request_value_reader = {
19958 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19959 common::remove_json_null_values(&mut value);
19960 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19961 serde_json::to_writer(&mut dst, &value).unwrap();
19962 dst
19963 };
19964 let request_size = request_value_reader
19965 .seek(std::io::SeekFrom::End(0))
19966 .unwrap();
19967 request_value_reader
19968 .seek(std::io::SeekFrom::Start(0))
19969 .unwrap();
19970
19971 loop {
19972 let token = match self
19973 .hub
19974 .auth
19975 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19976 .await
19977 {
19978 Ok(token) => token,
19979 Err(e) => match dlg.token(e) {
19980 Ok(token) => token,
19981 Err(e) => {
19982 dlg.finished(false);
19983 return Err(common::Error::MissingToken(e));
19984 }
19985 },
19986 };
19987 request_value_reader
19988 .seek(std::io::SeekFrom::Start(0))
19989 .unwrap();
19990 let mut req_result = {
19991 let client = &self.hub.client;
19992 dlg.pre_request();
19993 let mut req_builder = hyper::Request::builder()
19994 .method(hyper::Method::POST)
19995 .uri(url.as_str())
19996 .header(USER_AGENT, self.hub._user_agent.clone());
19997
19998 if let Some(token) = token.as_ref() {
19999 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20000 }
20001
20002 let request = req_builder
20003 .header(CONTENT_TYPE, json_mime_type.to_string())
20004 .header(CONTENT_LENGTH, request_size as u64)
20005 .body(common::to_body(
20006 request_value_reader.get_ref().clone().into(),
20007 ));
20008
20009 client.request(request.unwrap()).await
20010 };
20011
20012 match req_result {
20013 Err(err) => {
20014 if let common::Retry::After(d) = dlg.http_error(&err) {
20015 sleep(d).await;
20016 continue;
20017 }
20018 dlg.finished(false);
20019 return Err(common::Error::HttpError(err));
20020 }
20021 Ok(res) => {
20022 let (mut parts, body) = res.into_parts();
20023 let mut body = common::Body::new(body);
20024 if !parts.status.is_success() {
20025 let bytes = common::to_bytes(body).await.unwrap_or_default();
20026 let error = serde_json::from_str(&common::to_string(&bytes));
20027 let response = common::to_response(parts, bytes.into());
20028
20029 if let common::Retry::After(d) =
20030 dlg.http_failure(&response, error.as_ref().ok())
20031 {
20032 sleep(d).await;
20033 continue;
20034 }
20035
20036 dlg.finished(false);
20037
20038 return Err(match error {
20039 Ok(value) => common::Error::BadRequest(value),
20040 _ => common::Error::Failure(response),
20041 });
20042 }
20043 let response = {
20044 let bytes = common::to_bytes(body).await.unwrap_or_default();
20045 let encoded = common::to_string(&bytes);
20046 match serde_json::from_str(&encoded) {
20047 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20048 Err(error) => {
20049 dlg.response_json_decode_error(&encoded, &error);
20050 return Err(common::Error::JsonDecodeError(
20051 encoded.to_string(),
20052 error,
20053 ));
20054 }
20055 }
20056 };
20057
20058 dlg.finished(true);
20059 return Ok(response);
20060 }
20061 }
20062 }
20063 }
20064
20065 ///
20066 /// Sets the *request* property to the given value.
20067 ///
20068 /// Even though the property as already been set when instantiating this call,
20069 /// we provide this method for API completeness.
20070 pub fn request(mut self, new_value: Service) -> ProjectLocationServiceCreateCall<'a, C> {
20071 self._request = new_value;
20072 self
20073 }
20074 /// Required. The resource's parent. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
20075 ///
20076 /// Sets the *parent* path property to the given value.
20077 ///
20078 /// Even though the property as already been set when instantiating this call,
20079 /// we provide this method for API completeness.
20080 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
20081 self._parent = new_value.to_string();
20082 self
20083 }
20084 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
20085 ///
20086 /// Sets the *dry run* query property to the given value.
20087 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
20088 self._dry_run = Some(new_value.to_string());
20089 self
20090 }
20091 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20092 /// while executing the actual API request.
20093 ///
20094 /// ````text
20095 /// It should be used to handle progress information, and to implement a certain level of resilience.
20096 /// ````
20097 ///
20098 /// Sets the *delegate* property to the given value.
20099 pub fn delegate(
20100 mut self,
20101 new_value: &'a mut dyn common::Delegate,
20102 ) -> ProjectLocationServiceCreateCall<'a, C> {
20103 self._delegate = Some(new_value);
20104 self
20105 }
20106
20107 /// Set any additional parameter of the query string used in the request.
20108 /// It should be used to set parameters which are not yet available through their own
20109 /// setters.
20110 ///
20111 /// Please note that this method must not be used to set any of the known parameters
20112 /// which have their own setter method. If done anyway, the request will fail.
20113 ///
20114 /// # Additional Parameters
20115 ///
20116 /// * *$.xgafv* (query-string) - V1 error format.
20117 /// * *access_token* (query-string) - OAuth access token.
20118 /// * *alt* (query-string) - Data format for response.
20119 /// * *callback* (query-string) - JSONP
20120 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20121 /// * *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.
20122 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20123 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20124 /// * *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.
20125 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20126 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20127 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceCreateCall<'a, C>
20128 where
20129 T: AsRef<str>,
20130 {
20131 self._additional_params
20132 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20133 self
20134 }
20135
20136 /// Identifies the authorization scope for the method you are building.
20137 ///
20138 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20139 /// [`Scope::CloudPlatform`].
20140 ///
20141 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20142 /// tokens for more than one scope.
20143 ///
20144 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20145 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20146 /// sufficient, a read-write scope will do as well.
20147 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCreateCall<'a, C>
20148 where
20149 St: AsRef<str>,
20150 {
20151 self._scopes.insert(String::from(scope.as_ref()));
20152 self
20153 }
20154 /// Identifies the authorization scope(s) for the method you are building.
20155 ///
20156 /// See [`Self::add_scope()`] for details.
20157 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceCreateCall<'a, C>
20158 where
20159 I: IntoIterator<Item = St>,
20160 St: AsRef<str>,
20161 {
20162 self._scopes
20163 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20164 self
20165 }
20166
20167 /// Removes all scopes, and no default scope will be used either.
20168 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20169 /// for details).
20170 pub fn clear_scopes(mut self) -> ProjectLocationServiceCreateCall<'a, C> {
20171 self._scopes.clear();
20172 self
20173 }
20174}
20175
20176/// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
20177///
20178/// A builder for the *locations.services.delete* method supported by a *project* resource.
20179/// It is not used directly, but through a [`ProjectMethods`] instance.
20180///
20181/// # Example
20182///
20183/// Instantiate a resource method builder
20184///
20185/// ```test_harness,no_run
20186/// # extern crate hyper;
20187/// # extern crate hyper_rustls;
20188/// # extern crate google_run1 as run1;
20189/// # async fn dox() {
20190/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20191///
20192/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20193/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20194/// # secret,
20195/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20196/// # ).build().await.unwrap();
20197///
20198/// # let client = hyper_util::client::legacy::Client::builder(
20199/// # hyper_util::rt::TokioExecutor::new()
20200/// # )
20201/// # .build(
20202/// # hyper_rustls::HttpsConnectorBuilder::new()
20203/// # .with_native_roots()
20204/// # .unwrap()
20205/// # .https_or_http()
20206/// # .enable_http1()
20207/// # .build()
20208/// # );
20209/// # let mut hub = CloudRun::new(client, auth);
20210/// // You can configure optional parameters by calling the respective setters at will, and
20211/// // execute the final call using `doit()`.
20212/// // Values shown here are possibly random and not representative !
20213/// let result = hub.projects().locations_services_delete("name")
20214/// .propagation_policy("justo")
20215/// .kind("amet.")
20216/// .dry_run("no")
20217/// .api_version("nonumy")
20218/// .doit().await;
20219/// # }
20220/// ```
20221pub struct ProjectLocationServiceDeleteCall<'a, C>
20222where
20223 C: 'a,
20224{
20225 hub: &'a CloudRun<C>,
20226 _name: String,
20227 _propagation_policy: Option<String>,
20228 _kind: Option<String>,
20229 _dry_run: Option<String>,
20230 _api_version: Option<String>,
20231 _delegate: Option<&'a mut dyn common::Delegate>,
20232 _additional_params: HashMap<String, String>,
20233 _scopes: BTreeSet<String>,
20234}
20235
20236impl<'a, C> common::CallBuilder for ProjectLocationServiceDeleteCall<'a, C> {}
20237
20238impl<'a, C> ProjectLocationServiceDeleteCall<'a, C>
20239where
20240 C: common::Connector,
20241{
20242 /// Perform the operation you have build so far.
20243 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
20244 use std::borrow::Cow;
20245 use std::io::{Read, Seek};
20246
20247 use common::{url::Params, ToParts};
20248 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20249
20250 let mut dd = common::DefaultDelegate;
20251 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20252 dlg.begin(common::MethodInfo {
20253 id: "run.projects.locations.services.delete",
20254 http_method: hyper::Method::DELETE,
20255 });
20256
20257 for &field in [
20258 "alt",
20259 "name",
20260 "propagationPolicy",
20261 "kind",
20262 "dryRun",
20263 "apiVersion",
20264 ]
20265 .iter()
20266 {
20267 if self._additional_params.contains_key(field) {
20268 dlg.finished(false);
20269 return Err(common::Error::FieldClash(field));
20270 }
20271 }
20272
20273 let mut params = Params::with_capacity(7 + self._additional_params.len());
20274 params.push("name", self._name);
20275 if let Some(value) = self._propagation_policy.as_ref() {
20276 params.push("propagationPolicy", value);
20277 }
20278 if let Some(value) = self._kind.as_ref() {
20279 params.push("kind", value);
20280 }
20281 if let Some(value) = self._dry_run.as_ref() {
20282 params.push("dryRun", value);
20283 }
20284 if let Some(value) = self._api_version.as_ref() {
20285 params.push("apiVersion", value);
20286 }
20287
20288 params.extend(self._additional_params.iter());
20289
20290 params.push("alt", "json");
20291 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20292 if self._scopes.is_empty() {
20293 self._scopes
20294 .insert(Scope::CloudPlatform.as_ref().to_string());
20295 }
20296
20297 #[allow(clippy::single_element_loop)]
20298 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20299 url = params.uri_replacement(url, param_name, find_this, true);
20300 }
20301 {
20302 let to_remove = ["name"];
20303 params.remove_params(&to_remove);
20304 }
20305
20306 let url = params.parse_with_url(&url);
20307
20308 loop {
20309 let token = match self
20310 .hub
20311 .auth
20312 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20313 .await
20314 {
20315 Ok(token) => token,
20316 Err(e) => match dlg.token(e) {
20317 Ok(token) => token,
20318 Err(e) => {
20319 dlg.finished(false);
20320 return Err(common::Error::MissingToken(e));
20321 }
20322 },
20323 };
20324 let mut req_result = {
20325 let client = &self.hub.client;
20326 dlg.pre_request();
20327 let mut req_builder = hyper::Request::builder()
20328 .method(hyper::Method::DELETE)
20329 .uri(url.as_str())
20330 .header(USER_AGENT, self.hub._user_agent.clone());
20331
20332 if let Some(token) = token.as_ref() {
20333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20334 }
20335
20336 let request = req_builder
20337 .header(CONTENT_LENGTH, 0_u64)
20338 .body(common::to_body::<String>(None));
20339
20340 client.request(request.unwrap()).await
20341 };
20342
20343 match req_result {
20344 Err(err) => {
20345 if let common::Retry::After(d) = dlg.http_error(&err) {
20346 sleep(d).await;
20347 continue;
20348 }
20349 dlg.finished(false);
20350 return Err(common::Error::HttpError(err));
20351 }
20352 Ok(res) => {
20353 let (mut parts, body) = res.into_parts();
20354 let mut body = common::Body::new(body);
20355 if !parts.status.is_success() {
20356 let bytes = common::to_bytes(body).await.unwrap_or_default();
20357 let error = serde_json::from_str(&common::to_string(&bytes));
20358 let response = common::to_response(parts, bytes.into());
20359
20360 if let common::Retry::After(d) =
20361 dlg.http_failure(&response, error.as_ref().ok())
20362 {
20363 sleep(d).await;
20364 continue;
20365 }
20366
20367 dlg.finished(false);
20368
20369 return Err(match error {
20370 Ok(value) => common::Error::BadRequest(value),
20371 _ => common::Error::Failure(response),
20372 });
20373 }
20374 let response = {
20375 let bytes = common::to_bytes(body).await.unwrap_or_default();
20376 let encoded = common::to_string(&bytes);
20377 match serde_json::from_str(&encoded) {
20378 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20379 Err(error) => {
20380 dlg.response_json_decode_error(&encoded, &error);
20381 return Err(common::Error::JsonDecodeError(
20382 encoded.to_string(),
20383 error,
20384 ));
20385 }
20386 }
20387 };
20388
20389 dlg.finished(true);
20390 return Ok(response);
20391 }
20392 }
20393 }
20394 }
20395
20396 /// Required. The fully qualified name of the service to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
20397 ///
20398 /// Sets the *name* path property to the given value.
20399 ///
20400 /// Even though the property as already been set when instantiating this call,
20401 /// we provide this method for API completeness.
20402 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
20403 self._name = new_value.to_string();
20404 self
20405 }
20406 /// Not supported, and ignored by Cloud Run.
20407 ///
20408 /// Sets the *propagation policy* query property to the given value.
20409 pub fn propagation_policy(
20410 mut self,
20411 new_value: &str,
20412 ) -> ProjectLocationServiceDeleteCall<'a, C> {
20413 self._propagation_policy = Some(new_value.to_string());
20414 self
20415 }
20416 /// Not supported, and ignored by Cloud Run.
20417 ///
20418 /// Sets the *kind* query property to the given value.
20419 pub fn kind(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
20420 self._kind = Some(new_value.to_string());
20421 self
20422 }
20423 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
20424 ///
20425 /// Sets the *dry run* query property to the given value.
20426 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
20427 self._dry_run = Some(new_value.to_string());
20428 self
20429 }
20430 /// Not supported, and ignored by Cloud Run.
20431 ///
20432 /// Sets the *api version* query property to the given value.
20433 pub fn api_version(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
20434 self._api_version = Some(new_value.to_string());
20435 self
20436 }
20437 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20438 /// while executing the actual API request.
20439 ///
20440 /// ````text
20441 /// It should be used to handle progress information, and to implement a certain level of resilience.
20442 /// ````
20443 ///
20444 /// Sets the *delegate* property to the given value.
20445 pub fn delegate(
20446 mut self,
20447 new_value: &'a mut dyn common::Delegate,
20448 ) -> ProjectLocationServiceDeleteCall<'a, C> {
20449 self._delegate = Some(new_value);
20450 self
20451 }
20452
20453 /// Set any additional parameter of the query string used in the request.
20454 /// It should be used to set parameters which are not yet available through their own
20455 /// setters.
20456 ///
20457 /// Please note that this method must not be used to set any of the known parameters
20458 /// which have their own setter method. If done anyway, the request will fail.
20459 ///
20460 /// # Additional Parameters
20461 ///
20462 /// * *$.xgafv* (query-string) - V1 error format.
20463 /// * *access_token* (query-string) - OAuth access token.
20464 /// * *alt* (query-string) - Data format for response.
20465 /// * *callback* (query-string) - JSONP
20466 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20467 /// * *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.
20468 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20469 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20470 /// * *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.
20471 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20472 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20473 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceDeleteCall<'a, C>
20474 where
20475 T: AsRef<str>,
20476 {
20477 self._additional_params
20478 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20479 self
20480 }
20481
20482 /// Identifies the authorization scope for the method you are building.
20483 ///
20484 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20485 /// [`Scope::CloudPlatform`].
20486 ///
20487 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20488 /// tokens for more than one scope.
20489 ///
20490 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20491 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20492 /// sufficient, a read-write scope will do as well.
20493 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceDeleteCall<'a, C>
20494 where
20495 St: AsRef<str>,
20496 {
20497 self._scopes.insert(String::from(scope.as_ref()));
20498 self
20499 }
20500 /// Identifies the authorization scope(s) for the method you are building.
20501 ///
20502 /// See [`Self::add_scope()`] for details.
20503 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceDeleteCall<'a, C>
20504 where
20505 I: IntoIterator<Item = St>,
20506 St: AsRef<str>,
20507 {
20508 self._scopes
20509 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20510 self
20511 }
20512
20513 /// Removes all scopes, and no default scope will be used either.
20514 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20515 /// for details).
20516 pub fn clear_scopes(mut self) -> ProjectLocationServiceDeleteCall<'a, C> {
20517 self._scopes.clear();
20518 self
20519 }
20520}
20521
20522/// Gets information about a service.
20523///
20524/// A builder for the *locations.services.get* method supported by a *project* resource.
20525/// It is not used directly, but through a [`ProjectMethods`] instance.
20526///
20527/// # Example
20528///
20529/// Instantiate a resource method builder
20530///
20531/// ```test_harness,no_run
20532/// # extern crate hyper;
20533/// # extern crate hyper_rustls;
20534/// # extern crate google_run1 as run1;
20535/// # async fn dox() {
20536/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20537///
20538/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20540/// # secret,
20541/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20542/// # ).build().await.unwrap();
20543///
20544/// # let client = hyper_util::client::legacy::Client::builder(
20545/// # hyper_util::rt::TokioExecutor::new()
20546/// # )
20547/// # .build(
20548/// # hyper_rustls::HttpsConnectorBuilder::new()
20549/// # .with_native_roots()
20550/// # .unwrap()
20551/// # .https_or_http()
20552/// # .enable_http1()
20553/// # .build()
20554/// # );
20555/// # let mut hub = CloudRun::new(client, auth);
20556/// // You can configure optional parameters by calling the respective setters at will, and
20557/// // execute the final call using `doit()`.
20558/// // Values shown here are possibly random and not representative !
20559/// let result = hub.projects().locations_services_get("name")
20560/// .doit().await;
20561/// # }
20562/// ```
20563pub struct ProjectLocationServiceGetCall<'a, C>
20564where
20565 C: 'a,
20566{
20567 hub: &'a CloudRun<C>,
20568 _name: String,
20569 _delegate: Option<&'a mut dyn common::Delegate>,
20570 _additional_params: HashMap<String, String>,
20571 _scopes: BTreeSet<String>,
20572}
20573
20574impl<'a, C> common::CallBuilder for ProjectLocationServiceGetCall<'a, C> {}
20575
20576impl<'a, C> ProjectLocationServiceGetCall<'a, C>
20577where
20578 C: common::Connector,
20579{
20580 /// Perform the operation you have build so far.
20581 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
20582 use std::borrow::Cow;
20583 use std::io::{Read, Seek};
20584
20585 use common::{url::Params, ToParts};
20586 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20587
20588 let mut dd = common::DefaultDelegate;
20589 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20590 dlg.begin(common::MethodInfo {
20591 id: "run.projects.locations.services.get",
20592 http_method: hyper::Method::GET,
20593 });
20594
20595 for &field in ["alt", "name"].iter() {
20596 if self._additional_params.contains_key(field) {
20597 dlg.finished(false);
20598 return Err(common::Error::FieldClash(field));
20599 }
20600 }
20601
20602 let mut params = Params::with_capacity(3 + self._additional_params.len());
20603 params.push("name", self._name);
20604
20605 params.extend(self._additional_params.iter());
20606
20607 params.push("alt", "json");
20608 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20609 if self._scopes.is_empty() {
20610 self._scopes
20611 .insert(Scope::CloudPlatform.as_ref().to_string());
20612 }
20613
20614 #[allow(clippy::single_element_loop)]
20615 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20616 url = params.uri_replacement(url, param_name, find_this, true);
20617 }
20618 {
20619 let to_remove = ["name"];
20620 params.remove_params(&to_remove);
20621 }
20622
20623 let url = params.parse_with_url(&url);
20624
20625 loop {
20626 let token = match self
20627 .hub
20628 .auth
20629 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20630 .await
20631 {
20632 Ok(token) => token,
20633 Err(e) => match dlg.token(e) {
20634 Ok(token) => token,
20635 Err(e) => {
20636 dlg.finished(false);
20637 return Err(common::Error::MissingToken(e));
20638 }
20639 },
20640 };
20641 let mut req_result = {
20642 let client = &self.hub.client;
20643 dlg.pre_request();
20644 let mut req_builder = hyper::Request::builder()
20645 .method(hyper::Method::GET)
20646 .uri(url.as_str())
20647 .header(USER_AGENT, self.hub._user_agent.clone());
20648
20649 if let Some(token) = token.as_ref() {
20650 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20651 }
20652
20653 let request = req_builder
20654 .header(CONTENT_LENGTH, 0_u64)
20655 .body(common::to_body::<String>(None));
20656
20657 client.request(request.unwrap()).await
20658 };
20659
20660 match req_result {
20661 Err(err) => {
20662 if let common::Retry::After(d) = dlg.http_error(&err) {
20663 sleep(d).await;
20664 continue;
20665 }
20666 dlg.finished(false);
20667 return Err(common::Error::HttpError(err));
20668 }
20669 Ok(res) => {
20670 let (mut parts, body) = res.into_parts();
20671 let mut body = common::Body::new(body);
20672 if !parts.status.is_success() {
20673 let bytes = common::to_bytes(body).await.unwrap_or_default();
20674 let error = serde_json::from_str(&common::to_string(&bytes));
20675 let response = common::to_response(parts, bytes.into());
20676
20677 if let common::Retry::After(d) =
20678 dlg.http_failure(&response, error.as_ref().ok())
20679 {
20680 sleep(d).await;
20681 continue;
20682 }
20683
20684 dlg.finished(false);
20685
20686 return Err(match error {
20687 Ok(value) => common::Error::BadRequest(value),
20688 _ => common::Error::Failure(response),
20689 });
20690 }
20691 let response = {
20692 let bytes = common::to_bytes(body).await.unwrap_or_default();
20693 let encoded = common::to_string(&bytes);
20694 match serde_json::from_str(&encoded) {
20695 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20696 Err(error) => {
20697 dlg.response_json_decode_error(&encoded, &error);
20698 return Err(common::Error::JsonDecodeError(
20699 encoded.to_string(),
20700 error,
20701 ));
20702 }
20703 }
20704 };
20705
20706 dlg.finished(true);
20707 return Ok(response);
20708 }
20709 }
20710 }
20711 }
20712
20713 /// Required. The fully qualified name of the service to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
20714 ///
20715 /// Sets the *name* path property to the given value.
20716 ///
20717 /// Even though the property as already been set when instantiating this call,
20718 /// we provide this method for API completeness.
20719 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceGetCall<'a, C> {
20720 self._name = new_value.to_string();
20721 self
20722 }
20723 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20724 /// while executing the actual API request.
20725 ///
20726 /// ````text
20727 /// It should be used to handle progress information, and to implement a certain level of resilience.
20728 /// ````
20729 ///
20730 /// Sets the *delegate* property to the given value.
20731 pub fn delegate(
20732 mut self,
20733 new_value: &'a mut dyn common::Delegate,
20734 ) -> ProjectLocationServiceGetCall<'a, C> {
20735 self._delegate = Some(new_value);
20736 self
20737 }
20738
20739 /// Set any additional parameter of the query string used in the request.
20740 /// It should be used to set parameters which are not yet available through their own
20741 /// setters.
20742 ///
20743 /// Please note that this method must not be used to set any of the known parameters
20744 /// which have their own setter method. If done anyway, the request will fail.
20745 ///
20746 /// # Additional Parameters
20747 ///
20748 /// * *$.xgafv* (query-string) - V1 error format.
20749 /// * *access_token* (query-string) - OAuth access token.
20750 /// * *alt* (query-string) - Data format for response.
20751 /// * *callback* (query-string) - JSONP
20752 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20753 /// * *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.
20754 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20755 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20756 /// * *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.
20757 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20758 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20759 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetCall<'a, C>
20760 where
20761 T: AsRef<str>,
20762 {
20763 self._additional_params
20764 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20765 self
20766 }
20767
20768 /// Identifies the authorization scope for the method you are building.
20769 ///
20770 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20771 /// [`Scope::CloudPlatform`].
20772 ///
20773 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20774 /// tokens for more than one scope.
20775 ///
20776 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20777 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20778 /// sufficient, a read-write scope will do as well.
20779 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetCall<'a, C>
20780 where
20781 St: AsRef<str>,
20782 {
20783 self._scopes.insert(String::from(scope.as_ref()));
20784 self
20785 }
20786 /// Identifies the authorization scope(s) for the method you are building.
20787 ///
20788 /// See [`Self::add_scope()`] for details.
20789 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetCall<'a, C>
20790 where
20791 I: IntoIterator<Item = St>,
20792 St: AsRef<str>,
20793 {
20794 self._scopes
20795 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20796 self
20797 }
20798
20799 /// Removes all scopes, and no default scope will be used either.
20800 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20801 /// for details).
20802 pub fn clear_scopes(mut self) -> ProjectLocationServiceGetCall<'a, C> {
20803 self._scopes.clear();
20804 self
20805 }
20806}
20807
20808/// Gets the IAM Access Control policy currently in effect for the given Cloud Run service. This result does not include any inherited policies.
20809///
20810/// A builder for the *locations.services.getIamPolicy* method supported by a *project* resource.
20811/// It is not used directly, but through a [`ProjectMethods`] instance.
20812///
20813/// # Example
20814///
20815/// Instantiate a resource method builder
20816///
20817/// ```test_harness,no_run
20818/// # extern crate hyper;
20819/// # extern crate hyper_rustls;
20820/// # extern crate google_run1 as run1;
20821/// # async fn dox() {
20822/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20823///
20824/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20826/// # secret,
20827/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20828/// # ).build().await.unwrap();
20829///
20830/// # let client = hyper_util::client::legacy::Client::builder(
20831/// # hyper_util::rt::TokioExecutor::new()
20832/// # )
20833/// # .build(
20834/// # hyper_rustls::HttpsConnectorBuilder::new()
20835/// # .with_native_roots()
20836/// # .unwrap()
20837/// # .https_or_http()
20838/// # .enable_http1()
20839/// # .build()
20840/// # );
20841/// # let mut hub = CloudRun::new(client, auth);
20842/// // You can configure optional parameters by calling the respective setters at will, and
20843/// // execute the final call using `doit()`.
20844/// // Values shown here are possibly random and not representative !
20845/// let result = hub.projects().locations_services_get_iam_policy("resource")
20846/// .options_requested_policy_version(-101)
20847/// .doit().await;
20848/// # }
20849/// ```
20850pub struct ProjectLocationServiceGetIamPolicyCall<'a, C>
20851where
20852 C: 'a,
20853{
20854 hub: &'a CloudRun<C>,
20855 _resource: String,
20856 _options_requested_policy_version: Option<i32>,
20857 _delegate: Option<&'a mut dyn common::Delegate>,
20858 _additional_params: HashMap<String, String>,
20859 _scopes: BTreeSet<String>,
20860}
20861
20862impl<'a, C> common::CallBuilder for ProjectLocationServiceGetIamPolicyCall<'a, C> {}
20863
20864impl<'a, C> ProjectLocationServiceGetIamPolicyCall<'a, C>
20865where
20866 C: common::Connector,
20867{
20868 /// Perform the operation you have build so far.
20869 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20870 use std::borrow::Cow;
20871 use std::io::{Read, Seek};
20872
20873 use common::{url::Params, ToParts};
20874 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20875
20876 let mut dd = common::DefaultDelegate;
20877 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20878 dlg.begin(common::MethodInfo {
20879 id: "run.projects.locations.services.getIamPolicy",
20880 http_method: hyper::Method::GET,
20881 });
20882
20883 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
20884 if self._additional_params.contains_key(field) {
20885 dlg.finished(false);
20886 return Err(common::Error::FieldClash(field));
20887 }
20888 }
20889
20890 let mut params = Params::with_capacity(4 + self._additional_params.len());
20891 params.push("resource", self._resource);
20892 if let Some(value) = self._options_requested_policy_version.as_ref() {
20893 params.push("options.requestedPolicyVersion", value.to_string());
20894 }
20895
20896 params.extend(self._additional_params.iter());
20897
20898 params.push("alt", "json");
20899 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
20900 if self._scopes.is_empty() {
20901 self._scopes
20902 .insert(Scope::CloudPlatform.as_ref().to_string());
20903 }
20904
20905 #[allow(clippy::single_element_loop)]
20906 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20907 url = params.uri_replacement(url, param_name, find_this, true);
20908 }
20909 {
20910 let to_remove = ["resource"];
20911 params.remove_params(&to_remove);
20912 }
20913
20914 let url = params.parse_with_url(&url);
20915
20916 loop {
20917 let token = match self
20918 .hub
20919 .auth
20920 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20921 .await
20922 {
20923 Ok(token) => token,
20924 Err(e) => match dlg.token(e) {
20925 Ok(token) => token,
20926 Err(e) => {
20927 dlg.finished(false);
20928 return Err(common::Error::MissingToken(e));
20929 }
20930 },
20931 };
20932 let mut req_result = {
20933 let client = &self.hub.client;
20934 dlg.pre_request();
20935 let mut req_builder = hyper::Request::builder()
20936 .method(hyper::Method::GET)
20937 .uri(url.as_str())
20938 .header(USER_AGENT, self.hub._user_agent.clone());
20939
20940 if let Some(token) = token.as_ref() {
20941 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20942 }
20943
20944 let request = req_builder
20945 .header(CONTENT_LENGTH, 0_u64)
20946 .body(common::to_body::<String>(None));
20947
20948 client.request(request.unwrap()).await
20949 };
20950
20951 match req_result {
20952 Err(err) => {
20953 if let common::Retry::After(d) = dlg.http_error(&err) {
20954 sleep(d).await;
20955 continue;
20956 }
20957 dlg.finished(false);
20958 return Err(common::Error::HttpError(err));
20959 }
20960 Ok(res) => {
20961 let (mut parts, body) = res.into_parts();
20962 let mut body = common::Body::new(body);
20963 if !parts.status.is_success() {
20964 let bytes = common::to_bytes(body).await.unwrap_or_default();
20965 let error = serde_json::from_str(&common::to_string(&bytes));
20966 let response = common::to_response(parts, bytes.into());
20967
20968 if let common::Retry::After(d) =
20969 dlg.http_failure(&response, error.as_ref().ok())
20970 {
20971 sleep(d).await;
20972 continue;
20973 }
20974
20975 dlg.finished(false);
20976
20977 return Err(match error {
20978 Ok(value) => common::Error::BadRequest(value),
20979 _ => common::Error::Failure(response),
20980 });
20981 }
20982 let response = {
20983 let bytes = common::to_bytes(body).await.unwrap_or_default();
20984 let encoded = common::to_string(&bytes);
20985 match serde_json::from_str(&encoded) {
20986 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20987 Err(error) => {
20988 dlg.response_json_decode_error(&encoded, &error);
20989 return Err(common::Error::JsonDecodeError(
20990 encoded.to_string(),
20991 error,
20992 ));
20993 }
20994 }
20995 };
20996
20997 dlg.finished(true);
20998 return Ok(response);
20999 }
21000 }
21001 }
21002 }
21003
21004 /// 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.
21005 ///
21006 /// Sets the *resource* path property to the given value.
21007 ///
21008 /// Even though the property as already been set when instantiating this call,
21009 /// we provide this method for API completeness.
21010 pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
21011 self._resource = new_value.to_string();
21012 self
21013 }
21014 /// 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).
21015 ///
21016 /// Sets the *options.requested policy version* query property to the given value.
21017 pub fn options_requested_policy_version(
21018 mut self,
21019 new_value: i32,
21020 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
21021 self._options_requested_policy_version = Some(new_value);
21022 self
21023 }
21024 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21025 /// while executing the actual API request.
21026 ///
21027 /// ````text
21028 /// It should be used to handle progress information, and to implement a certain level of resilience.
21029 /// ````
21030 ///
21031 /// Sets the *delegate* property to the given value.
21032 pub fn delegate(
21033 mut self,
21034 new_value: &'a mut dyn common::Delegate,
21035 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
21036 self._delegate = Some(new_value);
21037 self
21038 }
21039
21040 /// Set any additional parameter of the query string used in the request.
21041 /// It should be used to set parameters which are not yet available through their own
21042 /// setters.
21043 ///
21044 /// Please note that this method must not be used to set any of the known parameters
21045 /// which have their own setter method. If done anyway, the request will fail.
21046 ///
21047 /// # Additional Parameters
21048 ///
21049 /// * *$.xgafv* (query-string) - V1 error format.
21050 /// * *access_token* (query-string) - OAuth access token.
21051 /// * *alt* (query-string) - Data format for response.
21052 /// * *callback* (query-string) - JSONP
21053 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21054 /// * *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.
21055 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21056 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21057 /// * *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.
21058 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21059 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21060 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
21061 where
21062 T: AsRef<str>,
21063 {
21064 self._additional_params
21065 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21066 self
21067 }
21068
21069 /// Identifies the authorization scope for the method you are building.
21070 ///
21071 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21072 /// [`Scope::CloudPlatform`].
21073 ///
21074 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21075 /// tokens for more than one scope.
21076 ///
21077 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21078 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21079 /// sufficient, a read-write scope will do as well.
21080 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
21081 where
21082 St: AsRef<str>,
21083 {
21084 self._scopes.insert(String::from(scope.as_ref()));
21085 self
21086 }
21087 /// Identifies the authorization scope(s) for the method you are building.
21088 ///
21089 /// See [`Self::add_scope()`] for details.
21090 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
21091 where
21092 I: IntoIterator<Item = St>,
21093 St: AsRef<str>,
21094 {
21095 self._scopes
21096 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21097 self
21098 }
21099
21100 /// Removes all scopes, and no default scope will be used either.
21101 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21102 /// for details).
21103 pub fn clear_scopes(mut self) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
21104 self._scopes.clear();
21105 self
21106 }
21107}
21108
21109/// Lists services for the given project and region. Results are sorted by creation time, descending.
21110///
21111/// A builder for the *locations.services.list* method supported by a *project* resource.
21112/// It is not used directly, but through a [`ProjectMethods`] instance.
21113///
21114/// # Example
21115///
21116/// Instantiate a resource method builder
21117///
21118/// ```test_harness,no_run
21119/// # extern crate hyper;
21120/// # extern crate hyper_rustls;
21121/// # extern crate google_run1 as run1;
21122/// # async fn dox() {
21123/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21124///
21125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21127/// # secret,
21128/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21129/// # ).build().await.unwrap();
21130///
21131/// # let client = hyper_util::client::legacy::Client::builder(
21132/// # hyper_util::rt::TokioExecutor::new()
21133/// # )
21134/// # .build(
21135/// # hyper_rustls::HttpsConnectorBuilder::new()
21136/// # .with_native_roots()
21137/// # .unwrap()
21138/// # .https_or_http()
21139/// # .enable_http1()
21140/// # .build()
21141/// # );
21142/// # let mut hub = CloudRun::new(client, auth);
21143/// // You can configure optional parameters by calling the respective setters at will, and
21144/// // execute the final call using `doit()`.
21145/// // Values shown here are possibly random and not representative !
21146/// let result = hub.projects().locations_services_list("parent")
21147/// .watch(false)
21148/// .resource_version("rebum.")
21149/// .limit(-39)
21150/// .label_selector("dolore")
21151/// .include_uninitialized(true)
21152/// .field_selector("dolore")
21153/// .continue_("amet")
21154/// .doit().await;
21155/// # }
21156/// ```
21157pub struct ProjectLocationServiceListCall<'a, C>
21158where
21159 C: 'a,
21160{
21161 hub: &'a CloudRun<C>,
21162 _parent: String,
21163 _watch: Option<bool>,
21164 _resource_version: Option<String>,
21165 _limit: Option<i32>,
21166 _label_selector: Option<String>,
21167 _include_uninitialized: Option<bool>,
21168 _field_selector: Option<String>,
21169 _continue_: Option<String>,
21170 _delegate: Option<&'a mut dyn common::Delegate>,
21171 _additional_params: HashMap<String, String>,
21172 _scopes: BTreeSet<String>,
21173}
21174
21175impl<'a, C> common::CallBuilder for ProjectLocationServiceListCall<'a, C> {}
21176
21177impl<'a, C> ProjectLocationServiceListCall<'a, C>
21178where
21179 C: common::Connector,
21180{
21181 /// Perform the operation you have build so far.
21182 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
21183 use std::borrow::Cow;
21184 use std::io::{Read, Seek};
21185
21186 use common::{url::Params, ToParts};
21187 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21188
21189 let mut dd = common::DefaultDelegate;
21190 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21191 dlg.begin(common::MethodInfo {
21192 id: "run.projects.locations.services.list",
21193 http_method: hyper::Method::GET,
21194 });
21195
21196 for &field in [
21197 "alt",
21198 "parent",
21199 "watch",
21200 "resourceVersion",
21201 "limit",
21202 "labelSelector",
21203 "includeUninitialized",
21204 "fieldSelector",
21205 "continue",
21206 ]
21207 .iter()
21208 {
21209 if self._additional_params.contains_key(field) {
21210 dlg.finished(false);
21211 return Err(common::Error::FieldClash(field));
21212 }
21213 }
21214
21215 let mut params = Params::with_capacity(10 + self._additional_params.len());
21216 params.push("parent", self._parent);
21217 if let Some(value) = self._watch.as_ref() {
21218 params.push("watch", value.to_string());
21219 }
21220 if let Some(value) = self._resource_version.as_ref() {
21221 params.push("resourceVersion", value);
21222 }
21223 if let Some(value) = self._limit.as_ref() {
21224 params.push("limit", value.to_string());
21225 }
21226 if let Some(value) = self._label_selector.as_ref() {
21227 params.push("labelSelector", value);
21228 }
21229 if let Some(value) = self._include_uninitialized.as_ref() {
21230 params.push("includeUninitialized", value.to_string());
21231 }
21232 if let Some(value) = self._field_selector.as_ref() {
21233 params.push("fieldSelector", value);
21234 }
21235 if let Some(value) = self._continue_.as_ref() {
21236 params.push("continue", value);
21237 }
21238
21239 params.extend(self._additional_params.iter());
21240
21241 params.push("alt", "json");
21242 let mut url = self.hub._base_url.clone() + "v1/{+parent}/services";
21243 if self._scopes.is_empty() {
21244 self._scopes
21245 .insert(Scope::CloudPlatform.as_ref().to_string());
21246 }
21247
21248 #[allow(clippy::single_element_loop)]
21249 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21250 url = params.uri_replacement(url, param_name, find_this, true);
21251 }
21252 {
21253 let to_remove = ["parent"];
21254 params.remove_params(&to_remove);
21255 }
21256
21257 let url = params.parse_with_url(&url);
21258
21259 loop {
21260 let token = match self
21261 .hub
21262 .auth
21263 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21264 .await
21265 {
21266 Ok(token) => token,
21267 Err(e) => match dlg.token(e) {
21268 Ok(token) => token,
21269 Err(e) => {
21270 dlg.finished(false);
21271 return Err(common::Error::MissingToken(e));
21272 }
21273 },
21274 };
21275 let mut req_result = {
21276 let client = &self.hub.client;
21277 dlg.pre_request();
21278 let mut req_builder = hyper::Request::builder()
21279 .method(hyper::Method::GET)
21280 .uri(url.as_str())
21281 .header(USER_AGENT, self.hub._user_agent.clone());
21282
21283 if let Some(token) = token.as_ref() {
21284 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21285 }
21286
21287 let request = req_builder
21288 .header(CONTENT_LENGTH, 0_u64)
21289 .body(common::to_body::<String>(None));
21290
21291 client.request(request.unwrap()).await
21292 };
21293
21294 match req_result {
21295 Err(err) => {
21296 if let common::Retry::After(d) = dlg.http_error(&err) {
21297 sleep(d).await;
21298 continue;
21299 }
21300 dlg.finished(false);
21301 return Err(common::Error::HttpError(err));
21302 }
21303 Ok(res) => {
21304 let (mut parts, body) = res.into_parts();
21305 let mut body = common::Body::new(body);
21306 if !parts.status.is_success() {
21307 let bytes = common::to_bytes(body).await.unwrap_or_default();
21308 let error = serde_json::from_str(&common::to_string(&bytes));
21309 let response = common::to_response(parts, bytes.into());
21310
21311 if let common::Retry::After(d) =
21312 dlg.http_failure(&response, error.as_ref().ok())
21313 {
21314 sleep(d).await;
21315 continue;
21316 }
21317
21318 dlg.finished(false);
21319
21320 return Err(match error {
21321 Ok(value) => common::Error::BadRequest(value),
21322 _ => common::Error::Failure(response),
21323 });
21324 }
21325 let response = {
21326 let bytes = common::to_bytes(body).await.unwrap_or_default();
21327 let encoded = common::to_string(&bytes);
21328 match serde_json::from_str(&encoded) {
21329 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21330 Err(error) => {
21331 dlg.response_json_decode_error(&encoded, &error);
21332 return Err(common::Error::JsonDecodeError(
21333 encoded.to_string(),
21334 error,
21335 ));
21336 }
21337 }
21338 };
21339
21340 dlg.finished(true);
21341 return Ok(response);
21342 }
21343 }
21344 }
21345 }
21346
21347 /// Required. The parent from where the resources should be listed. In Cloud Run, it may be one of the following: * `{project_id_or_number}` * `namespaces/{project_id_or_number}` * `namespaces/{project_id_or_number}/services` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
21348 ///
21349 /// Sets the *parent* path property to the given value.
21350 ///
21351 /// Even though the property as already been set when instantiating this call,
21352 /// we provide this method for API completeness.
21353 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
21354 self._parent = new_value.to_string();
21355 self
21356 }
21357 /// Not supported, and ignored by Cloud Run.
21358 ///
21359 /// Sets the *watch* query property to the given value.
21360 pub fn watch(mut self, new_value: bool) -> ProjectLocationServiceListCall<'a, C> {
21361 self._watch = Some(new_value);
21362 self
21363 }
21364 /// Not supported, and ignored by Cloud Run.
21365 ///
21366 /// Sets the *resource version* query property to the given value.
21367 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
21368 self._resource_version = Some(new_value.to_string());
21369 self
21370 }
21371 /// The maximum number of records that should be returned.
21372 ///
21373 /// Sets the *limit* query property to the given value.
21374 pub fn limit(mut self, new_value: i32) -> ProjectLocationServiceListCall<'a, C> {
21375 self._limit = Some(new_value);
21376 self
21377 }
21378 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
21379 ///
21380 /// Sets the *label selector* query property to the given value.
21381 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
21382 self._label_selector = Some(new_value.to_string());
21383 self
21384 }
21385 /// Not supported, and ignored by Cloud Run.
21386 ///
21387 /// Sets the *include uninitialized* query property to the given value.
21388 pub fn include_uninitialized(
21389 mut self,
21390 new_value: bool,
21391 ) -> ProjectLocationServiceListCall<'a, C> {
21392 self._include_uninitialized = Some(new_value);
21393 self
21394 }
21395 /// Not supported, and ignored by Cloud Run.
21396 ///
21397 /// Sets the *field selector* query property to the given value.
21398 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
21399 self._field_selector = Some(new_value.to_string());
21400 self
21401 }
21402 /// Encoded string to continue paging.
21403 ///
21404 /// Sets the *continue* query property to the given value.
21405 pub fn continue_(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
21406 self._continue_ = Some(new_value.to_string());
21407 self
21408 }
21409 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21410 /// while executing the actual API request.
21411 ///
21412 /// ````text
21413 /// It should be used to handle progress information, and to implement a certain level of resilience.
21414 /// ````
21415 ///
21416 /// Sets the *delegate* property to the given value.
21417 pub fn delegate(
21418 mut self,
21419 new_value: &'a mut dyn common::Delegate,
21420 ) -> ProjectLocationServiceListCall<'a, C> {
21421 self._delegate = Some(new_value);
21422 self
21423 }
21424
21425 /// Set any additional parameter of the query string used in the request.
21426 /// It should be used to set parameters which are not yet available through their own
21427 /// setters.
21428 ///
21429 /// Please note that this method must not be used to set any of the known parameters
21430 /// which have their own setter method. If done anyway, the request will fail.
21431 ///
21432 /// # Additional Parameters
21433 ///
21434 /// * *$.xgafv* (query-string) - V1 error format.
21435 /// * *access_token* (query-string) - OAuth access token.
21436 /// * *alt* (query-string) - Data format for response.
21437 /// * *callback* (query-string) - JSONP
21438 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21439 /// * *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.
21440 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21441 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21442 /// * *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.
21443 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21444 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21445 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceListCall<'a, C>
21446 where
21447 T: AsRef<str>,
21448 {
21449 self._additional_params
21450 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21451 self
21452 }
21453
21454 /// Identifies the authorization scope for the method you are building.
21455 ///
21456 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21457 /// [`Scope::CloudPlatform`].
21458 ///
21459 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21460 /// tokens for more than one scope.
21461 ///
21462 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21463 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21464 /// sufficient, a read-write scope will do as well.
21465 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceListCall<'a, C>
21466 where
21467 St: AsRef<str>,
21468 {
21469 self._scopes.insert(String::from(scope.as_ref()));
21470 self
21471 }
21472 /// Identifies the authorization scope(s) for the method you are building.
21473 ///
21474 /// See [`Self::add_scope()`] for details.
21475 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceListCall<'a, C>
21476 where
21477 I: IntoIterator<Item = St>,
21478 St: AsRef<str>,
21479 {
21480 self._scopes
21481 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21482 self
21483 }
21484
21485 /// Removes all scopes, and no default scope will be used either.
21486 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21487 /// for details).
21488 pub fn clear_scopes(mut self) -> ProjectLocationServiceListCall<'a, C> {
21489 self._scopes.clear();
21490 self
21491 }
21492}
21493
21494/// Replaces a service. Only the spec and metadata labels and annotations are modifiable. After the Update request, Cloud Run will work to make the 'status' match the requested 'spec'. May provide metadata.resourceVersion to enforce update from last read for optimistic concurrency control.
21495///
21496/// A builder for the *locations.services.replaceService* method supported by a *project* resource.
21497/// It is not used directly, but through a [`ProjectMethods`] instance.
21498///
21499/// # Example
21500///
21501/// Instantiate a resource method builder
21502///
21503/// ```test_harness,no_run
21504/// # extern crate hyper;
21505/// # extern crate hyper_rustls;
21506/// # extern crate google_run1 as run1;
21507/// use run1::api::Service;
21508/// # async fn dox() {
21509/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21510///
21511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21513/// # secret,
21514/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21515/// # ).build().await.unwrap();
21516///
21517/// # let client = hyper_util::client::legacy::Client::builder(
21518/// # hyper_util::rt::TokioExecutor::new()
21519/// # )
21520/// # .build(
21521/// # hyper_rustls::HttpsConnectorBuilder::new()
21522/// # .with_native_roots()
21523/// # .unwrap()
21524/// # .https_or_http()
21525/// # .enable_http1()
21526/// # .build()
21527/// # );
21528/// # let mut hub = CloudRun::new(client, auth);
21529/// // As the method needs a request, you would usually fill it with the desired information
21530/// // into the respective structure. Some of the parts shown here might not be applicable !
21531/// // Values shown here are possibly random and not representative !
21532/// let mut req = Service::default();
21533///
21534/// // You can configure optional parameters by calling the respective setters at will, and
21535/// // execute the final call using `doit()`.
21536/// // Values shown here are possibly random and not representative !
21537/// let result = hub.projects().locations_services_replace_service(req, "name")
21538/// .dry_run("At")
21539/// .doit().await;
21540/// # }
21541/// ```
21542pub struct ProjectLocationServiceReplaceServiceCall<'a, C>
21543where
21544 C: 'a,
21545{
21546 hub: &'a CloudRun<C>,
21547 _request: Service,
21548 _name: String,
21549 _dry_run: Option<String>,
21550 _delegate: Option<&'a mut dyn common::Delegate>,
21551 _additional_params: HashMap<String, String>,
21552 _scopes: BTreeSet<String>,
21553}
21554
21555impl<'a, C> common::CallBuilder for ProjectLocationServiceReplaceServiceCall<'a, C> {}
21556
21557impl<'a, C> ProjectLocationServiceReplaceServiceCall<'a, C>
21558where
21559 C: common::Connector,
21560{
21561 /// Perform the operation you have build so far.
21562 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
21563 use std::borrow::Cow;
21564 use std::io::{Read, Seek};
21565
21566 use common::{url::Params, ToParts};
21567 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21568
21569 let mut dd = common::DefaultDelegate;
21570 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21571 dlg.begin(common::MethodInfo {
21572 id: "run.projects.locations.services.replaceService",
21573 http_method: hyper::Method::PUT,
21574 });
21575
21576 for &field in ["alt", "name", "dryRun"].iter() {
21577 if self._additional_params.contains_key(field) {
21578 dlg.finished(false);
21579 return Err(common::Error::FieldClash(field));
21580 }
21581 }
21582
21583 let mut params = Params::with_capacity(5 + self._additional_params.len());
21584 params.push("name", self._name);
21585 if let Some(value) = self._dry_run.as_ref() {
21586 params.push("dryRun", value);
21587 }
21588
21589 params.extend(self._additional_params.iter());
21590
21591 params.push("alt", "json");
21592 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21593 if self._scopes.is_empty() {
21594 self._scopes
21595 .insert(Scope::CloudPlatform.as_ref().to_string());
21596 }
21597
21598 #[allow(clippy::single_element_loop)]
21599 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21600 url = params.uri_replacement(url, param_name, find_this, true);
21601 }
21602 {
21603 let to_remove = ["name"];
21604 params.remove_params(&to_remove);
21605 }
21606
21607 let url = params.parse_with_url(&url);
21608
21609 let mut json_mime_type = mime::APPLICATION_JSON;
21610 let mut request_value_reader = {
21611 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21612 common::remove_json_null_values(&mut value);
21613 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21614 serde_json::to_writer(&mut dst, &value).unwrap();
21615 dst
21616 };
21617 let request_size = request_value_reader
21618 .seek(std::io::SeekFrom::End(0))
21619 .unwrap();
21620 request_value_reader
21621 .seek(std::io::SeekFrom::Start(0))
21622 .unwrap();
21623
21624 loop {
21625 let token = match self
21626 .hub
21627 .auth
21628 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21629 .await
21630 {
21631 Ok(token) => token,
21632 Err(e) => match dlg.token(e) {
21633 Ok(token) => token,
21634 Err(e) => {
21635 dlg.finished(false);
21636 return Err(common::Error::MissingToken(e));
21637 }
21638 },
21639 };
21640 request_value_reader
21641 .seek(std::io::SeekFrom::Start(0))
21642 .unwrap();
21643 let mut req_result = {
21644 let client = &self.hub.client;
21645 dlg.pre_request();
21646 let mut req_builder = hyper::Request::builder()
21647 .method(hyper::Method::PUT)
21648 .uri(url.as_str())
21649 .header(USER_AGENT, self.hub._user_agent.clone());
21650
21651 if let Some(token) = token.as_ref() {
21652 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21653 }
21654
21655 let request = req_builder
21656 .header(CONTENT_TYPE, json_mime_type.to_string())
21657 .header(CONTENT_LENGTH, request_size as u64)
21658 .body(common::to_body(
21659 request_value_reader.get_ref().clone().into(),
21660 ));
21661
21662 client.request(request.unwrap()).await
21663 };
21664
21665 match req_result {
21666 Err(err) => {
21667 if let common::Retry::After(d) = dlg.http_error(&err) {
21668 sleep(d).await;
21669 continue;
21670 }
21671 dlg.finished(false);
21672 return Err(common::Error::HttpError(err));
21673 }
21674 Ok(res) => {
21675 let (mut parts, body) = res.into_parts();
21676 let mut body = common::Body::new(body);
21677 if !parts.status.is_success() {
21678 let bytes = common::to_bytes(body).await.unwrap_or_default();
21679 let error = serde_json::from_str(&common::to_string(&bytes));
21680 let response = common::to_response(parts, bytes.into());
21681
21682 if let common::Retry::After(d) =
21683 dlg.http_failure(&response, error.as_ref().ok())
21684 {
21685 sleep(d).await;
21686 continue;
21687 }
21688
21689 dlg.finished(false);
21690
21691 return Err(match error {
21692 Ok(value) => common::Error::BadRequest(value),
21693 _ => common::Error::Failure(response),
21694 });
21695 }
21696 let response = {
21697 let bytes = common::to_bytes(body).await.unwrap_or_default();
21698 let encoded = common::to_string(&bytes);
21699 match serde_json::from_str(&encoded) {
21700 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21701 Err(error) => {
21702 dlg.response_json_decode_error(&encoded, &error);
21703 return Err(common::Error::JsonDecodeError(
21704 encoded.to_string(),
21705 error,
21706 ));
21707 }
21708 }
21709 };
21710
21711 dlg.finished(true);
21712 return Ok(response);
21713 }
21714 }
21715 }
21716 }
21717
21718 ///
21719 /// Sets the *request* property to the given value.
21720 ///
21721 /// Even though the property as already been set when instantiating this call,
21722 /// we provide this method for API completeness.
21723 pub fn request(
21724 mut self,
21725 new_value: Service,
21726 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
21727 self._request = new_value;
21728 self
21729 }
21730 /// Required. The fully qualified name of the service to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/services/{service_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/services/{service_name}` * `projects/{project_id_or_number}/regions/{region}/services/{service_name}`
21731 ///
21732 /// Sets the *name* path property to the given value.
21733 ///
21734 /// Even though the property as already been set when instantiating this call,
21735 /// we provide this method for API completeness.
21736 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
21737 self._name = new_value.to_string();
21738 self
21739 }
21740 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
21741 ///
21742 /// Sets the *dry run* query property to the given value.
21743 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
21744 self._dry_run = Some(new_value.to_string());
21745 self
21746 }
21747 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21748 /// while executing the actual API request.
21749 ///
21750 /// ````text
21751 /// It should be used to handle progress information, and to implement a certain level of resilience.
21752 /// ````
21753 ///
21754 /// Sets the *delegate* property to the given value.
21755 pub fn delegate(
21756 mut self,
21757 new_value: &'a mut dyn common::Delegate,
21758 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
21759 self._delegate = Some(new_value);
21760 self
21761 }
21762
21763 /// Set any additional parameter of the query string used in the request.
21764 /// It should be used to set parameters which are not yet available through their own
21765 /// setters.
21766 ///
21767 /// Please note that this method must not be used to set any of the known parameters
21768 /// which have their own setter method. If done anyway, the request will fail.
21769 ///
21770 /// # Additional Parameters
21771 ///
21772 /// * *$.xgafv* (query-string) - V1 error format.
21773 /// * *access_token* (query-string) - OAuth access token.
21774 /// * *alt* (query-string) - Data format for response.
21775 /// * *callback* (query-string) - JSONP
21776 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21777 /// * *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.
21778 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21779 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21780 /// * *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.
21781 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21782 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21783 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceReplaceServiceCall<'a, C>
21784 where
21785 T: AsRef<str>,
21786 {
21787 self._additional_params
21788 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21789 self
21790 }
21791
21792 /// Identifies the authorization scope for the method you are building.
21793 ///
21794 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21795 /// [`Scope::CloudPlatform`].
21796 ///
21797 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21798 /// tokens for more than one scope.
21799 ///
21800 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21801 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21802 /// sufficient, a read-write scope will do as well.
21803 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceReplaceServiceCall<'a, C>
21804 where
21805 St: AsRef<str>,
21806 {
21807 self._scopes.insert(String::from(scope.as_ref()));
21808 self
21809 }
21810 /// Identifies the authorization scope(s) for the method you are building.
21811 ///
21812 /// See [`Self::add_scope()`] for details.
21813 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceReplaceServiceCall<'a, C>
21814 where
21815 I: IntoIterator<Item = St>,
21816 St: AsRef<str>,
21817 {
21818 self._scopes
21819 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21820 self
21821 }
21822
21823 /// Removes all scopes, and no default scope will be used either.
21824 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21825 /// for details).
21826 pub fn clear_scopes(mut self) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
21827 self._scopes.clear();
21828 self
21829 }
21830}
21831
21832/// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
21833///
21834/// A builder for the *locations.services.setIamPolicy* method supported by a *project* resource.
21835/// It is not used directly, but through a [`ProjectMethods`] instance.
21836///
21837/// # Example
21838///
21839/// Instantiate a resource method builder
21840///
21841/// ```test_harness,no_run
21842/// # extern crate hyper;
21843/// # extern crate hyper_rustls;
21844/// # extern crate google_run1 as run1;
21845/// use run1::api::SetIamPolicyRequest;
21846/// # async fn dox() {
21847/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21848///
21849/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21850/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21851/// # secret,
21852/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21853/// # ).build().await.unwrap();
21854///
21855/// # let client = hyper_util::client::legacy::Client::builder(
21856/// # hyper_util::rt::TokioExecutor::new()
21857/// # )
21858/// # .build(
21859/// # hyper_rustls::HttpsConnectorBuilder::new()
21860/// # .with_native_roots()
21861/// # .unwrap()
21862/// # .https_or_http()
21863/// # .enable_http1()
21864/// # .build()
21865/// # );
21866/// # let mut hub = CloudRun::new(client, auth);
21867/// // As the method needs a request, you would usually fill it with the desired information
21868/// // into the respective structure. Some of the parts shown here might not be applicable !
21869/// // Values shown here are possibly random and not representative !
21870/// let mut req = SetIamPolicyRequest::default();
21871///
21872/// // You can configure optional parameters by calling the respective setters at will, and
21873/// // execute the final call using `doit()`.
21874/// // Values shown here are possibly random and not representative !
21875/// let result = hub.projects().locations_services_set_iam_policy(req, "resource")
21876/// .doit().await;
21877/// # }
21878/// ```
21879pub struct ProjectLocationServiceSetIamPolicyCall<'a, C>
21880where
21881 C: 'a,
21882{
21883 hub: &'a CloudRun<C>,
21884 _request: SetIamPolicyRequest,
21885 _resource: String,
21886 _delegate: Option<&'a mut dyn common::Delegate>,
21887 _additional_params: HashMap<String, String>,
21888 _scopes: BTreeSet<String>,
21889}
21890
21891impl<'a, C> common::CallBuilder for ProjectLocationServiceSetIamPolicyCall<'a, C> {}
21892
21893impl<'a, C> ProjectLocationServiceSetIamPolicyCall<'a, C>
21894where
21895 C: common::Connector,
21896{
21897 /// Perform the operation you have build so far.
21898 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
21899 use std::borrow::Cow;
21900 use std::io::{Read, Seek};
21901
21902 use common::{url::Params, ToParts};
21903 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21904
21905 let mut dd = common::DefaultDelegate;
21906 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21907 dlg.begin(common::MethodInfo {
21908 id: "run.projects.locations.services.setIamPolicy",
21909 http_method: hyper::Method::POST,
21910 });
21911
21912 for &field in ["alt", "resource"].iter() {
21913 if self._additional_params.contains_key(field) {
21914 dlg.finished(false);
21915 return Err(common::Error::FieldClash(field));
21916 }
21917 }
21918
21919 let mut params = Params::with_capacity(4 + self._additional_params.len());
21920 params.push("resource", self._resource);
21921
21922 params.extend(self._additional_params.iter());
21923
21924 params.push("alt", "json");
21925 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
21926 if self._scopes.is_empty() {
21927 self._scopes
21928 .insert(Scope::CloudPlatform.as_ref().to_string());
21929 }
21930
21931 #[allow(clippy::single_element_loop)]
21932 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21933 url = params.uri_replacement(url, param_name, find_this, true);
21934 }
21935 {
21936 let to_remove = ["resource"];
21937 params.remove_params(&to_remove);
21938 }
21939
21940 let url = params.parse_with_url(&url);
21941
21942 let mut json_mime_type = mime::APPLICATION_JSON;
21943 let mut request_value_reader = {
21944 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21945 common::remove_json_null_values(&mut value);
21946 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21947 serde_json::to_writer(&mut dst, &value).unwrap();
21948 dst
21949 };
21950 let request_size = request_value_reader
21951 .seek(std::io::SeekFrom::End(0))
21952 .unwrap();
21953 request_value_reader
21954 .seek(std::io::SeekFrom::Start(0))
21955 .unwrap();
21956
21957 loop {
21958 let token = match self
21959 .hub
21960 .auth
21961 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21962 .await
21963 {
21964 Ok(token) => token,
21965 Err(e) => match dlg.token(e) {
21966 Ok(token) => token,
21967 Err(e) => {
21968 dlg.finished(false);
21969 return Err(common::Error::MissingToken(e));
21970 }
21971 },
21972 };
21973 request_value_reader
21974 .seek(std::io::SeekFrom::Start(0))
21975 .unwrap();
21976 let mut req_result = {
21977 let client = &self.hub.client;
21978 dlg.pre_request();
21979 let mut req_builder = hyper::Request::builder()
21980 .method(hyper::Method::POST)
21981 .uri(url.as_str())
21982 .header(USER_AGENT, self.hub._user_agent.clone());
21983
21984 if let Some(token) = token.as_ref() {
21985 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21986 }
21987
21988 let request = req_builder
21989 .header(CONTENT_TYPE, json_mime_type.to_string())
21990 .header(CONTENT_LENGTH, request_size as u64)
21991 .body(common::to_body(
21992 request_value_reader.get_ref().clone().into(),
21993 ));
21994
21995 client.request(request.unwrap()).await
21996 };
21997
21998 match req_result {
21999 Err(err) => {
22000 if let common::Retry::After(d) = dlg.http_error(&err) {
22001 sleep(d).await;
22002 continue;
22003 }
22004 dlg.finished(false);
22005 return Err(common::Error::HttpError(err));
22006 }
22007 Ok(res) => {
22008 let (mut parts, body) = res.into_parts();
22009 let mut body = common::Body::new(body);
22010 if !parts.status.is_success() {
22011 let bytes = common::to_bytes(body).await.unwrap_or_default();
22012 let error = serde_json::from_str(&common::to_string(&bytes));
22013 let response = common::to_response(parts, bytes.into());
22014
22015 if let common::Retry::After(d) =
22016 dlg.http_failure(&response, error.as_ref().ok())
22017 {
22018 sleep(d).await;
22019 continue;
22020 }
22021
22022 dlg.finished(false);
22023
22024 return Err(match error {
22025 Ok(value) => common::Error::BadRequest(value),
22026 _ => common::Error::Failure(response),
22027 });
22028 }
22029 let response = {
22030 let bytes = common::to_bytes(body).await.unwrap_or_default();
22031 let encoded = common::to_string(&bytes);
22032 match serde_json::from_str(&encoded) {
22033 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22034 Err(error) => {
22035 dlg.response_json_decode_error(&encoded, &error);
22036 return Err(common::Error::JsonDecodeError(
22037 encoded.to_string(),
22038 error,
22039 ));
22040 }
22041 }
22042 };
22043
22044 dlg.finished(true);
22045 return Ok(response);
22046 }
22047 }
22048 }
22049 }
22050
22051 ///
22052 /// Sets the *request* property to the given value.
22053 ///
22054 /// Even though the property as already been set when instantiating this call,
22055 /// we provide this method for API completeness.
22056 pub fn request(
22057 mut self,
22058 new_value: SetIamPolicyRequest,
22059 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
22060 self._request = new_value;
22061 self
22062 }
22063 /// 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.
22064 ///
22065 /// Sets the *resource* path property to the given value.
22066 ///
22067 /// Even though the property as already been set when instantiating this call,
22068 /// we provide this method for API completeness.
22069 pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
22070 self._resource = new_value.to_string();
22071 self
22072 }
22073 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22074 /// while executing the actual API request.
22075 ///
22076 /// ````text
22077 /// It should be used to handle progress information, and to implement a certain level of resilience.
22078 /// ````
22079 ///
22080 /// Sets the *delegate* property to the given value.
22081 pub fn delegate(
22082 mut self,
22083 new_value: &'a mut dyn common::Delegate,
22084 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
22085 self._delegate = Some(new_value);
22086 self
22087 }
22088
22089 /// Set any additional parameter of the query string used in the request.
22090 /// It should be used to set parameters which are not yet available through their own
22091 /// setters.
22092 ///
22093 /// Please note that this method must not be used to set any of the known parameters
22094 /// which have their own setter method. If done anyway, the request will fail.
22095 ///
22096 /// # Additional Parameters
22097 ///
22098 /// * *$.xgafv* (query-string) - V1 error format.
22099 /// * *access_token* (query-string) - OAuth access token.
22100 /// * *alt* (query-string) - Data format for response.
22101 /// * *callback* (query-string) - JSONP
22102 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22103 /// * *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.
22104 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22105 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22106 /// * *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.
22107 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22108 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22109 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
22110 where
22111 T: AsRef<str>,
22112 {
22113 self._additional_params
22114 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22115 self
22116 }
22117
22118 /// Identifies the authorization scope for the method you are building.
22119 ///
22120 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22121 /// [`Scope::CloudPlatform`].
22122 ///
22123 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22124 /// tokens for more than one scope.
22125 ///
22126 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22127 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22128 /// sufficient, a read-write scope will do as well.
22129 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
22130 where
22131 St: AsRef<str>,
22132 {
22133 self._scopes.insert(String::from(scope.as_ref()));
22134 self
22135 }
22136 /// Identifies the authorization scope(s) for the method you are building.
22137 ///
22138 /// See [`Self::add_scope()`] for details.
22139 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
22140 where
22141 I: IntoIterator<Item = St>,
22142 St: AsRef<str>,
22143 {
22144 self._scopes
22145 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22146 self
22147 }
22148
22149 /// Removes all scopes, and no default scope will be used either.
22150 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22151 /// for details).
22152 pub fn clear_scopes(mut self) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
22153 self._scopes.clear();
22154 self
22155 }
22156}
22157
22158/// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
22159///
22160/// A builder for the *locations.services.testIamPermissions* method supported by a *project* resource.
22161/// It is not used directly, but through a [`ProjectMethods`] instance.
22162///
22163/// # Example
22164///
22165/// Instantiate a resource method builder
22166///
22167/// ```test_harness,no_run
22168/// # extern crate hyper;
22169/// # extern crate hyper_rustls;
22170/// # extern crate google_run1 as run1;
22171/// use run1::api::TestIamPermissionsRequest;
22172/// # async fn dox() {
22173/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22174///
22175/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22176/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22177/// # secret,
22178/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22179/// # ).build().await.unwrap();
22180///
22181/// # let client = hyper_util::client::legacy::Client::builder(
22182/// # hyper_util::rt::TokioExecutor::new()
22183/// # )
22184/// # .build(
22185/// # hyper_rustls::HttpsConnectorBuilder::new()
22186/// # .with_native_roots()
22187/// # .unwrap()
22188/// # .https_or_http()
22189/// # .enable_http1()
22190/// # .build()
22191/// # );
22192/// # let mut hub = CloudRun::new(client, auth);
22193/// // As the method needs a request, you would usually fill it with the desired information
22194/// // into the respective structure. Some of the parts shown here might not be applicable !
22195/// // Values shown here are possibly random and not representative !
22196/// let mut req = TestIamPermissionsRequest::default();
22197///
22198/// // You can configure optional parameters by calling the respective setters at will, and
22199/// // execute the final call using `doit()`.
22200/// // Values shown here are possibly random and not representative !
22201/// let result = hub.projects().locations_services_test_iam_permissions(req, "resource")
22202/// .doit().await;
22203/// # }
22204/// ```
22205pub struct ProjectLocationServiceTestIamPermissionCall<'a, C>
22206where
22207 C: 'a,
22208{
22209 hub: &'a CloudRun<C>,
22210 _request: TestIamPermissionsRequest,
22211 _resource: String,
22212 _delegate: Option<&'a mut dyn common::Delegate>,
22213 _additional_params: HashMap<String, String>,
22214 _scopes: BTreeSet<String>,
22215}
22216
22217impl<'a, C> common::CallBuilder for ProjectLocationServiceTestIamPermissionCall<'a, C> {}
22218
22219impl<'a, C> ProjectLocationServiceTestIamPermissionCall<'a, C>
22220where
22221 C: common::Connector,
22222{
22223 /// Perform the operation you have build so far.
22224 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
22225 use std::borrow::Cow;
22226 use std::io::{Read, Seek};
22227
22228 use common::{url::Params, ToParts};
22229 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22230
22231 let mut dd = common::DefaultDelegate;
22232 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22233 dlg.begin(common::MethodInfo {
22234 id: "run.projects.locations.services.testIamPermissions",
22235 http_method: hyper::Method::POST,
22236 });
22237
22238 for &field in ["alt", "resource"].iter() {
22239 if self._additional_params.contains_key(field) {
22240 dlg.finished(false);
22241 return Err(common::Error::FieldClash(field));
22242 }
22243 }
22244
22245 let mut params = Params::with_capacity(4 + self._additional_params.len());
22246 params.push("resource", self._resource);
22247
22248 params.extend(self._additional_params.iter());
22249
22250 params.push("alt", "json");
22251 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
22252 if self._scopes.is_empty() {
22253 self._scopes
22254 .insert(Scope::CloudPlatform.as_ref().to_string());
22255 }
22256
22257 #[allow(clippy::single_element_loop)]
22258 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22259 url = params.uri_replacement(url, param_name, find_this, true);
22260 }
22261 {
22262 let to_remove = ["resource"];
22263 params.remove_params(&to_remove);
22264 }
22265
22266 let url = params.parse_with_url(&url);
22267
22268 let mut json_mime_type = mime::APPLICATION_JSON;
22269 let mut request_value_reader = {
22270 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22271 common::remove_json_null_values(&mut value);
22272 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22273 serde_json::to_writer(&mut dst, &value).unwrap();
22274 dst
22275 };
22276 let request_size = request_value_reader
22277 .seek(std::io::SeekFrom::End(0))
22278 .unwrap();
22279 request_value_reader
22280 .seek(std::io::SeekFrom::Start(0))
22281 .unwrap();
22282
22283 loop {
22284 let token = match self
22285 .hub
22286 .auth
22287 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22288 .await
22289 {
22290 Ok(token) => token,
22291 Err(e) => match dlg.token(e) {
22292 Ok(token) => token,
22293 Err(e) => {
22294 dlg.finished(false);
22295 return Err(common::Error::MissingToken(e));
22296 }
22297 },
22298 };
22299 request_value_reader
22300 .seek(std::io::SeekFrom::Start(0))
22301 .unwrap();
22302 let mut req_result = {
22303 let client = &self.hub.client;
22304 dlg.pre_request();
22305 let mut req_builder = hyper::Request::builder()
22306 .method(hyper::Method::POST)
22307 .uri(url.as_str())
22308 .header(USER_AGENT, self.hub._user_agent.clone());
22309
22310 if let Some(token) = token.as_ref() {
22311 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22312 }
22313
22314 let request = req_builder
22315 .header(CONTENT_TYPE, json_mime_type.to_string())
22316 .header(CONTENT_LENGTH, request_size as u64)
22317 .body(common::to_body(
22318 request_value_reader.get_ref().clone().into(),
22319 ));
22320
22321 client.request(request.unwrap()).await
22322 };
22323
22324 match req_result {
22325 Err(err) => {
22326 if let common::Retry::After(d) = dlg.http_error(&err) {
22327 sleep(d).await;
22328 continue;
22329 }
22330 dlg.finished(false);
22331 return Err(common::Error::HttpError(err));
22332 }
22333 Ok(res) => {
22334 let (mut parts, body) = res.into_parts();
22335 let mut body = common::Body::new(body);
22336 if !parts.status.is_success() {
22337 let bytes = common::to_bytes(body).await.unwrap_or_default();
22338 let error = serde_json::from_str(&common::to_string(&bytes));
22339 let response = common::to_response(parts, bytes.into());
22340
22341 if let common::Retry::After(d) =
22342 dlg.http_failure(&response, error.as_ref().ok())
22343 {
22344 sleep(d).await;
22345 continue;
22346 }
22347
22348 dlg.finished(false);
22349
22350 return Err(match error {
22351 Ok(value) => common::Error::BadRequest(value),
22352 _ => common::Error::Failure(response),
22353 });
22354 }
22355 let response = {
22356 let bytes = common::to_bytes(body).await.unwrap_or_default();
22357 let encoded = common::to_string(&bytes);
22358 match serde_json::from_str(&encoded) {
22359 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22360 Err(error) => {
22361 dlg.response_json_decode_error(&encoded, &error);
22362 return Err(common::Error::JsonDecodeError(
22363 encoded.to_string(),
22364 error,
22365 ));
22366 }
22367 }
22368 };
22369
22370 dlg.finished(true);
22371 return Ok(response);
22372 }
22373 }
22374 }
22375 }
22376
22377 ///
22378 /// Sets the *request* property to the given value.
22379 ///
22380 /// Even though the property as already been set when instantiating this call,
22381 /// we provide this method for API completeness.
22382 pub fn request(
22383 mut self,
22384 new_value: TestIamPermissionsRequest,
22385 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
22386 self._request = new_value;
22387 self
22388 }
22389 /// 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.
22390 ///
22391 /// Sets the *resource* path property to the given value.
22392 ///
22393 /// Even though the property as already been set when instantiating this call,
22394 /// we provide this method for API completeness.
22395 pub fn resource(
22396 mut self,
22397 new_value: &str,
22398 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
22399 self._resource = new_value.to_string();
22400 self
22401 }
22402 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22403 /// while executing the actual API request.
22404 ///
22405 /// ````text
22406 /// It should be used to handle progress information, and to implement a certain level of resilience.
22407 /// ````
22408 ///
22409 /// Sets the *delegate* property to the given value.
22410 pub fn delegate(
22411 mut self,
22412 new_value: &'a mut dyn common::Delegate,
22413 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
22414 self._delegate = Some(new_value);
22415 self
22416 }
22417
22418 /// Set any additional parameter of the query string used in the request.
22419 /// It should be used to set parameters which are not yet available through their own
22420 /// setters.
22421 ///
22422 /// Please note that this method must not be used to set any of the known parameters
22423 /// which have their own setter method. If done anyway, the request will fail.
22424 ///
22425 /// # Additional Parameters
22426 ///
22427 /// * *$.xgafv* (query-string) - V1 error format.
22428 /// * *access_token* (query-string) - OAuth access token.
22429 /// * *alt* (query-string) - Data format for response.
22430 /// * *callback* (query-string) - JSONP
22431 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22432 /// * *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.
22433 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22434 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22435 /// * *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.
22436 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22437 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22438 pub fn param<T>(
22439 mut self,
22440 name: T,
22441 value: T,
22442 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
22443 where
22444 T: AsRef<str>,
22445 {
22446 self._additional_params
22447 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22448 self
22449 }
22450
22451 /// Identifies the authorization scope for the method you are building.
22452 ///
22453 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22454 /// [`Scope::CloudPlatform`].
22455 ///
22456 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22457 /// tokens for more than one scope.
22458 ///
22459 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22460 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22461 /// sufficient, a read-write scope will do as well.
22462 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
22463 where
22464 St: AsRef<str>,
22465 {
22466 self._scopes.insert(String::from(scope.as_ref()));
22467 self
22468 }
22469 /// Identifies the authorization scope(s) for the method you are building.
22470 ///
22471 /// See [`Self::add_scope()`] for details.
22472 pub fn add_scopes<I, St>(
22473 mut self,
22474 scopes: I,
22475 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
22476 where
22477 I: IntoIterator<Item = St>,
22478 St: AsRef<str>,
22479 {
22480 self._scopes
22481 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22482 self
22483 }
22484
22485 /// Removes all scopes, and no default scope will be used either.
22486 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22487 /// for details).
22488 pub fn clear_scopes(mut self) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
22489 self._scopes.clear();
22490 self
22491 }
22492}
22493
22494/// Lists information about the supported locations for this service.
22495///
22496/// A builder for the *locations.list* method supported by a *project* resource.
22497/// It is not used directly, but through a [`ProjectMethods`] instance.
22498///
22499/// # Example
22500///
22501/// Instantiate a resource method builder
22502///
22503/// ```test_harness,no_run
22504/// # extern crate hyper;
22505/// # extern crate hyper_rustls;
22506/// # extern crate google_run1 as run1;
22507/// # async fn dox() {
22508/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22509///
22510/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22512/// # secret,
22513/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22514/// # ).build().await.unwrap();
22515///
22516/// # let client = hyper_util::client::legacy::Client::builder(
22517/// # hyper_util::rt::TokioExecutor::new()
22518/// # )
22519/// # .build(
22520/// # hyper_rustls::HttpsConnectorBuilder::new()
22521/// # .with_native_roots()
22522/// # .unwrap()
22523/// # .https_or_http()
22524/// # .enable_http1()
22525/// # .build()
22526/// # );
22527/// # let mut hub = CloudRun::new(client, auth);
22528/// // You can configure optional parameters by calling the respective setters at will, and
22529/// // execute the final call using `doit()`.
22530/// // Values shown here are possibly random and not representative !
22531/// let result = hub.projects().locations_list("name")
22532/// .page_token("sadipscing")
22533/// .page_size(-87)
22534/// .filter("rebum.")
22535/// .doit().await;
22536/// # }
22537/// ```
22538pub struct ProjectLocationListCall<'a, C>
22539where
22540 C: 'a,
22541{
22542 hub: &'a CloudRun<C>,
22543 _name: String,
22544 _page_token: Option<String>,
22545 _page_size: Option<i32>,
22546 _filter: Option<String>,
22547 _delegate: Option<&'a mut dyn common::Delegate>,
22548 _additional_params: HashMap<String, String>,
22549 _scopes: BTreeSet<String>,
22550}
22551
22552impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
22553
22554impl<'a, C> ProjectLocationListCall<'a, C>
22555where
22556 C: common::Connector,
22557{
22558 /// Perform the operation you have build so far.
22559 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
22560 use std::borrow::Cow;
22561 use std::io::{Read, Seek};
22562
22563 use common::{url::Params, ToParts};
22564 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22565
22566 let mut dd = common::DefaultDelegate;
22567 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22568 dlg.begin(common::MethodInfo {
22569 id: "run.projects.locations.list",
22570 http_method: hyper::Method::GET,
22571 });
22572
22573 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
22574 if self._additional_params.contains_key(field) {
22575 dlg.finished(false);
22576 return Err(common::Error::FieldClash(field));
22577 }
22578 }
22579
22580 let mut params = Params::with_capacity(6 + self._additional_params.len());
22581 params.push("name", self._name);
22582 if let Some(value) = self._page_token.as_ref() {
22583 params.push("pageToken", value);
22584 }
22585 if let Some(value) = self._page_size.as_ref() {
22586 params.push("pageSize", value.to_string());
22587 }
22588 if let Some(value) = self._filter.as_ref() {
22589 params.push("filter", value);
22590 }
22591
22592 params.extend(self._additional_params.iter());
22593
22594 params.push("alt", "json");
22595 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
22596 if self._scopes.is_empty() {
22597 self._scopes
22598 .insert(Scope::CloudPlatform.as_ref().to_string());
22599 }
22600
22601 #[allow(clippy::single_element_loop)]
22602 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22603 url = params.uri_replacement(url, param_name, find_this, true);
22604 }
22605 {
22606 let to_remove = ["name"];
22607 params.remove_params(&to_remove);
22608 }
22609
22610 let url = params.parse_with_url(&url);
22611
22612 loop {
22613 let token = match self
22614 .hub
22615 .auth
22616 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22617 .await
22618 {
22619 Ok(token) => token,
22620 Err(e) => match dlg.token(e) {
22621 Ok(token) => token,
22622 Err(e) => {
22623 dlg.finished(false);
22624 return Err(common::Error::MissingToken(e));
22625 }
22626 },
22627 };
22628 let mut req_result = {
22629 let client = &self.hub.client;
22630 dlg.pre_request();
22631 let mut req_builder = hyper::Request::builder()
22632 .method(hyper::Method::GET)
22633 .uri(url.as_str())
22634 .header(USER_AGENT, self.hub._user_agent.clone());
22635
22636 if let Some(token) = token.as_ref() {
22637 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22638 }
22639
22640 let request = req_builder
22641 .header(CONTENT_LENGTH, 0_u64)
22642 .body(common::to_body::<String>(None));
22643
22644 client.request(request.unwrap()).await
22645 };
22646
22647 match req_result {
22648 Err(err) => {
22649 if let common::Retry::After(d) = dlg.http_error(&err) {
22650 sleep(d).await;
22651 continue;
22652 }
22653 dlg.finished(false);
22654 return Err(common::Error::HttpError(err));
22655 }
22656 Ok(res) => {
22657 let (mut parts, body) = res.into_parts();
22658 let mut body = common::Body::new(body);
22659 if !parts.status.is_success() {
22660 let bytes = common::to_bytes(body).await.unwrap_or_default();
22661 let error = serde_json::from_str(&common::to_string(&bytes));
22662 let response = common::to_response(parts, bytes.into());
22663
22664 if let common::Retry::After(d) =
22665 dlg.http_failure(&response, error.as_ref().ok())
22666 {
22667 sleep(d).await;
22668 continue;
22669 }
22670
22671 dlg.finished(false);
22672
22673 return Err(match error {
22674 Ok(value) => common::Error::BadRequest(value),
22675 _ => common::Error::Failure(response),
22676 });
22677 }
22678 let response = {
22679 let bytes = common::to_bytes(body).await.unwrap_or_default();
22680 let encoded = common::to_string(&bytes);
22681 match serde_json::from_str(&encoded) {
22682 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22683 Err(error) => {
22684 dlg.response_json_decode_error(&encoded, &error);
22685 return Err(common::Error::JsonDecodeError(
22686 encoded.to_string(),
22687 error,
22688 ));
22689 }
22690 }
22691 };
22692
22693 dlg.finished(true);
22694 return Ok(response);
22695 }
22696 }
22697 }
22698 }
22699
22700 /// The resource that owns the locations collection, if applicable.
22701 ///
22702 /// Sets the *name* path property to the given value.
22703 ///
22704 /// Even though the property as already been set when instantiating this call,
22705 /// we provide this method for API completeness.
22706 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22707 self._name = new_value.to_string();
22708 self
22709 }
22710 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
22711 ///
22712 /// Sets the *page token* query property to the given value.
22713 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22714 self._page_token = Some(new_value.to_string());
22715 self
22716 }
22717 /// The maximum number of results to return. If not set, the service selects a default.
22718 ///
22719 /// Sets the *page size* query property to the given value.
22720 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
22721 self._page_size = Some(new_value);
22722 self
22723 }
22724 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
22725 ///
22726 /// Sets the *filter* query property to the given value.
22727 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22728 self._filter = Some(new_value.to_string());
22729 self
22730 }
22731 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22732 /// while executing the actual API request.
22733 ///
22734 /// ````text
22735 /// It should be used to handle progress information, and to implement a certain level of resilience.
22736 /// ````
22737 ///
22738 /// Sets the *delegate* property to the given value.
22739 pub fn delegate(
22740 mut self,
22741 new_value: &'a mut dyn common::Delegate,
22742 ) -> ProjectLocationListCall<'a, C> {
22743 self._delegate = Some(new_value);
22744 self
22745 }
22746
22747 /// Set any additional parameter of the query string used in the request.
22748 /// It should be used to set parameters which are not yet available through their own
22749 /// setters.
22750 ///
22751 /// Please note that this method must not be used to set any of the known parameters
22752 /// which have their own setter method. If done anyway, the request will fail.
22753 ///
22754 /// # Additional Parameters
22755 ///
22756 /// * *$.xgafv* (query-string) - V1 error format.
22757 /// * *access_token* (query-string) - OAuth access token.
22758 /// * *alt* (query-string) - Data format for response.
22759 /// * *callback* (query-string) - JSONP
22760 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22761 /// * *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.
22762 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22763 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22764 /// * *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.
22765 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22766 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22767 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
22768 where
22769 T: AsRef<str>,
22770 {
22771 self._additional_params
22772 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22773 self
22774 }
22775
22776 /// Identifies the authorization scope for the method you are building.
22777 ///
22778 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22779 /// [`Scope::CloudPlatform`].
22780 ///
22781 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22782 /// tokens for more than one scope.
22783 ///
22784 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22785 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22786 /// sufficient, a read-write scope will do as well.
22787 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
22788 where
22789 St: AsRef<str>,
22790 {
22791 self._scopes.insert(String::from(scope.as_ref()));
22792 self
22793 }
22794 /// Identifies the authorization scope(s) for the method you are building.
22795 ///
22796 /// See [`Self::add_scope()`] for details.
22797 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
22798 where
22799 I: IntoIterator<Item = St>,
22800 St: AsRef<str>,
22801 {
22802 self._scopes
22803 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22804 self
22805 }
22806
22807 /// Removes all scopes, and no default scope will be used either.
22808 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22809 /// for details).
22810 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
22811 self._scopes.clear();
22812 self
22813 }
22814}