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 connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = CloudRun::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.namespaces().domainmappings_delete("name")
93/// .propagation_policy("duo")
94/// .kind("ipsum")
95/// .dry_run("gubergren")
96/// .api_version("Lorem")
97/// .doit().await;
98///
99/// match result {
100/// Err(e) => match e {
101/// // The Error enum provides details about what exactly happened.
102/// // You can also just use its `Debug`, `Display` or `Error` traits
103/// Error::HttpError(_)
104/// |Error::Io(_)
105/// |Error::MissingAPIKey
106/// |Error::MissingToken(_)
107/// |Error::Cancelled
108/// |Error::UploadSizeLimitExceeded(_, _)
109/// |Error::Failure(_)
110/// |Error::BadRequest(_)
111/// |Error::FieldClash(_)
112/// |Error::JsonDecodeError(_, _) => println!("{}", e),
113/// },
114/// Ok(res) => println!("Success: {:?}", res),
115/// }
116/// # }
117/// ```
118#[derive(Clone)]
119pub struct CloudRun<C> {
120 pub client: common::Client<C>,
121 pub auth: Box<dyn common::GetToken>,
122 _user_agent: String,
123 _base_url: String,
124 _root_url: String,
125}
126
127impl<C> common::Hub for CloudRun<C> {}
128
129impl<'a, C> CloudRun<C> {
130 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudRun<C> {
131 CloudRun {
132 client,
133 auth: Box::new(auth),
134 _user_agent: "google-api-rust-client/7.0.0".to_string(),
135 _base_url: "https://run.googleapis.com/".to_string(),
136 _root_url: "https://run.googleapis.com/".to_string(),
137 }
138 }
139
140 pub fn namespaces(&'a self) -> NamespaceMethods<'a, C> {
141 NamespaceMethods { hub: self }
142 }
143 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
144 ProjectMethods { hub: self }
145 }
146
147 /// Set the user-agent header field to use in all requests to the server.
148 /// It defaults to `google-api-rust-client/7.0.0`.
149 ///
150 /// Returns the previously set user-agent.
151 pub fn user_agent(&mut self, agent_name: String) -> String {
152 std::mem::replace(&mut self._user_agent, agent_name)
153 }
154
155 /// Set the base url to use in all requests to the server.
156 /// It defaults to `https://run.googleapis.com/`.
157 ///
158 /// Returns the previously set base url.
159 pub fn base_url(&mut self, new_base_url: String) -> String {
160 std::mem::replace(&mut self._base_url, new_base_url)
161 }
162
163 /// Set the root url to use in all requests to the server.
164 /// It defaults to `https://run.googleapis.com/`.
165 ///
166 /// Returns the previously set root url.
167 pub fn root_url(&mut self, new_root_url: String) -> String {
168 std::mem::replace(&mut self._root_url, new_root_url)
169 }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// Information for connecting over HTTP(s).
176///
177/// This type is not used in any activity, and only used as *part* of another schema.
178///
179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
180#[serde_with::serde_as]
181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
182pub struct Addressable {
183 /// no description provided
184 pub url: Option<String>,
185}
186
187impl common::Part for Addressable {}
188
189/// 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.
190///
191/// This type is not used in any activity, and only used as *part* of another schema.
192///
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct AuditConfig {
197 /// The configuration for logging of each type of permission.
198 #[serde(rename = "auditLogConfigs")]
199 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
200 /// 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.
201 pub service: Option<String>,
202}
203
204impl common::Part for AuditConfig {}
205
206/// 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.
207///
208/// This type is not used in any activity, and only used as *part* of another schema.
209///
210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
211#[serde_with::serde_as]
212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
213pub struct AuditLogConfig {
214 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
215 #[serde(rename = "exemptedMembers")]
216 pub exempted_members: Option<Vec<String>>,
217 /// The log type that this config enables.
218 #[serde(rename = "logType")]
219 pub log_type: Option<String>,
220}
221
222impl common::Part for AuditLogConfig {}
223
224/// 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).
225///
226/// This type is not used in any activity, and only used as *part* of another schema.
227///
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct AuthorizedDomain {
232 /// Relative name of the domain authorized for use. Example: `example.com`.
233 pub id: Option<String>,
234 /// Deprecated Read only. Full path to the `AuthorizedDomain` resource in the API. Example: `projects/myproject/authorizedDomains/example.com`.
235 pub name: Option<String>,
236}
237
238impl common::Part for AuthorizedDomain {}
239
240/// Associates `members`, or principals, with a `role`.
241///
242/// This type is not used in any activity, and only used as *part* of another schema.
243///
244#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
245#[serde_with::serde_as]
246#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
247pub struct Binding {
248 /// 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).
249 pub condition: Option<Expr>,
250 /// 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`.
251 pub members: Option<Vec<String>>,
252 /// 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).
253 pub role: Option<String>,
254}
255
256impl common::Part for Binding {}
257
258/// Storage volume source using the Container Storage Interface.
259///
260/// This type is not used in any activity, and only used as *part* of another schema.
261///
262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
263#[serde_with::serde_as]
264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
265pub struct CSIVolumeSource {
266 /// 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.
267 pub driver: Option<String>,
268 /// If true, mount the volume as read only. Defaults to false.
269 #[serde(rename = "readOnly")]
270 pub read_only: Option<bool>,
271 /// 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. * mountOptions: comma-separated list of mount options to pass to the gcsfuse.
272 #[serde(rename = "volumeAttributes")]
273 pub volume_attributes: Option<HashMap<String, String>>,
274}
275
276impl common::Part for CSIVolumeSource {}
277
278/// Request message for cancelling an execution.
279///
280/// # Activities
281///
282/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
283/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
284///
285/// * [executions cancel namespaces](NamespaceExecutionCancelCall) (request)
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct CancelExecutionRequest {
290 _never_set: Option<bool>,
291}
292
293impl common::RequestValue for CancelExecutionRequest {}
294
295/// 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.
296///
297/// This type is not used in any activity, and only used as *part* of another schema.
298///
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct ConfigMapEnvSource {
303 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
304 #[serde(rename = "localObjectReference")]
305 pub local_object_reference: Option<LocalObjectReference>,
306 /// The ConfigMap to select from.
307 pub name: Option<String>,
308 /// Specify whether the ConfigMap must be defined.
309 pub optional: Option<bool>,
310}
311
312impl common::Part for ConfigMapEnvSource {}
313
314/// Not supported by Cloud Run.
315///
316/// This type is not used in any activity, and only used as *part* of another schema.
317///
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct ConfigMapKeySelector {
322 /// Required. Not supported by Cloud Run.
323 pub key: Option<String>,
324 /// Not supported by Cloud Run.
325 #[serde(rename = "localObjectReference")]
326 pub local_object_reference: Option<LocalObjectReference>,
327 /// Required. Not supported by Cloud Run.
328 pub name: Option<String>,
329 /// Not supported by Cloud Run.
330 pub optional: Option<bool>,
331}
332
333impl common::Part for ConfigMapKeySelector {}
334
335/// 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.
336///
337/// This type is not used in any activity, and only used as *part* of another schema.
338///
339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
340#[serde_with::serde_as]
341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
342pub struct ConfigMapVolumeSource {
343 /// (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.
344 #[serde(rename = "defaultMode")]
345 pub default_mode: Option<i32>,
346 /// (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.
347 pub items: Option<Vec<KeyToPath>>,
348 /// Name of the config.
349 pub name: Option<String>,
350 /// (Optional) Specify whether the Secret or its keys must be defined.
351 pub optional: Option<bool>,
352}
353
354impl common::Part for ConfigMapVolumeSource {}
355
356/// 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.
357///
358/// # Activities
359///
360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
362///
363/// * [configurations get namespaces](NamespaceConfigurationGetCall) (response)
364/// * [locations configurations get projects](ProjectLocationConfigurationGetCall) (response)
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct Configuration {
369 /// The API version for this call such as "serving.knative.dev/v1".
370 #[serde(rename = "apiVersion")]
371 pub api_version: Option<String>,
372 /// The kind of resource, in this case always "Configuration".
373 pub kind: Option<String>,
374 /// Metadata associated with this Configuration, including name, namespace, labels, and annotations.
375 pub metadata: Option<ObjectMeta>,
376 /// Spec holds the desired state of the Configuration (from the client).
377 pub spec: Option<ConfigurationSpec>,
378 /// Status communicates the observed state of the Configuration (from the controller).
379 pub status: Option<ConfigurationStatus>,
380}
381
382impl common::ResponseResult for Configuration {}
383
384/// ConfigurationSpec holds the desired state of the Configuration (from the client).
385///
386/// This type is not used in any activity, and only used as *part* of another schema.
387///
388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
389#[serde_with::serde_as]
390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
391pub struct ConfigurationSpec {
392 /// Template holds the latest specification for the Revision to be stamped out.
393 pub template: Option<RevisionTemplate>,
394}
395
396impl common::Part for ConfigurationSpec {}
397
398/// ConfigurationStatus communicates the observed state of the Configuration (from the controller).
399///
400/// This type is not used in any activity, and only used as *part* of another schema.
401///
402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
403#[serde_with::serde_as]
404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
405pub struct ConfigurationStatus {
406 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world.
407 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
408 /// 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.
409 #[serde(rename = "latestCreatedRevisionName")]
410 pub latest_created_revision_name: Option<String>,
411 /// LatestReadyRevisionName holds the name of the latest Revision stamped out from this Configuration that has had its "Ready" condition become "True".
412 #[serde(rename = "latestReadyRevisionName")]
413 pub latest_ready_revision_name: Option<String>,
414 /// 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.
415 #[serde(rename = "observedGeneration")]
416 pub observed_generation: Option<i32>,
417}
418
419impl common::Part for ConfigurationStatus {}
420
421/// 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.
422///
423/// This type is not used in any activity, and only used as *part* of another schema.
424///
425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
426#[serde_with::serde_as]
427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
428pub struct Container {
429 /// Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references are not supported in Cloud Run.
430 pub args: Option<Vec<String>>,
431 /// 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.
432 pub command: Option<Vec<String>>,
433 /// 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.
434 pub env: Option<Vec<EnvVar>>,
435 /// Not supported by Cloud Run.
436 #[serde(rename = "envFrom")]
437 pub env_from: Option<Vec<EnvFromSource>>,
438 /// Required. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.
439 pub image: Option<String>,
440 /// Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
441 #[serde(rename = "imagePullPolicy")]
442 pub image_pull_policy: Option<String>,
443 /// Periodic probe of container liveness. Container will be restarted if the probe fails.
444 #[serde(rename = "livenessProbe")]
445 pub liveness_probe: Option<Probe>,
446 /// Name of the container specified as a DNS_LABEL (RFC 1123).
447 pub name: Option<String>,
448 /// 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.
449 pub ports: Option<Vec<ContainerPort>>,
450 /// Readiness probe to be used for health checks.
451 #[serde(rename = "readinessProbe")]
452 pub readiness_probe: Option<Probe>,
453 /// Compute Resources required by this container.
454 pub resources: Option<ResourceRequirements>,
455 /// Not supported by Cloud Run.
456 #[serde(rename = "securityContext")]
457 pub security_context: Option<SecurityContext>,
458 /// 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.
459 #[serde(rename = "startupProbe")]
460 pub startup_probe: Option<Probe>,
461 /// 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.
462 #[serde(rename = "terminationMessagePath")]
463 pub termination_message_path: Option<String>,
464 /// 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.
465 #[serde(rename = "terminationMessagePolicy")]
466 pub termination_message_policy: Option<String>,
467 /// Volume to mount into the container's filesystem. Only supports SecretVolumeSources. Pod volumes to mount into the container's filesystem.
468 #[serde(rename = "volumeMounts")]
469 pub volume_mounts: Option<Vec<VolumeMount>>,
470 /// Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.
471 #[serde(rename = "workingDir")]
472 pub working_dir: Option<String>,
473}
474
475impl common::Part for Container {}
476
477/// Per container override specification.
478///
479/// This type is not used in any activity, and only used as *part* of another schema.
480///
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct ContainerOverride {
485 /// Arguments to the entrypoint. The specified arguments replace and override any existing entrypoint arguments. Must be empty if `clear_args` is set to true.
486 pub args: Option<Vec<String>>,
487 /// Optional. Set to True to clear all existing arguments.
488 #[serde(rename = "clearArgs")]
489 pub clear_args: Option<bool>,
490 /// 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.
491 pub env: Option<Vec<EnvVar>>,
492 /// The name of the container specified as a DNS_LABEL.
493 pub name: Option<String>,
494}
495
496impl common::Part for ContainerOverride {}
497
498/// ContainerPort represents a network port in a single container.
499///
500/// This type is not used in any activity, and only used as *part* of another schema.
501///
502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
503#[serde_with::serde_as]
504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
505pub struct ContainerPort {
506 /// 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
507 #[serde(rename = "containerPort")]
508 pub container_port: Option<i32>,
509 /// If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c".
510 pub name: Option<String>,
511 /// Protocol for port. Must be "TCP". Defaults to "TCP".
512 pub protocol: Option<String>,
513}
514
515impl common::Part for ContainerPort {}
516
517/// Resource to hold the state and status of a user’s domain mapping. NOTE: This resource is currently in Beta.
518///
519/// # Activities
520///
521/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
522/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
523///
524/// * [domainmappings create namespaces](NamespaceDomainmappingCreateCall) (request|response)
525/// * [domainmappings get namespaces](NamespaceDomainmappingGetCall) (response)
526/// * [locations domainmappings create projects](ProjectLocationDomainmappingCreateCall) (request|response)
527/// * [locations domainmappings get projects](ProjectLocationDomainmappingGetCall) (response)
528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
529#[serde_with::serde_as]
530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
531pub struct DomainMapping {
532 /// The API version for this call such as "domains.cloudrun.com/v1".
533 #[serde(rename = "apiVersion")]
534 pub api_version: Option<String>,
535 /// The kind of resource, in this case "DomainMapping".
536 pub kind: Option<String>,
537 /// Metadata associated with this BuildTemplate.
538 pub metadata: Option<ObjectMeta>,
539 /// The spec for this DomainMapping.
540 pub spec: Option<DomainMappingSpec>,
541 /// The current status of the DomainMapping.
542 pub status: Option<DomainMappingStatus>,
543}
544
545impl common::RequestValue for DomainMapping {}
546impl common::ResponseResult for DomainMapping {}
547
548/// The desired state of the Domain Mapping.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct DomainMappingSpec {
556 /// The mode of the certificate.
557 #[serde(rename = "certificateMode")]
558 pub certificate_mode: Option<String>,
559 /// 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.
560 #[serde(rename = "forceOverride")]
561 pub force_override: Option<bool>,
562 /// The name of the Knative Route that this DomainMapping applies to. The route must exist.
563 #[serde(rename = "routeName")]
564 pub route_name: Option<String>,
565}
566
567impl common::Part for DomainMappingSpec {}
568
569/// The current state of the Domain Mapping.
570///
571/// This type is not used in any activity, and only used as *part* of another schema.
572///
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct DomainMappingStatus {
577 /// Array of observed DomainMappingConditions, indicating the current state of the DomainMapping.
578 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
579 /// The name of the route that the mapping currently points to.
580 #[serde(rename = "mappedRouteName")]
581 pub mapped_route_name: Option<String>,
582 /// 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.
583 #[serde(rename = "observedGeneration")]
584 pub observed_generation: Option<i32>,
585 /// 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.
586 #[serde(rename = "resourceRecords")]
587 pub resource_records: Option<Vec<ResourceRecord>>,
588 /// Optional. Not supported by Cloud Run.
589 pub url: Option<String>,
590}
591
592impl common::Part for DomainMappingStatus {}
593
594/// 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); }
595///
596/// # Activities
597///
598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
600///
601/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
603#[serde_with::serde_as]
604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
605pub struct Empty {
606 _never_set: Option<bool>,
607}
608
609impl common::ResponseResult for Empty {}
610
611/// 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).
612///
613/// This type is not used in any activity, and only used as *part* of another schema.
614///
615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
616#[serde_with::serde_as]
617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
618pub struct EmptyDirVolumeSource {
619 /// 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
620 pub medium: Option<String>,
621 /// 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
622 #[serde(rename = "sizeLimit")]
623 pub size_limit: Option<String>,
624}
625
626impl common::Part for EmptyDirVolumeSource {}
627
628/// Not supported by Cloud Run. EnvFromSource represents the source of a set of ConfigMaps
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct EnvFromSource {
636 /// The ConfigMap to select from
637 #[serde(rename = "configMapRef")]
638 pub config_map_ref: Option<ConfigMapEnvSource>,
639 /// An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.
640 pub prefix: Option<String>,
641 /// The Secret to select from
642 #[serde(rename = "secretRef")]
643 pub secret_ref: Option<SecretEnvSource>,
644}
645
646impl common::Part for EnvFromSource {}
647
648/// EnvVar represents an environment variable present in a Container.
649///
650/// This type is not used in any activity, and only used as *part* of another schema.
651///
652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
653#[serde_with::serde_as]
654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
655pub struct EnvVar {
656 /// Required. Name of the environment variable.
657 pub name: Option<String>,
658 /// Value of the environment variable. Defaults to "". Variable references are not supported in Cloud Run.
659 pub value: Option<String>,
660 /// Source for the environment variable's value. Only supports secret_key_ref. Cannot be used if value is not empty.
661 #[serde(rename = "valueFrom")]
662 pub value_from: Option<EnvVarSource>,
663}
664
665impl common::Part for EnvVar {}
666
667/// EnvVarSource represents a source for the value of an EnvVar.
668///
669/// This type is not used in any activity, and only used as *part* of another schema.
670///
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct EnvVarSource {
675 /// Not supported by Cloud Run. Not supported in Cloud Run.
676 #[serde(rename = "configMapKeyRef")]
677 pub config_map_key_ref: Option<ConfigMapKeySelector>,
678 /// Selects a key (version) of a secret in Secret Manager.
679 #[serde(rename = "secretKeyRef")]
680 pub secret_key_ref: Option<SecretKeySelector>,
681}
682
683impl common::Part for EnvVarSource {}
684
685/// Not supported by Cloud Run. ExecAction describes a "run in container" action.
686///
687/// This type is not used in any activity, and only used as *part* of another schema.
688///
689#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
690#[serde_with::serde_as]
691#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
692pub struct ExecAction {
693 /// 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.
694 pub command: Option<Vec<String>>,
695}
696
697impl common::Part for ExecAction {}
698
699/// Execution represents the configuration of a single execution. An execution is an immutable resource that references a container image which is run to completion.
700///
701/// # Activities
702///
703/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
704/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
705///
706/// * [executions cancel namespaces](NamespaceExecutionCancelCall) (response)
707/// * [executions get namespaces](NamespaceExecutionGetCall) (response)
708/// * [jobs run namespaces](NamespaceJobRunCall) (response)
709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
710#[serde_with::serde_as]
711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
712pub struct Execution {
713 /// 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.
714 #[serde(rename = "apiVersion")]
715 pub api_version: Option<String>,
716 /// 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.
717 pub kind: Option<String>,
718 /// Optional. Standard object's metadata.
719 pub metadata: Option<ObjectMeta>,
720 /// Optional. Specification of the desired behavior of an execution.
721 pub spec: Option<ExecutionSpec>,
722 /// Output only. Current status of an execution.
723 pub status: Option<ExecutionStatus>,
724}
725
726impl common::ResponseResult for Execution {}
727
728/// Reference to an Execution. Use /Executions.GetExecution with the given name to get full execution including the latest status.
729///
730/// This type is not used in any activity, and only used as *part* of another schema.
731///
732#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
733#[serde_with::serde_as]
734#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
735pub struct ExecutionReference {
736 /// Optional. Status for the execution completion.
737 #[serde(rename = "completionStatus")]
738 pub completion_status: Option<String>,
739 /// Optional. Completion timestamp of the execution.
740 #[serde(rename = "completionTimestamp")]
741 pub completion_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
742 /// Optional. Creation timestamp of the execution.
743 #[serde(rename = "creationTimestamp")]
744 pub creation_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
745 /// Optional. The read-only soft deletion timestamp of the execution.
746 #[serde(rename = "deletionTimestamp")]
747 pub deletion_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
748 /// Optional. Name of the execution.
749 pub name: Option<String>,
750}
751
752impl common::Part for ExecutionReference {}
753
754/// ExecutionSpec describes how the execution will look.
755///
756/// This type is not used in any activity, and only used as *part* of another schema.
757///
758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
759#[serde_with::serde_as]
760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
761pub struct ExecutionSpec {
762 /// Optional. Specifies the maximum desired number of tasks the execution should run at given time. When the job is run, if this field is 0 or unset, the maximum possible value will be used for that execution. The actual number of tasks running in steady state will be less than this number when there are fewer tasks waiting to be completed, i.e. when the work left to do is less than max parallelism.
763 pub parallelism: Option<i32>,
764 /// 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.
765 #[serde(rename = "taskCount")]
766 pub task_count: Option<i32>,
767 /// Optional. The template used to create tasks for this execution.
768 pub template: Option<TaskTemplateSpec>,
769}
770
771impl common::Part for ExecutionSpec {}
772
773/// ExecutionStatus represents the current state of an Execution.
774///
775/// This type is not used in any activity, and only used as *part* of another schema.
776///
777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
778#[serde_with::serde_as]
779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
780pub struct ExecutionStatus {
781 /// Optional. The number of tasks which reached phase Cancelled.
782 #[serde(rename = "cancelledCount")]
783 pub cancelled_count: Option<i32>,
784 /// 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
785 #[serde(rename = "completionTime")]
786 pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
787 /// 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.
788 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
789 /// Optional. The number of tasks which reached phase Failed.
790 #[serde(rename = "failedCount")]
791 pub failed_count: Option<i32>,
792 /// Optional. URI where logs for this execution can be found in Cloud Console.
793 #[serde(rename = "logUri")]
794 pub log_uri: Option<String>,
795 /// Optional. The 'generation' of the execution that was last processed by the controller.
796 #[serde(rename = "observedGeneration")]
797 pub observed_generation: Option<i32>,
798 /// Optional. The number of tasks which have retried at least once.
799 #[serde(rename = "retriedCount")]
800 pub retried_count: Option<i32>,
801 /// Optional. The number of actively running tasks.
802 #[serde(rename = "runningCount")]
803 pub running_count: Option<i32>,
804 /// 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.
805 #[serde(rename = "startTime")]
806 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
807 /// Optional. The number of tasks which reached phase Succeeded.
808 #[serde(rename = "succeededCount")]
809 pub succeeded_count: Option<i32>,
810}
811
812impl common::Part for ExecutionStatus {}
813
814/// ExecutionTemplateSpec describes the metadata and spec an Execution should have when created from a job.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct ExecutionTemplateSpec {
822 /// 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`.
823 pub metadata: Option<ObjectMeta>,
824 /// Required. ExecutionSpec holds the desired configuration for executions of this job.
825 pub spec: Option<ExecutionSpec>,
826}
827
828impl common::Part for ExecutionTemplateSpec {}
829
830/// 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.
831///
832/// This type is not used in any activity, and only used as *part* of another schema.
833///
834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
835#[serde_with::serde_as]
836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
837pub struct Expr {
838 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
839 pub description: Option<String>,
840 /// Textual representation of an expression in Common Expression Language syntax.
841 pub expression: Option<String>,
842 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
843 pub location: Option<String>,
844 /// 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.
845 pub title: Option<String>,
846}
847
848impl common::Part for Expr {}
849
850/// GRPCAction describes an action involving a GRPC port.
851///
852/// This type is not used in any activity, and only used as *part* of another schema.
853///
854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
855#[serde_with::serde_as]
856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
857pub struct GRPCAction {
858 /// Port number of the gRPC service. Number must be in the range 1 to 65535.
859 pub port: Option<i32>,
860 /// 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.
861 pub service: Option<String>,
862}
863
864impl common::Part for GRPCAction {}
865
866/// 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.
867///
868/// This type is not used in any activity, and only used as *part* of another schema.
869///
870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
871#[serde_with::serde_as]
872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
873pub struct GoogleCloudRunV1Condition {
874 /// Optional. Last time the condition transitioned from one status to another.
875 #[serde(rename = "lastTransitionTime")]
876 pub last_transition_time: Option<chrono::DateTime<chrono::offset::Utc>>,
877 /// Optional. Human readable message indicating details about the current status.
878 pub message: Option<String>,
879 /// 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.
880 pub reason: Option<String>,
881 /// Optional. How to interpret this condition. One of Error, Warning, or Info. Conditions of severity Info do not contribute to resource readiness.
882 pub severity: Option<String>,
883 /// Status of the condition, one of True, False, Unknown.
884 pub status: Option<String>,
885 /// 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.
886 #[serde(rename = "type")]
887 pub type_: Option<String>,
888}
889
890impl common::Part for GoogleCloudRunV1Condition {}
891
892/// The response message for Operations.ListOperations.
893///
894/// # Activities
895///
896/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
897/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
898///
899/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
901#[serde_with::serde_as]
902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
903pub struct GoogleLongrunningListOperationsResponse {
904 /// The standard List next-page token.
905 #[serde(rename = "nextPageToken")]
906 pub next_page_token: Option<String>,
907 /// A list of operations that matches the specified filter in the request.
908 pub operations: Option<Vec<GoogleLongrunningOperation>>,
909 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
910 pub unreachable: Option<Vec<String>>,
911}
912
913impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
914
915/// This resource represents a long-running operation that is the result of a network API call.
916///
917/// # Activities
918///
919/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
920/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
921///
922/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
923/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (response)
924#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
925#[serde_with::serde_as]
926#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
927pub struct GoogleLongrunningOperation {
928 /// 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.
929 pub done: Option<bool>,
930 /// The error result of the operation in case of failure or cancellation.
931 pub error: Option<GoogleRpcStatus>,
932 /// 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.
933 pub metadata: Option<HashMap<String, serde_json::Value>>,
934 /// 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}`.
935 pub name: Option<String>,
936 /// 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`.
937 pub response: Option<HashMap<String, serde_json::Value>>,
938}
939
940impl common::ResponseResult for GoogleLongrunningOperation {}
941
942/// The request message for Operations.WaitOperation.
943///
944/// # Activities
945///
946/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
947/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
948///
949/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (request)
950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
951#[serde_with::serde_as]
952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
953pub struct GoogleLongrunningWaitOperationRequest {
954 /// 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.
955 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
956 pub timeout: Option<chrono::Duration>,
957}
958
959impl common::RequestValue for GoogleLongrunningWaitOperationRequest {}
960
961/// 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).
962///
963/// This type is not used in any activity, and only used as *part* of another schema.
964///
965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
966#[serde_with::serde_as]
967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
968pub struct GoogleRpcStatus {
969 /// The status code, which should be an enum value of google.rpc.Code.
970 pub code: Option<i32>,
971 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
972 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
973 /// 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.
974 pub message: Option<String>,
975}
976
977impl common::Part for GoogleRpcStatus {}
978
979/// HTTPGetAction describes an action based on HTTP Get requests.
980///
981/// This type is not used in any activity, and only used as *part* of another schema.
982///
983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
984#[serde_with::serde_as]
985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
986pub struct HTTPGetAction {
987 /// Not supported by Cloud Run.
988 pub host: Option<String>,
989 /// Custom headers to set in the request. HTTP allows repeated headers.
990 #[serde(rename = "httpHeaders")]
991 pub http_headers: Option<Vec<HTTPHeader>>,
992 /// Path to access on the HTTP server.
993 pub path: Option<String>,
994 /// Port number to access on the container. Number must be in the range 1 to 65535.
995 pub port: Option<i32>,
996 /// Not supported by Cloud Run.
997 pub scheme: Option<String>,
998}
999
1000impl common::Part for HTTPGetAction {}
1001
1002/// HTTPHeader describes a custom header to be used in HTTP probes
1003///
1004/// This type is not used in any activity, and only used as *part* of another schema.
1005///
1006#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1007#[serde_with::serde_as]
1008#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1009pub struct HTTPHeader {
1010 /// Required. The header field name
1011 pub name: Option<String>,
1012 /// The header field value
1013 pub value: Option<String>,
1014}
1015
1016impl common::Part for HTTPHeader {}
1017
1018/// Holds a single instance split entry for the Worker. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.
1019///
1020/// This type is not used in any activity, and only used as *part* of another schema.
1021///
1022#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1023#[serde_with::serde_as]
1024#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1025pub struct InstanceSplit {
1026 /// Uses the "status.latestReadyRevisionName" to determine the instance split target. When it changes, workloads will automatically migrate from the prior "latest ready" revision to the new one.
1027 #[serde(rename = "latestRevision")]
1028 pub latest_revision: Option<bool>,
1029 /// Optional. Specifies percent of the instance split to this Revision. This defaults to zero if unspecified.
1030 pub percent: Option<i32>,
1031 /// Revision to which to assign this portion of instances.
1032 #[serde(rename = "revisionName")]
1033 pub revision_name: Option<String>,
1034}
1035
1036impl common::Part for InstanceSplit {}
1037
1038/// Job represents the configuration of a single job, which references a container image which is run to completion.
1039///
1040/// # Activities
1041///
1042/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1043/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1044///
1045/// * [jobs create namespaces](NamespaceJobCreateCall) (request|response)
1046/// * [jobs get namespaces](NamespaceJobGetCall) (response)
1047/// * [jobs replace job namespaces](NamespaceJobReplaceJobCall) (request|response)
1048#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1049#[serde_with::serde_as]
1050#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1051pub struct Job {
1052 /// 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.
1053 #[serde(rename = "apiVersion")]
1054 pub api_version: Option<String>,
1055 /// 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.
1056 pub kind: Option<String>,
1057 /// Optional. Standard object's metadata.
1058 pub metadata: Option<ObjectMeta>,
1059 /// Optional. Specification of the desired behavior of a job.
1060 pub spec: Option<JobSpec>,
1061 /// Output only. Current status of a job.
1062 pub status: Option<JobStatus>,
1063}
1064
1065impl common::RequestValue for Job {}
1066impl common::ResponseResult for Job {}
1067
1068/// JobSpec describes how the job will look.
1069///
1070/// This type is not used in any activity, and only used as *part* of another schema.
1071///
1072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1073#[serde_with::serde_as]
1074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1075pub struct JobSpec {
1076 /// 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.
1077 #[serde(rename = "runExecutionToken")]
1078 pub run_execution_token: Option<String>,
1079 /// 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.
1080 #[serde(rename = "startExecutionToken")]
1081 pub start_execution_token: Option<String>,
1082 /// Optional. Describes the execution that will be created when running a job.
1083 pub template: Option<ExecutionTemplateSpec>,
1084}
1085
1086impl common::Part for JobSpec {}
1087
1088/// JobStatus represents the current state of a Job.
1089///
1090/// This type is not used in any activity, and only used as *part* of another schema.
1091///
1092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1093#[serde_with::serde_as]
1094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1095pub struct JobStatus {
1096 /// 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.
1097 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1098 /// Number of executions created for this job.
1099 #[serde(rename = "executionCount")]
1100 pub execution_count: Option<i32>,
1101 /// A pointer to the most recently created execution for this job. This is set regardless of the eventual state of the execution.
1102 #[serde(rename = "latestCreatedExecution")]
1103 pub latest_created_execution: Option<ExecutionReference>,
1104 /// The 'generation' of the job that was last processed by the controller.
1105 #[serde(rename = "observedGeneration")]
1106 pub observed_generation: Option<i32>,
1107}
1108
1109impl common::Part for JobStatus {}
1110
1111/// Maps a string key to a path within a volume.
1112///
1113/// This type is not used in any activity, and only used as *part* of another schema.
1114///
1115#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1116#[serde_with::serde_as]
1117#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1118pub struct KeyToPath {
1119 /// 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.
1120 pub key: Option<String>,
1121 /// (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.
1122 pub mode: Option<i32>,
1123 /// 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 '..'.
1124 pub path: Option<String>,
1125}
1126
1127impl common::Part for KeyToPath {}
1128
1129/// A list of Authorized Domains.
1130///
1131/// # Activities
1132///
1133/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1134/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1135///
1136/// * [authorizeddomains list namespaces](NamespaceAuthorizeddomainListCall) (response)
1137/// * [authorizeddomains list projects](ProjectAuthorizeddomainListCall) (response)
1138/// * [locations authorizeddomains list projects](ProjectLocationAuthorizeddomainListCall) (response)
1139#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1140#[serde_with::serde_as]
1141#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1142pub struct ListAuthorizedDomainsResponse {
1143 /// The authorized domains belonging to the user.
1144 pub domains: Option<Vec<AuthorizedDomain>>,
1145 /// Continuation token for fetching the next page of results.
1146 #[serde(rename = "nextPageToken")]
1147 pub next_page_token: Option<String>,
1148}
1149
1150impl common::ResponseResult for ListAuthorizedDomainsResponse {}
1151
1152/// ListConfigurationsResponse is a list of Configuration resources.
1153///
1154/// # Activities
1155///
1156/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1157/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1158///
1159/// * [configurations list namespaces](NamespaceConfigurationListCall) (response)
1160/// * [locations configurations list projects](ProjectLocationConfigurationListCall) (response)
1161#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1162#[serde_with::serde_as]
1163#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1164pub struct ListConfigurationsResponse {
1165 /// The API version for this call such as "serving.knative.dev/v1".
1166 #[serde(rename = "apiVersion")]
1167 pub api_version: Option<String>,
1168 /// List of Configurations.
1169 pub items: Option<Vec<Configuration>>,
1170 /// The kind of this resource, in this case "ConfigurationList".
1171 pub kind: Option<String>,
1172 /// Metadata associated with this Configuration list.
1173 pub metadata: Option<ListMeta>,
1174 /// Locations that could not be reached.
1175 pub unreachable: Option<Vec<String>>,
1176}
1177
1178impl common::ResponseResult for ListConfigurationsResponse {}
1179
1180/// ListDomainMappingsResponse is a list of DomainMapping resources.
1181///
1182/// # Activities
1183///
1184/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1185/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1186///
1187/// * [domainmappings list namespaces](NamespaceDomainmappingListCall) (response)
1188/// * [locations domainmappings list projects](ProjectLocationDomainmappingListCall) (response)
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct ListDomainMappingsResponse {
1193 /// The API version for this call such as "domains.cloudrun.com/v1".
1194 #[serde(rename = "apiVersion")]
1195 pub api_version: Option<String>,
1196 /// List of DomainMappings.
1197 pub items: Option<Vec<DomainMapping>>,
1198 /// The kind of this resource, in this case "DomainMappingList".
1199 pub kind: Option<String>,
1200 /// Metadata associated with this DomainMapping list.
1201 pub metadata: Option<ListMeta>,
1202 /// Locations that could not be reached.
1203 pub unreachable: Option<Vec<String>>,
1204}
1205
1206impl common::ResponseResult for ListDomainMappingsResponse {}
1207
1208/// ListExecutionsResponse is a list of Executions resources.
1209///
1210/// # Activities
1211///
1212/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1213/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1214///
1215/// * [executions list namespaces](NamespaceExecutionListCall) (response)
1216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1217#[serde_with::serde_as]
1218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1219pub struct ListExecutionsResponse {
1220 /// The API version for this call such as "run.googleapis.com/v1".
1221 #[serde(rename = "apiVersion")]
1222 pub api_version: Option<String>,
1223 /// List of Executions.
1224 pub items: Option<Vec<Execution>>,
1225 /// The kind of this resource, in this case "ExecutionsList".
1226 pub kind: Option<String>,
1227 /// Metadata associated with this executions list.
1228 pub metadata: Option<ListMeta>,
1229 /// Locations that could not be reached.
1230 pub unreachable: Option<Vec<String>>,
1231}
1232
1233impl common::ResponseResult for ListExecutionsResponse {}
1234
1235/// ListJobsResponse is a list of Jobs resources.
1236///
1237/// # Activities
1238///
1239/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1240/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1241///
1242/// * [jobs list namespaces](NamespaceJobListCall) (response)
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct ListJobsResponse {
1247 /// The API version for this call such as "run.googleapis.com/v1".
1248 #[serde(rename = "apiVersion")]
1249 pub api_version: Option<String>,
1250 /// List of Jobs.
1251 pub items: Option<Vec<Job>>,
1252 /// The kind of this resource, in this case "JobsList".
1253 pub kind: Option<String>,
1254 /// Metadata associated with this jobs list.
1255 pub metadata: Option<ListMeta>,
1256 /// Locations that could not be reached.
1257 pub unreachable: Option<Vec<String>>,
1258}
1259
1260impl common::ResponseResult for ListJobsResponse {}
1261
1262/// The response message for Locations.ListLocations.
1263///
1264/// # Activities
1265///
1266/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1267/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1268///
1269/// * [locations list projects](ProjectLocationListCall) (response)
1270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1271#[serde_with::serde_as]
1272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1273pub struct ListLocationsResponse {
1274 /// A list of locations that matches the specified filter in the request.
1275 pub locations: Option<Vec<Location>>,
1276 /// The standard List next-page token.
1277 #[serde(rename = "nextPageToken")]
1278 pub next_page_token: Option<String>,
1279}
1280
1281impl common::ResponseResult for ListLocationsResponse {}
1282
1283/// Metadata for synthetic resources like List. In Cloud Run, all List Resources Responses will have a ListMeta instead of ObjectMeta.
1284///
1285/// This type is not used in any activity, and only used as *part* of another schema.
1286///
1287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1288#[serde_with::serde_as]
1289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1290pub struct ListMeta {
1291 /// 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`.
1292 #[serde(rename = "continue")]
1293 pub continue_: Option<String>,
1294 /// 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.
1295 #[serde(rename = "resourceVersion")]
1296 pub resource_version: Option<String>,
1297 /// URL representing this object.
1298 #[serde(rename = "selfLink")]
1299 pub self_link: Option<String>,
1300}
1301
1302impl common::Part for ListMeta {}
1303
1304/// ListRevisionsResponse is a list of Revision resources.
1305///
1306/// # Activities
1307///
1308/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1309/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1310///
1311/// * [revisions list namespaces](NamespaceRevisionListCall) (response)
1312/// * [locations revisions list projects](ProjectLocationRevisionListCall) (response)
1313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1314#[serde_with::serde_as]
1315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1316pub struct ListRevisionsResponse {
1317 /// The API version for this call such as "serving.knative.dev/v1".
1318 #[serde(rename = "apiVersion")]
1319 pub api_version: Option<String>,
1320 /// List of Revisions.
1321 pub items: Option<Vec<Revision>>,
1322 /// The kind of this resource, in this case "RevisionList".
1323 pub kind: Option<String>,
1324 /// Metadata associated with this revision list.
1325 pub metadata: Option<ListMeta>,
1326 /// Locations that could not be reached.
1327 pub unreachable: Option<Vec<String>>,
1328}
1329
1330impl common::ResponseResult for ListRevisionsResponse {}
1331
1332/// ListRoutesResponse is a list of Route resources.
1333///
1334/// # Activities
1335///
1336/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1337/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1338///
1339/// * [routes list namespaces](NamespaceRouteListCall) (response)
1340/// * [locations routes list projects](ProjectLocationRouteListCall) (response)
1341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1342#[serde_with::serde_as]
1343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1344pub struct ListRoutesResponse {
1345 /// The API version for this call such as "serving.knative.dev/v1".
1346 #[serde(rename = "apiVersion")]
1347 pub api_version: Option<String>,
1348 /// List of Routes.
1349 pub items: Option<Vec<Route>>,
1350 /// The kind of this resource, in this case always "RouteList".
1351 pub kind: Option<String>,
1352 /// Metadata associated with this Route list.
1353 pub metadata: Option<ListMeta>,
1354 /// Locations that could not be reached.
1355 pub unreachable: Option<Vec<String>>,
1356}
1357
1358impl common::ResponseResult for ListRoutesResponse {}
1359
1360/// A list of Service resources.
1361///
1362/// # Activities
1363///
1364/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1365/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1366///
1367/// * [services list namespaces](NamespaceServiceListCall) (response)
1368/// * [locations services list projects](ProjectLocationServiceListCall) (response)
1369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1370#[serde_with::serde_as]
1371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1372pub struct ListServicesResponse {
1373 /// The API version for this call; returns "serving.knative.dev/v1".
1374 #[serde(rename = "apiVersion")]
1375 pub api_version: Option<String>,
1376 /// List of Services.
1377 pub items: Option<Vec<Service>>,
1378 /// The kind of this resource; returns "ServiceList".
1379 pub kind: Option<String>,
1380 /// Metadata associated with this Service list.
1381 pub metadata: Option<ListMeta>,
1382 /// 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.
1383 pub unreachable: Option<Vec<String>>,
1384}
1385
1386impl common::ResponseResult for ListServicesResponse {}
1387
1388/// ListTasksResponse is a list of Tasks resources.
1389///
1390/// # Activities
1391///
1392/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1393/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1394///
1395/// * [tasks list namespaces](NamespaceTaskListCall) (response)
1396#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1397#[serde_with::serde_as]
1398#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1399pub struct ListTasksResponse {
1400 /// The API version for this call such as "run.googleapis.com/v1".
1401 #[serde(rename = "apiVersion")]
1402 pub api_version: Option<String>,
1403 /// List of Tasks.
1404 pub items: Option<Vec<Task>>,
1405 /// The kind of this resource, in this case "TasksList".
1406 pub kind: Option<String>,
1407 /// Metadata associated with this tasks list.
1408 pub metadata: Option<ListMeta>,
1409 /// Locations that could not be reached.
1410 pub unreachable: Option<Vec<String>>,
1411}
1412
1413impl common::ResponseResult for ListTasksResponse {}
1414
1415/// A list of WorkerPool resources.
1416///
1417/// # Activities
1418///
1419/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1420/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1421///
1422/// * [workerpools list namespaces](NamespaceWorkerpoolListCall) (response)
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct ListWorkerPoolsResponse {
1427 /// The API version for this call; returns "run.googleapis.com/v1".
1428 #[serde(rename = "apiVersion")]
1429 pub api_version: Option<String>,
1430 /// List of WorkerPools.
1431 pub items: Option<Vec<WorkerPool>>,
1432 /// The kind of this resource; returns "WorkerPoolList".
1433 pub kind: Option<String>,
1434 /// Metadata associated with this WorkerPool list.
1435 pub metadata: Option<ListMeta>,
1436 /// 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.
1437 pub unreachable: Option<Vec<String>>,
1438}
1439
1440impl common::ResponseResult for ListWorkerPoolsResponse {}
1441
1442/// Not supported by Cloud Run. LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.
1443///
1444/// This type is not used in any activity, and only used as *part* of another schema.
1445///
1446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1447#[serde_with::serde_as]
1448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1449pub struct LocalObjectReference {
1450 /// Name of the referent.
1451 pub name: Option<String>,
1452}
1453
1454impl common::Part for LocalObjectReference {}
1455
1456/// A resource that represents a Google Cloud location.
1457///
1458/// This type is not used in any activity, and only used as *part* of another schema.
1459///
1460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1461#[serde_with::serde_as]
1462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1463pub struct Location {
1464 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1465 #[serde(rename = "displayName")]
1466 pub display_name: Option<String>,
1467 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1468 pub labels: Option<HashMap<String, String>>,
1469 /// The canonical id for this location. For example: `"us-east1"`.
1470 #[serde(rename = "locationId")]
1471 pub location_id: Option<String>,
1472 /// Service-specific metadata. For example the available capacity at the given location.
1473 pub metadata: Option<HashMap<String, serde_json::Value>>,
1474 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1475 pub name: Option<String>,
1476}
1477
1478impl common::Part for Location {}
1479
1480/// 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.
1481///
1482/// This type is not used in any activity, and only used as *part* of another schema.
1483///
1484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1485#[serde_with::serde_as]
1486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct NFSVolumeSource {
1488 /// Path that is exported by the NFS server.
1489 pub path: Option<String>,
1490 /// If true, mount the NFS volume as read only. Defaults to false.
1491 #[serde(rename = "readOnly")]
1492 pub read_only: Option<bool>,
1493 /// Hostname or IP address of the NFS server.
1494 pub server: Option<String>,
1495}
1496
1497impl common::Part for NFSVolumeSource {}
1498
1499/// google.cloud.run.meta.v1.ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
1500///
1501/// This type is not used in any activity, and only used as *part* of another schema.
1502///
1503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1504#[serde_with::serde_as]
1505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1506pub struct ObjectMeta {
1507 /// 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/base-images`: Service, Revision. * `run.googleapis.com/binary-authorization-breakglass`: Service, Job, * `run.googleapis.com/binary-authorization`: Service, Job, Execution. * `run.googleapis.com/build-base-image`: Service. * `run.googleapis.com/build-enable-automatic-updates`: Service. * `run.googleapis.com/build-environment-variables`: Service. * `run.googleapis.com/build-function-target`: Service. * `run.googleapis.com/build-id`: Service. * `run.googleapis.com/build-image-uri`: Service. * `run.googleapis.com/build-name`: Service. * `run.googleapis.com/build-service-account`: Service. * `run.googleapis.com/build-source-location`: Service. * `run.googleapis.com/build-worker-pool`: Service. * `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/gpu-zonal-redundancy-disabled`: Revision. * `run.googleapis.com/health-check-disabled`: Revision. * `run.googleapis.com/ingress`: Service. * `run.googleapis.com/launch-stage`: Service, Job. * `run.googleapis.com/minScale`: Service. * `run.googleapis.com/maxScale`: Service. * `run.googleapis.com/manualInstanceCount`: Service. * `run.googleapis.com/network-interfaces`: Revision, Execution. * `run.googleapis.com/post-key-revocation-action-type`: Revision. `run.googleapis.com/scalingMode`: Service. * `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.
1508 pub annotations: Option<HashMap<String, String>>,
1509 /// Not supported by Cloud Run
1510 #[serde(rename = "clusterName")]
1511 pub cluster_name: Option<String>,
1512 /// UTC timestamp representing the server time when this object was created.
1513 #[serde(rename = "creationTimestamp")]
1514 pub creation_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1515 /// Not supported by Cloud Run
1516 #[serde(rename = "deletionGracePeriodSeconds")]
1517 pub deletion_grace_period_seconds: Option<i32>,
1518 /// 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.
1519 #[serde(rename = "deletionTimestamp")]
1520 pub deletion_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1521 /// Not supported by Cloud Run
1522 pub finalizers: Option<Vec<String>>,
1523 /// Not supported by Cloud Run
1524 #[serde(rename = "generateName")]
1525 pub generate_name: Option<String>,
1526 /// A system-provided sequence number representing a specific generation of the desired state.
1527 pub generation: Option<i32>,
1528 /// 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.
1529 pub labels: Option<HashMap<String, String>>,
1530 /// 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.
1531 pub name: Option<String>,
1532 /// 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.
1533 pub namespace: Option<String>,
1534 /// Not supported by Cloud Run
1535 #[serde(rename = "ownerReferences")]
1536 pub owner_references: Option<Vec<OwnerReference>>,
1537 /// 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.
1538 #[serde(rename = "resourceVersion")]
1539 pub resource_version: Option<String>,
1540 /// URL representing this object.
1541 #[serde(rename = "selfLink")]
1542 pub self_link: Option<String>,
1543 /// Unique, system-generated identifier for this resource.
1544 pub uid: Option<String>,
1545}
1546
1547impl common::Part for ObjectMeta {}
1548
1549/// RunJob Overrides that contains Execution fields to be overridden on the go.
1550///
1551/// This type is not used in any activity, and only used as *part* of another schema.
1552///
1553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1554#[serde_with::serde_as]
1555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1556pub struct Overrides {
1557 /// Per container override specification.
1558 #[serde(rename = "containerOverrides")]
1559 pub container_overrides: Option<Vec<ContainerOverride>>,
1560 /// The desired number of tasks the execution should run. Will replace existing task_count value.
1561 #[serde(rename = "taskCount")]
1562 pub task_count: Option<i32>,
1563 /// 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.
1564 #[serde(rename = "timeoutSeconds")]
1565 pub timeout_seconds: Option<i32>,
1566}
1567
1568impl common::Part for Overrides {}
1569
1570/// This is not supported or used by Cloud Run.
1571///
1572/// This type is not used in any activity, and only used as *part* of another schema.
1573///
1574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1575#[serde_with::serde_as]
1576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1577pub struct OwnerReference {
1578 /// This is not supported or used by Cloud Run.
1579 #[serde(rename = "apiVersion")]
1580 pub api_version: Option<String>,
1581 /// This is not supported or used by Cloud Run.
1582 #[serde(rename = "blockOwnerDeletion")]
1583 pub block_owner_deletion: Option<bool>,
1584 /// This is not supported or used by Cloud Run.
1585 pub controller: Option<bool>,
1586 /// This is not supported or used by Cloud Run.
1587 pub kind: Option<String>,
1588 /// This is not supported or used by Cloud Run.
1589 pub name: Option<String>,
1590 /// This is not supported or used by Cloud Run.
1591 pub uid: Option<String>,
1592}
1593
1594impl common::Part for OwnerReference {}
1595
1596/// 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/).
1597///
1598/// # Activities
1599///
1600/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1601/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1602///
1603/// * [locations jobs get iam policy projects](ProjectLocationJobGetIamPolicyCall) (response)
1604/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (response)
1605/// * [locations services get iam policy projects](ProjectLocationServiceGetIamPolicyCall) (response)
1606/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (response)
1607/// * [locations workerpools get iam policy projects](ProjectLocationWorkerpoolGetIamPolicyCall) (response)
1608/// * [locations workerpools set iam policy projects](ProjectLocationWorkerpoolSetIamPolicyCall) (response)
1609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1610#[serde_with::serde_as]
1611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1612pub struct Policy {
1613 /// Specifies cloud audit logging configuration for this policy.
1614 #[serde(rename = "auditConfigs")]
1615 pub audit_configs: Option<Vec<AuditConfig>>,
1616 /// 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`.
1617 pub bindings: Option<Vec<Binding>>,
1618 /// `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.
1619 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1620 pub etag: Option<Vec<u8>>,
1621 /// 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).
1622 pub version: Option<i32>,
1623}
1624
1625impl common::ResponseResult for Policy {}
1626
1627/// Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.
1628///
1629/// This type is not used in any activity, and only used as *part* of another schema.
1630///
1631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1632#[serde_with::serde_as]
1633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1634pub struct Probe {
1635 /// Not supported by Cloud Run.
1636 pub exec: Option<ExecAction>,
1637 /// Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.
1638 #[serde(rename = "failureThreshold")]
1639 pub failure_threshold: Option<i32>,
1640 /// GRPCAction specifies an action involving a GRPC port.
1641 pub grpc: Option<GRPCAction>,
1642 /// HTTPGet specifies the http request to perform.
1643 #[serde(rename = "httpGet")]
1644 pub http_get: Option<HTTPGetAction>,
1645 /// 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.
1646 #[serde(rename = "initialDelaySeconds")]
1647 pub initial_delay_seconds: Option<i32>,
1648 /// 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.
1649 #[serde(rename = "periodSeconds")]
1650 pub period_seconds: Option<i32>,
1651 /// Minimum consecutive successes for the probe to be considered successful after having failed. Must be 1 if set.
1652 #[serde(rename = "successThreshold")]
1653 pub success_threshold: Option<i32>,
1654 /// TCPSocket specifies an action involving a TCP port.
1655 #[serde(rename = "tcpSocket")]
1656 pub tcp_socket: Option<TCPSocketAction>,
1657 /// 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.
1658 #[serde(rename = "timeoutSeconds")]
1659 pub timeout_seconds: Option<i32>,
1660}
1661
1662impl common::Part for Probe {}
1663
1664/// A DNS resource record.
1665///
1666/// This type is not used in any activity, and only used as *part* of another schema.
1667///
1668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1669#[serde_with::serde_as]
1670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1671pub struct ResourceRecord {
1672 /// Relative name of the object affected by this record. Only applicable for `CNAME` records. Example: 'www'.
1673 pub name: Option<String>,
1674 /// Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).
1675 pub rrdata: Option<String>,
1676 /// Resource record type. Example: `AAAA`.
1677 #[serde(rename = "type")]
1678 pub type_: Option<String>,
1679}
1680
1681impl common::Part for ResourceRecord {}
1682
1683/// ResourceRequirements describes the compute resource requirements.
1684///
1685/// This type is not used in any activity, and only used as *part* of another schema.
1686///
1687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1688#[serde_with::serde_as]
1689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1690pub struct ResourceRequirements {
1691 /// Limits describes the maximum amount of compute resources allowed. Only 'cpu', 'memory' and 'nvidia.com/gpu' 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. * The only supported 'nvidia.com/gpu' value is '1'.
1692 pub limits: Option<HashMap<String, String>>,
1693 /// 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
1694 pub requests: Option<HashMap<String, String>>,
1695}
1696
1697impl common::Part for ResourceRequirements {}
1698
1699/// 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
1700///
1701/// # Activities
1702///
1703/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1704/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1705///
1706/// * [revisions get namespaces](NamespaceRevisionGetCall) (response)
1707/// * [locations revisions get projects](ProjectLocationRevisionGetCall) (response)
1708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1709#[serde_with::serde_as]
1710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1711pub struct Revision {
1712 /// The API version for this call such as "serving.knative.dev/v1".
1713 #[serde(rename = "apiVersion")]
1714 pub api_version: Option<String>,
1715 /// The kind of this resource, in this case "Revision".
1716 pub kind: Option<String>,
1717 /// Metadata associated with this Revision, including name, namespace, labels, and annotations.
1718 pub metadata: Option<ObjectMeta>,
1719 /// Spec holds the desired state of the Revision (from the client).
1720 pub spec: Option<RevisionSpec>,
1721 /// Status communicates the observed state of the Revision (from the controller).
1722 pub status: Option<RevisionStatus>,
1723}
1724
1725impl common::ResponseResult for Revision {}
1726
1727/// RevisionSpec holds the desired state of the Revision (from the client).
1728///
1729/// This type is not used in any activity, and only used as *part* of another schema.
1730///
1731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1732#[serde_with::serde_as]
1733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1734pub struct RevisionSpec {
1735 /// ContainerConcurrency specifies the maximum allowed in-flight (concurrent) requests per container instance of the Revision. If not specified or 0, defaults to 80 when requested CPU >= 1 and defaults to 1 when requested CPU < 1.
1736 #[serde(rename = "containerConcurrency")]
1737 pub container_concurrency: Option<i32>,
1738 /// Required. Containers holds the list which define the units of execution for this Revision. In the context of a Revision, we disallow a number of fields on this Container, including: name and lifecycle.
1739 pub containers: Option<Vec<Container>>,
1740 /// Not supported by Cloud Run.
1741 #[serde(rename = "enableServiceLinks")]
1742 pub enable_service_links: Option<bool>,
1743 /// Not supported by Cloud Run.
1744 #[serde(rename = "imagePullSecrets")]
1745 pub image_pull_secrets: Option<Vec<LocalObjectReference>>,
1746 /// Optional. The Node Selector configuration. Map of selector key to a value which matches a node.
1747 #[serde(rename = "nodeSelector")]
1748 pub node_selector: Option<HashMap<String, String>>,
1749 /// Optional. Runtime. Leave unset for default.
1750 #[serde(rename = "runtimeClassName")]
1751 pub runtime_class_name: Option<String>,
1752 /// 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.
1753 #[serde(rename = "serviceAccountName")]
1754 pub service_account_name: Option<String>,
1755 /// Optional. 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).
1756 #[serde(rename = "timeoutSeconds")]
1757 pub timeout_seconds: Option<i32>,
1758 /// no description provided
1759 pub volumes: Option<Vec<Volume>>,
1760}
1761
1762impl common::Part for RevisionSpec {}
1763
1764/// RevisionStatus communicates the observed state of the Revision (from the controller).
1765///
1766/// This type is not used in any activity, and only used as *part* of another schema.
1767///
1768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1769#[serde_with::serde_as]
1770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1771pub struct RevisionStatus {
1772 /// 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.
1773 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1774 /// 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.
1775 #[serde(rename = "desiredReplicas")]
1776 pub desired_replicas: Option<i32>,
1777 /// 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.
1778 #[serde(rename = "imageDigest")]
1779 pub image_digest: Option<String>,
1780 /// Optional. Specifies the generated logging url for this particular revision based on the revision url template specified in the controller's config.
1781 #[serde(rename = "logUrl")]
1782 pub log_url: Option<String>,
1783 /// 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.
1784 #[serde(rename = "observedGeneration")]
1785 pub observed_generation: Option<i32>,
1786 /// Not currently used by Cloud Run.
1787 #[serde(rename = "serviceName")]
1788 pub service_name: Option<String>,
1789}
1790
1791impl common::Part for RevisionStatus {}
1792
1793/// RevisionTemplateSpec describes the data a revision should have when created from a template.
1794///
1795/// This type is not used in any activity, and only used as *part* of another schema.
1796///
1797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1798#[serde_with::serde_as]
1799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1800pub struct RevisionTemplate {
1801 /// 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/health-check-disabled`: if true, deploy-time startup probes will not run for this revision. * `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`.
1802 pub metadata: Option<ObjectMeta>,
1803 /// RevisionSpec holds the desired state of the Revision (from the client).
1804 pub spec: Option<RevisionSpec>,
1805}
1806
1807impl common::Part for RevisionTemplate {}
1808
1809/// 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.
1810///
1811/// # Activities
1812///
1813/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1814/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1815///
1816/// * [routes get namespaces](NamespaceRouteGetCall) (response)
1817/// * [locations routes get projects](ProjectLocationRouteGetCall) (response)
1818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1819#[serde_with::serde_as]
1820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1821pub struct Route {
1822 /// The API version for this call such as "serving.knative.dev/v1".
1823 #[serde(rename = "apiVersion")]
1824 pub api_version: Option<String>,
1825 /// The kind of this resource, in this case always "Route".
1826 pub kind: Option<String>,
1827 /// Metadata associated with this Route, including name, namespace, labels, and annotations.
1828 pub metadata: Option<ObjectMeta>,
1829 /// Spec holds the desired state of the Route (from the client).
1830 pub spec: Option<RouteSpec>,
1831 /// Status communicates the observed state of the Route (from the controller).
1832 pub status: Option<RouteStatus>,
1833}
1834
1835impl common::ResponseResult for Route {}
1836
1837/// RouteSpec holds the desired state of the Route (from the client).
1838///
1839/// This type is not used in any activity, and only used as *part* of another schema.
1840///
1841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1842#[serde_with::serde_as]
1843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1844pub struct RouteSpec {
1845 /// Traffic specifies how to distribute traffic over a collection of Knative Revisions and Configurations. Cloud Run currently supports a single configurationName.
1846 pub traffic: Option<Vec<TrafficTarget>>,
1847}
1848
1849impl common::Part for RouteSpec {}
1850
1851/// RouteStatus communicates the observed state of the Route (from the controller).
1852///
1853/// This type is not used in any activity, and only used as *part* of another schema.
1854///
1855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1856#[serde_with::serde_as]
1857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1858pub struct RouteStatus {
1859 /// Similar to url, information on where the service is available on HTTP.
1860 pub address: Option<Addressable>,
1861 /// Conditions communicates information about ongoing/complete reconciliation processes that bring the "spec" inline with the observed state of the world.
1862 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
1863 /// 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.
1864 #[serde(rename = "observedGeneration")]
1865 pub observed_generation: Option<i32>,
1866 /// 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.
1867 pub traffic: Option<Vec<TrafficTarget>>,
1868 /// 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`
1869 pub url: Option<String>,
1870}
1871
1872impl common::Part for RouteStatus {}
1873
1874/// Request message for creating a new execution of a job.
1875///
1876/// # Activities
1877///
1878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1880///
1881/// * [jobs run namespaces](NamespaceJobRunCall) (request)
1882#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1883#[serde_with::serde_as]
1884#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1885pub struct RunJobRequest {
1886 /// 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.
1887 pub overrides: Option<Overrides>,
1888}
1889
1890impl common::RequestValue for RunJobRequest {}
1891
1892/// 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.
1893///
1894/// This type is not used in any activity, and only used as *part* of another schema.
1895///
1896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1897#[serde_with::serde_as]
1898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1899pub struct SecretEnvSource {
1900 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
1901 #[serde(rename = "localObjectReference")]
1902 pub local_object_reference: Option<LocalObjectReference>,
1903 /// The Secret to select from.
1904 pub name: Option<String>,
1905 /// Specify whether the Secret must be defined
1906 pub optional: Option<bool>,
1907}
1908
1909impl common::Part for SecretEnvSource {}
1910
1911/// SecretKeySelector selects a key of a Secret.
1912///
1913/// This type is not used in any activity, and only used as *part* of another schema.
1914///
1915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1916#[serde_with::serde_as]
1917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1918pub struct SecretKeySelector {
1919 /// 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.
1920 pub key: Option<String>,
1921 /// This field should not be used directly as it is meant to be inlined directly into the message. Use the "name" field instead.
1922 #[serde(rename = "localObjectReference")]
1923 pub local_object_reference: Option<LocalObjectReference>,
1924 /// 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.
1925 pub name: Option<String>,
1926 /// Specify whether the Secret or its key must be defined.
1927 pub optional: Option<bool>,
1928}
1929
1930impl common::Part for SecretKeySelector {}
1931
1932/// 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.
1933///
1934/// This type is not used in any activity, and only used as *part* of another schema.
1935///
1936#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1937#[serde_with::serde_as]
1938#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1939pub struct SecretVolumeSource {
1940 /// 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.
1941 #[serde(rename = "defaultMode")]
1942 pub default_mode: Option<i32>,
1943 /// 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.
1944 pub items: Option<Vec<KeyToPath>>,
1945 /// Not supported by Cloud Run.
1946 pub optional: Option<bool>,
1947 /// 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.
1948 #[serde(rename = "secretName")]
1949 pub secret_name: Option<String>,
1950}
1951
1952impl common::Part for SecretVolumeSource {}
1953
1954/// 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.
1955///
1956/// This type is not used in any activity, and only used as *part* of another schema.
1957///
1958#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1959#[serde_with::serde_as]
1960#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1961pub struct SecurityContext {
1962 /// 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.
1963 #[serde(rename = "runAsUser")]
1964 pub run_as_user: Option<i32>,
1965}
1966
1967impl common::Part for SecurityContext {}
1968
1969/// 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.
1970///
1971/// # Activities
1972///
1973/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1974/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1975///
1976/// * [services create namespaces](NamespaceServiceCreateCall) (request|response)
1977/// * [services get namespaces](NamespaceServiceGetCall) (response)
1978/// * [services replace service namespaces](NamespaceServiceReplaceServiceCall) (request|response)
1979/// * [locations services create projects](ProjectLocationServiceCreateCall) (request|response)
1980/// * [locations services get projects](ProjectLocationServiceGetCall) (response)
1981/// * [locations services replace service projects](ProjectLocationServiceReplaceServiceCall) (request|response)
1982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1983#[serde_with::serde_as]
1984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1985pub struct Service {
1986 /// The API version for this call. It must be "serving.knative.dev/v1".
1987 #[serde(rename = "apiVersion")]
1988 pub api_version: Option<String>,
1989 /// The kind of resource. It must be "Service".
1990 pub kind: Option<String>,
1991 /// 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.
1992 pub metadata: Option<ObjectMeta>,
1993 /// Holds the desired state of the Service (from the client).
1994 pub spec: Option<ServiceSpec>,
1995 /// Communicates the system-controlled state of the Service.
1996 pub status: Option<ServiceStatus>,
1997}
1998
1999impl common::RequestValue for Service {}
2000impl common::ResponseResult for Service {}
2001
2002/// ServiceSpec holds the desired state of the Route (from the client), which is used to manipulate the underlying Route and Configuration(s).
2003///
2004/// This type is not used in any activity, and only used as *part* of another schema.
2005///
2006#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2007#[serde_with::serde_as]
2008#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2009pub struct ServiceSpec {
2010 /// Holds the latest specification for the Revision to be stamped out.
2011 pub template: Option<RevisionTemplate>,
2012 /// Specifies how to distribute traffic over a collection of Knative Revisions and Configurations to the Service's main URL.
2013 pub traffic: Option<Vec<TrafficTarget>>,
2014}
2015
2016impl common::Part for ServiceSpec {}
2017
2018/// The current state of the Service. Output only.
2019///
2020/// This type is not used in any activity, and only used as *part* of another schema.
2021///
2022#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2023#[serde_with::serde_as]
2024#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2025pub struct ServiceStatus {
2026 /// Similar to url, information on where the service is available on HTTP.
2027 pub address: Option<Addressable>,
2028 /// 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.
2029 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
2030 /// Name of the last revision that was created from this Service's Configuration. It might not be ready yet, for that use LatestReadyRevisionName.
2031 #[serde(rename = "latestCreatedRevisionName")]
2032 pub latest_created_revision_name: Option<String>,
2033 /// Name of the latest Revision from this Service's Configuration that has had its `Ready` condition become `True`.
2034 #[serde(rename = "latestReadyRevisionName")]
2035 pub latest_ready_revision_name: Option<String>,
2036 /// 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.
2037 #[serde(rename = "observedGeneration")]
2038 pub observed_generation: Option<i32>,
2039 /// 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.
2040 pub traffic: Option<Vec<TrafficTarget>>,
2041 /// 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`
2042 pub url: Option<String>,
2043}
2044
2045impl common::Part for ServiceStatus {}
2046
2047/// Request message for `SetIamPolicy` method.
2048///
2049/// # Activities
2050///
2051/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2052/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2053///
2054/// * [locations jobs set iam policy projects](ProjectLocationJobSetIamPolicyCall) (request)
2055/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (request)
2056/// * [locations workerpools set iam policy projects](ProjectLocationWorkerpoolSetIamPolicyCall) (request)
2057#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2058#[serde_with::serde_as]
2059#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2060pub struct SetIamPolicyRequest {
2061 /// 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.
2062 pub policy: Option<Policy>,
2063 /// 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"`
2064 #[serde(rename = "updateMask")]
2065 pub update_mask: Option<common::FieldMask>,
2066}
2067
2068impl common::RequestValue for SetIamPolicyRequest {}
2069
2070/// Status is a return value for calls that don’t return other objects.
2071///
2072/// # Activities
2073///
2074/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2075/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2076///
2077/// * [domainmappings delete namespaces](NamespaceDomainmappingDeleteCall) (response)
2078/// * [executions delete namespaces](NamespaceExecutionDeleteCall) (response)
2079/// * [jobs delete namespaces](NamespaceJobDeleteCall) (response)
2080/// * [revisions delete namespaces](NamespaceRevisionDeleteCall) (response)
2081/// * [services delete namespaces](NamespaceServiceDeleteCall) (response)
2082/// * [workerpools delete namespaces](NamespaceWorkerpoolDeleteCall) (response)
2083/// * [locations domainmappings delete projects](ProjectLocationDomainmappingDeleteCall) (response)
2084/// * [locations revisions delete projects](ProjectLocationRevisionDeleteCall) (response)
2085/// * [locations services delete projects](ProjectLocationServiceDeleteCall) (response)
2086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2087#[serde_with::serde_as]
2088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2089pub struct Status {
2090 /// Suggested HTTP return code for this status, 0 if not set.
2091 pub code: Option<i32>,
2092 /// 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.
2093 pub details: Option<StatusDetails>,
2094 /// A human-readable description of the status of this operation.
2095 pub message: Option<String>,
2096 /// Standard list metadata.
2097 pub metadata: Option<ListMeta>,
2098 /// 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.
2099 pub reason: Option<String>,
2100 /// Status of the operation. One of: "Success" or "Failure".
2101 pub status: Option<String>,
2102}
2103
2104impl common::ResponseResult for Status {}
2105
2106/// StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.
2107///
2108/// This type is not used in any activity, and only used as *part* of another schema.
2109///
2110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2111#[serde_with::serde_as]
2112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2113pub struct StatusCause {
2114 /// 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"
2115 pub field: Option<String>,
2116 /// A human-readable description of the cause of the error. This field may be presented as-is to a reader.
2117 pub message: Option<String>,
2118 /// A machine-readable description of the cause of the error. If this value is empty there is no information available.
2119 pub reason: Option<String>,
2120}
2121
2122impl common::Part for StatusCause {}
2123
2124/// 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.
2125///
2126/// This type is not used in any activity, and only used as *part* of another schema.
2127///
2128#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2129#[serde_with::serde_as]
2130#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2131pub struct StatusDetails {
2132 /// The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.
2133 pub causes: Option<Vec<StatusCause>>,
2134 /// The group attribute of the resource associated with the status StatusReason.
2135 pub group: Option<String>,
2136 /// The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind.
2137 pub kind: Option<String>,
2138 /// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
2139 pub name: Option<String>,
2140 /// 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.
2141 #[serde(rename = "retryAfterSeconds")]
2142 pub retry_after_seconds: Option<i32>,
2143 /// UID of the resource. (when there is a single resource which can be described).
2144 pub uid: Option<String>,
2145}
2146
2147impl common::Part for StatusDetails {}
2148
2149/// TCPSocketAction describes an action based on opening a socket
2150///
2151/// This type is not used in any activity, and only used as *part* of another schema.
2152///
2153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2154#[serde_with::serde_as]
2155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2156pub struct TCPSocketAction {
2157 /// Not supported by Cloud Run.
2158 pub host: Option<String>,
2159 /// Port number to access on the container. Number must be in the range 1 to 65535.
2160 pub port: Option<i32>,
2161}
2162
2163impl common::Part for TCPSocketAction {}
2164
2165/// Task represents a single run of a container to completion.
2166///
2167/// # Activities
2168///
2169/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2170/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2171///
2172/// * [tasks get namespaces](NamespaceTaskGetCall) (response)
2173#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2174#[serde_with::serde_as]
2175#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2176pub struct Task {
2177 /// 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.
2178 #[serde(rename = "apiVersion")]
2179 pub api_version: Option<String>,
2180 /// 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.
2181 pub kind: Option<String>,
2182 /// Optional. Standard object's metadata.
2183 pub metadata: Option<ObjectMeta>,
2184 /// Optional. Specification of the desired behavior of a task.
2185 pub spec: Option<TaskSpec>,
2186 /// Output only. Current status of a task.
2187 pub status: Option<TaskStatus>,
2188}
2189
2190impl common::ResponseResult for Task {}
2191
2192/// Result of a task attempt.
2193///
2194/// This type is not used in any activity, and only used as *part* of another schema.
2195///
2196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2197#[serde_with::serde_as]
2198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2199pub struct TaskAttemptResult {
2200 /// 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. At most one of exit_code or term_signal will be set.
2201 #[serde(rename = "exitCode")]
2202 pub exit_code: Option<i32>,
2203 /// Optional. The status of this attempt. If the status code is OK, then the attempt succeeded.
2204 pub status: Option<GoogleRpcStatus>,
2205 /// Optional. Termination signal of the container. This is set to non-zero if the container is terminated by the system. At most one of exit_code or term_signal will be set.
2206 #[serde(rename = "termSignal")]
2207 pub term_signal: Option<i32>,
2208}
2209
2210impl common::Part for TaskAttemptResult {}
2211
2212/// TaskSpec is a description of a task.
2213///
2214/// This type is not used in any activity, and only used as *part* of another schema.
2215///
2216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2217#[serde_with::serde_as]
2218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2219pub struct TaskSpec {
2220 /// Optional. List of containers belonging to the task. We disallow a number of fields on this Container.
2221 pub containers: Option<Vec<Container>>,
2222 /// Optional. Number of retries allowed per task, before marking this job failed. Defaults to 3.
2223 #[serde(rename = "maxRetries")]
2224 pub max_retries: Option<i32>,
2225 /// Optional. The Node Selector configuration. Map of selector key to a value which matches a node.
2226 #[serde(rename = "nodeSelector")]
2227 pub node_selector: Option<HashMap<String, String>>,
2228 /// 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.
2229 #[serde(rename = "serviceAccountName")]
2230 pub service_account_name: Option<String>,
2231 /// 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.
2232 #[serde(rename = "timeoutSeconds")]
2233 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2234 pub timeout_seconds: Option<i64>,
2235 /// Optional. List of volumes that can be mounted by containers belonging to the task.
2236 pub volumes: Option<Vec<Volume>>,
2237}
2238
2239impl common::Part for TaskSpec {}
2240
2241/// TaskStatus represents the status of a task.
2242///
2243/// This type is not used in any activity, and only used as *part* of another schema.
2244///
2245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2246#[serde_with::serde_as]
2247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2248pub struct TaskStatus {
2249 /// 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.
2250 #[serde(rename = "completionTime")]
2251 pub completion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2252 /// 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.
2253 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
2254 /// Required. Index of the task, unique per execution, and beginning at 0.
2255 pub index: Option<i32>,
2256 /// Optional. Result of the last attempt of this task.
2257 #[serde(rename = "lastAttemptResult")]
2258 pub last_attempt_result: Option<TaskAttemptResult>,
2259 /// Optional. URI where logs for this task can be found in Cloud Console.
2260 #[serde(rename = "logUri")]
2261 pub log_uri: Option<String>,
2262 /// Optional. The 'generation' of the task that was last processed by the controller.
2263 #[serde(rename = "observedGeneration")]
2264 pub observed_generation: Option<i32>,
2265 /// Optional. The number of times this task was retried. Instances are retried when they fail up to the maxRetries limit.
2266 pub retried: Option<i32>,
2267 /// 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.
2268 #[serde(rename = "startTime")]
2269 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2270}
2271
2272impl common::Part for TaskStatus {}
2273
2274/// TaskTemplateSpec describes the data a task should have when created from a template.
2275///
2276/// This type is not used in any activity, and only used as *part* of another schema.
2277///
2278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2279#[serde_with::serde_as]
2280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2281pub struct TaskTemplateSpec {
2282 /// Optional. Specification of the desired behavior of the task.
2283 pub spec: Option<TaskSpec>,
2284}
2285
2286impl common::Part for TaskTemplateSpec {}
2287
2288/// Request message for `TestIamPermissions` method.
2289///
2290/// # Activities
2291///
2292/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2293/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2294///
2295/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (request)
2296/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (request)
2297/// * [locations workerpools test iam permissions projects](ProjectLocationWorkerpoolTestIamPermissionCall) (request)
2298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2299#[serde_with::serde_as]
2300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2301pub struct TestIamPermissionsRequest {
2302 /// 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).
2303 pub permissions: Option<Vec<String>>,
2304}
2305
2306impl common::RequestValue for TestIamPermissionsRequest {}
2307
2308/// Response message for `TestIamPermissions` method.
2309///
2310/// # Activities
2311///
2312/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2313/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2314///
2315/// * [locations jobs test iam permissions projects](ProjectLocationJobTestIamPermissionCall) (response)
2316/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (response)
2317/// * [locations workerpools test iam permissions projects](ProjectLocationWorkerpoolTestIamPermissionCall) (response)
2318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2319#[serde_with::serde_as]
2320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2321pub struct TestIamPermissionsResponse {
2322 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2323 pub permissions: Option<Vec<String>>,
2324}
2325
2326impl common::ResponseResult for TestIamPermissionsResponse {}
2327
2328/// TrafficTarget holds a single entry of the routing table for a Route.
2329///
2330/// This type is not used in any activity, and only used as *part* of another schema.
2331///
2332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2333#[serde_with::serde_as]
2334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2335pub struct TrafficTarget {
2336 /// [Deprecated] Not supported in Cloud Run. It must be empty.
2337 #[serde(rename = "configurationName")]
2338 pub configuration_name: Option<String>,
2339 /// 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.
2340 #[serde(rename = "latestRevision")]
2341 pub latest_revision: Option<bool>,
2342 /// Percent specifies percent of the traffic to this Revision or Configuration. This defaults to zero if unspecified.
2343 pub percent: Option<i32>,
2344 /// Points this traffic target to a specific Revision. This field is mutually exclusive with latest_revision.
2345 #[serde(rename = "revisionName")]
2346 pub revision_name: Option<String>,
2347 /// Tag is used to expose a dedicated url for referencing this target exclusively.
2348 pub tag: Option<String>,
2349 /// 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.)
2350 pub url: Option<String>,
2351}
2352
2353impl common::Part for TrafficTarget {}
2354
2355/// Volume represents a named volume in a container.
2356///
2357/// This type is not used in any activity, and only used as *part* of another schema.
2358///
2359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2360#[serde_with::serde_as]
2361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2362pub struct Volume {
2363 /// Not supported in Cloud Run.
2364 #[serde(rename = "configMap")]
2365 pub config_map: Option<ConfigMapVolumeSource>,
2366 /// Volume specified by the Container Storage Interface driver
2367 pub csi: Option<CSIVolumeSource>,
2368 /// Ephemeral storage used as a shared volume.
2369 #[serde(rename = "emptyDir")]
2370 pub empty_dir: Option<EmptyDirVolumeSource>,
2371 /// Volume's name. In Cloud Run Fully Managed, the name 'cloudsql' is reserved.
2372 pub name: Option<String>,
2373 /// no description provided
2374 pub nfs: Option<NFSVolumeSource>,
2375 /// 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.
2376 pub secret: Option<SecretVolumeSource>,
2377}
2378
2379impl common::Part for Volume {}
2380
2381/// VolumeMount describes a mounting of a Volume within a container.
2382///
2383/// This type is not used in any activity, and only used as *part* of another schema.
2384///
2385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2386#[serde_with::serde_as]
2387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2388pub struct VolumeMount {
2389 /// Required. Path within the container at which the volume should be mounted. Must not contain ':'.
2390 #[serde(rename = "mountPath")]
2391 pub mount_path: Option<String>,
2392 /// Required. The name of the volume. There must be a corresponding Volume with the same name.
2393 pub name: Option<String>,
2394 /// Sets the mount to be read-only or read-write. Not used by Cloud Run.
2395 #[serde(rename = "readOnly")]
2396 pub read_only: Option<bool>,
2397 /// Path within the volume from which the container's volume should be mounted. Defaults to "" (volume's root).
2398 #[serde(rename = "subPath")]
2399 pub sub_path: Option<String>,
2400}
2401
2402impl common::Part for VolumeMount {}
2403
2404/// WorkerPool acts as a top-level container that manages a set instance splits among a set of Revisions and a template for creating new Revisions.
2405///
2406/// # Activities
2407///
2408/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2409/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2410///
2411/// * [workerpools create namespaces](NamespaceWorkerpoolCreateCall) (request|response)
2412/// * [workerpools get namespaces](NamespaceWorkerpoolGetCall) (response)
2413/// * [workerpools replace worker pool namespaces](NamespaceWorkerpoolReplaceWorkerPoolCall) (request|response)
2414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2415#[serde_with::serde_as]
2416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2417pub struct WorkerPool {
2418 /// The API version for this call. It must be "run.googleapis.com/v1".
2419 #[serde(rename = "apiVersion")]
2420 pub api_version: Option<String>,
2421 /// The kind of resource. It must be "WorkerPool".
2422 pub kind: Option<String>,
2423 /// Metadata associated with this WorkerPool, 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 WorkerPool.metadata.annotations. * `run.googleapis.com/binary-authorization-breakglass` * `run.googleapis.com/binary-authorization` * `run.googleapis.com/client-name` * `run.googleapis.com/description`
2424 pub metadata: Option<ObjectMeta>,
2425 /// Holds the desired state of the WorkerPool (from the client).
2426 pub spec: Option<WorkerPoolSpec>,
2427 /// Communicates the system-controlled state of the WorkerPool.
2428 pub status: Option<WorkerPoolStatus>,
2429}
2430
2431impl common::RequestValue for WorkerPool {}
2432impl common::ResponseResult for WorkerPool {}
2433
2434/// WorkerPoolSpec holds the desired state of the WorkerPool's template and instance splits.
2435///
2436/// This type is not used in any activity, and only used as *part* of another schema.
2437///
2438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2439#[serde_with::serde_as]
2440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2441pub struct WorkerPoolSpec {
2442 /// Specifies how to distribute instances over a collection of Revisions.
2443 #[serde(rename = "instanceSplits")]
2444 pub instance_splits: Option<Vec<InstanceSplit>>,
2445 /// Holds the latest specification for the Revision to be stamped out.
2446 pub template: Option<RevisionTemplate>,
2447}
2448
2449impl common::Part for WorkerPoolSpec {}
2450
2451/// The current state of the WorkerPool. Output only.
2452///
2453/// This type is not used in any activity, and only used as *part* of another schema.
2454///
2455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2456#[serde_with::serde_as]
2457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2458pub struct WorkerPoolStatus {
2459 /// Conditions communicate information about ongoing/complete reconciliation processes that bring the `spec` inline with the observed state of the world. * `Ready`: `True` when all underlying resources are ready.
2460 pub conditions: Option<Vec<GoogleCloudRunV1Condition>>,
2461 /// Holds the configured workload distribution. These entries will always contain RevisionName references. When ConfigurationName appears in the spec, this will hold the LatestReadyRevisionName that we last observed.
2462 #[serde(rename = "instanceSplits")]
2463 pub instance_splits: Option<Vec<InstanceSplit>>,
2464 /// Name of the last revision that was created from this WorkerPool's template. It might not be ready yet, for that use LatestReadyRevisionName.
2465 #[serde(rename = "latestCreatedRevisionName")]
2466 pub latest_created_revision_name: Option<String>,
2467 /// Name of the latest Revision from this WorkerPool's template that has had its `Ready` condition become `True`.
2468 #[serde(rename = "latestReadyRevisionName")]
2469 pub latest_ready_revision_name: Option<String>,
2470 /// 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.
2471 #[serde(rename = "observedGeneration")]
2472 pub observed_generation: Option<i32>,
2473}
2474
2475impl common::Part for WorkerPoolStatus {}
2476
2477// ###################
2478// MethodBuilders ###
2479// #################
2480
2481/// A builder providing access to all methods supported on *namespace* resources.
2482/// It is not used directly, but through the [`CloudRun`] hub.
2483///
2484/// # Example
2485///
2486/// Instantiate a resource builder
2487///
2488/// ```test_harness,no_run
2489/// extern crate hyper;
2490/// extern crate hyper_rustls;
2491/// extern crate google_run1 as run1;
2492///
2493/// # async fn dox() {
2494/// use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2495///
2496/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2497/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2498/// .with_native_roots()
2499/// .unwrap()
2500/// .https_only()
2501/// .enable_http2()
2502/// .build();
2503///
2504/// let executor = hyper_util::rt::TokioExecutor::new();
2505/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2506/// secret,
2507/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2508/// yup_oauth2::client::CustomHyperClientBuilder::from(
2509/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2510/// ),
2511/// ).build().await.unwrap();
2512///
2513/// let client = hyper_util::client::legacy::Client::builder(
2514/// hyper_util::rt::TokioExecutor::new()
2515/// )
2516/// .build(
2517/// hyper_rustls::HttpsConnectorBuilder::new()
2518/// .with_native_roots()
2519/// .unwrap()
2520/// .https_or_http()
2521/// .enable_http2()
2522/// .build()
2523/// );
2524/// let mut hub = CloudRun::new(client, auth);
2525/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2526/// // 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(...)`, `tasks_list(...)`, `workerpools_create(...)`, `workerpools_delete(...)`, `workerpools_get(...)`, `workerpools_list(...)` and `workerpools_replace_worker_pool(...)`
2527/// // to build up your call.
2528/// let rb = hub.namespaces();
2529/// # }
2530/// ```
2531pub struct NamespaceMethods<'a, C>
2532where
2533 C: 'a,
2534{
2535 hub: &'a CloudRun<C>,
2536}
2537
2538impl<'a, C> common::MethodsBuilder for NamespaceMethods<'a, C> {}
2539
2540impl<'a, C> NamespaceMethods<'a, C> {
2541 /// Create a builder to help you perform the following task:
2542 ///
2543 /// List authorized domains.
2544 ///
2545 /// # Arguments
2546 ///
2547 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
2548 pub fn authorizeddomains_list(&self, parent: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
2549 NamespaceAuthorizeddomainListCall {
2550 hub: self.hub,
2551 _parent: parent.to_string(),
2552 _page_token: Default::default(),
2553 _page_size: Default::default(),
2554 _delegate: Default::default(),
2555 _additional_params: Default::default(),
2556 _scopes: Default::default(),
2557 }
2558 }
2559
2560 /// Create a builder to help you perform the following task:
2561 ///
2562 /// Get information about a configuration.
2563 ///
2564 /// # Arguments
2565 ///
2566 /// * `name` - The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
2567 pub fn configurations_get(&self, name: &str) -> NamespaceConfigurationGetCall<'a, C> {
2568 NamespaceConfigurationGetCall {
2569 hub: self.hub,
2570 _name: name.to_string(),
2571 _delegate: Default::default(),
2572 _additional_params: Default::default(),
2573 _scopes: Default::default(),
2574 }
2575 }
2576
2577 /// Create a builder to help you perform the following task:
2578 ///
2579 /// List configurations. Results are sorted by creation time, descending.
2580 ///
2581 /// # Arguments
2582 ///
2583 /// * `parent` - The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
2584 pub fn configurations_list(&self, parent: &str) -> NamespaceConfigurationListCall<'a, C> {
2585 NamespaceConfigurationListCall {
2586 hub: self.hub,
2587 _parent: parent.to_string(),
2588 _watch: Default::default(),
2589 _resource_version: Default::default(),
2590 _limit: Default::default(),
2591 _label_selector: Default::default(),
2592 _include_uninitialized: Default::default(),
2593 _field_selector: Default::default(),
2594 _continue_: Default::default(),
2595 _delegate: Default::default(),
2596 _additional_params: Default::default(),
2597 _scopes: Default::default(),
2598 }
2599 }
2600
2601 /// Create a builder to help you perform the following task:
2602 ///
2603 /// Create a new domain mapping.
2604 ///
2605 /// # Arguments
2606 ///
2607 /// * `request` - No description provided.
2608 /// * `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
2609 pub fn domainmappings_create(
2610 &self,
2611 request: DomainMapping,
2612 parent: &str,
2613 ) -> NamespaceDomainmappingCreateCall<'a, C> {
2614 NamespaceDomainmappingCreateCall {
2615 hub: self.hub,
2616 _request: request,
2617 _parent: parent.to_string(),
2618 _dry_run: Default::default(),
2619 _delegate: Default::default(),
2620 _additional_params: Default::default(),
2621 _scopes: Default::default(),
2622 }
2623 }
2624
2625 /// Create a builder to help you perform the following task:
2626 ///
2627 /// Delete a domain mapping.
2628 ///
2629 /// # Arguments
2630 ///
2631 /// * `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
2632 pub fn domainmappings_delete(&self, name: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
2633 NamespaceDomainmappingDeleteCall {
2634 hub: self.hub,
2635 _name: name.to_string(),
2636 _propagation_policy: Default::default(),
2637 _kind: Default::default(),
2638 _dry_run: Default::default(),
2639 _api_version: Default::default(),
2640 _delegate: Default::default(),
2641 _additional_params: Default::default(),
2642 _scopes: Default::default(),
2643 }
2644 }
2645
2646 /// Create a builder to help you perform the following task:
2647 ///
2648 /// Get information about a domain mapping.
2649 ///
2650 /// # Arguments
2651 ///
2652 /// * `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
2653 pub fn domainmappings_get(&self, name: &str) -> NamespaceDomainmappingGetCall<'a, C> {
2654 NamespaceDomainmappingGetCall {
2655 hub: self.hub,
2656 _name: name.to_string(),
2657 _delegate: Default::default(),
2658 _additional_params: Default::default(),
2659 _scopes: Default::default(),
2660 }
2661 }
2662
2663 /// Create a builder to help you perform the following task:
2664 ///
2665 /// List all domain mappings.
2666 ///
2667 /// # Arguments
2668 ///
2669 /// * `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
2670 pub fn domainmappings_list(&self, parent: &str) -> NamespaceDomainmappingListCall<'a, C> {
2671 NamespaceDomainmappingListCall {
2672 hub: self.hub,
2673 _parent: parent.to_string(),
2674 _watch: Default::default(),
2675 _resource_version: Default::default(),
2676 _limit: Default::default(),
2677 _label_selector: Default::default(),
2678 _include_uninitialized: Default::default(),
2679 _field_selector: Default::default(),
2680 _continue_: Default::default(),
2681 _delegate: Default::default(),
2682 _additional_params: Default::default(),
2683 _scopes: Default::default(),
2684 }
2685 }
2686
2687 /// Create a builder to help you perform the following task:
2688 ///
2689 /// Cancel an execution.
2690 ///
2691 /// # Arguments
2692 ///
2693 /// * `request` - No description provided.
2694 /// * `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
2695 pub fn executions_cancel(
2696 &self,
2697 request: CancelExecutionRequest,
2698 name: &str,
2699 ) -> NamespaceExecutionCancelCall<'a, C> {
2700 NamespaceExecutionCancelCall {
2701 hub: self.hub,
2702 _request: request,
2703 _name: name.to_string(),
2704 _delegate: Default::default(),
2705 _additional_params: Default::default(),
2706 _scopes: Default::default(),
2707 }
2708 }
2709
2710 /// Create a builder to help you perform the following task:
2711 ///
2712 /// Delete an execution.
2713 ///
2714 /// # Arguments
2715 ///
2716 /// * `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
2717 pub fn executions_delete(&self, name: &str) -> NamespaceExecutionDeleteCall<'a, C> {
2718 NamespaceExecutionDeleteCall {
2719 hub: self.hub,
2720 _name: name.to_string(),
2721 _propagation_policy: Default::default(),
2722 _kind: Default::default(),
2723 _api_version: Default::default(),
2724 _delegate: Default::default(),
2725 _additional_params: Default::default(),
2726 _scopes: Default::default(),
2727 }
2728 }
2729
2730 /// Create a builder to help you perform the following task:
2731 ///
2732 /// Get information about an execution.
2733 ///
2734 /// # Arguments
2735 ///
2736 /// * `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
2737 pub fn executions_get(&self, name: &str) -> NamespaceExecutionGetCall<'a, C> {
2738 NamespaceExecutionGetCall {
2739 hub: self.hub,
2740 _name: name.to_string(),
2741 _delegate: Default::default(),
2742 _additional_params: Default::default(),
2743 _scopes: Default::default(),
2744 }
2745 }
2746
2747 /// Create a builder to help you perform the following task:
2748 ///
2749 /// List executions. Results are sorted by creation time, descending.
2750 ///
2751 /// # Arguments
2752 ///
2753 /// * `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
2754 pub fn executions_list(&self, parent: &str) -> NamespaceExecutionListCall<'a, C> {
2755 NamespaceExecutionListCall {
2756 hub: self.hub,
2757 _parent: parent.to_string(),
2758 _watch: Default::default(),
2759 _resource_version: Default::default(),
2760 _limit: Default::default(),
2761 _label_selector: Default::default(),
2762 _include_uninitialized: Default::default(),
2763 _field_selector: Default::default(),
2764 _continue_: Default::default(),
2765 _delegate: Default::default(),
2766 _additional_params: Default::default(),
2767 _scopes: Default::default(),
2768 }
2769 }
2770
2771 /// Create a builder to help you perform the following task:
2772 ///
2773 /// Create a job.
2774 ///
2775 /// # Arguments
2776 ///
2777 /// * `request` - No description provided.
2778 /// * `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
2779 pub fn jobs_create(&self, request: Job, parent: &str) -> NamespaceJobCreateCall<'a, C> {
2780 NamespaceJobCreateCall {
2781 hub: self.hub,
2782 _request: request,
2783 _parent: parent.to_string(),
2784 _delegate: Default::default(),
2785 _additional_params: Default::default(),
2786 _scopes: Default::default(),
2787 }
2788 }
2789
2790 /// Create a builder to help you perform the following task:
2791 ///
2792 /// Delete a job.
2793 ///
2794 /// # Arguments
2795 ///
2796 /// * `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
2797 pub fn jobs_delete(&self, name: &str) -> NamespaceJobDeleteCall<'a, C> {
2798 NamespaceJobDeleteCall {
2799 hub: self.hub,
2800 _name: name.to_string(),
2801 _propagation_policy: Default::default(),
2802 _kind: Default::default(),
2803 _api_version: Default::default(),
2804 _delegate: Default::default(),
2805 _additional_params: Default::default(),
2806 _scopes: Default::default(),
2807 }
2808 }
2809
2810 /// Create a builder to help you perform the following task:
2811 ///
2812 /// Get information about a job.
2813 ///
2814 /// # Arguments
2815 ///
2816 /// * `name` - Required. The name of the job to retrieve. It takes the form namespaces/{namespace}/jobs/{job_name} and the `endpoint` must be regional. Replace {namespace} with the project ID or number.
2817 pub fn jobs_get(&self, name: &str) -> NamespaceJobGetCall<'a, C> {
2818 NamespaceJobGetCall {
2819 hub: self.hub,
2820 _name: name.to_string(),
2821 _delegate: Default::default(),
2822 _additional_params: Default::default(),
2823 _scopes: Default::default(),
2824 }
2825 }
2826
2827 /// Create a builder to help you perform the following task:
2828 ///
2829 /// List jobs. Results are sorted by creation time, descending.
2830 ///
2831 /// # Arguments
2832 ///
2833 /// * `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
2834 pub fn jobs_list(&self, parent: &str) -> NamespaceJobListCall<'a, C> {
2835 NamespaceJobListCall {
2836 hub: self.hub,
2837 _parent: parent.to_string(),
2838 _watch: Default::default(),
2839 _resource_version: Default::default(),
2840 _limit: Default::default(),
2841 _label_selector: Default::default(),
2842 _include_uninitialized: Default::default(),
2843 _field_selector: Default::default(),
2844 _continue_: Default::default(),
2845 _delegate: Default::default(),
2846 _additional_params: Default::default(),
2847 _scopes: Default::default(),
2848 }
2849 }
2850
2851 /// Create a builder to help you perform the following task:
2852 ///
2853 /// 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.
2854 ///
2855 /// # Arguments
2856 ///
2857 /// * `request` - No description provided.
2858 /// * `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
2859 pub fn jobs_replace_job(&self, request: Job, name: &str) -> NamespaceJobReplaceJobCall<'a, C> {
2860 NamespaceJobReplaceJobCall {
2861 hub: self.hub,
2862 _request: request,
2863 _name: name.to_string(),
2864 _delegate: Default::default(),
2865 _additional_params: Default::default(),
2866 _scopes: Default::default(),
2867 }
2868 }
2869
2870 /// Create a builder to help you perform the following task:
2871 ///
2872 /// Trigger creation of a new execution of this job.
2873 ///
2874 /// # Arguments
2875 ///
2876 /// * `request` - No description provided.
2877 /// * `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
2878 pub fn jobs_run(&self, request: RunJobRequest, name: &str) -> NamespaceJobRunCall<'a, C> {
2879 NamespaceJobRunCall {
2880 hub: self.hub,
2881 _request: request,
2882 _name: name.to_string(),
2883 _delegate: Default::default(),
2884 _additional_params: Default::default(),
2885 _scopes: Default::default(),
2886 }
2887 }
2888
2889 /// Create a builder to help you perform the following task:
2890 ///
2891 /// Delete a revision.
2892 ///
2893 /// # Arguments
2894 ///
2895 /// * `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
2896 pub fn revisions_delete(&self, name: &str) -> NamespaceRevisionDeleteCall<'a, C> {
2897 NamespaceRevisionDeleteCall {
2898 hub: self.hub,
2899 _name: name.to_string(),
2900 _propagation_policy: Default::default(),
2901 _kind: Default::default(),
2902 _dry_run: Default::default(),
2903 _api_version: Default::default(),
2904 _delegate: Default::default(),
2905 _additional_params: Default::default(),
2906 _scopes: Default::default(),
2907 }
2908 }
2909
2910 /// Create a builder to help you perform the following task:
2911 ///
2912 /// Get information about a revision.
2913 ///
2914 /// # Arguments
2915 ///
2916 /// * `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
2917 pub fn revisions_get(&self, name: &str) -> NamespaceRevisionGetCall<'a, C> {
2918 NamespaceRevisionGetCall {
2919 hub: self.hub,
2920 _name: name.to_string(),
2921 _delegate: Default::default(),
2922 _additional_params: Default::default(),
2923 _scopes: Default::default(),
2924 }
2925 }
2926
2927 /// Create a builder to help you perform the following task:
2928 ///
2929 /// List revisions. Results are sorted by creation time, descending.
2930 ///
2931 /// # Arguments
2932 ///
2933 /// * `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
2934 pub fn revisions_list(&self, parent: &str) -> NamespaceRevisionListCall<'a, C> {
2935 NamespaceRevisionListCall {
2936 hub: self.hub,
2937 _parent: parent.to_string(),
2938 _watch: Default::default(),
2939 _resource_version: Default::default(),
2940 _limit: Default::default(),
2941 _label_selector: Default::default(),
2942 _include_uninitialized: Default::default(),
2943 _field_selector: Default::default(),
2944 _continue_: Default::default(),
2945 _delegate: Default::default(),
2946 _additional_params: Default::default(),
2947 _scopes: Default::default(),
2948 }
2949 }
2950
2951 /// Create a builder to help you perform the following task:
2952 ///
2953 /// Get information about a route.
2954 ///
2955 /// # Arguments
2956 ///
2957 /// * `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
2958 pub fn routes_get(&self, name: &str) -> NamespaceRouteGetCall<'a, C> {
2959 NamespaceRouteGetCall {
2960 hub: self.hub,
2961 _name: name.to_string(),
2962 _delegate: Default::default(),
2963 _additional_params: Default::default(),
2964 _scopes: Default::default(),
2965 }
2966 }
2967
2968 /// Create a builder to help you perform the following task:
2969 ///
2970 /// List routes. Results are sorted by creation time, descending.
2971 ///
2972 /// # Arguments
2973 ///
2974 /// * `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
2975 pub fn routes_list(&self, parent: &str) -> NamespaceRouteListCall<'a, C> {
2976 NamespaceRouteListCall {
2977 hub: self.hub,
2978 _parent: parent.to_string(),
2979 _watch: Default::default(),
2980 _resource_version: Default::default(),
2981 _limit: Default::default(),
2982 _label_selector: Default::default(),
2983 _include_uninitialized: Default::default(),
2984 _field_selector: Default::default(),
2985 _continue_: Default::default(),
2986 _delegate: Default::default(),
2987 _additional_params: Default::default(),
2988 _scopes: Default::default(),
2989 }
2990 }
2991
2992 /// Create a builder to help you perform the following task:
2993 ///
2994 /// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
2995 ///
2996 /// # Arguments
2997 ///
2998 /// * `request` - No description provided.
2999 /// * `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}`
3000 pub fn services_create(
3001 &self,
3002 request: Service,
3003 parent: &str,
3004 ) -> NamespaceServiceCreateCall<'a, C> {
3005 NamespaceServiceCreateCall {
3006 hub: self.hub,
3007 _request: request,
3008 _parent: parent.to_string(),
3009 _dry_run: Default::default(),
3010 _delegate: Default::default(),
3011 _additional_params: Default::default(),
3012 _scopes: Default::default(),
3013 }
3014 }
3015
3016 /// Create a builder to help you perform the following task:
3017 ///
3018 /// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
3019 ///
3020 /// # Arguments
3021 ///
3022 /// * `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}`
3023 pub fn services_delete(&self, name: &str) -> NamespaceServiceDeleteCall<'a, C> {
3024 NamespaceServiceDeleteCall {
3025 hub: self.hub,
3026 _name: name.to_string(),
3027 _propagation_policy: Default::default(),
3028 _kind: Default::default(),
3029 _dry_run: Default::default(),
3030 _api_version: Default::default(),
3031 _delegate: Default::default(),
3032 _additional_params: Default::default(),
3033 _scopes: Default::default(),
3034 }
3035 }
3036
3037 /// Create a builder to help you perform the following task:
3038 ///
3039 /// Gets information about a service.
3040 ///
3041 /// # Arguments
3042 ///
3043 /// * `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}`
3044 pub fn services_get(&self, name: &str) -> NamespaceServiceGetCall<'a, C> {
3045 NamespaceServiceGetCall {
3046 hub: self.hub,
3047 _name: name.to_string(),
3048 _delegate: Default::default(),
3049 _additional_params: Default::default(),
3050 _scopes: Default::default(),
3051 }
3052 }
3053
3054 /// Create a builder to help you perform the following task:
3055 ///
3056 /// Lists services for the given project and region. Results are sorted by creation time, descending.
3057 ///
3058 /// # Arguments
3059 ///
3060 /// * `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}`
3061 pub fn services_list(&self, parent: &str) -> NamespaceServiceListCall<'a, C> {
3062 NamespaceServiceListCall {
3063 hub: self.hub,
3064 _parent: parent.to_string(),
3065 _watch: Default::default(),
3066 _resource_version: Default::default(),
3067 _limit: Default::default(),
3068 _label_selector: Default::default(),
3069 _include_uninitialized: Default::default(),
3070 _field_selector: Default::default(),
3071 _continue_: Default::default(),
3072 _delegate: Default::default(),
3073 _additional_params: Default::default(),
3074 _scopes: Default::default(),
3075 }
3076 }
3077
3078 /// Create a builder to help you perform the following task:
3079 ///
3080 /// 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.
3081 ///
3082 /// # Arguments
3083 ///
3084 /// * `request` - No description provided.
3085 /// * `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}`
3086 pub fn services_replace_service(
3087 &self,
3088 request: Service,
3089 name: &str,
3090 ) -> NamespaceServiceReplaceServiceCall<'a, C> {
3091 NamespaceServiceReplaceServiceCall {
3092 hub: self.hub,
3093 _request: request,
3094 _name: name.to_string(),
3095 _dry_run: Default::default(),
3096 _delegate: Default::default(),
3097 _additional_params: Default::default(),
3098 _scopes: Default::default(),
3099 }
3100 }
3101
3102 /// Create a builder to help you perform the following task:
3103 ///
3104 /// Get information about a task.
3105 ///
3106 /// # Arguments
3107 ///
3108 /// * `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
3109 pub fn tasks_get(&self, name: &str) -> NamespaceTaskGetCall<'a, C> {
3110 NamespaceTaskGetCall {
3111 hub: self.hub,
3112 _name: name.to_string(),
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 /// List tasks.
3122 ///
3123 /// # Arguments
3124 ///
3125 /// * `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
3126 pub fn tasks_list(&self, parent: &str) -> NamespaceTaskListCall<'a, C> {
3127 NamespaceTaskListCall {
3128 hub: self.hub,
3129 _parent: parent.to_string(),
3130 _watch: Default::default(),
3131 _resource_version: Default::default(),
3132 _limit: Default::default(),
3133 _label_selector: Default::default(),
3134 _include_uninitialized: Default::default(),
3135 _field_selector: Default::default(),
3136 _continue_: 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 /// Creates a new WorkerPool. WorkerPool creation will trigger a new deployment. Use GetWorkerPool, and check worker_pool.status to determine if the WorkerPool is ready.
3146 ///
3147 /// # Arguments
3148 ///
3149 /// * `request` - No description provided.
3150 /// * `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}/workerpools` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
3151 pub fn workerpools_create(
3152 &self,
3153 request: WorkerPool,
3154 parent: &str,
3155 ) -> NamespaceWorkerpoolCreateCall<'a, C> {
3156 NamespaceWorkerpoolCreateCall {
3157 hub: self.hub,
3158 _request: request,
3159 _parent: parent.to_string(),
3160 _dry_run: 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 /// Deletes the provided worker pool. This will cause the WorkerPool to stop all instances and will delete all associated WorkerPoolRevisions.
3170 ///
3171 /// # Arguments
3172 ///
3173 /// * `name` - Required. The fully qualified name of the worker pool to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
3174 pub fn workerpools_delete(&self, name: &str) -> NamespaceWorkerpoolDeleteCall<'a, C> {
3175 NamespaceWorkerpoolDeleteCall {
3176 hub: self.hub,
3177 _name: name.to_string(),
3178 _dry_run: Default::default(),
3179 _delegate: Default::default(),
3180 _additional_params: Default::default(),
3181 _scopes: Default::default(),
3182 }
3183 }
3184
3185 /// Create a builder to help you perform the following task:
3186 ///
3187 /// Gets information about a worker pool.
3188 ///
3189 /// # Arguments
3190 ///
3191 /// * `name` - Required. The fully qualified name of the worker pool to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
3192 pub fn workerpools_get(&self, name: &str) -> NamespaceWorkerpoolGetCall<'a, C> {
3193 NamespaceWorkerpoolGetCall {
3194 hub: self.hub,
3195 _name: name.to_string(),
3196 _delegate: Default::default(),
3197 _additional_params: Default::default(),
3198 _scopes: Default::default(),
3199 }
3200 }
3201
3202 /// Create a builder to help you perform the following task:
3203 ///
3204 /// Lists worker pools for the given project and region. Results are sorted by creation time, descending.
3205 ///
3206 /// # Arguments
3207 ///
3208 /// * `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}/workerpools` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
3209 pub fn workerpools_list(&self, parent: &str) -> NamespaceWorkerpoolListCall<'a, C> {
3210 NamespaceWorkerpoolListCall {
3211 hub: self.hub,
3212 _parent: parent.to_string(),
3213 _limit: Default::default(),
3214 _label_selector: Default::default(),
3215 _continue_: Default::default(),
3216 _delegate: Default::default(),
3217 _additional_params: Default::default(),
3218 _scopes: Default::default(),
3219 }
3220 }
3221
3222 /// Create a builder to help you perform the following task:
3223 ///
3224 /// Replaces a worker pool. 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.
3225 ///
3226 /// # Arguments
3227 ///
3228 /// * `request` - No description provided.
3229 /// * `name` - Required. The fully qualified name of the worker pool to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
3230 pub fn workerpools_replace_worker_pool(
3231 &self,
3232 request: WorkerPool,
3233 name: &str,
3234 ) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
3235 NamespaceWorkerpoolReplaceWorkerPoolCall {
3236 hub: self.hub,
3237 _request: request,
3238 _name: name.to_string(),
3239 _dry_run: Default::default(),
3240 _delegate: Default::default(),
3241 _additional_params: Default::default(),
3242 _scopes: Default::default(),
3243 }
3244 }
3245}
3246
3247/// A builder providing access to all methods supported on *project* resources.
3248/// It is not used directly, but through the [`CloudRun`] hub.
3249///
3250/// # Example
3251///
3252/// Instantiate a resource builder
3253///
3254/// ```test_harness,no_run
3255/// extern crate hyper;
3256/// extern crate hyper_rustls;
3257/// extern crate google_run1 as run1;
3258///
3259/// # async fn dox() {
3260/// use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3261///
3262/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3263/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3264/// .with_native_roots()
3265/// .unwrap()
3266/// .https_only()
3267/// .enable_http2()
3268/// .build();
3269///
3270/// let executor = hyper_util::rt::TokioExecutor::new();
3271/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3272/// secret,
3273/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3274/// yup_oauth2::client::CustomHyperClientBuilder::from(
3275/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3276/// ),
3277/// ).build().await.unwrap();
3278///
3279/// let client = hyper_util::client::legacy::Client::builder(
3280/// hyper_util::rt::TokioExecutor::new()
3281/// )
3282/// .build(
3283/// hyper_rustls::HttpsConnectorBuilder::new()
3284/// .with_native_roots()
3285/// .unwrap()
3286/// .https_or_http()
3287/// .enable_http2()
3288/// .build()
3289/// );
3290/// let mut hub = CloudRun::new(client, auth);
3291/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3292/// // 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(...)`, `locations_services_test_iam_permissions(...)`, `locations_workerpools_get_iam_policy(...)`, `locations_workerpools_set_iam_policy(...)` and `locations_workerpools_test_iam_permissions(...)`
3293/// // to build up your call.
3294/// let rb = hub.projects();
3295/// # }
3296/// ```
3297pub struct ProjectMethods<'a, C>
3298where
3299 C: 'a,
3300{
3301 hub: &'a CloudRun<C>,
3302}
3303
3304impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3305
3306impl<'a, C> ProjectMethods<'a, C> {
3307 /// Create a builder to help you perform the following task:
3308 ///
3309 /// List authorized domains.
3310 ///
3311 /// # Arguments
3312 ///
3313 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
3314 pub fn authorizeddomains_list(&self, parent: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
3315 ProjectAuthorizeddomainListCall {
3316 hub: self.hub,
3317 _parent: parent.to_string(),
3318 _page_token: Default::default(),
3319 _page_size: Default::default(),
3320 _delegate: Default::default(),
3321 _additional_params: Default::default(),
3322 _scopes: Default::default(),
3323 }
3324 }
3325
3326 /// Create a builder to help you perform the following task:
3327 ///
3328 /// List authorized domains.
3329 ///
3330 /// # Arguments
3331 ///
3332 /// * `parent` - Name of the parent Project resource. Example: `projects/myproject`.
3333 pub fn locations_authorizeddomains_list(
3334 &self,
3335 parent: &str,
3336 ) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
3337 ProjectLocationAuthorizeddomainListCall {
3338 hub: self.hub,
3339 _parent: parent.to_string(),
3340 _page_token: Default::default(),
3341 _page_size: Default::default(),
3342 _delegate: Default::default(),
3343 _additional_params: Default::default(),
3344 _scopes: Default::default(),
3345 }
3346 }
3347
3348 /// Create a builder to help you perform the following task:
3349 ///
3350 /// Get information about a configuration.
3351 ///
3352 /// # Arguments
3353 ///
3354 /// * `name` - The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
3355 pub fn locations_configurations_get(
3356 &self,
3357 name: &str,
3358 ) -> ProjectLocationConfigurationGetCall<'a, C> {
3359 ProjectLocationConfigurationGetCall {
3360 hub: self.hub,
3361 _name: name.to_string(),
3362 _delegate: Default::default(),
3363 _additional_params: Default::default(),
3364 _scopes: Default::default(),
3365 }
3366 }
3367
3368 /// Create a builder to help you perform the following task:
3369 ///
3370 /// List configurations. Results are sorted by creation time, descending.
3371 ///
3372 /// # Arguments
3373 ///
3374 /// * `parent` - The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
3375 pub fn locations_configurations_list(
3376 &self,
3377 parent: &str,
3378 ) -> ProjectLocationConfigurationListCall<'a, C> {
3379 ProjectLocationConfigurationListCall {
3380 hub: self.hub,
3381 _parent: parent.to_string(),
3382 _watch: Default::default(),
3383 _resource_version: Default::default(),
3384 _limit: Default::default(),
3385 _label_selector: Default::default(),
3386 _include_uninitialized: Default::default(),
3387 _field_selector: Default::default(),
3388 _continue_: Default::default(),
3389 _delegate: Default::default(),
3390 _additional_params: Default::default(),
3391 _scopes: Default::default(),
3392 }
3393 }
3394
3395 /// Create a builder to help you perform the following task:
3396 ///
3397 /// Create a new domain mapping.
3398 ///
3399 /// # Arguments
3400 ///
3401 /// * `request` - No description provided.
3402 /// * `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
3403 pub fn locations_domainmappings_create(
3404 &self,
3405 request: DomainMapping,
3406 parent: &str,
3407 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
3408 ProjectLocationDomainmappingCreateCall {
3409 hub: self.hub,
3410 _request: request,
3411 _parent: parent.to_string(),
3412 _dry_run: Default::default(),
3413 _delegate: Default::default(),
3414 _additional_params: Default::default(),
3415 _scopes: Default::default(),
3416 }
3417 }
3418
3419 /// Create a builder to help you perform the following task:
3420 ///
3421 /// Delete a domain mapping.
3422 ///
3423 /// # Arguments
3424 ///
3425 /// * `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
3426 pub fn locations_domainmappings_delete(
3427 &self,
3428 name: &str,
3429 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
3430 ProjectLocationDomainmappingDeleteCall {
3431 hub: self.hub,
3432 _name: name.to_string(),
3433 _propagation_policy: Default::default(),
3434 _kind: Default::default(),
3435 _dry_run: Default::default(),
3436 _api_version: Default::default(),
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 /// Get information about a domain mapping.
3446 ///
3447 /// # Arguments
3448 ///
3449 /// * `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
3450 pub fn locations_domainmappings_get(
3451 &self,
3452 name: &str,
3453 ) -> ProjectLocationDomainmappingGetCall<'a, C> {
3454 ProjectLocationDomainmappingGetCall {
3455 hub: self.hub,
3456 _name: name.to_string(),
3457 _delegate: Default::default(),
3458 _additional_params: Default::default(),
3459 _scopes: Default::default(),
3460 }
3461 }
3462
3463 /// Create a builder to help you perform the following task:
3464 ///
3465 /// List all domain mappings.
3466 ///
3467 /// # Arguments
3468 ///
3469 /// * `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
3470 pub fn locations_domainmappings_list(
3471 &self,
3472 parent: &str,
3473 ) -> ProjectLocationDomainmappingListCall<'a, C> {
3474 ProjectLocationDomainmappingListCall {
3475 hub: self.hub,
3476 _parent: parent.to_string(),
3477 _watch: Default::default(),
3478 _resource_version: Default::default(),
3479 _limit: Default::default(),
3480 _label_selector: Default::default(),
3481 _include_uninitialized: Default::default(),
3482 _field_selector: Default::default(),
3483 _continue_: Default::default(),
3484 _delegate: Default::default(),
3485 _additional_params: Default::default(),
3486 _scopes: Default::default(),
3487 }
3488 }
3489
3490 /// Create a builder to help you perform the following task:
3491 ///
3492 /// Get the IAM Access Control policy currently in effect for the given job. This result does not include any inherited policies.
3493 ///
3494 /// # Arguments
3495 ///
3496 /// * `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.
3497 pub fn locations_jobs_get_iam_policy(
3498 &self,
3499 resource: &str,
3500 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
3501 ProjectLocationJobGetIamPolicyCall {
3502 hub: self.hub,
3503 _resource: resource.to_string(),
3504 _options_requested_policy_version: Default::default(),
3505 _delegate: Default::default(),
3506 _additional_params: Default::default(),
3507 _scopes: Default::default(),
3508 }
3509 }
3510
3511 /// Create a builder to help you perform the following task:
3512 ///
3513 /// Sets the IAM Access control policy for the specified job. Overwrites any existing policy.
3514 ///
3515 /// # Arguments
3516 ///
3517 /// * `request` - No description provided.
3518 /// * `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.
3519 pub fn locations_jobs_set_iam_policy(
3520 &self,
3521 request: SetIamPolicyRequest,
3522 resource: &str,
3523 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
3524 ProjectLocationJobSetIamPolicyCall {
3525 hub: self.hub,
3526 _request: request,
3527 _resource: resource.to_string(),
3528 _delegate: Default::default(),
3529 _additional_params: Default::default(),
3530 _scopes: Default::default(),
3531 }
3532 }
3533
3534 /// Create a builder to help you perform the following task:
3535 ///
3536 /// Returns permissions that a caller has on the specified job. There are no permissions required for making this API call.
3537 ///
3538 /// # Arguments
3539 ///
3540 /// * `request` - No description provided.
3541 /// * `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.
3542 pub fn locations_jobs_test_iam_permissions(
3543 &self,
3544 request: TestIamPermissionsRequest,
3545 resource: &str,
3546 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
3547 ProjectLocationJobTestIamPermissionCall {
3548 hub: self.hub,
3549 _request: request,
3550 _resource: resource.to_string(),
3551 _delegate: Default::default(),
3552 _additional_params: Default::default(),
3553 _scopes: Default::default(),
3554 }
3555 }
3556
3557 /// Create a builder to help you perform the following task:
3558 ///
3559 /// 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`.
3560 ///
3561 /// # Arguments
3562 ///
3563 /// * `name` - The name of the operation resource to be deleted.
3564 pub fn locations_operations_delete(
3565 &self,
3566 name: &str,
3567 ) -> ProjectLocationOperationDeleteCall<'a, C> {
3568 ProjectLocationOperationDeleteCall {
3569 hub: self.hub,
3570 _name: name.to_string(),
3571 _delegate: Default::default(),
3572 _additional_params: Default::default(),
3573 _scopes: Default::default(),
3574 }
3575 }
3576
3577 /// Create a builder to help you perform the following task:
3578 ///
3579 /// 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.
3580 ///
3581 /// # Arguments
3582 ///
3583 /// * `name` - The name of the operation resource.
3584 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3585 ProjectLocationOperationGetCall {
3586 hub: self.hub,
3587 _name: name.to_string(),
3588 _delegate: Default::default(),
3589 _additional_params: Default::default(),
3590 _scopes: Default::default(),
3591 }
3592 }
3593
3594 /// Create a builder to help you perform the following task:
3595 ///
3596 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3597 ///
3598 /// # Arguments
3599 ///
3600 /// * `name` - Required. To query for all of the operations for a project.
3601 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3602 ProjectLocationOperationListCall {
3603 hub: self.hub,
3604 _name: name.to_string(),
3605 _return_partial_success: Default::default(),
3606 _page_token: Default::default(),
3607 _page_size: Default::default(),
3608 _filter: Default::default(),
3609 _delegate: Default::default(),
3610 _additional_params: Default::default(),
3611 _scopes: Default::default(),
3612 }
3613 }
3614
3615 /// Create a builder to help you perform the following task:
3616 ///
3617 /// 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.
3618 ///
3619 /// # Arguments
3620 ///
3621 /// * `request` - No description provided.
3622 /// * `name` - The name of the operation resource to wait on.
3623 pub fn locations_operations_wait(
3624 &self,
3625 request: GoogleLongrunningWaitOperationRequest,
3626 name: &str,
3627 ) -> ProjectLocationOperationWaitCall<'a, C> {
3628 ProjectLocationOperationWaitCall {
3629 hub: self.hub,
3630 _request: request,
3631 _name: name.to_string(),
3632 _delegate: Default::default(),
3633 _additional_params: Default::default(),
3634 _scopes: Default::default(),
3635 }
3636 }
3637
3638 /// Create a builder to help you perform the following task:
3639 ///
3640 /// Delete a revision.
3641 ///
3642 /// # Arguments
3643 ///
3644 /// * `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
3645 pub fn locations_revisions_delete(
3646 &self,
3647 name: &str,
3648 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
3649 ProjectLocationRevisionDeleteCall {
3650 hub: self.hub,
3651 _name: name.to_string(),
3652 _propagation_policy: Default::default(),
3653 _kind: Default::default(),
3654 _dry_run: Default::default(),
3655 _api_version: Default::default(),
3656 _delegate: Default::default(),
3657 _additional_params: Default::default(),
3658 _scopes: Default::default(),
3659 }
3660 }
3661
3662 /// Create a builder to help you perform the following task:
3663 ///
3664 /// Get information about a revision.
3665 ///
3666 /// # Arguments
3667 ///
3668 /// * `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
3669 pub fn locations_revisions_get(&self, name: &str) -> ProjectLocationRevisionGetCall<'a, C> {
3670 ProjectLocationRevisionGetCall {
3671 hub: self.hub,
3672 _name: name.to_string(),
3673 _delegate: Default::default(),
3674 _additional_params: Default::default(),
3675 _scopes: Default::default(),
3676 }
3677 }
3678
3679 /// Create a builder to help you perform the following task:
3680 ///
3681 /// List revisions. Results are sorted by creation time, descending.
3682 ///
3683 /// # Arguments
3684 ///
3685 /// * `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
3686 pub fn locations_revisions_list(&self, parent: &str) -> ProjectLocationRevisionListCall<'a, C> {
3687 ProjectLocationRevisionListCall {
3688 hub: self.hub,
3689 _parent: parent.to_string(),
3690 _watch: Default::default(),
3691 _resource_version: Default::default(),
3692 _limit: Default::default(),
3693 _label_selector: Default::default(),
3694 _include_uninitialized: Default::default(),
3695 _field_selector: Default::default(),
3696 _continue_: Default::default(),
3697 _delegate: Default::default(),
3698 _additional_params: Default::default(),
3699 _scopes: Default::default(),
3700 }
3701 }
3702
3703 /// Create a builder to help you perform the following task:
3704 ///
3705 /// Get information about a route.
3706 ///
3707 /// # Arguments
3708 ///
3709 /// * `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
3710 pub fn locations_routes_get(&self, name: &str) -> ProjectLocationRouteGetCall<'a, C> {
3711 ProjectLocationRouteGetCall {
3712 hub: self.hub,
3713 _name: name.to_string(),
3714 _delegate: Default::default(),
3715 _additional_params: Default::default(),
3716 _scopes: Default::default(),
3717 }
3718 }
3719
3720 /// Create a builder to help you perform the following task:
3721 ///
3722 /// List routes. Results are sorted by creation time, descending.
3723 ///
3724 /// # Arguments
3725 ///
3726 /// * `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
3727 pub fn locations_routes_list(&self, parent: &str) -> ProjectLocationRouteListCall<'a, C> {
3728 ProjectLocationRouteListCall {
3729 hub: self.hub,
3730 _parent: parent.to_string(),
3731 _watch: Default::default(),
3732 _resource_version: Default::default(),
3733 _limit: Default::default(),
3734 _label_selector: Default::default(),
3735 _include_uninitialized: Default::default(),
3736 _field_selector: Default::default(),
3737 _continue_: Default::default(),
3738 _delegate: Default::default(),
3739 _additional_params: Default::default(),
3740 _scopes: Default::default(),
3741 }
3742 }
3743
3744 /// Create a builder to help you perform the following task:
3745 ///
3746 /// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
3747 ///
3748 /// # Arguments
3749 ///
3750 /// * `request` - No description provided.
3751 /// * `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}`
3752 pub fn locations_services_create(
3753 &self,
3754 request: Service,
3755 parent: &str,
3756 ) -> ProjectLocationServiceCreateCall<'a, C> {
3757 ProjectLocationServiceCreateCall {
3758 hub: self.hub,
3759 _request: request,
3760 _parent: parent.to_string(),
3761 _dry_run: Default::default(),
3762 _delegate: Default::default(),
3763 _additional_params: Default::default(),
3764 _scopes: Default::default(),
3765 }
3766 }
3767
3768 /// Create a builder to help you perform the following task:
3769 ///
3770 /// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
3771 ///
3772 /// # Arguments
3773 ///
3774 /// * `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}`
3775 pub fn locations_services_delete(&self, name: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
3776 ProjectLocationServiceDeleteCall {
3777 hub: self.hub,
3778 _name: name.to_string(),
3779 _propagation_policy: Default::default(),
3780 _kind: Default::default(),
3781 _dry_run: Default::default(),
3782 _api_version: Default::default(),
3783 _delegate: Default::default(),
3784 _additional_params: Default::default(),
3785 _scopes: Default::default(),
3786 }
3787 }
3788
3789 /// Create a builder to help you perform the following task:
3790 ///
3791 /// Gets information about a service.
3792 ///
3793 /// # Arguments
3794 ///
3795 /// * `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}`
3796 pub fn locations_services_get(&self, name: &str) -> ProjectLocationServiceGetCall<'a, C> {
3797 ProjectLocationServiceGetCall {
3798 hub: self.hub,
3799 _name: name.to_string(),
3800 _delegate: Default::default(),
3801 _additional_params: Default::default(),
3802 _scopes: Default::default(),
3803 }
3804 }
3805
3806 /// Create a builder to help you perform the following task:
3807 ///
3808 /// Gets the IAM Access Control policy currently in effect for the given Cloud Run service. This result does not include any inherited policies.
3809 ///
3810 /// # Arguments
3811 ///
3812 /// * `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.
3813 pub fn locations_services_get_iam_policy(
3814 &self,
3815 resource: &str,
3816 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
3817 ProjectLocationServiceGetIamPolicyCall {
3818 hub: self.hub,
3819 _resource: resource.to_string(),
3820 _options_requested_policy_version: Default::default(),
3821 _delegate: Default::default(),
3822 _additional_params: Default::default(),
3823 _scopes: Default::default(),
3824 }
3825 }
3826
3827 /// Create a builder to help you perform the following task:
3828 ///
3829 /// Lists services for the given project and region. Results are sorted by creation time, descending.
3830 ///
3831 /// # Arguments
3832 ///
3833 /// * `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}`
3834 pub fn locations_services_list(&self, parent: &str) -> ProjectLocationServiceListCall<'a, C> {
3835 ProjectLocationServiceListCall {
3836 hub: self.hub,
3837 _parent: parent.to_string(),
3838 _watch: Default::default(),
3839 _resource_version: Default::default(),
3840 _limit: Default::default(),
3841 _label_selector: Default::default(),
3842 _include_uninitialized: Default::default(),
3843 _field_selector: Default::default(),
3844 _continue_: Default::default(),
3845 _delegate: Default::default(),
3846 _additional_params: Default::default(),
3847 _scopes: Default::default(),
3848 }
3849 }
3850
3851 /// Create a builder to help you perform the following task:
3852 ///
3853 /// 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.
3854 ///
3855 /// # Arguments
3856 ///
3857 /// * `request` - No description provided.
3858 /// * `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}`
3859 pub fn locations_services_replace_service(
3860 &self,
3861 request: Service,
3862 name: &str,
3863 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
3864 ProjectLocationServiceReplaceServiceCall {
3865 hub: self.hub,
3866 _request: request,
3867 _name: name.to_string(),
3868 _dry_run: Default::default(),
3869 _delegate: Default::default(),
3870 _additional_params: Default::default(),
3871 _scopes: Default::default(),
3872 }
3873 }
3874
3875 /// Create a builder to help you perform the following task:
3876 ///
3877 /// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
3878 ///
3879 /// # Arguments
3880 ///
3881 /// * `request` - No description provided.
3882 /// * `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.
3883 pub fn locations_services_set_iam_policy(
3884 &self,
3885 request: SetIamPolicyRequest,
3886 resource: &str,
3887 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
3888 ProjectLocationServiceSetIamPolicyCall {
3889 hub: self.hub,
3890 _request: request,
3891 _resource: resource.to_string(),
3892 _delegate: Default::default(),
3893 _additional_params: Default::default(),
3894 _scopes: Default::default(),
3895 }
3896 }
3897
3898 /// Create a builder to help you perform the following task:
3899 ///
3900 /// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
3901 ///
3902 /// # Arguments
3903 ///
3904 /// * `request` - No description provided.
3905 /// * `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.
3906 pub fn locations_services_test_iam_permissions(
3907 &self,
3908 request: TestIamPermissionsRequest,
3909 resource: &str,
3910 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
3911 ProjectLocationServiceTestIamPermissionCall {
3912 hub: self.hub,
3913 _request: request,
3914 _resource: resource.to_string(),
3915 _delegate: Default::default(),
3916 _additional_params: Default::default(),
3917 _scopes: Default::default(),
3918 }
3919 }
3920
3921 /// Create a builder to help you perform the following task:
3922 ///
3923 /// Get the IAM Access Control policy currently in effect for the given worker pool. This result does not include any inherited policies.
3924 ///
3925 /// # Arguments
3926 ///
3927 /// * `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.
3928 pub fn locations_workerpools_get_iam_policy(
3929 &self,
3930 resource: &str,
3931 ) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {
3932 ProjectLocationWorkerpoolGetIamPolicyCall {
3933 hub: self.hub,
3934 _resource: resource.to_string(),
3935 _options_requested_policy_version: Default::default(),
3936 _delegate: Default::default(),
3937 _additional_params: Default::default(),
3938 _scopes: Default::default(),
3939 }
3940 }
3941
3942 /// Create a builder to help you perform the following task:
3943 ///
3944 /// Sets the IAM Access control policy for the specified worker pool. Overwrites any existing policy.
3945 ///
3946 /// # Arguments
3947 ///
3948 /// * `request` - No description provided.
3949 /// * `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.
3950 pub fn locations_workerpools_set_iam_policy(
3951 &self,
3952 request: SetIamPolicyRequest,
3953 resource: &str,
3954 ) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {
3955 ProjectLocationWorkerpoolSetIamPolicyCall {
3956 hub: self.hub,
3957 _request: request,
3958 _resource: resource.to_string(),
3959 _delegate: Default::default(),
3960 _additional_params: Default::default(),
3961 _scopes: Default::default(),
3962 }
3963 }
3964
3965 /// Create a builder to help you perform the following task:
3966 ///
3967 /// Returns permissions that a caller has on the specified worker pool. There are no permissions required for making this API call.
3968 ///
3969 /// # Arguments
3970 ///
3971 /// * `request` - No description provided.
3972 /// * `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.
3973 pub fn locations_workerpools_test_iam_permissions(
3974 &self,
3975 request: TestIamPermissionsRequest,
3976 resource: &str,
3977 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {
3978 ProjectLocationWorkerpoolTestIamPermissionCall {
3979 hub: self.hub,
3980 _request: request,
3981 _resource: resource.to_string(),
3982 _delegate: Default::default(),
3983 _additional_params: Default::default(),
3984 _scopes: Default::default(),
3985 }
3986 }
3987
3988 /// Create a builder to help you perform the following task:
3989 ///
3990 /// Lists information about the supported locations for this service.
3991 ///
3992 /// # Arguments
3993 ///
3994 /// * `name` - The resource that owns the locations collection, if applicable.
3995 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
3996 ProjectLocationListCall {
3997 hub: self.hub,
3998 _name: name.to_string(),
3999 _page_token: Default::default(),
4000 _page_size: Default::default(),
4001 _filter: Default::default(),
4002 _extra_location_types: Default::default(),
4003 _delegate: Default::default(),
4004 _additional_params: Default::default(),
4005 _scopes: Default::default(),
4006 }
4007 }
4008}
4009
4010// ###################
4011// CallBuilders ###
4012// #################
4013
4014/// List authorized domains.
4015///
4016/// A builder for the *authorizeddomains.list* method supported by a *namespace* resource.
4017/// It is not used directly, but through a [`NamespaceMethods`] instance.
4018///
4019/// # Example
4020///
4021/// Instantiate a resource method builder
4022///
4023/// ```test_harness,no_run
4024/// # extern crate hyper;
4025/// # extern crate hyper_rustls;
4026/// # extern crate google_run1 as run1;
4027/// # async fn dox() {
4028/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4029///
4030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4031/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4032/// # .with_native_roots()
4033/// # .unwrap()
4034/// # .https_only()
4035/// # .enable_http2()
4036/// # .build();
4037///
4038/// # let executor = hyper_util::rt::TokioExecutor::new();
4039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4040/// # secret,
4041/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4042/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4043/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4044/// # ),
4045/// # ).build().await.unwrap();
4046///
4047/// # let client = hyper_util::client::legacy::Client::builder(
4048/// # hyper_util::rt::TokioExecutor::new()
4049/// # )
4050/// # .build(
4051/// # hyper_rustls::HttpsConnectorBuilder::new()
4052/// # .with_native_roots()
4053/// # .unwrap()
4054/// # .https_or_http()
4055/// # .enable_http2()
4056/// # .build()
4057/// # );
4058/// # let mut hub = CloudRun::new(client, auth);
4059/// // You can configure optional parameters by calling the respective setters at will, and
4060/// // execute the final call using `doit()`.
4061/// // Values shown here are possibly random and not representative !
4062/// let result = hub.namespaces().authorizeddomains_list("parent")
4063/// .page_token("eos")
4064/// .page_size(-4)
4065/// .doit().await;
4066/// # }
4067/// ```
4068pub struct NamespaceAuthorizeddomainListCall<'a, C>
4069where
4070 C: 'a,
4071{
4072 hub: &'a CloudRun<C>,
4073 _parent: String,
4074 _page_token: Option<String>,
4075 _page_size: Option<i32>,
4076 _delegate: Option<&'a mut dyn common::Delegate>,
4077 _additional_params: HashMap<String, String>,
4078 _scopes: BTreeSet<String>,
4079}
4080
4081impl<'a, C> common::CallBuilder for NamespaceAuthorizeddomainListCall<'a, C> {}
4082
4083impl<'a, C> NamespaceAuthorizeddomainListCall<'a, C>
4084where
4085 C: common::Connector,
4086{
4087 /// Perform the operation you have build so far.
4088 pub async fn doit(
4089 mut self,
4090 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
4091 use std::borrow::Cow;
4092 use std::io::{Read, Seek};
4093
4094 use common::{url::Params, ToParts};
4095 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4096
4097 let mut dd = common::DefaultDelegate;
4098 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4099 dlg.begin(common::MethodInfo {
4100 id: "run.namespaces.authorizeddomains.list",
4101 http_method: hyper::Method::GET,
4102 });
4103
4104 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4105 if self._additional_params.contains_key(field) {
4106 dlg.finished(false);
4107 return Err(common::Error::FieldClash(field));
4108 }
4109 }
4110
4111 let mut params = Params::with_capacity(5 + self._additional_params.len());
4112 params.push("parent", self._parent);
4113 if let Some(value) = self._page_token.as_ref() {
4114 params.push("pageToken", value);
4115 }
4116 if let Some(value) = self._page_size.as_ref() {
4117 params.push("pageSize", value.to_string());
4118 }
4119
4120 params.extend(self._additional_params.iter());
4121
4122 params.push("alt", "json");
4123 let mut url =
4124 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/authorizeddomains";
4125 if self._scopes.is_empty() {
4126 self._scopes
4127 .insert(Scope::CloudPlatform.as_ref().to_string());
4128 }
4129
4130 #[allow(clippy::single_element_loop)]
4131 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4132 url = params.uri_replacement(url, param_name, find_this, true);
4133 }
4134 {
4135 let to_remove = ["parent"];
4136 params.remove_params(&to_remove);
4137 }
4138
4139 let url = params.parse_with_url(&url);
4140
4141 loop {
4142 let token = match self
4143 .hub
4144 .auth
4145 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4146 .await
4147 {
4148 Ok(token) => token,
4149 Err(e) => match dlg.token(e) {
4150 Ok(token) => token,
4151 Err(e) => {
4152 dlg.finished(false);
4153 return Err(common::Error::MissingToken(e));
4154 }
4155 },
4156 };
4157 let mut req_result = {
4158 let client = &self.hub.client;
4159 dlg.pre_request();
4160 let mut req_builder = hyper::Request::builder()
4161 .method(hyper::Method::GET)
4162 .uri(url.as_str())
4163 .header(USER_AGENT, self.hub._user_agent.clone());
4164
4165 if let Some(token) = token.as_ref() {
4166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4167 }
4168
4169 let request = req_builder
4170 .header(CONTENT_LENGTH, 0_u64)
4171 .body(common::to_body::<String>(None));
4172
4173 client.request(request.unwrap()).await
4174 };
4175
4176 match req_result {
4177 Err(err) => {
4178 if let common::Retry::After(d) = dlg.http_error(&err) {
4179 sleep(d).await;
4180 continue;
4181 }
4182 dlg.finished(false);
4183 return Err(common::Error::HttpError(err));
4184 }
4185 Ok(res) => {
4186 let (mut parts, body) = res.into_parts();
4187 let mut body = common::Body::new(body);
4188 if !parts.status.is_success() {
4189 let bytes = common::to_bytes(body).await.unwrap_or_default();
4190 let error = serde_json::from_str(&common::to_string(&bytes));
4191 let response = common::to_response(parts, bytes.into());
4192
4193 if let common::Retry::After(d) =
4194 dlg.http_failure(&response, error.as_ref().ok())
4195 {
4196 sleep(d).await;
4197 continue;
4198 }
4199
4200 dlg.finished(false);
4201
4202 return Err(match error {
4203 Ok(value) => common::Error::BadRequest(value),
4204 _ => common::Error::Failure(response),
4205 });
4206 }
4207 let response = {
4208 let bytes = common::to_bytes(body).await.unwrap_or_default();
4209 let encoded = common::to_string(&bytes);
4210 match serde_json::from_str(&encoded) {
4211 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4212 Err(error) => {
4213 dlg.response_json_decode_error(&encoded, &error);
4214 return Err(common::Error::JsonDecodeError(
4215 encoded.to_string(),
4216 error,
4217 ));
4218 }
4219 }
4220 };
4221
4222 dlg.finished(true);
4223 return Ok(response);
4224 }
4225 }
4226 }
4227 }
4228
4229 /// Name of the parent Project resource. Example: `projects/myproject`.
4230 ///
4231 /// Sets the *parent* path property to the given value.
4232 ///
4233 /// Even though the property as already been set when instantiating this call,
4234 /// we provide this method for API completeness.
4235 pub fn parent(mut self, new_value: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
4236 self._parent = new_value.to_string();
4237 self
4238 }
4239 /// Continuation token for fetching the next page of results.
4240 ///
4241 /// Sets the *page token* query property to the given value.
4242 pub fn page_token(mut self, new_value: &str) -> NamespaceAuthorizeddomainListCall<'a, C> {
4243 self._page_token = Some(new_value.to_string());
4244 self
4245 }
4246 /// Maximum results to return per page.
4247 ///
4248 /// Sets the *page size* query property to the given value.
4249 pub fn page_size(mut self, new_value: i32) -> NamespaceAuthorizeddomainListCall<'a, C> {
4250 self._page_size = Some(new_value);
4251 self
4252 }
4253 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4254 /// while executing the actual API request.
4255 ///
4256 /// ````text
4257 /// It should be used to handle progress information, and to implement a certain level of resilience.
4258 /// ````
4259 ///
4260 /// Sets the *delegate* property to the given value.
4261 pub fn delegate(
4262 mut self,
4263 new_value: &'a mut dyn common::Delegate,
4264 ) -> NamespaceAuthorizeddomainListCall<'a, C> {
4265 self._delegate = Some(new_value);
4266 self
4267 }
4268
4269 /// Set any additional parameter of the query string used in the request.
4270 /// It should be used to set parameters which are not yet available through their own
4271 /// setters.
4272 ///
4273 /// Please note that this method must not be used to set any of the known parameters
4274 /// which have their own setter method. If done anyway, the request will fail.
4275 ///
4276 /// # Additional Parameters
4277 ///
4278 /// * *$.xgafv* (query-string) - V1 error format.
4279 /// * *access_token* (query-string) - OAuth access token.
4280 /// * *alt* (query-string) - Data format for response.
4281 /// * *callback* (query-string) - JSONP
4282 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4283 /// * *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.
4284 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4285 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4286 /// * *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.
4287 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4288 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4289 pub fn param<T>(mut self, name: T, value: T) -> NamespaceAuthorizeddomainListCall<'a, C>
4290 where
4291 T: AsRef<str>,
4292 {
4293 self._additional_params
4294 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4295 self
4296 }
4297
4298 /// Identifies the authorization scope for the method you are building.
4299 ///
4300 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4301 /// [`Scope::CloudPlatform`].
4302 ///
4303 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4304 /// tokens for more than one scope.
4305 ///
4306 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4307 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4308 /// sufficient, a read-write scope will do as well.
4309 pub fn add_scope<St>(mut self, scope: St) -> NamespaceAuthorizeddomainListCall<'a, C>
4310 where
4311 St: AsRef<str>,
4312 {
4313 self._scopes.insert(String::from(scope.as_ref()));
4314 self
4315 }
4316 /// Identifies the authorization scope(s) for the method you are building.
4317 ///
4318 /// See [`Self::add_scope()`] for details.
4319 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceAuthorizeddomainListCall<'a, C>
4320 where
4321 I: IntoIterator<Item = St>,
4322 St: AsRef<str>,
4323 {
4324 self._scopes
4325 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4326 self
4327 }
4328
4329 /// Removes all scopes, and no default scope will be used either.
4330 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4331 /// for details).
4332 pub fn clear_scopes(mut self) -> NamespaceAuthorizeddomainListCall<'a, C> {
4333 self._scopes.clear();
4334 self
4335 }
4336}
4337
4338/// Get information about a configuration.
4339///
4340/// A builder for the *configurations.get* method supported by a *namespace* resource.
4341/// It is not used directly, but through a [`NamespaceMethods`] instance.
4342///
4343/// # Example
4344///
4345/// Instantiate a resource method builder
4346///
4347/// ```test_harness,no_run
4348/// # extern crate hyper;
4349/// # extern crate hyper_rustls;
4350/// # extern crate google_run1 as run1;
4351/// # async fn dox() {
4352/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4353///
4354/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4355/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4356/// # .with_native_roots()
4357/// # .unwrap()
4358/// # .https_only()
4359/// # .enable_http2()
4360/// # .build();
4361///
4362/// # let executor = hyper_util::rt::TokioExecutor::new();
4363/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4364/// # secret,
4365/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4366/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4367/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4368/// # ),
4369/// # ).build().await.unwrap();
4370///
4371/// # let client = hyper_util::client::legacy::Client::builder(
4372/// # hyper_util::rt::TokioExecutor::new()
4373/// # )
4374/// # .build(
4375/// # hyper_rustls::HttpsConnectorBuilder::new()
4376/// # .with_native_roots()
4377/// # .unwrap()
4378/// # .https_or_http()
4379/// # .enable_http2()
4380/// # .build()
4381/// # );
4382/// # let mut hub = CloudRun::new(client, auth);
4383/// // You can configure optional parameters by calling the respective setters at will, and
4384/// // execute the final call using `doit()`.
4385/// // Values shown here are possibly random and not representative !
4386/// let result = hub.namespaces().configurations_get("name")
4387/// .doit().await;
4388/// # }
4389/// ```
4390pub struct NamespaceConfigurationGetCall<'a, C>
4391where
4392 C: 'a,
4393{
4394 hub: &'a CloudRun<C>,
4395 _name: String,
4396 _delegate: Option<&'a mut dyn common::Delegate>,
4397 _additional_params: HashMap<String, String>,
4398 _scopes: BTreeSet<String>,
4399}
4400
4401impl<'a, C> common::CallBuilder for NamespaceConfigurationGetCall<'a, C> {}
4402
4403impl<'a, C> NamespaceConfigurationGetCall<'a, C>
4404where
4405 C: common::Connector,
4406{
4407 /// Perform the operation you have build so far.
4408 pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
4409 use std::borrow::Cow;
4410 use std::io::{Read, Seek};
4411
4412 use common::{url::Params, ToParts};
4413 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4414
4415 let mut dd = common::DefaultDelegate;
4416 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4417 dlg.begin(common::MethodInfo {
4418 id: "run.namespaces.configurations.get",
4419 http_method: hyper::Method::GET,
4420 });
4421
4422 for &field in ["alt", "name"].iter() {
4423 if self._additional_params.contains_key(field) {
4424 dlg.finished(false);
4425 return Err(common::Error::FieldClash(field));
4426 }
4427 }
4428
4429 let mut params = Params::with_capacity(3 + self._additional_params.len());
4430 params.push("name", self._name);
4431
4432 params.extend(self._additional_params.iter());
4433
4434 params.push("alt", "json");
4435 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
4436 if self._scopes.is_empty() {
4437 self._scopes
4438 .insert(Scope::CloudPlatform.as_ref().to_string());
4439 }
4440
4441 #[allow(clippy::single_element_loop)]
4442 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4443 url = params.uri_replacement(url, param_name, find_this, true);
4444 }
4445 {
4446 let to_remove = ["name"];
4447 params.remove_params(&to_remove);
4448 }
4449
4450 let url = params.parse_with_url(&url);
4451
4452 loop {
4453 let token = match self
4454 .hub
4455 .auth
4456 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4457 .await
4458 {
4459 Ok(token) => token,
4460 Err(e) => match dlg.token(e) {
4461 Ok(token) => token,
4462 Err(e) => {
4463 dlg.finished(false);
4464 return Err(common::Error::MissingToken(e));
4465 }
4466 },
4467 };
4468 let mut req_result = {
4469 let client = &self.hub.client;
4470 dlg.pre_request();
4471 let mut req_builder = hyper::Request::builder()
4472 .method(hyper::Method::GET)
4473 .uri(url.as_str())
4474 .header(USER_AGENT, self.hub._user_agent.clone());
4475
4476 if let Some(token) = token.as_ref() {
4477 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4478 }
4479
4480 let request = req_builder
4481 .header(CONTENT_LENGTH, 0_u64)
4482 .body(common::to_body::<String>(None));
4483
4484 client.request(request.unwrap()).await
4485 };
4486
4487 match req_result {
4488 Err(err) => {
4489 if let common::Retry::After(d) = dlg.http_error(&err) {
4490 sleep(d).await;
4491 continue;
4492 }
4493 dlg.finished(false);
4494 return Err(common::Error::HttpError(err));
4495 }
4496 Ok(res) => {
4497 let (mut parts, body) = res.into_parts();
4498 let mut body = common::Body::new(body);
4499 if !parts.status.is_success() {
4500 let bytes = common::to_bytes(body).await.unwrap_or_default();
4501 let error = serde_json::from_str(&common::to_string(&bytes));
4502 let response = common::to_response(parts, bytes.into());
4503
4504 if let common::Retry::After(d) =
4505 dlg.http_failure(&response, error.as_ref().ok())
4506 {
4507 sleep(d).await;
4508 continue;
4509 }
4510
4511 dlg.finished(false);
4512
4513 return Err(match error {
4514 Ok(value) => common::Error::BadRequest(value),
4515 _ => common::Error::Failure(response),
4516 });
4517 }
4518 let response = {
4519 let bytes = common::to_bytes(body).await.unwrap_or_default();
4520 let encoded = common::to_string(&bytes);
4521 match serde_json::from_str(&encoded) {
4522 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4523 Err(error) => {
4524 dlg.response_json_decode_error(&encoded, &error);
4525 return Err(common::Error::JsonDecodeError(
4526 encoded.to_string(),
4527 error,
4528 ));
4529 }
4530 }
4531 };
4532
4533 dlg.finished(true);
4534 return Ok(response);
4535 }
4536 }
4537 }
4538 }
4539
4540 /// The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
4541 ///
4542 /// Sets the *name* path property to the given value.
4543 ///
4544 /// Even though the property as already been set when instantiating this call,
4545 /// we provide this method for API completeness.
4546 pub fn name(mut self, new_value: &str) -> NamespaceConfigurationGetCall<'a, C> {
4547 self._name = new_value.to_string();
4548 self
4549 }
4550 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4551 /// while executing the actual API request.
4552 ///
4553 /// ````text
4554 /// It should be used to handle progress information, and to implement a certain level of resilience.
4555 /// ````
4556 ///
4557 /// Sets the *delegate* property to the given value.
4558 pub fn delegate(
4559 mut self,
4560 new_value: &'a mut dyn common::Delegate,
4561 ) -> NamespaceConfigurationGetCall<'a, C> {
4562 self._delegate = Some(new_value);
4563 self
4564 }
4565
4566 /// Set any additional parameter of the query string used in the request.
4567 /// It should be used to set parameters which are not yet available through their own
4568 /// setters.
4569 ///
4570 /// Please note that this method must not be used to set any of the known parameters
4571 /// which have their own setter method. If done anyway, the request will fail.
4572 ///
4573 /// # Additional Parameters
4574 ///
4575 /// * *$.xgafv* (query-string) - V1 error format.
4576 /// * *access_token* (query-string) - OAuth access token.
4577 /// * *alt* (query-string) - Data format for response.
4578 /// * *callback* (query-string) - JSONP
4579 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4580 /// * *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.
4581 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4582 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4583 /// * *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.
4584 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4585 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4586 pub fn param<T>(mut self, name: T, value: T) -> NamespaceConfigurationGetCall<'a, C>
4587 where
4588 T: AsRef<str>,
4589 {
4590 self._additional_params
4591 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4592 self
4593 }
4594
4595 /// Identifies the authorization scope for the method you are building.
4596 ///
4597 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4598 /// [`Scope::CloudPlatform`].
4599 ///
4600 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4601 /// tokens for more than one scope.
4602 ///
4603 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4604 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4605 /// sufficient, a read-write scope will do as well.
4606 pub fn add_scope<St>(mut self, scope: St) -> NamespaceConfigurationGetCall<'a, C>
4607 where
4608 St: AsRef<str>,
4609 {
4610 self._scopes.insert(String::from(scope.as_ref()));
4611 self
4612 }
4613 /// Identifies the authorization scope(s) for the method you are building.
4614 ///
4615 /// See [`Self::add_scope()`] for details.
4616 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceConfigurationGetCall<'a, C>
4617 where
4618 I: IntoIterator<Item = St>,
4619 St: AsRef<str>,
4620 {
4621 self._scopes
4622 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4623 self
4624 }
4625
4626 /// Removes all scopes, and no default scope will be used either.
4627 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4628 /// for details).
4629 pub fn clear_scopes(mut self) -> NamespaceConfigurationGetCall<'a, C> {
4630 self._scopes.clear();
4631 self
4632 }
4633}
4634
4635/// List configurations. Results are sorted by creation time, descending.
4636///
4637/// A builder for the *configurations.list* method supported by a *namespace* resource.
4638/// It is not used directly, but through a [`NamespaceMethods`] instance.
4639///
4640/// # Example
4641///
4642/// Instantiate a resource method builder
4643///
4644/// ```test_harness,no_run
4645/// # extern crate hyper;
4646/// # extern crate hyper_rustls;
4647/// # extern crate google_run1 as run1;
4648/// # async fn dox() {
4649/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4650///
4651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4653/// # .with_native_roots()
4654/// # .unwrap()
4655/// # .https_only()
4656/// # .enable_http2()
4657/// # .build();
4658///
4659/// # let executor = hyper_util::rt::TokioExecutor::new();
4660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4661/// # secret,
4662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4665/// # ),
4666/// # ).build().await.unwrap();
4667///
4668/// # let client = hyper_util::client::legacy::Client::builder(
4669/// # hyper_util::rt::TokioExecutor::new()
4670/// # )
4671/// # .build(
4672/// # hyper_rustls::HttpsConnectorBuilder::new()
4673/// # .with_native_roots()
4674/// # .unwrap()
4675/// # .https_or_http()
4676/// # .enable_http2()
4677/// # .build()
4678/// # );
4679/// # let mut hub = CloudRun::new(client, auth);
4680/// // You can configure optional parameters by calling the respective setters at will, and
4681/// // execute the final call using `doit()`.
4682/// // Values shown here are possibly random and not representative !
4683/// let result = hub.namespaces().configurations_list("parent")
4684/// .watch(false)
4685/// .resource_version("amet")
4686/// .limit(-20)
4687/// .label_selector("ipsum")
4688/// .include_uninitialized(false)
4689/// .field_selector("ut")
4690/// .continue_("gubergren")
4691/// .doit().await;
4692/// # }
4693/// ```
4694pub struct NamespaceConfigurationListCall<'a, C>
4695where
4696 C: 'a,
4697{
4698 hub: &'a CloudRun<C>,
4699 _parent: String,
4700 _watch: Option<bool>,
4701 _resource_version: Option<String>,
4702 _limit: Option<i32>,
4703 _label_selector: Option<String>,
4704 _include_uninitialized: Option<bool>,
4705 _field_selector: Option<String>,
4706 _continue_: Option<String>,
4707 _delegate: Option<&'a mut dyn common::Delegate>,
4708 _additional_params: HashMap<String, String>,
4709 _scopes: BTreeSet<String>,
4710}
4711
4712impl<'a, C> common::CallBuilder for NamespaceConfigurationListCall<'a, C> {}
4713
4714impl<'a, C> NamespaceConfigurationListCall<'a, C>
4715where
4716 C: common::Connector,
4717{
4718 /// Perform the operation you have build so far.
4719 pub async fn doit(mut self) -> common::Result<(common::Response, ListConfigurationsResponse)> {
4720 use std::borrow::Cow;
4721 use std::io::{Read, Seek};
4722
4723 use common::{url::Params, ToParts};
4724 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4725
4726 let mut dd = common::DefaultDelegate;
4727 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4728 dlg.begin(common::MethodInfo {
4729 id: "run.namespaces.configurations.list",
4730 http_method: hyper::Method::GET,
4731 });
4732
4733 for &field in [
4734 "alt",
4735 "parent",
4736 "watch",
4737 "resourceVersion",
4738 "limit",
4739 "labelSelector",
4740 "includeUninitialized",
4741 "fieldSelector",
4742 "continue",
4743 ]
4744 .iter()
4745 {
4746 if self._additional_params.contains_key(field) {
4747 dlg.finished(false);
4748 return Err(common::Error::FieldClash(field));
4749 }
4750 }
4751
4752 let mut params = Params::with_capacity(10 + self._additional_params.len());
4753 params.push("parent", self._parent);
4754 if let Some(value) = self._watch.as_ref() {
4755 params.push("watch", value.to_string());
4756 }
4757 if let Some(value) = self._resource_version.as_ref() {
4758 params.push("resourceVersion", value);
4759 }
4760 if let Some(value) = self._limit.as_ref() {
4761 params.push("limit", value.to_string());
4762 }
4763 if let Some(value) = self._label_selector.as_ref() {
4764 params.push("labelSelector", value);
4765 }
4766 if let Some(value) = self._include_uninitialized.as_ref() {
4767 params.push("includeUninitialized", value.to_string());
4768 }
4769 if let Some(value) = self._field_selector.as_ref() {
4770 params.push("fieldSelector", value);
4771 }
4772 if let Some(value) = self._continue_.as_ref() {
4773 params.push("continue", value);
4774 }
4775
4776 params.extend(self._additional_params.iter());
4777
4778 params.push("alt", "json");
4779 let mut url =
4780 self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/configurations";
4781 if self._scopes.is_empty() {
4782 self._scopes
4783 .insert(Scope::CloudPlatform.as_ref().to_string());
4784 }
4785
4786 #[allow(clippy::single_element_loop)]
4787 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4788 url = params.uri_replacement(url, param_name, find_this, true);
4789 }
4790 {
4791 let to_remove = ["parent"];
4792 params.remove_params(&to_remove);
4793 }
4794
4795 let url = params.parse_with_url(&url);
4796
4797 loop {
4798 let token = match self
4799 .hub
4800 .auth
4801 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4802 .await
4803 {
4804 Ok(token) => token,
4805 Err(e) => match dlg.token(e) {
4806 Ok(token) => token,
4807 Err(e) => {
4808 dlg.finished(false);
4809 return Err(common::Error::MissingToken(e));
4810 }
4811 },
4812 };
4813 let mut req_result = {
4814 let client = &self.hub.client;
4815 dlg.pre_request();
4816 let mut req_builder = hyper::Request::builder()
4817 .method(hyper::Method::GET)
4818 .uri(url.as_str())
4819 .header(USER_AGENT, self.hub._user_agent.clone());
4820
4821 if let Some(token) = token.as_ref() {
4822 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4823 }
4824
4825 let request = req_builder
4826 .header(CONTENT_LENGTH, 0_u64)
4827 .body(common::to_body::<String>(None));
4828
4829 client.request(request.unwrap()).await
4830 };
4831
4832 match req_result {
4833 Err(err) => {
4834 if let common::Retry::After(d) = dlg.http_error(&err) {
4835 sleep(d).await;
4836 continue;
4837 }
4838 dlg.finished(false);
4839 return Err(common::Error::HttpError(err));
4840 }
4841 Ok(res) => {
4842 let (mut parts, body) = res.into_parts();
4843 let mut body = common::Body::new(body);
4844 if !parts.status.is_success() {
4845 let bytes = common::to_bytes(body).await.unwrap_or_default();
4846 let error = serde_json::from_str(&common::to_string(&bytes));
4847 let response = common::to_response(parts, bytes.into());
4848
4849 if let common::Retry::After(d) =
4850 dlg.http_failure(&response, error.as_ref().ok())
4851 {
4852 sleep(d).await;
4853 continue;
4854 }
4855
4856 dlg.finished(false);
4857
4858 return Err(match error {
4859 Ok(value) => common::Error::BadRequest(value),
4860 _ => common::Error::Failure(response),
4861 });
4862 }
4863 let response = {
4864 let bytes = common::to_bytes(body).await.unwrap_or_default();
4865 let encoded = common::to_string(&bytes);
4866 match serde_json::from_str(&encoded) {
4867 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4868 Err(error) => {
4869 dlg.response_json_decode_error(&encoded, &error);
4870 return Err(common::Error::JsonDecodeError(
4871 encoded.to_string(),
4872 error,
4873 ));
4874 }
4875 }
4876 };
4877
4878 dlg.finished(true);
4879 return Ok(response);
4880 }
4881 }
4882 }
4883 }
4884
4885 /// The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
4886 ///
4887 /// Sets the *parent* path property to the given value.
4888 ///
4889 /// Even though the property as already been set when instantiating this call,
4890 /// we provide this method for API completeness.
4891 pub fn parent(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4892 self._parent = new_value.to_string();
4893 self
4894 }
4895 /// Not supported by Cloud Run.
4896 ///
4897 /// Sets the *watch* query property to the given value.
4898 pub fn watch(mut self, new_value: bool) -> NamespaceConfigurationListCall<'a, C> {
4899 self._watch = Some(new_value);
4900 self
4901 }
4902 /// Not supported by Cloud Run.
4903 ///
4904 /// Sets the *resource version* query property to the given value.
4905 pub fn resource_version(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4906 self._resource_version = Some(new_value.to_string());
4907 self
4908 }
4909 /// Optional. The maximum number of the records that should be returned.
4910 ///
4911 /// Sets the *limit* query property to the given value.
4912 pub fn limit(mut self, new_value: i32) -> NamespaceConfigurationListCall<'a, C> {
4913 self._limit = Some(new_value);
4914 self
4915 }
4916 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
4917 ///
4918 /// Sets the *label selector* query property to the given value.
4919 pub fn label_selector(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4920 self._label_selector = Some(new_value.to_string());
4921 self
4922 }
4923 /// Not supported by Cloud Run.
4924 ///
4925 /// Sets the *include uninitialized* query property to the given value.
4926 pub fn include_uninitialized(
4927 mut self,
4928 new_value: bool,
4929 ) -> NamespaceConfigurationListCall<'a, C> {
4930 self._include_uninitialized = Some(new_value);
4931 self
4932 }
4933 /// Not supported by Cloud Run.
4934 ///
4935 /// Sets the *field selector* query property to the given value.
4936 pub fn field_selector(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4937 self._field_selector = Some(new_value.to_string());
4938 self
4939 }
4940 /// Optional. Encoded string to continue paging.
4941 ///
4942 /// Sets the *continue* query property to the given value.
4943 pub fn continue_(mut self, new_value: &str) -> NamespaceConfigurationListCall<'a, C> {
4944 self._continue_ = Some(new_value.to_string());
4945 self
4946 }
4947 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4948 /// while executing the actual API request.
4949 ///
4950 /// ````text
4951 /// It should be used to handle progress information, and to implement a certain level of resilience.
4952 /// ````
4953 ///
4954 /// Sets the *delegate* property to the given value.
4955 pub fn delegate(
4956 mut self,
4957 new_value: &'a mut dyn common::Delegate,
4958 ) -> NamespaceConfigurationListCall<'a, C> {
4959 self._delegate = Some(new_value);
4960 self
4961 }
4962
4963 /// Set any additional parameter of the query string used in the request.
4964 /// It should be used to set parameters which are not yet available through their own
4965 /// setters.
4966 ///
4967 /// Please note that this method must not be used to set any of the known parameters
4968 /// which have their own setter method. If done anyway, the request will fail.
4969 ///
4970 /// # Additional Parameters
4971 ///
4972 /// * *$.xgafv* (query-string) - V1 error format.
4973 /// * *access_token* (query-string) - OAuth access token.
4974 /// * *alt* (query-string) - Data format for response.
4975 /// * *callback* (query-string) - JSONP
4976 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4977 /// * *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.
4978 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4979 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4980 /// * *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.
4981 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4982 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4983 pub fn param<T>(mut self, name: T, value: T) -> NamespaceConfigurationListCall<'a, C>
4984 where
4985 T: AsRef<str>,
4986 {
4987 self._additional_params
4988 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4989 self
4990 }
4991
4992 /// Identifies the authorization scope for the method you are building.
4993 ///
4994 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4995 /// [`Scope::CloudPlatform`].
4996 ///
4997 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4998 /// tokens for more than one scope.
4999 ///
5000 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5001 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5002 /// sufficient, a read-write scope will do as well.
5003 pub fn add_scope<St>(mut self, scope: St) -> NamespaceConfigurationListCall<'a, C>
5004 where
5005 St: AsRef<str>,
5006 {
5007 self._scopes.insert(String::from(scope.as_ref()));
5008 self
5009 }
5010 /// Identifies the authorization scope(s) for the method you are building.
5011 ///
5012 /// See [`Self::add_scope()`] for details.
5013 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceConfigurationListCall<'a, C>
5014 where
5015 I: IntoIterator<Item = St>,
5016 St: AsRef<str>,
5017 {
5018 self._scopes
5019 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5020 self
5021 }
5022
5023 /// Removes all scopes, and no default scope will be used either.
5024 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5025 /// for details).
5026 pub fn clear_scopes(mut self) -> NamespaceConfigurationListCall<'a, C> {
5027 self._scopes.clear();
5028 self
5029 }
5030}
5031
5032/// Create a new domain mapping.
5033///
5034/// A builder for the *domainmappings.create* method supported by a *namespace* resource.
5035/// It is not used directly, but through a [`NamespaceMethods`] instance.
5036///
5037/// # Example
5038///
5039/// Instantiate a resource method builder
5040///
5041/// ```test_harness,no_run
5042/// # extern crate hyper;
5043/// # extern crate hyper_rustls;
5044/// # extern crate google_run1 as run1;
5045/// use run1::api::DomainMapping;
5046/// # async fn dox() {
5047/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5048///
5049/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5050/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5051/// # .with_native_roots()
5052/// # .unwrap()
5053/// # .https_only()
5054/// # .enable_http2()
5055/// # .build();
5056///
5057/// # let executor = hyper_util::rt::TokioExecutor::new();
5058/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5059/// # secret,
5060/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5061/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5062/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5063/// # ),
5064/// # ).build().await.unwrap();
5065///
5066/// # let client = hyper_util::client::legacy::Client::builder(
5067/// # hyper_util::rt::TokioExecutor::new()
5068/// # )
5069/// # .build(
5070/// # hyper_rustls::HttpsConnectorBuilder::new()
5071/// # .with_native_roots()
5072/// # .unwrap()
5073/// # .https_or_http()
5074/// # .enable_http2()
5075/// # .build()
5076/// # );
5077/// # let mut hub = CloudRun::new(client, auth);
5078/// // As the method needs a request, you would usually fill it with the desired information
5079/// // into the respective structure. Some of the parts shown here might not be applicable !
5080/// // Values shown here are possibly random and not representative !
5081/// let mut req = DomainMapping::default();
5082///
5083/// // You can configure optional parameters by calling the respective setters at will, and
5084/// // execute the final call using `doit()`.
5085/// // Values shown here are possibly random and not representative !
5086/// let result = hub.namespaces().domainmappings_create(req, "parent")
5087/// .dry_run("est")
5088/// .doit().await;
5089/// # }
5090/// ```
5091pub struct NamespaceDomainmappingCreateCall<'a, C>
5092where
5093 C: 'a,
5094{
5095 hub: &'a CloudRun<C>,
5096 _request: DomainMapping,
5097 _parent: String,
5098 _dry_run: Option<String>,
5099 _delegate: Option<&'a mut dyn common::Delegate>,
5100 _additional_params: HashMap<String, String>,
5101 _scopes: BTreeSet<String>,
5102}
5103
5104impl<'a, C> common::CallBuilder for NamespaceDomainmappingCreateCall<'a, C> {}
5105
5106impl<'a, C> NamespaceDomainmappingCreateCall<'a, C>
5107where
5108 C: common::Connector,
5109{
5110 /// Perform the operation you have build so far.
5111 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
5112 use std::borrow::Cow;
5113 use std::io::{Read, Seek};
5114
5115 use common::{url::Params, ToParts};
5116 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5117
5118 let mut dd = common::DefaultDelegate;
5119 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5120 dlg.begin(common::MethodInfo {
5121 id: "run.namespaces.domainmappings.create",
5122 http_method: hyper::Method::POST,
5123 });
5124
5125 for &field in ["alt", "parent", "dryRun"].iter() {
5126 if self._additional_params.contains_key(field) {
5127 dlg.finished(false);
5128 return Err(common::Error::FieldClash(field));
5129 }
5130 }
5131
5132 let mut params = Params::with_capacity(5 + self._additional_params.len());
5133 params.push("parent", self._parent);
5134 if let Some(value) = self._dry_run.as_ref() {
5135 params.push("dryRun", value);
5136 }
5137
5138 params.extend(self._additional_params.iter());
5139
5140 params.push("alt", "json");
5141 let mut url =
5142 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/domainmappings";
5143 if self._scopes.is_empty() {
5144 self._scopes
5145 .insert(Scope::CloudPlatform.as_ref().to_string());
5146 }
5147
5148 #[allow(clippy::single_element_loop)]
5149 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5150 url = params.uri_replacement(url, param_name, find_this, true);
5151 }
5152 {
5153 let to_remove = ["parent"];
5154 params.remove_params(&to_remove);
5155 }
5156
5157 let url = params.parse_with_url(&url);
5158
5159 let mut json_mime_type = mime::APPLICATION_JSON;
5160 let mut request_value_reader = {
5161 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5162 common::remove_json_null_values(&mut value);
5163 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5164 serde_json::to_writer(&mut dst, &value).unwrap();
5165 dst
5166 };
5167 let request_size = request_value_reader
5168 .seek(std::io::SeekFrom::End(0))
5169 .unwrap();
5170 request_value_reader
5171 .seek(std::io::SeekFrom::Start(0))
5172 .unwrap();
5173
5174 loop {
5175 let token = match self
5176 .hub
5177 .auth
5178 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5179 .await
5180 {
5181 Ok(token) => token,
5182 Err(e) => match dlg.token(e) {
5183 Ok(token) => token,
5184 Err(e) => {
5185 dlg.finished(false);
5186 return Err(common::Error::MissingToken(e));
5187 }
5188 },
5189 };
5190 request_value_reader
5191 .seek(std::io::SeekFrom::Start(0))
5192 .unwrap();
5193 let mut req_result = {
5194 let client = &self.hub.client;
5195 dlg.pre_request();
5196 let mut req_builder = hyper::Request::builder()
5197 .method(hyper::Method::POST)
5198 .uri(url.as_str())
5199 .header(USER_AGENT, self.hub._user_agent.clone());
5200
5201 if let Some(token) = token.as_ref() {
5202 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5203 }
5204
5205 let request = req_builder
5206 .header(CONTENT_TYPE, json_mime_type.to_string())
5207 .header(CONTENT_LENGTH, request_size as u64)
5208 .body(common::to_body(
5209 request_value_reader.get_ref().clone().into(),
5210 ));
5211
5212 client.request(request.unwrap()).await
5213 };
5214
5215 match req_result {
5216 Err(err) => {
5217 if let common::Retry::After(d) = dlg.http_error(&err) {
5218 sleep(d).await;
5219 continue;
5220 }
5221 dlg.finished(false);
5222 return Err(common::Error::HttpError(err));
5223 }
5224 Ok(res) => {
5225 let (mut parts, body) = res.into_parts();
5226 let mut body = common::Body::new(body);
5227 if !parts.status.is_success() {
5228 let bytes = common::to_bytes(body).await.unwrap_or_default();
5229 let error = serde_json::from_str(&common::to_string(&bytes));
5230 let response = common::to_response(parts, bytes.into());
5231
5232 if let common::Retry::After(d) =
5233 dlg.http_failure(&response, error.as_ref().ok())
5234 {
5235 sleep(d).await;
5236 continue;
5237 }
5238
5239 dlg.finished(false);
5240
5241 return Err(match error {
5242 Ok(value) => common::Error::BadRequest(value),
5243 _ => common::Error::Failure(response),
5244 });
5245 }
5246 let response = {
5247 let bytes = common::to_bytes(body).await.unwrap_or_default();
5248 let encoded = common::to_string(&bytes);
5249 match serde_json::from_str(&encoded) {
5250 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5251 Err(error) => {
5252 dlg.response_json_decode_error(&encoded, &error);
5253 return Err(common::Error::JsonDecodeError(
5254 encoded.to_string(),
5255 error,
5256 ));
5257 }
5258 }
5259 };
5260
5261 dlg.finished(true);
5262 return Ok(response);
5263 }
5264 }
5265 }
5266 }
5267
5268 ///
5269 /// Sets the *request* property to the given value.
5270 ///
5271 /// Even though the property as already been set when instantiating this call,
5272 /// we provide this method for API completeness.
5273 pub fn request(mut self, new_value: DomainMapping) -> NamespaceDomainmappingCreateCall<'a, C> {
5274 self._request = new_value;
5275 self
5276 }
5277 /// 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
5278 ///
5279 /// Sets the *parent* path property to the given value.
5280 ///
5281 /// Even though the property as already been set when instantiating this call,
5282 /// we provide this method for API completeness.
5283 pub fn parent(mut self, new_value: &str) -> NamespaceDomainmappingCreateCall<'a, C> {
5284 self._parent = new_value.to_string();
5285 self
5286 }
5287 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
5288 ///
5289 /// Sets the *dry run* query property to the given value.
5290 pub fn dry_run(mut self, new_value: &str) -> NamespaceDomainmappingCreateCall<'a, C> {
5291 self._dry_run = Some(new_value.to_string());
5292 self
5293 }
5294 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5295 /// while executing the actual API request.
5296 ///
5297 /// ````text
5298 /// It should be used to handle progress information, and to implement a certain level of resilience.
5299 /// ````
5300 ///
5301 /// Sets the *delegate* property to the given value.
5302 pub fn delegate(
5303 mut self,
5304 new_value: &'a mut dyn common::Delegate,
5305 ) -> NamespaceDomainmappingCreateCall<'a, C> {
5306 self._delegate = Some(new_value);
5307 self
5308 }
5309
5310 /// Set any additional parameter of the query string used in the request.
5311 /// It should be used to set parameters which are not yet available through their own
5312 /// setters.
5313 ///
5314 /// Please note that this method must not be used to set any of the known parameters
5315 /// which have their own setter method. If done anyway, the request will fail.
5316 ///
5317 /// # Additional Parameters
5318 ///
5319 /// * *$.xgafv* (query-string) - V1 error format.
5320 /// * *access_token* (query-string) - OAuth access token.
5321 /// * *alt* (query-string) - Data format for response.
5322 /// * *callback* (query-string) - JSONP
5323 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5324 /// * *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.
5325 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5326 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5327 /// * *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.
5328 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5329 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5330 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingCreateCall<'a, C>
5331 where
5332 T: AsRef<str>,
5333 {
5334 self._additional_params
5335 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5336 self
5337 }
5338
5339 /// Identifies the authorization scope for the method you are building.
5340 ///
5341 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5342 /// [`Scope::CloudPlatform`].
5343 ///
5344 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5345 /// tokens for more than one scope.
5346 ///
5347 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5348 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5349 /// sufficient, a read-write scope will do as well.
5350 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingCreateCall<'a, C>
5351 where
5352 St: AsRef<str>,
5353 {
5354 self._scopes.insert(String::from(scope.as_ref()));
5355 self
5356 }
5357 /// Identifies the authorization scope(s) for the method you are building.
5358 ///
5359 /// See [`Self::add_scope()`] for details.
5360 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingCreateCall<'a, C>
5361 where
5362 I: IntoIterator<Item = St>,
5363 St: AsRef<str>,
5364 {
5365 self._scopes
5366 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5367 self
5368 }
5369
5370 /// Removes all scopes, and no default scope will be used either.
5371 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5372 /// for details).
5373 pub fn clear_scopes(mut self) -> NamespaceDomainmappingCreateCall<'a, C> {
5374 self._scopes.clear();
5375 self
5376 }
5377}
5378
5379/// Delete a domain mapping.
5380///
5381/// A builder for the *domainmappings.delete* method supported by a *namespace* resource.
5382/// It is not used directly, but through a [`NamespaceMethods`] instance.
5383///
5384/// # Example
5385///
5386/// Instantiate a resource method builder
5387///
5388/// ```test_harness,no_run
5389/// # extern crate hyper;
5390/// # extern crate hyper_rustls;
5391/// # extern crate google_run1 as run1;
5392/// # async fn dox() {
5393/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5394///
5395/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5396/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5397/// # .with_native_roots()
5398/// # .unwrap()
5399/// # .https_only()
5400/// # .enable_http2()
5401/// # .build();
5402///
5403/// # let executor = hyper_util::rt::TokioExecutor::new();
5404/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5405/// # secret,
5406/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5407/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5408/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5409/// # ),
5410/// # ).build().await.unwrap();
5411///
5412/// # let client = hyper_util::client::legacy::Client::builder(
5413/// # hyper_util::rt::TokioExecutor::new()
5414/// # )
5415/// # .build(
5416/// # hyper_rustls::HttpsConnectorBuilder::new()
5417/// # .with_native_roots()
5418/// # .unwrap()
5419/// # .https_or_http()
5420/// # .enable_http2()
5421/// # .build()
5422/// # );
5423/// # let mut hub = CloudRun::new(client, auth);
5424/// // You can configure optional parameters by calling the respective setters at will, and
5425/// // execute the final call using `doit()`.
5426/// // Values shown here are possibly random and not representative !
5427/// let result = hub.namespaces().domainmappings_delete("name")
5428/// .propagation_policy("ipsum")
5429/// .kind("est")
5430/// .dry_run("gubergren")
5431/// .api_version("ea")
5432/// .doit().await;
5433/// # }
5434/// ```
5435pub struct NamespaceDomainmappingDeleteCall<'a, C>
5436where
5437 C: 'a,
5438{
5439 hub: &'a CloudRun<C>,
5440 _name: String,
5441 _propagation_policy: Option<String>,
5442 _kind: Option<String>,
5443 _dry_run: Option<String>,
5444 _api_version: Option<String>,
5445 _delegate: Option<&'a mut dyn common::Delegate>,
5446 _additional_params: HashMap<String, String>,
5447 _scopes: BTreeSet<String>,
5448}
5449
5450impl<'a, C> common::CallBuilder for NamespaceDomainmappingDeleteCall<'a, C> {}
5451
5452impl<'a, C> NamespaceDomainmappingDeleteCall<'a, C>
5453where
5454 C: common::Connector,
5455{
5456 /// Perform the operation you have build so far.
5457 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
5458 use std::borrow::Cow;
5459 use std::io::{Read, Seek};
5460
5461 use common::{url::Params, ToParts};
5462 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5463
5464 let mut dd = common::DefaultDelegate;
5465 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5466 dlg.begin(common::MethodInfo {
5467 id: "run.namespaces.domainmappings.delete",
5468 http_method: hyper::Method::DELETE,
5469 });
5470
5471 for &field in [
5472 "alt",
5473 "name",
5474 "propagationPolicy",
5475 "kind",
5476 "dryRun",
5477 "apiVersion",
5478 ]
5479 .iter()
5480 {
5481 if self._additional_params.contains_key(field) {
5482 dlg.finished(false);
5483 return Err(common::Error::FieldClash(field));
5484 }
5485 }
5486
5487 let mut params = Params::with_capacity(7 + self._additional_params.len());
5488 params.push("name", self._name);
5489 if let Some(value) = self._propagation_policy.as_ref() {
5490 params.push("propagationPolicy", value);
5491 }
5492 if let Some(value) = self._kind.as_ref() {
5493 params.push("kind", value);
5494 }
5495 if let Some(value) = self._dry_run.as_ref() {
5496 params.push("dryRun", value);
5497 }
5498 if let Some(value) = self._api_version.as_ref() {
5499 params.push("apiVersion", value);
5500 }
5501
5502 params.extend(self._additional_params.iter());
5503
5504 params.push("alt", "json");
5505 let mut url = self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+name}";
5506 if self._scopes.is_empty() {
5507 self._scopes
5508 .insert(Scope::CloudPlatform.as_ref().to_string());
5509 }
5510
5511 #[allow(clippy::single_element_loop)]
5512 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5513 url = params.uri_replacement(url, param_name, find_this, true);
5514 }
5515 {
5516 let to_remove = ["name"];
5517 params.remove_params(&to_remove);
5518 }
5519
5520 let url = params.parse_with_url(&url);
5521
5522 loop {
5523 let token = match self
5524 .hub
5525 .auth
5526 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5527 .await
5528 {
5529 Ok(token) => token,
5530 Err(e) => match dlg.token(e) {
5531 Ok(token) => token,
5532 Err(e) => {
5533 dlg.finished(false);
5534 return Err(common::Error::MissingToken(e));
5535 }
5536 },
5537 };
5538 let mut req_result = {
5539 let client = &self.hub.client;
5540 dlg.pre_request();
5541 let mut req_builder = hyper::Request::builder()
5542 .method(hyper::Method::DELETE)
5543 .uri(url.as_str())
5544 .header(USER_AGENT, self.hub._user_agent.clone());
5545
5546 if let Some(token) = token.as_ref() {
5547 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5548 }
5549
5550 let request = req_builder
5551 .header(CONTENT_LENGTH, 0_u64)
5552 .body(common::to_body::<String>(None));
5553
5554 client.request(request.unwrap()).await
5555 };
5556
5557 match req_result {
5558 Err(err) => {
5559 if let common::Retry::After(d) = dlg.http_error(&err) {
5560 sleep(d).await;
5561 continue;
5562 }
5563 dlg.finished(false);
5564 return Err(common::Error::HttpError(err));
5565 }
5566 Ok(res) => {
5567 let (mut parts, body) = res.into_parts();
5568 let mut body = common::Body::new(body);
5569 if !parts.status.is_success() {
5570 let bytes = common::to_bytes(body).await.unwrap_or_default();
5571 let error = serde_json::from_str(&common::to_string(&bytes));
5572 let response = common::to_response(parts, bytes.into());
5573
5574 if let common::Retry::After(d) =
5575 dlg.http_failure(&response, error.as_ref().ok())
5576 {
5577 sleep(d).await;
5578 continue;
5579 }
5580
5581 dlg.finished(false);
5582
5583 return Err(match error {
5584 Ok(value) => common::Error::BadRequest(value),
5585 _ => common::Error::Failure(response),
5586 });
5587 }
5588 let response = {
5589 let bytes = common::to_bytes(body).await.unwrap_or_default();
5590 let encoded = common::to_string(&bytes);
5591 match serde_json::from_str(&encoded) {
5592 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5593 Err(error) => {
5594 dlg.response_json_decode_error(&encoded, &error);
5595 return Err(common::Error::JsonDecodeError(
5596 encoded.to_string(),
5597 error,
5598 ));
5599 }
5600 }
5601 };
5602
5603 dlg.finished(true);
5604 return Ok(response);
5605 }
5606 }
5607 }
5608 }
5609
5610 /// 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
5611 ///
5612 /// Sets the *name* path property to the given value.
5613 ///
5614 /// Even though the property as already been set when instantiating this call,
5615 /// we provide this method for API completeness.
5616 pub fn name(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5617 self._name = new_value.to_string();
5618 self
5619 }
5620 /// 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.
5621 ///
5622 /// Sets the *propagation policy* query property to the given value.
5623 pub fn propagation_policy(
5624 mut self,
5625 new_value: &str,
5626 ) -> NamespaceDomainmappingDeleteCall<'a, C> {
5627 self._propagation_policy = Some(new_value.to_string());
5628 self
5629 }
5630 /// Cloud Run currently ignores this parameter.
5631 ///
5632 /// Sets the *kind* query property to the given value.
5633 pub fn kind(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5634 self._kind = Some(new_value.to_string());
5635 self
5636 }
5637 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
5638 ///
5639 /// Sets the *dry run* query property to the given value.
5640 pub fn dry_run(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5641 self._dry_run = Some(new_value.to_string());
5642 self
5643 }
5644 /// Cloud Run currently ignores this parameter.
5645 ///
5646 /// Sets the *api version* query property to the given value.
5647 pub fn api_version(mut self, new_value: &str) -> NamespaceDomainmappingDeleteCall<'a, C> {
5648 self._api_version = Some(new_value.to_string());
5649 self
5650 }
5651 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5652 /// while executing the actual API request.
5653 ///
5654 /// ````text
5655 /// It should be used to handle progress information, and to implement a certain level of resilience.
5656 /// ````
5657 ///
5658 /// Sets the *delegate* property to the given value.
5659 pub fn delegate(
5660 mut self,
5661 new_value: &'a mut dyn common::Delegate,
5662 ) -> NamespaceDomainmappingDeleteCall<'a, C> {
5663 self._delegate = Some(new_value);
5664 self
5665 }
5666
5667 /// Set any additional parameter of the query string used in the request.
5668 /// It should be used to set parameters which are not yet available through their own
5669 /// setters.
5670 ///
5671 /// Please note that this method must not be used to set any of the known parameters
5672 /// which have their own setter method. If done anyway, the request will fail.
5673 ///
5674 /// # Additional Parameters
5675 ///
5676 /// * *$.xgafv* (query-string) - V1 error format.
5677 /// * *access_token* (query-string) - OAuth access token.
5678 /// * *alt* (query-string) - Data format for response.
5679 /// * *callback* (query-string) - JSONP
5680 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5681 /// * *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.
5682 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5683 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5684 /// * *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.
5685 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5686 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5687 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingDeleteCall<'a, C>
5688 where
5689 T: AsRef<str>,
5690 {
5691 self._additional_params
5692 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5693 self
5694 }
5695
5696 /// Identifies the authorization scope for the method you are building.
5697 ///
5698 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5699 /// [`Scope::CloudPlatform`].
5700 ///
5701 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5702 /// tokens for more than one scope.
5703 ///
5704 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5705 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5706 /// sufficient, a read-write scope will do as well.
5707 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingDeleteCall<'a, C>
5708 where
5709 St: AsRef<str>,
5710 {
5711 self._scopes.insert(String::from(scope.as_ref()));
5712 self
5713 }
5714 /// Identifies the authorization scope(s) for the method you are building.
5715 ///
5716 /// See [`Self::add_scope()`] for details.
5717 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingDeleteCall<'a, C>
5718 where
5719 I: IntoIterator<Item = St>,
5720 St: AsRef<str>,
5721 {
5722 self._scopes
5723 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5724 self
5725 }
5726
5727 /// Removes all scopes, and no default scope will be used either.
5728 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5729 /// for details).
5730 pub fn clear_scopes(mut self) -> NamespaceDomainmappingDeleteCall<'a, C> {
5731 self._scopes.clear();
5732 self
5733 }
5734}
5735
5736/// Get information about a domain mapping.
5737///
5738/// A builder for the *domainmappings.get* method supported by a *namespace* resource.
5739/// It is not used directly, but through a [`NamespaceMethods`] instance.
5740///
5741/// # Example
5742///
5743/// Instantiate a resource method builder
5744///
5745/// ```test_harness,no_run
5746/// # extern crate hyper;
5747/// # extern crate hyper_rustls;
5748/// # extern crate google_run1 as run1;
5749/// # async fn dox() {
5750/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5751///
5752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5754/// # .with_native_roots()
5755/// # .unwrap()
5756/// # .https_only()
5757/// # .enable_http2()
5758/// # .build();
5759///
5760/// # let executor = hyper_util::rt::TokioExecutor::new();
5761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5762/// # secret,
5763/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5764/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5765/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5766/// # ),
5767/// # ).build().await.unwrap();
5768///
5769/// # let client = hyper_util::client::legacy::Client::builder(
5770/// # hyper_util::rt::TokioExecutor::new()
5771/// # )
5772/// # .build(
5773/// # hyper_rustls::HttpsConnectorBuilder::new()
5774/// # .with_native_roots()
5775/// # .unwrap()
5776/// # .https_or_http()
5777/// # .enable_http2()
5778/// # .build()
5779/// # );
5780/// # let mut hub = CloudRun::new(client, auth);
5781/// // You can configure optional parameters by calling the respective setters at will, and
5782/// // execute the final call using `doit()`.
5783/// // Values shown here are possibly random and not representative !
5784/// let result = hub.namespaces().domainmappings_get("name")
5785/// .doit().await;
5786/// # }
5787/// ```
5788pub struct NamespaceDomainmappingGetCall<'a, C>
5789where
5790 C: 'a,
5791{
5792 hub: &'a CloudRun<C>,
5793 _name: String,
5794 _delegate: Option<&'a mut dyn common::Delegate>,
5795 _additional_params: HashMap<String, String>,
5796 _scopes: BTreeSet<String>,
5797}
5798
5799impl<'a, C> common::CallBuilder for NamespaceDomainmappingGetCall<'a, C> {}
5800
5801impl<'a, C> NamespaceDomainmappingGetCall<'a, C>
5802where
5803 C: common::Connector,
5804{
5805 /// Perform the operation you have build so far.
5806 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
5807 use std::borrow::Cow;
5808 use std::io::{Read, Seek};
5809
5810 use common::{url::Params, ToParts};
5811 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5812
5813 let mut dd = common::DefaultDelegate;
5814 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5815 dlg.begin(common::MethodInfo {
5816 id: "run.namespaces.domainmappings.get",
5817 http_method: hyper::Method::GET,
5818 });
5819
5820 for &field in ["alt", "name"].iter() {
5821 if self._additional_params.contains_key(field) {
5822 dlg.finished(false);
5823 return Err(common::Error::FieldClash(field));
5824 }
5825 }
5826
5827 let mut params = Params::with_capacity(3 + self._additional_params.len());
5828 params.push("name", self._name);
5829
5830 params.extend(self._additional_params.iter());
5831
5832 params.push("alt", "json");
5833 let mut url = self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+name}";
5834 if self._scopes.is_empty() {
5835 self._scopes
5836 .insert(Scope::CloudPlatform.as_ref().to_string());
5837 }
5838
5839 #[allow(clippy::single_element_loop)]
5840 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5841 url = params.uri_replacement(url, param_name, find_this, true);
5842 }
5843 {
5844 let to_remove = ["name"];
5845 params.remove_params(&to_remove);
5846 }
5847
5848 let url = params.parse_with_url(&url);
5849
5850 loop {
5851 let token = match self
5852 .hub
5853 .auth
5854 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5855 .await
5856 {
5857 Ok(token) => token,
5858 Err(e) => match dlg.token(e) {
5859 Ok(token) => token,
5860 Err(e) => {
5861 dlg.finished(false);
5862 return Err(common::Error::MissingToken(e));
5863 }
5864 },
5865 };
5866 let mut req_result = {
5867 let client = &self.hub.client;
5868 dlg.pre_request();
5869 let mut req_builder = hyper::Request::builder()
5870 .method(hyper::Method::GET)
5871 .uri(url.as_str())
5872 .header(USER_AGENT, self.hub._user_agent.clone());
5873
5874 if let Some(token) = token.as_ref() {
5875 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5876 }
5877
5878 let request = req_builder
5879 .header(CONTENT_LENGTH, 0_u64)
5880 .body(common::to_body::<String>(None));
5881
5882 client.request(request.unwrap()).await
5883 };
5884
5885 match req_result {
5886 Err(err) => {
5887 if let common::Retry::After(d) = dlg.http_error(&err) {
5888 sleep(d).await;
5889 continue;
5890 }
5891 dlg.finished(false);
5892 return Err(common::Error::HttpError(err));
5893 }
5894 Ok(res) => {
5895 let (mut parts, body) = res.into_parts();
5896 let mut body = common::Body::new(body);
5897 if !parts.status.is_success() {
5898 let bytes = common::to_bytes(body).await.unwrap_or_default();
5899 let error = serde_json::from_str(&common::to_string(&bytes));
5900 let response = common::to_response(parts, bytes.into());
5901
5902 if let common::Retry::After(d) =
5903 dlg.http_failure(&response, error.as_ref().ok())
5904 {
5905 sleep(d).await;
5906 continue;
5907 }
5908
5909 dlg.finished(false);
5910
5911 return Err(match error {
5912 Ok(value) => common::Error::BadRequest(value),
5913 _ => common::Error::Failure(response),
5914 });
5915 }
5916 let response = {
5917 let bytes = common::to_bytes(body).await.unwrap_or_default();
5918 let encoded = common::to_string(&bytes);
5919 match serde_json::from_str(&encoded) {
5920 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5921 Err(error) => {
5922 dlg.response_json_decode_error(&encoded, &error);
5923 return Err(common::Error::JsonDecodeError(
5924 encoded.to_string(),
5925 error,
5926 ));
5927 }
5928 }
5929 };
5930
5931 dlg.finished(true);
5932 return Ok(response);
5933 }
5934 }
5935 }
5936 }
5937
5938 /// 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
5939 ///
5940 /// Sets the *name* path property to the given value.
5941 ///
5942 /// Even though the property as already been set when instantiating this call,
5943 /// we provide this method for API completeness.
5944 pub fn name(mut self, new_value: &str) -> NamespaceDomainmappingGetCall<'a, C> {
5945 self._name = new_value.to_string();
5946 self
5947 }
5948 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5949 /// while executing the actual API request.
5950 ///
5951 /// ````text
5952 /// It should be used to handle progress information, and to implement a certain level of resilience.
5953 /// ````
5954 ///
5955 /// Sets the *delegate* property to the given value.
5956 pub fn delegate(
5957 mut self,
5958 new_value: &'a mut dyn common::Delegate,
5959 ) -> NamespaceDomainmappingGetCall<'a, C> {
5960 self._delegate = Some(new_value);
5961 self
5962 }
5963
5964 /// Set any additional parameter of the query string used in the request.
5965 /// It should be used to set parameters which are not yet available through their own
5966 /// setters.
5967 ///
5968 /// Please note that this method must not be used to set any of the known parameters
5969 /// which have their own setter method. If done anyway, the request will fail.
5970 ///
5971 /// # Additional Parameters
5972 ///
5973 /// * *$.xgafv* (query-string) - V1 error format.
5974 /// * *access_token* (query-string) - OAuth access token.
5975 /// * *alt* (query-string) - Data format for response.
5976 /// * *callback* (query-string) - JSONP
5977 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5978 /// * *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.
5979 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5980 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5981 /// * *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.
5982 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5983 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5984 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingGetCall<'a, C>
5985 where
5986 T: AsRef<str>,
5987 {
5988 self._additional_params
5989 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5990 self
5991 }
5992
5993 /// Identifies the authorization scope for the method you are building.
5994 ///
5995 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5996 /// [`Scope::CloudPlatform`].
5997 ///
5998 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5999 /// tokens for more than one scope.
6000 ///
6001 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6002 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6003 /// sufficient, a read-write scope will do as well.
6004 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingGetCall<'a, C>
6005 where
6006 St: AsRef<str>,
6007 {
6008 self._scopes.insert(String::from(scope.as_ref()));
6009 self
6010 }
6011 /// Identifies the authorization scope(s) for the method you are building.
6012 ///
6013 /// See [`Self::add_scope()`] for details.
6014 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingGetCall<'a, C>
6015 where
6016 I: IntoIterator<Item = St>,
6017 St: AsRef<str>,
6018 {
6019 self._scopes
6020 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6021 self
6022 }
6023
6024 /// Removes all scopes, and no default scope will be used either.
6025 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6026 /// for details).
6027 pub fn clear_scopes(mut self) -> NamespaceDomainmappingGetCall<'a, C> {
6028 self._scopes.clear();
6029 self
6030 }
6031}
6032
6033/// List all domain mappings.
6034///
6035/// A builder for the *domainmappings.list* method supported by a *namespace* resource.
6036/// It is not used directly, but through a [`NamespaceMethods`] instance.
6037///
6038/// # Example
6039///
6040/// Instantiate a resource method builder
6041///
6042/// ```test_harness,no_run
6043/// # extern crate hyper;
6044/// # extern crate hyper_rustls;
6045/// # extern crate google_run1 as run1;
6046/// # async fn dox() {
6047/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6048///
6049/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6050/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6051/// # .with_native_roots()
6052/// # .unwrap()
6053/// # .https_only()
6054/// # .enable_http2()
6055/// # .build();
6056///
6057/// # let executor = hyper_util::rt::TokioExecutor::new();
6058/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6059/// # secret,
6060/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6061/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6062/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6063/// # ),
6064/// # ).build().await.unwrap();
6065///
6066/// # let client = hyper_util::client::legacy::Client::builder(
6067/// # hyper_util::rt::TokioExecutor::new()
6068/// # )
6069/// # .build(
6070/// # hyper_rustls::HttpsConnectorBuilder::new()
6071/// # .with_native_roots()
6072/// # .unwrap()
6073/// # .https_or_http()
6074/// # .enable_http2()
6075/// # .build()
6076/// # );
6077/// # let mut hub = CloudRun::new(client, auth);
6078/// // You can configure optional parameters by calling the respective setters at will, and
6079/// // execute the final call using `doit()`.
6080/// // Values shown here are possibly random and not representative !
6081/// let result = hub.namespaces().domainmappings_list("parent")
6082/// .watch(false)
6083/// .resource_version("sed")
6084/// .limit(-70)
6085/// .label_selector("sed")
6086/// .include_uninitialized(true)
6087/// .field_selector("Stet")
6088/// .continue_("kasd")
6089/// .doit().await;
6090/// # }
6091/// ```
6092pub struct NamespaceDomainmappingListCall<'a, C>
6093where
6094 C: 'a,
6095{
6096 hub: &'a CloudRun<C>,
6097 _parent: String,
6098 _watch: Option<bool>,
6099 _resource_version: Option<String>,
6100 _limit: Option<i32>,
6101 _label_selector: Option<String>,
6102 _include_uninitialized: Option<bool>,
6103 _field_selector: Option<String>,
6104 _continue_: Option<String>,
6105 _delegate: Option<&'a mut dyn common::Delegate>,
6106 _additional_params: HashMap<String, String>,
6107 _scopes: BTreeSet<String>,
6108}
6109
6110impl<'a, C> common::CallBuilder for NamespaceDomainmappingListCall<'a, C> {}
6111
6112impl<'a, C> NamespaceDomainmappingListCall<'a, C>
6113where
6114 C: common::Connector,
6115{
6116 /// Perform the operation you have build so far.
6117 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
6118 use std::borrow::Cow;
6119 use std::io::{Read, Seek};
6120
6121 use common::{url::Params, ToParts};
6122 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6123
6124 let mut dd = common::DefaultDelegate;
6125 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6126 dlg.begin(common::MethodInfo {
6127 id: "run.namespaces.domainmappings.list",
6128 http_method: hyper::Method::GET,
6129 });
6130
6131 for &field in [
6132 "alt",
6133 "parent",
6134 "watch",
6135 "resourceVersion",
6136 "limit",
6137 "labelSelector",
6138 "includeUninitialized",
6139 "fieldSelector",
6140 "continue",
6141 ]
6142 .iter()
6143 {
6144 if self._additional_params.contains_key(field) {
6145 dlg.finished(false);
6146 return Err(common::Error::FieldClash(field));
6147 }
6148 }
6149
6150 let mut params = Params::with_capacity(10 + self._additional_params.len());
6151 params.push("parent", self._parent);
6152 if let Some(value) = self._watch.as_ref() {
6153 params.push("watch", value.to_string());
6154 }
6155 if let Some(value) = self._resource_version.as_ref() {
6156 params.push("resourceVersion", value);
6157 }
6158 if let Some(value) = self._limit.as_ref() {
6159 params.push("limit", value.to_string());
6160 }
6161 if let Some(value) = self._label_selector.as_ref() {
6162 params.push("labelSelector", value);
6163 }
6164 if let Some(value) = self._include_uninitialized.as_ref() {
6165 params.push("includeUninitialized", value.to_string());
6166 }
6167 if let Some(value) = self._field_selector.as_ref() {
6168 params.push("fieldSelector", value);
6169 }
6170 if let Some(value) = self._continue_.as_ref() {
6171 params.push("continue", value);
6172 }
6173
6174 params.extend(self._additional_params.iter());
6175
6176 params.push("alt", "json");
6177 let mut url =
6178 self.hub._base_url.clone() + "apis/domains.cloudrun.com/v1/{+parent}/domainmappings";
6179 if self._scopes.is_empty() {
6180 self._scopes
6181 .insert(Scope::CloudPlatform.as_ref().to_string());
6182 }
6183
6184 #[allow(clippy::single_element_loop)]
6185 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6186 url = params.uri_replacement(url, param_name, find_this, true);
6187 }
6188 {
6189 let to_remove = ["parent"];
6190 params.remove_params(&to_remove);
6191 }
6192
6193 let url = params.parse_with_url(&url);
6194
6195 loop {
6196 let token = match self
6197 .hub
6198 .auth
6199 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6200 .await
6201 {
6202 Ok(token) => token,
6203 Err(e) => match dlg.token(e) {
6204 Ok(token) => token,
6205 Err(e) => {
6206 dlg.finished(false);
6207 return Err(common::Error::MissingToken(e));
6208 }
6209 },
6210 };
6211 let mut req_result = {
6212 let client = &self.hub.client;
6213 dlg.pre_request();
6214 let mut req_builder = hyper::Request::builder()
6215 .method(hyper::Method::GET)
6216 .uri(url.as_str())
6217 .header(USER_AGENT, self.hub._user_agent.clone());
6218
6219 if let Some(token) = token.as_ref() {
6220 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6221 }
6222
6223 let request = req_builder
6224 .header(CONTENT_LENGTH, 0_u64)
6225 .body(common::to_body::<String>(None));
6226
6227 client.request(request.unwrap()).await
6228 };
6229
6230 match req_result {
6231 Err(err) => {
6232 if let common::Retry::After(d) = dlg.http_error(&err) {
6233 sleep(d).await;
6234 continue;
6235 }
6236 dlg.finished(false);
6237 return Err(common::Error::HttpError(err));
6238 }
6239 Ok(res) => {
6240 let (mut parts, body) = res.into_parts();
6241 let mut body = common::Body::new(body);
6242 if !parts.status.is_success() {
6243 let bytes = common::to_bytes(body).await.unwrap_or_default();
6244 let error = serde_json::from_str(&common::to_string(&bytes));
6245 let response = common::to_response(parts, bytes.into());
6246
6247 if let common::Retry::After(d) =
6248 dlg.http_failure(&response, error.as_ref().ok())
6249 {
6250 sleep(d).await;
6251 continue;
6252 }
6253
6254 dlg.finished(false);
6255
6256 return Err(match error {
6257 Ok(value) => common::Error::BadRequest(value),
6258 _ => common::Error::Failure(response),
6259 });
6260 }
6261 let response = {
6262 let bytes = common::to_bytes(body).await.unwrap_or_default();
6263 let encoded = common::to_string(&bytes);
6264 match serde_json::from_str(&encoded) {
6265 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6266 Err(error) => {
6267 dlg.response_json_decode_error(&encoded, &error);
6268 return Err(common::Error::JsonDecodeError(
6269 encoded.to_string(),
6270 error,
6271 ));
6272 }
6273 }
6274 };
6275
6276 dlg.finished(true);
6277 return Ok(response);
6278 }
6279 }
6280 }
6281 }
6282
6283 /// 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
6284 ///
6285 /// Sets the *parent* path property to the given value.
6286 ///
6287 /// Even though the property as already been set when instantiating this call,
6288 /// we provide this method for API completeness.
6289 pub fn parent(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
6290 self._parent = new_value.to_string();
6291 self
6292 }
6293 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
6294 ///
6295 /// Sets the *watch* query property to the given value.
6296 pub fn watch(mut self, new_value: bool) -> NamespaceDomainmappingListCall<'a, C> {
6297 self._watch = Some(new_value);
6298 self
6299 }
6300 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
6301 ///
6302 /// Sets the *resource version* query property to the given value.
6303 pub fn resource_version(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
6304 self._resource_version = Some(new_value.to_string());
6305 self
6306 }
6307 /// Optional. The maximum number of records that should be returned.
6308 ///
6309 /// Sets the *limit* query property to the given value.
6310 pub fn limit(mut self, new_value: i32) -> NamespaceDomainmappingListCall<'a, C> {
6311 self._limit = Some(new_value);
6312 self
6313 }
6314 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
6315 ///
6316 /// Sets the *label selector* query property to the given value.
6317 pub fn label_selector(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
6318 self._label_selector = Some(new_value.to_string());
6319 self
6320 }
6321 /// Not currently used by Cloud Run.
6322 ///
6323 /// Sets the *include uninitialized* query property to the given value.
6324 pub fn include_uninitialized(
6325 mut self,
6326 new_value: bool,
6327 ) -> NamespaceDomainmappingListCall<'a, C> {
6328 self._include_uninitialized = Some(new_value);
6329 self
6330 }
6331 /// 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.
6332 ///
6333 /// Sets the *field selector* query property to the given value.
6334 pub fn field_selector(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
6335 self._field_selector = Some(new_value.to_string());
6336 self
6337 }
6338 /// Optional. Encoded string to continue paging.
6339 ///
6340 /// Sets the *continue* query property to the given value.
6341 pub fn continue_(mut self, new_value: &str) -> NamespaceDomainmappingListCall<'a, C> {
6342 self._continue_ = Some(new_value.to_string());
6343 self
6344 }
6345 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6346 /// while executing the actual API request.
6347 ///
6348 /// ````text
6349 /// It should be used to handle progress information, and to implement a certain level of resilience.
6350 /// ````
6351 ///
6352 /// Sets the *delegate* property to the given value.
6353 pub fn delegate(
6354 mut self,
6355 new_value: &'a mut dyn common::Delegate,
6356 ) -> NamespaceDomainmappingListCall<'a, C> {
6357 self._delegate = Some(new_value);
6358 self
6359 }
6360
6361 /// Set any additional parameter of the query string used in the request.
6362 /// It should be used to set parameters which are not yet available through their own
6363 /// setters.
6364 ///
6365 /// Please note that this method must not be used to set any of the known parameters
6366 /// which have their own setter method. If done anyway, the request will fail.
6367 ///
6368 /// # Additional Parameters
6369 ///
6370 /// * *$.xgafv* (query-string) - V1 error format.
6371 /// * *access_token* (query-string) - OAuth access token.
6372 /// * *alt* (query-string) - Data format for response.
6373 /// * *callback* (query-string) - JSONP
6374 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6375 /// * *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.
6376 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6377 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6378 /// * *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.
6379 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6380 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6381 pub fn param<T>(mut self, name: T, value: T) -> NamespaceDomainmappingListCall<'a, C>
6382 where
6383 T: AsRef<str>,
6384 {
6385 self._additional_params
6386 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6387 self
6388 }
6389
6390 /// Identifies the authorization scope for the method you are building.
6391 ///
6392 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6393 /// [`Scope::CloudPlatform`].
6394 ///
6395 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6396 /// tokens for more than one scope.
6397 ///
6398 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6399 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6400 /// sufficient, a read-write scope will do as well.
6401 pub fn add_scope<St>(mut self, scope: St) -> NamespaceDomainmappingListCall<'a, C>
6402 where
6403 St: AsRef<str>,
6404 {
6405 self._scopes.insert(String::from(scope.as_ref()));
6406 self
6407 }
6408 /// Identifies the authorization scope(s) for the method you are building.
6409 ///
6410 /// See [`Self::add_scope()`] for details.
6411 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceDomainmappingListCall<'a, C>
6412 where
6413 I: IntoIterator<Item = St>,
6414 St: AsRef<str>,
6415 {
6416 self._scopes
6417 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6418 self
6419 }
6420
6421 /// Removes all scopes, and no default scope will be used either.
6422 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6423 /// for details).
6424 pub fn clear_scopes(mut self) -> NamespaceDomainmappingListCall<'a, C> {
6425 self._scopes.clear();
6426 self
6427 }
6428}
6429
6430/// Cancel an execution.
6431///
6432/// A builder for the *executions.cancel* method supported by a *namespace* resource.
6433/// It is not used directly, but through a [`NamespaceMethods`] instance.
6434///
6435/// # Example
6436///
6437/// Instantiate a resource method builder
6438///
6439/// ```test_harness,no_run
6440/// # extern crate hyper;
6441/// # extern crate hyper_rustls;
6442/// # extern crate google_run1 as run1;
6443/// use run1::api::CancelExecutionRequest;
6444/// # async fn dox() {
6445/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6446///
6447/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6448/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6449/// # .with_native_roots()
6450/// # .unwrap()
6451/// # .https_only()
6452/// # .enable_http2()
6453/// # .build();
6454///
6455/// # let executor = hyper_util::rt::TokioExecutor::new();
6456/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6457/// # secret,
6458/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6459/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6460/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6461/// # ),
6462/// # ).build().await.unwrap();
6463///
6464/// # let client = hyper_util::client::legacy::Client::builder(
6465/// # hyper_util::rt::TokioExecutor::new()
6466/// # )
6467/// # .build(
6468/// # hyper_rustls::HttpsConnectorBuilder::new()
6469/// # .with_native_roots()
6470/// # .unwrap()
6471/// # .https_or_http()
6472/// # .enable_http2()
6473/// # .build()
6474/// # );
6475/// # let mut hub = CloudRun::new(client, auth);
6476/// // As the method needs a request, you would usually fill it with the desired information
6477/// // into the respective structure. Some of the parts shown here might not be applicable !
6478/// // Values shown here are possibly random and not representative !
6479/// let mut req = CancelExecutionRequest::default();
6480///
6481/// // You can configure optional parameters by calling the respective setters at will, and
6482/// // execute the final call using `doit()`.
6483/// // Values shown here are possibly random and not representative !
6484/// let result = hub.namespaces().executions_cancel(req, "name")
6485/// .doit().await;
6486/// # }
6487/// ```
6488pub struct NamespaceExecutionCancelCall<'a, C>
6489where
6490 C: 'a,
6491{
6492 hub: &'a CloudRun<C>,
6493 _request: CancelExecutionRequest,
6494 _name: String,
6495 _delegate: Option<&'a mut dyn common::Delegate>,
6496 _additional_params: HashMap<String, String>,
6497 _scopes: BTreeSet<String>,
6498}
6499
6500impl<'a, C> common::CallBuilder for NamespaceExecutionCancelCall<'a, C> {}
6501
6502impl<'a, C> NamespaceExecutionCancelCall<'a, C>
6503where
6504 C: common::Connector,
6505{
6506 /// Perform the operation you have build so far.
6507 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
6508 use std::borrow::Cow;
6509 use std::io::{Read, Seek};
6510
6511 use common::{url::Params, ToParts};
6512 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6513
6514 let mut dd = common::DefaultDelegate;
6515 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6516 dlg.begin(common::MethodInfo {
6517 id: "run.namespaces.executions.cancel",
6518 http_method: hyper::Method::POST,
6519 });
6520
6521 for &field in ["alt", "name"].iter() {
6522 if self._additional_params.contains_key(field) {
6523 dlg.finished(false);
6524 return Err(common::Error::FieldClash(field));
6525 }
6526 }
6527
6528 let mut params = Params::with_capacity(4 + self._additional_params.len());
6529 params.push("name", self._name);
6530
6531 params.extend(self._additional_params.iter());
6532
6533 params.push("alt", "json");
6534 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}:cancel";
6535 if self._scopes.is_empty() {
6536 self._scopes
6537 .insert(Scope::CloudPlatform.as_ref().to_string());
6538 }
6539
6540 #[allow(clippy::single_element_loop)]
6541 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6542 url = params.uri_replacement(url, param_name, find_this, true);
6543 }
6544 {
6545 let to_remove = ["name"];
6546 params.remove_params(&to_remove);
6547 }
6548
6549 let url = params.parse_with_url(&url);
6550
6551 let mut json_mime_type = mime::APPLICATION_JSON;
6552 let mut request_value_reader = {
6553 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6554 common::remove_json_null_values(&mut value);
6555 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6556 serde_json::to_writer(&mut dst, &value).unwrap();
6557 dst
6558 };
6559 let request_size = request_value_reader
6560 .seek(std::io::SeekFrom::End(0))
6561 .unwrap();
6562 request_value_reader
6563 .seek(std::io::SeekFrom::Start(0))
6564 .unwrap();
6565
6566 loop {
6567 let token = match self
6568 .hub
6569 .auth
6570 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6571 .await
6572 {
6573 Ok(token) => token,
6574 Err(e) => match dlg.token(e) {
6575 Ok(token) => token,
6576 Err(e) => {
6577 dlg.finished(false);
6578 return Err(common::Error::MissingToken(e));
6579 }
6580 },
6581 };
6582 request_value_reader
6583 .seek(std::io::SeekFrom::Start(0))
6584 .unwrap();
6585 let mut req_result = {
6586 let client = &self.hub.client;
6587 dlg.pre_request();
6588 let mut req_builder = hyper::Request::builder()
6589 .method(hyper::Method::POST)
6590 .uri(url.as_str())
6591 .header(USER_AGENT, self.hub._user_agent.clone());
6592
6593 if let Some(token) = token.as_ref() {
6594 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6595 }
6596
6597 let request = req_builder
6598 .header(CONTENT_TYPE, json_mime_type.to_string())
6599 .header(CONTENT_LENGTH, request_size as u64)
6600 .body(common::to_body(
6601 request_value_reader.get_ref().clone().into(),
6602 ));
6603
6604 client.request(request.unwrap()).await
6605 };
6606
6607 match req_result {
6608 Err(err) => {
6609 if let common::Retry::After(d) = dlg.http_error(&err) {
6610 sleep(d).await;
6611 continue;
6612 }
6613 dlg.finished(false);
6614 return Err(common::Error::HttpError(err));
6615 }
6616 Ok(res) => {
6617 let (mut parts, body) = res.into_parts();
6618 let mut body = common::Body::new(body);
6619 if !parts.status.is_success() {
6620 let bytes = common::to_bytes(body).await.unwrap_or_default();
6621 let error = serde_json::from_str(&common::to_string(&bytes));
6622 let response = common::to_response(parts, bytes.into());
6623
6624 if let common::Retry::After(d) =
6625 dlg.http_failure(&response, error.as_ref().ok())
6626 {
6627 sleep(d).await;
6628 continue;
6629 }
6630
6631 dlg.finished(false);
6632
6633 return Err(match error {
6634 Ok(value) => common::Error::BadRequest(value),
6635 _ => common::Error::Failure(response),
6636 });
6637 }
6638 let response = {
6639 let bytes = common::to_bytes(body).await.unwrap_or_default();
6640 let encoded = common::to_string(&bytes);
6641 match serde_json::from_str(&encoded) {
6642 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6643 Err(error) => {
6644 dlg.response_json_decode_error(&encoded, &error);
6645 return Err(common::Error::JsonDecodeError(
6646 encoded.to_string(),
6647 error,
6648 ));
6649 }
6650 }
6651 };
6652
6653 dlg.finished(true);
6654 return Ok(response);
6655 }
6656 }
6657 }
6658 }
6659
6660 ///
6661 /// Sets the *request* property to the given value.
6662 ///
6663 /// Even though the property as already been set when instantiating this call,
6664 /// we provide this method for API completeness.
6665 pub fn request(
6666 mut self,
6667 new_value: CancelExecutionRequest,
6668 ) -> NamespaceExecutionCancelCall<'a, C> {
6669 self._request = new_value;
6670 self
6671 }
6672 /// 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
6673 ///
6674 /// Sets the *name* path property to the given value.
6675 ///
6676 /// Even though the property as already been set when instantiating this call,
6677 /// we provide this method for API completeness.
6678 pub fn name(mut self, new_value: &str) -> NamespaceExecutionCancelCall<'a, C> {
6679 self._name = new_value.to_string();
6680 self
6681 }
6682 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6683 /// while executing the actual API request.
6684 ///
6685 /// ````text
6686 /// It should be used to handle progress information, and to implement a certain level of resilience.
6687 /// ````
6688 ///
6689 /// Sets the *delegate* property to the given value.
6690 pub fn delegate(
6691 mut self,
6692 new_value: &'a mut dyn common::Delegate,
6693 ) -> NamespaceExecutionCancelCall<'a, C> {
6694 self._delegate = Some(new_value);
6695 self
6696 }
6697
6698 /// Set any additional parameter of the query string used in the request.
6699 /// It should be used to set parameters which are not yet available through their own
6700 /// setters.
6701 ///
6702 /// Please note that this method must not be used to set any of the known parameters
6703 /// which have their own setter method. If done anyway, the request will fail.
6704 ///
6705 /// # Additional Parameters
6706 ///
6707 /// * *$.xgafv* (query-string) - V1 error format.
6708 /// * *access_token* (query-string) - OAuth access token.
6709 /// * *alt* (query-string) - Data format for response.
6710 /// * *callback* (query-string) - JSONP
6711 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6712 /// * *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.
6713 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6714 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6715 /// * *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.
6716 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6717 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6718 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionCancelCall<'a, C>
6719 where
6720 T: AsRef<str>,
6721 {
6722 self._additional_params
6723 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6724 self
6725 }
6726
6727 /// Identifies the authorization scope for the method you are building.
6728 ///
6729 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6730 /// [`Scope::CloudPlatform`].
6731 ///
6732 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6733 /// tokens for more than one scope.
6734 ///
6735 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6736 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6737 /// sufficient, a read-write scope will do as well.
6738 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionCancelCall<'a, C>
6739 where
6740 St: AsRef<str>,
6741 {
6742 self._scopes.insert(String::from(scope.as_ref()));
6743 self
6744 }
6745 /// Identifies the authorization scope(s) for the method you are building.
6746 ///
6747 /// See [`Self::add_scope()`] for details.
6748 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionCancelCall<'a, C>
6749 where
6750 I: IntoIterator<Item = St>,
6751 St: AsRef<str>,
6752 {
6753 self._scopes
6754 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6755 self
6756 }
6757
6758 /// Removes all scopes, and no default scope will be used either.
6759 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6760 /// for details).
6761 pub fn clear_scopes(mut self) -> NamespaceExecutionCancelCall<'a, C> {
6762 self._scopes.clear();
6763 self
6764 }
6765}
6766
6767/// Delete an execution.
6768///
6769/// A builder for the *executions.delete* method supported by a *namespace* resource.
6770/// It is not used directly, but through a [`NamespaceMethods`] instance.
6771///
6772/// # Example
6773///
6774/// Instantiate a resource method builder
6775///
6776/// ```test_harness,no_run
6777/// # extern crate hyper;
6778/// # extern crate hyper_rustls;
6779/// # extern crate google_run1 as run1;
6780/// # async fn dox() {
6781/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6782///
6783/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6784/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6785/// # .with_native_roots()
6786/// # .unwrap()
6787/// # .https_only()
6788/// # .enable_http2()
6789/// # .build();
6790///
6791/// # let executor = hyper_util::rt::TokioExecutor::new();
6792/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6793/// # secret,
6794/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6795/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6796/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6797/// # ),
6798/// # ).build().await.unwrap();
6799///
6800/// # let client = hyper_util::client::legacy::Client::builder(
6801/// # hyper_util::rt::TokioExecutor::new()
6802/// # )
6803/// # .build(
6804/// # hyper_rustls::HttpsConnectorBuilder::new()
6805/// # .with_native_roots()
6806/// # .unwrap()
6807/// # .https_or_http()
6808/// # .enable_http2()
6809/// # .build()
6810/// # );
6811/// # let mut hub = CloudRun::new(client, auth);
6812/// // You can configure optional parameters by calling the respective setters at will, and
6813/// // execute the final call using `doit()`.
6814/// // Values shown here are possibly random and not representative !
6815/// let result = hub.namespaces().executions_delete("name")
6816/// .propagation_policy("et")
6817/// .kind("et")
6818/// .api_version("vero")
6819/// .doit().await;
6820/// # }
6821/// ```
6822pub struct NamespaceExecutionDeleteCall<'a, C>
6823where
6824 C: 'a,
6825{
6826 hub: &'a CloudRun<C>,
6827 _name: String,
6828 _propagation_policy: Option<String>,
6829 _kind: Option<String>,
6830 _api_version: Option<String>,
6831 _delegate: Option<&'a mut dyn common::Delegate>,
6832 _additional_params: HashMap<String, String>,
6833 _scopes: BTreeSet<String>,
6834}
6835
6836impl<'a, C> common::CallBuilder for NamespaceExecutionDeleteCall<'a, C> {}
6837
6838impl<'a, C> NamespaceExecutionDeleteCall<'a, C>
6839where
6840 C: common::Connector,
6841{
6842 /// Perform the operation you have build so far.
6843 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
6844 use std::borrow::Cow;
6845 use std::io::{Read, Seek};
6846
6847 use common::{url::Params, ToParts};
6848 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6849
6850 let mut dd = common::DefaultDelegate;
6851 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6852 dlg.begin(common::MethodInfo {
6853 id: "run.namespaces.executions.delete",
6854 http_method: hyper::Method::DELETE,
6855 });
6856
6857 for &field in ["alt", "name", "propagationPolicy", "kind", "apiVersion"].iter() {
6858 if self._additional_params.contains_key(field) {
6859 dlg.finished(false);
6860 return Err(common::Error::FieldClash(field));
6861 }
6862 }
6863
6864 let mut params = Params::with_capacity(6 + self._additional_params.len());
6865 params.push("name", self._name);
6866 if let Some(value) = self._propagation_policy.as_ref() {
6867 params.push("propagationPolicy", value);
6868 }
6869 if let Some(value) = self._kind.as_ref() {
6870 params.push("kind", value);
6871 }
6872 if let Some(value) = self._api_version.as_ref() {
6873 params.push("apiVersion", value);
6874 }
6875
6876 params.extend(self._additional_params.iter());
6877
6878 params.push("alt", "json");
6879 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
6880 if self._scopes.is_empty() {
6881 self._scopes
6882 .insert(Scope::CloudPlatform.as_ref().to_string());
6883 }
6884
6885 #[allow(clippy::single_element_loop)]
6886 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6887 url = params.uri_replacement(url, param_name, find_this, true);
6888 }
6889 {
6890 let to_remove = ["name"];
6891 params.remove_params(&to_remove);
6892 }
6893
6894 let url = params.parse_with_url(&url);
6895
6896 loop {
6897 let token = match self
6898 .hub
6899 .auth
6900 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6901 .await
6902 {
6903 Ok(token) => token,
6904 Err(e) => match dlg.token(e) {
6905 Ok(token) => token,
6906 Err(e) => {
6907 dlg.finished(false);
6908 return Err(common::Error::MissingToken(e));
6909 }
6910 },
6911 };
6912 let mut req_result = {
6913 let client = &self.hub.client;
6914 dlg.pre_request();
6915 let mut req_builder = hyper::Request::builder()
6916 .method(hyper::Method::DELETE)
6917 .uri(url.as_str())
6918 .header(USER_AGENT, self.hub._user_agent.clone());
6919
6920 if let Some(token) = token.as_ref() {
6921 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6922 }
6923
6924 let request = req_builder
6925 .header(CONTENT_LENGTH, 0_u64)
6926 .body(common::to_body::<String>(None));
6927
6928 client.request(request.unwrap()).await
6929 };
6930
6931 match req_result {
6932 Err(err) => {
6933 if let common::Retry::After(d) = dlg.http_error(&err) {
6934 sleep(d).await;
6935 continue;
6936 }
6937 dlg.finished(false);
6938 return Err(common::Error::HttpError(err));
6939 }
6940 Ok(res) => {
6941 let (mut parts, body) = res.into_parts();
6942 let mut body = common::Body::new(body);
6943 if !parts.status.is_success() {
6944 let bytes = common::to_bytes(body).await.unwrap_or_default();
6945 let error = serde_json::from_str(&common::to_string(&bytes));
6946 let response = common::to_response(parts, bytes.into());
6947
6948 if let common::Retry::After(d) =
6949 dlg.http_failure(&response, error.as_ref().ok())
6950 {
6951 sleep(d).await;
6952 continue;
6953 }
6954
6955 dlg.finished(false);
6956
6957 return Err(match error {
6958 Ok(value) => common::Error::BadRequest(value),
6959 _ => common::Error::Failure(response),
6960 });
6961 }
6962 let response = {
6963 let bytes = common::to_bytes(body).await.unwrap_or_default();
6964 let encoded = common::to_string(&bytes);
6965 match serde_json::from_str(&encoded) {
6966 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6967 Err(error) => {
6968 dlg.response_json_decode_error(&encoded, &error);
6969 return Err(common::Error::JsonDecodeError(
6970 encoded.to_string(),
6971 error,
6972 ));
6973 }
6974 }
6975 };
6976
6977 dlg.finished(true);
6978 return Ok(response);
6979 }
6980 }
6981 }
6982 }
6983
6984 /// 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
6985 ///
6986 /// Sets the *name* path property to the given value.
6987 ///
6988 /// Even though the property as already been set when instantiating this call,
6989 /// we provide this method for API completeness.
6990 pub fn name(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6991 self._name = new_value.to_string();
6992 self
6993 }
6994 /// Optional. Specifies the propagation policy of delete. Cloud Run currently ignores this setting.
6995 ///
6996 /// Sets the *propagation policy* query property to the given value.
6997 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
6998 self._propagation_policy = Some(new_value.to_string());
6999 self
7000 }
7001 /// Optional. Cloud Run currently ignores this parameter.
7002 ///
7003 /// Sets the *kind* query property to the given value.
7004 pub fn kind(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
7005 self._kind = Some(new_value.to_string());
7006 self
7007 }
7008 /// Optional. Cloud Run currently ignores this parameter.
7009 ///
7010 /// Sets the *api version* query property to the given value.
7011 pub fn api_version(mut self, new_value: &str) -> NamespaceExecutionDeleteCall<'a, C> {
7012 self._api_version = Some(new_value.to_string());
7013 self
7014 }
7015 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7016 /// while executing the actual API request.
7017 ///
7018 /// ````text
7019 /// It should be used to handle progress information, and to implement a certain level of resilience.
7020 /// ````
7021 ///
7022 /// Sets the *delegate* property to the given value.
7023 pub fn delegate(
7024 mut self,
7025 new_value: &'a mut dyn common::Delegate,
7026 ) -> NamespaceExecutionDeleteCall<'a, C> {
7027 self._delegate = Some(new_value);
7028 self
7029 }
7030
7031 /// Set any additional parameter of the query string used in the request.
7032 /// It should be used to set parameters which are not yet available through their own
7033 /// setters.
7034 ///
7035 /// Please note that this method must not be used to set any of the known parameters
7036 /// which have their own setter method. If done anyway, the request will fail.
7037 ///
7038 /// # Additional Parameters
7039 ///
7040 /// * *$.xgafv* (query-string) - V1 error format.
7041 /// * *access_token* (query-string) - OAuth access token.
7042 /// * *alt* (query-string) - Data format for response.
7043 /// * *callback* (query-string) - JSONP
7044 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7045 /// * *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.
7046 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7047 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7048 /// * *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.
7049 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7050 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7051 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionDeleteCall<'a, C>
7052 where
7053 T: AsRef<str>,
7054 {
7055 self._additional_params
7056 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7057 self
7058 }
7059
7060 /// Identifies the authorization scope for the method you are building.
7061 ///
7062 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7063 /// [`Scope::CloudPlatform`].
7064 ///
7065 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7066 /// tokens for more than one scope.
7067 ///
7068 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7069 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7070 /// sufficient, a read-write scope will do as well.
7071 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionDeleteCall<'a, C>
7072 where
7073 St: AsRef<str>,
7074 {
7075 self._scopes.insert(String::from(scope.as_ref()));
7076 self
7077 }
7078 /// Identifies the authorization scope(s) for the method you are building.
7079 ///
7080 /// See [`Self::add_scope()`] for details.
7081 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionDeleteCall<'a, C>
7082 where
7083 I: IntoIterator<Item = St>,
7084 St: AsRef<str>,
7085 {
7086 self._scopes
7087 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7088 self
7089 }
7090
7091 /// Removes all scopes, and no default scope will be used either.
7092 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7093 /// for details).
7094 pub fn clear_scopes(mut self) -> NamespaceExecutionDeleteCall<'a, C> {
7095 self._scopes.clear();
7096 self
7097 }
7098}
7099
7100/// Get information about an execution.
7101///
7102/// A builder for the *executions.get* method supported by a *namespace* resource.
7103/// It is not used directly, but through a [`NamespaceMethods`] instance.
7104///
7105/// # Example
7106///
7107/// Instantiate a resource method builder
7108///
7109/// ```test_harness,no_run
7110/// # extern crate hyper;
7111/// # extern crate hyper_rustls;
7112/// # extern crate google_run1 as run1;
7113/// # async fn dox() {
7114/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7115///
7116/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7117/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7118/// # .with_native_roots()
7119/// # .unwrap()
7120/// # .https_only()
7121/// # .enable_http2()
7122/// # .build();
7123///
7124/// # let executor = hyper_util::rt::TokioExecutor::new();
7125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7126/// # secret,
7127/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7128/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7129/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7130/// # ),
7131/// # ).build().await.unwrap();
7132///
7133/// # let client = hyper_util::client::legacy::Client::builder(
7134/// # hyper_util::rt::TokioExecutor::new()
7135/// # )
7136/// # .build(
7137/// # hyper_rustls::HttpsConnectorBuilder::new()
7138/// # .with_native_roots()
7139/// # .unwrap()
7140/// # .https_or_http()
7141/// # .enable_http2()
7142/// # .build()
7143/// # );
7144/// # let mut hub = CloudRun::new(client, auth);
7145/// // You can configure optional parameters by calling the respective setters at will, and
7146/// // execute the final call using `doit()`.
7147/// // Values shown here are possibly random and not representative !
7148/// let result = hub.namespaces().executions_get("name")
7149/// .doit().await;
7150/// # }
7151/// ```
7152pub struct NamespaceExecutionGetCall<'a, C>
7153where
7154 C: 'a,
7155{
7156 hub: &'a CloudRun<C>,
7157 _name: String,
7158 _delegate: Option<&'a mut dyn common::Delegate>,
7159 _additional_params: HashMap<String, String>,
7160 _scopes: BTreeSet<String>,
7161}
7162
7163impl<'a, C> common::CallBuilder for NamespaceExecutionGetCall<'a, C> {}
7164
7165impl<'a, C> NamespaceExecutionGetCall<'a, C>
7166where
7167 C: common::Connector,
7168{
7169 /// Perform the operation you have build so far.
7170 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
7171 use std::borrow::Cow;
7172 use std::io::{Read, Seek};
7173
7174 use common::{url::Params, ToParts};
7175 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7176
7177 let mut dd = common::DefaultDelegate;
7178 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7179 dlg.begin(common::MethodInfo {
7180 id: "run.namespaces.executions.get",
7181 http_method: hyper::Method::GET,
7182 });
7183
7184 for &field in ["alt", "name"].iter() {
7185 if self._additional_params.contains_key(field) {
7186 dlg.finished(false);
7187 return Err(common::Error::FieldClash(field));
7188 }
7189 }
7190
7191 let mut params = Params::with_capacity(3 + self._additional_params.len());
7192 params.push("name", self._name);
7193
7194 params.extend(self._additional_params.iter());
7195
7196 params.push("alt", "json");
7197 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
7198 if self._scopes.is_empty() {
7199 self._scopes
7200 .insert(Scope::CloudPlatform.as_ref().to_string());
7201 }
7202
7203 #[allow(clippy::single_element_loop)]
7204 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7205 url = params.uri_replacement(url, param_name, find_this, true);
7206 }
7207 {
7208 let to_remove = ["name"];
7209 params.remove_params(&to_remove);
7210 }
7211
7212 let url = params.parse_with_url(&url);
7213
7214 loop {
7215 let token = match self
7216 .hub
7217 .auth
7218 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7219 .await
7220 {
7221 Ok(token) => token,
7222 Err(e) => match dlg.token(e) {
7223 Ok(token) => token,
7224 Err(e) => {
7225 dlg.finished(false);
7226 return Err(common::Error::MissingToken(e));
7227 }
7228 },
7229 };
7230 let mut req_result = {
7231 let client = &self.hub.client;
7232 dlg.pre_request();
7233 let mut req_builder = hyper::Request::builder()
7234 .method(hyper::Method::GET)
7235 .uri(url.as_str())
7236 .header(USER_AGENT, self.hub._user_agent.clone());
7237
7238 if let Some(token) = token.as_ref() {
7239 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7240 }
7241
7242 let request = req_builder
7243 .header(CONTENT_LENGTH, 0_u64)
7244 .body(common::to_body::<String>(None));
7245
7246 client.request(request.unwrap()).await
7247 };
7248
7249 match req_result {
7250 Err(err) => {
7251 if let common::Retry::After(d) = dlg.http_error(&err) {
7252 sleep(d).await;
7253 continue;
7254 }
7255 dlg.finished(false);
7256 return Err(common::Error::HttpError(err));
7257 }
7258 Ok(res) => {
7259 let (mut parts, body) = res.into_parts();
7260 let mut body = common::Body::new(body);
7261 if !parts.status.is_success() {
7262 let bytes = common::to_bytes(body).await.unwrap_or_default();
7263 let error = serde_json::from_str(&common::to_string(&bytes));
7264 let response = common::to_response(parts, bytes.into());
7265
7266 if let common::Retry::After(d) =
7267 dlg.http_failure(&response, error.as_ref().ok())
7268 {
7269 sleep(d).await;
7270 continue;
7271 }
7272
7273 dlg.finished(false);
7274
7275 return Err(match error {
7276 Ok(value) => common::Error::BadRequest(value),
7277 _ => common::Error::Failure(response),
7278 });
7279 }
7280 let response = {
7281 let bytes = common::to_bytes(body).await.unwrap_or_default();
7282 let encoded = common::to_string(&bytes);
7283 match serde_json::from_str(&encoded) {
7284 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7285 Err(error) => {
7286 dlg.response_json_decode_error(&encoded, &error);
7287 return Err(common::Error::JsonDecodeError(
7288 encoded.to_string(),
7289 error,
7290 ));
7291 }
7292 }
7293 };
7294
7295 dlg.finished(true);
7296 return Ok(response);
7297 }
7298 }
7299 }
7300 }
7301
7302 /// 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
7303 ///
7304 /// Sets the *name* path property to the given value.
7305 ///
7306 /// Even though the property as already been set when instantiating this call,
7307 /// we provide this method for API completeness.
7308 pub fn name(mut self, new_value: &str) -> NamespaceExecutionGetCall<'a, C> {
7309 self._name = new_value.to_string();
7310 self
7311 }
7312 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7313 /// while executing the actual API request.
7314 ///
7315 /// ````text
7316 /// It should be used to handle progress information, and to implement a certain level of resilience.
7317 /// ````
7318 ///
7319 /// Sets the *delegate* property to the given value.
7320 pub fn delegate(
7321 mut self,
7322 new_value: &'a mut dyn common::Delegate,
7323 ) -> NamespaceExecutionGetCall<'a, C> {
7324 self._delegate = Some(new_value);
7325 self
7326 }
7327
7328 /// Set any additional parameter of the query string used in the request.
7329 /// It should be used to set parameters which are not yet available through their own
7330 /// setters.
7331 ///
7332 /// Please note that this method must not be used to set any of the known parameters
7333 /// which have their own setter method. If done anyway, the request will fail.
7334 ///
7335 /// # Additional Parameters
7336 ///
7337 /// * *$.xgafv* (query-string) - V1 error format.
7338 /// * *access_token* (query-string) - OAuth access token.
7339 /// * *alt* (query-string) - Data format for response.
7340 /// * *callback* (query-string) - JSONP
7341 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7342 /// * *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.
7343 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7344 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7345 /// * *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.
7346 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7347 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7348 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionGetCall<'a, C>
7349 where
7350 T: AsRef<str>,
7351 {
7352 self._additional_params
7353 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7354 self
7355 }
7356
7357 /// Identifies the authorization scope for the method you are building.
7358 ///
7359 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7360 /// [`Scope::CloudPlatform`].
7361 ///
7362 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7363 /// tokens for more than one scope.
7364 ///
7365 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7366 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7367 /// sufficient, a read-write scope will do as well.
7368 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionGetCall<'a, C>
7369 where
7370 St: AsRef<str>,
7371 {
7372 self._scopes.insert(String::from(scope.as_ref()));
7373 self
7374 }
7375 /// Identifies the authorization scope(s) for the method you are building.
7376 ///
7377 /// See [`Self::add_scope()`] for details.
7378 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionGetCall<'a, C>
7379 where
7380 I: IntoIterator<Item = St>,
7381 St: AsRef<str>,
7382 {
7383 self._scopes
7384 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7385 self
7386 }
7387
7388 /// Removes all scopes, and no default scope will be used either.
7389 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7390 /// for details).
7391 pub fn clear_scopes(mut self) -> NamespaceExecutionGetCall<'a, C> {
7392 self._scopes.clear();
7393 self
7394 }
7395}
7396
7397/// List executions. Results are sorted by creation time, descending.
7398///
7399/// A builder for the *executions.list* method supported by a *namespace* resource.
7400/// It is not used directly, but through a [`NamespaceMethods`] instance.
7401///
7402/// # Example
7403///
7404/// Instantiate a resource method builder
7405///
7406/// ```test_harness,no_run
7407/// # extern crate hyper;
7408/// # extern crate hyper_rustls;
7409/// # extern crate google_run1 as run1;
7410/// # async fn dox() {
7411/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7412///
7413/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7414/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7415/// # .with_native_roots()
7416/// # .unwrap()
7417/// # .https_only()
7418/// # .enable_http2()
7419/// # .build();
7420///
7421/// # let executor = hyper_util::rt::TokioExecutor::new();
7422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7423/// # secret,
7424/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7425/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7426/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7427/// # ),
7428/// # ).build().await.unwrap();
7429///
7430/// # let client = hyper_util::client::legacy::Client::builder(
7431/// # hyper_util::rt::TokioExecutor::new()
7432/// # )
7433/// # .build(
7434/// # hyper_rustls::HttpsConnectorBuilder::new()
7435/// # .with_native_roots()
7436/// # .unwrap()
7437/// # .https_or_http()
7438/// # .enable_http2()
7439/// # .build()
7440/// # );
7441/// # let mut hub = CloudRun::new(client, auth);
7442/// // You can configure optional parameters by calling the respective setters at will, and
7443/// // execute the final call using `doit()`.
7444/// // Values shown here are possibly random and not representative !
7445/// let result = hub.namespaces().executions_list("parent")
7446/// .watch(false)
7447/// .resource_version("diam")
7448/// .limit(-49)
7449/// .label_selector("et")
7450/// .include_uninitialized(false)
7451/// .field_selector("Stet")
7452/// .continue_("dolor")
7453/// .doit().await;
7454/// # }
7455/// ```
7456pub struct NamespaceExecutionListCall<'a, C>
7457where
7458 C: 'a,
7459{
7460 hub: &'a CloudRun<C>,
7461 _parent: String,
7462 _watch: Option<bool>,
7463 _resource_version: Option<String>,
7464 _limit: Option<i32>,
7465 _label_selector: Option<String>,
7466 _include_uninitialized: Option<bool>,
7467 _field_selector: Option<String>,
7468 _continue_: Option<String>,
7469 _delegate: Option<&'a mut dyn common::Delegate>,
7470 _additional_params: HashMap<String, String>,
7471 _scopes: BTreeSet<String>,
7472}
7473
7474impl<'a, C> common::CallBuilder for NamespaceExecutionListCall<'a, C> {}
7475
7476impl<'a, C> NamespaceExecutionListCall<'a, C>
7477where
7478 C: common::Connector,
7479{
7480 /// Perform the operation you have build so far.
7481 pub async fn doit(mut self) -> common::Result<(common::Response, ListExecutionsResponse)> {
7482 use std::borrow::Cow;
7483 use std::io::{Read, Seek};
7484
7485 use common::{url::Params, ToParts};
7486 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7487
7488 let mut dd = common::DefaultDelegate;
7489 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7490 dlg.begin(common::MethodInfo {
7491 id: "run.namespaces.executions.list",
7492 http_method: hyper::Method::GET,
7493 });
7494
7495 for &field in [
7496 "alt",
7497 "parent",
7498 "watch",
7499 "resourceVersion",
7500 "limit",
7501 "labelSelector",
7502 "includeUninitialized",
7503 "fieldSelector",
7504 "continue",
7505 ]
7506 .iter()
7507 {
7508 if self._additional_params.contains_key(field) {
7509 dlg.finished(false);
7510 return Err(common::Error::FieldClash(field));
7511 }
7512 }
7513
7514 let mut params = Params::with_capacity(10 + self._additional_params.len());
7515 params.push("parent", self._parent);
7516 if let Some(value) = self._watch.as_ref() {
7517 params.push("watch", value.to_string());
7518 }
7519 if let Some(value) = self._resource_version.as_ref() {
7520 params.push("resourceVersion", value);
7521 }
7522 if let Some(value) = self._limit.as_ref() {
7523 params.push("limit", value.to_string());
7524 }
7525 if let Some(value) = self._label_selector.as_ref() {
7526 params.push("labelSelector", value);
7527 }
7528 if let Some(value) = self._include_uninitialized.as_ref() {
7529 params.push("includeUninitialized", value.to_string());
7530 }
7531 if let Some(value) = self._field_selector.as_ref() {
7532 params.push("fieldSelector", value);
7533 }
7534 if let Some(value) = self._continue_.as_ref() {
7535 params.push("continue", value);
7536 }
7537
7538 params.extend(self._additional_params.iter());
7539
7540 params.push("alt", "json");
7541 let mut url =
7542 self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/executions";
7543 if self._scopes.is_empty() {
7544 self._scopes
7545 .insert(Scope::CloudPlatform.as_ref().to_string());
7546 }
7547
7548 #[allow(clippy::single_element_loop)]
7549 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7550 url = params.uri_replacement(url, param_name, find_this, true);
7551 }
7552 {
7553 let to_remove = ["parent"];
7554 params.remove_params(&to_remove);
7555 }
7556
7557 let url = params.parse_with_url(&url);
7558
7559 loop {
7560 let token = match self
7561 .hub
7562 .auth
7563 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7564 .await
7565 {
7566 Ok(token) => token,
7567 Err(e) => match dlg.token(e) {
7568 Ok(token) => token,
7569 Err(e) => {
7570 dlg.finished(false);
7571 return Err(common::Error::MissingToken(e));
7572 }
7573 },
7574 };
7575 let mut req_result = {
7576 let client = &self.hub.client;
7577 dlg.pre_request();
7578 let mut req_builder = hyper::Request::builder()
7579 .method(hyper::Method::GET)
7580 .uri(url.as_str())
7581 .header(USER_AGENT, self.hub._user_agent.clone());
7582
7583 if let Some(token) = token.as_ref() {
7584 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7585 }
7586
7587 let request = req_builder
7588 .header(CONTENT_LENGTH, 0_u64)
7589 .body(common::to_body::<String>(None));
7590
7591 client.request(request.unwrap()).await
7592 };
7593
7594 match req_result {
7595 Err(err) => {
7596 if let common::Retry::After(d) = dlg.http_error(&err) {
7597 sleep(d).await;
7598 continue;
7599 }
7600 dlg.finished(false);
7601 return Err(common::Error::HttpError(err));
7602 }
7603 Ok(res) => {
7604 let (mut parts, body) = res.into_parts();
7605 let mut body = common::Body::new(body);
7606 if !parts.status.is_success() {
7607 let bytes = common::to_bytes(body).await.unwrap_or_default();
7608 let error = serde_json::from_str(&common::to_string(&bytes));
7609 let response = common::to_response(parts, bytes.into());
7610
7611 if let common::Retry::After(d) =
7612 dlg.http_failure(&response, error.as_ref().ok())
7613 {
7614 sleep(d).await;
7615 continue;
7616 }
7617
7618 dlg.finished(false);
7619
7620 return Err(match error {
7621 Ok(value) => common::Error::BadRequest(value),
7622 _ => common::Error::Failure(response),
7623 });
7624 }
7625 let response = {
7626 let bytes = common::to_bytes(body).await.unwrap_or_default();
7627 let encoded = common::to_string(&bytes);
7628 match serde_json::from_str(&encoded) {
7629 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7630 Err(error) => {
7631 dlg.response_json_decode_error(&encoded, &error);
7632 return Err(common::Error::JsonDecodeError(
7633 encoded.to_string(),
7634 error,
7635 ));
7636 }
7637 }
7638 };
7639
7640 dlg.finished(true);
7641 return Ok(response);
7642 }
7643 }
7644 }
7645 }
7646
7647 /// 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
7648 ///
7649 /// Sets the *parent* path property to the given value.
7650 ///
7651 /// Even though the property as already been set when instantiating this call,
7652 /// we provide this method for API completeness.
7653 pub fn parent(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7654 self._parent = new_value.to_string();
7655 self
7656 }
7657 /// Optional. Not supported by Cloud Run.
7658 ///
7659 /// Sets the *watch* query property to the given value.
7660 pub fn watch(mut self, new_value: bool) -> NamespaceExecutionListCall<'a, C> {
7661 self._watch = Some(new_value);
7662 self
7663 }
7664 /// Optional. Not supported by Cloud Run.
7665 ///
7666 /// Sets the *resource version* query property to the given value.
7667 pub fn resource_version(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7668 self._resource_version = Some(new_value.to_string());
7669 self
7670 }
7671 /// Optional. The maximum number of the records that should be returned.
7672 ///
7673 /// Sets the *limit* query property to the given value.
7674 pub fn limit(mut self, new_value: i32) -> NamespaceExecutionListCall<'a, C> {
7675 self._limit = Some(new_value);
7676 self
7677 }
7678 /// Optional. Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
7679 ///
7680 /// Sets the *label selector* query property to the given value.
7681 pub fn label_selector(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7682 self._label_selector = Some(new_value.to_string());
7683 self
7684 }
7685 /// Optional. Not supported by Cloud Run.
7686 ///
7687 /// Sets the *include uninitialized* query property to the given value.
7688 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceExecutionListCall<'a, C> {
7689 self._include_uninitialized = Some(new_value);
7690 self
7691 }
7692 /// Optional. Not supported by Cloud Run.
7693 ///
7694 /// Sets the *field selector* query property to the given value.
7695 pub fn field_selector(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7696 self._field_selector = Some(new_value.to_string());
7697 self
7698 }
7699 /// Optional. Optional encoded string to continue paging.
7700 ///
7701 /// Sets the *continue* query property to the given value.
7702 pub fn continue_(mut self, new_value: &str) -> NamespaceExecutionListCall<'a, C> {
7703 self._continue_ = Some(new_value.to_string());
7704 self
7705 }
7706 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7707 /// while executing the actual API request.
7708 ///
7709 /// ````text
7710 /// It should be used to handle progress information, and to implement a certain level of resilience.
7711 /// ````
7712 ///
7713 /// Sets the *delegate* property to the given value.
7714 pub fn delegate(
7715 mut self,
7716 new_value: &'a mut dyn common::Delegate,
7717 ) -> NamespaceExecutionListCall<'a, C> {
7718 self._delegate = Some(new_value);
7719 self
7720 }
7721
7722 /// Set any additional parameter of the query string used in the request.
7723 /// It should be used to set parameters which are not yet available through their own
7724 /// setters.
7725 ///
7726 /// Please note that this method must not be used to set any of the known parameters
7727 /// which have their own setter method. If done anyway, the request will fail.
7728 ///
7729 /// # Additional Parameters
7730 ///
7731 /// * *$.xgafv* (query-string) - V1 error format.
7732 /// * *access_token* (query-string) - OAuth access token.
7733 /// * *alt* (query-string) - Data format for response.
7734 /// * *callback* (query-string) - JSONP
7735 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7736 /// * *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.
7737 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7738 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7739 /// * *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.
7740 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7741 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7742 pub fn param<T>(mut self, name: T, value: T) -> NamespaceExecutionListCall<'a, C>
7743 where
7744 T: AsRef<str>,
7745 {
7746 self._additional_params
7747 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7748 self
7749 }
7750
7751 /// Identifies the authorization scope for the method you are building.
7752 ///
7753 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7754 /// [`Scope::CloudPlatform`].
7755 ///
7756 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7757 /// tokens for more than one scope.
7758 ///
7759 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7760 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7761 /// sufficient, a read-write scope will do as well.
7762 pub fn add_scope<St>(mut self, scope: St) -> NamespaceExecutionListCall<'a, C>
7763 where
7764 St: AsRef<str>,
7765 {
7766 self._scopes.insert(String::from(scope.as_ref()));
7767 self
7768 }
7769 /// Identifies the authorization scope(s) for the method you are building.
7770 ///
7771 /// See [`Self::add_scope()`] for details.
7772 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceExecutionListCall<'a, C>
7773 where
7774 I: IntoIterator<Item = St>,
7775 St: AsRef<str>,
7776 {
7777 self._scopes
7778 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7779 self
7780 }
7781
7782 /// Removes all scopes, and no default scope will be used either.
7783 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7784 /// for details).
7785 pub fn clear_scopes(mut self) -> NamespaceExecutionListCall<'a, C> {
7786 self._scopes.clear();
7787 self
7788 }
7789}
7790
7791/// Create a job.
7792///
7793/// A builder for the *jobs.create* method supported by a *namespace* resource.
7794/// It is not used directly, but through a [`NamespaceMethods`] instance.
7795///
7796/// # Example
7797///
7798/// Instantiate a resource method builder
7799///
7800/// ```test_harness,no_run
7801/// # extern crate hyper;
7802/// # extern crate hyper_rustls;
7803/// # extern crate google_run1 as run1;
7804/// use run1::api::Job;
7805/// # async fn dox() {
7806/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7807///
7808/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7809/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7810/// # .with_native_roots()
7811/// # .unwrap()
7812/// # .https_only()
7813/// # .enable_http2()
7814/// # .build();
7815///
7816/// # let executor = hyper_util::rt::TokioExecutor::new();
7817/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7818/// # secret,
7819/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7820/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7821/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7822/// # ),
7823/// # ).build().await.unwrap();
7824///
7825/// # let client = hyper_util::client::legacy::Client::builder(
7826/// # hyper_util::rt::TokioExecutor::new()
7827/// # )
7828/// # .build(
7829/// # hyper_rustls::HttpsConnectorBuilder::new()
7830/// # .with_native_roots()
7831/// # .unwrap()
7832/// # .https_or_http()
7833/// # .enable_http2()
7834/// # .build()
7835/// # );
7836/// # let mut hub = CloudRun::new(client, auth);
7837/// // As the method needs a request, you would usually fill it with the desired information
7838/// // into the respective structure. Some of the parts shown here might not be applicable !
7839/// // Values shown here are possibly random and not representative !
7840/// let mut req = Job::default();
7841///
7842/// // You can configure optional parameters by calling the respective setters at will, and
7843/// // execute the final call using `doit()`.
7844/// // Values shown here are possibly random and not representative !
7845/// let result = hub.namespaces().jobs_create(req, "parent")
7846/// .doit().await;
7847/// # }
7848/// ```
7849pub struct NamespaceJobCreateCall<'a, C>
7850where
7851 C: 'a,
7852{
7853 hub: &'a CloudRun<C>,
7854 _request: Job,
7855 _parent: String,
7856 _delegate: Option<&'a mut dyn common::Delegate>,
7857 _additional_params: HashMap<String, String>,
7858 _scopes: BTreeSet<String>,
7859}
7860
7861impl<'a, C> common::CallBuilder for NamespaceJobCreateCall<'a, C> {}
7862
7863impl<'a, C> NamespaceJobCreateCall<'a, C>
7864where
7865 C: common::Connector,
7866{
7867 /// Perform the operation you have build so far.
7868 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
7869 use std::borrow::Cow;
7870 use std::io::{Read, Seek};
7871
7872 use common::{url::Params, ToParts};
7873 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7874
7875 let mut dd = common::DefaultDelegate;
7876 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7877 dlg.begin(common::MethodInfo {
7878 id: "run.namespaces.jobs.create",
7879 http_method: hyper::Method::POST,
7880 });
7881
7882 for &field in ["alt", "parent"].iter() {
7883 if self._additional_params.contains_key(field) {
7884 dlg.finished(false);
7885 return Err(common::Error::FieldClash(field));
7886 }
7887 }
7888
7889 let mut params = Params::with_capacity(4 + self._additional_params.len());
7890 params.push("parent", self._parent);
7891
7892 params.extend(self._additional_params.iter());
7893
7894 params.push("alt", "json");
7895 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/jobs";
7896 if self._scopes.is_empty() {
7897 self._scopes
7898 .insert(Scope::CloudPlatform.as_ref().to_string());
7899 }
7900
7901 #[allow(clippy::single_element_loop)]
7902 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7903 url = params.uri_replacement(url, param_name, find_this, true);
7904 }
7905 {
7906 let to_remove = ["parent"];
7907 params.remove_params(&to_remove);
7908 }
7909
7910 let url = params.parse_with_url(&url);
7911
7912 let mut json_mime_type = mime::APPLICATION_JSON;
7913 let mut request_value_reader = {
7914 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7915 common::remove_json_null_values(&mut value);
7916 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7917 serde_json::to_writer(&mut dst, &value).unwrap();
7918 dst
7919 };
7920 let request_size = request_value_reader
7921 .seek(std::io::SeekFrom::End(0))
7922 .unwrap();
7923 request_value_reader
7924 .seek(std::io::SeekFrom::Start(0))
7925 .unwrap();
7926
7927 loop {
7928 let token = match self
7929 .hub
7930 .auth
7931 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7932 .await
7933 {
7934 Ok(token) => token,
7935 Err(e) => match dlg.token(e) {
7936 Ok(token) => token,
7937 Err(e) => {
7938 dlg.finished(false);
7939 return Err(common::Error::MissingToken(e));
7940 }
7941 },
7942 };
7943 request_value_reader
7944 .seek(std::io::SeekFrom::Start(0))
7945 .unwrap();
7946 let mut req_result = {
7947 let client = &self.hub.client;
7948 dlg.pre_request();
7949 let mut req_builder = hyper::Request::builder()
7950 .method(hyper::Method::POST)
7951 .uri(url.as_str())
7952 .header(USER_AGENT, self.hub._user_agent.clone());
7953
7954 if let Some(token) = token.as_ref() {
7955 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7956 }
7957
7958 let request = req_builder
7959 .header(CONTENT_TYPE, json_mime_type.to_string())
7960 .header(CONTENT_LENGTH, request_size as u64)
7961 .body(common::to_body(
7962 request_value_reader.get_ref().clone().into(),
7963 ));
7964
7965 client.request(request.unwrap()).await
7966 };
7967
7968 match req_result {
7969 Err(err) => {
7970 if let common::Retry::After(d) = dlg.http_error(&err) {
7971 sleep(d).await;
7972 continue;
7973 }
7974 dlg.finished(false);
7975 return Err(common::Error::HttpError(err));
7976 }
7977 Ok(res) => {
7978 let (mut parts, body) = res.into_parts();
7979 let mut body = common::Body::new(body);
7980 if !parts.status.is_success() {
7981 let bytes = common::to_bytes(body).await.unwrap_or_default();
7982 let error = serde_json::from_str(&common::to_string(&bytes));
7983 let response = common::to_response(parts, bytes.into());
7984
7985 if let common::Retry::After(d) =
7986 dlg.http_failure(&response, error.as_ref().ok())
7987 {
7988 sleep(d).await;
7989 continue;
7990 }
7991
7992 dlg.finished(false);
7993
7994 return Err(match error {
7995 Ok(value) => common::Error::BadRequest(value),
7996 _ => common::Error::Failure(response),
7997 });
7998 }
7999 let response = {
8000 let bytes = common::to_bytes(body).await.unwrap_or_default();
8001 let encoded = common::to_string(&bytes);
8002 match serde_json::from_str(&encoded) {
8003 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8004 Err(error) => {
8005 dlg.response_json_decode_error(&encoded, &error);
8006 return Err(common::Error::JsonDecodeError(
8007 encoded.to_string(),
8008 error,
8009 ));
8010 }
8011 }
8012 };
8013
8014 dlg.finished(true);
8015 return Ok(response);
8016 }
8017 }
8018 }
8019 }
8020
8021 ///
8022 /// Sets the *request* property to the given value.
8023 ///
8024 /// Even though the property as already been set when instantiating this call,
8025 /// we provide this method for API completeness.
8026 pub fn request(mut self, new_value: Job) -> NamespaceJobCreateCall<'a, C> {
8027 self._request = new_value;
8028 self
8029 }
8030 /// 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
8031 ///
8032 /// Sets the *parent* path property to the given value.
8033 ///
8034 /// Even though the property as already been set when instantiating this call,
8035 /// we provide this method for API completeness.
8036 pub fn parent(mut self, new_value: &str) -> NamespaceJobCreateCall<'a, C> {
8037 self._parent = new_value.to_string();
8038 self
8039 }
8040 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8041 /// while executing the actual API request.
8042 ///
8043 /// ````text
8044 /// It should be used to handle progress information, and to implement a certain level of resilience.
8045 /// ````
8046 ///
8047 /// Sets the *delegate* property to the given value.
8048 pub fn delegate(
8049 mut self,
8050 new_value: &'a mut dyn common::Delegate,
8051 ) -> NamespaceJobCreateCall<'a, C> {
8052 self._delegate = Some(new_value);
8053 self
8054 }
8055
8056 /// Set any additional parameter of the query string used in the request.
8057 /// It should be used to set parameters which are not yet available through their own
8058 /// setters.
8059 ///
8060 /// Please note that this method must not be used to set any of the known parameters
8061 /// which have their own setter method. If done anyway, the request will fail.
8062 ///
8063 /// # Additional Parameters
8064 ///
8065 /// * *$.xgafv* (query-string) - V1 error format.
8066 /// * *access_token* (query-string) - OAuth access token.
8067 /// * *alt* (query-string) - Data format for response.
8068 /// * *callback* (query-string) - JSONP
8069 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8070 /// * *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.
8071 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8072 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8073 /// * *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.
8074 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8075 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8076 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobCreateCall<'a, C>
8077 where
8078 T: AsRef<str>,
8079 {
8080 self._additional_params
8081 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8082 self
8083 }
8084
8085 /// Identifies the authorization scope for the method you are building.
8086 ///
8087 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8088 /// [`Scope::CloudPlatform`].
8089 ///
8090 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8091 /// tokens for more than one scope.
8092 ///
8093 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8094 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8095 /// sufficient, a read-write scope will do as well.
8096 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobCreateCall<'a, C>
8097 where
8098 St: AsRef<str>,
8099 {
8100 self._scopes.insert(String::from(scope.as_ref()));
8101 self
8102 }
8103 /// Identifies the authorization scope(s) for the method you are building.
8104 ///
8105 /// See [`Self::add_scope()`] for details.
8106 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobCreateCall<'a, C>
8107 where
8108 I: IntoIterator<Item = St>,
8109 St: AsRef<str>,
8110 {
8111 self._scopes
8112 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8113 self
8114 }
8115
8116 /// Removes all scopes, and no default scope will be used either.
8117 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8118 /// for details).
8119 pub fn clear_scopes(mut self) -> NamespaceJobCreateCall<'a, C> {
8120 self._scopes.clear();
8121 self
8122 }
8123}
8124
8125/// Delete a job.
8126///
8127/// A builder for the *jobs.delete* method supported by a *namespace* resource.
8128/// It is not used directly, but through a [`NamespaceMethods`] instance.
8129///
8130/// # Example
8131///
8132/// Instantiate a resource method builder
8133///
8134/// ```test_harness,no_run
8135/// # extern crate hyper;
8136/// # extern crate hyper_rustls;
8137/// # extern crate google_run1 as run1;
8138/// # async fn dox() {
8139/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8140///
8141/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8142/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8143/// # .with_native_roots()
8144/// # .unwrap()
8145/// # .https_only()
8146/// # .enable_http2()
8147/// # .build();
8148///
8149/// # let executor = hyper_util::rt::TokioExecutor::new();
8150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8151/// # secret,
8152/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8153/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8154/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8155/// # ),
8156/// # ).build().await.unwrap();
8157///
8158/// # let client = hyper_util::client::legacy::Client::builder(
8159/// # hyper_util::rt::TokioExecutor::new()
8160/// # )
8161/// # .build(
8162/// # hyper_rustls::HttpsConnectorBuilder::new()
8163/// # .with_native_roots()
8164/// # .unwrap()
8165/// # .https_or_http()
8166/// # .enable_http2()
8167/// # .build()
8168/// # );
8169/// # let mut hub = CloudRun::new(client, auth);
8170/// // You can configure optional parameters by calling the respective setters at will, and
8171/// // execute the final call using `doit()`.
8172/// // Values shown here are possibly random and not representative !
8173/// let result = hub.namespaces().jobs_delete("name")
8174/// .propagation_policy("vero")
8175/// .kind("invidunt")
8176/// .api_version("Stet")
8177/// .doit().await;
8178/// # }
8179/// ```
8180pub struct NamespaceJobDeleteCall<'a, C>
8181where
8182 C: 'a,
8183{
8184 hub: &'a CloudRun<C>,
8185 _name: String,
8186 _propagation_policy: Option<String>,
8187 _kind: Option<String>,
8188 _api_version: Option<String>,
8189 _delegate: Option<&'a mut dyn common::Delegate>,
8190 _additional_params: HashMap<String, String>,
8191 _scopes: BTreeSet<String>,
8192}
8193
8194impl<'a, C> common::CallBuilder for NamespaceJobDeleteCall<'a, C> {}
8195
8196impl<'a, C> NamespaceJobDeleteCall<'a, C>
8197where
8198 C: common::Connector,
8199{
8200 /// Perform the operation you have build so far.
8201 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
8202 use std::borrow::Cow;
8203 use std::io::{Read, Seek};
8204
8205 use common::{url::Params, ToParts};
8206 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8207
8208 let mut dd = common::DefaultDelegate;
8209 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8210 dlg.begin(common::MethodInfo {
8211 id: "run.namespaces.jobs.delete",
8212 http_method: hyper::Method::DELETE,
8213 });
8214
8215 for &field in ["alt", "name", "propagationPolicy", "kind", "apiVersion"].iter() {
8216 if self._additional_params.contains_key(field) {
8217 dlg.finished(false);
8218 return Err(common::Error::FieldClash(field));
8219 }
8220 }
8221
8222 let mut params = Params::with_capacity(6 + self._additional_params.len());
8223 params.push("name", self._name);
8224 if let Some(value) = self._propagation_policy.as_ref() {
8225 params.push("propagationPolicy", value);
8226 }
8227 if let Some(value) = self._kind.as_ref() {
8228 params.push("kind", value);
8229 }
8230 if let Some(value) = self._api_version.as_ref() {
8231 params.push("apiVersion", value);
8232 }
8233
8234 params.extend(self._additional_params.iter());
8235
8236 params.push("alt", "json");
8237 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
8238 if self._scopes.is_empty() {
8239 self._scopes
8240 .insert(Scope::CloudPlatform.as_ref().to_string());
8241 }
8242
8243 #[allow(clippy::single_element_loop)]
8244 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8245 url = params.uri_replacement(url, param_name, find_this, true);
8246 }
8247 {
8248 let to_remove = ["name"];
8249 params.remove_params(&to_remove);
8250 }
8251
8252 let url = params.parse_with_url(&url);
8253
8254 loop {
8255 let token = match self
8256 .hub
8257 .auth
8258 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8259 .await
8260 {
8261 Ok(token) => token,
8262 Err(e) => match dlg.token(e) {
8263 Ok(token) => token,
8264 Err(e) => {
8265 dlg.finished(false);
8266 return Err(common::Error::MissingToken(e));
8267 }
8268 },
8269 };
8270 let mut req_result = {
8271 let client = &self.hub.client;
8272 dlg.pre_request();
8273 let mut req_builder = hyper::Request::builder()
8274 .method(hyper::Method::DELETE)
8275 .uri(url.as_str())
8276 .header(USER_AGENT, self.hub._user_agent.clone());
8277
8278 if let Some(token) = token.as_ref() {
8279 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8280 }
8281
8282 let request = req_builder
8283 .header(CONTENT_LENGTH, 0_u64)
8284 .body(common::to_body::<String>(None));
8285
8286 client.request(request.unwrap()).await
8287 };
8288
8289 match req_result {
8290 Err(err) => {
8291 if let common::Retry::After(d) = dlg.http_error(&err) {
8292 sleep(d).await;
8293 continue;
8294 }
8295 dlg.finished(false);
8296 return Err(common::Error::HttpError(err));
8297 }
8298 Ok(res) => {
8299 let (mut parts, body) = res.into_parts();
8300 let mut body = common::Body::new(body);
8301 if !parts.status.is_success() {
8302 let bytes = common::to_bytes(body).await.unwrap_or_default();
8303 let error = serde_json::from_str(&common::to_string(&bytes));
8304 let response = common::to_response(parts, bytes.into());
8305
8306 if let common::Retry::After(d) =
8307 dlg.http_failure(&response, error.as_ref().ok())
8308 {
8309 sleep(d).await;
8310 continue;
8311 }
8312
8313 dlg.finished(false);
8314
8315 return Err(match error {
8316 Ok(value) => common::Error::BadRequest(value),
8317 _ => common::Error::Failure(response),
8318 });
8319 }
8320 let response = {
8321 let bytes = common::to_bytes(body).await.unwrap_or_default();
8322 let encoded = common::to_string(&bytes);
8323 match serde_json::from_str(&encoded) {
8324 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8325 Err(error) => {
8326 dlg.response_json_decode_error(&encoded, &error);
8327 return Err(common::Error::JsonDecodeError(
8328 encoded.to_string(),
8329 error,
8330 ));
8331 }
8332 }
8333 };
8334
8335 dlg.finished(true);
8336 return Ok(response);
8337 }
8338 }
8339 }
8340 }
8341
8342 /// 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
8343 ///
8344 /// Sets the *name* path property to the given value.
8345 ///
8346 /// Even though the property as already been set when instantiating this call,
8347 /// we provide this method for API completeness.
8348 pub fn name(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
8349 self._name = new_value.to_string();
8350 self
8351 }
8352 /// 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.
8353 ///
8354 /// Sets the *propagation policy* query property to the given value.
8355 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
8356 self._propagation_policy = Some(new_value.to_string());
8357 self
8358 }
8359 /// Optional. Cloud Run currently ignores this parameter.
8360 ///
8361 /// Sets the *kind* query property to the given value.
8362 pub fn kind(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
8363 self._kind = Some(new_value.to_string());
8364 self
8365 }
8366 /// Optional. Cloud Run currently ignores this parameter.
8367 ///
8368 /// Sets the *api version* query property to the given value.
8369 pub fn api_version(mut self, new_value: &str) -> NamespaceJobDeleteCall<'a, C> {
8370 self._api_version = Some(new_value.to_string());
8371 self
8372 }
8373 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8374 /// while executing the actual API request.
8375 ///
8376 /// ````text
8377 /// It should be used to handle progress information, and to implement a certain level of resilience.
8378 /// ````
8379 ///
8380 /// Sets the *delegate* property to the given value.
8381 pub fn delegate(
8382 mut self,
8383 new_value: &'a mut dyn common::Delegate,
8384 ) -> NamespaceJobDeleteCall<'a, C> {
8385 self._delegate = Some(new_value);
8386 self
8387 }
8388
8389 /// Set any additional parameter of the query string used in the request.
8390 /// It should be used to set parameters which are not yet available through their own
8391 /// setters.
8392 ///
8393 /// Please note that this method must not be used to set any of the known parameters
8394 /// which have their own setter method. If done anyway, the request will fail.
8395 ///
8396 /// # Additional Parameters
8397 ///
8398 /// * *$.xgafv* (query-string) - V1 error format.
8399 /// * *access_token* (query-string) - OAuth access token.
8400 /// * *alt* (query-string) - Data format for response.
8401 /// * *callback* (query-string) - JSONP
8402 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8403 /// * *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.
8404 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8405 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8406 /// * *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.
8407 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8408 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8409 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobDeleteCall<'a, C>
8410 where
8411 T: AsRef<str>,
8412 {
8413 self._additional_params
8414 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8415 self
8416 }
8417
8418 /// Identifies the authorization scope for the method you are building.
8419 ///
8420 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8421 /// [`Scope::CloudPlatform`].
8422 ///
8423 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8424 /// tokens for more than one scope.
8425 ///
8426 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8427 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8428 /// sufficient, a read-write scope will do as well.
8429 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobDeleteCall<'a, C>
8430 where
8431 St: AsRef<str>,
8432 {
8433 self._scopes.insert(String::from(scope.as_ref()));
8434 self
8435 }
8436 /// Identifies the authorization scope(s) for the method you are building.
8437 ///
8438 /// See [`Self::add_scope()`] for details.
8439 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobDeleteCall<'a, C>
8440 where
8441 I: IntoIterator<Item = St>,
8442 St: AsRef<str>,
8443 {
8444 self._scopes
8445 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8446 self
8447 }
8448
8449 /// Removes all scopes, and no default scope will be used either.
8450 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8451 /// for details).
8452 pub fn clear_scopes(mut self) -> NamespaceJobDeleteCall<'a, C> {
8453 self._scopes.clear();
8454 self
8455 }
8456}
8457
8458/// Get information about a job.
8459///
8460/// A builder for the *jobs.get* method supported by a *namespace* resource.
8461/// It is not used directly, but through a [`NamespaceMethods`] instance.
8462///
8463/// # Example
8464///
8465/// Instantiate a resource method builder
8466///
8467/// ```test_harness,no_run
8468/// # extern crate hyper;
8469/// # extern crate hyper_rustls;
8470/// # extern crate google_run1 as run1;
8471/// # async fn dox() {
8472/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8473///
8474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8475/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8476/// # .with_native_roots()
8477/// # .unwrap()
8478/// # .https_only()
8479/// # .enable_http2()
8480/// # .build();
8481///
8482/// # let executor = hyper_util::rt::TokioExecutor::new();
8483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8484/// # secret,
8485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8486/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8487/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8488/// # ),
8489/// # ).build().await.unwrap();
8490///
8491/// # let client = hyper_util::client::legacy::Client::builder(
8492/// # hyper_util::rt::TokioExecutor::new()
8493/// # )
8494/// # .build(
8495/// # hyper_rustls::HttpsConnectorBuilder::new()
8496/// # .with_native_roots()
8497/// # .unwrap()
8498/// # .https_or_http()
8499/// # .enable_http2()
8500/// # .build()
8501/// # );
8502/// # let mut hub = CloudRun::new(client, auth);
8503/// // You can configure optional parameters by calling the respective setters at will, and
8504/// // execute the final call using `doit()`.
8505/// // Values shown here are possibly random and not representative !
8506/// let result = hub.namespaces().jobs_get("name")
8507/// .doit().await;
8508/// # }
8509/// ```
8510pub struct NamespaceJobGetCall<'a, C>
8511where
8512 C: 'a,
8513{
8514 hub: &'a CloudRun<C>,
8515 _name: String,
8516 _delegate: Option<&'a mut dyn common::Delegate>,
8517 _additional_params: HashMap<String, String>,
8518 _scopes: BTreeSet<String>,
8519}
8520
8521impl<'a, C> common::CallBuilder for NamespaceJobGetCall<'a, C> {}
8522
8523impl<'a, C> NamespaceJobGetCall<'a, C>
8524where
8525 C: common::Connector,
8526{
8527 /// Perform the operation you have build so far.
8528 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
8529 use std::borrow::Cow;
8530 use std::io::{Read, Seek};
8531
8532 use common::{url::Params, ToParts};
8533 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8534
8535 let mut dd = common::DefaultDelegate;
8536 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8537 dlg.begin(common::MethodInfo {
8538 id: "run.namespaces.jobs.get",
8539 http_method: hyper::Method::GET,
8540 });
8541
8542 for &field in ["alt", "name"].iter() {
8543 if self._additional_params.contains_key(field) {
8544 dlg.finished(false);
8545 return Err(common::Error::FieldClash(field));
8546 }
8547 }
8548
8549 let mut params = Params::with_capacity(3 + self._additional_params.len());
8550 params.push("name", self._name);
8551
8552 params.extend(self._additional_params.iter());
8553
8554 params.push("alt", "json");
8555 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
8556 if self._scopes.is_empty() {
8557 self._scopes
8558 .insert(Scope::CloudPlatform.as_ref().to_string());
8559 }
8560
8561 #[allow(clippy::single_element_loop)]
8562 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8563 url = params.uri_replacement(url, param_name, find_this, true);
8564 }
8565 {
8566 let to_remove = ["name"];
8567 params.remove_params(&to_remove);
8568 }
8569
8570 let url = params.parse_with_url(&url);
8571
8572 loop {
8573 let token = match self
8574 .hub
8575 .auth
8576 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8577 .await
8578 {
8579 Ok(token) => token,
8580 Err(e) => match dlg.token(e) {
8581 Ok(token) => token,
8582 Err(e) => {
8583 dlg.finished(false);
8584 return Err(common::Error::MissingToken(e));
8585 }
8586 },
8587 };
8588 let mut req_result = {
8589 let client = &self.hub.client;
8590 dlg.pre_request();
8591 let mut req_builder = hyper::Request::builder()
8592 .method(hyper::Method::GET)
8593 .uri(url.as_str())
8594 .header(USER_AGENT, self.hub._user_agent.clone());
8595
8596 if let Some(token) = token.as_ref() {
8597 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8598 }
8599
8600 let request = req_builder
8601 .header(CONTENT_LENGTH, 0_u64)
8602 .body(common::to_body::<String>(None));
8603
8604 client.request(request.unwrap()).await
8605 };
8606
8607 match req_result {
8608 Err(err) => {
8609 if let common::Retry::After(d) = dlg.http_error(&err) {
8610 sleep(d).await;
8611 continue;
8612 }
8613 dlg.finished(false);
8614 return Err(common::Error::HttpError(err));
8615 }
8616 Ok(res) => {
8617 let (mut parts, body) = res.into_parts();
8618 let mut body = common::Body::new(body);
8619 if !parts.status.is_success() {
8620 let bytes = common::to_bytes(body).await.unwrap_or_default();
8621 let error = serde_json::from_str(&common::to_string(&bytes));
8622 let response = common::to_response(parts, bytes.into());
8623
8624 if let common::Retry::After(d) =
8625 dlg.http_failure(&response, error.as_ref().ok())
8626 {
8627 sleep(d).await;
8628 continue;
8629 }
8630
8631 dlg.finished(false);
8632
8633 return Err(match error {
8634 Ok(value) => common::Error::BadRequest(value),
8635 _ => common::Error::Failure(response),
8636 });
8637 }
8638 let response = {
8639 let bytes = common::to_bytes(body).await.unwrap_or_default();
8640 let encoded = common::to_string(&bytes);
8641 match serde_json::from_str(&encoded) {
8642 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8643 Err(error) => {
8644 dlg.response_json_decode_error(&encoded, &error);
8645 return Err(common::Error::JsonDecodeError(
8646 encoded.to_string(),
8647 error,
8648 ));
8649 }
8650 }
8651 };
8652
8653 dlg.finished(true);
8654 return Ok(response);
8655 }
8656 }
8657 }
8658 }
8659
8660 /// Required. The name of the job to retrieve. It takes the form namespaces/{namespace}/jobs/{job_name} and the `endpoint` must be regional. Replace {namespace} with the project ID or number.
8661 ///
8662 /// Sets the *name* path property to the given value.
8663 ///
8664 /// Even though the property as already been set when instantiating this call,
8665 /// we provide this method for API completeness.
8666 pub fn name(mut self, new_value: &str) -> NamespaceJobGetCall<'a, C> {
8667 self._name = new_value.to_string();
8668 self
8669 }
8670 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8671 /// while executing the actual API request.
8672 ///
8673 /// ````text
8674 /// It should be used to handle progress information, and to implement a certain level of resilience.
8675 /// ````
8676 ///
8677 /// Sets the *delegate* property to the given value.
8678 pub fn delegate(
8679 mut self,
8680 new_value: &'a mut dyn common::Delegate,
8681 ) -> NamespaceJobGetCall<'a, C> {
8682 self._delegate = Some(new_value);
8683 self
8684 }
8685
8686 /// Set any additional parameter of the query string used in the request.
8687 /// It should be used to set parameters which are not yet available through their own
8688 /// setters.
8689 ///
8690 /// Please note that this method must not be used to set any of the known parameters
8691 /// which have their own setter method. If done anyway, the request will fail.
8692 ///
8693 /// # Additional Parameters
8694 ///
8695 /// * *$.xgafv* (query-string) - V1 error format.
8696 /// * *access_token* (query-string) - OAuth access token.
8697 /// * *alt* (query-string) - Data format for response.
8698 /// * *callback* (query-string) - JSONP
8699 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8700 /// * *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.
8701 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8702 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8703 /// * *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.
8704 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8705 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8706 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobGetCall<'a, C>
8707 where
8708 T: AsRef<str>,
8709 {
8710 self._additional_params
8711 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8712 self
8713 }
8714
8715 /// Identifies the authorization scope for the method you are building.
8716 ///
8717 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8718 /// [`Scope::CloudPlatform`].
8719 ///
8720 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8721 /// tokens for more than one scope.
8722 ///
8723 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8724 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8725 /// sufficient, a read-write scope will do as well.
8726 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobGetCall<'a, C>
8727 where
8728 St: AsRef<str>,
8729 {
8730 self._scopes.insert(String::from(scope.as_ref()));
8731 self
8732 }
8733 /// Identifies the authorization scope(s) for the method you are building.
8734 ///
8735 /// See [`Self::add_scope()`] for details.
8736 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobGetCall<'a, C>
8737 where
8738 I: IntoIterator<Item = St>,
8739 St: AsRef<str>,
8740 {
8741 self._scopes
8742 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8743 self
8744 }
8745
8746 /// Removes all scopes, and no default scope will be used either.
8747 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8748 /// for details).
8749 pub fn clear_scopes(mut self) -> NamespaceJobGetCall<'a, C> {
8750 self._scopes.clear();
8751 self
8752 }
8753}
8754
8755/// List jobs. Results are sorted by creation time, descending.
8756///
8757/// A builder for the *jobs.list* method supported by a *namespace* resource.
8758/// It is not used directly, but through a [`NamespaceMethods`] instance.
8759///
8760/// # Example
8761///
8762/// Instantiate a resource method builder
8763///
8764/// ```test_harness,no_run
8765/// # extern crate hyper;
8766/// # extern crate hyper_rustls;
8767/// # extern crate google_run1 as run1;
8768/// # async fn dox() {
8769/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8770///
8771/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8772/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8773/// # .with_native_roots()
8774/// # .unwrap()
8775/// # .https_only()
8776/// # .enable_http2()
8777/// # .build();
8778///
8779/// # let executor = hyper_util::rt::TokioExecutor::new();
8780/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8781/// # secret,
8782/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8783/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8784/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8785/// # ),
8786/// # ).build().await.unwrap();
8787///
8788/// # let client = hyper_util::client::legacy::Client::builder(
8789/// # hyper_util::rt::TokioExecutor::new()
8790/// # )
8791/// # .build(
8792/// # hyper_rustls::HttpsConnectorBuilder::new()
8793/// # .with_native_roots()
8794/// # .unwrap()
8795/// # .https_or_http()
8796/// # .enable_http2()
8797/// # .build()
8798/// # );
8799/// # let mut hub = CloudRun::new(client, auth);
8800/// // You can configure optional parameters by calling the respective setters at will, and
8801/// // execute the final call using `doit()`.
8802/// // Values shown here are possibly random and not representative !
8803/// let result = hub.namespaces().jobs_list("parent")
8804/// .watch(true)
8805/// .resource_version("ipsum")
8806/// .limit(-23)
8807/// .label_selector("takimata")
8808/// .include_uninitialized(true)
8809/// .field_selector("voluptua.")
8810/// .continue_("et")
8811/// .doit().await;
8812/// # }
8813/// ```
8814pub struct NamespaceJobListCall<'a, C>
8815where
8816 C: 'a,
8817{
8818 hub: &'a CloudRun<C>,
8819 _parent: String,
8820 _watch: Option<bool>,
8821 _resource_version: Option<String>,
8822 _limit: Option<i32>,
8823 _label_selector: Option<String>,
8824 _include_uninitialized: Option<bool>,
8825 _field_selector: Option<String>,
8826 _continue_: Option<String>,
8827 _delegate: Option<&'a mut dyn common::Delegate>,
8828 _additional_params: HashMap<String, String>,
8829 _scopes: BTreeSet<String>,
8830}
8831
8832impl<'a, C> common::CallBuilder for NamespaceJobListCall<'a, C> {}
8833
8834impl<'a, C> NamespaceJobListCall<'a, C>
8835where
8836 C: common::Connector,
8837{
8838 /// Perform the operation you have build so far.
8839 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
8840 use std::borrow::Cow;
8841 use std::io::{Read, Seek};
8842
8843 use common::{url::Params, ToParts};
8844 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8845
8846 let mut dd = common::DefaultDelegate;
8847 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8848 dlg.begin(common::MethodInfo {
8849 id: "run.namespaces.jobs.list",
8850 http_method: hyper::Method::GET,
8851 });
8852
8853 for &field in [
8854 "alt",
8855 "parent",
8856 "watch",
8857 "resourceVersion",
8858 "limit",
8859 "labelSelector",
8860 "includeUninitialized",
8861 "fieldSelector",
8862 "continue",
8863 ]
8864 .iter()
8865 {
8866 if self._additional_params.contains_key(field) {
8867 dlg.finished(false);
8868 return Err(common::Error::FieldClash(field));
8869 }
8870 }
8871
8872 let mut params = Params::with_capacity(10 + self._additional_params.len());
8873 params.push("parent", self._parent);
8874 if let Some(value) = self._watch.as_ref() {
8875 params.push("watch", value.to_string());
8876 }
8877 if let Some(value) = self._resource_version.as_ref() {
8878 params.push("resourceVersion", value);
8879 }
8880 if let Some(value) = self._limit.as_ref() {
8881 params.push("limit", value.to_string());
8882 }
8883 if let Some(value) = self._label_selector.as_ref() {
8884 params.push("labelSelector", value);
8885 }
8886 if let Some(value) = self._include_uninitialized.as_ref() {
8887 params.push("includeUninitialized", value.to_string());
8888 }
8889 if let Some(value) = self._field_selector.as_ref() {
8890 params.push("fieldSelector", value);
8891 }
8892 if let Some(value) = self._continue_.as_ref() {
8893 params.push("continue", value);
8894 }
8895
8896 params.extend(self._additional_params.iter());
8897
8898 params.push("alt", "json");
8899 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/jobs";
8900 if self._scopes.is_empty() {
8901 self._scopes
8902 .insert(Scope::CloudPlatform.as_ref().to_string());
8903 }
8904
8905 #[allow(clippy::single_element_loop)]
8906 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8907 url = params.uri_replacement(url, param_name, find_this, true);
8908 }
8909 {
8910 let to_remove = ["parent"];
8911 params.remove_params(&to_remove);
8912 }
8913
8914 let url = params.parse_with_url(&url);
8915
8916 loop {
8917 let token = match self
8918 .hub
8919 .auth
8920 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8921 .await
8922 {
8923 Ok(token) => token,
8924 Err(e) => match dlg.token(e) {
8925 Ok(token) => token,
8926 Err(e) => {
8927 dlg.finished(false);
8928 return Err(common::Error::MissingToken(e));
8929 }
8930 },
8931 };
8932 let mut req_result = {
8933 let client = &self.hub.client;
8934 dlg.pre_request();
8935 let mut req_builder = hyper::Request::builder()
8936 .method(hyper::Method::GET)
8937 .uri(url.as_str())
8938 .header(USER_AGENT, self.hub._user_agent.clone());
8939
8940 if let Some(token) = token.as_ref() {
8941 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8942 }
8943
8944 let request = req_builder
8945 .header(CONTENT_LENGTH, 0_u64)
8946 .body(common::to_body::<String>(None));
8947
8948 client.request(request.unwrap()).await
8949 };
8950
8951 match req_result {
8952 Err(err) => {
8953 if let common::Retry::After(d) = dlg.http_error(&err) {
8954 sleep(d).await;
8955 continue;
8956 }
8957 dlg.finished(false);
8958 return Err(common::Error::HttpError(err));
8959 }
8960 Ok(res) => {
8961 let (mut parts, body) = res.into_parts();
8962 let mut body = common::Body::new(body);
8963 if !parts.status.is_success() {
8964 let bytes = common::to_bytes(body).await.unwrap_or_default();
8965 let error = serde_json::from_str(&common::to_string(&bytes));
8966 let response = common::to_response(parts, bytes.into());
8967
8968 if let common::Retry::After(d) =
8969 dlg.http_failure(&response, error.as_ref().ok())
8970 {
8971 sleep(d).await;
8972 continue;
8973 }
8974
8975 dlg.finished(false);
8976
8977 return Err(match error {
8978 Ok(value) => common::Error::BadRequest(value),
8979 _ => common::Error::Failure(response),
8980 });
8981 }
8982 let response = {
8983 let bytes = common::to_bytes(body).await.unwrap_or_default();
8984 let encoded = common::to_string(&bytes);
8985 match serde_json::from_str(&encoded) {
8986 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8987 Err(error) => {
8988 dlg.response_json_decode_error(&encoded, &error);
8989 return Err(common::Error::JsonDecodeError(
8990 encoded.to_string(),
8991 error,
8992 ));
8993 }
8994 }
8995 };
8996
8997 dlg.finished(true);
8998 return Ok(response);
8999 }
9000 }
9001 }
9002 }
9003
9004 /// 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
9005 ///
9006 /// Sets the *parent* path property to the given value.
9007 ///
9008 /// Even though the property as already been set when instantiating this call,
9009 /// we provide this method for API completeness.
9010 pub fn parent(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
9011 self._parent = new_value.to_string();
9012 self
9013 }
9014 /// Optional. Not supported by Cloud Run.
9015 ///
9016 /// Sets the *watch* query property to the given value.
9017 pub fn watch(mut self, new_value: bool) -> NamespaceJobListCall<'a, C> {
9018 self._watch = Some(new_value);
9019 self
9020 }
9021 /// Optional. Not supported by Cloud Run.
9022 ///
9023 /// Sets the *resource version* query property to the given value.
9024 pub fn resource_version(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
9025 self._resource_version = Some(new_value.to_string());
9026 self
9027 }
9028 /// Optional. The maximum number of records that should be returned.
9029 ///
9030 /// Sets the *limit* query property to the given value.
9031 pub fn limit(mut self, new_value: i32) -> NamespaceJobListCall<'a, C> {
9032 self._limit = Some(new_value);
9033 self
9034 }
9035 /// Optional. Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
9036 ///
9037 /// Sets the *label selector* query property to the given value.
9038 pub fn label_selector(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
9039 self._label_selector = Some(new_value.to_string());
9040 self
9041 }
9042 /// Optional. Not supported by Cloud Run.
9043 ///
9044 /// Sets the *include uninitialized* query property to the given value.
9045 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceJobListCall<'a, C> {
9046 self._include_uninitialized = Some(new_value);
9047 self
9048 }
9049 /// Optional. Not supported by Cloud Run.
9050 ///
9051 /// Sets the *field selector* query property to the given value.
9052 pub fn field_selector(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
9053 self._field_selector = Some(new_value.to_string());
9054 self
9055 }
9056 /// Optional. Optional encoded string to continue paging.
9057 ///
9058 /// Sets the *continue* query property to the given value.
9059 pub fn continue_(mut self, new_value: &str) -> NamespaceJobListCall<'a, C> {
9060 self._continue_ = Some(new_value.to_string());
9061 self
9062 }
9063 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9064 /// while executing the actual API request.
9065 ///
9066 /// ````text
9067 /// It should be used to handle progress information, and to implement a certain level of resilience.
9068 /// ````
9069 ///
9070 /// Sets the *delegate* property to the given value.
9071 pub fn delegate(
9072 mut self,
9073 new_value: &'a mut dyn common::Delegate,
9074 ) -> NamespaceJobListCall<'a, C> {
9075 self._delegate = Some(new_value);
9076 self
9077 }
9078
9079 /// Set any additional parameter of the query string used in the request.
9080 /// It should be used to set parameters which are not yet available through their own
9081 /// setters.
9082 ///
9083 /// Please note that this method must not be used to set any of the known parameters
9084 /// which have their own setter method. If done anyway, the request will fail.
9085 ///
9086 /// # Additional Parameters
9087 ///
9088 /// * *$.xgafv* (query-string) - V1 error format.
9089 /// * *access_token* (query-string) - OAuth access token.
9090 /// * *alt* (query-string) - Data format for response.
9091 /// * *callback* (query-string) - JSONP
9092 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9093 /// * *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.
9094 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9095 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9096 /// * *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.
9097 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9098 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9099 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobListCall<'a, C>
9100 where
9101 T: AsRef<str>,
9102 {
9103 self._additional_params
9104 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9105 self
9106 }
9107
9108 /// Identifies the authorization scope for the method you are building.
9109 ///
9110 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9111 /// [`Scope::CloudPlatform`].
9112 ///
9113 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9114 /// tokens for more than one scope.
9115 ///
9116 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9117 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9118 /// sufficient, a read-write scope will do as well.
9119 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobListCall<'a, C>
9120 where
9121 St: AsRef<str>,
9122 {
9123 self._scopes.insert(String::from(scope.as_ref()));
9124 self
9125 }
9126 /// Identifies the authorization scope(s) for the method you are building.
9127 ///
9128 /// See [`Self::add_scope()`] for details.
9129 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobListCall<'a, C>
9130 where
9131 I: IntoIterator<Item = St>,
9132 St: AsRef<str>,
9133 {
9134 self._scopes
9135 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9136 self
9137 }
9138
9139 /// Removes all scopes, and no default scope will be used either.
9140 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9141 /// for details).
9142 pub fn clear_scopes(mut self) -> NamespaceJobListCall<'a, C> {
9143 self._scopes.clear();
9144 self
9145 }
9146}
9147
9148/// 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.
9149///
9150/// A builder for the *jobs.replaceJob* method supported by a *namespace* resource.
9151/// It is not used directly, but through a [`NamespaceMethods`] instance.
9152///
9153/// # Example
9154///
9155/// Instantiate a resource method builder
9156///
9157/// ```test_harness,no_run
9158/// # extern crate hyper;
9159/// # extern crate hyper_rustls;
9160/// # extern crate google_run1 as run1;
9161/// use run1::api::Job;
9162/// # async fn dox() {
9163/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9164///
9165/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9166/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9167/// # .with_native_roots()
9168/// # .unwrap()
9169/// # .https_only()
9170/// # .enable_http2()
9171/// # .build();
9172///
9173/// # let executor = hyper_util::rt::TokioExecutor::new();
9174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9175/// # secret,
9176/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9177/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9178/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9179/// # ),
9180/// # ).build().await.unwrap();
9181///
9182/// # let client = hyper_util::client::legacy::Client::builder(
9183/// # hyper_util::rt::TokioExecutor::new()
9184/// # )
9185/// # .build(
9186/// # hyper_rustls::HttpsConnectorBuilder::new()
9187/// # .with_native_roots()
9188/// # .unwrap()
9189/// # .https_or_http()
9190/// # .enable_http2()
9191/// # .build()
9192/// # );
9193/// # let mut hub = CloudRun::new(client, auth);
9194/// // As the method needs a request, you would usually fill it with the desired information
9195/// // into the respective structure. Some of the parts shown here might not be applicable !
9196/// // Values shown here are possibly random and not representative !
9197/// let mut req = Job::default();
9198///
9199/// // You can configure optional parameters by calling the respective setters at will, and
9200/// // execute the final call using `doit()`.
9201/// // Values shown here are possibly random and not representative !
9202/// let result = hub.namespaces().jobs_replace_job(req, "name")
9203/// .doit().await;
9204/// # }
9205/// ```
9206pub struct NamespaceJobReplaceJobCall<'a, C>
9207where
9208 C: 'a,
9209{
9210 hub: &'a CloudRun<C>,
9211 _request: Job,
9212 _name: String,
9213 _delegate: Option<&'a mut dyn common::Delegate>,
9214 _additional_params: HashMap<String, String>,
9215 _scopes: BTreeSet<String>,
9216}
9217
9218impl<'a, C> common::CallBuilder for NamespaceJobReplaceJobCall<'a, C> {}
9219
9220impl<'a, C> NamespaceJobReplaceJobCall<'a, C>
9221where
9222 C: common::Connector,
9223{
9224 /// Perform the operation you have build so far.
9225 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
9226 use std::borrow::Cow;
9227 use std::io::{Read, Seek};
9228
9229 use common::{url::Params, ToParts};
9230 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9231
9232 let mut dd = common::DefaultDelegate;
9233 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9234 dlg.begin(common::MethodInfo {
9235 id: "run.namespaces.jobs.replaceJob",
9236 http_method: hyper::Method::PUT,
9237 });
9238
9239 for &field in ["alt", "name"].iter() {
9240 if self._additional_params.contains_key(field) {
9241 dlg.finished(false);
9242 return Err(common::Error::FieldClash(field));
9243 }
9244 }
9245
9246 let mut params = Params::with_capacity(4 + self._additional_params.len());
9247 params.push("name", self._name);
9248
9249 params.extend(self._additional_params.iter());
9250
9251 params.push("alt", "json");
9252 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
9253 if self._scopes.is_empty() {
9254 self._scopes
9255 .insert(Scope::CloudPlatform.as_ref().to_string());
9256 }
9257
9258 #[allow(clippy::single_element_loop)]
9259 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9260 url = params.uri_replacement(url, param_name, find_this, true);
9261 }
9262 {
9263 let to_remove = ["name"];
9264 params.remove_params(&to_remove);
9265 }
9266
9267 let url = params.parse_with_url(&url);
9268
9269 let mut json_mime_type = mime::APPLICATION_JSON;
9270 let mut request_value_reader = {
9271 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9272 common::remove_json_null_values(&mut value);
9273 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9274 serde_json::to_writer(&mut dst, &value).unwrap();
9275 dst
9276 };
9277 let request_size = request_value_reader
9278 .seek(std::io::SeekFrom::End(0))
9279 .unwrap();
9280 request_value_reader
9281 .seek(std::io::SeekFrom::Start(0))
9282 .unwrap();
9283
9284 loop {
9285 let token = match self
9286 .hub
9287 .auth
9288 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9289 .await
9290 {
9291 Ok(token) => token,
9292 Err(e) => match dlg.token(e) {
9293 Ok(token) => token,
9294 Err(e) => {
9295 dlg.finished(false);
9296 return Err(common::Error::MissingToken(e));
9297 }
9298 },
9299 };
9300 request_value_reader
9301 .seek(std::io::SeekFrom::Start(0))
9302 .unwrap();
9303 let mut req_result = {
9304 let client = &self.hub.client;
9305 dlg.pre_request();
9306 let mut req_builder = hyper::Request::builder()
9307 .method(hyper::Method::PUT)
9308 .uri(url.as_str())
9309 .header(USER_AGENT, self.hub._user_agent.clone());
9310
9311 if let Some(token) = token.as_ref() {
9312 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9313 }
9314
9315 let request = req_builder
9316 .header(CONTENT_TYPE, json_mime_type.to_string())
9317 .header(CONTENT_LENGTH, request_size as u64)
9318 .body(common::to_body(
9319 request_value_reader.get_ref().clone().into(),
9320 ));
9321
9322 client.request(request.unwrap()).await
9323 };
9324
9325 match req_result {
9326 Err(err) => {
9327 if let common::Retry::After(d) = dlg.http_error(&err) {
9328 sleep(d).await;
9329 continue;
9330 }
9331 dlg.finished(false);
9332 return Err(common::Error::HttpError(err));
9333 }
9334 Ok(res) => {
9335 let (mut parts, body) = res.into_parts();
9336 let mut body = common::Body::new(body);
9337 if !parts.status.is_success() {
9338 let bytes = common::to_bytes(body).await.unwrap_or_default();
9339 let error = serde_json::from_str(&common::to_string(&bytes));
9340 let response = common::to_response(parts, bytes.into());
9341
9342 if let common::Retry::After(d) =
9343 dlg.http_failure(&response, error.as_ref().ok())
9344 {
9345 sleep(d).await;
9346 continue;
9347 }
9348
9349 dlg.finished(false);
9350
9351 return Err(match error {
9352 Ok(value) => common::Error::BadRequest(value),
9353 _ => common::Error::Failure(response),
9354 });
9355 }
9356 let response = {
9357 let bytes = common::to_bytes(body).await.unwrap_or_default();
9358 let encoded = common::to_string(&bytes);
9359 match serde_json::from_str(&encoded) {
9360 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9361 Err(error) => {
9362 dlg.response_json_decode_error(&encoded, &error);
9363 return Err(common::Error::JsonDecodeError(
9364 encoded.to_string(),
9365 error,
9366 ));
9367 }
9368 }
9369 };
9370
9371 dlg.finished(true);
9372 return Ok(response);
9373 }
9374 }
9375 }
9376 }
9377
9378 ///
9379 /// Sets the *request* property to the given value.
9380 ///
9381 /// Even though the property as already been set when instantiating this call,
9382 /// we provide this method for API completeness.
9383 pub fn request(mut self, new_value: Job) -> NamespaceJobReplaceJobCall<'a, C> {
9384 self._request = new_value;
9385 self
9386 }
9387 /// 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
9388 ///
9389 /// Sets the *name* path property to the given value.
9390 ///
9391 /// Even though the property as already been set when instantiating this call,
9392 /// we provide this method for API completeness.
9393 pub fn name(mut self, new_value: &str) -> NamespaceJobReplaceJobCall<'a, C> {
9394 self._name = new_value.to_string();
9395 self
9396 }
9397 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9398 /// while executing the actual API request.
9399 ///
9400 /// ````text
9401 /// It should be used to handle progress information, and to implement a certain level of resilience.
9402 /// ````
9403 ///
9404 /// Sets the *delegate* property to the given value.
9405 pub fn delegate(
9406 mut self,
9407 new_value: &'a mut dyn common::Delegate,
9408 ) -> NamespaceJobReplaceJobCall<'a, C> {
9409 self._delegate = Some(new_value);
9410 self
9411 }
9412
9413 /// Set any additional parameter of the query string used in the request.
9414 /// It should be used to set parameters which are not yet available through their own
9415 /// setters.
9416 ///
9417 /// Please note that this method must not be used to set any of the known parameters
9418 /// which have their own setter method. If done anyway, the request will fail.
9419 ///
9420 /// # Additional Parameters
9421 ///
9422 /// * *$.xgafv* (query-string) - V1 error format.
9423 /// * *access_token* (query-string) - OAuth access token.
9424 /// * *alt* (query-string) - Data format for response.
9425 /// * *callback* (query-string) - JSONP
9426 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9427 /// * *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.
9428 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9429 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9430 /// * *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.
9431 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9432 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9433 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobReplaceJobCall<'a, C>
9434 where
9435 T: AsRef<str>,
9436 {
9437 self._additional_params
9438 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9439 self
9440 }
9441
9442 /// Identifies the authorization scope for the method you are building.
9443 ///
9444 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9445 /// [`Scope::CloudPlatform`].
9446 ///
9447 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9448 /// tokens for more than one scope.
9449 ///
9450 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9451 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9452 /// sufficient, a read-write scope will do as well.
9453 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobReplaceJobCall<'a, C>
9454 where
9455 St: AsRef<str>,
9456 {
9457 self._scopes.insert(String::from(scope.as_ref()));
9458 self
9459 }
9460 /// Identifies the authorization scope(s) for the method you are building.
9461 ///
9462 /// See [`Self::add_scope()`] for details.
9463 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobReplaceJobCall<'a, C>
9464 where
9465 I: IntoIterator<Item = St>,
9466 St: AsRef<str>,
9467 {
9468 self._scopes
9469 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9470 self
9471 }
9472
9473 /// Removes all scopes, and no default scope will be used either.
9474 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9475 /// for details).
9476 pub fn clear_scopes(mut self) -> NamespaceJobReplaceJobCall<'a, C> {
9477 self._scopes.clear();
9478 self
9479 }
9480}
9481
9482/// Trigger creation of a new execution of this job.
9483///
9484/// A builder for the *jobs.run* method supported by a *namespace* resource.
9485/// It is not used directly, but through a [`NamespaceMethods`] instance.
9486///
9487/// # Example
9488///
9489/// Instantiate a resource method builder
9490///
9491/// ```test_harness,no_run
9492/// # extern crate hyper;
9493/// # extern crate hyper_rustls;
9494/// # extern crate google_run1 as run1;
9495/// use run1::api::RunJobRequest;
9496/// # async fn dox() {
9497/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9498///
9499/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9500/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9501/// # .with_native_roots()
9502/// # .unwrap()
9503/// # .https_only()
9504/// # .enable_http2()
9505/// # .build();
9506///
9507/// # let executor = hyper_util::rt::TokioExecutor::new();
9508/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9509/// # secret,
9510/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9511/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9512/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9513/// # ),
9514/// # ).build().await.unwrap();
9515///
9516/// # let client = hyper_util::client::legacy::Client::builder(
9517/// # hyper_util::rt::TokioExecutor::new()
9518/// # )
9519/// # .build(
9520/// # hyper_rustls::HttpsConnectorBuilder::new()
9521/// # .with_native_roots()
9522/// # .unwrap()
9523/// # .https_or_http()
9524/// # .enable_http2()
9525/// # .build()
9526/// # );
9527/// # let mut hub = CloudRun::new(client, auth);
9528/// // As the method needs a request, you would usually fill it with the desired information
9529/// // into the respective structure. Some of the parts shown here might not be applicable !
9530/// // Values shown here are possibly random and not representative !
9531/// let mut req = RunJobRequest::default();
9532///
9533/// // You can configure optional parameters by calling the respective setters at will, and
9534/// // execute the final call using `doit()`.
9535/// // Values shown here are possibly random and not representative !
9536/// let result = hub.namespaces().jobs_run(req, "name")
9537/// .doit().await;
9538/// # }
9539/// ```
9540pub struct NamespaceJobRunCall<'a, C>
9541where
9542 C: 'a,
9543{
9544 hub: &'a CloudRun<C>,
9545 _request: RunJobRequest,
9546 _name: String,
9547 _delegate: Option<&'a mut dyn common::Delegate>,
9548 _additional_params: HashMap<String, String>,
9549 _scopes: BTreeSet<String>,
9550}
9551
9552impl<'a, C> common::CallBuilder for NamespaceJobRunCall<'a, C> {}
9553
9554impl<'a, C> NamespaceJobRunCall<'a, C>
9555where
9556 C: common::Connector,
9557{
9558 /// Perform the operation you have build so far.
9559 pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
9560 use std::borrow::Cow;
9561 use std::io::{Read, Seek};
9562
9563 use common::{url::Params, ToParts};
9564 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9565
9566 let mut dd = common::DefaultDelegate;
9567 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9568 dlg.begin(common::MethodInfo {
9569 id: "run.namespaces.jobs.run",
9570 http_method: hyper::Method::POST,
9571 });
9572
9573 for &field in ["alt", "name"].iter() {
9574 if self._additional_params.contains_key(field) {
9575 dlg.finished(false);
9576 return Err(common::Error::FieldClash(field));
9577 }
9578 }
9579
9580 let mut params = Params::with_capacity(4 + self._additional_params.len());
9581 params.push("name", self._name);
9582
9583 params.extend(self._additional_params.iter());
9584
9585 params.push("alt", "json");
9586 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}:run";
9587 if self._scopes.is_empty() {
9588 self._scopes
9589 .insert(Scope::CloudPlatform.as_ref().to_string());
9590 }
9591
9592 #[allow(clippy::single_element_loop)]
9593 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9594 url = params.uri_replacement(url, param_name, find_this, true);
9595 }
9596 {
9597 let to_remove = ["name"];
9598 params.remove_params(&to_remove);
9599 }
9600
9601 let url = params.parse_with_url(&url);
9602
9603 let mut json_mime_type = mime::APPLICATION_JSON;
9604 let mut request_value_reader = {
9605 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9606 common::remove_json_null_values(&mut value);
9607 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9608 serde_json::to_writer(&mut dst, &value).unwrap();
9609 dst
9610 };
9611 let request_size = request_value_reader
9612 .seek(std::io::SeekFrom::End(0))
9613 .unwrap();
9614 request_value_reader
9615 .seek(std::io::SeekFrom::Start(0))
9616 .unwrap();
9617
9618 loop {
9619 let token = match self
9620 .hub
9621 .auth
9622 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9623 .await
9624 {
9625 Ok(token) => token,
9626 Err(e) => match dlg.token(e) {
9627 Ok(token) => token,
9628 Err(e) => {
9629 dlg.finished(false);
9630 return Err(common::Error::MissingToken(e));
9631 }
9632 },
9633 };
9634 request_value_reader
9635 .seek(std::io::SeekFrom::Start(0))
9636 .unwrap();
9637 let mut req_result = {
9638 let client = &self.hub.client;
9639 dlg.pre_request();
9640 let mut req_builder = hyper::Request::builder()
9641 .method(hyper::Method::POST)
9642 .uri(url.as_str())
9643 .header(USER_AGENT, self.hub._user_agent.clone());
9644
9645 if let Some(token) = token.as_ref() {
9646 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9647 }
9648
9649 let request = req_builder
9650 .header(CONTENT_TYPE, json_mime_type.to_string())
9651 .header(CONTENT_LENGTH, request_size as u64)
9652 .body(common::to_body(
9653 request_value_reader.get_ref().clone().into(),
9654 ));
9655
9656 client.request(request.unwrap()).await
9657 };
9658
9659 match req_result {
9660 Err(err) => {
9661 if let common::Retry::After(d) = dlg.http_error(&err) {
9662 sleep(d).await;
9663 continue;
9664 }
9665 dlg.finished(false);
9666 return Err(common::Error::HttpError(err));
9667 }
9668 Ok(res) => {
9669 let (mut parts, body) = res.into_parts();
9670 let mut body = common::Body::new(body);
9671 if !parts.status.is_success() {
9672 let bytes = common::to_bytes(body).await.unwrap_or_default();
9673 let error = serde_json::from_str(&common::to_string(&bytes));
9674 let response = common::to_response(parts, bytes.into());
9675
9676 if let common::Retry::After(d) =
9677 dlg.http_failure(&response, error.as_ref().ok())
9678 {
9679 sleep(d).await;
9680 continue;
9681 }
9682
9683 dlg.finished(false);
9684
9685 return Err(match error {
9686 Ok(value) => common::Error::BadRequest(value),
9687 _ => common::Error::Failure(response),
9688 });
9689 }
9690 let response = {
9691 let bytes = common::to_bytes(body).await.unwrap_or_default();
9692 let encoded = common::to_string(&bytes);
9693 match serde_json::from_str(&encoded) {
9694 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9695 Err(error) => {
9696 dlg.response_json_decode_error(&encoded, &error);
9697 return Err(common::Error::JsonDecodeError(
9698 encoded.to_string(),
9699 error,
9700 ));
9701 }
9702 }
9703 };
9704
9705 dlg.finished(true);
9706 return Ok(response);
9707 }
9708 }
9709 }
9710 }
9711
9712 ///
9713 /// Sets the *request* property to the given value.
9714 ///
9715 /// Even though the property as already been set when instantiating this call,
9716 /// we provide this method for API completeness.
9717 pub fn request(mut self, new_value: RunJobRequest) -> NamespaceJobRunCall<'a, C> {
9718 self._request = new_value;
9719 self
9720 }
9721 /// 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
9722 ///
9723 /// Sets the *name* path property to the given value.
9724 ///
9725 /// Even though the property as already been set when instantiating this call,
9726 /// we provide this method for API completeness.
9727 pub fn name(mut self, new_value: &str) -> NamespaceJobRunCall<'a, C> {
9728 self._name = new_value.to_string();
9729 self
9730 }
9731 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9732 /// while executing the actual API request.
9733 ///
9734 /// ````text
9735 /// It should be used to handle progress information, and to implement a certain level of resilience.
9736 /// ````
9737 ///
9738 /// Sets the *delegate* property to the given value.
9739 pub fn delegate(
9740 mut self,
9741 new_value: &'a mut dyn common::Delegate,
9742 ) -> NamespaceJobRunCall<'a, C> {
9743 self._delegate = Some(new_value);
9744 self
9745 }
9746
9747 /// Set any additional parameter of the query string used in the request.
9748 /// It should be used to set parameters which are not yet available through their own
9749 /// setters.
9750 ///
9751 /// Please note that this method must not be used to set any of the known parameters
9752 /// which have their own setter method. If done anyway, the request will fail.
9753 ///
9754 /// # Additional Parameters
9755 ///
9756 /// * *$.xgafv* (query-string) - V1 error format.
9757 /// * *access_token* (query-string) - OAuth access token.
9758 /// * *alt* (query-string) - Data format for response.
9759 /// * *callback* (query-string) - JSONP
9760 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9761 /// * *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.
9762 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9763 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9764 /// * *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.
9765 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9766 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9767 pub fn param<T>(mut self, name: T, value: T) -> NamespaceJobRunCall<'a, C>
9768 where
9769 T: AsRef<str>,
9770 {
9771 self._additional_params
9772 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9773 self
9774 }
9775
9776 /// Identifies the authorization scope for the method you are building.
9777 ///
9778 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9779 /// [`Scope::CloudPlatform`].
9780 ///
9781 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9782 /// tokens for more than one scope.
9783 ///
9784 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9785 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9786 /// sufficient, a read-write scope will do as well.
9787 pub fn add_scope<St>(mut self, scope: St) -> NamespaceJobRunCall<'a, C>
9788 where
9789 St: AsRef<str>,
9790 {
9791 self._scopes.insert(String::from(scope.as_ref()));
9792 self
9793 }
9794 /// Identifies the authorization scope(s) for the method you are building.
9795 ///
9796 /// See [`Self::add_scope()`] for details.
9797 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceJobRunCall<'a, C>
9798 where
9799 I: IntoIterator<Item = St>,
9800 St: AsRef<str>,
9801 {
9802 self._scopes
9803 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9804 self
9805 }
9806
9807 /// Removes all scopes, and no default scope will be used either.
9808 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9809 /// for details).
9810 pub fn clear_scopes(mut self) -> NamespaceJobRunCall<'a, C> {
9811 self._scopes.clear();
9812 self
9813 }
9814}
9815
9816/// Delete a revision.
9817///
9818/// A builder for the *revisions.delete* method supported by a *namespace* resource.
9819/// It is not used directly, but through a [`NamespaceMethods`] instance.
9820///
9821/// # Example
9822///
9823/// Instantiate a resource method builder
9824///
9825/// ```test_harness,no_run
9826/// # extern crate hyper;
9827/// # extern crate hyper_rustls;
9828/// # extern crate google_run1 as run1;
9829/// # async fn dox() {
9830/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9831///
9832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9833/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9834/// # .with_native_roots()
9835/// # .unwrap()
9836/// # .https_only()
9837/// # .enable_http2()
9838/// # .build();
9839///
9840/// # let executor = hyper_util::rt::TokioExecutor::new();
9841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9842/// # secret,
9843/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9844/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9845/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9846/// # ),
9847/// # ).build().await.unwrap();
9848///
9849/// # let client = hyper_util::client::legacy::Client::builder(
9850/// # hyper_util::rt::TokioExecutor::new()
9851/// # )
9852/// # .build(
9853/// # hyper_rustls::HttpsConnectorBuilder::new()
9854/// # .with_native_roots()
9855/// # .unwrap()
9856/// # .https_or_http()
9857/// # .enable_http2()
9858/// # .build()
9859/// # );
9860/// # let mut hub = CloudRun::new(client, auth);
9861/// // You can configure optional parameters by calling the respective setters at will, and
9862/// // execute the final call using `doit()`.
9863/// // Values shown here are possibly random and not representative !
9864/// let result = hub.namespaces().revisions_delete("name")
9865/// .propagation_policy("sed")
9866/// .kind("takimata")
9867/// .dry_run("dolores")
9868/// .api_version("gubergren")
9869/// .doit().await;
9870/// # }
9871/// ```
9872pub struct NamespaceRevisionDeleteCall<'a, C>
9873where
9874 C: 'a,
9875{
9876 hub: &'a CloudRun<C>,
9877 _name: String,
9878 _propagation_policy: Option<String>,
9879 _kind: Option<String>,
9880 _dry_run: Option<String>,
9881 _api_version: Option<String>,
9882 _delegate: Option<&'a mut dyn common::Delegate>,
9883 _additional_params: HashMap<String, String>,
9884 _scopes: BTreeSet<String>,
9885}
9886
9887impl<'a, C> common::CallBuilder for NamespaceRevisionDeleteCall<'a, C> {}
9888
9889impl<'a, C> NamespaceRevisionDeleteCall<'a, C>
9890where
9891 C: common::Connector,
9892{
9893 /// Perform the operation you have build so far.
9894 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
9895 use std::borrow::Cow;
9896 use std::io::{Read, Seek};
9897
9898 use common::{url::Params, ToParts};
9899 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9900
9901 let mut dd = common::DefaultDelegate;
9902 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9903 dlg.begin(common::MethodInfo {
9904 id: "run.namespaces.revisions.delete",
9905 http_method: hyper::Method::DELETE,
9906 });
9907
9908 for &field in [
9909 "alt",
9910 "name",
9911 "propagationPolicy",
9912 "kind",
9913 "dryRun",
9914 "apiVersion",
9915 ]
9916 .iter()
9917 {
9918 if self._additional_params.contains_key(field) {
9919 dlg.finished(false);
9920 return Err(common::Error::FieldClash(field));
9921 }
9922 }
9923
9924 let mut params = Params::with_capacity(7 + self._additional_params.len());
9925 params.push("name", self._name);
9926 if let Some(value) = self._propagation_policy.as_ref() {
9927 params.push("propagationPolicy", value);
9928 }
9929 if let Some(value) = self._kind.as_ref() {
9930 params.push("kind", value);
9931 }
9932 if let Some(value) = self._dry_run.as_ref() {
9933 params.push("dryRun", value);
9934 }
9935 if let Some(value) = self._api_version.as_ref() {
9936 params.push("apiVersion", value);
9937 }
9938
9939 params.extend(self._additional_params.iter());
9940
9941 params.push("alt", "json");
9942 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
9943 if self._scopes.is_empty() {
9944 self._scopes
9945 .insert(Scope::CloudPlatform.as_ref().to_string());
9946 }
9947
9948 #[allow(clippy::single_element_loop)]
9949 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9950 url = params.uri_replacement(url, param_name, find_this, true);
9951 }
9952 {
9953 let to_remove = ["name"];
9954 params.remove_params(&to_remove);
9955 }
9956
9957 let url = params.parse_with_url(&url);
9958
9959 loop {
9960 let token = match self
9961 .hub
9962 .auth
9963 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9964 .await
9965 {
9966 Ok(token) => token,
9967 Err(e) => match dlg.token(e) {
9968 Ok(token) => token,
9969 Err(e) => {
9970 dlg.finished(false);
9971 return Err(common::Error::MissingToken(e));
9972 }
9973 },
9974 };
9975 let mut req_result = {
9976 let client = &self.hub.client;
9977 dlg.pre_request();
9978 let mut req_builder = hyper::Request::builder()
9979 .method(hyper::Method::DELETE)
9980 .uri(url.as_str())
9981 .header(USER_AGENT, self.hub._user_agent.clone());
9982
9983 if let Some(token) = token.as_ref() {
9984 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9985 }
9986
9987 let request = req_builder
9988 .header(CONTENT_LENGTH, 0_u64)
9989 .body(common::to_body::<String>(None));
9990
9991 client.request(request.unwrap()).await
9992 };
9993
9994 match req_result {
9995 Err(err) => {
9996 if let common::Retry::After(d) = dlg.http_error(&err) {
9997 sleep(d).await;
9998 continue;
9999 }
10000 dlg.finished(false);
10001 return Err(common::Error::HttpError(err));
10002 }
10003 Ok(res) => {
10004 let (mut parts, body) = res.into_parts();
10005 let mut body = common::Body::new(body);
10006 if !parts.status.is_success() {
10007 let bytes = common::to_bytes(body).await.unwrap_or_default();
10008 let error = serde_json::from_str(&common::to_string(&bytes));
10009 let response = common::to_response(parts, bytes.into());
10010
10011 if let common::Retry::After(d) =
10012 dlg.http_failure(&response, error.as_ref().ok())
10013 {
10014 sleep(d).await;
10015 continue;
10016 }
10017
10018 dlg.finished(false);
10019
10020 return Err(match error {
10021 Ok(value) => common::Error::BadRequest(value),
10022 _ => common::Error::Failure(response),
10023 });
10024 }
10025 let response = {
10026 let bytes = common::to_bytes(body).await.unwrap_or_default();
10027 let encoded = common::to_string(&bytes);
10028 match serde_json::from_str(&encoded) {
10029 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10030 Err(error) => {
10031 dlg.response_json_decode_error(&encoded, &error);
10032 return Err(common::Error::JsonDecodeError(
10033 encoded.to_string(),
10034 error,
10035 ));
10036 }
10037 }
10038 };
10039
10040 dlg.finished(true);
10041 return Ok(response);
10042 }
10043 }
10044 }
10045 }
10046
10047 /// 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
10048 ///
10049 /// Sets the *name* path property to the given value.
10050 ///
10051 /// Even though the property as already been set when instantiating this call,
10052 /// we provide this method for API completeness.
10053 pub fn name(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
10054 self._name = new_value.to_string();
10055 self
10056 }
10057 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background.
10058 ///
10059 /// Sets the *propagation policy* query property to the given value.
10060 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
10061 self._propagation_policy = Some(new_value.to_string());
10062 self
10063 }
10064 /// Cloud Run currently ignores this parameter.
10065 ///
10066 /// Sets the *kind* query property to the given value.
10067 pub fn kind(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
10068 self._kind = Some(new_value.to_string());
10069 self
10070 }
10071 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
10072 ///
10073 /// Sets the *dry run* query property to the given value.
10074 pub fn dry_run(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
10075 self._dry_run = Some(new_value.to_string());
10076 self
10077 }
10078 /// Cloud Run currently ignores this parameter.
10079 ///
10080 /// Sets the *api version* query property to the given value.
10081 pub fn api_version(mut self, new_value: &str) -> NamespaceRevisionDeleteCall<'a, C> {
10082 self._api_version = Some(new_value.to_string());
10083 self
10084 }
10085 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10086 /// while executing the actual API request.
10087 ///
10088 /// ````text
10089 /// It should be used to handle progress information, and to implement a certain level of resilience.
10090 /// ````
10091 ///
10092 /// Sets the *delegate* property to the given value.
10093 pub fn delegate(
10094 mut self,
10095 new_value: &'a mut dyn common::Delegate,
10096 ) -> NamespaceRevisionDeleteCall<'a, C> {
10097 self._delegate = Some(new_value);
10098 self
10099 }
10100
10101 /// Set any additional parameter of the query string used in the request.
10102 /// It should be used to set parameters which are not yet available through their own
10103 /// setters.
10104 ///
10105 /// Please note that this method must not be used to set any of the known parameters
10106 /// which have their own setter method. If done anyway, the request will fail.
10107 ///
10108 /// # Additional Parameters
10109 ///
10110 /// * *$.xgafv* (query-string) - V1 error format.
10111 /// * *access_token* (query-string) - OAuth access token.
10112 /// * *alt* (query-string) - Data format for response.
10113 /// * *callback* (query-string) - JSONP
10114 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10115 /// * *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.
10116 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10117 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10118 /// * *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.
10119 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10120 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10121 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionDeleteCall<'a, C>
10122 where
10123 T: AsRef<str>,
10124 {
10125 self._additional_params
10126 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10127 self
10128 }
10129
10130 /// Identifies the authorization scope for the method you are building.
10131 ///
10132 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10133 /// [`Scope::CloudPlatform`].
10134 ///
10135 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10136 /// tokens for more than one scope.
10137 ///
10138 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10139 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10140 /// sufficient, a read-write scope will do as well.
10141 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionDeleteCall<'a, C>
10142 where
10143 St: AsRef<str>,
10144 {
10145 self._scopes.insert(String::from(scope.as_ref()));
10146 self
10147 }
10148 /// Identifies the authorization scope(s) for the method you are building.
10149 ///
10150 /// See [`Self::add_scope()`] for details.
10151 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionDeleteCall<'a, C>
10152 where
10153 I: IntoIterator<Item = St>,
10154 St: AsRef<str>,
10155 {
10156 self._scopes
10157 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10158 self
10159 }
10160
10161 /// Removes all scopes, and no default scope will be used either.
10162 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10163 /// for details).
10164 pub fn clear_scopes(mut self) -> NamespaceRevisionDeleteCall<'a, C> {
10165 self._scopes.clear();
10166 self
10167 }
10168}
10169
10170/// Get information about a revision.
10171///
10172/// A builder for the *revisions.get* method supported by a *namespace* resource.
10173/// It is not used directly, but through a [`NamespaceMethods`] instance.
10174///
10175/// # Example
10176///
10177/// Instantiate a resource method builder
10178///
10179/// ```test_harness,no_run
10180/// # extern crate hyper;
10181/// # extern crate hyper_rustls;
10182/// # extern crate google_run1 as run1;
10183/// # async fn dox() {
10184/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10185///
10186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10188/// # .with_native_roots()
10189/// # .unwrap()
10190/// # .https_only()
10191/// # .enable_http2()
10192/// # .build();
10193///
10194/// # let executor = hyper_util::rt::TokioExecutor::new();
10195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10196/// # secret,
10197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10200/// # ),
10201/// # ).build().await.unwrap();
10202///
10203/// # let client = hyper_util::client::legacy::Client::builder(
10204/// # hyper_util::rt::TokioExecutor::new()
10205/// # )
10206/// # .build(
10207/// # hyper_rustls::HttpsConnectorBuilder::new()
10208/// # .with_native_roots()
10209/// # .unwrap()
10210/// # .https_or_http()
10211/// # .enable_http2()
10212/// # .build()
10213/// # );
10214/// # let mut hub = CloudRun::new(client, auth);
10215/// // You can configure optional parameters by calling the respective setters at will, and
10216/// // execute the final call using `doit()`.
10217/// // Values shown here are possibly random and not representative !
10218/// let result = hub.namespaces().revisions_get("name")
10219/// .doit().await;
10220/// # }
10221/// ```
10222pub struct NamespaceRevisionGetCall<'a, C>
10223where
10224 C: 'a,
10225{
10226 hub: &'a CloudRun<C>,
10227 _name: String,
10228 _delegate: Option<&'a mut dyn common::Delegate>,
10229 _additional_params: HashMap<String, String>,
10230 _scopes: BTreeSet<String>,
10231}
10232
10233impl<'a, C> common::CallBuilder for NamespaceRevisionGetCall<'a, C> {}
10234
10235impl<'a, C> NamespaceRevisionGetCall<'a, C>
10236where
10237 C: common::Connector,
10238{
10239 /// Perform the operation you have build so far.
10240 pub async fn doit(mut self) -> common::Result<(common::Response, Revision)> {
10241 use std::borrow::Cow;
10242 use std::io::{Read, Seek};
10243
10244 use common::{url::Params, ToParts};
10245 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10246
10247 let mut dd = common::DefaultDelegate;
10248 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10249 dlg.begin(common::MethodInfo {
10250 id: "run.namespaces.revisions.get",
10251 http_method: hyper::Method::GET,
10252 });
10253
10254 for &field in ["alt", "name"].iter() {
10255 if self._additional_params.contains_key(field) {
10256 dlg.finished(false);
10257 return Err(common::Error::FieldClash(field));
10258 }
10259 }
10260
10261 let mut params = Params::with_capacity(3 + self._additional_params.len());
10262 params.push("name", self._name);
10263
10264 params.extend(self._additional_params.iter());
10265
10266 params.push("alt", "json");
10267 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
10268 if self._scopes.is_empty() {
10269 self._scopes
10270 .insert(Scope::CloudPlatform.as_ref().to_string());
10271 }
10272
10273 #[allow(clippy::single_element_loop)]
10274 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10275 url = params.uri_replacement(url, param_name, find_this, true);
10276 }
10277 {
10278 let to_remove = ["name"];
10279 params.remove_params(&to_remove);
10280 }
10281
10282 let url = params.parse_with_url(&url);
10283
10284 loop {
10285 let token = match self
10286 .hub
10287 .auth
10288 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10289 .await
10290 {
10291 Ok(token) => token,
10292 Err(e) => match dlg.token(e) {
10293 Ok(token) => token,
10294 Err(e) => {
10295 dlg.finished(false);
10296 return Err(common::Error::MissingToken(e));
10297 }
10298 },
10299 };
10300 let mut req_result = {
10301 let client = &self.hub.client;
10302 dlg.pre_request();
10303 let mut req_builder = hyper::Request::builder()
10304 .method(hyper::Method::GET)
10305 .uri(url.as_str())
10306 .header(USER_AGENT, self.hub._user_agent.clone());
10307
10308 if let Some(token) = token.as_ref() {
10309 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10310 }
10311
10312 let request = req_builder
10313 .header(CONTENT_LENGTH, 0_u64)
10314 .body(common::to_body::<String>(None));
10315
10316 client.request(request.unwrap()).await
10317 };
10318
10319 match req_result {
10320 Err(err) => {
10321 if let common::Retry::After(d) = dlg.http_error(&err) {
10322 sleep(d).await;
10323 continue;
10324 }
10325 dlg.finished(false);
10326 return Err(common::Error::HttpError(err));
10327 }
10328 Ok(res) => {
10329 let (mut parts, body) = res.into_parts();
10330 let mut body = common::Body::new(body);
10331 if !parts.status.is_success() {
10332 let bytes = common::to_bytes(body).await.unwrap_or_default();
10333 let error = serde_json::from_str(&common::to_string(&bytes));
10334 let response = common::to_response(parts, bytes.into());
10335
10336 if let common::Retry::After(d) =
10337 dlg.http_failure(&response, error.as_ref().ok())
10338 {
10339 sleep(d).await;
10340 continue;
10341 }
10342
10343 dlg.finished(false);
10344
10345 return Err(match error {
10346 Ok(value) => common::Error::BadRequest(value),
10347 _ => common::Error::Failure(response),
10348 });
10349 }
10350 let response = {
10351 let bytes = common::to_bytes(body).await.unwrap_or_default();
10352 let encoded = common::to_string(&bytes);
10353 match serde_json::from_str(&encoded) {
10354 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10355 Err(error) => {
10356 dlg.response_json_decode_error(&encoded, &error);
10357 return Err(common::Error::JsonDecodeError(
10358 encoded.to_string(),
10359 error,
10360 ));
10361 }
10362 }
10363 };
10364
10365 dlg.finished(true);
10366 return Ok(response);
10367 }
10368 }
10369 }
10370 }
10371
10372 /// 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
10373 ///
10374 /// Sets the *name* path property to the given value.
10375 ///
10376 /// Even though the property as already been set when instantiating this call,
10377 /// we provide this method for API completeness.
10378 pub fn name(mut self, new_value: &str) -> NamespaceRevisionGetCall<'a, C> {
10379 self._name = new_value.to_string();
10380 self
10381 }
10382 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10383 /// while executing the actual API request.
10384 ///
10385 /// ````text
10386 /// It should be used to handle progress information, and to implement a certain level of resilience.
10387 /// ````
10388 ///
10389 /// Sets the *delegate* property to the given value.
10390 pub fn delegate(
10391 mut self,
10392 new_value: &'a mut dyn common::Delegate,
10393 ) -> NamespaceRevisionGetCall<'a, C> {
10394 self._delegate = Some(new_value);
10395 self
10396 }
10397
10398 /// Set any additional parameter of the query string used in the request.
10399 /// It should be used to set parameters which are not yet available through their own
10400 /// setters.
10401 ///
10402 /// Please note that this method must not be used to set any of the known parameters
10403 /// which have their own setter method. If done anyway, the request will fail.
10404 ///
10405 /// # Additional Parameters
10406 ///
10407 /// * *$.xgafv* (query-string) - V1 error format.
10408 /// * *access_token* (query-string) - OAuth access token.
10409 /// * *alt* (query-string) - Data format for response.
10410 /// * *callback* (query-string) - JSONP
10411 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10412 /// * *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.
10413 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10414 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10415 /// * *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.
10416 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10417 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10418 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionGetCall<'a, C>
10419 where
10420 T: AsRef<str>,
10421 {
10422 self._additional_params
10423 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10424 self
10425 }
10426
10427 /// Identifies the authorization scope for the method you are building.
10428 ///
10429 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10430 /// [`Scope::CloudPlatform`].
10431 ///
10432 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10433 /// tokens for more than one scope.
10434 ///
10435 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10436 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10437 /// sufficient, a read-write scope will do as well.
10438 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionGetCall<'a, C>
10439 where
10440 St: AsRef<str>,
10441 {
10442 self._scopes.insert(String::from(scope.as_ref()));
10443 self
10444 }
10445 /// Identifies the authorization scope(s) for the method you are building.
10446 ///
10447 /// See [`Self::add_scope()`] for details.
10448 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionGetCall<'a, C>
10449 where
10450 I: IntoIterator<Item = St>,
10451 St: AsRef<str>,
10452 {
10453 self._scopes
10454 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10455 self
10456 }
10457
10458 /// Removes all scopes, and no default scope will be used either.
10459 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10460 /// for details).
10461 pub fn clear_scopes(mut self) -> NamespaceRevisionGetCall<'a, C> {
10462 self._scopes.clear();
10463 self
10464 }
10465}
10466
10467/// List revisions. Results are sorted by creation time, descending.
10468///
10469/// A builder for the *revisions.list* method supported by a *namespace* resource.
10470/// It is not used directly, but through a [`NamespaceMethods`] instance.
10471///
10472/// # Example
10473///
10474/// Instantiate a resource method builder
10475///
10476/// ```test_harness,no_run
10477/// # extern crate hyper;
10478/// # extern crate hyper_rustls;
10479/// # extern crate google_run1 as run1;
10480/// # async fn dox() {
10481/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10482///
10483/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10484/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10485/// # .with_native_roots()
10486/// # .unwrap()
10487/// # .https_only()
10488/// # .enable_http2()
10489/// # .build();
10490///
10491/// # let executor = hyper_util::rt::TokioExecutor::new();
10492/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10493/// # secret,
10494/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10495/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10496/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10497/// # ),
10498/// # ).build().await.unwrap();
10499///
10500/// # let client = hyper_util::client::legacy::Client::builder(
10501/// # hyper_util::rt::TokioExecutor::new()
10502/// # )
10503/// # .build(
10504/// # hyper_rustls::HttpsConnectorBuilder::new()
10505/// # .with_native_roots()
10506/// # .unwrap()
10507/// # .https_or_http()
10508/// # .enable_http2()
10509/// # .build()
10510/// # );
10511/// # let mut hub = CloudRun::new(client, auth);
10512/// // You can configure optional parameters by calling the respective setters at will, and
10513/// // execute the final call using `doit()`.
10514/// // Values shown here are possibly random and not representative !
10515/// let result = hub.namespaces().revisions_list("parent")
10516/// .watch(false)
10517/// .resource_version("dolore")
10518/// .limit(-34)
10519/// .label_selector("dolore")
10520/// .include_uninitialized(false)
10521/// .field_selector("amet.")
10522/// .continue_("ea")
10523/// .doit().await;
10524/// # }
10525/// ```
10526pub struct NamespaceRevisionListCall<'a, C>
10527where
10528 C: 'a,
10529{
10530 hub: &'a CloudRun<C>,
10531 _parent: String,
10532 _watch: Option<bool>,
10533 _resource_version: Option<String>,
10534 _limit: Option<i32>,
10535 _label_selector: Option<String>,
10536 _include_uninitialized: Option<bool>,
10537 _field_selector: Option<String>,
10538 _continue_: Option<String>,
10539 _delegate: Option<&'a mut dyn common::Delegate>,
10540 _additional_params: HashMap<String, String>,
10541 _scopes: BTreeSet<String>,
10542}
10543
10544impl<'a, C> common::CallBuilder for NamespaceRevisionListCall<'a, C> {}
10545
10546impl<'a, C> NamespaceRevisionListCall<'a, C>
10547where
10548 C: common::Connector,
10549{
10550 /// Perform the operation you have build so far.
10551 pub async fn doit(mut self) -> common::Result<(common::Response, ListRevisionsResponse)> {
10552 use std::borrow::Cow;
10553 use std::io::{Read, Seek};
10554
10555 use common::{url::Params, ToParts};
10556 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10557
10558 let mut dd = common::DefaultDelegate;
10559 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10560 dlg.begin(common::MethodInfo {
10561 id: "run.namespaces.revisions.list",
10562 http_method: hyper::Method::GET,
10563 });
10564
10565 for &field in [
10566 "alt",
10567 "parent",
10568 "watch",
10569 "resourceVersion",
10570 "limit",
10571 "labelSelector",
10572 "includeUninitialized",
10573 "fieldSelector",
10574 "continue",
10575 ]
10576 .iter()
10577 {
10578 if self._additional_params.contains_key(field) {
10579 dlg.finished(false);
10580 return Err(common::Error::FieldClash(field));
10581 }
10582 }
10583
10584 let mut params = Params::with_capacity(10 + self._additional_params.len());
10585 params.push("parent", self._parent);
10586 if let Some(value) = self._watch.as_ref() {
10587 params.push("watch", value.to_string());
10588 }
10589 if let Some(value) = self._resource_version.as_ref() {
10590 params.push("resourceVersion", value);
10591 }
10592 if let Some(value) = self._limit.as_ref() {
10593 params.push("limit", value.to_string());
10594 }
10595 if let Some(value) = self._label_selector.as_ref() {
10596 params.push("labelSelector", value);
10597 }
10598 if let Some(value) = self._include_uninitialized.as_ref() {
10599 params.push("includeUninitialized", value.to_string());
10600 }
10601 if let Some(value) = self._field_selector.as_ref() {
10602 params.push("fieldSelector", value);
10603 }
10604 if let Some(value) = self._continue_.as_ref() {
10605 params.push("continue", value);
10606 }
10607
10608 params.extend(self._additional_params.iter());
10609
10610 params.push("alt", "json");
10611 let mut url =
10612 self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/revisions";
10613 if self._scopes.is_empty() {
10614 self._scopes
10615 .insert(Scope::CloudPlatform.as_ref().to_string());
10616 }
10617
10618 #[allow(clippy::single_element_loop)]
10619 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10620 url = params.uri_replacement(url, param_name, find_this, true);
10621 }
10622 {
10623 let to_remove = ["parent"];
10624 params.remove_params(&to_remove);
10625 }
10626
10627 let url = params.parse_with_url(&url);
10628
10629 loop {
10630 let token = match self
10631 .hub
10632 .auth
10633 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10634 .await
10635 {
10636 Ok(token) => token,
10637 Err(e) => match dlg.token(e) {
10638 Ok(token) => token,
10639 Err(e) => {
10640 dlg.finished(false);
10641 return Err(common::Error::MissingToken(e));
10642 }
10643 },
10644 };
10645 let mut req_result = {
10646 let client = &self.hub.client;
10647 dlg.pre_request();
10648 let mut req_builder = hyper::Request::builder()
10649 .method(hyper::Method::GET)
10650 .uri(url.as_str())
10651 .header(USER_AGENT, self.hub._user_agent.clone());
10652
10653 if let Some(token) = token.as_ref() {
10654 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10655 }
10656
10657 let request = req_builder
10658 .header(CONTENT_LENGTH, 0_u64)
10659 .body(common::to_body::<String>(None));
10660
10661 client.request(request.unwrap()).await
10662 };
10663
10664 match req_result {
10665 Err(err) => {
10666 if let common::Retry::After(d) = dlg.http_error(&err) {
10667 sleep(d).await;
10668 continue;
10669 }
10670 dlg.finished(false);
10671 return Err(common::Error::HttpError(err));
10672 }
10673 Ok(res) => {
10674 let (mut parts, body) = res.into_parts();
10675 let mut body = common::Body::new(body);
10676 if !parts.status.is_success() {
10677 let bytes = common::to_bytes(body).await.unwrap_or_default();
10678 let error = serde_json::from_str(&common::to_string(&bytes));
10679 let response = common::to_response(parts, bytes.into());
10680
10681 if let common::Retry::After(d) =
10682 dlg.http_failure(&response, error.as_ref().ok())
10683 {
10684 sleep(d).await;
10685 continue;
10686 }
10687
10688 dlg.finished(false);
10689
10690 return Err(match error {
10691 Ok(value) => common::Error::BadRequest(value),
10692 _ => common::Error::Failure(response),
10693 });
10694 }
10695 let response = {
10696 let bytes = common::to_bytes(body).await.unwrap_or_default();
10697 let encoded = common::to_string(&bytes);
10698 match serde_json::from_str(&encoded) {
10699 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10700 Err(error) => {
10701 dlg.response_json_decode_error(&encoded, &error);
10702 return Err(common::Error::JsonDecodeError(
10703 encoded.to_string(),
10704 error,
10705 ));
10706 }
10707 }
10708 };
10709
10710 dlg.finished(true);
10711 return Ok(response);
10712 }
10713 }
10714 }
10715 }
10716
10717 /// 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
10718 ///
10719 /// Sets the *parent* path property to the given value.
10720 ///
10721 /// Even though the property as already been set when instantiating this call,
10722 /// we provide this method for API completeness.
10723 pub fn parent(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10724 self._parent = new_value.to_string();
10725 self
10726 }
10727 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
10728 ///
10729 /// Sets the *watch* query property to the given value.
10730 pub fn watch(mut self, new_value: bool) -> NamespaceRevisionListCall<'a, C> {
10731 self._watch = Some(new_value);
10732 self
10733 }
10734 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
10735 ///
10736 /// Sets the *resource version* query property to the given value.
10737 pub fn resource_version(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10738 self._resource_version = Some(new_value.to_string());
10739 self
10740 }
10741 /// Optional. The maximum number of records that should be returned.
10742 ///
10743 /// Sets the *limit* query property to the given value.
10744 pub fn limit(mut self, new_value: i32) -> NamespaceRevisionListCall<'a, C> {
10745 self._limit = Some(new_value);
10746 self
10747 }
10748 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
10749 ///
10750 /// Sets the *label selector* query property to the given value.
10751 pub fn label_selector(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10752 self._label_selector = Some(new_value.to_string());
10753 self
10754 }
10755 /// Not currently used by Cloud Run.
10756 ///
10757 /// Sets the *include uninitialized* query property to the given value.
10758 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceRevisionListCall<'a, C> {
10759 self._include_uninitialized = Some(new_value);
10760 self
10761 }
10762 /// 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.
10763 ///
10764 /// Sets the *field selector* query property to the given value.
10765 pub fn field_selector(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10766 self._field_selector = Some(new_value.to_string());
10767 self
10768 }
10769 /// Optional. Encoded string to continue paging.
10770 ///
10771 /// Sets the *continue* query property to the given value.
10772 pub fn continue_(mut self, new_value: &str) -> NamespaceRevisionListCall<'a, C> {
10773 self._continue_ = Some(new_value.to_string());
10774 self
10775 }
10776 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10777 /// while executing the actual API request.
10778 ///
10779 /// ````text
10780 /// It should be used to handle progress information, and to implement a certain level of resilience.
10781 /// ````
10782 ///
10783 /// Sets the *delegate* property to the given value.
10784 pub fn delegate(
10785 mut self,
10786 new_value: &'a mut dyn common::Delegate,
10787 ) -> NamespaceRevisionListCall<'a, C> {
10788 self._delegate = Some(new_value);
10789 self
10790 }
10791
10792 /// Set any additional parameter of the query string used in the request.
10793 /// It should be used to set parameters which are not yet available through their own
10794 /// setters.
10795 ///
10796 /// Please note that this method must not be used to set any of the known parameters
10797 /// which have their own setter method. If done anyway, the request will fail.
10798 ///
10799 /// # Additional Parameters
10800 ///
10801 /// * *$.xgafv* (query-string) - V1 error format.
10802 /// * *access_token* (query-string) - OAuth access token.
10803 /// * *alt* (query-string) - Data format for response.
10804 /// * *callback* (query-string) - JSONP
10805 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10806 /// * *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.
10807 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10808 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10809 /// * *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.
10810 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10811 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10812 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRevisionListCall<'a, C>
10813 where
10814 T: AsRef<str>,
10815 {
10816 self._additional_params
10817 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10818 self
10819 }
10820
10821 /// Identifies the authorization scope for the method you are building.
10822 ///
10823 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10824 /// [`Scope::CloudPlatform`].
10825 ///
10826 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10827 /// tokens for more than one scope.
10828 ///
10829 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10830 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10831 /// sufficient, a read-write scope will do as well.
10832 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRevisionListCall<'a, C>
10833 where
10834 St: AsRef<str>,
10835 {
10836 self._scopes.insert(String::from(scope.as_ref()));
10837 self
10838 }
10839 /// Identifies the authorization scope(s) for the method you are building.
10840 ///
10841 /// See [`Self::add_scope()`] for details.
10842 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRevisionListCall<'a, C>
10843 where
10844 I: IntoIterator<Item = St>,
10845 St: AsRef<str>,
10846 {
10847 self._scopes
10848 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10849 self
10850 }
10851
10852 /// Removes all scopes, and no default scope will be used either.
10853 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10854 /// for details).
10855 pub fn clear_scopes(mut self) -> NamespaceRevisionListCall<'a, C> {
10856 self._scopes.clear();
10857 self
10858 }
10859}
10860
10861/// Get information about a route.
10862///
10863/// A builder for the *routes.get* method supported by a *namespace* resource.
10864/// It is not used directly, but through a [`NamespaceMethods`] instance.
10865///
10866/// # Example
10867///
10868/// Instantiate a resource method builder
10869///
10870/// ```test_harness,no_run
10871/// # extern crate hyper;
10872/// # extern crate hyper_rustls;
10873/// # extern crate google_run1 as run1;
10874/// # async fn dox() {
10875/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10876///
10877/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10878/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10879/// # .with_native_roots()
10880/// # .unwrap()
10881/// # .https_only()
10882/// # .enable_http2()
10883/// # .build();
10884///
10885/// # let executor = hyper_util::rt::TokioExecutor::new();
10886/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10887/// # secret,
10888/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10889/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10890/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10891/// # ),
10892/// # ).build().await.unwrap();
10893///
10894/// # let client = hyper_util::client::legacy::Client::builder(
10895/// # hyper_util::rt::TokioExecutor::new()
10896/// # )
10897/// # .build(
10898/// # hyper_rustls::HttpsConnectorBuilder::new()
10899/// # .with_native_roots()
10900/// # .unwrap()
10901/// # .https_or_http()
10902/// # .enable_http2()
10903/// # .build()
10904/// # );
10905/// # let mut hub = CloudRun::new(client, auth);
10906/// // You can configure optional parameters by calling the respective setters at will, and
10907/// // execute the final call using `doit()`.
10908/// // Values shown here are possibly random and not representative !
10909/// let result = hub.namespaces().routes_get("name")
10910/// .doit().await;
10911/// # }
10912/// ```
10913pub struct NamespaceRouteGetCall<'a, C>
10914where
10915 C: 'a,
10916{
10917 hub: &'a CloudRun<C>,
10918 _name: String,
10919 _delegate: Option<&'a mut dyn common::Delegate>,
10920 _additional_params: HashMap<String, String>,
10921 _scopes: BTreeSet<String>,
10922}
10923
10924impl<'a, C> common::CallBuilder for NamespaceRouteGetCall<'a, C> {}
10925
10926impl<'a, C> NamespaceRouteGetCall<'a, C>
10927where
10928 C: common::Connector,
10929{
10930 /// Perform the operation you have build so far.
10931 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
10932 use std::borrow::Cow;
10933 use std::io::{Read, Seek};
10934
10935 use common::{url::Params, ToParts};
10936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10937
10938 let mut dd = common::DefaultDelegate;
10939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10940 dlg.begin(common::MethodInfo {
10941 id: "run.namespaces.routes.get",
10942 http_method: hyper::Method::GET,
10943 });
10944
10945 for &field in ["alt", "name"].iter() {
10946 if self._additional_params.contains_key(field) {
10947 dlg.finished(false);
10948 return Err(common::Error::FieldClash(field));
10949 }
10950 }
10951
10952 let mut params = Params::with_capacity(3 + self._additional_params.len());
10953 params.push("name", self._name);
10954
10955 params.extend(self._additional_params.iter());
10956
10957 params.push("alt", "json");
10958 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
10959 if self._scopes.is_empty() {
10960 self._scopes
10961 .insert(Scope::CloudPlatform.as_ref().to_string());
10962 }
10963
10964 #[allow(clippy::single_element_loop)]
10965 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10966 url = params.uri_replacement(url, param_name, find_this, true);
10967 }
10968 {
10969 let to_remove = ["name"];
10970 params.remove_params(&to_remove);
10971 }
10972
10973 let url = params.parse_with_url(&url);
10974
10975 loop {
10976 let token = match self
10977 .hub
10978 .auth
10979 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10980 .await
10981 {
10982 Ok(token) => token,
10983 Err(e) => match dlg.token(e) {
10984 Ok(token) => token,
10985 Err(e) => {
10986 dlg.finished(false);
10987 return Err(common::Error::MissingToken(e));
10988 }
10989 },
10990 };
10991 let mut req_result = {
10992 let client = &self.hub.client;
10993 dlg.pre_request();
10994 let mut req_builder = hyper::Request::builder()
10995 .method(hyper::Method::GET)
10996 .uri(url.as_str())
10997 .header(USER_AGENT, self.hub._user_agent.clone());
10998
10999 if let Some(token) = token.as_ref() {
11000 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11001 }
11002
11003 let request = req_builder
11004 .header(CONTENT_LENGTH, 0_u64)
11005 .body(common::to_body::<String>(None));
11006
11007 client.request(request.unwrap()).await
11008 };
11009
11010 match req_result {
11011 Err(err) => {
11012 if let common::Retry::After(d) = dlg.http_error(&err) {
11013 sleep(d).await;
11014 continue;
11015 }
11016 dlg.finished(false);
11017 return Err(common::Error::HttpError(err));
11018 }
11019 Ok(res) => {
11020 let (mut parts, body) = res.into_parts();
11021 let mut body = common::Body::new(body);
11022 if !parts.status.is_success() {
11023 let bytes = common::to_bytes(body).await.unwrap_or_default();
11024 let error = serde_json::from_str(&common::to_string(&bytes));
11025 let response = common::to_response(parts, bytes.into());
11026
11027 if let common::Retry::After(d) =
11028 dlg.http_failure(&response, error.as_ref().ok())
11029 {
11030 sleep(d).await;
11031 continue;
11032 }
11033
11034 dlg.finished(false);
11035
11036 return Err(match error {
11037 Ok(value) => common::Error::BadRequest(value),
11038 _ => common::Error::Failure(response),
11039 });
11040 }
11041 let response = {
11042 let bytes = common::to_bytes(body).await.unwrap_or_default();
11043 let encoded = common::to_string(&bytes);
11044 match serde_json::from_str(&encoded) {
11045 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11046 Err(error) => {
11047 dlg.response_json_decode_error(&encoded, &error);
11048 return Err(common::Error::JsonDecodeError(
11049 encoded.to_string(),
11050 error,
11051 ));
11052 }
11053 }
11054 };
11055
11056 dlg.finished(true);
11057 return Ok(response);
11058 }
11059 }
11060 }
11061 }
11062
11063 /// 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
11064 ///
11065 /// Sets the *name* path property to the given value.
11066 ///
11067 /// Even though the property as already been set when instantiating this call,
11068 /// we provide this method for API completeness.
11069 pub fn name(mut self, new_value: &str) -> NamespaceRouteGetCall<'a, C> {
11070 self._name = new_value.to_string();
11071 self
11072 }
11073 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11074 /// while executing the actual API request.
11075 ///
11076 /// ````text
11077 /// It should be used to handle progress information, and to implement a certain level of resilience.
11078 /// ````
11079 ///
11080 /// Sets the *delegate* property to the given value.
11081 pub fn delegate(
11082 mut self,
11083 new_value: &'a mut dyn common::Delegate,
11084 ) -> NamespaceRouteGetCall<'a, C> {
11085 self._delegate = Some(new_value);
11086 self
11087 }
11088
11089 /// Set any additional parameter of the query string used in the request.
11090 /// It should be used to set parameters which are not yet available through their own
11091 /// setters.
11092 ///
11093 /// Please note that this method must not be used to set any of the known parameters
11094 /// which have their own setter method. If done anyway, the request will fail.
11095 ///
11096 /// # Additional Parameters
11097 ///
11098 /// * *$.xgafv* (query-string) - V1 error format.
11099 /// * *access_token* (query-string) - OAuth access token.
11100 /// * *alt* (query-string) - Data format for response.
11101 /// * *callback* (query-string) - JSONP
11102 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11103 /// * *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.
11104 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11105 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11106 /// * *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.
11107 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11108 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11109 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRouteGetCall<'a, C>
11110 where
11111 T: AsRef<str>,
11112 {
11113 self._additional_params
11114 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11115 self
11116 }
11117
11118 /// Identifies the authorization scope for the method you are building.
11119 ///
11120 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11121 /// [`Scope::CloudPlatform`].
11122 ///
11123 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11124 /// tokens for more than one scope.
11125 ///
11126 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11127 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11128 /// sufficient, a read-write scope will do as well.
11129 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRouteGetCall<'a, C>
11130 where
11131 St: AsRef<str>,
11132 {
11133 self._scopes.insert(String::from(scope.as_ref()));
11134 self
11135 }
11136 /// Identifies the authorization scope(s) for the method you are building.
11137 ///
11138 /// See [`Self::add_scope()`] for details.
11139 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRouteGetCall<'a, C>
11140 where
11141 I: IntoIterator<Item = St>,
11142 St: AsRef<str>,
11143 {
11144 self._scopes
11145 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11146 self
11147 }
11148
11149 /// Removes all scopes, and no default scope will be used either.
11150 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11151 /// for details).
11152 pub fn clear_scopes(mut self) -> NamespaceRouteGetCall<'a, C> {
11153 self._scopes.clear();
11154 self
11155 }
11156}
11157
11158/// List routes. Results are sorted by creation time, descending.
11159///
11160/// A builder for the *routes.list* method supported by a *namespace* resource.
11161/// It is not used directly, but through a [`NamespaceMethods`] instance.
11162///
11163/// # Example
11164///
11165/// Instantiate a resource method builder
11166///
11167/// ```test_harness,no_run
11168/// # extern crate hyper;
11169/// # extern crate hyper_rustls;
11170/// # extern crate google_run1 as run1;
11171/// # async fn dox() {
11172/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11173///
11174/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11175/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11176/// # .with_native_roots()
11177/// # .unwrap()
11178/// # .https_only()
11179/// # .enable_http2()
11180/// # .build();
11181///
11182/// # let executor = hyper_util::rt::TokioExecutor::new();
11183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11184/// # secret,
11185/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11186/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11187/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11188/// # ),
11189/// # ).build().await.unwrap();
11190///
11191/// # let client = hyper_util::client::legacy::Client::builder(
11192/// # hyper_util::rt::TokioExecutor::new()
11193/// # )
11194/// # .build(
11195/// # hyper_rustls::HttpsConnectorBuilder::new()
11196/// # .with_native_roots()
11197/// # .unwrap()
11198/// # .https_or_http()
11199/// # .enable_http2()
11200/// # .build()
11201/// # );
11202/// # let mut hub = CloudRun::new(client, auth);
11203/// // You can configure optional parameters by calling the respective setters at will, and
11204/// // execute the final call using `doit()`.
11205/// // Values shown here are possibly random and not representative !
11206/// let result = hub.namespaces().routes_list("parent")
11207/// .watch(true)
11208/// .resource_version("no")
11209/// .limit(-7)
11210/// .label_selector("At")
11211/// .include_uninitialized(true)
11212/// .field_selector("sit")
11213/// .continue_("et")
11214/// .doit().await;
11215/// # }
11216/// ```
11217pub struct NamespaceRouteListCall<'a, C>
11218where
11219 C: 'a,
11220{
11221 hub: &'a CloudRun<C>,
11222 _parent: String,
11223 _watch: Option<bool>,
11224 _resource_version: Option<String>,
11225 _limit: Option<i32>,
11226 _label_selector: Option<String>,
11227 _include_uninitialized: Option<bool>,
11228 _field_selector: Option<String>,
11229 _continue_: Option<String>,
11230 _delegate: Option<&'a mut dyn common::Delegate>,
11231 _additional_params: HashMap<String, String>,
11232 _scopes: BTreeSet<String>,
11233}
11234
11235impl<'a, C> common::CallBuilder for NamespaceRouteListCall<'a, C> {}
11236
11237impl<'a, C> NamespaceRouteListCall<'a, C>
11238where
11239 C: common::Connector,
11240{
11241 /// Perform the operation you have build so far.
11242 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
11243 use std::borrow::Cow;
11244 use std::io::{Read, Seek};
11245
11246 use common::{url::Params, ToParts};
11247 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11248
11249 let mut dd = common::DefaultDelegate;
11250 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11251 dlg.begin(common::MethodInfo {
11252 id: "run.namespaces.routes.list",
11253 http_method: hyper::Method::GET,
11254 });
11255
11256 for &field in [
11257 "alt",
11258 "parent",
11259 "watch",
11260 "resourceVersion",
11261 "limit",
11262 "labelSelector",
11263 "includeUninitialized",
11264 "fieldSelector",
11265 "continue",
11266 ]
11267 .iter()
11268 {
11269 if self._additional_params.contains_key(field) {
11270 dlg.finished(false);
11271 return Err(common::Error::FieldClash(field));
11272 }
11273 }
11274
11275 let mut params = Params::with_capacity(10 + self._additional_params.len());
11276 params.push("parent", self._parent);
11277 if let Some(value) = self._watch.as_ref() {
11278 params.push("watch", value.to_string());
11279 }
11280 if let Some(value) = self._resource_version.as_ref() {
11281 params.push("resourceVersion", value);
11282 }
11283 if let Some(value) = self._limit.as_ref() {
11284 params.push("limit", value.to_string());
11285 }
11286 if let Some(value) = self._label_selector.as_ref() {
11287 params.push("labelSelector", value);
11288 }
11289 if let Some(value) = self._include_uninitialized.as_ref() {
11290 params.push("includeUninitialized", value.to_string());
11291 }
11292 if let Some(value) = self._field_selector.as_ref() {
11293 params.push("fieldSelector", value);
11294 }
11295 if let Some(value) = self._continue_.as_ref() {
11296 params.push("continue", value);
11297 }
11298
11299 params.extend(self._additional_params.iter());
11300
11301 params.push("alt", "json");
11302 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/routes";
11303 if self._scopes.is_empty() {
11304 self._scopes
11305 .insert(Scope::CloudPlatform.as_ref().to_string());
11306 }
11307
11308 #[allow(clippy::single_element_loop)]
11309 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11310 url = params.uri_replacement(url, param_name, find_this, true);
11311 }
11312 {
11313 let to_remove = ["parent"];
11314 params.remove_params(&to_remove);
11315 }
11316
11317 let url = params.parse_with_url(&url);
11318
11319 loop {
11320 let token = match self
11321 .hub
11322 .auth
11323 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11324 .await
11325 {
11326 Ok(token) => token,
11327 Err(e) => match dlg.token(e) {
11328 Ok(token) => token,
11329 Err(e) => {
11330 dlg.finished(false);
11331 return Err(common::Error::MissingToken(e));
11332 }
11333 },
11334 };
11335 let mut req_result = {
11336 let client = &self.hub.client;
11337 dlg.pre_request();
11338 let mut req_builder = hyper::Request::builder()
11339 .method(hyper::Method::GET)
11340 .uri(url.as_str())
11341 .header(USER_AGENT, self.hub._user_agent.clone());
11342
11343 if let Some(token) = token.as_ref() {
11344 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11345 }
11346
11347 let request = req_builder
11348 .header(CONTENT_LENGTH, 0_u64)
11349 .body(common::to_body::<String>(None));
11350
11351 client.request(request.unwrap()).await
11352 };
11353
11354 match req_result {
11355 Err(err) => {
11356 if let common::Retry::After(d) = dlg.http_error(&err) {
11357 sleep(d).await;
11358 continue;
11359 }
11360 dlg.finished(false);
11361 return Err(common::Error::HttpError(err));
11362 }
11363 Ok(res) => {
11364 let (mut parts, body) = res.into_parts();
11365 let mut body = common::Body::new(body);
11366 if !parts.status.is_success() {
11367 let bytes = common::to_bytes(body).await.unwrap_or_default();
11368 let error = serde_json::from_str(&common::to_string(&bytes));
11369 let response = common::to_response(parts, bytes.into());
11370
11371 if let common::Retry::After(d) =
11372 dlg.http_failure(&response, error.as_ref().ok())
11373 {
11374 sleep(d).await;
11375 continue;
11376 }
11377
11378 dlg.finished(false);
11379
11380 return Err(match error {
11381 Ok(value) => common::Error::BadRequest(value),
11382 _ => common::Error::Failure(response),
11383 });
11384 }
11385 let response = {
11386 let bytes = common::to_bytes(body).await.unwrap_or_default();
11387 let encoded = common::to_string(&bytes);
11388 match serde_json::from_str(&encoded) {
11389 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11390 Err(error) => {
11391 dlg.response_json_decode_error(&encoded, &error);
11392 return Err(common::Error::JsonDecodeError(
11393 encoded.to_string(),
11394 error,
11395 ));
11396 }
11397 }
11398 };
11399
11400 dlg.finished(true);
11401 return Ok(response);
11402 }
11403 }
11404 }
11405 }
11406
11407 /// 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
11408 ///
11409 /// Sets the *parent* path property to the given value.
11410 ///
11411 /// Even though the property as already been set when instantiating this call,
11412 /// we provide this method for API completeness.
11413 pub fn parent(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
11414 self._parent = new_value.to_string();
11415 self
11416 }
11417 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
11418 ///
11419 /// Sets the *watch* query property to the given value.
11420 pub fn watch(mut self, new_value: bool) -> NamespaceRouteListCall<'a, C> {
11421 self._watch = Some(new_value);
11422 self
11423 }
11424 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
11425 ///
11426 /// Sets the *resource version* query property to the given value.
11427 pub fn resource_version(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
11428 self._resource_version = Some(new_value.to_string());
11429 self
11430 }
11431 /// Optional. The maximum number of records that should be returned.
11432 ///
11433 /// Sets the *limit* query property to the given value.
11434 pub fn limit(mut self, new_value: i32) -> NamespaceRouteListCall<'a, C> {
11435 self._limit = Some(new_value);
11436 self
11437 }
11438 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
11439 ///
11440 /// Sets the *label selector* query property to the given value.
11441 pub fn label_selector(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
11442 self._label_selector = Some(new_value.to_string());
11443 self
11444 }
11445 /// Not currently used by Cloud Run.
11446 ///
11447 /// Sets the *include uninitialized* query property to the given value.
11448 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceRouteListCall<'a, C> {
11449 self._include_uninitialized = Some(new_value);
11450 self
11451 }
11452 /// 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.
11453 ///
11454 /// Sets the *field selector* query property to the given value.
11455 pub fn field_selector(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
11456 self._field_selector = Some(new_value.to_string());
11457 self
11458 }
11459 /// Optional. Encoded string to continue paging.
11460 ///
11461 /// Sets the *continue* query property to the given value.
11462 pub fn continue_(mut self, new_value: &str) -> NamespaceRouteListCall<'a, C> {
11463 self._continue_ = Some(new_value.to_string());
11464 self
11465 }
11466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11467 /// while executing the actual API request.
11468 ///
11469 /// ````text
11470 /// It should be used to handle progress information, and to implement a certain level of resilience.
11471 /// ````
11472 ///
11473 /// Sets the *delegate* property to the given value.
11474 pub fn delegate(
11475 mut self,
11476 new_value: &'a mut dyn common::Delegate,
11477 ) -> NamespaceRouteListCall<'a, C> {
11478 self._delegate = Some(new_value);
11479 self
11480 }
11481
11482 /// Set any additional parameter of the query string used in the request.
11483 /// It should be used to set parameters which are not yet available through their own
11484 /// setters.
11485 ///
11486 /// Please note that this method must not be used to set any of the known parameters
11487 /// which have their own setter method. If done anyway, the request will fail.
11488 ///
11489 /// # Additional Parameters
11490 ///
11491 /// * *$.xgafv* (query-string) - V1 error format.
11492 /// * *access_token* (query-string) - OAuth access token.
11493 /// * *alt* (query-string) - Data format for response.
11494 /// * *callback* (query-string) - JSONP
11495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11496 /// * *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.
11497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11499 /// * *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.
11500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11502 pub fn param<T>(mut self, name: T, value: T) -> NamespaceRouteListCall<'a, C>
11503 where
11504 T: AsRef<str>,
11505 {
11506 self._additional_params
11507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11508 self
11509 }
11510
11511 /// Identifies the authorization scope for the method you are building.
11512 ///
11513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11514 /// [`Scope::CloudPlatform`].
11515 ///
11516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11517 /// tokens for more than one scope.
11518 ///
11519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11521 /// sufficient, a read-write scope will do as well.
11522 pub fn add_scope<St>(mut self, scope: St) -> NamespaceRouteListCall<'a, C>
11523 where
11524 St: AsRef<str>,
11525 {
11526 self._scopes.insert(String::from(scope.as_ref()));
11527 self
11528 }
11529 /// Identifies the authorization scope(s) for the method you are building.
11530 ///
11531 /// See [`Self::add_scope()`] for details.
11532 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceRouteListCall<'a, C>
11533 where
11534 I: IntoIterator<Item = St>,
11535 St: AsRef<str>,
11536 {
11537 self._scopes
11538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11539 self
11540 }
11541
11542 /// Removes all scopes, and no default scope will be used either.
11543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11544 /// for details).
11545 pub fn clear_scopes(mut self) -> NamespaceRouteListCall<'a, C> {
11546 self._scopes.clear();
11547 self
11548 }
11549}
11550
11551/// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
11552///
11553/// A builder for the *services.create* method supported by a *namespace* resource.
11554/// It is not used directly, but through a [`NamespaceMethods`] instance.
11555///
11556/// # Example
11557///
11558/// Instantiate a resource method builder
11559///
11560/// ```test_harness,no_run
11561/// # extern crate hyper;
11562/// # extern crate hyper_rustls;
11563/// # extern crate google_run1 as run1;
11564/// use run1::api::Service;
11565/// # async fn dox() {
11566/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11567///
11568/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11569/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11570/// # .with_native_roots()
11571/// # .unwrap()
11572/// # .https_only()
11573/// # .enable_http2()
11574/// # .build();
11575///
11576/// # let executor = hyper_util::rt::TokioExecutor::new();
11577/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11578/// # secret,
11579/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11580/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11581/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11582/// # ),
11583/// # ).build().await.unwrap();
11584///
11585/// # let client = hyper_util::client::legacy::Client::builder(
11586/// # hyper_util::rt::TokioExecutor::new()
11587/// # )
11588/// # .build(
11589/// # hyper_rustls::HttpsConnectorBuilder::new()
11590/// # .with_native_roots()
11591/// # .unwrap()
11592/// # .https_or_http()
11593/// # .enable_http2()
11594/// # .build()
11595/// # );
11596/// # let mut hub = CloudRun::new(client, auth);
11597/// // As the method needs a request, you would usually fill it with the desired information
11598/// // into the respective structure. Some of the parts shown here might not be applicable !
11599/// // Values shown here are possibly random and not representative !
11600/// let mut req = Service::default();
11601///
11602/// // You can configure optional parameters by calling the respective setters at will, and
11603/// // execute the final call using `doit()`.
11604/// // Values shown here are possibly random and not representative !
11605/// let result = hub.namespaces().services_create(req, "parent")
11606/// .dry_run("aliquyam")
11607/// .doit().await;
11608/// # }
11609/// ```
11610pub struct NamespaceServiceCreateCall<'a, C>
11611where
11612 C: 'a,
11613{
11614 hub: &'a CloudRun<C>,
11615 _request: Service,
11616 _parent: String,
11617 _dry_run: Option<String>,
11618 _delegate: Option<&'a mut dyn common::Delegate>,
11619 _additional_params: HashMap<String, String>,
11620 _scopes: BTreeSet<String>,
11621}
11622
11623impl<'a, C> common::CallBuilder for NamespaceServiceCreateCall<'a, C> {}
11624
11625impl<'a, C> NamespaceServiceCreateCall<'a, C>
11626where
11627 C: common::Connector,
11628{
11629 /// Perform the operation you have build so far.
11630 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
11631 use std::borrow::Cow;
11632 use std::io::{Read, Seek};
11633
11634 use common::{url::Params, ToParts};
11635 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11636
11637 let mut dd = common::DefaultDelegate;
11638 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11639 dlg.begin(common::MethodInfo {
11640 id: "run.namespaces.services.create",
11641 http_method: hyper::Method::POST,
11642 });
11643
11644 for &field in ["alt", "parent", "dryRun"].iter() {
11645 if self._additional_params.contains_key(field) {
11646 dlg.finished(false);
11647 return Err(common::Error::FieldClash(field));
11648 }
11649 }
11650
11651 let mut params = Params::with_capacity(5 + self._additional_params.len());
11652 params.push("parent", self._parent);
11653 if let Some(value) = self._dry_run.as_ref() {
11654 params.push("dryRun", value);
11655 }
11656
11657 params.extend(self._additional_params.iter());
11658
11659 params.push("alt", "json");
11660 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/services";
11661 if self._scopes.is_empty() {
11662 self._scopes
11663 .insert(Scope::CloudPlatform.as_ref().to_string());
11664 }
11665
11666 #[allow(clippy::single_element_loop)]
11667 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11668 url = params.uri_replacement(url, param_name, find_this, true);
11669 }
11670 {
11671 let to_remove = ["parent"];
11672 params.remove_params(&to_remove);
11673 }
11674
11675 let url = params.parse_with_url(&url);
11676
11677 let mut json_mime_type = mime::APPLICATION_JSON;
11678 let mut request_value_reader = {
11679 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11680 common::remove_json_null_values(&mut value);
11681 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11682 serde_json::to_writer(&mut dst, &value).unwrap();
11683 dst
11684 };
11685 let request_size = request_value_reader
11686 .seek(std::io::SeekFrom::End(0))
11687 .unwrap();
11688 request_value_reader
11689 .seek(std::io::SeekFrom::Start(0))
11690 .unwrap();
11691
11692 loop {
11693 let token = match self
11694 .hub
11695 .auth
11696 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11697 .await
11698 {
11699 Ok(token) => token,
11700 Err(e) => match dlg.token(e) {
11701 Ok(token) => token,
11702 Err(e) => {
11703 dlg.finished(false);
11704 return Err(common::Error::MissingToken(e));
11705 }
11706 },
11707 };
11708 request_value_reader
11709 .seek(std::io::SeekFrom::Start(0))
11710 .unwrap();
11711 let mut req_result = {
11712 let client = &self.hub.client;
11713 dlg.pre_request();
11714 let mut req_builder = hyper::Request::builder()
11715 .method(hyper::Method::POST)
11716 .uri(url.as_str())
11717 .header(USER_AGENT, self.hub._user_agent.clone());
11718
11719 if let Some(token) = token.as_ref() {
11720 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11721 }
11722
11723 let request = req_builder
11724 .header(CONTENT_TYPE, json_mime_type.to_string())
11725 .header(CONTENT_LENGTH, request_size as u64)
11726 .body(common::to_body(
11727 request_value_reader.get_ref().clone().into(),
11728 ));
11729
11730 client.request(request.unwrap()).await
11731 };
11732
11733 match req_result {
11734 Err(err) => {
11735 if let common::Retry::After(d) = dlg.http_error(&err) {
11736 sleep(d).await;
11737 continue;
11738 }
11739 dlg.finished(false);
11740 return Err(common::Error::HttpError(err));
11741 }
11742 Ok(res) => {
11743 let (mut parts, body) = res.into_parts();
11744 let mut body = common::Body::new(body);
11745 if !parts.status.is_success() {
11746 let bytes = common::to_bytes(body).await.unwrap_or_default();
11747 let error = serde_json::from_str(&common::to_string(&bytes));
11748 let response = common::to_response(parts, bytes.into());
11749
11750 if let common::Retry::After(d) =
11751 dlg.http_failure(&response, error.as_ref().ok())
11752 {
11753 sleep(d).await;
11754 continue;
11755 }
11756
11757 dlg.finished(false);
11758
11759 return Err(match error {
11760 Ok(value) => common::Error::BadRequest(value),
11761 _ => common::Error::Failure(response),
11762 });
11763 }
11764 let response = {
11765 let bytes = common::to_bytes(body).await.unwrap_or_default();
11766 let encoded = common::to_string(&bytes);
11767 match serde_json::from_str(&encoded) {
11768 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11769 Err(error) => {
11770 dlg.response_json_decode_error(&encoded, &error);
11771 return Err(common::Error::JsonDecodeError(
11772 encoded.to_string(),
11773 error,
11774 ));
11775 }
11776 }
11777 };
11778
11779 dlg.finished(true);
11780 return Ok(response);
11781 }
11782 }
11783 }
11784 }
11785
11786 ///
11787 /// Sets the *request* property to the given value.
11788 ///
11789 /// Even though the property as already been set when instantiating this call,
11790 /// we provide this method for API completeness.
11791 pub fn request(mut self, new_value: Service) -> NamespaceServiceCreateCall<'a, C> {
11792 self._request = new_value;
11793 self
11794 }
11795 /// 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}`
11796 ///
11797 /// Sets the *parent* path property to the given value.
11798 ///
11799 /// Even though the property as already been set when instantiating this call,
11800 /// we provide this method for API completeness.
11801 pub fn parent(mut self, new_value: &str) -> NamespaceServiceCreateCall<'a, C> {
11802 self._parent = new_value.to_string();
11803 self
11804 }
11805 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
11806 ///
11807 /// Sets the *dry run* query property to the given value.
11808 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceCreateCall<'a, C> {
11809 self._dry_run = Some(new_value.to_string());
11810 self
11811 }
11812 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11813 /// while executing the actual API request.
11814 ///
11815 /// ````text
11816 /// It should be used to handle progress information, and to implement a certain level of resilience.
11817 /// ````
11818 ///
11819 /// Sets the *delegate* property to the given value.
11820 pub fn delegate(
11821 mut self,
11822 new_value: &'a mut dyn common::Delegate,
11823 ) -> NamespaceServiceCreateCall<'a, C> {
11824 self._delegate = Some(new_value);
11825 self
11826 }
11827
11828 /// Set any additional parameter of the query string used in the request.
11829 /// It should be used to set parameters which are not yet available through their own
11830 /// setters.
11831 ///
11832 /// Please note that this method must not be used to set any of the known parameters
11833 /// which have their own setter method. If done anyway, the request will fail.
11834 ///
11835 /// # Additional Parameters
11836 ///
11837 /// * *$.xgafv* (query-string) - V1 error format.
11838 /// * *access_token* (query-string) - OAuth access token.
11839 /// * *alt* (query-string) - Data format for response.
11840 /// * *callback* (query-string) - JSONP
11841 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11842 /// * *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.
11843 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11844 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11845 /// * *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.
11846 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11847 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11848 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceCreateCall<'a, C>
11849 where
11850 T: AsRef<str>,
11851 {
11852 self._additional_params
11853 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11854 self
11855 }
11856
11857 /// Identifies the authorization scope for the method you are building.
11858 ///
11859 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11860 /// [`Scope::CloudPlatform`].
11861 ///
11862 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11863 /// tokens for more than one scope.
11864 ///
11865 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11866 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11867 /// sufficient, a read-write scope will do as well.
11868 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceCreateCall<'a, C>
11869 where
11870 St: AsRef<str>,
11871 {
11872 self._scopes.insert(String::from(scope.as_ref()));
11873 self
11874 }
11875 /// Identifies the authorization scope(s) for the method you are building.
11876 ///
11877 /// See [`Self::add_scope()`] for details.
11878 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceCreateCall<'a, C>
11879 where
11880 I: IntoIterator<Item = St>,
11881 St: AsRef<str>,
11882 {
11883 self._scopes
11884 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11885 self
11886 }
11887
11888 /// Removes all scopes, and no default scope will be used either.
11889 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11890 /// for details).
11891 pub fn clear_scopes(mut self) -> NamespaceServiceCreateCall<'a, C> {
11892 self._scopes.clear();
11893 self
11894 }
11895}
11896
11897/// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
11898///
11899/// A builder for the *services.delete* method supported by a *namespace* resource.
11900/// It is not used directly, but through a [`NamespaceMethods`] instance.
11901///
11902/// # Example
11903///
11904/// Instantiate a resource method builder
11905///
11906/// ```test_harness,no_run
11907/// # extern crate hyper;
11908/// # extern crate hyper_rustls;
11909/// # extern crate google_run1 as run1;
11910/// # async fn dox() {
11911/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11912///
11913/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11914/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11915/// # .with_native_roots()
11916/// # .unwrap()
11917/// # .https_only()
11918/// # .enable_http2()
11919/// # .build();
11920///
11921/// # let executor = hyper_util::rt::TokioExecutor::new();
11922/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11923/// # secret,
11924/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11925/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11926/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11927/// # ),
11928/// # ).build().await.unwrap();
11929///
11930/// # let client = hyper_util::client::legacy::Client::builder(
11931/// # hyper_util::rt::TokioExecutor::new()
11932/// # )
11933/// # .build(
11934/// # hyper_rustls::HttpsConnectorBuilder::new()
11935/// # .with_native_roots()
11936/// # .unwrap()
11937/// # .https_or_http()
11938/// # .enable_http2()
11939/// # .build()
11940/// # );
11941/// # let mut hub = CloudRun::new(client, auth);
11942/// // You can configure optional parameters by calling the respective setters at will, and
11943/// // execute the final call using `doit()`.
11944/// // Values shown here are possibly random and not representative !
11945/// let result = hub.namespaces().services_delete("name")
11946/// .propagation_policy("et")
11947/// .kind("sanctus")
11948/// .dry_run("Lorem")
11949/// .api_version("est")
11950/// .doit().await;
11951/// # }
11952/// ```
11953pub struct NamespaceServiceDeleteCall<'a, C>
11954where
11955 C: 'a,
11956{
11957 hub: &'a CloudRun<C>,
11958 _name: String,
11959 _propagation_policy: Option<String>,
11960 _kind: Option<String>,
11961 _dry_run: Option<String>,
11962 _api_version: Option<String>,
11963 _delegate: Option<&'a mut dyn common::Delegate>,
11964 _additional_params: HashMap<String, String>,
11965 _scopes: BTreeSet<String>,
11966}
11967
11968impl<'a, C> common::CallBuilder for NamespaceServiceDeleteCall<'a, C> {}
11969
11970impl<'a, C> NamespaceServiceDeleteCall<'a, C>
11971where
11972 C: common::Connector,
11973{
11974 /// Perform the operation you have build so far.
11975 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
11976 use std::borrow::Cow;
11977 use std::io::{Read, Seek};
11978
11979 use common::{url::Params, ToParts};
11980 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11981
11982 let mut dd = common::DefaultDelegate;
11983 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11984 dlg.begin(common::MethodInfo {
11985 id: "run.namespaces.services.delete",
11986 http_method: hyper::Method::DELETE,
11987 });
11988
11989 for &field in [
11990 "alt",
11991 "name",
11992 "propagationPolicy",
11993 "kind",
11994 "dryRun",
11995 "apiVersion",
11996 ]
11997 .iter()
11998 {
11999 if self._additional_params.contains_key(field) {
12000 dlg.finished(false);
12001 return Err(common::Error::FieldClash(field));
12002 }
12003 }
12004
12005 let mut params = Params::with_capacity(7 + self._additional_params.len());
12006 params.push("name", self._name);
12007 if let Some(value) = self._propagation_policy.as_ref() {
12008 params.push("propagationPolicy", value);
12009 }
12010 if let Some(value) = self._kind.as_ref() {
12011 params.push("kind", value);
12012 }
12013 if let Some(value) = self._dry_run.as_ref() {
12014 params.push("dryRun", value);
12015 }
12016 if let Some(value) = self._api_version.as_ref() {
12017 params.push("apiVersion", value);
12018 }
12019
12020 params.extend(self._additional_params.iter());
12021
12022 params.push("alt", "json");
12023 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
12024 if self._scopes.is_empty() {
12025 self._scopes
12026 .insert(Scope::CloudPlatform.as_ref().to_string());
12027 }
12028
12029 #[allow(clippy::single_element_loop)]
12030 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12031 url = params.uri_replacement(url, param_name, find_this, true);
12032 }
12033 {
12034 let to_remove = ["name"];
12035 params.remove_params(&to_remove);
12036 }
12037
12038 let url = params.parse_with_url(&url);
12039
12040 loop {
12041 let token = match self
12042 .hub
12043 .auth
12044 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12045 .await
12046 {
12047 Ok(token) => token,
12048 Err(e) => match dlg.token(e) {
12049 Ok(token) => token,
12050 Err(e) => {
12051 dlg.finished(false);
12052 return Err(common::Error::MissingToken(e));
12053 }
12054 },
12055 };
12056 let mut req_result = {
12057 let client = &self.hub.client;
12058 dlg.pre_request();
12059 let mut req_builder = hyper::Request::builder()
12060 .method(hyper::Method::DELETE)
12061 .uri(url.as_str())
12062 .header(USER_AGENT, self.hub._user_agent.clone());
12063
12064 if let Some(token) = token.as_ref() {
12065 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12066 }
12067
12068 let request = req_builder
12069 .header(CONTENT_LENGTH, 0_u64)
12070 .body(common::to_body::<String>(None));
12071
12072 client.request(request.unwrap()).await
12073 };
12074
12075 match req_result {
12076 Err(err) => {
12077 if let common::Retry::After(d) = dlg.http_error(&err) {
12078 sleep(d).await;
12079 continue;
12080 }
12081 dlg.finished(false);
12082 return Err(common::Error::HttpError(err));
12083 }
12084 Ok(res) => {
12085 let (mut parts, body) = res.into_parts();
12086 let mut body = common::Body::new(body);
12087 if !parts.status.is_success() {
12088 let bytes = common::to_bytes(body).await.unwrap_or_default();
12089 let error = serde_json::from_str(&common::to_string(&bytes));
12090 let response = common::to_response(parts, bytes.into());
12091
12092 if let common::Retry::After(d) =
12093 dlg.http_failure(&response, error.as_ref().ok())
12094 {
12095 sleep(d).await;
12096 continue;
12097 }
12098
12099 dlg.finished(false);
12100
12101 return Err(match error {
12102 Ok(value) => common::Error::BadRequest(value),
12103 _ => common::Error::Failure(response),
12104 });
12105 }
12106 let response = {
12107 let bytes = common::to_bytes(body).await.unwrap_or_default();
12108 let encoded = common::to_string(&bytes);
12109 match serde_json::from_str(&encoded) {
12110 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12111 Err(error) => {
12112 dlg.response_json_decode_error(&encoded, &error);
12113 return Err(common::Error::JsonDecodeError(
12114 encoded.to_string(),
12115 error,
12116 ));
12117 }
12118 }
12119 };
12120
12121 dlg.finished(true);
12122 return Ok(response);
12123 }
12124 }
12125 }
12126 }
12127
12128 /// 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}`
12129 ///
12130 /// Sets the *name* path property to the given value.
12131 ///
12132 /// Even though the property as already been set when instantiating this call,
12133 /// we provide this method for API completeness.
12134 pub fn name(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
12135 self._name = new_value.to_string();
12136 self
12137 }
12138 /// Not supported, and ignored by Cloud Run.
12139 ///
12140 /// Sets the *propagation policy* query property to the given value.
12141 pub fn propagation_policy(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
12142 self._propagation_policy = Some(new_value.to_string());
12143 self
12144 }
12145 /// Not supported, and ignored by Cloud Run.
12146 ///
12147 /// Sets the *kind* query property to the given value.
12148 pub fn kind(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
12149 self._kind = Some(new_value.to_string());
12150 self
12151 }
12152 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
12153 ///
12154 /// Sets the *dry run* query property to the given value.
12155 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
12156 self._dry_run = Some(new_value.to_string());
12157 self
12158 }
12159 /// Not supported, and ignored by Cloud Run.
12160 ///
12161 /// Sets the *api version* query property to the given value.
12162 pub fn api_version(mut self, new_value: &str) -> NamespaceServiceDeleteCall<'a, C> {
12163 self._api_version = Some(new_value.to_string());
12164 self
12165 }
12166 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12167 /// while executing the actual API request.
12168 ///
12169 /// ````text
12170 /// It should be used to handle progress information, and to implement a certain level of resilience.
12171 /// ````
12172 ///
12173 /// Sets the *delegate* property to the given value.
12174 pub fn delegate(
12175 mut self,
12176 new_value: &'a mut dyn common::Delegate,
12177 ) -> NamespaceServiceDeleteCall<'a, C> {
12178 self._delegate = Some(new_value);
12179 self
12180 }
12181
12182 /// Set any additional parameter of the query string used in the request.
12183 /// It should be used to set parameters which are not yet available through their own
12184 /// setters.
12185 ///
12186 /// Please note that this method must not be used to set any of the known parameters
12187 /// which have their own setter method. If done anyway, the request will fail.
12188 ///
12189 /// # Additional Parameters
12190 ///
12191 /// * *$.xgafv* (query-string) - V1 error format.
12192 /// * *access_token* (query-string) - OAuth access token.
12193 /// * *alt* (query-string) - Data format for response.
12194 /// * *callback* (query-string) - JSONP
12195 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12196 /// * *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.
12197 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12198 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12199 /// * *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.
12200 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12201 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12202 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceDeleteCall<'a, C>
12203 where
12204 T: AsRef<str>,
12205 {
12206 self._additional_params
12207 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12208 self
12209 }
12210
12211 /// Identifies the authorization scope for the method you are building.
12212 ///
12213 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12214 /// [`Scope::CloudPlatform`].
12215 ///
12216 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12217 /// tokens for more than one scope.
12218 ///
12219 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12220 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12221 /// sufficient, a read-write scope will do as well.
12222 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceDeleteCall<'a, C>
12223 where
12224 St: AsRef<str>,
12225 {
12226 self._scopes.insert(String::from(scope.as_ref()));
12227 self
12228 }
12229 /// Identifies the authorization scope(s) for the method you are building.
12230 ///
12231 /// See [`Self::add_scope()`] for details.
12232 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceDeleteCall<'a, C>
12233 where
12234 I: IntoIterator<Item = St>,
12235 St: AsRef<str>,
12236 {
12237 self._scopes
12238 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12239 self
12240 }
12241
12242 /// Removes all scopes, and no default scope will be used either.
12243 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12244 /// for details).
12245 pub fn clear_scopes(mut self) -> NamespaceServiceDeleteCall<'a, C> {
12246 self._scopes.clear();
12247 self
12248 }
12249}
12250
12251/// Gets information about a service.
12252///
12253/// A builder for the *services.get* method supported by a *namespace* resource.
12254/// It is not used directly, but through a [`NamespaceMethods`] instance.
12255///
12256/// # Example
12257///
12258/// Instantiate a resource method builder
12259///
12260/// ```test_harness,no_run
12261/// # extern crate hyper;
12262/// # extern crate hyper_rustls;
12263/// # extern crate google_run1 as run1;
12264/// # async fn dox() {
12265/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12266///
12267/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12268/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12269/// # .with_native_roots()
12270/// # .unwrap()
12271/// # .https_only()
12272/// # .enable_http2()
12273/// # .build();
12274///
12275/// # let executor = hyper_util::rt::TokioExecutor::new();
12276/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12277/// # secret,
12278/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12279/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12280/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12281/// # ),
12282/// # ).build().await.unwrap();
12283///
12284/// # let client = hyper_util::client::legacy::Client::builder(
12285/// # hyper_util::rt::TokioExecutor::new()
12286/// # )
12287/// # .build(
12288/// # hyper_rustls::HttpsConnectorBuilder::new()
12289/// # .with_native_roots()
12290/// # .unwrap()
12291/// # .https_or_http()
12292/// # .enable_http2()
12293/// # .build()
12294/// # );
12295/// # let mut hub = CloudRun::new(client, auth);
12296/// // You can configure optional parameters by calling the respective setters at will, and
12297/// // execute the final call using `doit()`.
12298/// // Values shown here are possibly random and not representative !
12299/// let result = hub.namespaces().services_get("name")
12300/// .doit().await;
12301/// # }
12302/// ```
12303pub struct NamespaceServiceGetCall<'a, C>
12304where
12305 C: 'a,
12306{
12307 hub: &'a CloudRun<C>,
12308 _name: String,
12309 _delegate: Option<&'a mut dyn common::Delegate>,
12310 _additional_params: HashMap<String, String>,
12311 _scopes: BTreeSet<String>,
12312}
12313
12314impl<'a, C> common::CallBuilder for NamespaceServiceGetCall<'a, C> {}
12315
12316impl<'a, C> NamespaceServiceGetCall<'a, C>
12317where
12318 C: common::Connector,
12319{
12320 /// Perform the operation you have build so far.
12321 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
12322 use std::borrow::Cow;
12323 use std::io::{Read, Seek};
12324
12325 use common::{url::Params, ToParts};
12326 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12327
12328 let mut dd = common::DefaultDelegate;
12329 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12330 dlg.begin(common::MethodInfo {
12331 id: "run.namespaces.services.get",
12332 http_method: hyper::Method::GET,
12333 });
12334
12335 for &field in ["alt", "name"].iter() {
12336 if self._additional_params.contains_key(field) {
12337 dlg.finished(false);
12338 return Err(common::Error::FieldClash(field));
12339 }
12340 }
12341
12342 let mut params = Params::with_capacity(3 + self._additional_params.len());
12343 params.push("name", self._name);
12344
12345 params.extend(self._additional_params.iter());
12346
12347 params.push("alt", "json");
12348 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
12349 if self._scopes.is_empty() {
12350 self._scopes
12351 .insert(Scope::CloudPlatform.as_ref().to_string());
12352 }
12353
12354 #[allow(clippy::single_element_loop)]
12355 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12356 url = params.uri_replacement(url, param_name, find_this, true);
12357 }
12358 {
12359 let to_remove = ["name"];
12360 params.remove_params(&to_remove);
12361 }
12362
12363 let url = params.parse_with_url(&url);
12364
12365 loop {
12366 let token = match self
12367 .hub
12368 .auth
12369 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12370 .await
12371 {
12372 Ok(token) => token,
12373 Err(e) => match dlg.token(e) {
12374 Ok(token) => token,
12375 Err(e) => {
12376 dlg.finished(false);
12377 return Err(common::Error::MissingToken(e));
12378 }
12379 },
12380 };
12381 let mut req_result = {
12382 let client = &self.hub.client;
12383 dlg.pre_request();
12384 let mut req_builder = hyper::Request::builder()
12385 .method(hyper::Method::GET)
12386 .uri(url.as_str())
12387 .header(USER_AGENT, self.hub._user_agent.clone());
12388
12389 if let Some(token) = token.as_ref() {
12390 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12391 }
12392
12393 let request = req_builder
12394 .header(CONTENT_LENGTH, 0_u64)
12395 .body(common::to_body::<String>(None));
12396
12397 client.request(request.unwrap()).await
12398 };
12399
12400 match req_result {
12401 Err(err) => {
12402 if let common::Retry::After(d) = dlg.http_error(&err) {
12403 sleep(d).await;
12404 continue;
12405 }
12406 dlg.finished(false);
12407 return Err(common::Error::HttpError(err));
12408 }
12409 Ok(res) => {
12410 let (mut parts, body) = res.into_parts();
12411 let mut body = common::Body::new(body);
12412 if !parts.status.is_success() {
12413 let bytes = common::to_bytes(body).await.unwrap_or_default();
12414 let error = serde_json::from_str(&common::to_string(&bytes));
12415 let response = common::to_response(parts, bytes.into());
12416
12417 if let common::Retry::After(d) =
12418 dlg.http_failure(&response, error.as_ref().ok())
12419 {
12420 sleep(d).await;
12421 continue;
12422 }
12423
12424 dlg.finished(false);
12425
12426 return Err(match error {
12427 Ok(value) => common::Error::BadRequest(value),
12428 _ => common::Error::Failure(response),
12429 });
12430 }
12431 let response = {
12432 let bytes = common::to_bytes(body).await.unwrap_or_default();
12433 let encoded = common::to_string(&bytes);
12434 match serde_json::from_str(&encoded) {
12435 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12436 Err(error) => {
12437 dlg.response_json_decode_error(&encoded, &error);
12438 return Err(common::Error::JsonDecodeError(
12439 encoded.to_string(),
12440 error,
12441 ));
12442 }
12443 }
12444 };
12445
12446 dlg.finished(true);
12447 return Ok(response);
12448 }
12449 }
12450 }
12451 }
12452
12453 /// 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}`
12454 ///
12455 /// Sets the *name* path property to the given value.
12456 ///
12457 /// Even though the property as already been set when instantiating this call,
12458 /// we provide this method for API completeness.
12459 pub fn name(mut self, new_value: &str) -> NamespaceServiceGetCall<'a, C> {
12460 self._name = new_value.to_string();
12461 self
12462 }
12463 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12464 /// while executing the actual API request.
12465 ///
12466 /// ````text
12467 /// It should be used to handle progress information, and to implement a certain level of resilience.
12468 /// ````
12469 ///
12470 /// Sets the *delegate* property to the given value.
12471 pub fn delegate(
12472 mut self,
12473 new_value: &'a mut dyn common::Delegate,
12474 ) -> NamespaceServiceGetCall<'a, C> {
12475 self._delegate = Some(new_value);
12476 self
12477 }
12478
12479 /// Set any additional parameter of the query string used in the request.
12480 /// It should be used to set parameters which are not yet available through their own
12481 /// setters.
12482 ///
12483 /// Please note that this method must not be used to set any of the known parameters
12484 /// which have their own setter method. If done anyway, the request will fail.
12485 ///
12486 /// # Additional Parameters
12487 ///
12488 /// * *$.xgafv* (query-string) - V1 error format.
12489 /// * *access_token* (query-string) - OAuth access token.
12490 /// * *alt* (query-string) - Data format for response.
12491 /// * *callback* (query-string) - JSONP
12492 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12493 /// * *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.
12494 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12495 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12496 /// * *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.
12497 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12498 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12499 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceGetCall<'a, C>
12500 where
12501 T: AsRef<str>,
12502 {
12503 self._additional_params
12504 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12505 self
12506 }
12507
12508 /// Identifies the authorization scope for the method you are building.
12509 ///
12510 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12511 /// [`Scope::CloudPlatform`].
12512 ///
12513 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12514 /// tokens for more than one scope.
12515 ///
12516 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12517 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12518 /// sufficient, a read-write scope will do as well.
12519 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceGetCall<'a, C>
12520 where
12521 St: AsRef<str>,
12522 {
12523 self._scopes.insert(String::from(scope.as_ref()));
12524 self
12525 }
12526 /// Identifies the authorization scope(s) for the method you are building.
12527 ///
12528 /// See [`Self::add_scope()`] for details.
12529 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceGetCall<'a, C>
12530 where
12531 I: IntoIterator<Item = St>,
12532 St: AsRef<str>,
12533 {
12534 self._scopes
12535 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12536 self
12537 }
12538
12539 /// Removes all scopes, and no default scope will be used either.
12540 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12541 /// for details).
12542 pub fn clear_scopes(mut self) -> NamespaceServiceGetCall<'a, C> {
12543 self._scopes.clear();
12544 self
12545 }
12546}
12547
12548/// Lists services for the given project and region. Results are sorted by creation time, descending.
12549///
12550/// A builder for the *services.list* method supported by a *namespace* resource.
12551/// It is not used directly, but through a [`NamespaceMethods`] instance.
12552///
12553/// # Example
12554///
12555/// Instantiate a resource method builder
12556///
12557/// ```test_harness,no_run
12558/// # extern crate hyper;
12559/// # extern crate hyper_rustls;
12560/// # extern crate google_run1 as run1;
12561/// # async fn dox() {
12562/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12563///
12564/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12565/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12566/// # .with_native_roots()
12567/// # .unwrap()
12568/// # .https_only()
12569/// # .enable_http2()
12570/// # .build();
12571///
12572/// # let executor = hyper_util::rt::TokioExecutor::new();
12573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12574/// # secret,
12575/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12576/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12577/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12578/// # ),
12579/// # ).build().await.unwrap();
12580///
12581/// # let client = hyper_util::client::legacy::Client::builder(
12582/// # hyper_util::rt::TokioExecutor::new()
12583/// # )
12584/// # .build(
12585/// # hyper_rustls::HttpsConnectorBuilder::new()
12586/// # .with_native_roots()
12587/// # .unwrap()
12588/// # .https_or_http()
12589/// # .enable_http2()
12590/// # .build()
12591/// # );
12592/// # let mut hub = CloudRun::new(client, auth);
12593/// // You can configure optional parameters by calling the respective setters at will, and
12594/// // execute the final call using `doit()`.
12595/// // Values shown here are possibly random and not representative !
12596/// let result = hub.namespaces().services_list("parent")
12597/// .watch(true)
12598/// .resource_version("et")
12599/// .limit(-93)
12600/// .label_selector("no")
12601/// .include_uninitialized(false)
12602/// .field_selector("elitr")
12603/// .continue_("sed")
12604/// .doit().await;
12605/// # }
12606/// ```
12607pub struct NamespaceServiceListCall<'a, C>
12608where
12609 C: 'a,
12610{
12611 hub: &'a CloudRun<C>,
12612 _parent: String,
12613 _watch: Option<bool>,
12614 _resource_version: Option<String>,
12615 _limit: Option<i32>,
12616 _label_selector: Option<String>,
12617 _include_uninitialized: Option<bool>,
12618 _field_selector: Option<String>,
12619 _continue_: Option<String>,
12620 _delegate: Option<&'a mut dyn common::Delegate>,
12621 _additional_params: HashMap<String, String>,
12622 _scopes: BTreeSet<String>,
12623}
12624
12625impl<'a, C> common::CallBuilder for NamespaceServiceListCall<'a, C> {}
12626
12627impl<'a, C> NamespaceServiceListCall<'a, C>
12628where
12629 C: common::Connector,
12630{
12631 /// Perform the operation you have build so far.
12632 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
12633 use std::borrow::Cow;
12634 use std::io::{Read, Seek};
12635
12636 use common::{url::Params, ToParts};
12637 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12638
12639 let mut dd = common::DefaultDelegate;
12640 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12641 dlg.begin(common::MethodInfo {
12642 id: "run.namespaces.services.list",
12643 http_method: hyper::Method::GET,
12644 });
12645
12646 for &field in [
12647 "alt",
12648 "parent",
12649 "watch",
12650 "resourceVersion",
12651 "limit",
12652 "labelSelector",
12653 "includeUninitialized",
12654 "fieldSelector",
12655 "continue",
12656 ]
12657 .iter()
12658 {
12659 if self._additional_params.contains_key(field) {
12660 dlg.finished(false);
12661 return Err(common::Error::FieldClash(field));
12662 }
12663 }
12664
12665 let mut params = Params::with_capacity(10 + self._additional_params.len());
12666 params.push("parent", self._parent);
12667 if let Some(value) = self._watch.as_ref() {
12668 params.push("watch", value.to_string());
12669 }
12670 if let Some(value) = self._resource_version.as_ref() {
12671 params.push("resourceVersion", value);
12672 }
12673 if let Some(value) = self._limit.as_ref() {
12674 params.push("limit", value.to_string());
12675 }
12676 if let Some(value) = self._label_selector.as_ref() {
12677 params.push("labelSelector", value);
12678 }
12679 if let Some(value) = self._include_uninitialized.as_ref() {
12680 params.push("includeUninitialized", value.to_string());
12681 }
12682 if let Some(value) = self._field_selector.as_ref() {
12683 params.push("fieldSelector", value);
12684 }
12685 if let Some(value) = self._continue_.as_ref() {
12686 params.push("continue", value);
12687 }
12688
12689 params.extend(self._additional_params.iter());
12690
12691 params.push("alt", "json");
12692 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+parent}/services";
12693 if self._scopes.is_empty() {
12694 self._scopes
12695 .insert(Scope::CloudPlatform.as_ref().to_string());
12696 }
12697
12698 #[allow(clippy::single_element_loop)]
12699 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12700 url = params.uri_replacement(url, param_name, find_this, true);
12701 }
12702 {
12703 let to_remove = ["parent"];
12704 params.remove_params(&to_remove);
12705 }
12706
12707 let url = params.parse_with_url(&url);
12708
12709 loop {
12710 let token = match self
12711 .hub
12712 .auth
12713 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12714 .await
12715 {
12716 Ok(token) => token,
12717 Err(e) => match dlg.token(e) {
12718 Ok(token) => token,
12719 Err(e) => {
12720 dlg.finished(false);
12721 return Err(common::Error::MissingToken(e));
12722 }
12723 },
12724 };
12725 let mut req_result = {
12726 let client = &self.hub.client;
12727 dlg.pre_request();
12728 let mut req_builder = hyper::Request::builder()
12729 .method(hyper::Method::GET)
12730 .uri(url.as_str())
12731 .header(USER_AGENT, self.hub._user_agent.clone());
12732
12733 if let Some(token) = token.as_ref() {
12734 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12735 }
12736
12737 let request = req_builder
12738 .header(CONTENT_LENGTH, 0_u64)
12739 .body(common::to_body::<String>(None));
12740
12741 client.request(request.unwrap()).await
12742 };
12743
12744 match req_result {
12745 Err(err) => {
12746 if let common::Retry::After(d) = dlg.http_error(&err) {
12747 sleep(d).await;
12748 continue;
12749 }
12750 dlg.finished(false);
12751 return Err(common::Error::HttpError(err));
12752 }
12753 Ok(res) => {
12754 let (mut parts, body) = res.into_parts();
12755 let mut body = common::Body::new(body);
12756 if !parts.status.is_success() {
12757 let bytes = common::to_bytes(body).await.unwrap_or_default();
12758 let error = serde_json::from_str(&common::to_string(&bytes));
12759 let response = common::to_response(parts, bytes.into());
12760
12761 if let common::Retry::After(d) =
12762 dlg.http_failure(&response, error.as_ref().ok())
12763 {
12764 sleep(d).await;
12765 continue;
12766 }
12767
12768 dlg.finished(false);
12769
12770 return Err(match error {
12771 Ok(value) => common::Error::BadRequest(value),
12772 _ => common::Error::Failure(response),
12773 });
12774 }
12775 let response = {
12776 let bytes = common::to_bytes(body).await.unwrap_or_default();
12777 let encoded = common::to_string(&bytes);
12778 match serde_json::from_str(&encoded) {
12779 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12780 Err(error) => {
12781 dlg.response_json_decode_error(&encoded, &error);
12782 return Err(common::Error::JsonDecodeError(
12783 encoded.to_string(),
12784 error,
12785 ));
12786 }
12787 }
12788 };
12789
12790 dlg.finished(true);
12791 return Ok(response);
12792 }
12793 }
12794 }
12795 }
12796
12797 /// 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}`
12798 ///
12799 /// Sets the *parent* path property to the given value.
12800 ///
12801 /// Even though the property as already been set when instantiating this call,
12802 /// we provide this method for API completeness.
12803 pub fn parent(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12804 self._parent = new_value.to_string();
12805 self
12806 }
12807 /// Not supported, and ignored by Cloud Run.
12808 ///
12809 /// Sets the *watch* query property to the given value.
12810 pub fn watch(mut self, new_value: bool) -> NamespaceServiceListCall<'a, C> {
12811 self._watch = Some(new_value);
12812 self
12813 }
12814 /// Not supported, and ignored by Cloud Run.
12815 ///
12816 /// Sets the *resource version* query property to the given value.
12817 pub fn resource_version(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12818 self._resource_version = Some(new_value.to_string());
12819 self
12820 }
12821 /// The maximum number of records that should be returned.
12822 ///
12823 /// Sets the *limit* query property to the given value.
12824 pub fn limit(mut self, new_value: i32) -> NamespaceServiceListCall<'a, C> {
12825 self._limit = Some(new_value);
12826 self
12827 }
12828 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
12829 ///
12830 /// Sets the *label selector* query property to the given value.
12831 pub fn label_selector(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12832 self._label_selector = Some(new_value.to_string());
12833 self
12834 }
12835 /// Not supported, and ignored by Cloud Run.
12836 ///
12837 /// Sets the *include uninitialized* query property to the given value.
12838 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceServiceListCall<'a, C> {
12839 self._include_uninitialized = Some(new_value);
12840 self
12841 }
12842 /// Not supported, and ignored by Cloud Run.
12843 ///
12844 /// Sets the *field selector* query property to the given value.
12845 pub fn field_selector(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12846 self._field_selector = Some(new_value.to_string());
12847 self
12848 }
12849 /// Encoded string to continue paging.
12850 ///
12851 /// Sets the *continue* query property to the given value.
12852 pub fn continue_(mut self, new_value: &str) -> NamespaceServiceListCall<'a, C> {
12853 self._continue_ = Some(new_value.to_string());
12854 self
12855 }
12856 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12857 /// while executing the actual API request.
12858 ///
12859 /// ````text
12860 /// It should be used to handle progress information, and to implement a certain level of resilience.
12861 /// ````
12862 ///
12863 /// Sets the *delegate* property to the given value.
12864 pub fn delegate(
12865 mut self,
12866 new_value: &'a mut dyn common::Delegate,
12867 ) -> NamespaceServiceListCall<'a, C> {
12868 self._delegate = Some(new_value);
12869 self
12870 }
12871
12872 /// Set any additional parameter of the query string used in the request.
12873 /// It should be used to set parameters which are not yet available through their own
12874 /// setters.
12875 ///
12876 /// Please note that this method must not be used to set any of the known parameters
12877 /// which have their own setter method. If done anyway, the request will fail.
12878 ///
12879 /// # Additional Parameters
12880 ///
12881 /// * *$.xgafv* (query-string) - V1 error format.
12882 /// * *access_token* (query-string) - OAuth access token.
12883 /// * *alt* (query-string) - Data format for response.
12884 /// * *callback* (query-string) - JSONP
12885 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12886 /// * *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.
12887 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12888 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12889 /// * *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.
12890 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12891 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12892 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceListCall<'a, C>
12893 where
12894 T: AsRef<str>,
12895 {
12896 self._additional_params
12897 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12898 self
12899 }
12900
12901 /// Identifies the authorization scope for the method you are building.
12902 ///
12903 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12904 /// [`Scope::CloudPlatform`].
12905 ///
12906 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12907 /// tokens for more than one scope.
12908 ///
12909 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12910 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12911 /// sufficient, a read-write scope will do as well.
12912 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceListCall<'a, C>
12913 where
12914 St: AsRef<str>,
12915 {
12916 self._scopes.insert(String::from(scope.as_ref()));
12917 self
12918 }
12919 /// Identifies the authorization scope(s) for the method you are building.
12920 ///
12921 /// See [`Self::add_scope()`] for details.
12922 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceListCall<'a, C>
12923 where
12924 I: IntoIterator<Item = St>,
12925 St: AsRef<str>,
12926 {
12927 self._scopes
12928 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12929 self
12930 }
12931
12932 /// Removes all scopes, and no default scope will be used either.
12933 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12934 /// for details).
12935 pub fn clear_scopes(mut self) -> NamespaceServiceListCall<'a, C> {
12936 self._scopes.clear();
12937 self
12938 }
12939}
12940
12941/// 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.
12942///
12943/// A builder for the *services.replaceService* method supported by a *namespace* resource.
12944/// It is not used directly, but through a [`NamespaceMethods`] instance.
12945///
12946/// # Example
12947///
12948/// Instantiate a resource method builder
12949///
12950/// ```test_harness,no_run
12951/// # extern crate hyper;
12952/// # extern crate hyper_rustls;
12953/// # extern crate google_run1 as run1;
12954/// use run1::api::Service;
12955/// # async fn dox() {
12956/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12957///
12958/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12959/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12960/// # .with_native_roots()
12961/// # .unwrap()
12962/// # .https_only()
12963/// # .enable_http2()
12964/// # .build();
12965///
12966/// # let executor = hyper_util::rt::TokioExecutor::new();
12967/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12968/// # secret,
12969/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12970/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12971/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12972/// # ),
12973/// # ).build().await.unwrap();
12974///
12975/// # let client = hyper_util::client::legacy::Client::builder(
12976/// # hyper_util::rt::TokioExecutor::new()
12977/// # )
12978/// # .build(
12979/// # hyper_rustls::HttpsConnectorBuilder::new()
12980/// # .with_native_roots()
12981/// # .unwrap()
12982/// # .https_or_http()
12983/// # .enable_http2()
12984/// # .build()
12985/// # );
12986/// # let mut hub = CloudRun::new(client, auth);
12987/// // As the method needs a request, you would usually fill it with the desired information
12988/// // into the respective structure. Some of the parts shown here might not be applicable !
12989/// // Values shown here are possibly random and not representative !
12990/// let mut req = Service::default();
12991///
12992/// // You can configure optional parameters by calling the respective setters at will, and
12993/// // execute the final call using `doit()`.
12994/// // Values shown here are possibly random and not representative !
12995/// let result = hub.namespaces().services_replace_service(req, "name")
12996/// .dry_run("nonumy")
12997/// .doit().await;
12998/// # }
12999/// ```
13000pub struct NamespaceServiceReplaceServiceCall<'a, C>
13001where
13002 C: 'a,
13003{
13004 hub: &'a CloudRun<C>,
13005 _request: Service,
13006 _name: String,
13007 _dry_run: Option<String>,
13008 _delegate: Option<&'a mut dyn common::Delegate>,
13009 _additional_params: HashMap<String, String>,
13010 _scopes: BTreeSet<String>,
13011}
13012
13013impl<'a, C> common::CallBuilder for NamespaceServiceReplaceServiceCall<'a, C> {}
13014
13015impl<'a, C> NamespaceServiceReplaceServiceCall<'a, C>
13016where
13017 C: common::Connector,
13018{
13019 /// Perform the operation you have build so far.
13020 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
13021 use std::borrow::Cow;
13022 use std::io::{Read, Seek};
13023
13024 use common::{url::Params, ToParts};
13025 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13026
13027 let mut dd = common::DefaultDelegate;
13028 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13029 dlg.begin(common::MethodInfo {
13030 id: "run.namespaces.services.replaceService",
13031 http_method: hyper::Method::PUT,
13032 });
13033
13034 for &field in ["alt", "name", "dryRun"].iter() {
13035 if self._additional_params.contains_key(field) {
13036 dlg.finished(false);
13037 return Err(common::Error::FieldClash(field));
13038 }
13039 }
13040
13041 let mut params = Params::with_capacity(5 + self._additional_params.len());
13042 params.push("name", self._name);
13043 if let Some(value) = self._dry_run.as_ref() {
13044 params.push("dryRun", value);
13045 }
13046
13047 params.extend(self._additional_params.iter());
13048
13049 params.push("alt", "json");
13050 let mut url = self.hub._base_url.clone() + "apis/serving.knative.dev/v1/{+name}";
13051 if self._scopes.is_empty() {
13052 self._scopes
13053 .insert(Scope::CloudPlatform.as_ref().to_string());
13054 }
13055
13056 #[allow(clippy::single_element_loop)]
13057 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13058 url = params.uri_replacement(url, param_name, find_this, true);
13059 }
13060 {
13061 let to_remove = ["name"];
13062 params.remove_params(&to_remove);
13063 }
13064
13065 let url = params.parse_with_url(&url);
13066
13067 let mut json_mime_type = mime::APPLICATION_JSON;
13068 let mut request_value_reader = {
13069 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13070 common::remove_json_null_values(&mut value);
13071 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13072 serde_json::to_writer(&mut dst, &value).unwrap();
13073 dst
13074 };
13075 let request_size = request_value_reader
13076 .seek(std::io::SeekFrom::End(0))
13077 .unwrap();
13078 request_value_reader
13079 .seek(std::io::SeekFrom::Start(0))
13080 .unwrap();
13081
13082 loop {
13083 let token = match self
13084 .hub
13085 .auth
13086 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13087 .await
13088 {
13089 Ok(token) => token,
13090 Err(e) => match dlg.token(e) {
13091 Ok(token) => token,
13092 Err(e) => {
13093 dlg.finished(false);
13094 return Err(common::Error::MissingToken(e));
13095 }
13096 },
13097 };
13098 request_value_reader
13099 .seek(std::io::SeekFrom::Start(0))
13100 .unwrap();
13101 let mut req_result = {
13102 let client = &self.hub.client;
13103 dlg.pre_request();
13104 let mut req_builder = hyper::Request::builder()
13105 .method(hyper::Method::PUT)
13106 .uri(url.as_str())
13107 .header(USER_AGENT, self.hub._user_agent.clone());
13108
13109 if let Some(token) = token.as_ref() {
13110 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13111 }
13112
13113 let request = req_builder
13114 .header(CONTENT_TYPE, json_mime_type.to_string())
13115 .header(CONTENT_LENGTH, request_size as u64)
13116 .body(common::to_body(
13117 request_value_reader.get_ref().clone().into(),
13118 ));
13119
13120 client.request(request.unwrap()).await
13121 };
13122
13123 match req_result {
13124 Err(err) => {
13125 if let common::Retry::After(d) = dlg.http_error(&err) {
13126 sleep(d).await;
13127 continue;
13128 }
13129 dlg.finished(false);
13130 return Err(common::Error::HttpError(err));
13131 }
13132 Ok(res) => {
13133 let (mut parts, body) = res.into_parts();
13134 let mut body = common::Body::new(body);
13135 if !parts.status.is_success() {
13136 let bytes = common::to_bytes(body).await.unwrap_or_default();
13137 let error = serde_json::from_str(&common::to_string(&bytes));
13138 let response = common::to_response(parts, bytes.into());
13139
13140 if let common::Retry::After(d) =
13141 dlg.http_failure(&response, error.as_ref().ok())
13142 {
13143 sleep(d).await;
13144 continue;
13145 }
13146
13147 dlg.finished(false);
13148
13149 return Err(match error {
13150 Ok(value) => common::Error::BadRequest(value),
13151 _ => common::Error::Failure(response),
13152 });
13153 }
13154 let response = {
13155 let bytes = common::to_bytes(body).await.unwrap_or_default();
13156 let encoded = common::to_string(&bytes);
13157 match serde_json::from_str(&encoded) {
13158 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13159 Err(error) => {
13160 dlg.response_json_decode_error(&encoded, &error);
13161 return Err(common::Error::JsonDecodeError(
13162 encoded.to_string(),
13163 error,
13164 ));
13165 }
13166 }
13167 };
13168
13169 dlg.finished(true);
13170 return Ok(response);
13171 }
13172 }
13173 }
13174 }
13175
13176 ///
13177 /// Sets the *request* property to the given value.
13178 ///
13179 /// Even though the property as already been set when instantiating this call,
13180 /// we provide this method for API completeness.
13181 pub fn request(mut self, new_value: Service) -> NamespaceServiceReplaceServiceCall<'a, C> {
13182 self._request = new_value;
13183 self
13184 }
13185 /// 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}`
13186 ///
13187 /// Sets the *name* path property to the given value.
13188 ///
13189 /// Even though the property as already been set when instantiating this call,
13190 /// we provide this method for API completeness.
13191 pub fn name(mut self, new_value: &str) -> NamespaceServiceReplaceServiceCall<'a, C> {
13192 self._name = new_value.to_string();
13193 self
13194 }
13195 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
13196 ///
13197 /// Sets the *dry run* query property to the given value.
13198 pub fn dry_run(mut self, new_value: &str) -> NamespaceServiceReplaceServiceCall<'a, C> {
13199 self._dry_run = Some(new_value.to_string());
13200 self
13201 }
13202 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13203 /// while executing the actual API request.
13204 ///
13205 /// ````text
13206 /// It should be used to handle progress information, and to implement a certain level of resilience.
13207 /// ````
13208 ///
13209 /// Sets the *delegate* property to the given value.
13210 pub fn delegate(
13211 mut self,
13212 new_value: &'a mut dyn common::Delegate,
13213 ) -> NamespaceServiceReplaceServiceCall<'a, C> {
13214 self._delegate = Some(new_value);
13215 self
13216 }
13217
13218 /// Set any additional parameter of the query string used in the request.
13219 /// It should be used to set parameters which are not yet available through their own
13220 /// setters.
13221 ///
13222 /// Please note that this method must not be used to set any of the known parameters
13223 /// which have their own setter method. If done anyway, the request will fail.
13224 ///
13225 /// # Additional Parameters
13226 ///
13227 /// * *$.xgafv* (query-string) - V1 error format.
13228 /// * *access_token* (query-string) - OAuth access token.
13229 /// * *alt* (query-string) - Data format for response.
13230 /// * *callback* (query-string) - JSONP
13231 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13232 /// * *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.
13233 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13234 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13235 /// * *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.
13236 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13237 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13238 pub fn param<T>(mut self, name: T, value: T) -> NamespaceServiceReplaceServiceCall<'a, C>
13239 where
13240 T: AsRef<str>,
13241 {
13242 self._additional_params
13243 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13244 self
13245 }
13246
13247 /// Identifies the authorization scope for the method you are building.
13248 ///
13249 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13250 /// [`Scope::CloudPlatform`].
13251 ///
13252 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13253 /// tokens for more than one scope.
13254 ///
13255 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13256 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13257 /// sufficient, a read-write scope will do as well.
13258 pub fn add_scope<St>(mut self, scope: St) -> NamespaceServiceReplaceServiceCall<'a, C>
13259 where
13260 St: AsRef<str>,
13261 {
13262 self._scopes.insert(String::from(scope.as_ref()));
13263 self
13264 }
13265 /// Identifies the authorization scope(s) for the method you are building.
13266 ///
13267 /// See [`Self::add_scope()`] for details.
13268 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceServiceReplaceServiceCall<'a, C>
13269 where
13270 I: IntoIterator<Item = St>,
13271 St: AsRef<str>,
13272 {
13273 self._scopes
13274 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13275 self
13276 }
13277
13278 /// Removes all scopes, and no default scope will be used either.
13279 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13280 /// for details).
13281 pub fn clear_scopes(mut self) -> NamespaceServiceReplaceServiceCall<'a, C> {
13282 self._scopes.clear();
13283 self
13284 }
13285}
13286
13287/// Get information about a task.
13288///
13289/// A builder for the *tasks.get* method supported by a *namespace* resource.
13290/// It is not used directly, but through a [`NamespaceMethods`] instance.
13291///
13292/// # Example
13293///
13294/// Instantiate a resource method builder
13295///
13296/// ```test_harness,no_run
13297/// # extern crate hyper;
13298/// # extern crate hyper_rustls;
13299/// # extern crate google_run1 as run1;
13300/// # async fn dox() {
13301/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13302///
13303/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13304/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13305/// # .with_native_roots()
13306/// # .unwrap()
13307/// # .https_only()
13308/// # .enable_http2()
13309/// # .build();
13310///
13311/// # let executor = hyper_util::rt::TokioExecutor::new();
13312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13313/// # secret,
13314/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13315/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13316/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13317/// # ),
13318/// # ).build().await.unwrap();
13319///
13320/// # let client = hyper_util::client::legacy::Client::builder(
13321/// # hyper_util::rt::TokioExecutor::new()
13322/// # )
13323/// # .build(
13324/// # hyper_rustls::HttpsConnectorBuilder::new()
13325/// # .with_native_roots()
13326/// # .unwrap()
13327/// # .https_or_http()
13328/// # .enable_http2()
13329/// # .build()
13330/// # );
13331/// # let mut hub = CloudRun::new(client, auth);
13332/// // You can configure optional parameters by calling the respective setters at will, and
13333/// // execute the final call using `doit()`.
13334/// // Values shown here are possibly random and not representative !
13335/// let result = hub.namespaces().tasks_get("name")
13336/// .doit().await;
13337/// # }
13338/// ```
13339pub struct NamespaceTaskGetCall<'a, C>
13340where
13341 C: 'a,
13342{
13343 hub: &'a CloudRun<C>,
13344 _name: String,
13345 _delegate: Option<&'a mut dyn common::Delegate>,
13346 _additional_params: HashMap<String, String>,
13347 _scopes: BTreeSet<String>,
13348}
13349
13350impl<'a, C> common::CallBuilder for NamespaceTaskGetCall<'a, C> {}
13351
13352impl<'a, C> NamespaceTaskGetCall<'a, C>
13353where
13354 C: common::Connector,
13355{
13356 /// Perform the operation you have build so far.
13357 pub async fn doit(mut self) -> common::Result<(common::Response, Task)> {
13358 use std::borrow::Cow;
13359 use std::io::{Read, Seek};
13360
13361 use common::{url::Params, ToParts};
13362 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13363
13364 let mut dd = common::DefaultDelegate;
13365 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13366 dlg.begin(common::MethodInfo {
13367 id: "run.namespaces.tasks.get",
13368 http_method: hyper::Method::GET,
13369 });
13370
13371 for &field in ["alt", "name"].iter() {
13372 if self._additional_params.contains_key(field) {
13373 dlg.finished(false);
13374 return Err(common::Error::FieldClash(field));
13375 }
13376 }
13377
13378 let mut params = Params::with_capacity(3 + self._additional_params.len());
13379 params.push("name", self._name);
13380
13381 params.extend(self._additional_params.iter());
13382
13383 params.push("alt", "json");
13384 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
13385 if self._scopes.is_empty() {
13386 self._scopes
13387 .insert(Scope::CloudPlatform.as_ref().to_string());
13388 }
13389
13390 #[allow(clippy::single_element_loop)]
13391 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13392 url = params.uri_replacement(url, param_name, find_this, true);
13393 }
13394 {
13395 let to_remove = ["name"];
13396 params.remove_params(&to_remove);
13397 }
13398
13399 let url = params.parse_with_url(&url);
13400
13401 loop {
13402 let token = match self
13403 .hub
13404 .auth
13405 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13406 .await
13407 {
13408 Ok(token) => token,
13409 Err(e) => match dlg.token(e) {
13410 Ok(token) => token,
13411 Err(e) => {
13412 dlg.finished(false);
13413 return Err(common::Error::MissingToken(e));
13414 }
13415 },
13416 };
13417 let mut req_result = {
13418 let client = &self.hub.client;
13419 dlg.pre_request();
13420 let mut req_builder = hyper::Request::builder()
13421 .method(hyper::Method::GET)
13422 .uri(url.as_str())
13423 .header(USER_AGENT, self.hub._user_agent.clone());
13424
13425 if let Some(token) = token.as_ref() {
13426 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13427 }
13428
13429 let request = req_builder
13430 .header(CONTENT_LENGTH, 0_u64)
13431 .body(common::to_body::<String>(None));
13432
13433 client.request(request.unwrap()).await
13434 };
13435
13436 match req_result {
13437 Err(err) => {
13438 if let common::Retry::After(d) = dlg.http_error(&err) {
13439 sleep(d).await;
13440 continue;
13441 }
13442 dlg.finished(false);
13443 return Err(common::Error::HttpError(err));
13444 }
13445 Ok(res) => {
13446 let (mut parts, body) = res.into_parts();
13447 let mut body = common::Body::new(body);
13448 if !parts.status.is_success() {
13449 let bytes = common::to_bytes(body).await.unwrap_or_default();
13450 let error = serde_json::from_str(&common::to_string(&bytes));
13451 let response = common::to_response(parts, bytes.into());
13452
13453 if let common::Retry::After(d) =
13454 dlg.http_failure(&response, error.as_ref().ok())
13455 {
13456 sleep(d).await;
13457 continue;
13458 }
13459
13460 dlg.finished(false);
13461
13462 return Err(match error {
13463 Ok(value) => common::Error::BadRequest(value),
13464 _ => common::Error::Failure(response),
13465 });
13466 }
13467 let response = {
13468 let bytes = common::to_bytes(body).await.unwrap_or_default();
13469 let encoded = common::to_string(&bytes);
13470 match serde_json::from_str(&encoded) {
13471 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13472 Err(error) => {
13473 dlg.response_json_decode_error(&encoded, &error);
13474 return Err(common::Error::JsonDecodeError(
13475 encoded.to_string(),
13476 error,
13477 ));
13478 }
13479 }
13480 };
13481
13482 dlg.finished(true);
13483 return Ok(response);
13484 }
13485 }
13486 }
13487 }
13488
13489 /// 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
13490 ///
13491 /// Sets the *name* path property to the given value.
13492 ///
13493 /// Even though the property as already been set when instantiating this call,
13494 /// we provide this method for API completeness.
13495 pub fn name(mut self, new_value: &str) -> NamespaceTaskGetCall<'a, C> {
13496 self._name = new_value.to_string();
13497 self
13498 }
13499 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13500 /// while executing the actual API request.
13501 ///
13502 /// ````text
13503 /// It should be used to handle progress information, and to implement a certain level of resilience.
13504 /// ````
13505 ///
13506 /// Sets the *delegate* property to the given value.
13507 pub fn delegate(
13508 mut self,
13509 new_value: &'a mut dyn common::Delegate,
13510 ) -> NamespaceTaskGetCall<'a, C> {
13511 self._delegate = Some(new_value);
13512 self
13513 }
13514
13515 /// Set any additional parameter of the query string used in the request.
13516 /// It should be used to set parameters which are not yet available through their own
13517 /// setters.
13518 ///
13519 /// Please note that this method must not be used to set any of the known parameters
13520 /// which have their own setter method. If done anyway, the request will fail.
13521 ///
13522 /// # Additional Parameters
13523 ///
13524 /// * *$.xgafv* (query-string) - V1 error format.
13525 /// * *access_token* (query-string) - OAuth access token.
13526 /// * *alt* (query-string) - Data format for response.
13527 /// * *callback* (query-string) - JSONP
13528 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13529 /// * *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.
13530 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13531 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13532 /// * *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.
13533 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13534 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13535 pub fn param<T>(mut self, name: T, value: T) -> NamespaceTaskGetCall<'a, C>
13536 where
13537 T: AsRef<str>,
13538 {
13539 self._additional_params
13540 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13541 self
13542 }
13543
13544 /// Identifies the authorization scope for the method you are building.
13545 ///
13546 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13547 /// [`Scope::CloudPlatform`].
13548 ///
13549 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13550 /// tokens for more than one scope.
13551 ///
13552 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13553 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13554 /// sufficient, a read-write scope will do as well.
13555 pub fn add_scope<St>(mut self, scope: St) -> NamespaceTaskGetCall<'a, C>
13556 where
13557 St: AsRef<str>,
13558 {
13559 self._scopes.insert(String::from(scope.as_ref()));
13560 self
13561 }
13562 /// Identifies the authorization scope(s) for the method you are building.
13563 ///
13564 /// See [`Self::add_scope()`] for details.
13565 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceTaskGetCall<'a, C>
13566 where
13567 I: IntoIterator<Item = St>,
13568 St: AsRef<str>,
13569 {
13570 self._scopes
13571 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13572 self
13573 }
13574
13575 /// Removes all scopes, and no default scope will be used either.
13576 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13577 /// for details).
13578 pub fn clear_scopes(mut self) -> NamespaceTaskGetCall<'a, C> {
13579 self._scopes.clear();
13580 self
13581 }
13582}
13583
13584/// List tasks.
13585///
13586/// A builder for the *tasks.list* method supported by a *namespace* resource.
13587/// It is not used directly, but through a [`NamespaceMethods`] instance.
13588///
13589/// # Example
13590///
13591/// Instantiate a resource method builder
13592///
13593/// ```test_harness,no_run
13594/// # extern crate hyper;
13595/// # extern crate hyper_rustls;
13596/// # extern crate google_run1 as run1;
13597/// # async fn dox() {
13598/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13599///
13600/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13601/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13602/// # .with_native_roots()
13603/// # .unwrap()
13604/// # .https_only()
13605/// # .enable_http2()
13606/// # .build();
13607///
13608/// # let executor = hyper_util::rt::TokioExecutor::new();
13609/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13610/// # secret,
13611/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13612/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13613/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13614/// # ),
13615/// # ).build().await.unwrap();
13616///
13617/// # let client = hyper_util::client::legacy::Client::builder(
13618/// # hyper_util::rt::TokioExecutor::new()
13619/// # )
13620/// # .build(
13621/// # hyper_rustls::HttpsConnectorBuilder::new()
13622/// # .with_native_roots()
13623/// # .unwrap()
13624/// # .https_or_http()
13625/// # .enable_http2()
13626/// # .build()
13627/// # );
13628/// # let mut hub = CloudRun::new(client, auth);
13629/// // You can configure optional parameters by calling the respective setters at will, and
13630/// // execute the final call using `doit()`.
13631/// // Values shown here are possibly random and not representative !
13632/// let result = hub.namespaces().tasks_list("parent")
13633/// .watch(true)
13634/// .resource_version("sadipscing")
13635/// .limit(-31)
13636/// .label_selector("aliquyam")
13637/// .include_uninitialized(true)
13638/// .field_selector("est")
13639/// .continue_("et")
13640/// .doit().await;
13641/// # }
13642/// ```
13643pub struct NamespaceTaskListCall<'a, C>
13644where
13645 C: 'a,
13646{
13647 hub: &'a CloudRun<C>,
13648 _parent: String,
13649 _watch: Option<bool>,
13650 _resource_version: Option<String>,
13651 _limit: Option<i32>,
13652 _label_selector: Option<String>,
13653 _include_uninitialized: Option<bool>,
13654 _field_selector: Option<String>,
13655 _continue_: Option<String>,
13656 _delegate: Option<&'a mut dyn common::Delegate>,
13657 _additional_params: HashMap<String, String>,
13658 _scopes: BTreeSet<String>,
13659}
13660
13661impl<'a, C> common::CallBuilder for NamespaceTaskListCall<'a, C> {}
13662
13663impl<'a, C> NamespaceTaskListCall<'a, C>
13664where
13665 C: common::Connector,
13666{
13667 /// Perform the operation you have build so far.
13668 pub async fn doit(mut self) -> common::Result<(common::Response, ListTasksResponse)> {
13669 use std::borrow::Cow;
13670 use std::io::{Read, Seek};
13671
13672 use common::{url::Params, ToParts};
13673 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13674
13675 let mut dd = common::DefaultDelegate;
13676 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13677 dlg.begin(common::MethodInfo {
13678 id: "run.namespaces.tasks.list",
13679 http_method: hyper::Method::GET,
13680 });
13681
13682 for &field in [
13683 "alt",
13684 "parent",
13685 "watch",
13686 "resourceVersion",
13687 "limit",
13688 "labelSelector",
13689 "includeUninitialized",
13690 "fieldSelector",
13691 "continue",
13692 ]
13693 .iter()
13694 {
13695 if self._additional_params.contains_key(field) {
13696 dlg.finished(false);
13697 return Err(common::Error::FieldClash(field));
13698 }
13699 }
13700
13701 let mut params = Params::with_capacity(10 + self._additional_params.len());
13702 params.push("parent", self._parent);
13703 if let Some(value) = self._watch.as_ref() {
13704 params.push("watch", value.to_string());
13705 }
13706 if let Some(value) = self._resource_version.as_ref() {
13707 params.push("resourceVersion", value);
13708 }
13709 if let Some(value) = self._limit.as_ref() {
13710 params.push("limit", value.to_string());
13711 }
13712 if let Some(value) = self._label_selector.as_ref() {
13713 params.push("labelSelector", value);
13714 }
13715 if let Some(value) = self._include_uninitialized.as_ref() {
13716 params.push("includeUninitialized", value.to_string());
13717 }
13718 if let Some(value) = self._field_selector.as_ref() {
13719 params.push("fieldSelector", value);
13720 }
13721 if let Some(value) = self._continue_.as_ref() {
13722 params.push("continue", value);
13723 }
13724
13725 params.extend(self._additional_params.iter());
13726
13727 params.push("alt", "json");
13728 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/tasks";
13729 if self._scopes.is_empty() {
13730 self._scopes
13731 .insert(Scope::CloudPlatform.as_ref().to_string());
13732 }
13733
13734 #[allow(clippy::single_element_loop)]
13735 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13736 url = params.uri_replacement(url, param_name, find_this, true);
13737 }
13738 {
13739 let to_remove = ["parent"];
13740 params.remove_params(&to_remove);
13741 }
13742
13743 let url = params.parse_with_url(&url);
13744
13745 loop {
13746 let token = match self
13747 .hub
13748 .auth
13749 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13750 .await
13751 {
13752 Ok(token) => token,
13753 Err(e) => match dlg.token(e) {
13754 Ok(token) => token,
13755 Err(e) => {
13756 dlg.finished(false);
13757 return Err(common::Error::MissingToken(e));
13758 }
13759 },
13760 };
13761 let mut req_result = {
13762 let client = &self.hub.client;
13763 dlg.pre_request();
13764 let mut req_builder = hyper::Request::builder()
13765 .method(hyper::Method::GET)
13766 .uri(url.as_str())
13767 .header(USER_AGENT, self.hub._user_agent.clone());
13768
13769 if let Some(token) = token.as_ref() {
13770 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13771 }
13772
13773 let request = req_builder
13774 .header(CONTENT_LENGTH, 0_u64)
13775 .body(common::to_body::<String>(None));
13776
13777 client.request(request.unwrap()).await
13778 };
13779
13780 match req_result {
13781 Err(err) => {
13782 if let common::Retry::After(d) = dlg.http_error(&err) {
13783 sleep(d).await;
13784 continue;
13785 }
13786 dlg.finished(false);
13787 return Err(common::Error::HttpError(err));
13788 }
13789 Ok(res) => {
13790 let (mut parts, body) = res.into_parts();
13791 let mut body = common::Body::new(body);
13792 if !parts.status.is_success() {
13793 let bytes = common::to_bytes(body).await.unwrap_or_default();
13794 let error = serde_json::from_str(&common::to_string(&bytes));
13795 let response = common::to_response(parts, bytes.into());
13796
13797 if let common::Retry::After(d) =
13798 dlg.http_failure(&response, error.as_ref().ok())
13799 {
13800 sleep(d).await;
13801 continue;
13802 }
13803
13804 dlg.finished(false);
13805
13806 return Err(match error {
13807 Ok(value) => common::Error::BadRequest(value),
13808 _ => common::Error::Failure(response),
13809 });
13810 }
13811 let response = {
13812 let bytes = common::to_bytes(body).await.unwrap_or_default();
13813 let encoded = common::to_string(&bytes);
13814 match serde_json::from_str(&encoded) {
13815 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13816 Err(error) => {
13817 dlg.response_json_decode_error(&encoded, &error);
13818 return Err(common::Error::JsonDecodeError(
13819 encoded.to_string(),
13820 error,
13821 ));
13822 }
13823 }
13824 };
13825
13826 dlg.finished(true);
13827 return Ok(response);
13828 }
13829 }
13830 }
13831 }
13832
13833 /// 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
13834 ///
13835 /// Sets the *parent* path property to the given value.
13836 ///
13837 /// Even though the property as already been set when instantiating this call,
13838 /// we provide this method for API completeness.
13839 pub fn parent(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13840 self._parent = new_value.to_string();
13841 self
13842 }
13843 /// Optional. Not supported by Cloud Run.
13844 ///
13845 /// Sets the *watch* query property to the given value.
13846 pub fn watch(mut self, new_value: bool) -> NamespaceTaskListCall<'a, C> {
13847 self._watch = Some(new_value);
13848 self
13849 }
13850 /// Optional. Not supported by Cloud Run.
13851 ///
13852 /// Sets the *resource version* query property to the given value.
13853 pub fn resource_version(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13854 self._resource_version = Some(new_value.to_string());
13855 self
13856 }
13857 /// Optional. The maximum number of records that should be returned.
13858 ///
13859 /// Sets the *limit* query property to the given value.
13860 pub fn limit(mut self, new_value: i32) -> NamespaceTaskListCall<'a, C> {
13861 self._limit = Some(new_value);
13862 self
13863 }
13864 /// 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.
13865 ///
13866 /// Sets the *label selector* query property to the given value.
13867 pub fn label_selector(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13868 self._label_selector = Some(new_value.to_string());
13869 self
13870 }
13871 /// Optional. Not supported by Cloud Run.
13872 ///
13873 /// Sets the *include uninitialized* query property to the given value.
13874 pub fn include_uninitialized(mut self, new_value: bool) -> NamespaceTaskListCall<'a, C> {
13875 self._include_uninitialized = Some(new_value);
13876 self
13877 }
13878 /// Optional. Not supported by Cloud Run.
13879 ///
13880 /// Sets the *field selector* query property to the given value.
13881 pub fn field_selector(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13882 self._field_selector = Some(new_value.to_string());
13883 self
13884 }
13885 /// Optional. Optional encoded string to continue paging.
13886 ///
13887 /// Sets the *continue* query property to the given value.
13888 pub fn continue_(mut self, new_value: &str) -> NamespaceTaskListCall<'a, C> {
13889 self._continue_ = Some(new_value.to_string());
13890 self
13891 }
13892 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13893 /// while executing the actual API request.
13894 ///
13895 /// ````text
13896 /// It should be used to handle progress information, and to implement a certain level of resilience.
13897 /// ````
13898 ///
13899 /// Sets the *delegate* property to the given value.
13900 pub fn delegate(
13901 mut self,
13902 new_value: &'a mut dyn common::Delegate,
13903 ) -> NamespaceTaskListCall<'a, C> {
13904 self._delegate = Some(new_value);
13905 self
13906 }
13907
13908 /// Set any additional parameter of the query string used in the request.
13909 /// It should be used to set parameters which are not yet available through their own
13910 /// setters.
13911 ///
13912 /// Please note that this method must not be used to set any of the known parameters
13913 /// which have their own setter method. If done anyway, the request will fail.
13914 ///
13915 /// # Additional Parameters
13916 ///
13917 /// * *$.xgafv* (query-string) - V1 error format.
13918 /// * *access_token* (query-string) - OAuth access token.
13919 /// * *alt* (query-string) - Data format for response.
13920 /// * *callback* (query-string) - JSONP
13921 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13922 /// * *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.
13923 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13924 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13925 /// * *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.
13926 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13927 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13928 pub fn param<T>(mut self, name: T, value: T) -> NamespaceTaskListCall<'a, C>
13929 where
13930 T: AsRef<str>,
13931 {
13932 self._additional_params
13933 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13934 self
13935 }
13936
13937 /// Identifies the authorization scope for the method you are building.
13938 ///
13939 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13940 /// [`Scope::CloudPlatform`].
13941 ///
13942 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13943 /// tokens for more than one scope.
13944 ///
13945 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13946 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13947 /// sufficient, a read-write scope will do as well.
13948 pub fn add_scope<St>(mut self, scope: St) -> NamespaceTaskListCall<'a, C>
13949 where
13950 St: AsRef<str>,
13951 {
13952 self._scopes.insert(String::from(scope.as_ref()));
13953 self
13954 }
13955 /// Identifies the authorization scope(s) for the method you are building.
13956 ///
13957 /// See [`Self::add_scope()`] for details.
13958 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceTaskListCall<'a, C>
13959 where
13960 I: IntoIterator<Item = St>,
13961 St: AsRef<str>,
13962 {
13963 self._scopes
13964 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13965 self
13966 }
13967
13968 /// Removes all scopes, and no default scope will be used either.
13969 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13970 /// for details).
13971 pub fn clear_scopes(mut self) -> NamespaceTaskListCall<'a, C> {
13972 self._scopes.clear();
13973 self
13974 }
13975}
13976
13977/// Creates a new WorkerPool. WorkerPool creation will trigger a new deployment. Use GetWorkerPool, and check worker_pool.status to determine if the WorkerPool is ready.
13978///
13979/// A builder for the *workerpools.create* method supported by a *namespace* resource.
13980/// It is not used directly, but through a [`NamespaceMethods`] instance.
13981///
13982/// # Example
13983///
13984/// Instantiate a resource method builder
13985///
13986/// ```test_harness,no_run
13987/// # extern crate hyper;
13988/// # extern crate hyper_rustls;
13989/// # extern crate google_run1 as run1;
13990/// use run1::api::WorkerPool;
13991/// # async fn dox() {
13992/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13993///
13994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13996/// # .with_native_roots()
13997/// # .unwrap()
13998/// # .https_only()
13999/// # .enable_http2()
14000/// # .build();
14001///
14002/// # let executor = hyper_util::rt::TokioExecutor::new();
14003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14004/// # secret,
14005/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14006/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14007/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14008/// # ),
14009/// # ).build().await.unwrap();
14010///
14011/// # let client = hyper_util::client::legacy::Client::builder(
14012/// # hyper_util::rt::TokioExecutor::new()
14013/// # )
14014/// # .build(
14015/// # hyper_rustls::HttpsConnectorBuilder::new()
14016/// # .with_native_roots()
14017/// # .unwrap()
14018/// # .https_or_http()
14019/// # .enable_http2()
14020/// # .build()
14021/// # );
14022/// # let mut hub = CloudRun::new(client, auth);
14023/// // As the method needs a request, you would usually fill it with the desired information
14024/// // into the respective structure. Some of the parts shown here might not be applicable !
14025/// // Values shown here are possibly random and not representative !
14026/// let mut req = WorkerPool::default();
14027///
14028/// // You can configure optional parameters by calling the respective setters at will, and
14029/// // execute the final call using `doit()`.
14030/// // Values shown here are possibly random and not representative !
14031/// let result = hub.namespaces().workerpools_create(req, "parent")
14032/// .dry_run("consetetur")
14033/// .doit().await;
14034/// # }
14035/// ```
14036pub struct NamespaceWorkerpoolCreateCall<'a, C>
14037where
14038 C: 'a,
14039{
14040 hub: &'a CloudRun<C>,
14041 _request: WorkerPool,
14042 _parent: String,
14043 _dry_run: Option<String>,
14044 _delegate: Option<&'a mut dyn common::Delegate>,
14045 _additional_params: HashMap<String, String>,
14046 _scopes: BTreeSet<String>,
14047}
14048
14049impl<'a, C> common::CallBuilder for NamespaceWorkerpoolCreateCall<'a, C> {}
14050
14051impl<'a, C> NamespaceWorkerpoolCreateCall<'a, C>
14052where
14053 C: common::Connector,
14054{
14055 /// Perform the operation you have build so far.
14056 pub async fn doit(mut self) -> common::Result<(common::Response, WorkerPool)> {
14057 use std::borrow::Cow;
14058 use std::io::{Read, Seek};
14059
14060 use common::{url::Params, ToParts};
14061 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14062
14063 let mut dd = common::DefaultDelegate;
14064 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14065 dlg.begin(common::MethodInfo {
14066 id: "run.namespaces.workerpools.create",
14067 http_method: hyper::Method::POST,
14068 });
14069
14070 for &field in ["alt", "parent", "dryRun"].iter() {
14071 if self._additional_params.contains_key(field) {
14072 dlg.finished(false);
14073 return Err(common::Error::FieldClash(field));
14074 }
14075 }
14076
14077 let mut params = Params::with_capacity(5 + self._additional_params.len());
14078 params.push("parent", self._parent);
14079 if let Some(value) = self._dry_run.as_ref() {
14080 params.push("dryRun", value);
14081 }
14082
14083 params.extend(self._additional_params.iter());
14084
14085 params.push("alt", "json");
14086 let mut url =
14087 self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/workerpools";
14088 if self._scopes.is_empty() {
14089 self._scopes
14090 .insert(Scope::CloudPlatform.as_ref().to_string());
14091 }
14092
14093 #[allow(clippy::single_element_loop)]
14094 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14095 url = params.uri_replacement(url, param_name, find_this, true);
14096 }
14097 {
14098 let to_remove = ["parent"];
14099 params.remove_params(&to_remove);
14100 }
14101
14102 let url = params.parse_with_url(&url);
14103
14104 let mut json_mime_type = mime::APPLICATION_JSON;
14105 let mut request_value_reader = {
14106 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14107 common::remove_json_null_values(&mut value);
14108 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14109 serde_json::to_writer(&mut dst, &value).unwrap();
14110 dst
14111 };
14112 let request_size = request_value_reader
14113 .seek(std::io::SeekFrom::End(0))
14114 .unwrap();
14115 request_value_reader
14116 .seek(std::io::SeekFrom::Start(0))
14117 .unwrap();
14118
14119 loop {
14120 let token = match self
14121 .hub
14122 .auth
14123 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14124 .await
14125 {
14126 Ok(token) => token,
14127 Err(e) => match dlg.token(e) {
14128 Ok(token) => token,
14129 Err(e) => {
14130 dlg.finished(false);
14131 return Err(common::Error::MissingToken(e));
14132 }
14133 },
14134 };
14135 request_value_reader
14136 .seek(std::io::SeekFrom::Start(0))
14137 .unwrap();
14138 let mut req_result = {
14139 let client = &self.hub.client;
14140 dlg.pre_request();
14141 let mut req_builder = hyper::Request::builder()
14142 .method(hyper::Method::POST)
14143 .uri(url.as_str())
14144 .header(USER_AGENT, self.hub._user_agent.clone());
14145
14146 if let Some(token) = token.as_ref() {
14147 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14148 }
14149
14150 let request = req_builder
14151 .header(CONTENT_TYPE, json_mime_type.to_string())
14152 .header(CONTENT_LENGTH, request_size as u64)
14153 .body(common::to_body(
14154 request_value_reader.get_ref().clone().into(),
14155 ));
14156
14157 client.request(request.unwrap()).await
14158 };
14159
14160 match req_result {
14161 Err(err) => {
14162 if let common::Retry::After(d) = dlg.http_error(&err) {
14163 sleep(d).await;
14164 continue;
14165 }
14166 dlg.finished(false);
14167 return Err(common::Error::HttpError(err));
14168 }
14169 Ok(res) => {
14170 let (mut parts, body) = res.into_parts();
14171 let mut body = common::Body::new(body);
14172 if !parts.status.is_success() {
14173 let bytes = common::to_bytes(body).await.unwrap_or_default();
14174 let error = serde_json::from_str(&common::to_string(&bytes));
14175 let response = common::to_response(parts, bytes.into());
14176
14177 if let common::Retry::After(d) =
14178 dlg.http_failure(&response, error.as_ref().ok())
14179 {
14180 sleep(d).await;
14181 continue;
14182 }
14183
14184 dlg.finished(false);
14185
14186 return Err(match error {
14187 Ok(value) => common::Error::BadRequest(value),
14188 _ => common::Error::Failure(response),
14189 });
14190 }
14191 let response = {
14192 let bytes = common::to_bytes(body).await.unwrap_or_default();
14193 let encoded = common::to_string(&bytes);
14194 match serde_json::from_str(&encoded) {
14195 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14196 Err(error) => {
14197 dlg.response_json_decode_error(&encoded, &error);
14198 return Err(common::Error::JsonDecodeError(
14199 encoded.to_string(),
14200 error,
14201 ));
14202 }
14203 }
14204 };
14205
14206 dlg.finished(true);
14207 return Ok(response);
14208 }
14209 }
14210 }
14211 }
14212
14213 ///
14214 /// Sets the *request* property to the given value.
14215 ///
14216 /// Even though the property as already been set when instantiating this call,
14217 /// we provide this method for API completeness.
14218 pub fn request(mut self, new_value: WorkerPool) -> NamespaceWorkerpoolCreateCall<'a, C> {
14219 self._request = new_value;
14220 self
14221 }
14222 /// 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}/workerpools` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
14223 ///
14224 /// Sets the *parent* path property to the given value.
14225 ///
14226 /// Even though the property as already been set when instantiating this call,
14227 /// we provide this method for API completeness.
14228 pub fn parent(mut self, new_value: &str) -> NamespaceWorkerpoolCreateCall<'a, C> {
14229 self._parent = new_value.to_string();
14230 self
14231 }
14232 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
14233 ///
14234 /// Sets the *dry run* query property to the given value.
14235 pub fn dry_run(mut self, new_value: &str) -> NamespaceWorkerpoolCreateCall<'a, C> {
14236 self._dry_run = Some(new_value.to_string());
14237 self
14238 }
14239 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14240 /// while executing the actual API request.
14241 ///
14242 /// ````text
14243 /// It should be used to handle progress information, and to implement a certain level of resilience.
14244 /// ````
14245 ///
14246 /// Sets the *delegate* property to the given value.
14247 pub fn delegate(
14248 mut self,
14249 new_value: &'a mut dyn common::Delegate,
14250 ) -> NamespaceWorkerpoolCreateCall<'a, C> {
14251 self._delegate = Some(new_value);
14252 self
14253 }
14254
14255 /// Set any additional parameter of the query string used in the request.
14256 /// It should be used to set parameters which are not yet available through their own
14257 /// setters.
14258 ///
14259 /// Please note that this method must not be used to set any of the known parameters
14260 /// which have their own setter method. If done anyway, the request will fail.
14261 ///
14262 /// # Additional Parameters
14263 ///
14264 /// * *$.xgafv* (query-string) - V1 error format.
14265 /// * *access_token* (query-string) - OAuth access token.
14266 /// * *alt* (query-string) - Data format for response.
14267 /// * *callback* (query-string) - JSONP
14268 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14269 /// * *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.
14270 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14271 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14272 /// * *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.
14273 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14274 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14275 pub fn param<T>(mut self, name: T, value: T) -> NamespaceWorkerpoolCreateCall<'a, C>
14276 where
14277 T: AsRef<str>,
14278 {
14279 self._additional_params
14280 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14281 self
14282 }
14283
14284 /// Identifies the authorization scope for the method you are building.
14285 ///
14286 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14287 /// [`Scope::CloudPlatform`].
14288 ///
14289 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14290 /// tokens for more than one scope.
14291 ///
14292 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14293 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14294 /// sufficient, a read-write scope will do as well.
14295 pub fn add_scope<St>(mut self, scope: St) -> NamespaceWorkerpoolCreateCall<'a, C>
14296 where
14297 St: AsRef<str>,
14298 {
14299 self._scopes.insert(String::from(scope.as_ref()));
14300 self
14301 }
14302 /// Identifies the authorization scope(s) for the method you are building.
14303 ///
14304 /// See [`Self::add_scope()`] for details.
14305 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceWorkerpoolCreateCall<'a, C>
14306 where
14307 I: IntoIterator<Item = St>,
14308 St: AsRef<str>,
14309 {
14310 self._scopes
14311 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14312 self
14313 }
14314
14315 /// Removes all scopes, and no default scope will be used either.
14316 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14317 /// for details).
14318 pub fn clear_scopes(mut self) -> NamespaceWorkerpoolCreateCall<'a, C> {
14319 self._scopes.clear();
14320 self
14321 }
14322}
14323
14324/// Deletes the provided worker pool. This will cause the WorkerPool to stop all instances and will delete all associated WorkerPoolRevisions.
14325///
14326/// A builder for the *workerpools.delete* method supported by a *namespace* resource.
14327/// It is not used directly, but through a [`NamespaceMethods`] instance.
14328///
14329/// # Example
14330///
14331/// Instantiate a resource method builder
14332///
14333/// ```test_harness,no_run
14334/// # extern crate hyper;
14335/// # extern crate hyper_rustls;
14336/// # extern crate google_run1 as run1;
14337/// # async fn dox() {
14338/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14339///
14340/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14341/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14342/// # .with_native_roots()
14343/// # .unwrap()
14344/// # .https_only()
14345/// # .enable_http2()
14346/// # .build();
14347///
14348/// # let executor = hyper_util::rt::TokioExecutor::new();
14349/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14350/// # secret,
14351/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14352/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14353/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14354/// # ),
14355/// # ).build().await.unwrap();
14356///
14357/// # let client = hyper_util::client::legacy::Client::builder(
14358/// # hyper_util::rt::TokioExecutor::new()
14359/// # )
14360/// # .build(
14361/// # hyper_rustls::HttpsConnectorBuilder::new()
14362/// # .with_native_roots()
14363/// # .unwrap()
14364/// # .https_or_http()
14365/// # .enable_http2()
14366/// # .build()
14367/// # );
14368/// # let mut hub = CloudRun::new(client, auth);
14369/// // You can configure optional parameters by calling the respective setters at will, and
14370/// // execute the final call using `doit()`.
14371/// // Values shown here are possibly random and not representative !
14372/// let result = hub.namespaces().workerpools_delete("name")
14373/// .dry_run("Stet")
14374/// .doit().await;
14375/// # }
14376/// ```
14377pub struct NamespaceWorkerpoolDeleteCall<'a, C>
14378where
14379 C: 'a,
14380{
14381 hub: &'a CloudRun<C>,
14382 _name: String,
14383 _dry_run: Option<String>,
14384 _delegate: Option<&'a mut dyn common::Delegate>,
14385 _additional_params: HashMap<String, String>,
14386 _scopes: BTreeSet<String>,
14387}
14388
14389impl<'a, C> common::CallBuilder for NamespaceWorkerpoolDeleteCall<'a, C> {}
14390
14391impl<'a, C> NamespaceWorkerpoolDeleteCall<'a, C>
14392where
14393 C: common::Connector,
14394{
14395 /// Perform the operation you have build so far.
14396 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
14397 use std::borrow::Cow;
14398 use std::io::{Read, Seek};
14399
14400 use common::{url::Params, ToParts};
14401 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14402
14403 let mut dd = common::DefaultDelegate;
14404 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14405 dlg.begin(common::MethodInfo {
14406 id: "run.namespaces.workerpools.delete",
14407 http_method: hyper::Method::DELETE,
14408 });
14409
14410 for &field in ["alt", "name", "dryRun"].iter() {
14411 if self._additional_params.contains_key(field) {
14412 dlg.finished(false);
14413 return Err(common::Error::FieldClash(field));
14414 }
14415 }
14416
14417 let mut params = Params::with_capacity(4 + self._additional_params.len());
14418 params.push("name", self._name);
14419 if let Some(value) = self._dry_run.as_ref() {
14420 params.push("dryRun", value);
14421 }
14422
14423 params.extend(self._additional_params.iter());
14424
14425 params.push("alt", "json");
14426 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
14427 if self._scopes.is_empty() {
14428 self._scopes
14429 .insert(Scope::CloudPlatform.as_ref().to_string());
14430 }
14431
14432 #[allow(clippy::single_element_loop)]
14433 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14434 url = params.uri_replacement(url, param_name, find_this, true);
14435 }
14436 {
14437 let to_remove = ["name"];
14438 params.remove_params(&to_remove);
14439 }
14440
14441 let url = params.parse_with_url(&url);
14442
14443 loop {
14444 let token = match self
14445 .hub
14446 .auth
14447 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14448 .await
14449 {
14450 Ok(token) => token,
14451 Err(e) => match dlg.token(e) {
14452 Ok(token) => token,
14453 Err(e) => {
14454 dlg.finished(false);
14455 return Err(common::Error::MissingToken(e));
14456 }
14457 },
14458 };
14459 let mut req_result = {
14460 let client = &self.hub.client;
14461 dlg.pre_request();
14462 let mut req_builder = hyper::Request::builder()
14463 .method(hyper::Method::DELETE)
14464 .uri(url.as_str())
14465 .header(USER_AGENT, self.hub._user_agent.clone());
14466
14467 if let Some(token) = token.as_ref() {
14468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14469 }
14470
14471 let request = req_builder
14472 .header(CONTENT_LENGTH, 0_u64)
14473 .body(common::to_body::<String>(None));
14474
14475 client.request(request.unwrap()).await
14476 };
14477
14478 match req_result {
14479 Err(err) => {
14480 if let common::Retry::After(d) = dlg.http_error(&err) {
14481 sleep(d).await;
14482 continue;
14483 }
14484 dlg.finished(false);
14485 return Err(common::Error::HttpError(err));
14486 }
14487 Ok(res) => {
14488 let (mut parts, body) = res.into_parts();
14489 let mut body = common::Body::new(body);
14490 if !parts.status.is_success() {
14491 let bytes = common::to_bytes(body).await.unwrap_or_default();
14492 let error = serde_json::from_str(&common::to_string(&bytes));
14493 let response = common::to_response(parts, bytes.into());
14494
14495 if let common::Retry::After(d) =
14496 dlg.http_failure(&response, error.as_ref().ok())
14497 {
14498 sleep(d).await;
14499 continue;
14500 }
14501
14502 dlg.finished(false);
14503
14504 return Err(match error {
14505 Ok(value) => common::Error::BadRequest(value),
14506 _ => common::Error::Failure(response),
14507 });
14508 }
14509 let response = {
14510 let bytes = common::to_bytes(body).await.unwrap_or_default();
14511 let encoded = common::to_string(&bytes);
14512 match serde_json::from_str(&encoded) {
14513 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14514 Err(error) => {
14515 dlg.response_json_decode_error(&encoded, &error);
14516 return Err(common::Error::JsonDecodeError(
14517 encoded.to_string(),
14518 error,
14519 ));
14520 }
14521 }
14522 };
14523
14524 dlg.finished(true);
14525 return Ok(response);
14526 }
14527 }
14528 }
14529 }
14530
14531 /// Required. The fully qualified name of the worker pool to delete. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
14532 ///
14533 /// Sets the *name* path property to the given value.
14534 ///
14535 /// Even though the property as already been set when instantiating this call,
14536 /// we provide this method for API completeness.
14537 pub fn name(mut self, new_value: &str) -> NamespaceWorkerpoolDeleteCall<'a, C> {
14538 self._name = new_value.to_string();
14539 self
14540 }
14541 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
14542 ///
14543 /// Sets the *dry run* query property to the given value.
14544 pub fn dry_run(mut self, new_value: &str) -> NamespaceWorkerpoolDeleteCall<'a, C> {
14545 self._dry_run = Some(new_value.to_string());
14546 self
14547 }
14548 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14549 /// while executing the actual API request.
14550 ///
14551 /// ````text
14552 /// It should be used to handle progress information, and to implement a certain level of resilience.
14553 /// ````
14554 ///
14555 /// Sets the *delegate* property to the given value.
14556 pub fn delegate(
14557 mut self,
14558 new_value: &'a mut dyn common::Delegate,
14559 ) -> NamespaceWorkerpoolDeleteCall<'a, C> {
14560 self._delegate = Some(new_value);
14561 self
14562 }
14563
14564 /// Set any additional parameter of the query string used in the request.
14565 /// It should be used to set parameters which are not yet available through their own
14566 /// setters.
14567 ///
14568 /// Please note that this method must not be used to set any of the known parameters
14569 /// which have their own setter method. If done anyway, the request will fail.
14570 ///
14571 /// # Additional Parameters
14572 ///
14573 /// * *$.xgafv* (query-string) - V1 error format.
14574 /// * *access_token* (query-string) - OAuth access token.
14575 /// * *alt* (query-string) - Data format for response.
14576 /// * *callback* (query-string) - JSONP
14577 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14578 /// * *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.
14579 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14580 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14581 /// * *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.
14582 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14583 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14584 pub fn param<T>(mut self, name: T, value: T) -> NamespaceWorkerpoolDeleteCall<'a, C>
14585 where
14586 T: AsRef<str>,
14587 {
14588 self._additional_params
14589 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14590 self
14591 }
14592
14593 /// Identifies the authorization scope for the method you are building.
14594 ///
14595 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14596 /// [`Scope::CloudPlatform`].
14597 ///
14598 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14599 /// tokens for more than one scope.
14600 ///
14601 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14602 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14603 /// sufficient, a read-write scope will do as well.
14604 pub fn add_scope<St>(mut self, scope: St) -> NamespaceWorkerpoolDeleteCall<'a, C>
14605 where
14606 St: AsRef<str>,
14607 {
14608 self._scopes.insert(String::from(scope.as_ref()));
14609 self
14610 }
14611 /// Identifies the authorization scope(s) for the method you are building.
14612 ///
14613 /// See [`Self::add_scope()`] for details.
14614 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceWorkerpoolDeleteCall<'a, C>
14615 where
14616 I: IntoIterator<Item = St>,
14617 St: AsRef<str>,
14618 {
14619 self._scopes
14620 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14621 self
14622 }
14623
14624 /// Removes all scopes, and no default scope will be used either.
14625 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14626 /// for details).
14627 pub fn clear_scopes(mut self) -> NamespaceWorkerpoolDeleteCall<'a, C> {
14628 self._scopes.clear();
14629 self
14630 }
14631}
14632
14633/// Gets information about a worker pool.
14634///
14635/// A builder for the *workerpools.get* method supported by a *namespace* resource.
14636/// It is not used directly, but through a [`NamespaceMethods`] instance.
14637///
14638/// # Example
14639///
14640/// Instantiate a resource method builder
14641///
14642/// ```test_harness,no_run
14643/// # extern crate hyper;
14644/// # extern crate hyper_rustls;
14645/// # extern crate google_run1 as run1;
14646/// # async fn dox() {
14647/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14648///
14649/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14650/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14651/// # .with_native_roots()
14652/// # .unwrap()
14653/// # .https_only()
14654/// # .enable_http2()
14655/// # .build();
14656///
14657/// # let executor = hyper_util::rt::TokioExecutor::new();
14658/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14659/// # secret,
14660/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14661/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14662/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14663/// # ),
14664/// # ).build().await.unwrap();
14665///
14666/// # let client = hyper_util::client::legacy::Client::builder(
14667/// # hyper_util::rt::TokioExecutor::new()
14668/// # )
14669/// # .build(
14670/// # hyper_rustls::HttpsConnectorBuilder::new()
14671/// # .with_native_roots()
14672/// # .unwrap()
14673/// # .https_or_http()
14674/// # .enable_http2()
14675/// # .build()
14676/// # );
14677/// # let mut hub = CloudRun::new(client, auth);
14678/// // You can configure optional parameters by calling the respective setters at will, and
14679/// // execute the final call using `doit()`.
14680/// // Values shown here are possibly random and not representative !
14681/// let result = hub.namespaces().workerpools_get("name")
14682/// .doit().await;
14683/// # }
14684/// ```
14685pub struct NamespaceWorkerpoolGetCall<'a, C>
14686where
14687 C: 'a,
14688{
14689 hub: &'a CloudRun<C>,
14690 _name: String,
14691 _delegate: Option<&'a mut dyn common::Delegate>,
14692 _additional_params: HashMap<String, String>,
14693 _scopes: BTreeSet<String>,
14694}
14695
14696impl<'a, C> common::CallBuilder for NamespaceWorkerpoolGetCall<'a, C> {}
14697
14698impl<'a, C> NamespaceWorkerpoolGetCall<'a, C>
14699where
14700 C: common::Connector,
14701{
14702 /// Perform the operation you have build so far.
14703 pub async fn doit(mut self) -> common::Result<(common::Response, WorkerPool)> {
14704 use std::borrow::Cow;
14705 use std::io::{Read, Seek};
14706
14707 use common::{url::Params, ToParts};
14708 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14709
14710 let mut dd = common::DefaultDelegate;
14711 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14712 dlg.begin(common::MethodInfo {
14713 id: "run.namespaces.workerpools.get",
14714 http_method: hyper::Method::GET,
14715 });
14716
14717 for &field in ["alt", "name"].iter() {
14718 if self._additional_params.contains_key(field) {
14719 dlg.finished(false);
14720 return Err(common::Error::FieldClash(field));
14721 }
14722 }
14723
14724 let mut params = Params::with_capacity(3 + self._additional_params.len());
14725 params.push("name", self._name);
14726
14727 params.extend(self._additional_params.iter());
14728
14729 params.push("alt", "json");
14730 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
14731 if self._scopes.is_empty() {
14732 self._scopes
14733 .insert(Scope::CloudPlatform.as_ref().to_string());
14734 }
14735
14736 #[allow(clippy::single_element_loop)]
14737 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14738 url = params.uri_replacement(url, param_name, find_this, true);
14739 }
14740 {
14741 let to_remove = ["name"];
14742 params.remove_params(&to_remove);
14743 }
14744
14745 let url = params.parse_with_url(&url);
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 let mut req_result = {
14764 let client = &self.hub.client;
14765 dlg.pre_request();
14766 let mut req_builder = hyper::Request::builder()
14767 .method(hyper::Method::GET)
14768 .uri(url.as_str())
14769 .header(USER_AGENT, self.hub._user_agent.clone());
14770
14771 if let Some(token) = token.as_ref() {
14772 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14773 }
14774
14775 let request = req_builder
14776 .header(CONTENT_LENGTH, 0_u64)
14777 .body(common::to_body::<String>(None));
14778
14779 client.request(request.unwrap()).await
14780 };
14781
14782 match req_result {
14783 Err(err) => {
14784 if let common::Retry::After(d) = dlg.http_error(&err) {
14785 sleep(d).await;
14786 continue;
14787 }
14788 dlg.finished(false);
14789 return Err(common::Error::HttpError(err));
14790 }
14791 Ok(res) => {
14792 let (mut parts, body) = res.into_parts();
14793 let mut body = common::Body::new(body);
14794 if !parts.status.is_success() {
14795 let bytes = common::to_bytes(body).await.unwrap_or_default();
14796 let error = serde_json::from_str(&common::to_string(&bytes));
14797 let response = common::to_response(parts, bytes.into());
14798
14799 if let common::Retry::After(d) =
14800 dlg.http_failure(&response, error.as_ref().ok())
14801 {
14802 sleep(d).await;
14803 continue;
14804 }
14805
14806 dlg.finished(false);
14807
14808 return Err(match error {
14809 Ok(value) => common::Error::BadRequest(value),
14810 _ => common::Error::Failure(response),
14811 });
14812 }
14813 let response = {
14814 let bytes = common::to_bytes(body).await.unwrap_or_default();
14815 let encoded = common::to_string(&bytes);
14816 match serde_json::from_str(&encoded) {
14817 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14818 Err(error) => {
14819 dlg.response_json_decode_error(&encoded, &error);
14820 return Err(common::Error::JsonDecodeError(
14821 encoded.to_string(),
14822 error,
14823 ));
14824 }
14825 }
14826 };
14827
14828 dlg.finished(true);
14829 return Ok(response);
14830 }
14831 }
14832 }
14833 }
14834
14835 /// Required. The fully qualified name of the worker pool to retrieve. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
14836 ///
14837 /// Sets the *name* path property to the given value.
14838 ///
14839 /// Even though the property as already been set when instantiating this call,
14840 /// we provide this method for API completeness.
14841 pub fn name(mut self, new_value: &str) -> NamespaceWorkerpoolGetCall<'a, C> {
14842 self._name = new_value.to_string();
14843 self
14844 }
14845 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14846 /// while executing the actual API request.
14847 ///
14848 /// ````text
14849 /// It should be used to handle progress information, and to implement a certain level of resilience.
14850 /// ````
14851 ///
14852 /// Sets the *delegate* property to the given value.
14853 pub fn delegate(
14854 mut self,
14855 new_value: &'a mut dyn common::Delegate,
14856 ) -> NamespaceWorkerpoolGetCall<'a, C> {
14857 self._delegate = Some(new_value);
14858 self
14859 }
14860
14861 /// Set any additional parameter of the query string used in the request.
14862 /// It should be used to set parameters which are not yet available through their own
14863 /// setters.
14864 ///
14865 /// Please note that this method must not be used to set any of the known parameters
14866 /// which have their own setter method. If done anyway, the request will fail.
14867 ///
14868 /// # Additional Parameters
14869 ///
14870 /// * *$.xgafv* (query-string) - V1 error format.
14871 /// * *access_token* (query-string) - OAuth access token.
14872 /// * *alt* (query-string) - Data format for response.
14873 /// * *callback* (query-string) - JSONP
14874 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14875 /// * *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.
14876 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14877 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14878 /// * *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.
14879 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14880 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14881 pub fn param<T>(mut self, name: T, value: T) -> NamespaceWorkerpoolGetCall<'a, C>
14882 where
14883 T: AsRef<str>,
14884 {
14885 self._additional_params
14886 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14887 self
14888 }
14889
14890 /// Identifies the authorization scope for the method you are building.
14891 ///
14892 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14893 /// [`Scope::CloudPlatform`].
14894 ///
14895 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14896 /// tokens for more than one scope.
14897 ///
14898 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14899 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14900 /// sufficient, a read-write scope will do as well.
14901 pub fn add_scope<St>(mut self, scope: St) -> NamespaceWorkerpoolGetCall<'a, C>
14902 where
14903 St: AsRef<str>,
14904 {
14905 self._scopes.insert(String::from(scope.as_ref()));
14906 self
14907 }
14908 /// Identifies the authorization scope(s) for the method you are building.
14909 ///
14910 /// See [`Self::add_scope()`] for details.
14911 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceWorkerpoolGetCall<'a, C>
14912 where
14913 I: IntoIterator<Item = St>,
14914 St: AsRef<str>,
14915 {
14916 self._scopes
14917 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14918 self
14919 }
14920
14921 /// Removes all scopes, and no default scope will be used either.
14922 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14923 /// for details).
14924 pub fn clear_scopes(mut self) -> NamespaceWorkerpoolGetCall<'a, C> {
14925 self._scopes.clear();
14926 self
14927 }
14928}
14929
14930/// Lists worker pools for the given project and region. Results are sorted by creation time, descending.
14931///
14932/// A builder for the *workerpools.list* method supported by a *namespace* resource.
14933/// It is not used directly, but through a [`NamespaceMethods`] instance.
14934///
14935/// # Example
14936///
14937/// Instantiate a resource method builder
14938///
14939/// ```test_harness,no_run
14940/// # extern crate hyper;
14941/// # extern crate hyper_rustls;
14942/// # extern crate google_run1 as run1;
14943/// # async fn dox() {
14944/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14945///
14946/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14947/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14948/// # .with_native_roots()
14949/// # .unwrap()
14950/// # .https_only()
14951/// # .enable_http2()
14952/// # .build();
14953///
14954/// # let executor = hyper_util::rt::TokioExecutor::new();
14955/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14956/// # secret,
14957/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14958/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14959/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14960/// # ),
14961/// # ).build().await.unwrap();
14962///
14963/// # let client = hyper_util::client::legacy::Client::builder(
14964/// # hyper_util::rt::TokioExecutor::new()
14965/// # )
14966/// # .build(
14967/// # hyper_rustls::HttpsConnectorBuilder::new()
14968/// # .with_native_roots()
14969/// # .unwrap()
14970/// # .https_or_http()
14971/// # .enable_http2()
14972/// # .build()
14973/// # );
14974/// # let mut hub = CloudRun::new(client, auth);
14975/// // You can configure optional parameters by calling the respective setters at will, and
14976/// // execute the final call using `doit()`.
14977/// // Values shown here are possibly random and not representative !
14978/// let result = hub.namespaces().workerpools_list("parent")
14979/// .limit(-94)
14980/// .label_selector("duo")
14981/// .continue_("diam")
14982/// .doit().await;
14983/// # }
14984/// ```
14985pub struct NamespaceWorkerpoolListCall<'a, C>
14986where
14987 C: 'a,
14988{
14989 hub: &'a CloudRun<C>,
14990 _parent: String,
14991 _limit: Option<i32>,
14992 _label_selector: Option<String>,
14993 _continue_: Option<String>,
14994 _delegate: Option<&'a mut dyn common::Delegate>,
14995 _additional_params: HashMap<String, String>,
14996 _scopes: BTreeSet<String>,
14997}
14998
14999impl<'a, C> common::CallBuilder for NamespaceWorkerpoolListCall<'a, C> {}
15000
15001impl<'a, C> NamespaceWorkerpoolListCall<'a, C>
15002where
15003 C: common::Connector,
15004{
15005 /// Perform the operation you have build so far.
15006 pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkerPoolsResponse)> {
15007 use std::borrow::Cow;
15008 use std::io::{Read, Seek};
15009
15010 use common::{url::Params, ToParts};
15011 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15012
15013 let mut dd = common::DefaultDelegate;
15014 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15015 dlg.begin(common::MethodInfo {
15016 id: "run.namespaces.workerpools.list",
15017 http_method: hyper::Method::GET,
15018 });
15019
15020 for &field in ["alt", "parent", "limit", "labelSelector", "continue"].iter() {
15021 if self._additional_params.contains_key(field) {
15022 dlg.finished(false);
15023 return Err(common::Error::FieldClash(field));
15024 }
15025 }
15026
15027 let mut params = Params::with_capacity(6 + self._additional_params.len());
15028 params.push("parent", self._parent);
15029 if let Some(value) = self._limit.as_ref() {
15030 params.push("limit", value.to_string());
15031 }
15032 if let Some(value) = self._label_selector.as_ref() {
15033 params.push("labelSelector", value);
15034 }
15035 if let Some(value) = self._continue_.as_ref() {
15036 params.push("continue", value);
15037 }
15038
15039 params.extend(self._additional_params.iter());
15040
15041 params.push("alt", "json");
15042 let mut url =
15043 self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+parent}/workerpools";
15044 if self._scopes.is_empty() {
15045 self._scopes
15046 .insert(Scope::CloudPlatform.as_ref().to_string());
15047 }
15048
15049 #[allow(clippy::single_element_loop)]
15050 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15051 url = params.uri_replacement(url, param_name, find_this, true);
15052 }
15053 {
15054 let to_remove = ["parent"];
15055 params.remove_params(&to_remove);
15056 }
15057
15058 let url = params.parse_with_url(&url);
15059
15060 loop {
15061 let token = match self
15062 .hub
15063 .auth
15064 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15065 .await
15066 {
15067 Ok(token) => token,
15068 Err(e) => match dlg.token(e) {
15069 Ok(token) => token,
15070 Err(e) => {
15071 dlg.finished(false);
15072 return Err(common::Error::MissingToken(e));
15073 }
15074 },
15075 };
15076 let mut req_result = {
15077 let client = &self.hub.client;
15078 dlg.pre_request();
15079 let mut req_builder = hyper::Request::builder()
15080 .method(hyper::Method::GET)
15081 .uri(url.as_str())
15082 .header(USER_AGENT, self.hub._user_agent.clone());
15083
15084 if let Some(token) = token.as_ref() {
15085 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15086 }
15087
15088 let request = req_builder
15089 .header(CONTENT_LENGTH, 0_u64)
15090 .body(common::to_body::<String>(None));
15091
15092 client.request(request.unwrap()).await
15093 };
15094
15095 match req_result {
15096 Err(err) => {
15097 if let common::Retry::After(d) = dlg.http_error(&err) {
15098 sleep(d).await;
15099 continue;
15100 }
15101 dlg.finished(false);
15102 return Err(common::Error::HttpError(err));
15103 }
15104 Ok(res) => {
15105 let (mut parts, body) = res.into_parts();
15106 let mut body = common::Body::new(body);
15107 if !parts.status.is_success() {
15108 let bytes = common::to_bytes(body).await.unwrap_or_default();
15109 let error = serde_json::from_str(&common::to_string(&bytes));
15110 let response = common::to_response(parts, bytes.into());
15111
15112 if let common::Retry::After(d) =
15113 dlg.http_failure(&response, error.as_ref().ok())
15114 {
15115 sleep(d).await;
15116 continue;
15117 }
15118
15119 dlg.finished(false);
15120
15121 return Err(match error {
15122 Ok(value) => common::Error::BadRequest(value),
15123 _ => common::Error::Failure(response),
15124 });
15125 }
15126 let response = {
15127 let bytes = common::to_bytes(body).await.unwrap_or_default();
15128 let encoded = common::to_string(&bytes);
15129 match serde_json::from_str(&encoded) {
15130 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15131 Err(error) => {
15132 dlg.response_json_decode_error(&encoded, &error);
15133 return Err(common::Error::JsonDecodeError(
15134 encoded.to_string(),
15135 error,
15136 ));
15137 }
15138 }
15139 };
15140
15141 dlg.finished(true);
15142 return Ok(response);
15143 }
15144 }
15145 }
15146 }
15147
15148 /// 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}/workerpools` * `projects/{project_id_or_number}/locations/{region}` * `projects/{project_id_or_number}/regions/{region}`
15149 ///
15150 /// Sets the *parent* path property to the given value.
15151 ///
15152 /// Even though the property as already been set when instantiating this call,
15153 /// we provide this method for API completeness.
15154 pub fn parent(mut self, new_value: &str) -> NamespaceWorkerpoolListCall<'a, C> {
15155 self._parent = new_value.to_string();
15156 self
15157 }
15158 /// The maximum number of records that should be returned.
15159 ///
15160 /// Sets the *limit* query property to the given value.
15161 pub fn limit(mut self, new_value: i32) -> NamespaceWorkerpoolListCall<'a, C> {
15162 self._limit = Some(new_value);
15163 self
15164 }
15165 /// =, !=, exists, in, and notIn.
15166 ///
15167 /// Sets the *label selector* query property to the given value.
15168 pub fn label_selector(mut self, new_value: &str) -> NamespaceWorkerpoolListCall<'a, C> {
15169 self._label_selector = Some(new_value.to_string());
15170 self
15171 }
15172 /// Encoded string to continue paging.
15173 ///
15174 /// Sets the *continue* query property to the given value.
15175 pub fn continue_(mut self, new_value: &str) -> NamespaceWorkerpoolListCall<'a, C> {
15176 self._continue_ = Some(new_value.to_string());
15177 self
15178 }
15179 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15180 /// while executing the actual API request.
15181 ///
15182 /// ````text
15183 /// It should be used to handle progress information, and to implement a certain level of resilience.
15184 /// ````
15185 ///
15186 /// Sets the *delegate* property to the given value.
15187 pub fn delegate(
15188 mut self,
15189 new_value: &'a mut dyn common::Delegate,
15190 ) -> NamespaceWorkerpoolListCall<'a, C> {
15191 self._delegate = Some(new_value);
15192 self
15193 }
15194
15195 /// Set any additional parameter of the query string used in the request.
15196 /// It should be used to set parameters which are not yet available through their own
15197 /// setters.
15198 ///
15199 /// Please note that this method must not be used to set any of the known parameters
15200 /// which have their own setter method. If done anyway, the request will fail.
15201 ///
15202 /// # Additional Parameters
15203 ///
15204 /// * *$.xgafv* (query-string) - V1 error format.
15205 /// * *access_token* (query-string) - OAuth access token.
15206 /// * *alt* (query-string) - Data format for response.
15207 /// * *callback* (query-string) - JSONP
15208 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15209 /// * *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.
15210 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15211 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15212 /// * *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.
15213 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15214 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15215 pub fn param<T>(mut self, name: T, value: T) -> NamespaceWorkerpoolListCall<'a, C>
15216 where
15217 T: AsRef<str>,
15218 {
15219 self._additional_params
15220 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15221 self
15222 }
15223
15224 /// Identifies the authorization scope for the method you are building.
15225 ///
15226 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15227 /// [`Scope::CloudPlatform`].
15228 ///
15229 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15230 /// tokens for more than one scope.
15231 ///
15232 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15233 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15234 /// sufficient, a read-write scope will do as well.
15235 pub fn add_scope<St>(mut self, scope: St) -> NamespaceWorkerpoolListCall<'a, C>
15236 where
15237 St: AsRef<str>,
15238 {
15239 self._scopes.insert(String::from(scope.as_ref()));
15240 self
15241 }
15242 /// Identifies the authorization scope(s) for the method you are building.
15243 ///
15244 /// See [`Self::add_scope()`] for details.
15245 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceWorkerpoolListCall<'a, C>
15246 where
15247 I: IntoIterator<Item = St>,
15248 St: AsRef<str>,
15249 {
15250 self._scopes
15251 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15252 self
15253 }
15254
15255 /// Removes all scopes, and no default scope will be used either.
15256 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15257 /// for details).
15258 pub fn clear_scopes(mut self) -> NamespaceWorkerpoolListCall<'a, C> {
15259 self._scopes.clear();
15260 self
15261 }
15262}
15263
15264/// Replaces a worker pool. 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.
15265///
15266/// A builder for the *workerpools.replaceWorkerPool* method supported by a *namespace* resource.
15267/// It is not used directly, but through a [`NamespaceMethods`] instance.
15268///
15269/// # Example
15270///
15271/// Instantiate a resource method builder
15272///
15273/// ```test_harness,no_run
15274/// # extern crate hyper;
15275/// # extern crate hyper_rustls;
15276/// # extern crate google_run1 as run1;
15277/// use run1::api::WorkerPool;
15278/// # async fn dox() {
15279/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15280///
15281/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15282/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15283/// # .with_native_roots()
15284/// # .unwrap()
15285/// # .https_only()
15286/// # .enable_http2()
15287/// # .build();
15288///
15289/// # let executor = hyper_util::rt::TokioExecutor::new();
15290/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15291/// # secret,
15292/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15293/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15294/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15295/// # ),
15296/// # ).build().await.unwrap();
15297///
15298/// # let client = hyper_util::client::legacy::Client::builder(
15299/// # hyper_util::rt::TokioExecutor::new()
15300/// # )
15301/// # .build(
15302/// # hyper_rustls::HttpsConnectorBuilder::new()
15303/// # .with_native_roots()
15304/// # .unwrap()
15305/// # .https_or_http()
15306/// # .enable_http2()
15307/// # .build()
15308/// # );
15309/// # let mut hub = CloudRun::new(client, auth);
15310/// // As the method needs a request, you would usually fill it with the desired information
15311/// // into the respective structure. Some of the parts shown here might not be applicable !
15312/// // Values shown here are possibly random and not representative !
15313/// let mut req = WorkerPool::default();
15314///
15315/// // You can configure optional parameters by calling the respective setters at will, and
15316/// // execute the final call using `doit()`.
15317/// // Values shown here are possibly random and not representative !
15318/// let result = hub.namespaces().workerpools_replace_worker_pool(req, "name")
15319/// .dry_run("sit")
15320/// .doit().await;
15321/// # }
15322/// ```
15323pub struct NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C>
15324where
15325 C: 'a,
15326{
15327 hub: &'a CloudRun<C>,
15328 _request: WorkerPool,
15329 _name: String,
15330 _dry_run: Option<String>,
15331 _delegate: Option<&'a mut dyn common::Delegate>,
15332 _additional_params: HashMap<String, String>,
15333 _scopes: BTreeSet<String>,
15334}
15335
15336impl<'a, C> common::CallBuilder for NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {}
15337
15338impl<'a, C> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C>
15339where
15340 C: common::Connector,
15341{
15342 /// Perform the operation you have build so far.
15343 pub async fn doit(mut self) -> common::Result<(common::Response, WorkerPool)> {
15344 use std::borrow::Cow;
15345 use std::io::{Read, Seek};
15346
15347 use common::{url::Params, ToParts};
15348 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15349
15350 let mut dd = common::DefaultDelegate;
15351 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15352 dlg.begin(common::MethodInfo {
15353 id: "run.namespaces.workerpools.replaceWorkerPool",
15354 http_method: hyper::Method::PUT,
15355 });
15356
15357 for &field in ["alt", "name", "dryRun"].iter() {
15358 if self._additional_params.contains_key(field) {
15359 dlg.finished(false);
15360 return Err(common::Error::FieldClash(field));
15361 }
15362 }
15363
15364 let mut params = Params::with_capacity(5 + self._additional_params.len());
15365 params.push("name", self._name);
15366 if let Some(value) = self._dry_run.as_ref() {
15367 params.push("dryRun", value);
15368 }
15369
15370 params.extend(self._additional_params.iter());
15371
15372 params.push("alt", "json");
15373 let mut url = self.hub._base_url.clone() + "apis/run.googleapis.com/v1/{+name}";
15374 if self._scopes.is_empty() {
15375 self._scopes
15376 .insert(Scope::CloudPlatform.as_ref().to_string());
15377 }
15378
15379 #[allow(clippy::single_element_loop)]
15380 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15381 url = params.uri_replacement(url, param_name, find_this, true);
15382 }
15383 {
15384 let to_remove = ["name"];
15385 params.remove_params(&to_remove);
15386 }
15387
15388 let url = params.parse_with_url(&url);
15389
15390 let mut json_mime_type = mime::APPLICATION_JSON;
15391 let mut request_value_reader = {
15392 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15393 common::remove_json_null_values(&mut value);
15394 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15395 serde_json::to_writer(&mut dst, &value).unwrap();
15396 dst
15397 };
15398 let request_size = request_value_reader
15399 .seek(std::io::SeekFrom::End(0))
15400 .unwrap();
15401 request_value_reader
15402 .seek(std::io::SeekFrom::Start(0))
15403 .unwrap();
15404
15405 loop {
15406 let token = match self
15407 .hub
15408 .auth
15409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15410 .await
15411 {
15412 Ok(token) => token,
15413 Err(e) => match dlg.token(e) {
15414 Ok(token) => token,
15415 Err(e) => {
15416 dlg.finished(false);
15417 return Err(common::Error::MissingToken(e));
15418 }
15419 },
15420 };
15421 request_value_reader
15422 .seek(std::io::SeekFrom::Start(0))
15423 .unwrap();
15424 let mut req_result = {
15425 let client = &self.hub.client;
15426 dlg.pre_request();
15427 let mut req_builder = hyper::Request::builder()
15428 .method(hyper::Method::PUT)
15429 .uri(url.as_str())
15430 .header(USER_AGENT, self.hub._user_agent.clone());
15431
15432 if let Some(token) = token.as_ref() {
15433 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15434 }
15435
15436 let request = req_builder
15437 .header(CONTENT_TYPE, json_mime_type.to_string())
15438 .header(CONTENT_LENGTH, request_size as u64)
15439 .body(common::to_body(
15440 request_value_reader.get_ref().clone().into(),
15441 ));
15442
15443 client.request(request.unwrap()).await
15444 };
15445
15446 match req_result {
15447 Err(err) => {
15448 if let common::Retry::After(d) = dlg.http_error(&err) {
15449 sleep(d).await;
15450 continue;
15451 }
15452 dlg.finished(false);
15453 return Err(common::Error::HttpError(err));
15454 }
15455 Ok(res) => {
15456 let (mut parts, body) = res.into_parts();
15457 let mut body = common::Body::new(body);
15458 if !parts.status.is_success() {
15459 let bytes = common::to_bytes(body).await.unwrap_or_default();
15460 let error = serde_json::from_str(&common::to_string(&bytes));
15461 let response = common::to_response(parts, bytes.into());
15462
15463 if let common::Retry::After(d) =
15464 dlg.http_failure(&response, error.as_ref().ok())
15465 {
15466 sleep(d).await;
15467 continue;
15468 }
15469
15470 dlg.finished(false);
15471
15472 return Err(match error {
15473 Ok(value) => common::Error::BadRequest(value),
15474 _ => common::Error::Failure(response),
15475 });
15476 }
15477 let response = {
15478 let bytes = common::to_bytes(body).await.unwrap_or_default();
15479 let encoded = common::to_string(&bytes);
15480 match serde_json::from_str(&encoded) {
15481 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15482 Err(error) => {
15483 dlg.response_json_decode_error(&encoded, &error);
15484 return Err(common::Error::JsonDecodeError(
15485 encoded.to_string(),
15486 error,
15487 ));
15488 }
15489 }
15490 };
15491
15492 dlg.finished(true);
15493 return Ok(response);
15494 }
15495 }
15496 }
15497 }
15498
15499 ///
15500 /// Sets the *request* property to the given value.
15501 ///
15502 /// Even though the property as already been set when instantiating this call,
15503 /// we provide this method for API completeness.
15504 pub fn request(
15505 mut self,
15506 new_value: WorkerPool,
15507 ) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
15508 self._request = new_value;
15509 self
15510 }
15511 /// Required. The fully qualified name of the worker pool to replace. It can be any of the following forms: * `namespaces/{project_id_or_number}/workerpools/{worker_pool_name}` (only when the `endpoint` is regional) * `projects/{project_id_or_number}/locations/{region}/workerpools/{worker_pool_name}` * `projects/{project_id_or_number}/regions/{region}/workerpools/{worker_pool_name}`
15512 ///
15513 /// Sets the *name* path property to the given value.
15514 ///
15515 /// Even though the property as already been set when instantiating this call,
15516 /// we provide this method for API completeness.
15517 pub fn name(mut self, new_value: &str) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
15518 self._name = new_value.to_string();
15519 self
15520 }
15521 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
15522 ///
15523 /// Sets the *dry run* query property to the given value.
15524 pub fn dry_run(mut self, new_value: &str) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
15525 self._dry_run = Some(new_value.to_string());
15526 self
15527 }
15528 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15529 /// while executing the actual API request.
15530 ///
15531 /// ````text
15532 /// It should be used to handle progress information, and to implement a certain level of resilience.
15533 /// ````
15534 ///
15535 /// Sets the *delegate* property to the given value.
15536 pub fn delegate(
15537 mut self,
15538 new_value: &'a mut dyn common::Delegate,
15539 ) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
15540 self._delegate = Some(new_value);
15541 self
15542 }
15543
15544 /// Set any additional parameter of the query string used in the request.
15545 /// It should be used to set parameters which are not yet available through their own
15546 /// setters.
15547 ///
15548 /// Please note that this method must not be used to set any of the known parameters
15549 /// which have their own setter method. If done anyway, the request will fail.
15550 ///
15551 /// # Additional Parameters
15552 ///
15553 /// * *$.xgafv* (query-string) - V1 error format.
15554 /// * *access_token* (query-string) - OAuth access token.
15555 /// * *alt* (query-string) - Data format for response.
15556 /// * *callback* (query-string) - JSONP
15557 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15558 /// * *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.
15559 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15560 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15561 /// * *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.
15562 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15563 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15564 pub fn param<T>(mut self, name: T, value: T) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C>
15565 where
15566 T: AsRef<str>,
15567 {
15568 self._additional_params
15569 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15570 self
15571 }
15572
15573 /// Identifies the authorization scope for the method you are building.
15574 ///
15575 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15576 /// [`Scope::CloudPlatform`].
15577 ///
15578 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15579 /// tokens for more than one scope.
15580 ///
15581 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15582 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15583 /// sufficient, a read-write scope will do as well.
15584 pub fn add_scope<St>(mut self, scope: St) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C>
15585 where
15586 St: AsRef<str>,
15587 {
15588 self._scopes.insert(String::from(scope.as_ref()));
15589 self
15590 }
15591 /// Identifies the authorization scope(s) for the method you are building.
15592 ///
15593 /// See [`Self::add_scope()`] for details.
15594 pub fn add_scopes<I, St>(mut self, scopes: I) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C>
15595 where
15596 I: IntoIterator<Item = St>,
15597 St: AsRef<str>,
15598 {
15599 self._scopes
15600 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15601 self
15602 }
15603
15604 /// Removes all scopes, and no default scope will be used either.
15605 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15606 /// for details).
15607 pub fn clear_scopes(mut self) -> NamespaceWorkerpoolReplaceWorkerPoolCall<'a, C> {
15608 self._scopes.clear();
15609 self
15610 }
15611}
15612
15613/// List authorized domains.
15614///
15615/// A builder for the *authorizeddomains.list* method supported by a *project* resource.
15616/// It is not used directly, but through a [`ProjectMethods`] instance.
15617///
15618/// # Example
15619///
15620/// Instantiate a resource method builder
15621///
15622/// ```test_harness,no_run
15623/// # extern crate hyper;
15624/// # extern crate hyper_rustls;
15625/// # extern crate google_run1 as run1;
15626/// # async fn dox() {
15627/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15628///
15629/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15630/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15631/// # .with_native_roots()
15632/// # .unwrap()
15633/// # .https_only()
15634/// # .enable_http2()
15635/// # .build();
15636///
15637/// # let executor = hyper_util::rt::TokioExecutor::new();
15638/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15639/// # secret,
15640/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15641/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15642/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15643/// # ),
15644/// # ).build().await.unwrap();
15645///
15646/// # let client = hyper_util::client::legacy::Client::builder(
15647/// # hyper_util::rt::TokioExecutor::new()
15648/// # )
15649/// # .build(
15650/// # hyper_rustls::HttpsConnectorBuilder::new()
15651/// # .with_native_roots()
15652/// # .unwrap()
15653/// # .https_or_http()
15654/// # .enable_http2()
15655/// # .build()
15656/// # );
15657/// # let mut hub = CloudRun::new(client, auth);
15658/// // You can configure optional parameters by calling the respective setters at will, and
15659/// // execute the final call using `doit()`.
15660/// // Values shown here are possibly random and not representative !
15661/// let result = hub.projects().authorizeddomains_list("parent")
15662/// .page_token("eos")
15663/// .page_size(-56)
15664/// .doit().await;
15665/// # }
15666/// ```
15667pub struct ProjectAuthorizeddomainListCall<'a, C>
15668where
15669 C: 'a,
15670{
15671 hub: &'a CloudRun<C>,
15672 _parent: String,
15673 _page_token: Option<String>,
15674 _page_size: Option<i32>,
15675 _delegate: Option<&'a mut dyn common::Delegate>,
15676 _additional_params: HashMap<String, String>,
15677 _scopes: BTreeSet<String>,
15678}
15679
15680impl<'a, C> common::CallBuilder for ProjectAuthorizeddomainListCall<'a, C> {}
15681
15682impl<'a, C> ProjectAuthorizeddomainListCall<'a, C>
15683where
15684 C: common::Connector,
15685{
15686 /// Perform the operation you have build so far.
15687 pub async fn doit(
15688 mut self,
15689 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
15690 use std::borrow::Cow;
15691 use std::io::{Read, Seek};
15692
15693 use common::{url::Params, ToParts};
15694 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15695
15696 let mut dd = common::DefaultDelegate;
15697 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15698 dlg.begin(common::MethodInfo {
15699 id: "run.projects.authorizeddomains.list",
15700 http_method: hyper::Method::GET,
15701 });
15702
15703 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
15704 if self._additional_params.contains_key(field) {
15705 dlg.finished(false);
15706 return Err(common::Error::FieldClash(field));
15707 }
15708 }
15709
15710 let mut params = Params::with_capacity(5 + self._additional_params.len());
15711 params.push("parent", self._parent);
15712 if let Some(value) = self._page_token.as_ref() {
15713 params.push("pageToken", value);
15714 }
15715 if let Some(value) = self._page_size.as_ref() {
15716 params.push("pageSize", value.to_string());
15717 }
15718
15719 params.extend(self._additional_params.iter());
15720
15721 params.push("alt", "json");
15722 let mut url = self.hub._base_url.clone() + "v1/{+parent}/authorizeddomains";
15723 if self._scopes.is_empty() {
15724 self._scopes
15725 .insert(Scope::CloudPlatform.as_ref().to_string());
15726 }
15727
15728 #[allow(clippy::single_element_loop)]
15729 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15730 url = params.uri_replacement(url, param_name, find_this, true);
15731 }
15732 {
15733 let to_remove = ["parent"];
15734 params.remove_params(&to_remove);
15735 }
15736
15737 let url = params.parse_with_url(&url);
15738
15739 loop {
15740 let token = match self
15741 .hub
15742 .auth
15743 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15744 .await
15745 {
15746 Ok(token) => token,
15747 Err(e) => match dlg.token(e) {
15748 Ok(token) => token,
15749 Err(e) => {
15750 dlg.finished(false);
15751 return Err(common::Error::MissingToken(e));
15752 }
15753 },
15754 };
15755 let mut req_result = {
15756 let client = &self.hub.client;
15757 dlg.pre_request();
15758 let mut req_builder = hyper::Request::builder()
15759 .method(hyper::Method::GET)
15760 .uri(url.as_str())
15761 .header(USER_AGENT, self.hub._user_agent.clone());
15762
15763 if let Some(token) = token.as_ref() {
15764 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15765 }
15766
15767 let request = req_builder
15768 .header(CONTENT_LENGTH, 0_u64)
15769 .body(common::to_body::<String>(None));
15770
15771 client.request(request.unwrap()).await
15772 };
15773
15774 match req_result {
15775 Err(err) => {
15776 if let common::Retry::After(d) = dlg.http_error(&err) {
15777 sleep(d).await;
15778 continue;
15779 }
15780 dlg.finished(false);
15781 return Err(common::Error::HttpError(err));
15782 }
15783 Ok(res) => {
15784 let (mut parts, body) = res.into_parts();
15785 let mut body = common::Body::new(body);
15786 if !parts.status.is_success() {
15787 let bytes = common::to_bytes(body).await.unwrap_or_default();
15788 let error = serde_json::from_str(&common::to_string(&bytes));
15789 let response = common::to_response(parts, bytes.into());
15790
15791 if let common::Retry::After(d) =
15792 dlg.http_failure(&response, error.as_ref().ok())
15793 {
15794 sleep(d).await;
15795 continue;
15796 }
15797
15798 dlg.finished(false);
15799
15800 return Err(match error {
15801 Ok(value) => common::Error::BadRequest(value),
15802 _ => common::Error::Failure(response),
15803 });
15804 }
15805 let response = {
15806 let bytes = common::to_bytes(body).await.unwrap_or_default();
15807 let encoded = common::to_string(&bytes);
15808 match serde_json::from_str(&encoded) {
15809 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15810 Err(error) => {
15811 dlg.response_json_decode_error(&encoded, &error);
15812 return Err(common::Error::JsonDecodeError(
15813 encoded.to_string(),
15814 error,
15815 ));
15816 }
15817 }
15818 };
15819
15820 dlg.finished(true);
15821 return Ok(response);
15822 }
15823 }
15824 }
15825 }
15826
15827 /// Name of the parent Project resource. Example: `projects/myproject`.
15828 ///
15829 /// Sets the *parent* path property to the given value.
15830 ///
15831 /// Even though the property as already been set when instantiating this call,
15832 /// we provide this method for API completeness.
15833 pub fn parent(mut self, new_value: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
15834 self._parent = new_value.to_string();
15835 self
15836 }
15837 /// Continuation token for fetching the next page of results.
15838 ///
15839 /// Sets the *page token* query property to the given value.
15840 pub fn page_token(mut self, new_value: &str) -> ProjectAuthorizeddomainListCall<'a, C> {
15841 self._page_token = Some(new_value.to_string());
15842 self
15843 }
15844 /// Maximum results to return per page.
15845 ///
15846 /// Sets the *page size* query property to the given value.
15847 pub fn page_size(mut self, new_value: i32) -> ProjectAuthorizeddomainListCall<'a, C> {
15848 self._page_size = Some(new_value);
15849 self
15850 }
15851 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15852 /// while executing the actual API request.
15853 ///
15854 /// ````text
15855 /// It should be used to handle progress information, and to implement a certain level of resilience.
15856 /// ````
15857 ///
15858 /// Sets the *delegate* property to the given value.
15859 pub fn delegate(
15860 mut self,
15861 new_value: &'a mut dyn common::Delegate,
15862 ) -> ProjectAuthorizeddomainListCall<'a, C> {
15863 self._delegate = Some(new_value);
15864 self
15865 }
15866
15867 /// Set any additional parameter of the query string used in the request.
15868 /// It should be used to set parameters which are not yet available through their own
15869 /// setters.
15870 ///
15871 /// Please note that this method must not be used to set any of the known parameters
15872 /// which have their own setter method. If done anyway, the request will fail.
15873 ///
15874 /// # Additional Parameters
15875 ///
15876 /// * *$.xgafv* (query-string) - V1 error format.
15877 /// * *access_token* (query-string) - OAuth access token.
15878 /// * *alt* (query-string) - Data format for response.
15879 /// * *callback* (query-string) - JSONP
15880 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15881 /// * *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.
15882 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15883 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15884 /// * *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.
15885 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15886 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15887 pub fn param<T>(mut self, name: T, value: T) -> ProjectAuthorizeddomainListCall<'a, C>
15888 where
15889 T: AsRef<str>,
15890 {
15891 self._additional_params
15892 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15893 self
15894 }
15895
15896 /// Identifies the authorization scope for the method you are building.
15897 ///
15898 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15899 /// [`Scope::CloudPlatform`].
15900 ///
15901 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15902 /// tokens for more than one scope.
15903 ///
15904 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15905 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15906 /// sufficient, a read-write scope will do as well.
15907 pub fn add_scope<St>(mut self, scope: St) -> ProjectAuthorizeddomainListCall<'a, C>
15908 where
15909 St: AsRef<str>,
15910 {
15911 self._scopes.insert(String::from(scope.as_ref()));
15912 self
15913 }
15914 /// Identifies the authorization scope(s) for the method you are building.
15915 ///
15916 /// See [`Self::add_scope()`] for details.
15917 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectAuthorizeddomainListCall<'a, C>
15918 where
15919 I: IntoIterator<Item = St>,
15920 St: AsRef<str>,
15921 {
15922 self._scopes
15923 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15924 self
15925 }
15926
15927 /// Removes all scopes, and no default scope will be used either.
15928 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15929 /// for details).
15930 pub fn clear_scopes(mut self) -> ProjectAuthorizeddomainListCall<'a, C> {
15931 self._scopes.clear();
15932 self
15933 }
15934}
15935
15936/// List authorized domains.
15937///
15938/// A builder for the *locations.authorizeddomains.list* method supported by a *project* resource.
15939/// It is not used directly, but through a [`ProjectMethods`] instance.
15940///
15941/// # Example
15942///
15943/// Instantiate a resource method builder
15944///
15945/// ```test_harness,no_run
15946/// # extern crate hyper;
15947/// # extern crate hyper_rustls;
15948/// # extern crate google_run1 as run1;
15949/// # async fn dox() {
15950/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15951///
15952/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15953/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15954/// # .with_native_roots()
15955/// # .unwrap()
15956/// # .https_only()
15957/// # .enable_http2()
15958/// # .build();
15959///
15960/// # let executor = hyper_util::rt::TokioExecutor::new();
15961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15962/// # secret,
15963/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15964/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15965/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15966/// # ),
15967/// # ).build().await.unwrap();
15968///
15969/// # let client = hyper_util::client::legacy::Client::builder(
15970/// # hyper_util::rt::TokioExecutor::new()
15971/// # )
15972/// # .build(
15973/// # hyper_rustls::HttpsConnectorBuilder::new()
15974/// # .with_native_roots()
15975/// # .unwrap()
15976/// # .https_or_http()
15977/// # .enable_http2()
15978/// # .build()
15979/// # );
15980/// # let mut hub = CloudRun::new(client, auth);
15981/// // You can configure optional parameters by calling the respective setters at will, and
15982/// // execute the final call using `doit()`.
15983/// // Values shown here are possibly random and not representative !
15984/// let result = hub.projects().locations_authorizeddomains_list("parent")
15985/// .page_token("Stet")
15986/// .page_size(-19)
15987/// .doit().await;
15988/// # }
15989/// ```
15990pub struct ProjectLocationAuthorizeddomainListCall<'a, C>
15991where
15992 C: 'a,
15993{
15994 hub: &'a CloudRun<C>,
15995 _parent: String,
15996 _page_token: Option<String>,
15997 _page_size: Option<i32>,
15998 _delegate: Option<&'a mut dyn common::Delegate>,
15999 _additional_params: HashMap<String, String>,
16000 _scopes: BTreeSet<String>,
16001}
16002
16003impl<'a, C> common::CallBuilder for ProjectLocationAuthorizeddomainListCall<'a, C> {}
16004
16005impl<'a, C> ProjectLocationAuthorizeddomainListCall<'a, C>
16006where
16007 C: common::Connector,
16008{
16009 /// Perform the operation you have build so far.
16010 pub async fn doit(
16011 mut self,
16012 ) -> common::Result<(common::Response, ListAuthorizedDomainsResponse)> {
16013 use std::borrow::Cow;
16014 use std::io::{Read, Seek};
16015
16016 use common::{url::Params, ToParts};
16017 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16018
16019 let mut dd = common::DefaultDelegate;
16020 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16021 dlg.begin(common::MethodInfo {
16022 id: "run.projects.locations.authorizeddomains.list",
16023 http_method: hyper::Method::GET,
16024 });
16025
16026 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16027 if self._additional_params.contains_key(field) {
16028 dlg.finished(false);
16029 return Err(common::Error::FieldClash(field));
16030 }
16031 }
16032
16033 let mut params = Params::with_capacity(5 + self._additional_params.len());
16034 params.push("parent", self._parent);
16035 if let Some(value) = self._page_token.as_ref() {
16036 params.push("pageToken", value);
16037 }
16038 if let Some(value) = self._page_size.as_ref() {
16039 params.push("pageSize", value.to_string());
16040 }
16041
16042 params.extend(self._additional_params.iter());
16043
16044 params.push("alt", "json");
16045 let mut url = self.hub._base_url.clone() + "v1/{+parent}/authorizeddomains";
16046 if self._scopes.is_empty() {
16047 self._scopes
16048 .insert(Scope::CloudPlatform.as_ref().to_string());
16049 }
16050
16051 #[allow(clippy::single_element_loop)]
16052 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16053 url = params.uri_replacement(url, param_name, find_this, true);
16054 }
16055 {
16056 let to_remove = ["parent"];
16057 params.remove_params(&to_remove);
16058 }
16059
16060 let url = params.parse_with_url(&url);
16061
16062 loop {
16063 let token = match self
16064 .hub
16065 .auth
16066 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16067 .await
16068 {
16069 Ok(token) => token,
16070 Err(e) => match dlg.token(e) {
16071 Ok(token) => token,
16072 Err(e) => {
16073 dlg.finished(false);
16074 return Err(common::Error::MissingToken(e));
16075 }
16076 },
16077 };
16078 let mut req_result = {
16079 let client = &self.hub.client;
16080 dlg.pre_request();
16081 let mut req_builder = hyper::Request::builder()
16082 .method(hyper::Method::GET)
16083 .uri(url.as_str())
16084 .header(USER_AGENT, self.hub._user_agent.clone());
16085
16086 if let Some(token) = token.as_ref() {
16087 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16088 }
16089
16090 let request = req_builder
16091 .header(CONTENT_LENGTH, 0_u64)
16092 .body(common::to_body::<String>(None));
16093
16094 client.request(request.unwrap()).await
16095 };
16096
16097 match req_result {
16098 Err(err) => {
16099 if let common::Retry::After(d) = dlg.http_error(&err) {
16100 sleep(d).await;
16101 continue;
16102 }
16103 dlg.finished(false);
16104 return Err(common::Error::HttpError(err));
16105 }
16106 Ok(res) => {
16107 let (mut parts, body) = res.into_parts();
16108 let mut body = common::Body::new(body);
16109 if !parts.status.is_success() {
16110 let bytes = common::to_bytes(body).await.unwrap_or_default();
16111 let error = serde_json::from_str(&common::to_string(&bytes));
16112 let response = common::to_response(parts, bytes.into());
16113
16114 if let common::Retry::After(d) =
16115 dlg.http_failure(&response, error.as_ref().ok())
16116 {
16117 sleep(d).await;
16118 continue;
16119 }
16120
16121 dlg.finished(false);
16122
16123 return Err(match error {
16124 Ok(value) => common::Error::BadRequest(value),
16125 _ => common::Error::Failure(response),
16126 });
16127 }
16128 let response = {
16129 let bytes = common::to_bytes(body).await.unwrap_or_default();
16130 let encoded = common::to_string(&bytes);
16131 match serde_json::from_str(&encoded) {
16132 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16133 Err(error) => {
16134 dlg.response_json_decode_error(&encoded, &error);
16135 return Err(common::Error::JsonDecodeError(
16136 encoded.to_string(),
16137 error,
16138 ));
16139 }
16140 }
16141 };
16142
16143 dlg.finished(true);
16144 return Ok(response);
16145 }
16146 }
16147 }
16148 }
16149
16150 /// Name of the parent Project resource. Example: `projects/myproject`.
16151 ///
16152 /// Sets the *parent* path property to the given value.
16153 ///
16154 /// Even though the property as already been set when instantiating this call,
16155 /// we provide this method for API completeness.
16156 pub fn parent(mut self, new_value: &str) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
16157 self._parent = new_value.to_string();
16158 self
16159 }
16160 /// Continuation token for fetching the next page of results.
16161 ///
16162 /// Sets the *page token* query property to the given value.
16163 pub fn page_token(mut self, new_value: &str) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
16164 self._page_token = Some(new_value.to_string());
16165 self
16166 }
16167 /// Maximum results to return per page.
16168 ///
16169 /// Sets the *page size* query property to the given value.
16170 pub fn page_size(mut self, new_value: i32) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
16171 self._page_size = Some(new_value);
16172 self
16173 }
16174 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16175 /// while executing the actual API request.
16176 ///
16177 /// ````text
16178 /// It should be used to handle progress information, and to implement a certain level of resilience.
16179 /// ````
16180 ///
16181 /// Sets the *delegate* property to the given value.
16182 pub fn delegate(
16183 mut self,
16184 new_value: &'a mut dyn common::Delegate,
16185 ) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
16186 self._delegate = Some(new_value);
16187 self
16188 }
16189
16190 /// Set any additional parameter of the query string used in the request.
16191 /// It should be used to set parameters which are not yet available through their own
16192 /// setters.
16193 ///
16194 /// Please note that this method must not be used to set any of the known parameters
16195 /// which have their own setter method. If done anyway, the request will fail.
16196 ///
16197 /// # Additional Parameters
16198 ///
16199 /// * *$.xgafv* (query-string) - V1 error format.
16200 /// * *access_token* (query-string) - OAuth access token.
16201 /// * *alt* (query-string) - Data format for response.
16202 /// * *callback* (query-string) - JSONP
16203 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16204 /// * *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.
16205 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16206 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16207 /// * *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.
16208 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16209 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16210 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationAuthorizeddomainListCall<'a, C>
16211 where
16212 T: AsRef<str>,
16213 {
16214 self._additional_params
16215 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16216 self
16217 }
16218
16219 /// Identifies the authorization scope for the method you are building.
16220 ///
16221 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16222 /// [`Scope::CloudPlatform`].
16223 ///
16224 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16225 /// tokens for more than one scope.
16226 ///
16227 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16228 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16229 /// sufficient, a read-write scope will do as well.
16230 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAuthorizeddomainListCall<'a, C>
16231 where
16232 St: AsRef<str>,
16233 {
16234 self._scopes.insert(String::from(scope.as_ref()));
16235 self
16236 }
16237 /// Identifies the authorization scope(s) for the method you are building.
16238 ///
16239 /// See [`Self::add_scope()`] for details.
16240 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationAuthorizeddomainListCall<'a, C>
16241 where
16242 I: IntoIterator<Item = St>,
16243 St: AsRef<str>,
16244 {
16245 self._scopes
16246 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16247 self
16248 }
16249
16250 /// Removes all scopes, and no default scope will be used either.
16251 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16252 /// for details).
16253 pub fn clear_scopes(mut self) -> ProjectLocationAuthorizeddomainListCall<'a, C> {
16254 self._scopes.clear();
16255 self
16256 }
16257}
16258
16259/// Get information about a configuration.
16260///
16261/// A builder for the *locations.configurations.get* method supported by a *project* resource.
16262/// It is not used directly, but through a [`ProjectMethods`] instance.
16263///
16264/// # Example
16265///
16266/// Instantiate a resource method builder
16267///
16268/// ```test_harness,no_run
16269/// # extern crate hyper;
16270/// # extern crate hyper_rustls;
16271/// # extern crate google_run1 as run1;
16272/// # async fn dox() {
16273/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16274///
16275/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16276/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16277/// # .with_native_roots()
16278/// # .unwrap()
16279/// # .https_only()
16280/// # .enable_http2()
16281/// # .build();
16282///
16283/// # let executor = hyper_util::rt::TokioExecutor::new();
16284/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16285/// # secret,
16286/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16287/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16288/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16289/// # ),
16290/// # ).build().await.unwrap();
16291///
16292/// # let client = hyper_util::client::legacy::Client::builder(
16293/// # hyper_util::rt::TokioExecutor::new()
16294/// # )
16295/// # .build(
16296/// # hyper_rustls::HttpsConnectorBuilder::new()
16297/// # .with_native_roots()
16298/// # .unwrap()
16299/// # .https_or_http()
16300/// # .enable_http2()
16301/// # .build()
16302/// # );
16303/// # let mut hub = CloudRun::new(client, auth);
16304/// // You can configure optional parameters by calling the respective setters at will, and
16305/// // execute the final call using `doit()`.
16306/// // Values shown here are possibly random and not representative !
16307/// let result = hub.projects().locations_configurations_get("name")
16308/// .doit().await;
16309/// # }
16310/// ```
16311pub struct ProjectLocationConfigurationGetCall<'a, C>
16312where
16313 C: 'a,
16314{
16315 hub: &'a CloudRun<C>,
16316 _name: String,
16317 _delegate: Option<&'a mut dyn common::Delegate>,
16318 _additional_params: HashMap<String, String>,
16319 _scopes: BTreeSet<String>,
16320}
16321
16322impl<'a, C> common::CallBuilder for ProjectLocationConfigurationGetCall<'a, C> {}
16323
16324impl<'a, C> ProjectLocationConfigurationGetCall<'a, C>
16325where
16326 C: common::Connector,
16327{
16328 /// Perform the operation you have build so far.
16329 pub async fn doit(mut self) -> common::Result<(common::Response, Configuration)> {
16330 use std::borrow::Cow;
16331 use std::io::{Read, Seek};
16332
16333 use common::{url::Params, ToParts};
16334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16335
16336 let mut dd = common::DefaultDelegate;
16337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16338 dlg.begin(common::MethodInfo {
16339 id: "run.projects.locations.configurations.get",
16340 http_method: hyper::Method::GET,
16341 });
16342
16343 for &field in ["alt", "name"].iter() {
16344 if self._additional_params.contains_key(field) {
16345 dlg.finished(false);
16346 return Err(common::Error::FieldClash(field));
16347 }
16348 }
16349
16350 let mut params = Params::with_capacity(3 + self._additional_params.len());
16351 params.push("name", self._name);
16352
16353 params.extend(self._additional_params.iter());
16354
16355 params.push("alt", "json");
16356 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16357 if self._scopes.is_empty() {
16358 self._scopes
16359 .insert(Scope::CloudPlatform.as_ref().to_string());
16360 }
16361
16362 #[allow(clippy::single_element_loop)]
16363 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16364 url = params.uri_replacement(url, param_name, find_this, true);
16365 }
16366 {
16367 let to_remove = ["name"];
16368 params.remove_params(&to_remove);
16369 }
16370
16371 let url = params.parse_with_url(&url);
16372
16373 loop {
16374 let token = match self
16375 .hub
16376 .auth
16377 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16378 .await
16379 {
16380 Ok(token) => token,
16381 Err(e) => match dlg.token(e) {
16382 Ok(token) => token,
16383 Err(e) => {
16384 dlg.finished(false);
16385 return Err(common::Error::MissingToken(e));
16386 }
16387 },
16388 };
16389 let mut req_result = {
16390 let client = &self.hub.client;
16391 dlg.pre_request();
16392 let mut req_builder = hyper::Request::builder()
16393 .method(hyper::Method::GET)
16394 .uri(url.as_str())
16395 .header(USER_AGENT, self.hub._user_agent.clone());
16396
16397 if let Some(token) = token.as_ref() {
16398 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16399 }
16400
16401 let request = req_builder
16402 .header(CONTENT_LENGTH, 0_u64)
16403 .body(common::to_body::<String>(None));
16404
16405 client.request(request.unwrap()).await
16406 };
16407
16408 match req_result {
16409 Err(err) => {
16410 if let common::Retry::After(d) = dlg.http_error(&err) {
16411 sleep(d).await;
16412 continue;
16413 }
16414 dlg.finished(false);
16415 return Err(common::Error::HttpError(err));
16416 }
16417 Ok(res) => {
16418 let (mut parts, body) = res.into_parts();
16419 let mut body = common::Body::new(body);
16420 if !parts.status.is_success() {
16421 let bytes = common::to_bytes(body).await.unwrap_or_default();
16422 let error = serde_json::from_str(&common::to_string(&bytes));
16423 let response = common::to_response(parts, bytes.into());
16424
16425 if let common::Retry::After(d) =
16426 dlg.http_failure(&response, error.as_ref().ok())
16427 {
16428 sleep(d).await;
16429 continue;
16430 }
16431
16432 dlg.finished(false);
16433
16434 return Err(match error {
16435 Ok(value) => common::Error::BadRequest(value),
16436 _ => common::Error::Failure(response),
16437 });
16438 }
16439 let response = {
16440 let bytes = common::to_bytes(body).await.unwrap_or_default();
16441 let encoded = common::to_string(&bytes);
16442 match serde_json::from_str(&encoded) {
16443 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16444 Err(error) => {
16445 dlg.response_json_decode_error(&encoded, &error);
16446 return Err(common::Error::JsonDecodeError(
16447 encoded.to_string(),
16448 error,
16449 ));
16450 }
16451 }
16452 };
16453
16454 dlg.finished(true);
16455 return Ok(response);
16456 }
16457 }
16458 }
16459 }
16460
16461 /// The name of the configuration to retrieve. For Cloud Run, replace {namespace_id} with the project ID or number.
16462 ///
16463 /// Sets the *name* path property to the given value.
16464 ///
16465 /// Even though the property as already been set when instantiating this call,
16466 /// we provide this method for API completeness.
16467 pub fn name(mut self, new_value: &str) -> ProjectLocationConfigurationGetCall<'a, C> {
16468 self._name = new_value.to_string();
16469 self
16470 }
16471 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16472 /// while executing the actual API request.
16473 ///
16474 /// ````text
16475 /// It should be used to handle progress information, and to implement a certain level of resilience.
16476 /// ````
16477 ///
16478 /// Sets the *delegate* property to the given value.
16479 pub fn delegate(
16480 mut self,
16481 new_value: &'a mut dyn common::Delegate,
16482 ) -> ProjectLocationConfigurationGetCall<'a, C> {
16483 self._delegate = Some(new_value);
16484 self
16485 }
16486
16487 /// Set any additional parameter of the query string used in the request.
16488 /// It should be used to set parameters which are not yet available through their own
16489 /// setters.
16490 ///
16491 /// Please note that this method must not be used to set any of the known parameters
16492 /// which have their own setter method. If done anyway, the request will fail.
16493 ///
16494 /// # Additional Parameters
16495 ///
16496 /// * *$.xgafv* (query-string) - V1 error format.
16497 /// * *access_token* (query-string) - OAuth access token.
16498 /// * *alt* (query-string) - Data format for response.
16499 /// * *callback* (query-string) - JSONP
16500 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16501 /// * *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.
16502 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16503 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16504 /// * *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.
16505 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16506 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16507 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConfigurationGetCall<'a, C>
16508 where
16509 T: AsRef<str>,
16510 {
16511 self._additional_params
16512 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16513 self
16514 }
16515
16516 /// Identifies the authorization scope for the method you are building.
16517 ///
16518 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16519 /// [`Scope::CloudPlatform`].
16520 ///
16521 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16522 /// tokens for more than one scope.
16523 ///
16524 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16525 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16526 /// sufficient, a read-write scope will do as well.
16527 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConfigurationGetCall<'a, C>
16528 where
16529 St: AsRef<str>,
16530 {
16531 self._scopes.insert(String::from(scope.as_ref()));
16532 self
16533 }
16534 /// Identifies the authorization scope(s) for the method you are building.
16535 ///
16536 /// See [`Self::add_scope()`] for details.
16537 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConfigurationGetCall<'a, C>
16538 where
16539 I: IntoIterator<Item = St>,
16540 St: AsRef<str>,
16541 {
16542 self._scopes
16543 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16544 self
16545 }
16546
16547 /// Removes all scopes, and no default scope will be used either.
16548 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16549 /// for details).
16550 pub fn clear_scopes(mut self) -> ProjectLocationConfigurationGetCall<'a, C> {
16551 self._scopes.clear();
16552 self
16553 }
16554}
16555
16556/// List configurations. Results are sorted by creation time, descending.
16557///
16558/// A builder for the *locations.configurations.list* method supported by a *project* resource.
16559/// It is not used directly, but through a [`ProjectMethods`] instance.
16560///
16561/// # Example
16562///
16563/// Instantiate a resource method builder
16564///
16565/// ```test_harness,no_run
16566/// # extern crate hyper;
16567/// # extern crate hyper_rustls;
16568/// # extern crate google_run1 as run1;
16569/// # async fn dox() {
16570/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16571///
16572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16573/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16574/// # .with_native_roots()
16575/// # .unwrap()
16576/// # .https_only()
16577/// # .enable_http2()
16578/// # .build();
16579///
16580/// # let executor = hyper_util::rt::TokioExecutor::new();
16581/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16582/// # secret,
16583/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16584/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16585/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16586/// # ),
16587/// # ).build().await.unwrap();
16588///
16589/// # let client = hyper_util::client::legacy::Client::builder(
16590/// # hyper_util::rt::TokioExecutor::new()
16591/// # )
16592/// # .build(
16593/// # hyper_rustls::HttpsConnectorBuilder::new()
16594/// # .with_native_roots()
16595/// # .unwrap()
16596/// # .https_or_http()
16597/// # .enable_http2()
16598/// # .build()
16599/// # );
16600/// # let mut hub = CloudRun::new(client, auth);
16601/// // You can configure optional parameters by calling the respective setters at will, and
16602/// // execute the final call using `doit()`.
16603/// // Values shown here are possibly random and not representative !
16604/// let result = hub.projects().locations_configurations_list("parent")
16605/// .watch(false)
16606/// .resource_version("At")
16607/// .limit(-84)
16608/// .label_selector("eirmod")
16609/// .include_uninitialized(true)
16610/// .field_selector("accusam")
16611/// .continue_("amet")
16612/// .doit().await;
16613/// # }
16614/// ```
16615pub struct ProjectLocationConfigurationListCall<'a, C>
16616where
16617 C: 'a,
16618{
16619 hub: &'a CloudRun<C>,
16620 _parent: String,
16621 _watch: Option<bool>,
16622 _resource_version: Option<String>,
16623 _limit: Option<i32>,
16624 _label_selector: Option<String>,
16625 _include_uninitialized: Option<bool>,
16626 _field_selector: Option<String>,
16627 _continue_: Option<String>,
16628 _delegate: Option<&'a mut dyn common::Delegate>,
16629 _additional_params: HashMap<String, String>,
16630 _scopes: BTreeSet<String>,
16631}
16632
16633impl<'a, C> common::CallBuilder for ProjectLocationConfigurationListCall<'a, C> {}
16634
16635impl<'a, C> ProjectLocationConfigurationListCall<'a, C>
16636where
16637 C: common::Connector,
16638{
16639 /// Perform the operation you have build so far.
16640 pub async fn doit(mut self) -> common::Result<(common::Response, ListConfigurationsResponse)> {
16641 use std::borrow::Cow;
16642 use std::io::{Read, Seek};
16643
16644 use common::{url::Params, ToParts};
16645 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16646
16647 let mut dd = common::DefaultDelegate;
16648 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16649 dlg.begin(common::MethodInfo {
16650 id: "run.projects.locations.configurations.list",
16651 http_method: hyper::Method::GET,
16652 });
16653
16654 for &field in [
16655 "alt",
16656 "parent",
16657 "watch",
16658 "resourceVersion",
16659 "limit",
16660 "labelSelector",
16661 "includeUninitialized",
16662 "fieldSelector",
16663 "continue",
16664 ]
16665 .iter()
16666 {
16667 if self._additional_params.contains_key(field) {
16668 dlg.finished(false);
16669 return Err(common::Error::FieldClash(field));
16670 }
16671 }
16672
16673 let mut params = Params::with_capacity(10 + self._additional_params.len());
16674 params.push("parent", self._parent);
16675 if let Some(value) = self._watch.as_ref() {
16676 params.push("watch", value.to_string());
16677 }
16678 if let Some(value) = self._resource_version.as_ref() {
16679 params.push("resourceVersion", value);
16680 }
16681 if let Some(value) = self._limit.as_ref() {
16682 params.push("limit", value.to_string());
16683 }
16684 if let Some(value) = self._label_selector.as_ref() {
16685 params.push("labelSelector", value);
16686 }
16687 if let Some(value) = self._include_uninitialized.as_ref() {
16688 params.push("includeUninitialized", value.to_string());
16689 }
16690 if let Some(value) = self._field_selector.as_ref() {
16691 params.push("fieldSelector", value);
16692 }
16693 if let Some(value) = self._continue_.as_ref() {
16694 params.push("continue", value);
16695 }
16696
16697 params.extend(self._additional_params.iter());
16698
16699 params.push("alt", "json");
16700 let mut url = self.hub._base_url.clone() + "v1/{+parent}/configurations";
16701 if self._scopes.is_empty() {
16702 self._scopes
16703 .insert(Scope::CloudPlatform.as_ref().to_string());
16704 }
16705
16706 #[allow(clippy::single_element_loop)]
16707 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16708 url = params.uri_replacement(url, param_name, find_this, true);
16709 }
16710 {
16711 let to_remove = ["parent"];
16712 params.remove_params(&to_remove);
16713 }
16714
16715 let url = params.parse_with_url(&url);
16716
16717 loop {
16718 let token = match self
16719 .hub
16720 .auth
16721 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16722 .await
16723 {
16724 Ok(token) => token,
16725 Err(e) => match dlg.token(e) {
16726 Ok(token) => token,
16727 Err(e) => {
16728 dlg.finished(false);
16729 return Err(common::Error::MissingToken(e));
16730 }
16731 },
16732 };
16733 let mut req_result = {
16734 let client = &self.hub.client;
16735 dlg.pre_request();
16736 let mut req_builder = hyper::Request::builder()
16737 .method(hyper::Method::GET)
16738 .uri(url.as_str())
16739 .header(USER_AGENT, self.hub._user_agent.clone());
16740
16741 if let Some(token) = token.as_ref() {
16742 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16743 }
16744
16745 let request = req_builder
16746 .header(CONTENT_LENGTH, 0_u64)
16747 .body(common::to_body::<String>(None));
16748
16749 client.request(request.unwrap()).await
16750 };
16751
16752 match req_result {
16753 Err(err) => {
16754 if let common::Retry::After(d) = dlg.http_error(&err) {
16755 sleep(d).await;
16756 continue;
16757 }
16758 dlg.finished(false);
16759 return Err(common::Error::HttpError(err));
16760 }
16761 Ok(res) => {
16762 let (mut parts, body) = res.into_parts();
16763 let mut body = common::Body::new(body);
16764 if !parts.status.is_success() {
16765 let bytes = common::to_bytes(body).await.unwrap_or_default();
16766 let error = serde_json::from_str(&common::to_string(&bytes));
16767 let response = common::to_response(parts, bytes.into());
16768
16769 if let common::Retry::After(d) =
16770 dlg.http_failure(&response, error.as_ref().ok())
16771 {
16772 sleep(d).await;
16773 continue;
16774 }
16775
16776 dlg.finished(false);
16777
16778 return Err(match error {
16779 Ok(value) => common::Error::BadRequest(value),
16780 _ => common::Error::Failure(response),
16781 });
16782 }
16783 let response = {
16784 let bytes = common::to_bytes(body).await.unwrap_or_default();
16785 let encoded = common::to_string(&bytes);
16786 match serde_json::from_str(&encoded) {
16787 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16788 Err(error) => {
16789 dlg.response_json_decode_error(&encoded, &error);
16790 return Err(common::Error::JsonDecodeError(
16791 encoded.to_string(),
16792 error,
16793 ));
16794 }
16795 }
16796 };
16797
16798 dlg.finished(true);
16799 return Ok(response);
16800 }
16801 }
16802 }
16803 }
16804
16805 /// The namespace from which the configurations should be listed. For Cloud Run, replace {namespace_id} with the project ID or number.
16806 ///
16807 /// Sets the *parent* path property to the given value.
16808 ///
16809 /// Even though the property as already been set when instantiating this call,
16810 /// we provide this method for API completeness.
16811 pub fn parent(mut self, new_value: &str) -> ProjectLocationConfigurationListCall<'a, C> {
16812 self._parent = new_value.to_string();
16813 self
16814 }
16815 /// Not supported by Cloud Run.
16816 ///
16817 /// Sets the *watch* query property to the given value.
16818 pub fn watch(mut self, new_value: bool) -> ProjectLocationConfigurationListCall<'a, C> {
16819 self._watch = Some(new_value);
16820 self
16821 }
16822 /// Not supported by Cloud Run.
16823 ///
16824 /// Sets the *resource version* query property to the given value.
16825 pub fn resource_version(
16826 mut self,
16827 new_value: &str,
16828 ) -> ProjectLocationConfigurationListCall<'a, C> {
16829 self._resource_version = Some(new_value.to_string());
16830 self
16831 }
16832 /// Optional. The maximum number of the records that should be returned.
16833 ///
16834 /// Sets the *limit* query property to the given value.
16835 pub fn limit(mut self, new_value: i32) -> ProjectLocationConfigurationListCall<'a, C> {
16836 self._limit = Some(new_value);
16837 self
16838 }
16839 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
16840 ///
16841 /// Sets the *label selector* query property to the given value.
16842 pub fn label_selector(
16843 mut self,
16844 new_value: &str,
16845 ) -> ProjectLocationConfigurationListCall<'a, C> {
16846 self._label_selector = Some(new_value.to_string());
16847 self
16848 }
16849 /// Not supported by Cloud Run.
16850 ///
16851 /// Sets the *include uninitialized* query property to the given value.
16852 pub fn include_uninitialized(
16853 mut self,
16854 new_value: bool,
16855 ) -> ProjectLocationConfigurationListCall<'a, C> {
16856 self._include_uninitialized = Some(new_value);
16857 self
16858 }
16859 /// Not supported by Cloud Run.
16860 ///
16861 /// Sets the *field selector* query property to the given value.
16862 pub fn field_selector(
16863 mut self,
16864 new_value: &str,
16865 ) -> ProjectLocationConfigurationListCall<'a, C> {
16866 self._field_selector = Some(new_value.to_string());
16867 self
16868 }
16869 /// Optional. Encoded string to continue paging.
16870 ///
16871 /// Sets the *continue* query property to the given value.
16872 pub fn continue_(mut self, new_value: &str) -> ProjectLocationConfigurationListCall<'a, C> {
16873 self._continue_ = Some(new_value.to_string());
16874 self
16875 }
16876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16877 /// while executing the actual API request.
16878 ///
16879 /// ````text
16880 /// It should be used to handle progress information, and to implement a certain level of resilience.
16881 /// ````
16882 ///
16883 /// Sets the *delegate* property to the given value.
16884 pub fn delegate(
16885 mut self,
16886 new_value: &'a mut dyn common::Delegate,
16887 ) -> ProjectLocationConfigurationListCall<'a, C> {
16888 self._delegate = Some(new_value);
16889 self
16890 }
16891
16892 /// Set any additional parameter of the query string used in the request.
16893 /// It should be used to set parameters which are not yet available through their own
16894 /// setters.
16895 ///
16896 /// Please note that this method must not be used to set any of the known parameters
16897 /// which have their own setter method. If done anyway, the request will fail.
16898 ///
16899 /// # Additional Parameters
16900 ///
16901 /// * *$.xgafv* (query-string) - V1 error format.
16902 /// * *access_token* (query-string) - OAuth access token.
16903 /// * *alt* (query-string) - Data format for response.
16904 /// * *callback* (query-string) - JSONP
16905 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16906 /// * *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.
16907 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16908 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16909 /// * *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.
16910 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16911 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16912 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConfigurationListCall<'a, C>
16913 where
16914 T: AsRef<str>,
16915 {
16916 self._additional_params
16917 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16918 self
16919 }
16920
16921 /// Identifies the authorization scope for the method you are building.
16922 ///
16923 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16924 /// [`Scope::CloudPlatform`].
16925 ///
16926 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16927 /// tokens for more than one scope.
16928 ///
16929 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16930 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16931 /// sufficient, a read-write scope will do as well.
16932 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConfigurationListCall<'a, C>
16933 where
16934 St: AsRef<str>,
16935 {
16936 self._scopes.insert(String::from(scope.as_ref()));
16937 self
16938 }
16939 /// Identifies the authorization scope(s) for the method you are building.
16940 ///
16941 /// See [`Self::add_scope()`] for details.
16942 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConfigurationListCall<'a, C>
16943 where
16944 I: IntoIterator<Item = St>,
16945 St: AsRef<str>,
16946 {
16947 self._scopes
16948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16949 self
16950 }
16951
16952 /// Removes all scopes, and no default scope will be used either.
16953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16954 /// for details).
16955 pub fn clear_scopes(mut self) -> ProjectLocationConfigurationListCall<'a, C> {
16956 self._scopes.clear();
16957 self
16958 }
16959}
16960
16961/// Create a new domain mapping.
16962///
16963/// A builder for the *locations.domainmappings.create* method supported by a *project* resource.
16964/// It is not used directly, but through a [`ProjectMethods`] instance.
16965///
16966/// # Example
16967///
16968/// Instantiate a resource method builder
16969///
16970/// ```test_harness,no_run
16971/// # extern crate hyper;
16972/// # extern crate hyper_rustls;
16973/// # extern crate google_run1 as run1;
16974/// use run1::api::DomainMapping;
16975/// # async fn dox() {
16976/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16977///
16978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16979/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16980/// # .with_native_roots()
16981/// # .unwrap()
16982/// # .https_only()
16983/// # .enable_http2()
16984/// # .build();
16985///
16986/// # let executor = hyper_util::rt::TokioExecutor::new();
16987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16988/// # secret,
16989/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16990/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16991/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16992/// # ),
16993/// # ).build().await.unwrap();
16994///
16995/// # let client = hyper_util::client::legacy::Client::builder(
16996/// # hyper_util::rt::TokioExecutor::new()
16997/// # )
16998/// # .build(
16999/// # hyper_rustls::HttpsConnectorBuilder::new()
17000/// # .with_native_roots()
17001/// # .unwrap()
17002/// # .https_or_http()
17003/// # .enable_http2()
17004/// # .build()
17005/// # );
17006/// # let mut hub = CloudRun::new(client, auth);
17007/// // As the method needs a request, you would usually fill it with the desired information
17008/// // into the respective structure. Some of the parts shown here might not be applicable !
17009/// // Values shown here are possibly random and not representative !
17010/// let mut req = DomainMapping::default();
17011///
17012/// // You can configure optional parameters by calling the respective setters at will, and
17013/// // execute the final call using `doit()`.
17014/// // Values shown here are possibly random and not representative !
17015/// let result = hub.projects().locations_domainmappings_create(req, "parent")
17016/// .dry_run("dolores")
17017/// .doit().await;
17018/// # }
17019/// ```
17020pub struct ProjectLocationDomainmappingCreateCall<'a, C>
17021where
17022 C: 'a,
17023{
17024 hub: &'a CloudRun<C>,
17025 _request: DomainMapping,
17026 _parent: String,
17027 _dry_run: Option<String>,
17028 _delegate: Option<&'a mut dyn common::Delegate>,
17029 _additional_params: HashMap<String, String>,
17030 _scopes: BTreeSet<String>,
17031}
17032
17033impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingCreateCall<'a, C> {}
17034
17035impl<'a, C> ProjectLocationDomainmappingCreateCall<'a, C>
17036where
17037 C: common::Connector,
17038{
17039 /// Perform the operation you have build so far.
17040 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
17041 use std::borrow::Cow;
17042 use std::io::{Read, Seek};
17043
17044 use common::{url::Params, ToParts};
17045 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17046
17047 let mut dd = common::DefaultDelegate;
17048 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17049 dlg.begin(common::MethodInfo {
17050 id: "run.projects.locations.domainmappings.create",
17051 http_method: hyper::Method::POST,
17052 });
17053
17054 for &field in ["alt", "parent", "dryRun"].iter() {
17055 if self._additional_params.contains_key(field) {
17056 dlg.finished(false);
17057 return Err(common::Error::FieldClash(field));
17058 }
17059 }
17060
17061 let mut params = Params::with_capacity(5 + self._additional_params.len());
17062 params.push("parent", self._parent);
17063 if let Some(value) = self._dry_run.as_ref() {
17064 params.push("dryRun", value);
17065 }
17066
17067 params.extend(self._additional_params.iter());
17068
17069 params.push("alt", "json");
17070 let mut url = self.hub._base_url.clone() + "v1/{+parent}/domainmappings";
17071 if self._scopes.is_empty() {
17072 self._scopes
17073 .insert(Scope::CloudPlatform.as_ref().to_string());
17074 }
17075
17076 #[allow(clippy::single_element_loop)]
17077 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17078 url = params.uri_replacement(url, param_name, find_this, true);
17079 }
17080 {
17081 let to_remove = ["parent"];
17082 params.remove_params(&to_remove);
17083 }
17084
17085 let url = params.parse_with_url(&url);
17086
17087 let mut json_mime_type = mime::APPLICATION_JSON;
17088 let mut request_value_reader = {
17089 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17090 common::remove_json_null_values(&mut value);
17091 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17092 serde_json::to_writer(&mut dst, &value).unwrap();
17093 dst
17094 };
17095 let request_size = request_value_reader
17096 .seek(std::io::SeekFrom::End(0))
17097 .unwrap();
17098 request_value_reader
17099 .seek(std::io::SeekFrom::Start(0))
17100 .unwrap();
17101
17102 loop {
17103 let token = match self
17104 .hub
17105 .auth
17106 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17107 .await
17108 {
17109 Ok(token) => token,
17110 Err(e) => match dlg.token(e) {
17111 Ok(token) => token,
17112 Err(e) => {
17113 dlg.finished(false);
17114 return Err(common::Error::MissingToken(e));
17115 }
17116 },
17117 };
17118 request_value_reader
17119 .seek(std::io::SeekFrom::Start(0))
17120 .unwrap();
17121 let mut req_result = {
17122 let client = &self.hub.client;
17123 dlg.pre_request();
17124 let mut req_builder = hyper::Request::builder()
17125 .method(hyper::Method::POST)
17126 .uri(url.as_str())
17127 .header(USER_AGENT, self.hub._user_agent.clone());
17128
17129 if let Some(token) = token.as_ref() {
17130 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17131 }
17132
17133 let request = req_builder
17134 .header(CONTENT_TYPE, json_mime_type.to_string())
17135 .header(CONTENT_LENGTH, request_size as u64)
17136 .body(common::to_body(
17137 request_value_reader.get_ref().clone().into(),
17138 ));
17139
17140 client.request(request.unwrap()).await
17141 };
17142
17143 match req_result {
17144 Err(err) => {
17145 if let common::Retry::After(d) = dlg.http_error(&err) {
17146 sleep(d).await;
17147 continue;
17148 }
17149 dlg.finished(false);
17150 return Err(common::Error::HttpError(err));
17151 }
17152 Ok(res) => {
17153 let (mut parts, body) = res.into_parts();
17154 let mut body = common::Body::new(body);
17155 if !parts.status.is_success() {
17156 let bytes = common::to_bytes(body).await.unwrap_or_default();
17157 let error = serde_json::from_str(&common::to_string(&bytes));
17158 let response = common::to_response(parts, bytes.into());
17159
17160 if let common::Retry::After(d) =
17161 dlg.http_failure(&response, error.as_ref().ok())
17162 {
17163 sleep(d).await;
17164 continue;
17165 }
17166
17167 dlg.finished(false);
17168
17169 return Err(match error {
17170 Ok(value) => common::Error::BadRequest(value),
17171 _ => common::Error::Failure(response),
17172 });
17173 }
17174 let response = {
17175 let bytes = common::to_bytes(body).await.unwrap_or_default();
17176 let encoded = common::to_string(&bytes);
17177 match serde_json::from_str(&encoded) {
17178 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17179 Err(error) => {
17180 dlg.response_json_decode_error(&encoded, &error);
17181 return Err(common::Error::JsonDecodeError(
17182 encoded.to_string(),
17183 error,
17184 ));
17185 }
17186 }
17187 };
17188
17189 dlg.finished(true);
17190 return Ok(response);
17191 }
17192 }
17193 }
17194 }
17195
17196 ///
17197 /// Sets the *request* property to the given value.
17198 ///
17199 /// Even though the property as already been set when instantiating this call,
17200 /// we provide this method for API completeness.
17201 pub fn request(
17202 mut self,
17203 new_value: DomainMapping,
17204 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
17205 self._request = new_value;
17206 self
17207 }
17208 /// 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
17209 ///
17210 /// Sets the *parent* path property to the given value.
17211 ///
17212 /// Even though the property as already been set when instantiating this call,
17213 /// we provide this method for API completeness.
17214 pub fn parent(mut self, new_value: &str) -> ProjectLocationDomainmappingCreateCall<'a, C> {
17215 self._parent = new_value.to_string();
17216 self
17217 }
17218 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
17219 ///
17220 /// Sets the *dry run* query property to the given value.
17221 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationDomainmappingCreateCall<'a, C> {
17222 self._dry_run = Some(new_value.to_string());
17223 self
17224 }
17225 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17226 /// while executing the actual API request.
17227 ///
17228 /// ````text
17229 /// It should be used to handle progress information, and to implement a certain level of resilience.
17230 /// ````
17231 ///
17232 /// Sets the *delegate* property to the given value.
17233 pub fn delegate(
17234 mut self,
17235 new_value: &'a mut dyn common::Delegate,
17236 ) -> ProjectLocationDomainmappingCreateCall<'a, C> {
17237 self._delegate = Some(new_value);
17238 self
17239 }
17240
17241 /// Set any additional parameter of the query string used in the request.
17242 /// It should be used to set parameters which are not yet available through their own
17243 /// setters.
17244 ///
17245 /// Please note that this method must not be used to set any of the known parameters
17246 /// which have their own setter method. If done anyway, the request will fail.
17247 ///
17248 /// # Additional Parameters
17249 ///
17250 /// * *$.xgafv* (query-string) - V1 error format.
17251 /// * *access_token* (query-string) - OAuth access token.
17252 /// * *alt* (query-string) - Data format for response.
17253 /// * *callback* (query-string) - JSONP
17254 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17255 /// * *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.
17256 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17257 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17258 /// * *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.
17259 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17260 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17261 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingCreateCall<'a, C>
17262 where
17263 T: AsRef<str>,
17264 {
17265 self._additional_params
17266 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17267 self
17268 }
17269
17270 /// Identifies the authorization scope for the method you are building.
17271 ///
17272 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17273 /// [`Scope::CloudPlatform`].
17274 ///
17275 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17276 /// tokens for more than one scope.
17277 ///
17278 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17279 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17280 /// sufficient, a read-write scope will do as well.
17281 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingCreateCall<'a, C>
17282 where
17283 St: AsRef<str>,
17284 {
17285 self._scopes.insert(String::from(scope.as_ref()));
17286 self
17287 }
17288 /// Identifies the authorization scope(s) for the method you are building.
17289 ///
17290 /// See [`Self::add_scope()`] for details.
17291 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingCreateCall<'a, C>
17292 where
17293 I: IntoIterator<Item = St>,
17294 St: AsRef<str>,
17295 {
17296 self._scopes
17297 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17298 self
17299 }
17300
17301 /// Removes all scopes, and no default scope will be used either.
17302 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17303 /// for details).
17304 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingCreateCall<'a, C> {
17305 self._scopes.clear();
17306 self
17307 }
17308}
17309
17310/// Delete a domain mapping.
17311///
17312/// A builder for the *locations.domainmappings.delete* method supported by a *project* resource.
17313/// It is not used directly, but through a [`ProjectMethods`] instance.
17314///
17315/// # Example
17316///
17317/// Instantiate a resource method builder
17318///
17319/// ```test_harness,no_run
17320/// # extern crate hyper;
17321/// # extern crate hyper_rustls;
17322/// # extern crate google_run1 as run1;
17323/// # async fn dox() {
17324/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17325///
17326/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17327/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17328/// # .with_native_roots()
17329/// # .unwrap()
17330/// # .https_only()
17331/// # .enable_http2()
17332/// # .build();
17333///
17334/// # let executor = hyper_util::rt::TokioExecutor::new();
17335/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17336/// # secret,
17337/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17338/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17339/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17340/// # ),
17341/// # ).build().await.unwrap();
17342///
17343/// # let client = hyper_util::client::legacy::Client::builder(
17344/// # hyper_util::rt::TokioExecutor::new()
17345/// # )
17346/// # .build(
17347/// # hyper_rustls::HttpsConnectorBuilder::new()
17348/// # .with_native_roots()
17349/// # .unwrap()
17350/// # .https_or_http()
17351/// # .enable_http2()
17352/// # .build()
17353/// # );
17354/// # let mut hub = CloudRun::new(client, auth);
17355/// // You can configure optional parameters by calling the respective setters at will, and
17356/// // execute the final call using `doit()`.
17357/// // Values shown here are possibly random and not representative !
17358/// let result = hub.projects().locations_domainmappings_delete("name")
17359/// .propagation_policy("accusam")
17360/// .kind("sea")
17361/// .dry_run("takimata")
17362/// .api_version("Lorem")
17363/// .doit().await;
17364/// # }
17365/// ```
17366pub struct ProjectLocationDomainmappingDeleteCall<'a, C>
17367where
17368 C: 'a,
17369{
17370 hub: &'a CloudRun<C>,
17371 _name: String,
17372 _propagation_policy: Option<String>,
17373 _kind: Option<String>,
17374 _dry_run: Option<String>,
17375 _api_version: Option<String>,
17376 _delegate: Option<&'a mut dyn common::Delegate>,
17377 _additional_params: HashMap<String, String>,
17378 _scopes: BTreeSet<String>,
17379}
17380
17381impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingDeleteCall<'a, C> {}
17382
17383impl<'a, C> ProjectLocationDomainmappingDeleteCall<'a, C>
17384where
17385 C: common::Connector,
17386{
17387 /// Perform the operation you have build so far.
17388 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
17389 use std::borrow::Cow;
17390 use std::io::{Read, Seek};
17391
17392 use common::{url::Params, ToParts};
17393 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17394
17395 let mut dd = common::DefaultDelegate;
17396 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17397 dlg.begin(common::MethodInfo {
17398 id: "run.projects.locations.domainmappings.delete",
17399 http_method: hyper::Method::DELETE,
17400 });
17401
17402 for &field in [
17403 "alt",
17404 "name",
17405 "propagationPolicy",
17406 "kind",
17407 "dryRun",
17408 "apiVersion",
17409 ]
17410 .iter()
17411 {
17412 if self._additional_params.contains_key(field) {
17413 dlg.finished(false);
17414 return Err(common::Error::FieldClash(field));
17415 }
17416 }
17417
17418 let mut params = Params::with_capacity(7 + self._additional_params.len());
17419 params.push("name", self._name);
17420 if let Some(value) = self._propagation_policy.as_ref() {
17421 params.push("propagationPolicy", value);
17422 }
17423 if let Some(value) = self._kind.as_ref() {
17424 params.push("kind", value);
17425 }
17426 if let Some(value) = self._dry_run.as_ref() {
17427 params.push("dryRun", value);
17428 }
17429 if let Some(value) = self._api_version.as_ref() {
17430 params.push("apiVersion", value);
17431 }
17432
17433 params.extend(self._additional_params.iter());
17434
17435 params.push("alt", "json");
17436 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17437 if self._scopes.is_empty() {
17438 self._scopes
17439 .insert(Scope::CloudPlatform.as_ref().to_string());
17440 }
17441
17442 #[allow(clippy::single_element_loop)]
17443 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17444 url = params.uri_replacement(url, param_name, find_this, true);
17445 }
17446 {
17447 let to_remove = ["name"];
17448 params.remove_params(&to_remove);
17449 }
17450
17451 let url = params.parse_with_url(&url);
17452
17453 loop {
17454 let token = match self
17455 .hub
17456 .auth
17457 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17458 .await
17459 {
17460 Ok(token) => token,
17461 Err(e) => match dlg.token(e) {
17462 Ok(token) => token,
17463 Err(e) => {
17464 dlg.finished(false);
17465 return Err(common::Error::MissingToken(e));
17466 }
17467 },
17468 };
17469 let mut req_result = {
17470 let client = &self.hub.client;
17471 dlg.pre_request();
17472 let mut req_builder = hyper::Request::builder()
17473 .method(hyper::Method::DELETE)
17474 .uri(url.as_str())
17475 .header(USER_AGENT, self.hub._user_agent.clone());
17476
17477 if let Some(token) = token.as_ref() {
17478 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17479 }
17480
17481 let request = req_builder
17482 .header(CONTENT_LENGTH, 0_u64)
17483 .body(common::to_body::<String>(None));
17484
17485 client.request(request.unwrap()).await
17486 };
17487
17488 match req_result {
17489 Err(err) => {
17490 if let common::Retry::After(d) = dlg.http_error(&err) {
17491 sleep(d).await;
17492 continue;
17493 }
17494 dlg.finished(false);
17495 return Err(common::Error::HttpError(err));
17496 }
17497 Ok(res) => {
17498 let (mut parts, body) = res.into_parts();
17499 let mut body = common::Body::new(body);
17500 if !parts.status.is_success() {
17501 let bytes = common::to_bytes(body).await.unwrap_or_default();
17502 let error = serde_json::from_str(&common::to_string(&bytes));
17503 let response = common::to_response(parts, bytes.into());
17504
17505 if let common::Retry::After(d) =
17506 dlg.http_failure(&response, error.as_ref().ok())
17507 {
17508 sleep(d).await;
17509 continue;
17510 }
17511
17512 dlg.finished(false);
17513
17514 return Err(match error {
17515 Ok(value) => common::Error::BadRequest(value),
17516 _ => common::Error::Failure(response),
17517 });
17518 }
17519 let response = {
17520 let bytes = common::to_bytes(body).await.unwrap_or_default();
17521 let encoded = common::to_string(&bytes);
17522 match serde_json::from_str(&encoded) {
17523 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17524 Err(error) => {
17525 dlg.response_json_decode_error(&encoded, &error);
17526 return Err(common::Error::JsonDecodeError(
17527 encoded.to_string(),
17528 error,
17529 ));
17530 }
17531 }
17532 };
17533
17534 dlg.finished(true);
17535 return Ok(response);
17536 }
17537 }
17538 }
17539 }
17540
17541 /// 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
17542 ///
17543 /// Sets the *name* path property to the given value.
17544 ///
17545 /// Even though the property as already been set when instantiating this call,
17546 /// we provide this method for API completeness.
17547 pub fn name(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17548 self._name = new_value.to_string();
17549 self
17550 }
17551 /// 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.
17552 ///
17553 /// Sets the *propagation policy* query property to the given value.
17554 pub fn propagation_policy(
17555 mut self,
17556 new_value: &str,
17557 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17558 self._propagation_policy = Some(new_value.to_string());
17559 self
17560 }
17561 /// Cloud Run currently ignores this parameter.
17562 ///
17563 /// Sets the *kind* query property to the given value.
17564 pub fn kind(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17565 self._kind = Some(new_value.to_string());
17566 self
17567 }
17568 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
17569 ///
17570 /// Sets the *dry run* query property to the given value.
17571 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17572 self._dry_run = Some(new_value.to_string());
17573 self
17574 }
17575 /// Cloud Run currently ignores this parameter.
17576 ///
17577 /// Sets the *api version* query property to the given value.
17578 pub fn api_version(mut self, new_value: &str) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17579 self._api_version = Some(new_value.to_string());
17580 self
17581 }
17582 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17583 /// while executing the actual API request.
17584 ///
17585 /// ````text
17586 /// It should be used to handle progress information, and to implement a certain level of resilience.
17587 /// ````
17588 ///
17589 /// Sets the *delegate* property to the given value.
17590 pub fn delegate(
17591 mut self,
17592 new_value: &'a mut dyn common::Delegate,
17593 ) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17594 self._delegate = Some(new_value);
17595 self
17596 }
17597
17598 /// Set any additional parameter of the query string used in the request.
17599 /// It should be used to set parameters which are not yet available through their own
17600 /// setters.
17601 ///
17602 /// Please note that this method must not be used to set any of the known parameters
17603 /// which have their own setter method. If done anyway, the request will fail.
17604 ///
17605 /// # Additional Parameters
17606 ///
17607 /// * *$.xgafv* (query-string) - V1 error format.
17608 /// * *access_token* (query-string) - OAuth access token.
17609 /// * *alt* (query-string) - Data format for response.
17610 /// * *callback* (query-string) - JSONP
17611 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17612 /// * *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.
17613 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17614 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17615 /// * *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.
17616 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17617 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17618 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingDeleteCall<'a, C>
17619 where
17620 T: AsRef<str>,
17621 {
17622 self._additional_params
17623 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17624 self
17625 }
17626
17627 /// Identifies the authorization scope for the method you are building.
17628 ///
17629 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17630 /// [`Scope::CloudPlatform`].
17631 ///
17632 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17633 /// tokens for more than one scope.
17634 ///
17635 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17636 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17637 /// sufficient, a read-write scope will do as well.
17638 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingDeleteCall<'a, C>
17639 where
17640 St: AsRef<str>,
17641 {
17642 self._scopes.insert(String::from(scope.as_ref()));
17643 self
17644 }
17645 /// Identifies the authorization scope(s) for the method you are building.
17646 ///
17647 /// See [`Self::add_scope()`] for details.
17648 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingDeleteCall<'a, C>
17649 where
17650 I: IntoIterator<Item = St>,
17651 St: AsRef<str>,
17652 {
17653 self._scopes
17654 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17655 self
17656 }
17657
17658 /// Removes all scopes, and no default scope will be used either.
17659 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17660 /// for details).
17661 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingDeleteCall<'a, C> {
17662 self._scopes.clear();
17663 self
17664 }
17665}
17666
17667/// Get information about a domain mapping.
17668///
17669/// A builder for the *locations.domainmappings.get* method supported by a *project* resource.
17670/// It is not used directly, but through a [`ProjectMethods`] instance.
17671///
17672/// # Example
17673///
17674/// Instantiate a resource method builder
17675///
17676/// ```test_harness,no_run
17677/// # extern crate hyper;
17678/// # extern crate hyper_rustls;
17679/// # extern crate google_run1 as run1;
17680/// # async fn dox() {
17681/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17682///
17683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17684/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17685/// # .with_native_roots()
17686/// # .unwrap()
17687/// # .https_only()
17688/// # .enable_http2()
17689/// # .build();
17690///
17691/// # let executor = hyper_util::rt::TokioExecutor::new();
17692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17693/// # secret,
17694/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17695/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17696/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17697/// # ),
17698/// # ).build().await.unwrap();
17699///
17700/// # let client = hyper_util::client::legacy::Client::builder(
17701/// # hyper_util::rt::TokioExecutor::new()
17702/// # )
17703/// # .build(
17704/// # hyper_rustls::HttpsConnectorBuilder::new()
17705/// # .with_native_roots()
17706/// # .unwrap()
17707/// # .https_or_http()
17708/// # .enable_http2()
17709/// # .build()
17710/// # );
17711/// # let mut hub = CloudRun::new(client, auth);
17712/// // You can configure optional parameters by calling the respective setters at will, and
17713/// // execute the final call using `doit()`.
17714/// // Values shown here are possibly random and not representative !
17715/// let result = hub.projects().locations_domainmappings_get("name")
17716/// .doit().await;
17717/// # }
17718/// ```
17719pub struct ProjectLocationDomainmappingGetCall<'a, C>
17720where
17721 C: 'a,
17722{
17723 hub: &'a CloudRun<C>,
17724 _name: String,
17725 _delegate: Option<&'a mut dyn common::Delegate>,
17726 _additional_params: HashMap<String, String>,
17727 _scopes: BTreeSet<String>,
17728}
17729
17730impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingGetCall<'a, C> {}
17731
17732impl<'a, C> ProjectLocationDomainmappingGetCall<'a, C>
17733where
17734 C: common::Connector,
17735{
17736 /// Perform the operation you have build so far.
17737 pub async fn doit(mut self) -> common::Result<(common::Response, DomainMapping)> {
17738 use std::borrow::Cow;
17739 use std::io::{Read, Seek};
17740
17741 use common::{url::Params, ToParts};
17742 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17743
17744 let mut dd = common::DefaultDelegate;
17745 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17746 dlg.begin(common::MethodInfo {
17747 id: "run.projects.locations.domainmappings.get",
17748 http_method: hyper::Method::GET,
17749 });
17750
17751 for &field in ["alt", "name"].iter() {
17752 if self._additional_params.contains_key(field) {
17753 dlg.finished(false);
17754 return Err(common::Error::FieldClash(field));
17755 }
17756 }
17757
17758 let mut params = Params::with_capacity(3 + self._additional_params.len());
17759 params.push("name", self._name);
17760
17761 params.extend(self._additional_params.iter());
17762
17763 params.push("alt", "json");
17764 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17765 if self._scopes.is_empty() {
17766 self._scopes
17767 .insert(Scope::CloudPlatform.as_ref().to_string());
17768 }
17769
17770 #[allow(clippy::single_element_loop)]
17771 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17772 url = params.uri_replacement(url, param_name, find_this, true);
17773 }
17774 {
17775 let to_remove = ["name"];
17776 params.remove_params(&to_remove);
17777 }
17778
17779 let url = params.parse_with_url(&url);
17780
17781 loop {
17782 let token = match self
17783 .hub
17784 .auth
17785 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17786 .await
17787 {
17788 Ok(token) => token,
17789 Err(e) => match dlg.token(e) {
17790 Ok(token) => token,
17791 Err(e) => {
17792 dlg.finished(false);
17793 return Err(common::Error::MissingToken(e));
17794 }
17795 },
17796 };
17797 let mut req_result = {
17798 let client = &self.hub.client;
17799 dlg.pre_request();
17800 let mut req_builder = hyper::Request::builder()
17801 .method(hyper::Method::GET)
17802 .uri(url.as_str())
17803 .header(USER_AGENT, self.hub._user_agent.clone());
17804
17805 if let Some(token) = token.as_ref() {
17806 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17807 }
17808
17809 let request = req_builder
17810 .header(CONTENT_LENGTH, 0_u64)
17811 .body(common::to_body::<String>(None));
17812
17813 client.request(request.unwrap()).await
17814 };
17815
17816 match req_result {
17817 Err(err) => {
17818 if let common::Retry::After(d) = dlg.http_error(&err) {
17819 sleep(d).await;
17820 continue;
17821 }
17822 dlg.finished(false);
17823 return Err(common::Error::HttpError(err));
17824 }
17825 Ok(res) => {
17826 let (mut parts, body) = res.into_parts();
17827 let mut body = common::Body::new(body);
17828 if !parts.status.is_success() {
17829 let bytes = common::to_bytes(body).await.unwrap_or_default();
17830 let error = serde_json::from_str(&common::to_string(&bytes));
17831 let response = common::to_response(parts, bytes.into());
17832
17833 if let common::Retry::After(d) =
17834 dlg.http_failure(&response, error.as_ref().ok())
17835 {
17836 sleep(d).await;
17837 continue;
17838 }
17839
17840 dlg.finished(false);
17841
17842 return Err(match error {
17843 Ok(value) => common::Error::BadRequest(value),
17844 _ => common::Error::Failure(response),
17845 });
17846 }
17847 let response = {
17848 let bytes = common::to_bytes(body).await.unwrap_or_default();
17849 let encoded = common::to_string(&bytes);
17850 match serde_json::from_str(&encoded) {
17851 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17852 Err(error) => {
17853 dlg.response_json_decode_error(&encoded, &error);
17854 return Err(common::Error::JsonDecodeError(
17855 encoded.to_string(),
17856 error,
17857 ));
17858 }
17859 }
17860 };
17861
17862 dlg.finished(true);
17863 return Ok(response);
17864 }
17865 }
17866 }
17867 }
17868
17869 /// 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
17870 ///
17871 /// Sets the *name* path property to the given value.
17872 ///
17873 /// Even though the property as already been set when instantiating this call,
17874 /// we provide this method for API completeness.
17875 pub fn name(mut self, new_value: &str) -> ProjectLocationDomainmappingGetCall<'a, C> {
17876 self._name = new_value.to_string();
17877 self
17878 }
17879 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17880 /// while executing the actual API request.
17881 ///
17882 /// ````text
17883 /// It should be used to handle progress information, and to implement a certain level of resilience.
17884 /// ````
17885 ///
17886 /// Sets the *delegate* property to the given value.
17887 pub fn delegate(
17888 mut self,
17889 new_value: &'a mut dyn common::Delegate,
17890 ) -> ProjectLocationDomainmappingGetCall<'a, C> {
17891 self._delegate = Some(new_value);
17892 self
17893 }
17894
17895 /// Set any additional parameter of the query string used in the request.
17896 /// It should be used to set parameters which are not yet available through their own
17897 /// setters.
17898 ///
17899 /// Please note that this method must not be used to set any of the known parameters
17900 /// which have their own setter method. If done anyway, the request will fail.
17901 ///
17902 /// # Additional Parameters
17903 ///
17904 /// * *$.xgafv* (query-string) - V1 error format.
17905 /// * *access_token* (query-string) - OAuth access token.
17906 /// * *alt* (query-string) - Data format for response.
17907 /// * *callback* (query-string) - JSONP
17908 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17909 /// * *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.
17910 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17911 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17912 /// * *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.
17913 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17914 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17915 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingGetCall<'a, C>
17916 where
17917 T: AsRef<str>,
17918 {
17919 self._additional_params
17920 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17921 self
17922 }
17923
17924 /// Identifies the authorization scope for the method you are building.
17925 ///
17926 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17927 /// [`Scope::CloudPlatform`].
17928 ///
17929 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17930 /// tokens for more than one scope.
17931 ///
17932 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17933 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17934 /// sufficient, a read-write scope will do as well.
17935 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingGetCall<'a, C>
17936 where
17937 St: AsRef<str>,
17938 {
17939 self._scopes.insert(String::from(scope.as_ref()));
17940 self
17941 }
17942 /// Identifies the authorization scope(s) for the method you are building.
17943 ///
17944 /// See [`Self::add_scope()`] for details.
17945 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingGetCall<'a, C>
17946 where
17947 I: IntoIterator<Item = St>,
17948 St: AsRef<str>,
17949 {
17950 self._scopes
17951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17952 self
17953 }
17954
17955 /// Removes all scopes, and no default scope will be used either.
17956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17957 /// for details).
17958 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingGetCall<'a, C> {
17959 self._scopes.clear();
17960 self
17961 }
17962}
17963
17964/// List all domain mappings.
17965///
17966/// A builder for the *locations.domainmappings.list* method supported by a *project* resource.
17967/// It is not used directly, but through a [`ProjectMethods`] instance.
17968///
17969/// # Example
17970///
17971/// Instantiate a resource method builder
17972///
17973/// ```test_harness,no_run
17974/// # extern crate hyper;
17975/// # extern crate hyper_rustls;
17976/// # extern crate google_run1 as run1;
17977/// # async fn dox() {
17978/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17979///
17980/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17981/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17982/// # .with_native_roots()
17983/// # .unwrap()
17984/// # .https_only()
17985/// # .enable_http2()
17986/// # .build();
17987///
17988/// # let executor = hyper_util::rt::TokioExecutor::new();
17989/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17990/// # secret,
17991/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17992/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17993/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17994/// # ),
17995/// # ).build().await.unwrap();
17996///
17997/// # let client = hyper_util::client::legacy::Client::builder(
17998/// # hyper_util::rt::TokioExecutor::new()
17999/// # )
18000/// # .build(
18001/// # hyper_rustls::HttpsConnectorBuilder::new()
18002/// # .with_native_roots()
18003/// # .unwrap()
18004/// # .https_or_http()
18005/// # .enable_http2()
18006/// # .build()
18007/// # );
18008/// # let mut hub = CloudRun::new(client, auth);
18009/// // You can configure optional parameters by calling the respective setters at will, and
18010/// // execute the final call using `doit()`.
18011/// // Values shown here are possibly random and not representative !
18012/// let result = hub.projects().locations_domainmappings_list("parent")
18013/// .watch(true)
18014/// .resource_version("erat")
18015/// .limit(-10)
18016/// .label_selector("nonumy")
18017/// .include_uninitialized(true)
18018/// .field_selector("consetetur")
18019/// .continue_("sit")
18020/// .doit().await;
18021/// # }
18022/// ```
18023pub struct ProjectLocationDomainmappingListCall<'a, C>
18024where
18025 C: 'a,
18026{
18027 hub: &'a CloudRun<C>,
18028 _parent: String,
18029 _watch: Option<bool>,
18030 _resource_version: Option<String>,
18031 _limit: Option<i32>,
18032 _label_selector: Option<String>,
18033 _include_uninitialized: Option<bool>,
18034 _field_selector: Option<String>,
18035 _continue_: Option<String>,
18036 _delegate: Option<&'a mut dyn common::Delegate>,
18037 _additional_params: HashMap<String, String>,
18038 _scopes: BTreeSet<String>,
18039}
18040
18041impl<'a, C> common::CallBuilder for ProjectLocationDomainmappingListCall<'a, C> {}
18042
18043impl<'a, C> ProjectLocationDomainmappingListCall<'a, C>
18044where
18045 C: common::Connector,
18046{
18047 /// Perform the operation you have build so far.
18048 pub async fn doit(mut self) -> common::Result<(common::Response, ListDomainMappingsResponse)> {
18049 use std::borrow::Cow;
18050 use std::io::{Read, Seek};
18051
18052 use common::{url::Params, ToParts};
18053 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18054
18055 let mut dd = common::DefaultDelegate;
18056 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18057 dlg.begin(common::MethodInfo {
18058 id: "run.projects.locations.domainmappings.list",
18059 http_method: hyper::Method::GET,
18060 });
18061
18062 for &field in [
18063 "alt",
18064 "parent",
18065 "watch",
18066 "resourceVersion",
18067 "limit",
18068 "labelSelector",
18069 "includeUninitialized",
18070 "fieldSelector",
18071 "continue",
18072 ]
18073 .iter()
18074 {
18075 if self._additional_params.contains_key(field) {
18076 dlg.finished(false);
18077 return Err(common::Error::FieldClash(field));
18078 }
18079 }
18080
18081 let mut params = Params::with_capacity(10 + self._additional_params.len());
18082 params.push("parent", self._parent);
18083 if let Some(value) = self._watch.as_ref() {
18084 params.push("watch", value.to_string());
18085 }
18086 if let Some(value) = self._resource_version.as_ref() {
18087 params.push("resourceVersion", value);
18088 }
18089 if let Some(value) = self._limit.as_ref() {
18090 params.push("limit", value.to_string());
18091 }
18092 if let Some(value) = self._label_selector.as_ref() {
18093 params.push("labelSelector", value);
18094 }
18095 if let Some(value) = self._include_uninitialized.as_ref() {
18096 params.push("includeUninitialized", value.to_string());
18097 }
18098 if let Some(value) = self._field_selector.as_ref() {
18099 params.push("fieldSelector", value);
18100 }
18101 if let Some(value) = self._continue_.as_ref() {
18102 params.push("continue", value);
18103 }
18104
18105 params.extend(self._additional_params.iter());
18106
18107 params.push("alt", "json");
18108 let mut url = self.hub._base_url.clone() + "v1/{+parent}/domainmappings";
18109 if self._scopes.is_empty() {
18110 self._scopes
18111 .insert(Scope::CloudPlatform.as_ref().to_string());
18112 }
18113
18114 #[allow(clippy::single_element_loop)]
18115 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18116 url = params.uri_replacement(url, param_name, find_this, true);
18117 }
18118 {
18119 let to_remove = ["parent"];
18120 params.remove_params(&to_remove);
18121 }
18122
18123 let url = params.parse_with_url(&url);
18124
18125 loop {
18126 let token = match self
18127 .hub
18128 .auth
18129 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18130 .await
18131 {
18132 Ok(token) => token,
18133 Err(e) => match dlg.token(e) {
18134 Ok(token) => token,
18135 Err(e) => {
18136 dlg.finished(false);
18137 return Err(common::Error::MissingToken(e));
18138 }
18139 },
18140 };
18141 let mut req_result = {
18142 let client = &self.hub.client;
18143 dlg.pre_request();
18144 let mut req_builder = hyper::Request::builder()
18145 .method(hyper::Method::GET)
18146 .uri(url.as_str())
18147 .header(USER_AGENT, self.hub._user_agent.clone());
18148
18149 if let Some(token) = token.as_ref() {
18150 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18151 }
18152
18153 let request = req_builder
18154 .header(CONTENT_LENGTH, 0_u64)
18155 .body(common::to_body::<String>(None));
18156
18157 client.request(request.unwrap()).await
18158 };
18159
18160 match req_result {
18161 Err(err) => {
18162 if let common::Retry::After(d) = dlg.http_error(&err) {
18163 sleep(d).await;
18164 continue;
18165 }
18166 dlg.finished(false);
18167 return Err(common::Error::HttpError(err));
18168 }
18169 Ok(res) => {
18170 let (mut parts, body) = res.into_parts();
18171 let mut body = common::Body::new(body);
18172 if !parts.status.is_success() {
18173 let bytes = common::to_bytes(body).await.unwrap_or_default();
18174 let error = serde_json::from_str(&common::to_string(&bytes));
18175 let response = common::to_response(parts, bytes.into());
18176
18177 if let common::Retry::After(d) =
18178 dlg.http_failure(&response, error.as_ref().ok())
18179 {
18180 sleep(d).await;
18181 continue;
18182 }
18183
18184 dlg.finished(false);
18185
18186 return Err(match error {
18187 Ok(value) => common::Error::BadRequest(value),
18188 _ => common::Error::Failure(response),
18189 });
18190 }
18191 let response = {
18192 let bytes = common::to_bytes(body).await.unwrap_or_default();
18193 let encoded = common::to_string(&bytes);
18194 match serde_json::from_str(&encoded) {
18195 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18196 Err(error) => {
18197 dlg.response_json_decode_error(&encoded, &error);
18198 return Err(common::Error::JsonDecodeError(
18199 encoded.to_string(),
18200 error,
18201 ));
18202 }
18203 }
18204 };
18205
18206 dlg.finished(true);
18207 return Ok(response);
18208 }
18209 }
18210 }
18211 }
18212
18213 /// 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
18214 ///
18215 /// Sets the *parent* path property to the given value.
18216 ///
18217 /// Even though the property as already been set when instantiating this call,
18218 /// we provide this method for API completeness.
18219 pub fn parent(mut self, new_value: &str) -> ProjectLocationDomainmappingListCall<'a, C> {
18220 self._parent = new_value.to_string();
18221 self
18222 }
18223 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
18224 ///
18225 /// Sets the *watch* query property to the given value.
18226 pub fn watch(mut self, new_value: bool) -> ProjectLocationDomainmappingListCall<'a, C> {
18227 self._watch = Some(new_value);
18228 self
18229 }
18230 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
18231 ///
18232 /// Sets the *resource version* query property to the given value.
18233 pub fn resource_version(
18234 mut self,
18235 new_value: &str,
18236 ) -> ProjectLocationDomainmappingListCall<'a, C> {
18237 self._resource_version = Some(new_value.to_string());
18238 self
18239 }
18240 /// Optional. The maximum number of records that should be returned.
18241 ///
18242 /// Sets the *limit* query property to the given value.
18243 pub fn limit(mut self, new_value: i32) -> ProjectLocationDomainmappingListCall<'a, C> {
18244 self._limit = Some(new_value);
18245 self
18246 }
18247 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
18248 ///
18249 /// Sets the *label selector* query property to the given value.
18250 pub fn label_selector(
18251 mut self,
18252 new_value: &str,
18253 ) -> ProjectLocationDomainmappingListCall<'a, C> {
18254 self._label_selector = Some(new_value.to_string());
18255 self
18256 }
18257 /// Not currently used by Cloud Run.
18258 ///
18259 /// Sets the *include uninitialized* query property to the given value.
18260 pub fn include_uninitialized(
18261 mut self,
18262 new_value: bool,
18263 ) -> ProjectLocationDomainmappingListCall<'a, C> {
18264 self._include_uninitialized = Some(new_value);
18265 self
18266 }
18267 /// 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.
18268 ///
18269 /// Sets the *field selector* query property to the given value.
18270 pub fn field_selector(
18271 mut self,
18272 new_value: &str,
18273 ) -> ProjectLocationDomainmappingListCall<'a, C> {
18274 self._field_selector = Some(new_value.to_string());
18275 self
18276 }
18277 /// Optional. Encoded string to continue paging.
18278 ///
18279 /// Sets the *continue* query property to the given value.
18280 pub fn continue_(mut self, new_value: &str) -> ProjectLocationDomainmappingListCall<'a, C> {
18281 self._continue_ = Some(new_value.to_string());
18282 self
18283 }
18284 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18285 /// while executing the actual API request.
18286 ///
18287 /// ````text
18288 /// It should be used to handle progress information, and to implement a certain level of resilience.
18289 /// ````
18290 ///
18291 /// Sets the *delegate* property to the given value.
18292 pub fn delegate(
18293 mut self,
18294 new_value: &'a mut dyn common::Delegate,
18295 ) -> ProjectLocationDomainmappingListCall<'a, C> {
18296 self._delegate = Some(new_value);
18297 self
18298 }
18299
18300 /// Set any additional parameter of the query string used in the request.
18301 /// It should be used to set parameters which are not yet available through their own
18302 /// setters.
18303 ///
18304 /// Please note that this method must not be used to set any of the known parameters
18305 /// which have their own setter method. If done anyway, the request will fail.
18306 ///
18307 /// # Additional Parameters
18308 ///
18309 /// * *$.xgafv* (query-string) - V1 error format.
18310 /// * *access_token* (query-string) - OAuth access token.
18311 /// * *alt* (query-string) - Data format for response.
18312 /// * *callback* (query-string) - JSONP
18313 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18314 /// * *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.
18315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18316 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18317 /// * *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.
18318 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18319 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18320 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDomainmappingListCall<'a, C>
18321 where
18322 T: AsRef<str>,
18323 {
18324 self._additional_params
18325 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18326 self
18327 }
18328
18329 /// Identifies the authorization scope for the method you are building.
18330 ///
18331 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18332 /// [`Scope::CloudPlatform`].
18333 ///
18334 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18335 /// tokens for more than one scope.
18336 ///
18337 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18338 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18339 /// sufficient, a read-write scope will do as well.
18340 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDomainmappingListCall<'a, C>
18341 where
18342 St: AsRef<str>,
18343 {
18344 self._scopes.insert(String::from(scope.as_ref()));
18345 self
18346 }
18347 /// Identifies the authorization scope(s) for the method you are building.
18348 ///
18349 /// See [`Self::add_scope()`] for details.
18350 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDomainmappingListCall<'a, C>
18351 where
18352 I: IntoIterator<Item = St>,
18353 St: AsRef<str>,
18354 {
18355 self._scopes
18356 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18357 self
18358 }
18359
18360 /// Removes all scopes, and no default scope will be used either.
18361 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18362 /// for details).
18363 pub fn clear_scopes(mut self) -> ProjectLocationDomainmappingListCall<'a, C> {
18364 self._scopes.clear();
18365 self
18366 }
18367}
18368
18369/// Get the IAM Access Control policy currently in effect for the given job. This result does not include any inherited policies.
18370///
18371/// A builder for the *locations.jobs.getIamPolicy* method supported by a *project* resource.
18372/// It is not used directly, but through a [`ProjectMethods`] instance.
18373///
18374/// # Example
18375///
18376/// Instantiate a resource method builder
18377///
18378/// ```test_harness,no_run
18379/// # extern crate hyper;
18380/// # extern crate hyper_rustls;
18381/// # extern crate google_run1 as run1;
18382/// # async fn dox() {
18383/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18384///
18385/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18386/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18387/// # .with_native_roots()
18388/// # .unwrap()
18389/// # .https_only()
18390/// # .enable_http2()
18391/// # .build();
18392///
18393/// # let executor = hyper_util::rt::TokioExecutor::new();
18394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18395/// # secret,
18396/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18397/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18398/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18399/// # ),
18400/// # ).build().await.unwrap();
18401///
18402/// # let client = hyper_util::client::legacy::Client::builder(
18403/// # hyper_util::rt::TokioExecutor::new()
18404/// # )
18405/// # .build(
18406/// # hyper_rustls::HttpsConnectorBuilder::new()
18407/// # .with_native_roots()
18408/// # .unwrap()
18409/// # .https_or_http()
18410/// # .enable_http2()
18411/// # .build()
18412/// # );
18413/// # let mut hub = CloudRun::new(client, auth);
18414/// // You can configure optional parameters by calling the respective setters at will, and
18415/// // execute the final call using `doit()`.
18416/// // Values shown here are possibly random and not representative !
18417/// let result = hub.projects().locations_jobs_get_iam_policy("resource")
18418/// .options_requested_policy_version(-25)
18419/// .doit().await;
18420/// # }
18421/// ```
18422pub struct ProjectLocationJobGetIamPolicyCall<'a, C>
18423where
18424 C: 'a,
18425{
18426 hub: &'a CloudRun<C>,
18427 _resource: String,
18428 _options_requested_policy_version: Option<i32>,
18429 _delegate: Option<&'a mut dyn common::Delegate>,
18430 _additional_params: HashMap<String, String>,
18431 _scopes: BTreeSet<String>,
18432}
18433
18434impl<'a, C> common::CallBuilder for ProjectLocationJobGetIamPolicyCall<'a, C> {}
18435
18436impl<'a, C> ProjectLocationJobGetIamPolicyCall<'a, C>
18437where
18438 C: common::Connector,
18439{
18440 /// Perform the operation you have build so far.
18441 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18442 use std::borrow::Cow;
18443 use std::io::{Read, Seek};
18444
18445 use common::{url::Params, ToParts};
18446 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18447
18448 let mut dd = common::DefaultDelegate;
18449 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18450 dlg.begin(common::MethodInfo {
18451 id: "run.projects.locations.jobs.getIamPolicy",
18452 http_method: hyper::Method::GET,
18453 });
18454
18455 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
18456 if self._additional_params.contains_key(field) {
18457 dlg.finished(false);
18458 return Err(common::Error::FieldClash(field));
18459 }
18460 }
18461
18462 let mut params = Params::with_capacity(4 + self._additional_params.len());
18463 params.push("resource", self._resource);
18464 if let Some(value) = self._options_requested_policy_version.as_ref() {
18465 params.push("options.requestedPolicyVersion", value.to_string());
18466 }
18467
18468 params.extend(self._additional_params.iter());
18469
18470 params.push("alt", "json");
18471 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
18472 if self._scopes.is_empty() {
18473 self._scopes
18474 .insert(Scope::CloudPlatform.as_ref().to_string());
18475 }
18476
18477 #[allow(clippy::single_element_loop)]
18478 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18479 url = params.uri_replacement(url, param_name, find_this, true);
18480 }
18481 {
18482 let to_remove = ["resource"];
18483 params.remove_params(&to_remove);
18484 }
18485
18486 let url = params.parse_with_url(&url);
18487
18488 loop {
18489 let token = match self
18490 .hub
18491 .auth
18492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18493 .await
18494 {
18495 Ok(token) => token,
18496 Err(e) => match dlg.token(e) {
18497 Ok(token) => token,
18498 Err(e) => {
18499 dlg.finished(false);
18500 return Err(common::Error::MissingToken(e));
18501 }
18502 },
18503 };
18504 let mut req_result = {
18505 let client = &self.hub.client;
18506 dlg.pre_request();
18507 let mut req_builder = hyper::Request::builder()
18508 .method(hyper::Method::GET)
18509 .uri(url.as_str())
18510 .header(USER_AGENT, self.hub._user_agent.clone());
18511
18512 if let Some(token) = token.as_ref() {
18513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18514 }
18515
18516 let request = req_builder
18517 .header(CONTENT_LENGTH, 0_u64)
18518 .body(common::to_body::<String>(None));
18519
18520 client.request(request.unwrap()).await
18521 };
18522
18523 match req_result {
18524 Err(err) => {
18525 if let common::Retry::After(d) = dlg.http_error(&err) {
18526 sleep(d).await;
18527 continue;
18528 }
18529 dlg.finished(false);
18530 return Err(common::Error::HttpError(err));
18531 }
18532 Ok(res) => {
18533 let (mut parts, body) = res.into_parts();
18534 let mut body = common::Body::new(body);
18535 if !parts.status.is_success() {
18536 let bytes = common::to_bytes(body).await.unwrap_or_default();
18537 let error = serde_json::from_str(&common::to_string(&bytes));
18538 let response = common::to_response(parts, bytes.into());
18539
18540 if let common::Retry::After(d) =
18541 dlg.http_failure(&response, error.as_ref().ok())
18542 {
18543 sleep(d).await;
18544 continue;
18545 }
18546
18547 dlg.finished(false);
18548
18549 return Err(match error {
18550 Ok(value) => common::Error::BadRequest(value),
18551 _ => common::Error::Failure(response),
18552 });
18553 }
18554 let response = {
18555 let bytes = common::to_bytes(body).await.unwrap_or_default();
18556 let encoded = common::to_string(&bytes);
18557 match serde_json::from_str(&encoded) {
18558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18559 Err(error) => {
18560 dlg.response_json_decode_error(&encoded, &error);
18561 return Err(common::Error::JsonDecodeError(
18562 encoded.to_string(),
18563 error,
18564 ));
18565 }
18566 }
18567 };
18568
18569 dlg.finished(true);
18570 return Ok(response);
18571 }
18572 }
18573 }
18574 }
18575
18576 /// 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.
18577 ///
18578 /// Sets the *resource* path property to the given value.
18579 ///
18580 /// Even though the property as already been set when instantiating this call,
18581 /// we provide this method for API completeness.
18582 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
18583 self._resource = new_value.to_string();
18584 self
18585 }
18586 /// 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).
18587 ///
18588 /// Sets the *options.requested policy version* query property to the given value.
18589 pub fn options_requested_policy_version(
18590 mut self,
18591 new_value: i32,
18592 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
18593 self._options_requested_policy_version = Some(new_value);
18594 self
18595 }
18596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18597 /// while executing the actual API request.
18598 ///
18599 /// ````text
18600 /// It should be used to handle progress information, and to implement a certain level of resilience.
18601 /// ````
18602 ///
18603 /// Sets the *delegate* property to the given value.
18604 pub fn delegate(
18605 mut self,
18606 new_value: &'a mut dyn common::Delegate,
18607 ) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
18608 self._delegate = Some(new_value);
18609 self
18610 }
18611
18612 /// Set any additional parameter of the query string used in the request.
18613 /// It should be used to set parameters which are not yet available through their own
18614 /// setters.
18615 ///
18616 /// Please note that this method must not be used to set any of the known parameters
18617 /// which have their own setter method. If done anyway, the request will fail.
18618 ///
18619 /// # Additional Parameters
18620 ///
18621 /// * *$.xgafv* (query-string) - V1 error format.
18622 /// * *access_token* (query-string) - OAuth access token.
18623 /// * *alt* (query-string) - Data format for response.
18624 /// * *callback* (query-string) - JSONP
18625 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18626 /// * *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.
18627 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18628 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18629 /// * *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.
18630 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18631 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18632 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetIamPolicyCall<'a, C>
18633 where
18634 T: AsRef<str>,
18635 {
18636 self._additional_params
18637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18638 self
18639 }
18640
18641 /// Identifies the authorization scope for the method you are building.
18642 ///
18643 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18644 /// [`Scope::CloudPlatform`].
18645 ///
18646 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18647 /// tokens for more than one scope.
18648 ///
18649 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18650 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18651 /// sufficient, a read-write scope will do as well.
18652 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetIamPolicyCall<'a, C>
18653 where
18654 St: AsRef<str>,
18655 {
18656 self._scopes.insert(String::from(scope.as_ref()));
18657 self
18658 }
18659 /// Identifies the authorization scope(s) for the method you are building.
18660 ///
18661 /// See [`Self::add_scope()`] for details.
18662 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetIamPolicyCall<'a, C>
18663 where
18664 I: IntoIterator<Item = St>,
18665 St: AsRef<str>,
18666 {
18667 self._scopes
18668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18669 self
18670 }
18671
18672 /// Removes all scopes, and no default scope will be used either.
18673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18674 /// for details).
18675 pub fn clear_scopes(mut self) -> ProjectLocationJobGetIamPolicyCall<'a, C> {
18676 self._scopes.clear();
18677 self
18678 }
18679}
18680
18681/// Sets the IAM Access control policy for the specified job. Overwrites any existing policy.
18682///
18683/// A builder for the *locations.jobs.setIamPolicy* method supported by a *project* resource.
18684/// It is not used directly, but through a [`ProjectMethods`] instance.
18685///
18686/// # Example
18687///
18688/// Instantiate a resource method builder
18689///
18690/// ```test_harness,no_run
18691/// # extern crate hyper;
18692/// # extern crate hyper_rustls;
18693/// # extern crate google_run1 as run1;
18694/// use run1::api::SetIamPolicyRequest;
18695/// # async fn dox() {
18696/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18697///
18698/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18699/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18700/// # .with_native_roots()
18701/// # .unwrap()
18702/// # .https_only()
18703/// # .enable_http2()
18704/// # .build();
18705///
18706/// # let executor = hyper_util::rt::TokioExecutor::new();
18707/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18708/// # secret,
18709/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18710/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18711/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18712/// # ),
18713/// # ).build().await.unwrap();
18714///
18715/// # let client = hyper_util::client::legacy::Client::builder(
18716/// # hyper_util::rt::TokioExecutor::new()
18717/// # )
18718/// # .build(
18719/// # hyper_rustls::HttpsConnectorBuilder::new()
18720/// # .with_native_roots()
18721/// # .unwrap()
18722/// # .https_or_http()
18723/// # .enable_http2()
18724/// # .build()
18725/// # );
18726/// # let mut hub = CloudRun::new(client, auth);
18727/// // As the method needs a request, you would usually fill it with the desired information
18728/// // into the respective structure. Some of the parts shown here might not be applicable !
18729/// // Values shown here are possibly random and not representative !
18730/// let mut req = SetIamPolicyRequest::default();
18731///
18732/// // You can configure optional parameters by calling the respective setters at will, and
18733/// // execute the final call using `doit()`.
18734/// // Values shown here are possibly random and not representative !
18735/// let result = hub.projects().locations_jobs_set_iam_policy(req, "resource")
18736/// .doit().await;
18737/// # }
18738/// ```
18739pub struct ProjectLocationJobSetIamPolicyCall<'a, C>
18740where
18741 C: 'a,
18742{
18743 hub: &'a CloudRun<C>,
18744 _request: SetIamPolicyRequest,
18745 _resource: String,
18746 _delegate: Option<&'a mut dyn common::Delegate>,
18747 _additional_params: HashMap<String, String>,
18748 _scopes: BTreeSet<String>,
18749}
18750
18751impl<'a, C> common::CallBuilder for ProjectLocationJobSetIamPolicyCall<'a, C> {}
18752
18753impl<'a, C> ProjectLocationJobSetIamPolicyCall<'a, C>
18754where
18755 C: common::Connector,
18756{
18757 /// Perform the operation you have build so far.
18758 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18759 use std::borrow::Cow;
18760 use std::io::{Read, Seek};
18761
18762 use common::{url::Params, ToParts};
18763 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18764
18765 let mut dd = common::DefaultDelegate;
18766 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18767 dlg.begin(common::MethodInfo {
18768 id: "run.projects.locations.jobs.setIamPolicy",
18769 http_method: hyper::Method::POST,
18770 });
18771
18772 for &field in ["alt", "resource"].iter() {
18773 if self._additional_params.contains_key(field) {
18774 dlg.finished(false);
18775 return Err(common::Error::FieldClash(field));
18776 }
18777 }
18778
18779 let mut params = Params::with_capacity(4 + self._additional_params.len());
18780 params.push("resource", self._resource);
18781
18782 params.extend(self._additional_params.iter());
18783
18784 params.push("alt", "json");
18785 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
18786 if self._scopes.is_empty() {
18787 self._scopes
18788 .insert(Scope::CloudPlatform.as_ref().to_string());
18789 }
18790
18791 #[allow(clippy::single_element_loop)]
18792 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18793 url = params.uri_replacement(url, param_name, find_this, true);
18794 }
18795 {
18796 let to_remove = ["resource"];
18797 params.remove_params(&to_remove);
18798 }
18799
18800 let url = params.parse_with_url(&url);
18801
18802 let mut json_mime_type = mime::APPLICATION_JSON;
18803 let mut request_value_reader = {
18804 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18805 common::remove_json_null_values(&mut value);
18806 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18807 serde_json::to_writer(&mut dst, &value).unwrap();
18808 dst
18809 };
18810 let request_size = request_value_reader
18811 .seek(std::io::SeekFrom::End(0))
18812 .unwrap();
18813 request_value_reader
18814 .seek(std::io::SeekFrom::Start(0))
18815 .unwrap();
18816
18817 loop {
18818 let token = match self
18819 .hub
18820 .auth
18821 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18822 .await
18823 {
18824 Ok(token) => token,
18825 Err(e) => match dlg.token(e) {
18826 Ok(token) => token,
18827 Err(e) => {
18828 dlg.finished(false);
18829 return Err(common::Error::MissingToken(e));
18830 }
18831 },
18832 };
18833 request_value_reader
18834 .seek(std::io::SeekFrom::Start(0))
18835 .unwrap();
18836 let mut req_result = {
18837 let client = &self.hub.client;
18838 dlg.pre_request();
18839 let mut req_builder = hyper::Request::builder()
18840 .method(hyper::Method::POST)
18841 .uri(url.as_str())
18842 .header(USER_AGENT, self.hub._user_agent.clone());
18843
18844 if let Some(token) = token.as_ref() {
18845 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18846 }
18847
18848 let request = req_builder
18849 .header(CONTENT_TYPE, json_mime_type.to_string())
18850 .header(CONTENT_LENGTH, request_size as u64)
18851 .body(common::to_body(
18852 request_value_reader.get_ref().clone().into(),
18853 ));
18854
18855 client.request(request.unwrap()).await
18856 };
18857
18858 match req_result {
18859 Err(err) => {
18860 if let common::Retry::After(d) = dlg.http_error(&err) {
18861 sleep(d).await;
18862 continue;
18863 }
18864 dlg.finished(false);
18865 return Err(common::Error::HttpError(err));
18866 }
18867 Ok(res) => {
18868 let (mut parts, body) = res.into_parts();
18869 let mut body = common::Body::new(body);
18870 if !parts.status.is_success() {
18871 let bytes = common::to_bytes(body).await.unwrap_or_default();
18872 let error = serde_json::from_str(&common::to_string(&bytes));
18873 let response = common::to_response(parts, bytes.into());
18874
18875 if let common::Retry::After(d) =
18876 dlg.http_failure(&response, error.as_ref().ok())
18877 {
18878 sleep(d).await;
18879 continue;
18880 }
18881
18882 dlg.finished(false);
18883
18884 return Err(match error {
18885 Ok(value) => common::Error::BadRequest(value),
18886 _ => common::Error::Failure(response),
18887 });
18888 }
18889 let response = {
18890 let bytes = common::to_bytes(body).await.unwrap_or_default();
18891 let encoded = common::to_string(&bytes);
18892 match serde_json::from_str(&encoded) {
18893 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18894 Err(error) => {
18895 dlg.response_json_decode_error(&encoded, &error);
18896 return Err(common::Error::JsonDecodeError(
18897 encoded.to_string(),
18898 error,
18899 ));
18900 }
18901 }
18902 };
18903
18904 dlg.finished(true);
18905 return Ok(response);
18906 }
18907 }
18908 }
18909 }
18910
18911 ///
18912 /// Sets the *request* property to the given value.
18913 ///
18914 /// Even though the property as already been set when instantiating this call,
18915 /// we provide this method for API completeness.
18916 pub fn request(
18917 mut self,
18918 new_value: SetIamPolicyRequest,
18919 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
18920 self._request = new_value;
18921 self
18922 }
18923 /// 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.
18924 ///
18925 /// Sets the *resource* path property to the given value.
18926 ///
18927 /// Even though the property as already been set when instantiating this call,
18928 /// we provide this method for API completeness.
18929 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
18930 self._resource = new_value.to_string();
18931 self
18932 }
18933 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18934 /// while executing the actual API request.
18935 ///
18936 /// ````text
18937 /// It should be used to handle progress information, and to implement a certain level of resilience.
18938 /// ````
18939 ///
18940 /// Sets the *delegate* property to the given value.
18941 pub fn delegate(
18942 mut self,
18943 new_value: &'a mut dyn common::Delegate,
18944 ) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
18945 self._delegate = Some(new_value);
18946 self
18947 }
18948
18949 /// Set any additional parameter of the query string used in the request.
18950 /// It should be used to set parameters which are not yet available through their own
18951 /// setters.
18952 ///
18953 /// Please note that this method must not be used to set any of the known parameters
18954 /// which have their own setter method. If done anyway, the request will fail.
18955 ///
18956 /// # Additional Parameters
18957 ///
18958 /// * *$.xgafv* (query-string) - V1 error format.
18959 /// * *access_token* (query-string) - OAuth access token.
18960 /// * *alt* (query-string) - Data format for response.
18961 /// * *callback* (query-string) - JSONP
18962 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18963 /// * *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.
18964 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18965 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18966 /// * *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.
18967 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18968 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18969 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobSetIamPolicyCall<'a, C>
18970 where
18971 T: AsRef<str>,
18972 {
18973 self._additional_params
18974 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18975 self
18976 }
18977
18978 /// Identifies the authorization scope for the method you are building.
18979 ///
18980 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18981 /// [`Scope::CloudPlatform`].
18982 ///
18983 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18984 /// tokens for more than one scope.
18985 ///
18986 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18987 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18988 /// sufficient, a read-write scope will do as well.
18989 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobSetIamPolicyCall<'a, C>
18990 where
18991 St: AsRef<str>,
18992 {
18993 self._scopes.insert(String::from(scope.as_ref()));
18994 self
18995 }
18996 /// Identifies the authorization scope(s) for the method you are building.
18997 ///
18998 /// See [`Self::add_scope()`] for details.
18999 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobSetIamPolicyCall<'a, C>
19000 where
19001 I: IntoIterator<Item = St>,
19002 St: AsRef<str>,
19003 {
19004 self._scopes
19005 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19006 self
19007 }
19008
19009 /// Removes all scopes, and no default scope will be used either.
19010 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19011 /// for details).
19012 pub fn clear_scopes(mut self) -> ProjectLocationJobSetIamPolicyCall<'a, C> {
19013 self._scopes.clear();
19014 self
19015 }
19016}
19017
19018/// Returns permissions that a caller has on the specified job. There are no permissions required for making this API call.
19019///
19020/// A builder for the *locations.jobs.testIamPermissions* method supported by a *project* resource.
19021/// It is not used directly, but through a [`ProjectMethods`] instance.
19022///
19023/// # Example
19024///
19025/// Instantiate a resource method builder
19026///
19027/// ```test_harness,no_run
19028/// # extern crate hyper;
19029/// # extern crate hyper_rustls;
19030/// # extern crate google_run1 as run1;
19031/// use run1::api::TestIamPermissionsRequest;
19032/// # async fn dox() {
19033/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19034///
19035/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19036/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19037/// # .with_native_roots()
19038/// # .unwrap()
19039/// # .https_only()
19040/// # .enable_http2()
19041/// # .build();
19042///
19043/// # let executor = hyper_util::rt::TokioExecutor::new();
19044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19045/// # secret,
19046/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19047/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19048/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19049/// # ),
19050/// # ).build().await.unwrap();
19051///
19052/// # let client = hyper_util::client::legacy::Client::builder(
19053/// # hyper_util::rt::TokioExecutor::new()
19054/// # )
19055/// # .build(
19056/// # hyper_rustls::HttpsConnectorBuilder::new()
19057/// # .with_native_roots()
19058/// # .unwrap()
19059/// # .https_or_http()
19060/// # .enable_http2()
19061/// # .build()
19062/// # );
19063/// # let mut hub = CloudRun::new(client, auth);
19064/// // As the method needs a request, you would usually fill it with the desired information
19065/// // into the respective structure. Some of the parts shown here might not be applicable !
19066/// // Values shown here are possibly random and not representative !
19067/// let mut req = TestIamPermissionsRequest::default();
19068///
19069/// // You can configure optional parameters by calling the respective setters at will, and
19070/// // execute the final call using `doit()`.
19071/// // Values shown here are possibly random and not representative !
19072/// let result = hub.projects().locations_jobs_test_iam_permissions(req, "resource")
19073/// .doit().await;
19074/// # }
19075/// ```
19076pub struct ProjectLocationJobTestIamPermissionCall<'a, C>
19077where
19078 C: 'a,
19079{
19080 hub: &'a CloudRun<C>,
19081 _request: TestIamPermissionsRequest,
19082 _resource: String,
19083 _delegate: Option<&'a mut dyn common::Delegate>,
19084 _additional_params: HashMap<String, String>,
19085 _scopes: BTreeSet<String>,
19086}
19087
19088impl<'a, C> common::CallBuilder for ProjectLocationJobTestIamPermissionCall<'a, C> {}
19089
19090impl<'a, C> ProjectLocationJobTestIamPermissionCall<'a, C>
19091where
19092 C: common::Connector,
19093{
19094 /// Perform the operation you have build so far.
19095 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
19096 use std::borrow::Cow;
19097 use std::io::{Read, Seek};
19098
19099 use common::{url::Params, ToParts};
19100 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19101
19102 let mut dd = common::DefaultDelegate;
19103 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19104 dlg.begin(common::MethodInfo {
19105 id: "run.projects.locations.jobs.testIamPermissions",
19106 http_method: hyper::Method::POST,
19107 });
19108
19109 for &field in ["alt", "resource"].iter() {
19110 if self._additional_params.contains_key(field) {
19111 dlg.finished(false);
19112 return Err(common::Error::FieldClash(field));
19113 }
19114 }
19115
19116 let mut params = Params::with_capacity(4 + self._additional_params.len());
19117 params.push("resource", self._resource);
19118
19119 params.extend(self._additional_params.iter());
19120
19121 params.push("alt", "json");
19122 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
19123 if self._scopes.is_empty() {
19124 self._scopes
19125 .insert(Scope::CloudPlatform.as_ref().to_string());
19126 }
19127
19128 #[allow(clippy::single_element_loop)]
19129 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19130 url = params.uri_replacement(url, param_name, find_this, true);
19131 }
19132 {
19133 let to_remove = ["resource"];
19134 params.remove_params(&to_remove);
19135 }
19136
19137 let url = params.parse_with_url(&url);
19138
19139 let mut json_mime_type = mime::APPLICATION_JSON;
19140 let mut request_value_reader = {
19141 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19142 common::remove_json_null_values(&mut value);
19143 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19144 serde_json::to_writer(&mut dst, &value).unwrap();
19145 dst
19146 };
19147 let request_size = request_value_reader
19148 .seek(std::io::SeekFrom::End(0))
19149 .unwrap();
19150 request_value_reader
19151 .seek(std::io::SeekFrom::Start(0))
19152 .unwrap();
19153
19154 loop {
19155 let token = match self
19156 .hub
19157 .auth
19158 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19159 .await
19160 {
19161 Ok(token) => token,
19162 Err(e) => match dlg.token(e) {
19163 Ok(token) => token,
19164 Err(e) => {
19165 dlg.finished(false);
19166 return Err(common::Error::MissingToken(e));
19167 }
19168 },
19169 };
19170 request_value_reader
19171 .seek(std::io::SeekFrom::Start(0))
19172 .unwrap();
19173 let mut req_result = {
19174 let client = &self.hub.client;
19175 dlg.pre_request();
19176 let mut req_builder = hyper::Request::builder()
19177 .method(hyper::Method::POST)
19178 .uri(url.as_str())
19179 .header(USER_AGENT, self.hub._user_agent.clone());
19180
19181 if let Some(token) = token.as_ref() {
19182 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19183 }
19184
19185 let request = req_builder
19186 .header(CONTENT_TYPE, json_mime_type.to_string())
19187 .header(CONTENT_LENGTH, request_size as u64)
19188 .body(common::to_body(
19189 request_value_reader.get_ref().clone().into(),
19190 ));
19191
19192 client.request(request.unwrap()).await
19193 };
19194
19195 match req_result {
19196 Err(err) => {
19197 if let common::Retry::After(d) = dlg.http_error(&err) {
19198 sleep(d).await;
19199 continue;
19200 }
19201 dlg.finished(false);
19202 return Err(common::Error::HttpError(err));
19203 }
19204 Ok(res) => {
19205 let (mut parts, body) = res.into_parts();
19206 let mut body = common::Body::new(body);
19207 if !parts.status.is_success() {
19208 let bytes = common::to_bytes(body).await.unwrap_or_default();
19209 let error = serde_json::from_str(&common::to_string(&bytes));
19210 let response = common::to_response(parts, bytes.into());
19211
19212 if let common::Retry::After(d) =
19213 dlg.http_failure(&response, error.as_ref().ok())
19214 {
19215 sleep(d).await;
19216 continue;
19217 }
19218
19219 dlg.finished(false);
19220
19221 return Err(match error {
19222 Ok(value) => common::Error::BadRequest(value),
19223 _ => common::Error::Failure(response),
19224 });
19225 }
19226 let response = {
19227 let bytes = common::to_bytes(body).await.unwrap_or_default();
19228 let encoded = common::to_string(&bytes);
19229 match serde_json::from_str(&encoded) {
19230 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19231 Err(error) => {
19232 dlg.response_json_decode_error(&encoded, &error);
19233 return Err(common::Error::JsonDecodeError(
19234 encoded.to_string(),
19235 error,
19236 ));
19237 }
19238 }
19239 };
19240
19241 dlg.finished(true);
19242 return Ok(response);
19243 }
19244 }
19245 }
19246 }
19247
19248 ///
19249 /// Sets the *request* property to the given value.
19250 ///
19251 /// Even though the property as already been set when instantiating this call,
19252 /// we provide this method for API completeness.
19253 pub fn request(
19254 mut self,
19255 new_value: TestIamPermissionsRequest,
19256 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
19257 self._request = new_value;
19258 self
19259 }
19260 /// 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.
19261 ///
19262 /// Sets the *resource* path property to the given value.
19263 ///
19264 /// Even though the property as already been set when instantiating this call,
19265 /// we provide this method for API completeness.
19266 pub fn resource(mut self, new_value: &str) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
19267 self._resource = new_value.to_string();
19268 self
19269 }
19270 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19271 /// while executing the actual API request.
19272 ///
19273 /// ````text
19274 /// It should be used to handle progress information, and to implement a certain level of resilience.
19275 /// ````
19276 ///
19277 /// Sets the *delegate* property to the given value.
19278 pub fn delegate(
19279 mut self,
19280 new_value: &'a mut dyn common::Delegate,
19281 ) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
19282 self._delegate = Some(new_value);
19283 self
19284 }
19285
19286 /// Set any additional parameter of the query string used in the request.
19287 /// It should be used to set parameters which are not yet available through their own
19288 /// setters.
19289 ///
19290 /// Please note that this method must not be used to set any of the known parameters
19291 /// which have their own setter method. If done anyway, the request will fail.
19292 ///
19293 /// # Additional Parameters
19294 ///
19295 /// * *$.xgafv* (query-string) - V1 error format.
19296 /// * *access_token* (query-string) - OAuth access token.
19297 /// * *alt* (query-string) - Data format for response.
19298 /// * *callback* (query-string) - JSONP
19299 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19300 /// * *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.
19301 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19302 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19303 /// * *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.
19304 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19305 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19306 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTestIamPermissionCall<'a, C>
19307 where
19308 T: AsRef<str>,
19309 {
19310 self._additional_params
19311 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19312 self
19313 }
19314
19315 /// Identifies the authorization scope for the method you are building.
19316 ///
19317 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19318 /// [`Scope::CloudPlatform`].
19319 ///
19320 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19321 /// tokens for more than one scope.
19322 ///
19323 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19324 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19325 /// sufficient, a read-write scope will do as well.
19326 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTestIamPermissionCall<'a, C>
19327 where
19328 St: AsRef<str>,
19329 {
19330 self._scopes.insert(String::from(scope.as_ref()));
19331 self
19332 }
19333 /// Identifies the authorization scope(s) for the method you are building.
19334 ///
19335 /// See [`Self::add_scope()`] for details.
19336 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTestIamPermissionCall<'a, C>
19337 where
19338 I: IntoIterator<Item = St>,
19339 St: AsRef<str>,
19340 {
19341 self._scopes
19342 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19343 self
19344 }
19345
19346 /// Removes all scopes, and no default scope will be used either.
19347 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19348 /// for details).
19349 pub fn clear_scopes(mut self) -> ProjectLocationJobTestIamPermissionCall<'a, C> {
19350 self._scopes.clear();
19351 self
19352 }
19353}
19354
19355/// 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`.
19356///
19357/// A builder for the *locations.operations.delete* method supported by a *project* resource.
19358/// It is not used directly, but through a [`ProjectMethods`] instance.
19359///
19360/// # Example
19361///
19362/// Instantiate a resource method builder
19363///
19364/// ```test_harness,no_run
19365/// # extern crate hyper;
19366/// # extern crate hyper_rustls;
19367/// # extern crate google_run1 as run1;
19368/// # async fn dox() {
19369/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19370///
19371/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19372/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19373/// # .with_native_roots()
19374/// # .unwrap()
19375/// # .https_only()
19376/// # .enable_http2()
19377/// # .build();
19378///
19379/// # let executor = hyper_util::rt::TokioExecutor::new();
19380/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19381/// # secret,
19382/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19383/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19384/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19385/// # ),
19386/// # ).build().await.unwrap();
19387///
19388/// # let client = hyper_util::client::legacy::Client::builder(
19389/// # hyper_util::rt::TokioExecutor::new()
19390/// # )
19391/// # .build(
19392/// # hyper_rustls::HttpsConnectorBuilder::new()
19393/// # .with_native_roots()
19394/// # .unwrap()
19395/// # .https_or_http()
19396/// # .enable_http2()
19397/// # .build()
19398/// # );
19399/// # let mut hub = CloudRun::new(client, auth);
19400/// // You can configure optional parameters by calling the respective setters at will, and
19401/// // execute the final call using `doit()`.
19402/// // Values shown here are possibly random and not representative !
19403/// let result = hub.projects().locations_operations_delete("name")
19404/// .doit().await;
19405/// # }
19406/// ```
19407pub struct ProjectLocationOperationDeleteCall<'a, C>
19408where
19409 C: 'a,
19410{
19411 hub: &'a CloudRun<C>,
19412 _name: String,
19413 _delegate: Option<&'a mut dyn common::Delegate>,
19414 _additional_params: HashMap<String, String>,
19415 _scopes: BTreeSet<String>,
19416}
19417
19418impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
19419
19420impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
19421where
19422 C: common::Connector,
19423{
19424 /// Perform the operation you have build so far.
19425 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
19426 use std::borrow::Cow;
19427 use std::io::{Read, Seek};
19428
19429 use common::{url::Params, ToParts};
19430 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19431
19432 let mut dd = common::DefaultDelegate;
19433 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19434 dlg.begin(common::MethodInfo {
19435 id: "run.projects.locations.operations.delete",
19436 http_method: hyper::Method::DELETE,
19437 });
19438
19439 for &field in ["alt", "name"].iter() {
19440 if self._additional_params.contains_key(field) {
19441 dlg.finished(false);
19442 return Err(common::Error::FieldClash(field));
19443 }
19444 }
19445
19446 let mut params = Params::with_capacity(3 + self._additional_params.len());
19447 params.push("name", self._name);
19448
19449 params.extend(self._additional_params.iter());
19450
19451 params.push("alt", "json");
19452 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19453 if self._scopes.is_empty() {
19454 self._scopes
19455 .insert(Scope::CloudPlatform.as_ref().to_string());
19456 }
19457
19458 #[allow(clippy::single_element_loop)]
19459 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19460 url = params.uri_replacement(url, param_name, find_this, true);
19461 }
19462 {
19463 let to_remove = ["name"];
19464 params.remove_params(&to_remove);
19465 }
19466
19467 let url = params.parse_with_url(&url);
19468
19469 loop {
19470 let token = match self
19471 .hub
19472 .auth
19473 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19474 .await
19475 {
19476 Ok(token) => token,
19477 Err(e) => match dlg.token(e) {
19478 Ok(token) => token,
19479 Err(e) => {
19480 dlg.finished(false);
19481 return Err(common::Error::MissingToken(e));
19482 }
19483 },
19484 };
19485 let mut req_result = {
19486 let client = &self.hub.client;
19487 dlg.pre_request();
19488 let mut req_builder = hyper::Request::builder()
19489 .method(hyper::Method::DELETE)
19490 .uri(url.as_str())
19491 .header(USER_AGENT, self.hub._user_agent.clone());
19492
19493 if let Some(token) = token.as_ref() {
19494 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19495 }
19496
19497 let request = req_builder
19498 .header(CONTENT_LENGTH, 0_u64)
19499 .body(common::to_body::<String>(None));
19500
19501 client.request(request.unwrap()).await
19502 };
19503
19504 match req_result {
19505 Err(err) => {
19506 if let common::Retry::After(d) = dlg.http_error(&err) {
19507 sleep(d).await;
19508 continue;
19509 }
19510 dlg.finished(false);
19511 return Err(common::Error::HttpError(err));
19512 }
19513 Ok(res) => {
19514 let (mut parts, body) = res.into_parts();
19515 let mut body = common::Body::new(body);
19516 if !parts.status.is_success() {
19517 let bytes = common::to_bytes(body).await.unwrap_or_default();
19518 let error = serde_json::from_str(&common::to_string(&bytes));
19519 let response = common::to_response(parts, bytes.into());
19520
19521 if let common::Retry::After(d) =
19522 dlg.http_failure(&response, error.as_ref().ok())
19523 {
19524 sleep(d).await;
19525 continue;
19526 }
19527
19528 dlg.finished(false);
19529
19530 return Err(match error {
19531 Ok(value) => common::Error::BadRequest(value),
19532 _ => common::Error::Failure(response),
19533 });
19534 }
19535 let response = {
19536 let bytes = common::to_bytes(body).await.unwrap_or_default();
19537 let encoded = common::to_string(&bytes);
19538 match serde_json::from_str(&encoded) {
19539 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19540 Err(error) => {
19541 dlg.response_json_decode_error(&encoded, &error);
19542 return Err(common::Error::JsonDecodeError(
19543 encoded.to_string(),
19544 error,
19545 ));
19546 }
19547 }
19548 };
19549
19550 dlg.finished(true);
19551 return Ok(response);
19552 }
19553 }
19554 }
19555 }
19556
19557 /// The name of the operation resource to be deleted.
19558 ///
19559 /// Sets the *name* path property to the given value.
19560 ///
19561 /// Even though the property as already been set when instantiating this call,
19562 /// we provide this method for API completeness.
19563 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
19564 self._name = new_value.to_string();
19565 self
19566 }
19567 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19568 /// while executing the actual API request.
19569 ///
19570 /// ````text
19571 /// It should be used to handle progress information, and to implement a certain level of resilience.
19572 /// ````
19573 ///
19574 /// Sets the *delegate* property to the given value.
19575 pub fn delegate(
19576 mut self,
19577 new_value: &'a mut dyn common::Delegate,
19578 ) -> ProjectLocationOperationDeleteCall<'a, C> {
19579 self._delegate = Some(new_value);
19580 self
19581 }
19582
19583 /// Set any additional parameter of the query string used in the request.
19584 /// It should be used to set parameters which are not yet available through their own
19585 /// setters.
19586 ///
19587 /// Please note that this method must not be used to set any of the known parameters
19588 /// which have their own setter method. If done anyway, the request will fail.
19589 ///
19590 /// # Additional Parameters
19591 ///
19592 /// * *$.xgafv* (query-string) - V1 error format.
19593 /// * *access_token* (query-string) - OAuth access token.
19594 /// * *alt* (query-string) - Data format for response.
19595 /// * *callback* (query-string) - JSONP
19596 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19597 /// * *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.
19598 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19599 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19600 /// * *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.
19601 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19602 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19603 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
19604 where
19605 T: AsRef<str>,
19606 {
19607 self._additional_params
19608 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19609 self
19610 }
19611
19612 /// Identifies the authorization scope for the method you are building.
19613 ///
19614 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19615 /// [`Scope::CloudPlatform`].
19616 ///
19617 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19618 /// tokens for more than one scope.
19619 ///
19620 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19621 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19622 /// sufficient, a read-write scope will do as well.
19623 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
19624 where
19625 St: AsRef<str>,
19626 {
19627 self._scopes.insert(String::from(scope.as_ref()));
19628 self
19629 }
19630 /// Identifies the authorization scope(s) for the method you are building.
19631 ///
19632 /// See [`Self::add_scope()`] for details.
19633 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
19634 where
19635 I: IntoIterator<Item = St>,
19636 St: AsRef<str>,
19637 {
19638 self._scopes
19639 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19640 self
19641 }
19642
19643 /// Removes all scopes, and no default scope will be used either.
19644 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19645 /// for details).
19646 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
19647 self._scopes.clear();
19648 self
19649 }
19650}
19651
19652/// 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.
19653///
19654/// A builder for the *locations.operations.get* method supported by a *project* resource.
19655/// It is not used directly, but through a [`ProjectMethods`] instance.
19656///
19657/// # Example
19658///
19659/// Instantiate a resource method builder
19660///
19661/// ```test_harness,no_run
19662/// # extern crate hyper;
19663/// # extern crate hyper_rustls;
19664/// # extern crate google_run1 as run1;
19665/// # async fn dox() {
19666/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19667///
19668/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19669/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19670/// # .with_native_roots()
19671/// # .unwrap()
19672/// # .https_only()
19673/// # .enable_http2()
19674/// # .build();
19675///
19676/// # let executor = hyper_util::rt::TokioExecutor::new();
19677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19678/// # secret,
19679/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19680/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19681/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19682/// # ),
19683/// # ).build().await.unwrap();
19684///
19685/// # let client = hyper_util::client::legacy::Client::builder(
19686/// # hyper_util::rt::TokioExecutor::new()
19687/// # )
19688/// # .build(
19689/// # hyper_rustls::HttpsConnectorBuilder::new()
19690/// # .with_native_roots()
19691/// # .unwrap()
19692/// # .https_or_http()
19693/// # .enable_http2()
19694/// # .build()
19695/// # );
19696/// # let mut hub = CloudRun::new(client, auth);
19697/// // You can configure optional parameters by calling the respective setters at will, and
19698/// // execute the final call using `doit()`.
19699/// // Values shown here are possibly random and not representative !
19700/// let result = hub.projects().locations_operations_get("name")
19701/// .doit().await;
19702/// # }
19703/// ```
19704pub struct ProjectLocationOperationGetCall<'a, C>
19705where
19706 C: 'a,
19707{
19708 hub: &'a CloudRun<C>,
19709 _name: String,
19710 _delegate: Option<&'a mut dyn common::Delegate>,
19711 _additional_params: HashMap<String, String>,
19712 _scopes: BTreeSet<String>,
19713}
19714
19715impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
19716
19717impl<'a, C> ProjectLocationOperationGetCall<'a, C>
19718where
19719 C: common::Connector,
19720{
19721 /// Perform the operation you have build so far.
19722 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
19723 use std::borrow::Cow;
19724 use std::io::{Read, Seek};
19725
19726 use common::{url::Params, ToParts};
19727 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19728
19729 let mut dd = common::DefaultDelegate;
19730 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19731 dlg.begin(common::MethodInfo {
19732 id: "run.projects.locations.operations.get",
19733 http_method: hyper::Method::GET,
19734 });
19735
19736 for &field in ["alt", "name"].iter() {
19737 if self._additional_params.contains_key(field) {
19738 dlg.finished(false);
19739 return Err(common::Error::FieldClash(field));
19740 }
19741 }
19742
19743 let mut params = Params::with_capacity(3 + self._additional_params.len());
19744 params.push("name", self._name);
19745
19746 params.extend(self._additional_params.iter());
19747
19748 params.push("alt", "json");
19749 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19750 if self._scopes.is_empty() {
19751 self._scopes
19752 .insert(Scope::CloudPlatform.as_ref().to_string());
19753 }
19754
19755 #[allow(clippy::single_element_loop)]
19756 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19757 url = params.uri_replacement(url, param_name, find_this, true);
19758 }
19759 {
19760 let to_remove = ["name"];
19761 params.remove_params(&to_remove);
19762 }
19763
19764 let url = params.parse_with_url(&url);
19765
19766 loop {
19767 let token = match self
19768 .hub
19769 .auth
19770 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19771 .await
19772 {
19773 Ok(token) => token,
19774 Err(e) => match dlg.token(e) {
19775 Ok(token) => token,
19776 Err(e) => {
19777 dlg.finished(false);
19778 return Err(common::Error::MissingToken(e));
19779 }
19780 },
19781 };
19782 let mut req_result = {
19783 let client = &self.hub.client;
19784 dlg.pre_request();
19785 let mut req_builder = hyper::Request::builder()
19786 .method(hyper::Method::GET)
19787 .uri(url.as_str())
19788 .header(USER_AGENT, self.hub._user_agent.clone());
19789
19790 if let Some(token) = token.as_ref() {
19791 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19792 }
19793
19794 let request = req_builder
19795 .header(CONTENT_LENGTH, 0_u64)
19796 .body(common::to_body::<String>(None));
19797
19798 client.request(request.unwrap()).await
19799 };
19800
19801 match req_result {
19802 Err(err) => {
19803 if let common::Retry::After(d) = dlg.http_error(&err) {
19804 sleep(d).await;
19805 continue;
19806 }
19807 dlg.finished(false);
19808 return Err(common::Error::HttpError(err));
19809 }
19810 Ok(res) => {
19811 let (mut parts, body) = res.into_parts();
19812 let mut body = common::Body::new(body);
19813 if !parts.status.is_success() {
19814 let bytes = common::to_bytes(body).await.unwrap_or_default();
19815 let error = serde_json::from_str(&common::to_string(&bytes));
19816 let response = common::to_response(parts, bytes.into());
19817
19818 if let common::Retry::After(d) =
19819 dlg.http_failure(&response, error.as_ref().ok())
19820 {
19821 sleep(d).await;
19822 continue;
19823 }
19824
19825 dlg.finished(false);
19826
19827 return Err(match error {
19828 Ok(value) => common::Error::BadRequest(value),
19829 _ => common::Error::Failure(response),
19830 });
19831 }
19832 let response = {
19833 let bytes = common::to_bytes(body).await.unwrap_or_default();
19834 let encoded = common::to_string(&bytes);
19835 match serde_json::from_str(&encoded) {
19836 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19837 Err(error) => {
19838 dlg.response_json_decode_error(&encoded, &error);
19839 return Err(common::Error::JsonDecodeError(
19840 encoded.to_string(),
19841 error,
19842 ));
19843 }
19844 }
19845 };
19846
19847 dlg.finished(true);
19848 return Ok(response);
19849 }
19850 }
19851 }
19852 }
19853
19854 /// The name of the operation resource.
19855 ///
19856 /// Sets the *name* path property to the given value.
19857 ///
19858 /// Even though the property as already been set when instantiating this call,
19859 /// we provide this method for API completeness.
19860 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
19861 self._name = new_value.to_string();
19862 self
19863 }
19864 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19865 /// while executing the actual API request.
19866 ///
19867 /// ````text
19868 /// It should be used to handle progress information, and to implement a certain level of resilience.
19869 /// ````
19870 ///
19871 /// Sets the *delegate* property to the given value.
19872 pub fn delegate(
19873 mut self,
19874 new_value: &'a mut dyn common::Delegate,
19875 ) -> ProjectLocationOperationGetCall<'a, C> {
19876 self._delegate = Some(new_value);
19877 self
19878 }
19879
19880 /// Set any additional parameter of the query string used in the request.
19881 /// It should be used to set parameters which are not yet available through their own
19882 /// setters.
19883 ///
19884 /// Please note that this method must not be used to set any of the known parameters
19885 /// which have their own setter method. If done anyway, the request will fail.
19886 ///
19887 /// # Additional Parameters
19888 ///
19889 /// * *$.xgafv* (query-string) - V1 error format.
19890 /// * *access_token* (query-string) - OAuth access token.
19891 /// * *alt* (query-string) - Data format for response.
19892 /// * *callback* (query-string) - JSONP
19893 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19894 /// * *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.
19895 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19896 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19897 /// * *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.
19898 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19899 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19900 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
19901 where
19902 T: AsRef<str>,
19903 {
19904 self._additional_params
19905 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19906 self
19907 }
19908
19909 /// Identifies the authorization scope for the method you are building.
19910 ///
19911 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19912 /// [`Scope::CloudPlatform`].
19913 ///
19914 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19915 /// tokens for more than one scope.
19916 ///
19917 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19918 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19919 /// sufficient, a read-write scope will do as well.
19920 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
19921 where
19922 St: AsRef<str>,
19923 {
19924 self._scopes.insert(String::from(scope.as_ref()));
19925 self
19926 }
19927 /// Identifies the authorization scope(s) for the method you are building.
19928 ///
19929 /// See [`Self::add_scope()`] for details.
19930 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
19931 where
19932 I: IntoIterator<Item = St>,
19933 St: AsRef<str>,
19934 {
19935 self._scopes
19936 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19937 self
19938 }
19939
19940 /// Removes all scopes, and no default scope will be used either.
19941 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19942 /// for details).
19943 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
19944 self._scopes.clear();
19945 self
19946 }
19947}
19948
19949/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
19950///
19951/// A builder for the *locations.operations.list* method supported by a *project* resource.
19952/// It is not used directly, but through a [`ProjectMethods`] instance.
19953///
19954/// # Example
19955///
19956/// Instantiate a resource method builder
19957///
19958/// ```test_harness,no_run
19959/// # extern crate hyper;
19960/// # extern crate hyper_rustls;
19961/// # extern crate google_run1 as run1;
19962/// # async fn dox() {
19963/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19964///
19965/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19966/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19967/// # .with_native_roots()
19968/// # .unwrap()
19969/// # .https_only()
19970/// # .enable_http2()
19971/// # .build();
19972///
19973/// # let executor = hyper_util::rt::TokioExecutor::new();
19974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19975/// # secret,
19976/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19977/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19978/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19979/// # ),
19980/// # ).build().await.unwrap();
19981///
19982/// # let client = hyper_util::client::legacy::Client::builder(
19983/// # hyper_util::rt::TokioExecutor::new()
19984/// # )
19985/// # .build(
19986/// # hyper_rustls::HttpsConnectorBuilder::new()
19987/// # .with_native_roots()
19988/// # .unwrap()
19989/// # .https_or_http()
19990/// # .enable_http2()
19991/// # .build()
19992/// # );
19993/// # let mut hub = CloudRun::new(client, auth);
19994/// // You can configure optional parameters by calling the respective setters at will, and
19995/// // execute the final call using `doit()`.
19996/// // Values shown here are possibly random and not representative !
19997/// let result = hub.projects().locations_operations_list("name")
19998/// .return_partial_success(true)
19999/// .page_token("amet.")
20000/// .page_size(-50)
20001/// .filter("Lorem")
20002/// .doit().await;
20003/// # }
20004/// ```
20005pub struct ProjectLocationOperationListCall<'a, C>
20006where
20007 C: 'a,
20008{
20009 hub: &'a CloudRun<C>,
20010 _name: String,
20011 _return_partial_success: Option<bool>,
20012 _page_token: Option<String>,
20013 _page_size: Option<i32>,
20014 _filter: Option<String>,
20015 _delegate: Option<&'a mut dyn common::Delegate>,
20016 _additional_params: HashMap<String, String>,
20017 _scopes: BTreeSet<String>,
20018}
20019
20020impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
20021
20022impl<'a, C> ProjectLocationOperationListCall<'a, C>
20023where
20024 C: common::Connector,
20025{
20026 /// Perform the operation you have build so far.
20027 pub async fn doit(
20028 mut self,
20029 ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
20030 use std::borrow::Cow;
20031 use std::io::{Read, Seek};
20032
20033 use common::{url::Params, ToParts};
20034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20035
20036 let mut dd = common::DefaultDelegate;
20037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20038 dlg.begin(common::MethodInfo {
20039 id: "run.projects.locations.operations.list",
20040 http_method: hyper::Method::GET,
20041 });
20042
20043 for &field in [
20044 "alt",
20045 "name",
20046 "returnPartialSuccess",
20047 "pageToken",
20048 "pageSize",
20049 "filter",
20050 ]
20051 .iter()
20052 {
20053 if self._additional_params.contains_key(field) {
20054 dlg.finished(false);
20055 return Err(common::Error::FieldClash(field));
20056 }
20057 }
20058
20059 let mut params = Params::with_capacity(7 + self._additional_params.len());
20060 params.push("name", self._name);
20061 if let Some(value) = self._return_partial_success.as_ref() {
20062 params.push("returnPartialSuccess", value.to_string());
20063 }
20064 if let Some(value) = self._page_token.as_ref() {
20065 params.push("pageToken", value);
20066 }
20067 if let Some(value) = self._page_size.as_ref() {
20068 params.push("pageSize", value.to_string());
20069 }
20070 if let Some(value) = self._filter.as_ref() {
20071 params.push("filter", value);
20072 }
20073
20074 params.extend(self._additional_params.iter());
20075
20076 params.push("alt", "json");
20077 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
20078 if self._scopes.is_empty() {
20079 self._scopes
20080 .insert(Scope::CloudPlatform.as_ref().to_string());
20081 }
20082
20083 #[allow(clippy::single_element_loop)]
20084 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20085 url = params.uri_replacement(url, param_name, find_this, true);
20086 }
20087 {
20088 let to_remove = ["name"];
20089 params.remove_params(&to_remove);
20090 }
20091
20092 let url = params.parse_with_url(&url);
20093
20094 loop {
20095 let token = match self
20096 .hub
20097 .auth
20098 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20099 .await
20100 {
20101 Ok(token) => token,
20102 Err(e) => match dlg.token(e) {
20103 Ok(token) => token,
20104 Err(e) => {
20105 dlg.finished(false);
20106 return Err(common::Error::MissingToken(e));
20107 }
20108 },
20109 };
20110 let mut req_result = {
20111 let client = &self.hub.client;
20112 dlg.pre_request();
20113 let mut req_builder = hyper::Request::builder()
20114 .method(hyper::Method::GET)
20115 .uri(url.as_str())
20116 .header(USER_AGENT, self.hub._user_agent.clone());
20117
20118 if let Some(token) = token.as_ref() {
20119 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20120 }
20121
20122 let request = req_builder
20123 .header(CONTENT_LENGTH, 0_u64)
20124 .body(common::to_body::<String>(None));
20125
20126 client.request(request.unwrap()).await
20127 };
20128
20129 match req_result {
20130 Err(err) => {
20131 if let common::Retry::After(d) = dlg.http_error(&err) {
20132 sleep(d).await;
20133 continue;
20134 }
20135 dlg.finished(false);
20136 return Err(common::Error::HttpError(err));
20137 }
20138 Ok(res) => {
20139 let (mut parts, body) = res.into_parts();
20140 let mut body = common::Body::new(body);
20141 if !parts.status.is_success() {
20142 let bytes = common::to_bytes(body).await.unwrap_or_default();
20143 let error = serde_json::from_str(&common::to_string(&bytes));
20144 let response = common::to_response(parts, bytes.into());
20145
20146 if let common::Retry::After(d) =
20147 dlg.http_failure(&response, error.as_ref().ok())
20148 {
20149 sleep(d).await;
20150 continue;
20151 }
20152
20153 dlg.finished(false);
20154
20155 return Err(match error {
20156 Ok(value) => common::Error::BadRequest(value),
20157 _ => common::Error::Failure(response),
20158 });
20159 }
20160 let response = {
20161 let bytes = common::to_bytes(body).await.unwrap_or_default();
20162 let encoded = common::to_string(&bytes);
20163 match serde_json::from_str(&encoded) {
20164 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20165 Err(error) => {
20166 dlg.response_json_decode_error(&encoded, &error);
20167 return Err(common::Error::JsonDecodeError(
20168 encoded.to_string(),
20169 error,
20170 ));
20171 }
20172 }
20173 };
20174
20175 dlg.finished(true);
20176 return Ok(response);
20177 }
20178 }
20179 }
20180 }
20181
20182 /// Required. To query for all of the operations for a project.
20183 ///
20184 /// Sets the *name* path property to the given value.
20185 ///
20186 /// Even though the property as already been set when instantiating this call,
20187 /// we provide this method for API completeness.
20188 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
20189 self._name = new_value.to_string();
20190 self
20191 }
20192 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
20193 ///
20194 /// Sets the *return partial success* query property to the given value.
20195 pub fn return_partial_success(
20196 mut self,
20197 new_value: bool,
20198 ) -> ProjectLocationOperationListCall<'a, C> {
20199 self._return_partial_success = Some(new_value);
20200 self
20201 }
20202 /// Token identifying which result to start with, which is returned by a previous list call.
20203 ///
20204 /// Sets the *page token* query property to the given value.
20205 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
20206 self._page_token = Some(new_value.to_string());
20207 self
20208 }
20209 /// 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. .
20210 ///
20211 /// Sets the *page size* query property to the given value.
20212 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
20213 self._page_size = Some(new_value);
20214 self
20215 }
20216 /// 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.
20217 ///
20218 /// Sets the *filter* query property to the given value.
20219 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
20220 self._filter = Some(new_value.to_string());
20221 self
20222 }
20223 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20224 /// while executing the actual API request.
20225 ///
20226 /// ````text
20227 /// It should be used to handle progress information, and to implement a certain level of resilience.
20228 /// ````
20229 ///
20230 /// Sets the *delegate* property to the given value.
20231 pub fn delegate(
20232 mut self,
20233 new_value: &'a mut dyn common::Delegate,
20234 ) -> ProjectLocationOperationListCall<'a, C> {
20235 self._delegate = Some(new_value);
20236 self
20237 }
20238
20239 /// Set any additional parameter of the query string used in the request.
20240 /// It should be used to set parameters which are not yet available through their own
20241 /// setters.
20242 ///
20243 /// Please note that this method must not be used to set any of the known parameters
20244 /// which have their own setter method. If done anyway, the request will fail.
20245 ///
20246 /// # Additional Parameters
20247 ///
20248 /// * *$.xgafv* (query-string) - V1 error format.
20249 /// * *access_token* (query-string) - OAuth access token.
20250 /// * *alt* (query-string) - Data format for response.
20251 /// * *callback* (query-string) - JSONP
20252 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20253 /// * *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.
20254 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20255 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20256 /// * *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.
20257 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20258 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20259 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
20260 where
20261 T: AsRef<str>,
20262 {
20263 self._additional_params
20264 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20265 self
20266 }
20267
20268 /// Identifies the authorization scope for the method you are building.
20269 ///
20270 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20271 /// [`Scope::CloudPlatform`].
20272 ///
20273 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20274 /// tokens for more than one scope.
20275 ///
20276 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20277 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20278 /// sufficient, a read-write scope will do as well.
20279 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
20280 where
20281 St: AsRef<str>,
20282 {
20283 self._scopes.insert(String::from(scope.as_ref()));
20284 self
20285 }
20286 /// Identifies the authorization scope(s) for the method you are building.
20287 ///
20288 /// See [`Self::add_scope()`] for details.
20289 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
20290 where
20291 I: IntoIterator<Item = St>,
20292 St: AsRef<str>,
20293 {
20294 self._scopes
20295 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20296 self
20297 }
20298
20299 /// Removes all scopes, and no default scope will be used either.
20300 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20301 /// for details).
20302 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
20303 self._scopes.clear();
20304 self
20305 }
20306}
20307
20308/// 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.
20309///
20310/// A builder for the *locations.operations.wait* method supported by a *project* resource.
20311/// It is not used directly, but through a [`ProjectMethods`] instance.
20312///
20313/// # Example
20314///
20315/// Instantiate a resource method builder
20316///
20317/// ```test_harness,no_run
20318/// # extern crate hyper;
20319/// # extern crate hyper_rustls;
20320/// # extern crate google_run1 as run1;
20321/// use run1::api::GoogleLongrunningWaitOperationRequest;
20322/// # async fn dox() {
20323/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20324///
20325/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20326/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20327/// # .with_native_roots()
20328/// # .unwrap()
20329/// # .https_only()
20330/// # .enable_http2()
20331/// # .build();
20332///
20333/// # let executor = hyper_util::rt::TokioExecutor::new();
20334/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20335/// # secret,
20336/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20337/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20338/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20339/// # ),
20340/// # ).build().await.unwrap();
20341///
20342/// # let client = hyper_util::client::legacy::Client::builder(
20343/// # hyper_util::rt::TokioExecutor::new()
20344/// # )
20345/// # .build(
20346/// # hyper_rustls::HttpsConnectorBuilder::new()
20347/// # .with_native_roots()
20348/// # .unwrap()
20349/// # .https_or_http()
20350/// # .enable_http2()
20351/// # .build()
20352/// # );
20353/// # let mut hub = CloudRun::new(client, auth);
20354/// // As the method needs a request, you would usually fill it with the desired information
20355/// // into the respective structure. Some of the parts shown here might not be applicable !
20356/// // Values shown here are possibly random and not representative !
20357/// let mut req = GoogleLongrunningWaitOperationRequest::default();
20358///
20359/// // You can configure optional parameters by calling the respective setters at will, and
20360/// // execute the final call using `doit()`.
20361/// // Values shown here are possibly random and not representative !
20362/// let result = hub.projects().locations_operations_wait(req, "name")
20363/// .doit().await;
20364/// # }
20365/// ```
20366pub struct ProjectLocationOperationWaitCall<'a, C>
20367where
20368 C: 'a,
20369{
20370 hub: &'a CloudRun<C>,
20371 _request: GoogleLongrunningWaitOperationRequest,
20372 _name: String,
20373 _delegate: Option<&'a mut dyn common::Delegate>,
20374 _additional_params: HashMap<String, String>,
20375 _scopes: BTreeSet<String>,
20376}
20377
20378impl<'a, C> common::CallBuilder for ProjectLocationOperationWaitCall<'a, C> {}
20379
20380impl<'a, C> ProjectLocationOperationWaitCall<'a, C>
20381where
20382 C: common::Connector,
20383{
20384 /// Perform the operation you have build so far.
20385 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
20386 use std::borrow::Cow;
20387 use std::io::{Read, Seek};
20388
20389 use common::{url::Params, ToParts};
20390 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20391
20392 let mut dd = common::DefaultDelegate;
20393 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20394 dlg.begin(common::MethodInfo {
20395 id: "run.projects.locations.operations.wait",
20396 http_method: hyper::Method::POST,
20397 });
20398
20399 for &field in ["alt", "name"].iter() {
20400 if self._additional_params.contains_key(field) {
20401 dlg.finished(false);
20402 return Err(common::Error::FieldClash(field));
20403 }
20404 }
20405
20406 let mut params = Params::with_capacity(4 + self._additional_params.len());
20407 params.push("name", self._name);
20408
20409 params.extend(self._additional_params.iter());
20410
20411 params.push("alt", "json");
20412 let mut url = self.hub._base_url.clone() + "v1/{+name}:wait";
20413 if self._scopes.is_empty() {
20414 self._scopes
20415 .insert(Scope::CloudPlatform.as_ref().to_string());
20416 }
20417
20418 #[allow(clippy::single_element_loop)]
20419 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20420 url = params.uri_replacement(url, param_name, find_this, true);
20421 }
20422 {
20423 let to_remove = ["name"];
20424 params.remove_params(&to_remove);
20425 }
20426
20427 let url = params.parse_with_url(&url);
20428
20429 let mut json_mime_type = mime::APPLICATION_JSON;
20430 let mut request_value_reader = {
20431 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20432 common::remove_json_null_values(&mut value);
20433 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20434 serde_json::to_writer(&mut dst, &value).unwrap();
20435 dst
20436 };
20437 let request_size = request_value_reader
20438 .seek(std::io::SeekFrom::End(0))
20439 .unwrap();
20440 request_value_reader
20441 .seek(std::io::SeekFrom::Start(0))
20442 .unwrap();
20443
20444 loop {
20445 let token = match self
20446 .hub
20447 .auth
20448 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20449 .await
20450 {
20451 Ok(token) => token,
20452 Err(e) => match dlg.token(e) {
20453 Ok(token) => token,
20454 Err(e) => {
20455 dlg.finished(false);
20456 return Err(common::Error::MissingToken(e));
20457 }
20458 },
20459 };
20460 request_value_reader
20461 .seek(std::io::SeekFrom::Start(0))
20462 .unwrap();
20463 let mut req_result = {
20464 let client = &self.hub.client;
20465 dlg.pre_request();
20466 let mut req_builder = hyper::Request::builder()
20467 .method(hyper::Method::POST)
20468 .uri(url.as_str())
20469 .header(USER_AGENT, self.hub._user_agent.clone());
20470
20471 if let Some(token) = token.as_ref() {
20472 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20473 }
20474
20475 let request = req_builder
20476 .header(CONTENT_TYPE, json_mime_type.to_string())
20477 .header(CONTENT_LENGTH, request_size as u64)
20478 .body(common::to_body(
20479 request_value_reader.get_ref().clone().into(),
20480 ));
20481
20482 client.request(request.unwrap()).await
20483 };
20484
20485 match req_result {
20486 Err(err) => {
20487 if let common::Retry::After(d) = dlg.http_error(&err) {
20488 sleep(d).await;
20489 continue;
20490 }
20491 dlg.finished(false);
20492 return Err(common::Error::HttpError(err));
20493 }
20494 Ok(res) => {
20495 let (mut parts, body) = res.into_parts();
20496 let mut body = common::Body::new(body);
20497 if !parts.status.is_success() {
20498 let bytes = common::to_bytes(body).await.unwrap_or_default();
20499 let error = serde_json::from_str(&common::to_string(&bytes));
20500 let response = common::to_response(parts, bytes.into());
20501
20502 if let common::Retry::After(d) =
20503 dlg.http_failure(&response, error.as_ref().ok())
20504 {
20505 sleep(d).await;
20506 continue;
20507 }
20508
20509 dlg.finished(false);
20510
20511 return Err(match error {
20512 Ok(value) => common::Error::BadRequest(value),
20513 _ => common::Error::Failure(response),
20514 });
20515 }
20516 let response = {
20517 let bytes = common::to_bytes(body).await.unwrap_or_default();
20518 let encoded = common::to_string(&bytes);
20519 match serde_json::from_str(&encoded) {
20520 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20521 Err(error) => {
20522 dlg.response_json_decode_error(&encoded, &error);
20523 return Err(common::Error::JsonDecodeError(
20524 encoded.to_string(),
20525 error,
20526 ));
20527 }
20528 }
20529 };
20530
20531 dlg.finished(true);
20532 return Ok(response);
20533 }
20534 }
20535 }
20536 }
20537
20538 ///
20539 /// Sets the *request* property to the given value.
20540 ///
20541 /// Even though the property as already been set when instantiating this call,
20542 /// we provide this method for API completeness.
20543 pub fn request(
20544 mut self,
20545 new_value: GoogleLongrunningWaitOperationRequest,
20546 ) -> ProjectLocationOperationWaitCall<'a, C> {
20547 self._request = new_value;
20548 self
20549 }
20550 /// The name of the operation resource to wait on.
20551 ///
20552 /// Sets the *name* path property to the given value.
20553 ///
20554 /// Even though the property as already been set when instantiating this call,
20555 /// we provide this method for API completeness.
20556 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationWaitCall<'a, C> {
20557 self._name = new_value.to_string();
20558 self
20559 }
20560 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20561 /// while executing the actual API request.
20562 ///
20563 /// ````text
20564 /// It should be used to handle progress information, and to implement a certain level of resilience.
20565 /// ````
20566 ///
20567 /// Sets the *delegate* property to the given value.
20568 pub fn delegate(
20569 mut self,
20570 new_value: &'a mut dyn common::Delegate,
20571 ) -> ProjectLocationOperationWaitCall<'a, C> {
20572 self._delegate = Some(new_value);
20573 self
20574 }
20575
20576 /// Set any additional parameter of the query string used in the request.
20577 /// It should be used to set parameters which are not yet available through their own
20578 /// setters.
20579 ///
20580 /// Please note that this method must not be used to set any of the known parameters
20581 /// which have their own setter method. If done anyway, the request will fail.
20582 ///
20583 /// # Additional Parameters
20584 ///
20585 /// * *$.xgafv* (query-string) - V1 error format.
20586 /// * *access_token* (query-string) - OAuth access token.
20587 /// * *alt* (query-string) - Data format for response.
20588 /// * *callback* (query-string) - JSONP
20589 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20590 /// * *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.
20591 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20592 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20593 /// * *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.
20594 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20595 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20596 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationWaitCall<'a, C>
20597 where
20598 T: AsRef<str>,
20599 {
20600 self._additional_params
20601 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20602 self
20603 }
20604
20605 /// Identifies the authorization scope for the method you are building.
20606 ///
20607 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20608 /// [`Scope::CloudPlatform`].
20609 ///
20610 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20611 /// tokens for more than one scope.
20612 ///
20613 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20614 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20615 /// sufficient, a read-write scope will do as well.
20616 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationWaitCall<'a, C>
20617 where
20618 St: AsRef<str>,
20619 {
20620 self._scopes.insert(String::from(scope.as_ref()));
20621 self
20622 }
20623 /// Identifies the authorization scope(s) for the method you are building.
20624 ///
20625 /// See [`Self::add_scope()`] for details.
20626 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationWaitCall<'a, C>
20627 where
20628 I: IntoIterator<Item = St>,
20629 St: AsRef<str>,
20630 {
20631 self._scopes
20632 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20633 self
20634 }
20635
20636 /// Removes all scopes, and no default scope will be used either.
20637 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20638 /// for details).
20639 pub fn clear_scopes(mut self) -> ProjectLocationOperationWaitCall<'a, C> {
20640 self._scopes.clear();
20641 self
20642 }
20643}
20644
20645/// Delete a revision.
20646///
20647/// A builder for the *locations.revisions.delete* method supported by a *project* resource.
20648/// It is not used directly, but through a [`ProjectMethods`] instance.
20649///
20650/// # Example
20651///
20652/// Instantiate a resource method builder
20653///
20654/// ```test_harness,no_run
20655/// # extern crate hyper;
20656/// # extern crate hyper_rustls;
20657/// # extern crate google_run1 as run1;
20658/// # async fn dox() {
20659/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20660///
20661/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20662/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20663/// # .with_native_roots()
20664/// # .unwrap()
20665/// # .https_only()
20666/// # .enable_http2()
20667/// # .build();
20668///
20669/// # let executor = hyper_util::rt::TokioExecutor::new();
20670/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20671/// # secret,
20672/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20673/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20674/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20675/// # ),
20676/// # ).build().await.unwrap();
20677///
20678/// # let client = hyper_util::client::legacy::Client::builder(
20679/// # hyper_util::rt::TokioExecutor::new()
20680/// # )
20681/// # .build(
20682/// # hyper_rustls::HttpsConnectorBuilder::new()
20683/// # .with_native_roots()
20684/// # .unwrap()
20685/// # .https_or_http()
20686/// # .enable_http2()
20687/// # .build()
20688/// # );
20689/// # let mut hub = CloudRun::new(client, auth);
20690/// // You can configure optional parameters by calling the respective setters at will, and
20691/// // execute the final call using `doit()`.
20692/// // Values shown here are possibly random and not representative !
20693/// let result = hub.projects().locations_revisions_delete("name")
20694/// .propagation_policy("sadipscing")
20695/// .kind("At")
20696/// .dry_run("sit")
20697/// .api_version("duo")
20698/// .doit().await;
20699/// # }
20700/// ```
20701pub struct ProjectLocationRevisionDeleteCall<'a, C>
20702where
20703 C: 'a,
20704{
20705 hub: &'a CloudRun<C>,
20706 _name: String,
20707 _propagation_policy: Option<String>,
20708 _kind: Option<String>,
20709 _dry_run: Option<String>,
20710 _api_version: Option<String>,
20711 _delegate: Option<&'a mut dyn common::Delegate>,
20712 _additional_params: HashMap<String, String>,
20713 _scopes: BTreeSet<String>,
20714}
20715
20716impl<'a, C> common::CallBuilder for ProjectLocationRevisionDeleteCall<'a, C> {}
20717
20718impl<'a, C> ProjectLocationRevisionDeleteCall<'a, C>
20719where
20720 C: common::Connector,
20721{
20722 /// Perform the operation you have build so far.
20723 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
20724 use std::borrow::Cow;
20725 use std::io::{Read, Seek};
20726
20727 use common::{url::Params, ToParts};
20728 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20729
20730 let mut dd = common::DefaultDelegate;
20731 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20732 dlg.begin(common::MethodInfo {
20733 id: "run.projects.locations.revisions.delete",
20734 http_method: hyper::Method::DELETE,
20735 });
20736
20737 for &field in [
20738 "alt",
20739 "name",
20740 "propagationPolicy",
20741 "kind",
20742 "dryRun",
20743 "apiVersion",
20744 ]
20745 .iter()
20746 {
20747 if self._additional_params.contains_key(field) {
20748 dlg.finished(false);
20749 return Err(common::Error::FieldClash(field));
20750 }
20751 }
20752
20753 let mut params = Params::with_capacity(7 + self._additional_params.len());
20754 params.push("name", self._name);
20755 if let Some(value) = self._propagation_policy.as_ref() {
20756 params.push("propagationPolicy", value);
20757 }
20758 if let Some(value) = self._kind.as_ref() {
20759 params.push("kind", value);
20760 }
20761 if let Some(value) = self._dry_run.as_ref() {
20762 params.push("dryRun", value);
20763 }
20764 if let Some(value) = self._api_version.as_ref() {
20765 params.push("apiVersion", value);
20766 }
20767
20768 params.extend(self._additional_params.iter());
20769
20770 params.push("alt", "json");
20771 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20772 if self._scopes.is_empty() {
20773 self._scopes
20774 .insert(Scope::CloudPlatform.as_ref().to_string());
20775 }
20776
20777 #[allow(clippy::single_element_loop)]
20778 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20779 url = params.uri_replacement(url, param_name, find_this, true);
20780 }
20781 {
20782 let to_remove = ["name"];
20783 params.remove_params(&to_remove);
20784 }
20785
20786 let url = params.parse_with_url(&url);
20787
20788 loop {
20789 let token = match self
20790 .hub
20791 .auth
20792 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20793 .await
20794 {
20795 Ok(token) => token,
20796 Err(e) => match dlg.token(e) {
20797 Ok(token) => token,
20798 Err(e) => {
20799 dlg.finished(false);
20800 return Err(common::Error::MissingToken(e));
20801 }
20802 },
20803 };
20804 let mut req_result = {
20805 let client = &self.hub.client;
20806 dlg.pre_request();
20807 let mut req_builder = hyper::Request::builder()
20808 .method(hyper::Method::DELETE)
20809 .uri(url.as_str())
20810 .header(USER_AGENT, self.hub._user_agent.clone());
20811
20812 if let Some(token) = token.as_ref() {
20813 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20814 }
20815
20816 let request = req_builder
20817 .header(CONTENT_LENGTH, 0_u64)
20818 .body(common::to_body::<String>(None));
20819
20820 client.request(request.unwrap()).await
20821 };
20822
20823 match req_result {
20824 Err(err) => {
20825 if let common::Retry::After(d) = dlg.http_error(&err) {
20826 sleep(d).await;
20827 continue;
20828 }
20829 dlg.finished(false);
20830 return Err(common::Error::HttpError(err));
20831 }
20832 Ok(res) => {
20833 let (mut parts, body) = res.into_parts();
20834 let mut body = common::Body::new(body);
20835 if !parts.status.is_success() {
20836 let bytes = common::to_bytes(body).await.unwrap_or_default();
20837 let error = serde_json::from_str(&common::to_string(&bytes));
20838 let response = common::to_response(parts, bytes.into());
20839
20840 if let common::Retry::After(d) =
20841 dlg.http_failure(&response, error.as_ref().ok())
20842 {
20843 sleep(d).await;
20844 continue;
20845 }
20846
20847 dlg.finished(false);
20848
20849 return Err(match error {
20850 Ok(value) => common::Error::BadRequest(value),
20851 _ => common::Error::Failure(response),
20852 });
20853 }
20854 let response = {
20855 let bytes = common::to_bytes(body).await.unwrap_or_default();
20856 let encoded = common::to_string(&bytes);
20857 match serde_json::from_str(&encoded) {
20858 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20859 Err(error) => {
20860 dlg.response_json_decode_error(&encoded, &error);
20861 return Err(common::Error::JsonDecodeError(
20862 encoded.to_string(),
20863 error,
20864 ));
20865 }
20866 }
20867 };
20868
20869 dlg.finished(true);
20870 return Ok(response);
20871 }
20872 }
20873 }
20874 }
20875
20876 /// 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
20877 ///
20878 /// Sets the *name* path property to the given value.
20879 ///
20880 /// Even though the property as already been set when instantiating this call,
20881 /// we provide this method for API completeness.
20882 pub fn name(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
20883 self._name = new_value.to_string();
20884 self
20885 }
20886 /// Specifies the propagation policy of delete. Cloud Run currently ignores this setting, and deletes in the background.
20887 ///
20888 /// Sets the *propagation policy* query property to the given value.
20889 pub fn propagation_policy(
20890 mut self,
20891 new_value: &str,
20892 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
20893 self._propagation_policy = Some(new_value.to_string());
20894 self
20895 }
20896 /// Cloud Run currently ignores this parameter.
20897 ///
20898 /// Sets the *kind* query property to the given value.
20899 pub fn kind(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
20900 self._kind = Some(new_value.to_string());
20901 self
20902 }
20903 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
20904 ///
20905 /// Sets the *dry run* query property to the given value.
20906 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
20907 self._dry_run = Some(new_value.to_string());
20908 self
20909 }
20910 /// Cloud Run currently ignores this parameter.
20911 ///
20912 /// Sets the *api version* query property to the given value.
20913 pub fn api_version(mut self, new_value: &str) -> ProjectLocationRevisionDeleteCall<'a, C> {
20914 self._api_version = Some(new_value.to_string());
20915 self
20916 }
20917 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20918 /// while executing the actual API request.
20919 ///
20920 /// ````text
20921 /// It should be used to handle progress information, and to implement a certain level of resilience.
20922 /// ````
20923 ///
20924 /// Sets the *delegate* property to the given value.
20925 pub fn delegate(
20926 mut self,
20927 new_value: &'a mut dyn common::Delegate,
20928 ) -> ProjectLocationRevisionDeleteCall<'a, C> {
20929 self._delegate = Some(new_value);
20930 self
20931 }
20932
20933 /// Set any additional parameter of the query string used in the request.
20934 /// It should be used to set parameters which are not yet available through their own
20935 /// setters.
20936 ///
20937 /// Please note that this method must not be used to set any of the known parameters
20938 /// which have their own setter method. If done anyway, the request will fail.
20939 ///
20940 /// # Additional Parameters
20941 ///
20942 /// * *$.xgafv* (query-string) - V1 error format.
20943 /// * *access_token* (query-string) - OAuth access token.
20944 /// * *alt* (query-string) - Data format for response.
20945 /// * *callback* (query-string) - JSONP
20946 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20947 /// * *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.
20948 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20949 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20950 /// * *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.
20951 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20952 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20953 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionDeleteCall<'a, C>
20954 where
20955 T: AsRef<str>,
20956 {
20957 self._additional_params
20958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20959 self
20960 }
20961
20962 /// Identifies the authorization scope for the method you are building.
20963 ///
20964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20965 /// [`Scope::CloudPlatform`].
20966 ///
20967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20968 /// tokens for more than one scope.
20969 ///
20970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20972 /// sufficient, a read-write scope will do as well.
20973 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionDeleteCall<'a, C>
20974 where
20975 St: AsRef<str>,
20976 {
20977 self._scopes.insert(String::from(scope.as_ref()));
20978 self
20979 }
20980 /// Identifies the authorization scope(s) for the method you are building.
20981 ///
20982 /// See [`Self::add_scope()`] for details.
20983 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionDeleteCall<'a, C>
20984 where
20985 I: IntoIterator<Item = St>,
20986 St: AsRef<str>,
20987 {
20988 self._scopes
20989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20990 self
20991 }
20992
20993 /// Removes all scopes, and no default scope will be used either.
20994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20995 /// for details).
20996 pub fn clear_scopes(mut self) -> ProjectLocationRevisionDeleteCall<'a, C> {
20997 self._scopes.clear();
20998 self
20999 }
21000}
21001
21002/// Get information about a revision.
21003///
21004/// A builder for the *locations.revisions.get* method supported by a *project* resource.
21005/// It is not used directly, but through a [`ProjectMethods`] instance.
21006///
21007/// # Example
21008///
21009/// Instantiate a resource method builder
21010///
21011/// ```test_harness,no_run
21012/// # extern crate hyper;
21013/// # extern crate hyper_rustls;
21014/// # extern crate google_run1 as run1;
21015/// # async fn dox() {
21016/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21017///
21018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21020/// # .with_native_roots()
21021/// # .unwrap()
21022/// # .https_only()
21023/// # .enable_http2()
21024/// # .build();
21025///
21026/// # let executor = hyper_util::rt::TokioExecutor::new();
21027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21028/// # secret,
21029/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21030/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21031/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21032/// # ),
21033/// # ).build().await.unwrap();
21034///
21035/// # let client = hyper_util::client::legacy::Client::builder(
21036/// # hyper_util::rt::TokioExecutor::new()
21037/// # )
21038/// # .build(
21039/// # hyper_rustls::HttpsConnectorBuilder::new()
21040/// # .with_native_roots()
21041/// # .unwrap()
21042/// # .https_or_http()
21043/// # .enable_http2()
21044/// # .build()
21045/// # );
21046/// # let mut hub = CloudRun::new(client, auth);
21047/// // You can configure optional parameters by calling the respective setters at will, and
21048/// // execute the final call using `doit()`.
21049/// // Values shown here are possibly random and not representative !
21050/// let result = hub.projects().locations_revisions_get("name")
21051/// .doit().await;
21052/// # }
21053/// ```
21054pub struct ProjectLocationRevisionGetCall<'a, C>
21055where
21056 C: 'a,
21057{
21058 hub: &'a CloudRun<C>,
21059 _name: String,
21060 _delegate: Option<&'a mut dyn common::Delegate>,
21061 _additional_params: HashMap<String, String>,
21062 _scopes: BTreeSet<String>,
21063}
21064
21065impl<'a, C> common::CallBuilder for ProjectLocationRevisionGetCall<'a, C> {}
21066
21067impl<'a, C> ProjectLocationRevisionGetCall<'a, C>
21068where
21069 C: common::Connector,
21070{
21071 /// Perform the operation you have build so far.
21072 pub async fn doit(mut self) -> common::Result<(common::Response, Revision)> {
21073 use std::borrow::Cow;
21074 use std::io::{Read, Seek};
21075
21076 use common::{url::Params, ToParts};
21077 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21078
21079 let mut dd = common::DefaultDelegate;
21080 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21081 dlg.begin(common::MethodInfo {
21082 id: "run.projects.locations.revisions.get",
21083 http_method: hyper::Method::GET,
21084 });
21085
21086 for &field in ["alt", "name"].iter() {
21087 if self._additional_params.contains_key(field) {
21088 dlg.finished(false);
21089 return Err(common::Error::FieldClash(field));
21090 }
21091 }
21092
21093 let mut params = Params::with_capacity(3 + self._additional_params.len());
21094 params.push("name", self._name);
21095
21096 params.extend(self._additional_params.iter());
21097
21098 params.push("alt", "json");
21099 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21100 if self._scopes.is_empty() {
21101 self._scopes
21102 .insert(Scope::CloudPlatform.as_ref().to_string());
21103 }
21104
21105 #[allow(clippy::single_element_loop)]
21106 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21107 url = params.uri_replacement(url, param_name, find_this, true);
21108 }
21109 {
21110 let to_remove = ["name"];
21111 params.remove_params(&to_remove);
21112 }
21113
21114 let url = params.parse_with_url(&url);
21115
21116 loop {
21117 let token = match self
21118 .hub
21119 .auth
21120 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21121 .await
21122 {
21123 Ok(token) => token,
21124 Err(e) => match dlg.token(e) {
21125 Ok(token) => token,
21126 Err(e) => {
21127 dlg.finished(false);
21128 return Err(common::Error::MissingToken(e));
21129 }
21130 },
21131 };
21132 let mut req_result = {
21133 let client = &self.hub.client;
21134 dlg.pre_request();
21135 let mut req_builder = hyper::Request::builder()
21136 .method(hyper::Method::GET)
21137 .uri(url.as_str())
21138 .header(USER_AGENT, self.hub._user_agent.clone());
21139
21140 if let Some(token) = token.as_ref() {
21141 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21142 }
21143
21144 let request = req_builder
21145 .header(CONTENT_LENGTH, 0_u64)
21146 .body(common::to_body::<String>(None));
21147
21148 client.request(request.unwrap()).await
21149 };
21150
21151 match req_result {
21152 Err(err) => {
21153 if let common::Retry::After(d) = dlg.http_error(&err) {
21154 sleep(d).await;
21155 continue;
21156 }
21157 dlg.finished(false);
21158 return Err(common::Error::HttpError(err));
21159 }
21160 Ok(res) => {
21161 let (mut parts, body) = res.into_parts();
21162 let mut body = common::Body::new(body);
21163 if !parts.status.is_success() {
21164 let bytes = common::to_bytes(body).await.unwrap_or_default();
21165 let error = serde_json::from_str(&common::to_string(&bytes));
21166 let response = common::to_response(parts, bytes.into());
21167
21168 if let common::Retry::After(d) =
21169 dlg.http_failure(&response, error.as_ref().ok())
21170 {
21171 sleep(d).await;
21172 continue;
21173 }
21174
21175 dlg.finished(false);
21176
21177 return Err(match error {
21178 Ok(value) => common::Error::BadRequest(value),
21179 _ => common::Error::Failure(response),
21180 });
21181 }
21182 let response = {
21183 let bytes = common::to_bytes(body).await.unwrap_or_default();
21184 let encoded = common::to_string(&bytes);
21185 match serde_json::from_str(&encoded) {
21186 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21187 Err(error) => {
21188 dlg.response_json_decode_error(&encoded, &error);
21189 return Err(common::Error::JsonDecodeError(
21190 encoded.to_string(),
21191 error,
21192 ));
21193 }
21194 }
21195 };
21196
21197 dlg.finished(true);
21198 return Ok(response);
21199 }
21200 }
21201 }
21202 }
21203
21204 /// 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
21205 ///
21206 /// Sets the *name* path property to the given value.
21207 ///
21208 /// Even though the property as already been set when instantiating this call,
21209 /// we provide this method for API completeness.
21210 pub fn name(mut self, new_value: &str) -> ProjectLocationRevisionGetCall<'a, C> {
21211 self._name = new_value.to_string();
21212 self
21213 }
21214 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21215 /// while executing the actual API request.
21216 ///
21217 /// ````text
21218 /// It should be used to handle progress information, and to implement a certain level of resilience.
21219 /// ````
21220 ///
21221 /// Sets the *delegate* property to the given value.
21222 pub fn delegate(
21223 mut self,
21224 new_value: &'a mut dyn common::Delegate,
21225 ) -> ProjectLocationRevisionGetCall<'a, C> {
21226 self._delegate = Some(new_value);
21227 self
21228 }
21229
21230 /// Set any additional parameter of the query string used in the request.
21231 /// It should be used to set parameters which are not yet available through their own
21232 /// setters.
21233 ///
21234 /// Please note that this method must not be used to set any of the known parameters
21235 /// which have their own setter method. If done anyway, the request will fail.
21236 ///
21237 /// # Additional Parameters
21238 ///
21239 /// * *$.xgafv* (query-string) - V1 error format.
21240 /// * *access_token* (query-string) - OAuth access token.
21241 /// * *alt* (query-string) - Data format for response.
21242 /// * *callback* (query-string) - JSONP
21243 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21244 /// * *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.
21245 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21246 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21247 /// * *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.
21248 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21249 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21250 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionGetCall<'a, C>
21251 where
21252 T: AsRef<str>,
21253 {
21254 self._additional_params
21255 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21256 self
21257 }
21258
21259 /// Identifies the authorization scope for the method you are building.
21260 ///
21261 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21262 /// [`Scope::CloudPlatform`].
21263 ///
21264 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21265 /// tokens for more than one scope.
21266 ///
21267 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21268 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21269 /// sufficient, a read-write scope will do as well.
21270 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionGetCall<'a, C>
21271 where
21272 St: AsRef<str>,
21273 {
21274 self._scopes.insert(String::from(scope.as_ref()));
21275 self
21276 }
21277 /// Identifies the authorization scope(s) for the method you are building.
21278 ///
21279 /// See [`Self::add_scope()`] for details.
21280 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionGetCall<'a, C>
21281 where
21282 I: IntoIterator<Item = St>,
21283 St: AsRef<str>,
21284 {
21285 self._scopes
21286 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21287 self
21288 }
21289
21290 /// Removes all scopes, and no default scope will be used either.
21291 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21292 /// for details).
21293 pub fn clear_scopes(mut self) -> ProjectLocationRevisionGetCall<'a, C> {
21294 self._scopes.clear();
21295 self
21296 }
21297}
21298
21299/// List revisions. Results are sorted by creation time, descending.
21300///
21301/// A builder for the *locations.revisions.list* method supported by a *project* resource.
21302/// It is not used directly, but through a [`ProjectMethods`] instance.
21303///
21304/// # Example
21305///
21306/// Instantiate a resource method builder
21307///
21308/// ```test_harness,no_run
21309/// # extern crate hyper;
21310/// # extern crate hyper_rustls;
21311/// # extern crate google_run1 as run1;
21312/// # async fn dox() {
21313/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21314///
21315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21317/// # .with_native_roots()
21318/// # .unwrap()
21319/// # .https_only()
21320/// # .enable_http2()
21321/// # .build();
21322///
21323/// # let executor = hyper_util::rt::TokioExecutor::new();
21324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21325/// # secret,
21326/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21327/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21328/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21329/// # ),
21330/// # ).build().await.unwrap();
21331///
21332/// # let client = hyper_util::client::legacy::Client::builder(
21333/// # hyper_util::rt::TokioExecutor::new()
21334/// # )
21335/// # .build(
21336/// # hyper_rustls::HttpsConnectorBuilder::new()
21337/// # .with_native_roots()
21338/// # .unwrap()
21339/// # .https_or_http()
21340/// # .enable_http2()
21341/// # .build()
21342/// # );
21343/// # let mut hub = CloudRun::new(client, auth);
21344/// // You can configure optional parameters by calling the respective setters at will, and
21345/// // execute the final call using `doit()`.
21346/// // Values shown here are possibly random and not representative !
21347/// let result = hub.projects().locations_revisions_list("parent")
21348/// .watch(true)
21349/// .resource_version("dolor")
21350/// .limit(-6)
21351/// .label_selector("justo")
21352/// .include_uninitialized(true)
21353/// .field_selector("no")
21354/// .continue_("nonumy")
21355/// .doit().await;
21356/// # }
21357/// ```
21358pub struct ProjectLocationRevisionListCall<'a, C>
21359where
21360 C: 'a,
21361{
21362 hub: &'a CloudRun<C>,
21363 _parent: String,
21364 _watch: Option<bool>,
21365 _resource_version: Option<String>,
21366 _limit: Option<i32>,
21367 _label_selector: Option<String>,
21368 _include_uninitialized: Option<bool>,
21369 _field_selector: Option<String>,
21370 _continue_: Option<String>,
21371 _delegate: Option<&'a mut dyn common::Delegate>,
21372 _additional_params: HashMap<String, String>,
21373 _scopes: BTreeSet<String>,
21374}
21375
21376impl<'a, C> common::CallBuilder for ProjectLocationRevisionListCall<'a, C> {}
21377
21378impl<'a, C> ProjectLocationRevisionListCall<'a, C>
21379where
21380 C: common::Connector,
21381{
21382 /// Perform the operation you have build so far.
21383 pub async fn doit(mut self) -> common::Result<(common::Response, ListRevisionsResponse)> {
21384 use std::borrow::Cow;
21385 use std::io::{Read, Seek};
21386
21387 use common::{url::Params, ToParts};
21388 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21389
21390 let mut dd = common::DefaultDelegate;
21391 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21392 dlg.begin(common::MethodInfo {
21393 id: "run.projects.locations.revisions.list",
21394 http_method: hyper::Method::GET,
21395 });
21396
21397 for &field in [
21398 "alt",
21399 "parent",
21400 "watch",
21401 "resourceVersion",
21402 "limit",
21403 "labelSelector",
21404 "includeUninitialized",
21405 "fieldSelector",
21406 "continue",
21407 ]
21408 .iter()
21409 {
21410 if self._additional_params.contains_key(field) {
21411 dlg.finished(false);
21412 return Err(common::Error::FieldClash(field));
21413 }
21414 }
21415
21416 let mut params = Params::with_capacity(10 + self._additional_params.len());
21417 params.push("parent", self._parent);
21418 if let Some(value) = self._watch.as_ref() {
21419 params.push("watch", value.to_string());
21420 }
21421 if let Some(value) = self._resource_version.as_ref() {
21422 params.push("resourceVersion", value);
21423 }
21424 if let Some(value) = self._limit.as_ref() {
21425 params.push("limit", value.to_string());
21426 }
21427 if let Some(value) = self._label_selector.as_ref() {
21428 params.push("labelSelector", value);
21429 }
21430 if let Some(value) = self._include_uninitialized.as_ref() {
21431 params.push("includeUninitialized", value.to_string());
21432 }
21433 if let Some(value) = self._field_selector.as_ref() {
21434 params.push("fieldSelector", value);
21435 }
21436 if let Some(value) = self._continue_.as_ref() {
21437 params.push("continue", value);
21438 }
21439
21440 params.extend(self._additional_params.iter());
21441
21442 params.push("alt", "json");
21443 let mut url = self.hub._base_url.clone() + "v1/{+parent}/revisions";
21444 if self._scopes.is_empty() {
21445 self._scopes
21446 .insert(Scope::CloudPlatform.as_ref().to_string());
21447 }
21448
21449 #[allow(clippy::single_element_loop)]
21450 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21451 url = params.uri_replacement(url, param_name, find_this, true);
21452 }
21453 {
21454 let to_remove = ["parent"];
21455 params.remove_params(&to_remove);
21456 }
21457
21458 let url = params.parse_with_url(&url);
21459
21460 loop {
21461 let token = match self
21462 .hub
21463 .auth
21464 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21465 .await
21466 {
21467 Ok(token) => token,
21468 Err(e) => match dlg.token(e) {
21469 Ok(token) => token,
21470 Err(e) => {
21471 dlg.finished(false);
21472 return Err(common::Error::MissingToken(e));
21473 }
21474 },
21475 };
21476 let mut req_result = {
21477 let client = &self.hub.client;
21478 dlg.pre_request();
21479 let mut req_builder = hyper::Request::builder()
21480 .method(hyper::Method::GET)
21481 .uri(url.as_str())
21482 .header(USER_AGENT, self.hub._user_agent.clone());
21483
21484 if let Some(token) = token.as_ref() {
21485 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21486 }
21487
21488 let request = req_builder
21489 .header(CONTENT_LENGTH, 0_u64)
21490 .body(common::to_body::<String>(None));
21491
21492 client.request(request.unwrap()).await
21493 };
21494
21495 match req_result {
21496 Err(err) => {
21497 if let common::Retry::After(d) = dlg.http_error(&err) {
21498 sleep(d).await;
21499 continue;
21500 }
21501 dlg.finished(false);
21502 return Err(common::Error::HttpError(err));
21503 }
21504 Ok(res) => {
21505 let (mut parts, body) = res.into_parts();
21506 let mut body = common::Body::new(body);
21507 if !parts.status.is_success() {
21508 let bytes = common::to_bytes(body).await.unwrap_or_default();
21509 let error = serde_json::from_str(&common::to_string(&bytes));
21510 let response = common::to_response(parts, bytes.into());
21511
21512 if let common::Retry::After(d) =
21513 dlg.http_failure(&response, error.as_ref().ok())
21514 {
21515 sleep(d).await;
21516 continue;
21517 }
21518
21519 dlg.finished(false);
21520
21521 return Err(match error {
21522 Ok(value) => common::Error::BadRequest(value),
21523 _ => common::Error::Failure(response),
21524 });
21525 }
21526 let response = {
21527 let bytes = common::to_bytes(body).await.unwrap_or_default();
21528 let encoded = common::to_string(&bytes);
21529 match serde_json::from_str(&encoded) {
21530 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21531 Err(error) => {
21532 dlg.response_json_decode_error(&encoded, &error);
21533 return Err(common::Error::JsonDecodeError(
21534 encoded.to_string(),
21535 error,
21536 ));
21537 }
21538 }
21539 };
21540
21541 dlg.finished(true);
21542 return Ok(response);
21543 }
21544 }
21545 }
21546 }
21547
21548 /// 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
21549 ///
21550 /// Sets the *parent* path property to the given value.
21551 ///
21552 /// Even though the property as already been set when instantiating this call,
21553 /// we provide this method for API completeness.
21554 pub fn parent(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
21555 self._parent = new_value.to_string();
21556 self
21557 }
21558 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
21559 ///
21560 /// Sets the *watch* query property to the given value.
21561 pub fn watch(mut self, new_value: bool) -> ProjectLocationRevisionListCall<'a, C> {
21562 self._watch = Some(new_value);
21563 self
21564 }
21565 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
21566 ///
21567 /// Sets the *resource version* query property to the given value.
21568 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
21569 self._resource_version = Some(new_value.to_string());
21570 self
21571 }
21572 /// Optional. The maximum number of records that should be returned.
21573 ///
21574 /// Sets the *limit* query property to the given value.
21575 pub fn limit(mut self, new_value: i32) -> ProjectLocationRevisionListCall<'a, C> {
21576 self._limit = Some(new_value);
21577 self
21578 }
21579 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
21580 ///
21581 /// Sets the *label selector* query property to the given value.
21582 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
21583 self._label_selector = Some(new_value.to_string());
21584 self
21585 }
21586 /// Not currently used by Cloud Run.
21587 ///
21588 /// Sets the *include uninitialized* query property to the given value.
21589 pub fn include_uninitialized(
21590 mut self,
21591 new_value: bool,
21592 ) -> ProjectLocationRevisionListCall<'a, C> {
21593 self._include_uninitialized = Some(new_value);
21594 self
21595 }
21596 /// 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.
21597 ///
21598 /// Sets the *field selector* query property to the given value.
21599 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
21600 self._field_selector = Some(new_value.to_string());
21601 self
21602 }
21603 /// Optional. Encoded string to continue paging.
21604 ///
21605 /// Sets the *continue* query property to the given value.
21606 pub fn continue_(mut self, new_value: &str) -> ProjectLocationRevisionListCall<'a, C> {
21607 self._continue_ = Some(new_value.to_string());
21608 self
21609 }
21610 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21611 /// while executing the actual API request.
21612 ///
21613 /// ````text
21614 /// It should be used to handle progress information, and to implement a certain level of resilience.
21615 /// ````
21616 ///
21617 /// Sets the *delegate* property to the given value.
21618 pub fn delegate(
21619 mut self,
21620 new_value: &'a mut dyn common::Delegate,
21621 ) -> ProjectLocationRevisionListCall<'a, C> {
21622 self._delegate = Some(new_value);
21623 self
21624 }
21625
21626 /// Set any additional parameter of the query string used in the request.
21627 /// It should be used to set parameters which are not yet available through their own
21628 /// setters.
21629 ///
21630 /// Please note that this method must not be used to set any of the known parameters
21631 /// which have their own setter method. If done anyway, the request will fail.
21632 ///
21633 /// # Additional Parameters
21634 ///
21635 /// * *$.xgafv* (query-string) - V1 error format.
21636 /// * *access_token* (query-string) - OAuth access token.
21637 /// * *alt* (query-string) - Data format for response.
21638 /// * *callback* (query-string) - JSONP
21639 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21640 /// * *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.
21641 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21642 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21643 /// * *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.
21644 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21645 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21646 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRevisionListCall<'a, C>
21647 where
21648 T: AsRef<str>,
21649 {
21650 self._additional_params
21651 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21652 self
21653 }
21654
21655 /// Identifies the authorization scope for the method you are building.
21656 ///
21657 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21658 /// [`Scope::CloudPlatform`].
21659 ///
21660 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21661 /// tokens for more than one scope.
21662 ///
21663 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21664 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21665 /// sufficient, a read-write scope will do as well.
21666 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRevisionListCall<'a, C>
21667 where
21668 St: AsRef<str>,
21669 {
21670 self._scopes.insert(String::from(scope.as_ref()));
21671 self
21672 }
21673 /// Identifies the authorization scope(s) for the method you are building.
21674 ///
21675 /// See [`Self::add_scope()`] for details.
21676 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRevisionListCall<'a, C>
21677 where
21678 I: IntoIterator<Item = St>,
21679 St: AsRef<str>,
21680 {
21681 self._scopes
21682 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21683 self
21684 }
21685
21686 /// Removes all scopes, and no default scope will be used either.
21687 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21688 /// for details).
21689 pub fn clear_scopes(mut self) -> ProjectLocationRevisionListCall<'a, C> {
21690 self._scopes.clear();
21691 self
21692 }
21693}
21694
21695/// Get information about a route.
21696///
21697/// A builder for the *locations.routes.get* method supported by a *project* resource.
21698/// It is not used directly, but through a [`ProjectMethods`] instance.
21699///
21700/// # Example
21701///
21702/// Instantiate a resource method builder
21703///
21704/// ```test_harness,no_run
21705/// # extern crate hyper;
21706/// # extern crate hyper_rustls;
21707/// # extern crate google_run1 as run1;
21708/// # async fn dox() {
21709/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21710///
21711/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21712/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21713/// # .with_native_roots()
21714/// # .unwrap()
21715/// # .https_only()
21716/// # .enable_http2()
21717/// # .build();
21718///
21719/// # let executor = hyper_util::rt::TokioExecutor::new();
21720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21721/// # secret,
21722/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21723/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21724/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21725/// # ),
21726/// # ).build().await.unwrap();
21727///
21728/// # let client = hyper_util::client::legacy::Client::builder(
21729/// # hyper_util::rt::TokioExecutor::new()
21730/// # )
21731/// # .build(
21732/// # hyper_rustls::HttpsConnectorBuilder::new()
21733/// # .with_native_roots()
21734/// # .unwrap()
21735/// # .https_or_http()
21736/// # .enable_http2()
21737/// # .build()
21738/// # );
21739/// # let mut hub = CloudRun::new(client, auth);
21740/// // You can configure optional parameters by calling the respective setters at will, and
21741/// // execute the final call using `doit()`.
21742/// // Values shown here are possibly random and not representative !
21743/// let result = hub.projects().locations_routes_get("name")
21744/// .doit().await;
21745/// # }
21746/// ```
21747pub struct ProjectLocationRouteGetCall<'a, C>
21748where
21749 C: 'a,
21750{
21751 hub: &'a CloudRun<C>,
21752 _name: String,
21753 _delegate: Option<&'a mut dyn common::Delegate>,
21754 _additional_params: HashMap<String, String>,
21755 _scopes: BTreeSet<String>,
21756}
21757
21758impl<'a, C> common::CallBuilder for ProjectLocationRouteGetCall<'a, C> {}
21759
21760impl<'a, C> ProjectLocationRouteGetCall<'a, C>
21761where
21762 C: common::Connector,
21763{
21764 /// Perform the operation you have build so far.
21765 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
21766 use std::borrow::Cow;
21767 use std::io::{Read, Seek};
21768
21769 use common::{url::Params, ToParts};
21770 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21771
21772 let mut dd = common::DefaultDelegate;
21773 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21774 dlg.begin(common::MethodInfo {
21775 id: "run.projects.locations.routes.get",
21776 http_method: hyper::Method::GET,
21777 });
21778
21779 for &field in ["alt", "name"].iter() {
21780 if self._additional_params.contains_key(field) {
21781 dlg.finished(false);
21782 return Err(common::Error::FieldClash(field));
21783 }
21784 }
21785
21786 let mut params = Params::with_capacity(3 + self._additional_params.len());
21787 params.push("name", self._name);
21788
21789 params.extend(self._additional_params.iter());
21790
21791 params.push("alt", "json");
21792 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21793 if self._scopes.is_empty() {
21794 self._scopes
21795 .insert(Scope::CloudPlatform.as_ref().to_string());
21796 }
21797
21798 #[allow(clippy::single_element_loop)]
21799 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21800 url = params.uri_replacement(url, param_name, find_this, true);
21801 }
21802 {
21803 let to_remove = ["name"];
21804 params.remove_params(&to_remove);
21805 }
21806
21807 let url = params.parse_with_url(&url);
21808
21809 loop {
21810 let token = match self
21811 .hub
21812 .auth
21813 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21814 .await
21815 {
21816 Ok(token) => token,
21817 Err(e) => match dlg.token(e) {
21818 Ok(token) => token,
21819 Err(e) => {
21820 dlg.finished(false);
21821 return Err(common::Error::MissingToken(e));
21822 }
21823 },
21824 };
21825 let mut req_result = {
21826 let client = &self.hub.client;
21827 dlg.pre_request();
21828 let mut req_builder = hyper::Request::builder()
21829 .method(hyper::Method::GET)
21830 .uri(url.as_str())
21831 .header(USER_AGENT, self.hub._user_agent.clone());
21832
21833 if let Some(token) = token.as_ref() {
21834 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21835 }
21836
21837 let request = req_builder
21838 .header(CONTENT_LENGTH, 0_u64)
21839 .body(common::to_body::<String>(None));
21840
21841 client.request(request.unwrap()).await
21842 };
21843
21844 match req_result {
21845 Err(err) => {
21846 if let common::Retry::After(d) = dlg.http_error(&err) {
21847 sleep(d).await;
21848 continue;
21849 }
21850 dlg.finished(false);
21851 return Err(common::Error::HttpError(err));
21852 }
21853 Ok(res) => {
21854 let (mut parts, body) = res.into_parts();
21855 let mut body = common::Body::new(body);
21856 if !parts.status.is_success() {
21857 let bytes = common::to_bytes(body).await.unwrap_or_default();
21858 let error = serde_json::from_str(&common::to_string(&bytes));
21859 let response = common::to_response(parts, bytes.into());
21860
21861 if let common::Retry::After(d) =
21862 dlg.http_failure(&response, error.as_ref().ok())
21863 {
21864 sleep(d).await;
21865 continue;
21866 }
21867
21868 dlg.finished(false);
21869
21870 return Err(match error {
21871 Ok(value) => common::Error::BadRequest(value),
21872 _ => common::Error::Failure(response),
21873 });
21874 }
21875 let response = {
21876 let bytes = common::to_bytes(body).await.unwrap_or_default();
21877 let encoded = common::to_string(&bytes);
21878 match serde_json::from_str(&encoded) {
21879 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21880 Err(error) => {
21881 dlg.response_json_decode_error(&encoded, &error);
21882 return Err(common::Error::JsonDecodeError(
21883 encoded.to_string(),
21884 error,
21885 ));
21886 }
21887 }
21888 };
21889
21890 dlg.finished(true);
21891 return Ok(response);
21892 }
21893 }
21894 }
21895 }
21896
21897 /// 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
21898 ///
21899 /// Sets the *name* path property to the given value.
21900 ///
21901 /// Even though the property as already been set when instantiating this call,
21902 /// we provide this method for API completeness.
21903 pub fn name(mut self, new_value: &str) -> ProjectLocationRouteGetCall<'a, C> {
21904 self._name = new_value.to_string();
21905 self
21906 }
21907 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21908 /// while executing the actual API request.
21909 ///
21910 /// ````text
21911 /// It should be used to handle progress information, and to implement a certain level of resilience.
21912 /// ````
21913 ///
21914 /// Sets the *delegate* property to the given value.
21915 pub fn delegate(
21916 mut self,
21917 new_value: &'a mut dyn common::Delegate,
21918 ) -> ProjectLocationRouteGetCall<'a, C> {
21919 self._delegate = Some(new_value);
21920 self
21921 }
21922
21923 /// Set any additional parameter of the query string used in the request.
21924 /// It should be used to set parameters which are not yet available through their own
21925 /// setters.
21926 ///
21927 /// Please note that this method must not be used to set any of the known parameters
21928 /// which have their own setter method. If done anyway, the request will fail.
21929 ///
21930 /// # Additional Parameters
21931 ///
21932 /// * *$.xgafv* (query-string) - V1 error format.
21933 /// * *access_token* (query-string) - OAuth access token.
21934 /// * *alt* (query-string) - Data format for response.
21935 /// * *callback* (query-string) - JSONP
21936 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21937 /// * *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.
21938 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21939 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21940 /// * *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.
21941 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21942 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21943 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRouteGetCall<'a, C>
21944 where
21945 T: AsRef<str>,
21946 {
21947 self._additional_params
21948 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21949 self
21950 }
21951
21952 /// Identifies the authorization scope for the method you are building.
21953 ///
21954 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21955 /// [`Scope::CloudPlatform`].
21956 ///
21957 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21958 /// tokens for more than one scope.
21959 ///
21960 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21961 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21962 /// sufficient, a read-write scope will do as well.
21963 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRouteGetCall<'a, C>
21964 where
21965 St: AsRef<str>,
21966 {
21967 self._scopes.insert(String::from(scope.as_ref()));
21968 self
21969 }
21970 /// Identifies the authorization scope(s) for the method you are building.
21971 ///
21972 /// See [`Self::add_scope()`] for details.
21973 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRouteGetCall<'a, C>
21974 where
21975 I: IntoIterator<Item = St>,
21976 St: AsRef<str>,
21977 {
21978 self._scopes
21979 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21980 self
21981 }
21982
21983 /// Removes all scopes, and no default scope will be used either.
21984 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21985 /// for details).
21986 pub fn clear_scopes(mut self) -> ProjectLocationRouteGetCall<'a, C> {
21987 self._scopes.clear();
21988 self
21989 }
21990}
21991
21992/// List routes. Results are sorted by creation time, descending.
21993///
21994/// A builder for the *locations.routes.list* method supported by a *project* resource.
21995/// It is not used directly, but through a [`ProjectMethods`] instance.
21996///
21997/// # Example
21998///
21999/// Instantiate a resource method builder
22000///
22001/// ```test_harness,no_run
22002/// # extern crate hyper;
22003/// # extern crate hyper_rustls;
22004/// # extern crate google_run1 as run1;
22005/// # async fn dox() {
22006/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22007///
22008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22010/// # .with_native_roots()
22011/// # .unwrap()
22012/// # .https_only()
22013/// # .enable_http2()
22014/// # .build();
22015///
22016/// # let executor = hyper_util::rt::TokioExecutor::new();
22017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22018/// # secret,
22019/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22020/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22021/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22022/// # ),
22023/// # ).build().await.unwrap();
22024///
22025/// # let client = hyper_util::client::legacy::Client::builder(
22026/// # hyper_util::rt::TokioExecutor::new()
22027/// # )
22028/// # .build(
22029/// # hyper_rustls::HttpsConnectorBuilder::new()
22030/// # .with_native_roots()
22031/// # .unwrap()
22032/// # .https_or_http()
22033/// # .enable_http2()
22034/// # .build()
22035/// # );
22036/// # let mut hub = CloudRun::new(client, auth);
22037/// // You can configure optional parameters by calling the respective setters at will, and
22038/// // execute the final call using `doit()`.
22039/// // Values shown here are possibly random and not representative !
22040/// let result = hub.projects().locations_routes_list("parent")
22041/// .watch(false)
22042/// .resource_version("sanctus")
22043/// .limit(-91)
22044/// .label_selector("rebum.")
22045/// .include_uninitialized(true)
22046/// .field_selector("dolore")
22047/// .continue_("eos")
22048/// .doit().await;
22049/// # }
22050/// ```
22051pub struct ProjectLocationRouteListCall<'a, C>
22052where
22053 C: 'a,
22054{
22055 hub: &'a CloudRun<C>,
22056 _parent: String,
22057 _watch: Option<bool>,
22058 _resource_version: Option<String>,
22059 _limit: Option<i32>,
22060 _label_selector: Option<String>,
22061 _include_uninitialized: Option<bool>,
22062 _field_selector: Option<String>,
22063 _continue_: Option<String>,
22064 _delegate: Option<&'a mut dyn common::Delegate>,
22065 _additional_params: HashMap<String, String>,
22066 _scopes: BTreeSet<String>,
22067}
22068
22069impl<'a, C> common::CallBuilder for ProjectLocationRouteListCall<'a, C> {}
22070
22071impl<'a, C> ProjectLocationRouteListCall<'a, C>
22072where
22073 C: common::Connector,
22074{
22075 /// Perform the operation you have build so far.
22076 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
22077 use std::borrow::Cow;
22078 use std::io::{Read, Seek};
22079
22080 use common::{url::Params, ToParts};
22081 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22082
22083 let mut dd = common::DefaultDelegate;
22084 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22085 dlg.begin(common::MethodInfo {
22086 id: "run.projects.locations.routes.list",
22087 http_method: hyper::Method::GET,
22088 });
22089
22090 for &field in [
22091 "alt",
22092 "parent",
22093 "watch",
22094 "resourceVersion",
22095 "limit",
22096 "labelSelector",
22097 "includeUninitialized",
22098 "fieldSelector",
22099 "continue",
22100 ]
22101 .iter()
22102 {
22103 if self._additional_params.contains_key(field) {
22104 dlg.finished(false);
22105 return Err(common::Error::FieldClash(field));
22106 }
22107 }
22108
22109 let mut params = Params::with_capacity(10 + self._additional_params.len());
22110 params.push("parent", self._parent);
22111 if let Some(value) = self._watch.as_ref() {
22112 params.push("watch", value.to_string());
22113 }
22114 if let Some(value) = self._resource_version.as_ref() {
22115 params.push("resourceVersion", value);
22116 }
22117 if let Some(value) = self._limit.as_ref() {
22118 params.push("limit", value.to_string());
22119 }
22120 if let Some(value) = self._label_selector.as_ref() {
22121 params.push("labelSelector", value);
22122 }
22123 if let Some(value) = self._include_uninitialized.as_ref() {
22124 params.push("includeUninitialized", value.to_string());
22125 }
22126 if let Some(value) = self._field_selector.as_ref() {
22127 params.push("fieldSelector", value);
22128 }
22129 if let Some(value) = self._continue_.as_ref() {
22130 params.push("continue", value);
22131 }
22132
22133 params.extend(self._additional_params.iter());
22134
22135 params.push("alt", "json");
22136 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
22137 if self._scopes.is_empty() {
22138 self._scopes
22139 .insert(Scope::CloudPlatform.as_ref().to_string());
22140 }
22141
22142 #[allow(clippy::single_element_loop)]
22143 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22144 url = params.uri_replacement(url, param_name, find_this, true);
22145 }
22146 {
22147 let to_remove = ["parent"];
22148 params.remove_params(&to_remove);
22149 }
22150
22151 let url = params.parse_with_url(&url);
22152
22153 loop {
22154 let token = match self
22155 .hub
22156 .auth
22157 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22158 .await
22159 {
22160 Ok(token) => token,
22161 Err(e) => match dlg.token(e) {
22162 Ok(token) => token,
22163 Err(e) => {
22164 dlg.finished(false);
22165 return Err(common::Error::MissingToken(e));
22166 }
22167 },
22168 };
22169 let mut req_result = {
22170 let client = &self.hub.client;
22171 dlg.pre_request();
22172 let mut req_builder = hyper::Request::builder()
22173 .method(hyper::Method::GET)
22174 .uri(url.as_str())
22175 .header(USER_AGENT, self.hub._user_agent.clone());
22176
22177 if let Some(token) = token.as_ref() {
22178 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22179 }
22180
22181 let request = req_builder
22182 .header(CONTENT_LENGTH, 0_u64)
22183 .body(common::to_body::<String>(None));
22184
22185 client.request(request.unwrap()).await
22186 };
22187
22188 match req_result {
22189 Err(err) => {
22190 if let common::Retry::After(d) = dlg.http_error(&err) {
22191 sleep(d).await;
22192 continue;
22193 }
22194 dlg.finished(false);
22195 return Err(common::Error::HttpError(err));
22196 }
22197 Ok(res) => {
22198 let (mut parts, body) = res.into_parts();
22199 let mut body = common::Body::new(body);
22200 if !parts.status.is_success() {
22201 let bytes = common::to_bytes(body).await.unwrap_or_default();
22202 let error = serde_json::from_str(&common::to_string(&bytes));
22203 let response = common::to_response(parts, bytes.into());
22204
22205 if let common::Retry::After(d) =
22206 dlg.http_failure(&response, error.as_ref().ok())
22207 {
22208 sleep(d).await;
22209 continue;
22210 }
22211
22212 dlg.finished(false);
22213
22214 return Err(match error {
22215 Ok(value) => common::Error::BadRequest(value),
22216 _ => common::Error::Failure(response),
22217 });
22218 }
22219 let response = {
22220 let bytes = common::to_bytes(body).await.unwrap_or_default();
22221 let encoded = common::to_string(&bytes);
22222 match serde_json::from_str(&encoded) {
22223 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22224 Err(error) => {
22225 dlg.response_json_decode_error(&encoded, &error);
22226 return Err(common::Error::JsonDecodeError(
22227 encoded.to_string(),
22228 error,
22229 ));
22230 }
22231 }
22232 };
22233
22234 dlg.finished(true);
22235 return Ok(response);
22236 }
22237 }
22238 }
22239 }
22240
22241 /// 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
22242 ///
22243 /// Sets the *parent* path property to the given value.
22244 ///
22245 /// Even though the property as already been set when instantiating this call,
22246 /// we provide this method for API completeness.
22247 pub fn parent(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
22248 self._parent = new_value.to_string();
22249 self
22250 }
22251 /// Flag that indicates that the client expects to watch this resource as well. Not currently used by Cloud Run.
22252 ///
22253 /// Sets the *watch* query property to the given value.
22254 pub fn watch(mut self, new_value: bool) -> ProjectLocationRouteListCall<'a, C> {
22255 self._watch = Some(new_value);
22256 self
22257 }
22258 /// The baseline resource version from which the list or watch operation should start. Not currently used by Cloud Run.
22259 ///
22260 /// Sets the *resource version* query property to the given value.
22261 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
22262 self._resource_version = Some(new_value.to_string());
22263 self
22264 }
22265 /// Optional. The maximum number of records that should be returned.
22266 ///
22267 /// Sets the *limit* query property to the given value.
22268 pub fn limit(mut self, new_value: i32) -> ProjectLocationRouteListCall<'a, C> {
22269 self._limit = Some(new_value);
22270 self
22271 }
22272 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
22273 ///
22274 /// Sets the *label selector* query property to the given value.
22275 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
22276 self._label_selector = Some(new_value.to_string());
22277 self
22278 }
22279 /// Not currently used by Cloud Run.
22280 ///
22281 /// Sets the *include uninitialized* query property to the given value.
22282 pub fn include_uninitialized(mut self, new_value: bool) -> ProjectLocationRouteListCall<'a, C> {
22283 self._include_uninitialized = Some(new_value);
22284 self
22285 }
22286 /// 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.
22287 ///
22288 /// Sets the *field selector* query property to the given value.
22289 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
22290 self._field_selector = Some(new_value.to_string());
22291 self
22292 }
22293 /// Optional. Encoded string to continue paging.
22294 ///
22295 /// Sets the *continue* query property to the given value.
22296 pub fn continue_(mut self, new_value: &str) -> ProjectLocationRouteListCall<'a, C> {
22297 self._continue_ = Some(new_value.to_string());
22298 self
22299 }
22300 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22301 /// while executing the actual API request.
22302 ///
22303 /// ````text
22304 /// It should be used to handle progress information, and to implement a certain level of resilience.
22305 /// ````
22306 ///
22307 /// Sets the *delegate* property to the given value.
22308 pub fn delegate(
22309 mut self,
22310 new_value: &'a mut dyn common::Delegate,
22311 ) -> ProjectLocationRouteListCall<'a, C> {
22312 self._delegate = Some(new_value);
22313 self
22314 }
22315
22316 /// Set any additional parameter of the query string used in the request.
22317 /// It should be used to set parameters which are not yet available through their own
22318 /// setters.
22319 ///
22320 /// Please note that this method must not be used to set any of the known parameters
22321 /// which have their own setter method. If done anyway, the request will fail.
22322 ///
22323 /// # Additional Parameters
22324 ///
22325 /// * *$.xgafv* (query-string) - V1 error format.
22326 /// * *access_token* (query-string) - OAuth access token.
22327 /// * *alt* (query-string) - Data format for response.
22328 /// * *callback* (query-string) - JSONP
22329 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22330 /// * *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.
22331 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22332 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22333 /// * *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.
22334 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22335 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22336 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRouteListCall<'a, C>
22337 where
22338 T: AsRef<str>,
22339 {
22340 self._additional_params
22341 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22342 self
22343 }
22344
22345 /// Identifies the authorization scope for the method you are building.
22346 ///
22347 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22348 /// [`Scope::CloudPlatform`].
22349 ///
22350 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22351 /// tokens for more than one scope.
22352 ///
22353 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22354 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22355 /// sufficient, a read-write scope will do as well.
22356 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRouteListCall<'a, C>
22357 where
22358 St: AsRef<str>,
22359 {
22360 self._scopes.insert(String::from(scope.as_ref()));
22361 self
22362 }
22363 /// Identifies the authorization scope(s) for the method you are building.
22364 ///
22365 /// See [`Self::add_scope()`] for details.
22366 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRouteListCall<'a, C>
22367 where
22368 I: IntoIterator<Item = St>,
22369 St: AsRef<str>,
22370 {
22371 self._scopes
22372 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22373 self
22374 }
22375
22376 /// Removes all scopes, and no default scope will be used either.
22377 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22378 /// for details).
22379 pub fn clear_scopes(mut self) -> ProjectLocationRouteListCall<'a, C> {
22380 self._scopes.clear();
22381 self
22382 }
22383}
22384
22385/// Creates a new Service. Service creation will trigger a new deployment. Use GetService, and check service.status to determine if the Service is ready.
22386///
22387/// A builder for the *locations.services.create* method supported by a *project* resource.
22388/// It is not used directly, but through a [`ProjectMethods`] instance.
22389///
22390/// # Example
22391///
22392/// Instantiate a resource method builder
22393///
22394/// ```test_harness,no_run
22395/// # extern crate hyper;
22396/// # extern crate hyper_rustls;
22397/// # extern crate google_run1 as run1;
22398/// use run1::api::Service;
22399/// # async fn dox() {
22400/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22401///
22402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22403/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22404/// # .with_native_roots()
22405/// # .unwrap()
22406/// # .https_only()
22407/// # .enable_http2()
22408/// # .build();
22409///
22410/// # let executor = hyper_util::rt::TokioExecutor::new();
22411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22412/// # secret,
22413/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22414/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22415/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22416/// # ),
22417/// # ).build().await.unwrap();
22418///
22419/// # let client = hyper_util::client::legacy::Client::builder(
22420/// # hyper_util::rt::TokioExecutor::new()
22421/// # )
22422/// # .build(
22423/// # hyper_rustls::HttpsConnectorBuilder::new()
22424/// # .with_native_roots()
22425/// # .unwrap()
22426/// # .https_or_http()
22427/// # .enable_http2()
22428/// # .build()
22429/// # );
22430/// # let mut hub = CloudRun::new(client, auth);
22431/// // As the method needs a request, you would usually fill it with the desired information
22432/// // into the respective structure. Some of the parts shown here might not be applicable !
22433/// // Values shown here are possibly random and not representative !
22434/// let mut req = Service::default();
22435///
22436/// // You can configure optional parameters by calling the respective setters at will, and
22437/// // execute the final call using `doit()`.
22438/// // Values shown here are possibly random and not representative !
22439/// let result = hub.projects().locations_services_create(req, "parent")
22440/// .dry_run("dolore")
22441/// .doit().await;
22442/// # }
22443/// ```
22444pub struct ProjectLocationServiceCreateCall<'a, C>
22445where
22446 C: 'a,
22447{
22448 hub: &'a CloudRun<C>,
22449 _request: Service,
22450 _parent: String,
22451 _dry_run: Option<String>,
22452 _delegate: Option<&'a mut dyn common::Delegate>,
22453 _additional_params: HashMap<String, String>,
22454 _scopes: BTreeSet<String>,
22455}
22456
22457impl<'a, C> common::CallBuilder for ProjectLocationServiceCreateCall<'a, C> {}
22458
22459impl<'a, C> ProjectLocationServiceCreateCall<'a, C>
22460where
22461 C: common::Connector,
22462{
22463 /// Perform the operation you have build so far.
22464 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
22465 use std::borrow::Cow;
22466 use std::io::{Read, Seek};
22467
22468 use common::{url::Params, ToParts};
22469 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22470
22471 let mut dd = common::DefaultDelegate;
22472 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22473 dlg.begin(common::MethodInfo {
22474 id: "run.projects.locations.services.create",
22475 http_method: hyper::Method::POST,
22476 });
22477
22478 for &field in ["alt", "parent", "dryRun"].iter() {
22479 if self._additional_params.contains_key(field) {
22480 dlg.finished(false);
22481 return Err(common::Error::FieldClash(field));
22482 }
22483 }
22484
22485 let mut params = Params::with_capacity(5 + self._additional_params.len());
22486 params.push("parent", self._parent);
22487 if let Some(value) = self._dry_run.as_ref() {
22488 params.push("dryRun", value);
22489 }
22490
22491 params.extend(self._additional_params.iter());
22492
22493 params.push("alt", "json");
22494 let mut url = self.hub._base_url.clone() + "v1/{+parent}/services";
22495 if self._scopes.is_empty() {
22496 self._scopes
22497 .insert(Scope::CloudPlatform.as_ref().to_string());
22498 }
22499
22500 #[allow(clippy::single_element_loop)]
22501 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22502 url = params.uri_replacement(url, param_name, find_this, true);
22503 }
22504 {
22505 let to_remove = ["parent"];
22506 params.remove_params(&to_remove);
22507 }
22508
22509 let url = params.parse_with_url(&url);
22510
22511 let mut json_mime_type = mime::APPLICATION_JSON;
22512 let mut request_value_reader = {
22513 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22514 common::remove_json_null_values(&mut value);
22515 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22516 serde_json::to_writer(&mut dst, &value).unwrap();
22517 dst
22518 };
22519 let request_size = request_value_reader
22520 .seek(std::io::SeekFrom::End(0))
22521 .unwrap();
22522 request_value_reader
22523 .seek(std::io::SeekFrom::Start(0))
22524 .unwrap();
22525
22526 loop {
22527 let token = match self
22528 .hub
22529 .auth
22530 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22531 .await
22532 {
22533 Ok(token) => token,
22534 Err(e) => match dlg.token(e) {
22535 Ok(token) => token,
22536 Err(e) => {
22537 dlg.finished(false);
22538 return Err(common::Error::MissingToken(e));
22539 }
22540 },
22541 };
22542 request_value_reader
22543 .seek(std::io::SeekFrom::Start(0))
22544 .unwrap();
22545 let mut req_result = {
22546 let client = &self.hub.client;
22547 dlg.pre_request();
22548 let mut req_builder = hyper::Request::builder()
22549 .method(hyper::Method::POST)
22550 .uri(url.as_str())
22551 .header(USER_AGENT, self.hub._user_agent.clone());
22552
22553 if let Some(token) = token.as_ref() {
22554 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22555 }
22556
22557 let request = req_builder
22558 .header(CONTENT_TYPE, json_mime_type.to_string())
22559 .header(CONTENT_LENGTH, request_size as u64)
22560 .body(common::to_body(
22561 request_value_reader.get_ref().clone().into(),
22562 ));
22563
22564 client.request(request.unwrap()).await
22565 };
22566
22567 match req_result {
22568 Err(err) => {
22569 if let common::Retry::After(d) = dlg.http_error(&err) {
22570 sleep(d).await;
22571 continue;
22572 }
22573 dlg.finished(false);
22574 return Err(common::Error::HttpError(err));
22575 }
22576 Ok(res) => {
22577 let (mut parts, body) = res.into_parts();
22578 let mut body = common::Body::new(body);
22579 if !parts.status.is_success() {
22580 let bytes = common::to_bytes(body).await.unwrap_or_default();
22581 let error = serde_json::from_str(&common::to_string(&bytes));
22582 let response = common::to_response(parts, bytes.into());
22583
22584 if let common::Retry::After(d) =
22585 dlg.http_failure(&response, error.as_ref().ok())
22586 {
22587 sleep(d).await;
22588 continue;
22589 }
22590
22591 dlg.finished(false);
22592
22593 return Err(match error {
22594 Ok(value) => common::Error::BadRequest(value),
22595 _ => common::Error::Failure(response),
22596 });
22597 }
22598 let response = {
22599 let bytes = common::to_bytes(body).await.unwrap_or_default();
22600 let encoded = common::to_string(&bytes);
22601 match serde_json::from_str(&encoded) {
22602 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22603 Err(error) => {
22604 dlg.response_json_decode_error(&encoded, &error);
22605 return Err(common::Error::JsonDecodeError(
22606 encoded.to_string(),
22607 error,
22608 ));
22609 }
22610 }
22611 };
22612
22613 dlg.finished(true);
22614 return Ok(response);
22615 }
22616 }
22617 }
22618 }
22619
22620 ///
22621 /// Sets the *request* property to the given value.
22622 ///
22623 /// Even though the property as already been set when instantiating this call,
22624 /// we provide this method for API completeness.
22625 pub fn request(mut self, new_value: Service) -> ProjectLocationServiceCreateCall<'a, C> {
22626 self._request = new_value;
22627 self
22628 }
22629 /// 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}`
22630 ///
22631 /// Sets the *parent* path property to the given value.
22632 ///
22633 /// Even though the property as already been set when instantiating this call,
22634 /// we provide this method for API completeness.
22635 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
22636 self._parent = new_value.to_string();
22637 self
22638 }
22639 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
22640 ///
22641 /// Sets the *dry run* query property to the given value.
22642 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
22643 self._dry_run = Some(new_value.to_string());
22644 self
22645 }
22646 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22647 /// while executing the actual API request.
22648 ///
22649 /// ````text
22650 /// It should be used to handle progress information, and to implement a certain level of resilience.
22651 /// ````
22652 ///
22653 /// Sets the *delegate* property to the given value.
22654 pub fn delegate(
22655 mut self,
22656 new_value: &'a mut dyn common::Delegate,
22657 ) -> ProjectLocationServiceCreateCall<'a, C> {
22658 self._delegate = Some(new_value);
22659 self
22660 }
22661
22662 /// Set any additional parameter of the query string used in the request.
22663 /// It should be used to set parameters which are not yet available through their own
22664 /// setters.
22665 ///
22666 /// Please note that this method must not be used to set any of the known parameters
22667 /// which have their own setter method. If done anyway, the request will fail.
22668 ///
22669 /// # Additional Parameters
22670 ///
22671 /// * *$.xgafv* (query-string) - V1 error format.
22672 /// * *access_token* (query-string) - OAuth access token.
22673 /// * *alt* (query-string) - Data format for response.
22674 /// * *callback* (query-string) - JSONP
22675 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22676 /// * *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.
22677 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22678 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22679 /// * *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.
22680 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22681 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22682 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceCreateCall<'a, C>
22683 where
22684 T: AsRef<str>,
22685 {
22686 self._additional_params
22687 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22688 self
22689 }
22690
22691 /// Identifies the authorization scope for the method you are building.
22692 ///
22693 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22694 /// [`Scope::CloudPlatform`].
22695 ///
22696 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22697 /// tokens for more than one scope.
22698 ///
22699 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22700 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22701 /// sufficient, a read-write scope will do as well.
22702 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCreateCall<'a, C>
22703 where
22704 St: AsRef<str>,
22705 {
22706 self._scopes.insert(String::from(scope.as_ref()));
22707 self
22708 }
22709 /// Identifies the authorization scope(s) for the method you are building.
22710 ///
22711 /// See [`Self::add_scope()`] for details.
22712 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceCreateCall<'a, C>
22713 where
22714 I: IntoIterator<Item = St>,
22715 St: AsRef<str>,
22716 {
22717 self._scopes
22718 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22719 self
22720 }
22721
22722 /// Removes all scopes, and no default scope will be used either.
22723 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22724 /// for details).
22725 pub fn clear_scopes(mut self) -> ProjectLocationServiceCreateCall<'a, C> {
22726 self._scopes.clear();
22727 self
22728 }
22729}
22730
22731/// Deletes the provided service. This will cause the Service to stop serving traffic and will delete all associated Revisions.
22732///
22733/// A builder for the *locations.services.delete* method supported by a *project* resource.
22734/// It is not used directly, but through a [`ProjectMethods`] instance.
22735///
22736/// # Example
22737///
22738/// Instantiate a resource method builder
22739///
22740/// ```test_harness,no_run
22741/// # extern crate hyper;
22742/// # extern crate hyper_rustls;
22743/// # extern crate google_run1 as run1;
22744/// # async fn dox() {
22745/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22746///
22747/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22748/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22749/// # .with_native_roots()
22750/// # .unwrap()
22751/// # .https_only()
22752/// # .enable_http2()
22753/// # .build();
22754///
22755/// # let executor = hyper_util::rt::TokioExecutor::new();
22756/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22757/// # secret,
22758/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22759/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22760/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22761/// # ),
22762/// # ).build().await.unwrap();
22763///
22764/// # let client = hyper_util::client::legacy::Client::builder(
22765/// # hyper_util::rt::TokioExecutor::new()
22766/// # )
22767/// # .build(
22768/// # hyper_rustls::HttpsConnectorBuilder::new()
22769/// # .with_native_roots()
22770/// # .unwrap()
22771/// # .https_or_http()
22772/// # .enable_http2()
22773/// # .build()
22774/// # );
22775/// # let mut hub = CloudRun::new(client, auth);
22776/// // You can configure optional parameters by calling the respective setters at will, and
22777/// // execute the final call using `doit()`.
22778/// // Values shown here are possibly random and not representative !
22779/// let result = hub.projects().locations_services_delete("name")
22780/// .propagation_policy("ut")
22781/// .kind("At")
22782/// .dry_run("sit")
22783/// .api_version("vero")
22784/// .doit().await;
22785/// # }
22786/// ```
22787pub struct ProjectLocationServiceDeleteCall<'a, C>
22788where
22789 C: 'a,
22790{
22791 hub: &'a CloudRun<C>,
22792 _name: String,
22793 _propagation_policy: Option<String>,
22794 _kind: Option<String>,
22795 _dry_run: Option<String>,
22796 _api_version: Option<String>,
22797 _delegate: Option<&'a mut dyn common::Delegate>,
22798 _additional_params: HashMap<String, String>,
22799 _scopes: BTreeSet<String>,
22800}
22801
22802impl<'a, C> common::CallBuilder for ProjectLocationServiceDeleteCall<'a, C> {}
22803
22804impl<'a, C> ProjectLocationServiceDeleteCall<'a, C>
22805where
22806 C: common::Connector,
22807{
22808 /// Perform the operation you have build so far.
22809 pub async fn doit(mut self) -> common::Result<(common::Response, Status)> {
22810 use std::borrow::Cow;
22811 use std::io::{Read, Seek};
22812
22813 use common::{url::Params, ToParts};
22814 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22815
22816 let mut dd = common::DefaultDelegate;
22817 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22818 dlg.begin(common::MethodInfo {
22819 id: "run.projects.locations.services.delete",
22820 http_method: hyper::Method::DELETE,
22821 });
22822
22823 for &field in [
22824 "alt",
22825 "name",
22826 "propagationPolicy",
22827 "kind",
22828 "dryRun",
22829 "apiVersion",
22830 ]
22831 .iter()
22832 {
22833 if self._additional_params.contains_key(field) {
22834 dlg.finished(false);
22835 return Err(common::Error::FieldClash(field));
22836 }
22837 }
22838
22839 let mut params = Params::with_capacity(7 + self._additional_params.len());
22840 params.push("name", self._name);
22841 if let Some(value) = self._propagation_policy.as_ref() {
22842 params.push("propagationPolicy", value);
22843 }
22844 if let Some(value) = self._kind.as_ref() {
22845 params.push("kind", value);
22846 }
22847 if let Some(value) = self._dry_run.as_ref() {
22848 params.push("dryRun", value);
22849 }
22850 if let Some(value) = self._api_version.as_ref() {
22851 params.push("apiVersion", value);
22852 }
22853
22854 params.extend(self._additional_params.iter());
22855
22856 params.push("alt", "json");
22857 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22858 if self._scopes.is_empty() {
22859 self._scopes
22860 .insert(Scope::CloudPlatform.as_ref().to_string());
22861 }
22862
22863 #[allow(clippy::single_element_loop)]
22864 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22865 url = params.uri_replacement(url, param_name, find_this, true);
22866 }
22867 {
22868 let to_remove = ["name"];
22869 params.remove_params(&to_remove);
22870 }
22871
22872 let url = params.parse_with_url(&url);
22873
22874 loop {
22875 let token = match self
22876 .hub
22877 .auth
22878 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22879 .await
22880 {
22881 Ok(token) => token,
22882 Err(e) => match dlg.token(e) {
22883 Ok(token) => token,
22884 Err(e) => {
22885 dlg.finished(false);
22886 return Err(common::Error::MissingToken(e));
22887 }
22888 },
22889 };
22890 let mut req_result = {
22891 let client = &self.hub.client;
22892 dlg.pre_request();
22893 let mut req_builder = hyper::Request::builder()
22894 .method(hyper::Method::DELETE)
22895 .uri(url.as_str())
22896 .header(USER_AGENT, self.hub._user_agent.clone());
22897
22898 if let Some(token) = token.as_ref() {
22899 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22900 }
22901
22902 let request = req_builder
22903 .header(CONTENT_LENGTH, 0_u64)
22904 .body(common::to_body::<String>(None));
22905
22906 client.request(request.unwrap()).await
22907 };
22908
22909 match req_result {
22910 Err(err) => {
22911 if let common::Retry::After(d) = dlg.http_error(&err) {
22912 sleep(d).await;
22913 continue;
22914 }
22915 dlg.finished(false);
22916 return Err(common::Error::HttpError(err));
22917 }
22918 Ok(res) => {
22919 let (mut parts, body) = res.into_parts();
22920 let mut body = common::Body::new(body);
22921 if !parts.status.is_success() {
22922 let bytes = common::to_bytes(body).await.unwrap_or_default();
22923 let error = serde_json::from_str(&common::to_string(&bytes));
22924 let response = common::to_response(parts, bytes.into());
22925
22926 if let common::Retry::After(d) =
22927 dlg.http_failure(&response, error.as_ref().ok())
22928 {
22929 sleep(d).await;
22930 continue;
22931 }
22932
22933 dlg.finished(false);
22934
22935 return Err(match error {
22936 Ok(value) => common::Error::BadRequest(value),
22937 _ => common::Error::Failure(response),
22938 });
22939 }
22940 let response = {
22941 let bytes = common::to_bytes(body).await.unwrap_or_default();
22942 let encoded = common::to_string(&bytes);
22943 match serde_json::from_str(&encoded) {
22944 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22945 Err(error) => {
22946 dlg.response_json_decode_error(&encoded, &error);
22947 return Err(common::Error::JsonDecodeError(
22948 encoded.to_string(),
22949 error,
22950 ));
22951 }
22952 }
22953 };
22954
22955 dlg.finished(true);
22956 return Ok(response);
22957 }
22958 }
22959 }
22960 }
22961
22962 /// 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}`
22963 ///
22964 /// Sets the *name* path property to the given value.
22965 ///
22966 /// Even though the property as already been set when instantiating this call,
22967 /// we provide this method for API completeness.
22968 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
22969 self._name = new_value.to_string();
22970 self
22971 }
22972 /// Not supported, and ignored by Cloud Run.
22973 ///
22974 /// Sets the *propagation policy* query property to the given value.
22975 pub fn propagation_policy(
22976 mut self,
22977 new_value: &str,
22978 ) -> ProjectLocationServiceDeleteCall<'a, C> {
22979 self._propagation_policy = Some(new_value.to_string());
22980 self
22981 }
22982 /// Not supported, and ignored by Cloud Run.
22983 ///
22984 /// Sets the *kind* query property to the given value.
22985 pub fn kind(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
22986 self._kind = Some(new_value.to_string());
22987 self
22988 }
22989 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
22990 ///
22991 /// Sets the *dry run* query property to the given value.
22992 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
22993 self._dry_run = Some(new_value.to_string());
22994 self
22995 }
22996 /// Not supported, and ignored by Cloud Run.
22997 ///
22998 /// Sets the *api version* query property to the given value.
22999 pub fn api_version(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
23000 self._api_version = Some(new_value.to_string());
23001 self
23002 }
23003 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23004 /// while executing the actual API request.
23005 ///
23006 /// ````text
23007 /// It should be used to handle progress information, and to implement a certain level of resilience.
23008 /// ````
23009 ///
23010 /// Sets the *delegate* property to the given value.
23011 pub fn delegate(
23012 mut self,
23013 new_value: &'a mut dyn common::Delegate,
23014 ) -> ProjectLocationServiceDeleteCall<'a, C> {
23015 self._delegate = Some(new_value);
23016 self
23017 }
23018
23019 /// Set any additional parameter of the query string used in the request.
23020 /// It should be used to set parameters which are not yet available through their own
23021 /// setters.
23022 ///
23023 /// Please note that this method must not be used to set any of the known parameters
23024 /// which have their own setter method. If done anyway, the request will fail.
23025 ///
23026 /// # Additional Parameters
23027 ///
23028 /// * *$.xgafv* (query-string) - V1 error format.
23029 /// * *access_token* (query-string) - OAuth access token.
23030 /// * *alt* (query-string) - Data format for response.
23031 /// * *callback* (query-string) - JSONP
23032 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23033 /// * *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.
23034 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23035 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23036 /// * *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.
23037 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23038 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23039 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceDeleteCall<'a, C>
23040 where
23041 T: AsRef<str>,
23042 {
23043 self._additional_params
23044 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23045 self
23046 }
23047
23048 /// Identifies the authorization scope for the method you are building.
23049 ///
23050 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23051 /// [`Scope::CloudPlatform`].
23052 ///
23053 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23054 /// tokens for more than one scope.
23055 ///
23056 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23057 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23058 /// sufficient, a read-write scope will do as well.
23059 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceDeleteCall<'a, C>
23060 where
23061 St: AsRef<str>,
23062 {
23063 self._scopes.insert(String::from(scope.as_ref()));
23064 self
23065 }
23066 /// Identifies the authorization scope(s) for the method you are building.
23067 ///
23068 /// See [`Self::add_scope()`] for details.
23069 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceDeleteCall<'a, C>
23070 where
23071 I: IntoIterator<Item = St>,
23072 St: AsRef<str>,
23073 {
23074 self._scopes
23075 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23076 self
23077 }
23078
23079 /// Removes all scopes, and no default scope will be used either.
23080 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23081 /// for details).
23082 pub fn clear_scopes(mut self) -> ProjectLocationServiceDeleteCall<'a, C> {
23083 self._scopes.clear();
23084 self
23085 }
23086}
23087
23088/// Gets information about a service.
23089///
23090/// A builder for the *locations.services.get* method supported by a *project* resource.
23091/// It is not used directly, but through a [`ProjectMethods`] instance.
23092///
23093/// # Example
23094///
23095/// Instantiate a resource method builder
23096///
23097/// ```test_harness,no_run
23098/// # extern crate hyper;
23099/// # extern crate hyper_rustls;
23100/// # extern crate google_run1 as run1;
23101/// # async fn dox() {
23102/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23103///
23104/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23105/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23106/// # .with_native_roots()
23107/// # .unwrap()
23108/// # .https_only()
23109/// # .enable_http2()
23110/// # .build();
23111///
23112/// # let executor = hyper_util::rt::TokioExecutor::new();
23113/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23114/// # secret,
23115/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23116/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23117/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23118/// # ),
23119/// # ).build().await.unwrap();
23120///
23121/// # let client = hyper_util::client::legacy::Client::builder(
23122/// # hyper_util::rt::TokioExecutor::new()
23123/// # )
23124/// # .build(
23125/// # hyper_rustls::HttpsConnectorBuilder::new()
23126/// # .with_native_roots()
23127/// # .unwrap()
23128/// # .https_or_http()
23129/// # .enable_http2()
23130/// # .build()
23131/// # );
23132/// # let mut hub = CloudRun::new(client, auth);
23133/// // You can configure optional parameters by calling the respective setters at will, and
23134/// // execute the final call using `doit()`.
23135/// // Values shown here are possibly random and not representative !
23136/// let result = hub.projects().locations_services_get("name")
23137/// .doit().await;
23138/// # }
23139/// ```
23140pub struct ProjectLocationServiceGetCall<'a, C>
23141where
23142 C: 'a,
23143{
23144 hub: &'a CloudRun<C>,
23145 _name: String,
23146 _delegate: Option<&'a mut dyn common::Delegate>,
23147 _additional_params: HashMap<String, String>,
23148 _scopes: BTreeSet<String>,
23149}
23150
23151impl<'a, C> common::CallBuilder for ProjectLocationServiceGetCall<'a, C> {}
23152
23153impl<'a, C> ProjectLocationServiceGetCall<'a, C>
23154where
23155 C: common::Connector,
23156{
23157 /// Perform the operation you have build so far.
23158 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
23159 use std::borrow::Cow;
23160 use std::io::{Read, Seek};
23161
23162 use common::{url::Params, ToParts};
23163 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23164
23165 let mut dd = common::DefaultDelegate;
23166 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23167 dlg.begin(common::MethodInfo {
23168 id: "run.projects.locations.services.get",
23169 http_method: hyper::Method::GET,
23170 });
23171
23172 for &field in ["alt", "name"].iter() {
23173 if self._additional_params.contains_key(field) {
23174 dlg.finished(false);
23175 return Err(common::Error::FieldClash(field));
23176 }
23177 }
23178
23179 let mut params = Params::with_capacity(3 + self._additional_params.len());
23180 params.push("name", self._name);
23181
23182 params.extend(self._additional_params.iter());
23183
23184 params.push("alt", "json");
23185 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23186 if self._scopes.is_empty() {
23187 self._scopes
23188 .insert(Scope::CloudPlatform.as_ref().to_string());
23189 }
23190
23191 #[allow(clippy::single_element_loop)]
23192 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23193 url = params.uri_replacement(url, param_name, find_this, true);
23194 }
23195 {
23196 let to_remove = ["name"];
23197 params.remove_params(&to_remove);
23198 }
23199
23200 let url = params.parse_with_url(&url);
23201
23202 loop {
23203 let token = match self
23204 .hub
23205 .auth
23206 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23207 .await
23208 {
23209 Ok(token) => token,
23210 Err(e) => match dlg.token(e) {
23211 Ok(token) => token,
23212 Err(e) => {
23213 dlg.finished(false);
23214 return Err(common::Error::MissingToken(e));
23215 }
23216 },
23217 };
23218 let mut req_result = {
23219 let client = &self.hub.client;
23220 dlg.pre_request();
23221 let mut req_builder = hyper::Request::builder()
23222 .method(hyper::Method::GET)
23223 .uri(url.as_str())
23224 .header(USER_AGENT, self.hub._user_agent.clone());
23225
23226 if let Some(token) = token.as_ref() {
23227 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23228 }
23229
23230 let request = req_builder
23231 .header(CONTENT_LENGTH, 0_u64)
23232 .body(common::to_body::<String>(None));
23233
23234 client.request(request.unwrap()).await
23235 };
23236
23237 match req_result {
23238 Err(err) => {
23239 if let common::Retry::After(d) = dlg.http_error(&err) {
23240 sleep(d).await;
23241 continue;
23242 }
23243 dlg.finished(false);
23244 return Err(common::Error::HttpError(err));
23245 }
23246 Ok(res) => {
23247 let (mut parts, body) = res.into_parts();
23248 let mut body = common::Body::new(body);
23249 if !parts.status.is_success() {
23250 let bytes = common::to_bytes(body).await.unwrap_or_default();
23251 let error = serde_json::from_str(&common::to_string(&bytes));
23252 let response = common::to_response(parts, bytes.into());
23253
23254 if let common::Retry::After(d) =
23255 dlg.http_failure(&response, error.as_ref().ok())
23256 {
23257 sleep(d).await;
23258 continue;
23259 }
23260
23261 dlg.finished(false);
23262
23263 return Err(match error {
23264 Ok(value) => common::Error::BadRequest(value),
23265 _ => common::Error::Failure(response),
23266 });
23267 }
23268 let response = {
23269 let bytes = common::to_bytes(body).await.unwrap_or_default();
23270 let encoded = common::to_string(&bytes);
23271 match serde_json::from_str(&encoded) {
23272 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23273 Err(error) => {
23274 dlg.response_json_decode_error(&encoded, &error);
23275 return Err(common::Error::JsonDecodeError(
23276 encoded.to_string(),
23277 error,
23278 ));
23279 }
23280 }
23281 };
23282
23283 dlg.finished(true);
23284 return Ok(response);
23285 }
23286 }
23287 }
23288 }
23289
23290 /// 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}`
23291 ///
23292 /// Sets the *name* path property to the given value.
23293 ///
23294 /// Even though the property as already been set when instantiating this call,
23295 /// we provide this method for API completeness.
23296 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceGetCall<'a, C> {
23297 self._name = new_value.to_string();
23298 self
23299 }
23300 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23301 /// while executing the actual API request.
23302 ///
23303 /// ````text
23304 /// It should be used to handle progress information, and to implement a certain level of resilience.
23305 /// ````
23306 ///
23307 /// Sets the *delegate* property to the given value.
23308 pub fn delegate(
23309 mut self,
23310 new_value: &'a mut dyn common::Delegate,
23311 ) -> ProjectLocationServiceGetCall<'a, C> {
23312 self._delegate = Some(new_value);
23313 self
23314 }
23315
23316 /// Set any additional parameter of the query string used in the request.
23317 /// It should be used to set parameters which are not yet available through their own
23318 /// setters.
23319 ///
23320 /// Please note that this method must not be used to set any of the known parameters
23321 /// which have their own setter method. If done anyway, the request will fail.
23322 ///
23323 /// # Additional Parameters
23324 ///
23325 /// * *$.xgafv* (query-string) - V1 error format.
23326 /// * *access_token* (query-string) - OAuth access token.
23327 /// * *alt* (query-string) - Data format for response.
23328 /// * *callback* (query-string) - JSONP
23329 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23330 /// * *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.
23331 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23332 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23333 /// * *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.
23334 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23335 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23336 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetCall<'a, C>
23337 where
23338 T: AsRef<str>,
23339 {
23340 self._additional_params
23341 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23342 self
23343 }
23344
23345 /// Identifies the authorization scope for the method you are building.
23346 ///
23347 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23348 /// [`Scope::CloudPlatform`].
23349 ///
23350 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23351 /// tokens for more than one scope.
23352 ///
23353 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23354 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23355 /// sufficient, a read-write scope will do as well.
23356 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetCall<'a, C>
23357 where
23358 St: AsRef<str>,
23359 {
23360 self._scopes.insert(String::from(scope.as_ref()));
23361 self
23362 }
23363 /// Identifies the authorization scope(s) for the method you are building.
23364 ///
23365 /// See [`Self::add_scope()`] for details.
23366 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetCall<'a, C>
23367 where
23368 I: IntoIterator<Item = St>,
23369 St: AsRef<str>,
23370 {
23371 self._scopes
23372 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23373 self
23374 }
23375
23376 /// Removes all scopes, and no default scope will be used either.
23377 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23378 /// for details).
23379 pub fn clear_scopes(mut self) -> ProjectLocationServiceGetCall<'a, C> {
23380 self._scopes.clear();
23381 self
23382 }
23383}
23384
23385/// Gets the IAM Access Control policy currently in effect for the given Cloud Run service. This result does not include any inherited policies.
23386///
23387/// A builder for the *locations.services.getIamPolicy* method supported by a *project* resource.
23388/// It is not used directly, but through a [`ProjectMethods`] instance.
23389///
23390/// # Example
23391///
23392/// Instantiate a resource method builder
23393///
23394/// ```test_harness,no_run
23395/// # extern crate hyper;
23396/// # extern crate hyper_rustls;
23397/// # extern crate google_run1 as run1;
23398/// # async fn dox() {
23399/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23400///
23401/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23402/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23403/// # .with_native_roots()
23404/// # .unwrap()
23405/// # .https_only()
23406/// # .enable_http2()
23407/// # .build();
23408///
23409/// # let executor = hyper_util::rt::TokioExecutor::new();
23410/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23411/// # secret,
23412/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23413/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23414/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23415/// # ),
23416/// # ).build().await.unwrap();
23417///
23418/// # let client = hyper_util::client::legacy::Client::builder(
23419/// # hyper_util::rt::TokioExecutor::new()
23420/// # )
23421/// # .build(
23422/// # hyper_rustls::HttpsConnectorBuilder::new()
23423/// # .with_native_roots()
23424/// # .unwrap()
23425/// # .https_or_http()
23426/// # .enable_http2()
23427/// # .build()
23428/// # );
23429/// # let mut hub = CloudRun::new(client, auth);
23430/// // You can configure optional parameters by calling the respective setters at will, and
23431/// // execute the final call using `doit()`.
23432/// // Values shown here are possibly random and not representative !
23433/// let result = hub.projects().locations_services_get_iam_policy("resource")
23434/// .options_requested_policy_version(-87)
23435/// .doit().await;
23436/// # }
23437/// ```
23438pub struct ProjectLocationServiceGetIamPolicyCall<'a, C>
23439where
23440 C: 'a,
23441{
23442 hub: &'a CloudRun<C>,
23443 _resource: String,
23444 _options_requested_policy_version: Option<i32>,
23445 _delegate: Option<&'a mut dyn common::Delegate>,
23446 _additional_params: HashMap<String, String>,
23447 _scopes: BTreeSet<String>,
23448}
23449
23450impl<'a, C> common::CallBuilder for ProjectLocationServiceGetIamPolicyCall<'a, C> {}
23451
23452impl<'a, C> ProjectLocationServiceGetIamPolicyCall<'a, C>
23453where
23454 C: common::Connector,
23455{
23456 /// Perform the operation you have build so far.
23457 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23458 use std::borrow::Cow;
23459 use std::io::{Read, Seek};
23460
23461 use common::{url::Params, ToParts};
23462 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23463
23464 let mut dd = common::DefaultDelegate;
23465 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23466 dlg.begin(common::MethodInfo {
23467 id: "run.projects.locations.services.getIamPolicy",
23468 http_method: hyper::Method::GET,
23469 });
23470
23471 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
23472 if self._additional_params.contains_key(field) {
23473 dlg.finished(false);
23474 return Err(common::Error::FieldClash(field));
23475 }
23476 }
23477
23478 let mut params = Params::with_capacity(4 + self._additional_params.len());
23479 params.push("resource", self._resource);
23480 if let Some(value) = self._options_requested_policy_version.as_ref() {
23481 params.push("options.requestedPolicyVersion", value.to_string());
23482 }
23483
23484 params.extend(self._additional_params.iter());
23485
23486 params.push("alt", "json");
23487 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
23488 if self._scopes.is_empty() {
23489 self._scopes
23490 .insert(Scope::CloudPlatform.as_ref().to_string());
23491 }
23492
23493 #[allow(clippy::single_element_loop)]
23494 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23495 url = params.uri_replacement(url, param_name, find_this, true);
23496 }
23497 {
23498 let to_remove = ["resource"];
23499 params.remove_params(&to_remove);
23500 }
23501
23502 let url = params.parse_with_url(&url);
23503
23504 loop {
23505 let token = match self
23506 .hub
23507 .auth
23508 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23509 .await
23510 {
23511 Ok(token) => token,
23512 Err(e) => match dlg.token(e) {
23513 Ok(token) => token,
23514 Err(e) => {
23515 dlg.finished(false);
23516 return Err(common::Error::MissingToken(e));
23517 }
23518 },
23519 };
23520 let mut req_result = {
23521 let client = &self.hub.client;
23522 dlg.pre_request();
23523 let mut req_builder = hyper::Request::builder()
23524 .method(hyper::Method::GET)
23525 .uri(url.as_str())
23526 .header(USER_AGENT, self.hub._user_agent.clone());
23527
23528 if let Some(token) = token.as_ref() {
23529 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23530 }
23531
23532 let request = req_builder
23533 .header(CONTENT_LENGTH, 0_u64)
23534 .body(common::to_body::<String>(None));
23535
23536 client.request(request.unwrap()).await
23537 };
23538
23539 match req_result {
23540 Err(err) => {
23541 if let common::Retry::After(d) = dlg.http_error(&err) {
23542 sleep(d).await;
23543 continue;
23544 }
23545 dlg.finished(false);
23546 return Err(common::Error::HttpError(err));
23547 }
23548 Ok(res) => {
23549 let (mut parts, body) = res.into_parts();
23550 let mut body = common::Body::new(body);
23551 if !parts.status.is_success() {
23552 let bytes = common::to_bytes(body).await.unwrap_or_default();
23553 let error = serde_json::from_str(&common::to_string(&bytes));
23554 let response = common::to_response(parts, bytes.into());
23555
23556 if let common::Retry::After(d) =
23557 dlg.http_failure(&response, error.as_ref().ok())
23558 {
23559 sleep(d).await;
23560 continue;
23561 }
23562
23563 dlg.finished(false);
23564
23565 return Err(match error {
23566 Ok(value) => common::Error::BadRequest(value),
23567 _ => common::Error::Failure(response),
23568 });
23569 }
23570 let response = {
23571 let bytes = common::to_bytes(body).await.unwrap_or_default();
23572 let encoded = common::to_string(&bytes);
23573 match serde_json::from_str(&encoded) {
23574 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23575 Err(error) => {
23576 dlg.response_json_decode_error(&encoded, &error);
23577 return Err(common::Error::JsonDecodeError(
23578 encoded.to_string(),
23579 error,
23580 ));
23581 }
23582 }
23583 };
23584
23585 dlg.finished(true);
23586 return Ok(response);
23587 }
23588 }
23589 }
23590 }
23591
23592 /// 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.
23593 ///
23594 /// Sets the *resource* path property to the given value.
23595 ///
23596 /// Even though the property as already been set when instantiating this call,
23597 /// we provide this method for API completeness.
23598 pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
23599 self._resource = new_value.to_string();
23600 self
23601 }
23602 /// 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).
23603 ///
23604 /// Sets the *options.requested policy version* query property to the given value.
23605 pub fn options_requested_policy_version(
23606 mut self,
23607 new_value: i32,
23608 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
23609 self._options_requested_policy_version = Some(new_value);
23610 self
23611 }
23612 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23613 /// while executing the actual API request.
23614 ///
23615 /// ````text
23616 /// It should be used to handle progress information, and to implement a certain level of resilience.
23617 /// ````
23618 ///
23619 /// Sets the *delegate* property to the given value.
23620 pub fn delegate(
23621 mut self,
23622 new_value: &'a mut dyn common::Delegate,
23623 ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
23624 self._delegate = Some(new_value);
23625 self
23626 }
23627
23628 /// Set any additional parameter of the query string used in the request.
23629 /// It should be used to set parameters which are not yet available through their own
23630 /// setters.
23631 ///
23632 /// Please note that this method must not be used to set any of the known parameters
23633 /// which have their own setter method. If done anyway, the request will fail.
23634 ///
23635 /// # Additional Parameters
23636 ///
23637 /// * *$.xgafv* (query-string) - V1 error format.
23638 /// * *access_token* (query-string) - OAuth access token.
23639 /// * *alt* (query-string) - Data format for response.
23640 /// * *callback* (query-string) - JSONP
23641 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23642 /// * *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.
23643 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23644 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23645 /// * *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.
23646 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23647 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23648 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
23649 where
23650 T: AsRef<str>,
23651 {
23652 self._additional_params
23653 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23654 self
23655 }
23656
23657 /// Identifies the authorization scope for the method you are building.
23658 ///
23659 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23660 /// [`Scope::CloudPlatform`].
23661 ///
23662 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23663 /// tokens for more than one scope.
23664 ///
23665 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23666 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23667 /// sufficient, a read-write scope will do as well.
23668 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
23669 where
23670 St: AsRef<str>,
23671 {
23672 self._scopes.insert(String::from(scope.as_ref()));
23673 self
23674 }
23675 /// Identifies the authorization scope(s) for the method you are building.
23676 ///
23677 /// See [`Self::add_scope()`] for details.
23678 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
23679 where
23680 I: IntoIterator<Item = St>,
23681 St: AsRef<str>,
23682 {
23683 self._scopes
23684 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23685 self
23686 }
23687
23688 /// Removes all scopes, and no default scope will be used either.
23689 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23690 /// for details).
23691 pub fn clear_scopes(mut self) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
23692 self._scopes.clear();
23693 self
23694 }
23695}
23696
23697/// Lists services for the given project and region. Results are sorted by creation time, descending.
23698///
23699/// A builder for the *locations.services.list* method supported by a *project* resource.
23700/// It is not used directly, but through a [`ProjectMethods`] instance.
23701///
23702/// # Example
23703///
23704/// Instantiate a resource method builder
23705///
23706/// ```test_harness,no_run
23707/// # extern crate hyper;
23708/// # extern crate hyper_rustls;
23709/// # extern crate google_run1 as run1;
23710/// # async fn dox() {
23711/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23712///
23713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23715/// # .with_native_roots()
23716/// # .unwrap()
23717/// # .https_only()
23718/// # .enable_http2()
23719/// # .build();
23720///
23721/// # let executor = hyper_util::rt::TokioExecutor::new();
23722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23723/// # secret,
23724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23725/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23726/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23727/// # ),
23728/// # ).build().await.unwrap();
23729///
23730/// # let client = hyper_util::client::legacy::Client::builder(
23731/// # hyper_util::rt::TokioExecutor::new()
23732/// # )
23733/// # .build(
23734/// # hyper_rustls::HttpsConnectorBuilder::new()
23735/// # .with_native_roots()
23736/// # .unwrap()
23737/// # .https_or_http()
23738/// # .enable_http2()
23739/// # .build()
23740/// # );
23741/// # let mut hub = CloudRun::new(client, auth);
23742/// // You can configure optional parameters by calling the respective setters at will, and
23743/// // execute the final call using `doit()`.
23744/// // Values shown here are possibly random and not representative !
23745/// let result = hub.projects().locations_services_list("parent")
23746/// .watch(false)
23747/// .resource_version("kasd")
23748/// .limit(-95)
23749/// .label_selector("tempor")
23750/// .include_uninitialized(false)
23751/// .field_selector("Lorem")
23752/// .continue_("magna")
23753/// .doit().await;
23754/// # }
23755/// ```
23756pub struct ProjectLocationServiceListCall<'a, C>
23757where
23758 C: 'a,
23759{
23760 hub: &'a CloudRun<C>,
23761 _parent: String,
23762 _watch: Option<bool>,
23763 _resource_version: Option<String>,
23764 _limit: Option<i32>,
23765 _label_selector: Option<String>,
23766 _include_uninitialized: Option<bool>,
23767 _field_selector: Option<String>,
23768 _continue_: Option<String>,
23769 _delegate: Option<&'a mut dyn common::Delegate>,
23770 _additional_params: HashMap<String, String>,
23771 _scopes: BTreeSet<String>,
23772}
23773
23774impl<'a, C> common::CallBuilder for ProjectLocationServiceListCall<'a, C> {}
23775
23776impl<'a, C> ProjectLocationServiceListCall<'a, C>
23777where
23778 C: common::Connector,
23779{
23780 /// Perform the operation you have build so far.
23781 pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
23782 use std::borrow::Cow;
23783 use std::io::{Read, Seek};
23784
23785 use common::{url::Params, ToParts};
23786 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23787
23788 let mut dd = common::DefaultDelegate;
23789 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23790 dlg.begin(common::MethodInfo {
23791 id: "run.projects.locations.services.list",
23792 http_method: hyper::Method::GET,
23793 });
23794
23795 for &field in [
23796 "alt",
23797 "parent",
23798 "watch",
23799 "resourceVersion",
23800 "limit",
23801 "labelSelector",
23802 "includeUninitialized",
23803 "fieldSelector",
23804 "continue",
23805 ]
23806 .iter()
23807 {
23808 if self._additional_params.contains_key(field) {
23809 dlg.finished(false);
23810 return Err(common::Error::FieldClash(field));
23811 }
23812 }
23813
23814 let mut params = Params::with_capacity(10 + self._additional_params.len());
23815 params.push("parent", self._parent);
23816 if let Some(value) = self._watch.as_ref() {
23817 params.push("watch", value.to_string());
23818 }
23819 if let Some(value) = self._resource_version.as_ref() {
23820 params.push("resourceVersion", value);
23821 }
23822 if let Some(value) = self._limit.as_ref() {
23823 params.push("limit", value.to_string());
23824 }
23825 if let Some(value) = self._label_selector.as_ref() {
23826 params.push("labelSelector", value);
23827 }
23828 if let Some(value) = self._include_uninitialized.as_ref() {
23829 params.push("includeUninitialized", value.to_string());
23830 }
23831 if let Some(value) = self._field_selector.as_ref() {
23832 params.push("fieldSelector", value);
23833 }
23834 if let Some(value) = self._continue_.as_ref() {
23835 params.push("continue", value);
23836 }
23837
23838 params.extend(self._additional_params.iter());
23839
23840 params.push("alt", "json");
23841 let mut url = self.hub._base_url.clone() + "v1/{+parent}/services";
23842 if self._scopes.is_empty() {
23843 self._scopes
23844 .insert(Scope::CloudPlatform.as_ref().to_string());
23845 }
23846
23847 #[allow(clippy::single_element_loop)]
23848 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23849 url = params.uri_replacement(url, param_name, find_this, true);
23850 }
23851 {
23852 let to_remove = ["parent"];
23853 params.remove_params(&to_remove);
23854 }
23855
23856 let url = params.parse_with_url(&url);
23857
23858 loop {
23859 let token = match self
23860 .hub
23861 .auth
23862 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23863 .await
23864 {
23865 Ok(token) => token,
23866 Err(e) => match dlg.token(e) {
23867 Ok(token) => token,
23868 Err(e) => {
23869 dlg.finished(false);
23870 return Err(common::Error::MissingToken(e));
23871 }
23872 },
23873 };
23874 let mut req_result = {
23875 let client = &self.hub.client;
23876 dlg.pre_request();
23877 let mut req_builder = hyper::Request::builder()
23878 .method(hyper::Method::GET)
23879 .uri(url.as_str())
23880 .header(USER_AGENT, self.hub._user_agent.clone());
23881
23882 if let Some(token) = token.as_ref() {
23883 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23884 }
23885
23886 let request = req_builder
23887 .header(CONTENT_LENGTH, 0_u64)
23888 .body(common::to_body::<String>(None));
23889
23890 client.request(request.unwrap()).await
23891 };
23892
23893 match req_result {
23894 Err(err) => {
23895 if let common::Retry::After(d) = dlg.http_error(&err) {
23896 sleep(d).await;
23897 continue;
23898 }
23899 dlg.finished(false);
23900 return Err(common::Error::HttpError(err));
23901 }
23902 Ok(res) => {
23903 let (mut parts, body) = res.into_parts();
23904 let mut body = common::Body::new(body);
23905 if !parts.status.is_success() {
23906 let bytes = common::to_bytes(body).await.unwrap_or_default();
23907 let error = serde_json::from_str(&common::to_string(&bytes));
23908 let response = common::to_response(parts, bytes.into());
23909
23910 if let common::Retry::After(d) =
23911 dlg.http_failure(&response, error.as_ref().ok())
23912 {
23913 sleep(d).await;
23914 continue;
23915 }
23916
23917 dlg.finished(false);
23918
23919 return Err(match error {
23920 Ok(value) => common::Error::BadRequest(value),
23921 _ => common::Error::Failure(response),
23922 });
23923 }
23924 let response = {
23925 let bytes = common::to_bytes(body).await.unwrap_or_default();
23926 let encoded = common::to_string(&bytes);
23927 match serde_json::from_str(&encoded) {
23928 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23929 Err(error) => {
23930 dlg.response_json_decode_error(&encoded, &error);
23931 return Err(common::Error::JsonDecodeError(
23932 encoded.to_string(),
23933 error,
23934 ));
23935 }
23936 }
23937 };
23938
23939 dlg.finished(true);
23940 return Ok(response);
23941 }
23942 }
23943 }
23944 }
23945
23946 /// 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}`
23947 ///
23948 /// Sets the *parent* path property to the given value.
23949 ///
23950 /// Even though the property as already been set when instantiating this call,
23951 /// we provide this method for API completeness.
23952 pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
23953 self._parent = new_value.to_string();
23954 self
23955 }
23956 /// Not supported, and ignored by Cloud Run.
23957 ///
23958 /// Sets the *watch* query property to the given value.
23959 pub fn watch(mut self, new_value: bool) -> ProjectLocationServiceListCall<'a, C> {
23960 self._watch = Some(new_value);
23961 self
23962 }
23963 /// Not supported, and ignored by Cloud Run.
23964 ///
23965 /// Sets the *resource version* query property to the given value.
23966 pub fn resource_version(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
23967 self._resource_version = Some(new_value.to_string());
23968 self
23969 }
23970 /// The maximum number of records that should be returned.
23971 ///
23972 /// Sets the *limit* query property to the given value.
23973 pub fn limit(mut self, new_value: i32) -> ProjectLocationServiceListCall<'a, C> {
23974 self._limit = Some(new_value);
23975 self
23976 }
23977 /// Allows to filter resources based on a label. Supported operations are =, !=, exists, in, and notIn.
23978 ///
23979 /// Sets the *label selector* query property to the given value.
23980 pub fn label_selector(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
23981 self._label_selector = Some(new_value.to_string());
23982 self
23983 }
23984 /// Not supported, and ignored by Cloud Run.
23985 ///
23986 /// Sets the *include uninitialized* query property to the given value.
23987 pub fn include_uninitialized(
23988 mut self,
23989 new_value: bool,
23990 ) -> ProjectLocationServiceListCall<'a, C> {
23991 self._include_uninitialized = Some(new_value);
23992 self
23993 }
23994 /// Not supported, and ignored by Cloud Run.
23995 ///
23996 /// Sets the *field selector* query property to the given value.
23997 pub fn field_selector(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
23998 self._field_selector = Some(new_value.to_string());
23999 self
24000 }
24001 /// Encoded string to continue paging.
24002 ///
24003 /// Sets the *continue* query property to the given value.
24004 pub fn continue_(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
24005 self._continue_ = Some(new_value.to_string());
24006 self
24007 }
24008 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24009 /// while executing the actual API request.
24010 ///
24011 /// ````text
24012 /// It should be used to handle progress information, and to implement a certain level of resilience.
24013 /// ````
24014 ///
24015 /// Sets the *delegate* property to the given value.
24016 pub fn delegate(
24017 mut self,
24018 new_value: &'a mut dyn common::Delegate,
24019 ) -> ProjectLocationServiceListCall<'a, C> {
24020 self._delegate = Some(new_value);
24021 self
24022 }
24023
24024 /// Set any additional parameter of the query string used in the request.
24025 /// It should be used to set parameters which are not yet available through their own
24026 /// setters.
24027 ///
24028 /// Please note that this method must not be used to set any of the known parameters
24029 /// which have their own setter method. If done anyway, the request will fail.
24030 ///
24031 /// # Additional Parameters
24032 ///
24033 /// * *$.xgafv* (query-string) - V1 error format.
24034 /// * *access_token* (query-string) - OAuth access token.
24035 /// * *alt* (query-string) - Data format for response.
24036 /// * *callback* (query-string) - JSONP
24037 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24038 /// * *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.
24039 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24040 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24041 /// * *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.
24042 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24043 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24044 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceListCall<'a, C>
24045 where
24046 T: AsRef<str>,
24047 {
24048 self._additional_params
24049 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24050 self
24051 }
24052
24053 /// Identifies the authorization scope for the method you are building.
24054 ///
24055 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24056 /// [`Scope::CloudPlatform`].
24057 ///
24058 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24059 /// tokens for more than one scope.
24060 ///
24061 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24062 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24063 /// sufficient, a read-write scope will do as well.
24064 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceListCall<'a, C>
24065 where
24066 St: AsRef<str>,
24067 {
24068 self._scopes.insert(String::from(scope.as_ref()));
24069 self
24070 }
24071 /// Identifies the authorization scope(s) for the method you are building.
24072 ///
24073 /// See [`Self::add_scope()`] for details.
24074 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceListCall<'a, C>
24075 where
24076 I: IntoIterator<Item = St>,
24077 St: AsRef<str>,
24078 {
24079 self._scopes
24080 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24081 self
24082 }
24083
24084 /// Removes all scopes, and no default scope will be used either.
24085 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24086 /// for details).
24087 pub fn clear_scopes(mut self) -> ProjectLocationServiceListCall<'a, C> {
24088 self._scopes.clear();
24089 self
24090 }
24091}
24092
24093/// 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.
24094///
24095/// A builder for the *locations.services.replaceService* method supported by a *project* resource.
24096/// It is not used directly, but through a [`ProjectMethods`] instance.
24097///
24098/// # Example
24099///
24100/// Instantiate a resource method builder
24101///
24102/// ```test_harness,no_run
24103/// # extern crate hyper;
24104/// # extern crate hyper_rustls;
24105/// # extern crate google_run1 as run1;
24106/// use run1::api::Service;
24107/// # async fn dox() {
24108/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24109///
24110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24111/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24112/// # .with_native_roots()
24113/// # .unwrap()
24114/// # .https_only()
24115/// # .enable_http2()
24116/// # .build();
24117///
24118/// # let executor = hyper_util::rt::TokioExecutor::new();
24119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24120/// # secret,
24121/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24122/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24123/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24124/// # ),
24125/// # ).build().await.unwrap();
24126///
24127/// # let client = hyper_util::client::legacy::Client::builder(
24128/// # hyper_util::rt::TokioExecutor::new()
24129/// # )
24130/// # .build(
24131/// # hyper_rustls::HttpsConnectorBuilder::new()
24132/// # .with_native_roots()
24133/// # .unwrap()
24134/// # .https_or_http()
24135/// # .enable_http2()
24136/// # .build()
24137/// # );
24138/// # let mut hub = CloudRun::new(client, auth);
24139/// // As the method needs a request, you would usually fill it with the desired information
24140/// // into the respective structure. Some of the parts shown here might not be applicable !
24141/// // Values shown here are possibly random and not representative !
24142/// let mut req = Service::default();
24143///
24144/// // You can configure optional parameters by calling the respective setters at will, and
24145/// // execute the final call using `doit()`.
24146/// // Values shown here are possibly random and not representative !
24147/// let result = hub.projects().locations_services_replace_service(req, "name")
24148/// .dry_run("rebum.")
24149/// .doit().await;
24150/// # }
24151/// ```
24152pub struct ProjectLocationServiceReplaceServiceCall<'a, C>
24153where
24154 C: 'a,
24155{
24156 hub: &'a CloudRun<C>,
24157 _request: Service,
24158 _name: String,
24159 _dry_run: Option<String>,
24160 _delegate: Option<&'a mut dyn common::Delegate>,
24161 _additional_params: HashMap<String, String>,
24162 _scopes: BTreeSet<String>,
24163}
24164
24165impl<'a, C> common::CallBuilder for ProjectLocationServiceReplaceServiceCall<'a, C> {}
24166
24167impl<'a, C> ProjectLocationServiceReplaceServiceCall<'a, C>
24168where
24169 C: common::Connector,
24170{
24171 /// Perform the operation you have build so far.
24172 pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
24173 use std::borrow::Cow;
24174 use std::io::{Read, Seek};
24175
24176 use common::{url::Params, ToParts};
24177 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24178
24179 let mut dd = common::DefaultDelegate;
24180 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24181 dlg.begin(common::MethodInfo {
24182 id: "run.projects.locations.services.replaceService",
24183 http_method: hyper::Method::PUT,
24184 });
24185
24186 for &field in ["alt", "name", "dryRun"].iter() {
24187 if self._additional_params.contains_key(field) {
24188 dlg.finished(false);
24189 return Err(common::Error::FieldClash(field));
24190 }
24191 }
24192
24193 let mut params = Params::with_capacity(5 + self._additional_params.len());
24194 params.push("name", self._name);
24195 if let Some(value) = self._dry_run.as_ref() {
24196 params.push("dryRun", value);
24197 }
24198
24199 params.extend(self._additional_params.iter());
24200
24201 params.push("alt", "json");
24202 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24203 if self._scopes.is_empty() {
24204 self._scopes
24205 .insert(Scope::CloudPlatform.as_ref().to_string());
24206 }
24207
24208 #[allow(clippy::single_element_loop)]
24209 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24210 url = params.uri_replacement(url, param_name, find_this, true);
24211 }
24212 {
24213 let to_remove = ["name"];
24214 params.remove_params(&to_remove);
24215 }
24216
24217 let url = params.parse_with_url(&url);
24218
24219 let mut json_mime_type = mime::APPLICATION_JSON;
24220 let mut request_value_reader = {
24221 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24222 common::remove_json_null_values(&mut value);
24223 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24224 serde_json::to_writer(&mut dst, &value).unwrap();
24225 dst
24226 };
24227 let request_size = request_value_reader
24228 .seek(std::io::SeekFrom::End(0))
24229 .unwrap();
24230 request_value_reader
24231 .seek(std::io::SeekFrom::Start(0))
24232 .unwrap();
24233
24234 loop {
24235 let token = match self
24236 .hub
24237 .auth
24238 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24239 .await
24240 {
24241 Ok(token) => token,
24242 Err(e) => match dlg.token(e) {
24243 Ok(token) => token,
24244 Err(e) => {
24245 dlg.finished(false);
24246 return Err(common::Error::MissingToken(e));
24247 }
24248 },
24249 };
24250 request_value_reader
24251 .seek(std::io::SeekFrom::Start(0))
24252 .unwrap();
24253 let mut req_result = {
24254 let client = &self.hub.client;
24255 dlg.pre_request();
24256 let mut req_builder = hyper::Request::builder()
24257 .method(hyper::Method::PUT)
24258 .uri(url.as_str())
24259 .header(USER_AGENT, self.hub._user_agent.clone());
24260
24261 if let Some(token) = token.as_ref() {
24262 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24263 }
24264
24265 let request = req_builder
24266 .header(CONTENT_TYPE, json_mime_type.to_string())
24267 .header(CONTENT_LENGTH, request_size as u64)
24268 .body(common::to_body(
24269 request_value_reader.get_ref().clone().into(),
24270 ));
24271
24272 client.request(request.unwrap()).await
24273 };
24274
24275 match req_result {
24276 Err(err) => {
24277 if let common::Retry::After(d) = dlg.http_error(&err) {
24278 sleep(d).await;
24279 continue;
24280 }
24281 dlg.finished(false);
24282 return Err(common::Error::HttpError(err));
24283 }
24284 Ok(res) => {
24285 let (mut parts, body) = res.into_parts();
24286 let mut body = common::Body::new(body);
24287 if !parts.status.is_success() {
24288 let bytes = common::to_bytes(body).await.unwrap_or_default();
24289 let error = serde_json::from_str(&common::to_string(&bytes));
24290 let response = common::to_response(parts, bytes.into());
24291
24292 if let common::Retry::After(d) =
24293 dlg.http_failure(&response, error.as_ref().ok())
24294 {
24295 sleep(d).await;
24296 continue;
24297 }
24298
24299 dlg.finished(false);
24300
24301 return Err(match error {
24302 Ok(value) => common::Error::BadRequest(value),
24303 _ => common::Error::Failure(response),
24304 });
24305 }
24306 let response = {
24307 let bytes = common::to_bytes(body).await.unwrap_or_default();
24308 let encoded = common::to_string(&bytes);
24309 match serde_json::from_str(&encoded) {
24310 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24311 Err(error) => {
24312 dlg.response_json_decode_error(&encoded, &error);
24313 return Err(common::Error::JsonDecodeError(
24314 encoded.to_string(),
24315 error,
24316 ));
24317 }
24318 }
24319 };
24320
24321 dlg.finished(true);
24322 return Ok(response);
24323 }
24324 }
24325 }
24326 }
24327
24328 ///
24329 /// Sets the *request* property to the given value.
24330 ///
24331 /// Even though the property as already been set when instantiating this call,
24332 /// we provide this method for API completeness.
24333 pub fn request(
24334 mut self,
24335 new_value: Service,
24336 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
24337 self._request = new_value;
24338 self
24339 }
24340 /// 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}`
24341 ///
24342 /// Sets the *name* path property to the given value.
24343 ///
24344 /// Even though the property as already been set when instantiating this call,
24345 /// we provide this method for API completeness.
24346 pub fn name(mut self, new_value: &str) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
24347 self._name = new_value.to_string();
24348 self
24349 }
24350 /// Indicates that the server should validate the request and populate default values without persisting the request. Supported values: `all`
24351 ///
24352 /// Sets the *dry run* query property to the given value.
24353 pub fn dry_run(mut self, new_value: &str) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
24354 self._dry_run = Some(new_value.to_string());
24355 self
24356 }
24357 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24358 /// while executing the actual API request.
24359 ///
24360 /// ````text
24361 /// It should be used to handle progress information, and to implement a certain level of resilience.
24362 /// ````
24363 ///
24364 /// Sets the *delegate* property to the given value.
24365 pub fn delegate(
24366 mut self,
24367 new_value: &'a mut dyn common::Delegate,
24368 ) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
24369 self._delegate = Some(new_value);
24370 self
24371 }
24372
24373 /// Set any additional parameter of the query string used in the request.
24374 /// It should be used to set parameters which are not yet available through their own
24375 /// setters.
24376 ///
24377 /// Please note that this method must not be used to set any of the known parameters
24378 /// which have their own setter method. If done anyway, the request will fail.
24379 ///
24380 /// # Additional Parameters
24381 ///
24382 /// * *$.xgafv* (query-string) - V1 error format.
24383 /// * *access_token* (query-string) - OAuth access token.
24384 /// * *alt* (query-string) - Data format for response.
24385 /// * *callback* (query-string) - JSONP
24386 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24387 /// * *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.
24388 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24389 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24390 /// * *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.
24391 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24392 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24393 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceReplaceServiceCall<'a, C>
24394 where
24395 T: AsRef<str>,
24396 {
24397 self._additional_params
24398 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24399 self
24400 }
24401
24402 /// Identifies the authorization scope for the method you are building.
24403 ///
24404 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24405 /// [`Scope::CloudPlatform`].
24406 ///
24407 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24408 /// tokens for more than one scope.
24409 ///
24410 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24411 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24412 /// sufficient, a read-write scope will do as well.
24413 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceReplaceServiceCall<'a, C>
24414 where
24415 St: AsRef<str>,
24416 {
24417 self._scopes.insert(String::from(scope.as_ref()));
24418 self
24419 }
24420 /// Identifies the authorization scope(s) for the method you are building.
24421 ///
24422 /// See [`Self::add_scope()`] for details.
24423 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceReplaceServiceCall<'a, C>
24424 where
24425 I: IntoIterator<Item = St>,
24426 St: AsRef<str>,
24427 {
24428 self._scopes
24429 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24430 self
24431 }
24432
24433 /// Removes all scopes, and no default scope will be used either.
24434 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24435 /// for details).
24436 pub fn clear_scopes(mut self) -> ProjectLocationServiceReplaceServiceCall<'a, C> {
24437 self._scopes.clear();
24438 self
24439 }
24440}
24441
24442/// Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
24443///
24444/// A builder for the *locations.services.setIamPolicy* method supported by a *project* resource.
24445/// It is not used directly, but through a [`ProjectMethods`] instance.
24446///
24447/// # Example
24448///
24449/// Instantiate a resource method builder
24450///
24451/// ```test_harness,no_run
24452/// # extern crate hyper;
24453/// # extern crate hyper_rustls;
24454/// # extern crate google_run1 as run1;
24455/// use run1::api::SetIamPolicyRequest;
24456/// # async fn dox() {
24457/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24458///
24459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24460/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24461/// # .with_native_roots()
24462/// # .unwrap()
24463/// # .https_only()
24464/// # .enable_http2()
24465/// # .build();
24466///
24467/// # let executor = hyper_util::rt::TokioExecutor::new();
24468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24469/// # secret,
24470/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24471/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24472/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24473/// # ),
24474/// # ).build().await.unwrap();
24475///
24476/// # let client = hyper_util::client::legacy::Client::builder(
24477/// # hyper_util::rt::TokioExecutor::new()
24478/// # )
24479/// # .build(
24480/// # hyper_rustls::HttpsConnectorBuilder::new()
24481/// # .with_native_roots()
24482/// # .unwrap()
24483/// # .https_or_http()
24484/// # .enable_http2()
24485/// # .build()
24486/// # );
24487/// # let mut hub = CloudRun::new(client, auth);
24488/// // As the method needs a request, you would usually fill it with the desired information
24489/// // into the respective structure. Some of the parts shown here might not be applicable !
24490/// // Values shown here are possibly random and not representative !
24491/// let mut req = SetIamPolicyRequest::default();
24492///
24493/// // You can configure optional parameters by calling the respective setters at will, and
24494/// // execute the final call using `doit()`.
24495/// // Values shown here are possibly random and not representative !
24496/// let result = hub.projects().locations_services_set_iam_policy(req, "resource")
24497/// .doit().await;
24498/// # }
24499/// ```
24500pub struct ProjectLocationServiceSetIamPolicyCall<'a, C>
24501where
24502 C: 'a,
24503{
24504 hub: &'a CloudRun<C>,
24505 _request: SetIamPolicyRequest,
24506 _resource: String,
24507 _delegate: Option<&'a mut dyn common::Delegate>,
24508 _additional_params: HashMap<String, String>,
24509 _scopes: BTreeSet<String>,
24510}
24511
24512impl<'a, C> common::CallBuilder for ProjectLocationServiceSetIamPolicyCall<'a, C> {}
24513
24514impl<'a, C> ProjectLocationServiceSetIamPolicyCall<'a, C>
24515where
24516 C: common::Connector,
24517{
24518 /// Perform the operation you have build so far.
24519 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
24520 use std::borrow::Cow;
24521 use std::io::{Read, Seek};
24522
24523 use common::{url::Params, ToParts};
24524 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24525
24526 let mut dd = common::DefaultDelegate;
24527 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24528 dlg.begin(common::MethodInfo {
24529 id: "run.projects.locations.services.setIamPolicy",
24530 http_method: hyper::Method::POST,
24531 });
24532
24533 for &field in ["alt", "resource"].iter() {
24534 if self._additional_params.contains_key(field) {
24535 dlg.finished(false);
24536 return Err(common::Error::FieldClash(field));
24537 }
24538 }
24539
24540 let mut params = Params::with_capacity(4 + self._additional_params.len());
24541 params.push("resource", self._resource);
24542
24543 params.extend(self._additional_params.iter());
24544
24545 params.push("alt", "json");
24546 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
24547 if self._scopes.is_empty() {
24548 self._scopes
24549 .insert(Scope::CloudPlatform.as_ref().to_string());
24550 }
24551
24552 #[allow(clippy::single_element_loop)]
24553 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24554 url = params.uri_replacement(url, param_name, find_this, true);
24555 }
24556 {
24557 let to_remove = ["resource"];
24558 params.remove_params(&to_remove);
24559 }
24560
24561 let url = params.parse_with_url(&url);
24562
24563 let mut json_mime_type = mime::APPLICATION_JSON;
24564 let mut request_value_reader = {
24565 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24566 common::remove_json_null_values(&mut value);
24567 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24568 serde_json::to_writer(&mut dst, &value).unwrap();
24569 dst
24570 };
24571 let request_size = request_value_reader
24572 .seek(std::io::SeekFrom::End(0))
24573 .unwrap();
24574 request_value_reader
24575 .seek(std::io::SeekFrom::Start(0))
24576 .unwrap();
24577
24578 loop {
24579 let token = match self
24580 .hub
24581 .auth
24582 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24583 .await
24584 {
24585 Ok(token) => token,
24586 Err(e) => match dlg.token(e) {
24587 Ok(token) => token,
24588 Err(e) => {
24589 dlg.finished(false);
24590 return Err(common::Error::MissingToken(e));
24591 }
24592 },
24593 };
24594 request_value_reader
24595 .seek(std::io::SeekFrom::Start(0))
24596 .unwrap();
24597 let mut req_result = {
24598 let client = &self.hub.client;
24599 dlg.pre_request();
24600 let mut req_builder = hyper::Request::builder()
24601 .method(hyper::Method::POST)
24602 .uri(url.as_str())
24603 .header(USER_AGENT, self.hub._user_agent.clone());
24604
24605 if let Some(token) = token.as_ref() {
24606 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24607 }
24608
24609 let request = req_builder
24610 .header(CONTENT_TYPE, json_mime_type.to_string())
24611 .header(CONTENT_LENGTH, request_size as u64)
24612 .body(common::to_body(
24613 request_value_reader.get_ref().clone().into(),
24614 ));
24615
24616 client.request(request.unwrap()).await
24617 };
24618
24619 match req_result {
24620 Err(err) => {
24621 if let common::Retry::After(d) = dlg.http_error(&err) {
24622 sleep(d).await;
24623 continue;
24624 }
24625 dlg.finished(false);
24626 return Err(common::Error::HttpError(err));
24627 }
24628 Ok(res) => {
24629 let (mut parts, body) = res.into_parts();
24630 let mut body = common::Body::new(body);
24631 if !parts.status.is_success() {
24632 let bytes = common::to_bytes(body).await.unwrap_or_default();
24633 let error = serde_json::from_str(&common::to_string(&bytes));
24634 let response = common::to_response(parts, bytes.into());
24635
24636 if let common::Retry::After(d) =
24637 dlg.http_failure(&response, error.as_ref().ok())
24638 {
24639 sleep(d).await;
24640 continue;
24641 }
24642
24643 dlg.finished(false);
24644
24645 return Err(match error {
24646 Ok(value) => common::Error::BadRequest(value),
24647 _ => common::Error::Failure(response),
24648 });
24649 }
24650 let response = {
24651 let bytes = common::to_bytes(body).await.unwrap_or_default();
24652 let encoded = common::to_string(&bytes);
24653 match serde_json::from_str(&encoded) {
24654 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24655 Err(error) => {
24656 dlg.response_json_decode_error(&encoded, &error);
24657 return Err(common::Error::JsonDecodeError(
24658 encoded.to_string(),
24659 error,
24660 ));
24661 }
24662 }
24663 };
24664
24665 dlg.finished(true);
24666 return Ok(response);
24667 }
24668 }
24669 }
24670 }
24671
24672 ///
24673 /// Sets the *request* property to the given value.
24674 ///
24675 /// Even though the property as already been set when instantiating this call,
24676 /// we provide this method for API completeness.
24677 pub fn request(
24678 mut self,
24679 new_value: SetIamPolicyRequest,
24680 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
24681 self._request = new_value;
24682 self
24683 }
24684 /// 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.
24685 ///
24686 /// Sets the *resource* path property to the given value.
24687 ///
24688 /// Even though the property as already been set when instantiating this call,
24689 /// we provide this method for API completeness.
24690 pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
24691 self._resource = new_value.to_string();
24692 self
24693 }
24694 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24695 /// while executing the actual API request.
24696 ///
24697 /// ````text
24698 /// It should be used to handle progress information, and to implement a certain level of resilience.
24699 /// ````
24700 ///
24701 /// Sets the *delegate* property to the given value.
24702 pub fn delegate(
24703 mut self,
24704 new_value: &'a mut dyn common::Delegate,
24705 ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
24706 self._delegate = Some(new_value);
24707 self
24708 }
24709
24710 /// Set any additional parameter of the query string used in the request.
24711 /// It should be used to set parameters which are not yet available through their own
24712 /// setters.
24713 ///
24714 /// Please note that this method must not be used to set any of the known parameters
24715 /// which have their own setter method. If done anyway, the request will fail.
24716 ///
24717 /// # Additional Parameters
24718 ///
24719 /// * *$.xgafv* (query-string) - V1 error format.
24720 /// * *access_token* (query-string) - OAuth access token.
24721 /// * *alt* (query-string) - Data format for response.
24722 /// * *callback* (query-string) - JSONP
24723 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24724 /// * *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.
24725 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24726 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24727 /// * *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.
24728 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24729 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24730 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
24731 where
24732 T: AsRef<str>,
24733 {
24734 self._additional_params
24735 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24736 self
24737 }
24738
24739 /// Identifies the authorization scope for the method you are building.
24740 ///
24741 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24742 /// [`Scope::CloudPlatform`].
24743 ///
24744 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24745 /// tokens for more than one scope.
24746 ///
24747 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24748 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24749 /// sufficient, a read-write scope will do as well.
24750 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
24751 where
24752 St: AsRef<str>,
24753 {
24754 self._scopes.insert(String::from(scope.as_ref()));
24755 self
24756 }
24757 /// Identifies the authorization scope(s) for the method you are building.
24758 ///
24759 /// See [`Self::add_scope()`] for details.
24760 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
24761 where
24762 I: IntoIterator<Item = St>,
24763 St: AsRef<str>,
24764 {
24765 self._scopes
24766 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24767 self
24768 }
24769
24770 /// Removes all scopes, and no default scope will be used either.
24771 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24772 /// for details).
24773 pub fn clear_scopes(mut self) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
24774 self._scopes.clear();
24775 self
24776 }
24777}
24778
24779/// Returns permissions that a caller has on the specified Project. There are no permissions required for making this API call.
24780///
24781/// A builder for the *locations.services.testIamPermissions* method supported by a *project* resource.
24782/// It is not used directly, but through a [`ProjectMethods`] instance.
24783///
24784/// # Example
24785///
24786/// Instantiate a resource method builder
24787///
24788/// ```test_harness,no_run
24789/// # extern crate hyper;
24790/// # extern crate hyper_rustls;
24791/// # extern crate google_run1 as run1;
24792/// use run1::api::TestIamPermissionsRequest;
24793/// # async fn dox() {
24794/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24795///
24796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24797/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24798/// # .with_native_roots()
24799/// # .unwrap()
24800/// # .https_only()
24801/// # .enable_http2()
24802/// # .build();
24803///
24804/// # let executor = hyper_util::rt::TokioExecutor::new();
24805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24806/// # secret,
24807/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24808/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24809/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24810/// # ),
24811/// # ).build().await.unwrap();
24812///
24813/// # let client = hyper_util::client::legacy::Client::builder(
24814/// # hyper_util::rt::TokioExecutor::new()
24815/// # )
24816/// # .build(
24817/// # hyper_rustls::HttpsConnectorBuilder::new()
24818/// # .with_native_roots()
24819/// # .unwrap()
24820/// # .https_or_http()
24821/// # .enable_http2()
24822/// # .build()
24823/// # );
24824/// # let mut hub = CloudRun::new(client, auth);
24825/// // As the method needs a request, you would usually fill it with the desired information
24826/// // into the respective structure. Some of the parts shown here might not be applicable !
24827/// // Values shown here are possibly random and not representative !
24828/// let mut req = TestIamPermissionsRequest::default();
24829///
24830/// // You can configure optional parameters by calling the respective setters at will, and
24831/// // execute the final call using `doit()`.
24832/// // Values shown here are possibly random and not representative !
24833/// let result = hub.projects().locations_services_test_iam_permissions(req, "resource")
24834/// .doit().await;
24835/// # }
24836/// ```
24837pub struct ProjectLocationServiceTestIamPermissionCall<'a, C>
24838where
24839 C: 'a,
24840{
24841 hub: &'a CloudRun<C>,
24842 _request: TestIamPermissionsRequest,
24843 _resource: String,
24844 _delegate: Option<&'a mut dyn common::Delegate>,
24845 _additional_params: HashMap<String, String>,
24846 _scopes: BTreeSet<String>,
24847}
24848
24849impl<'a, C> common::CallBuilder for ProjectLocationServiceTestIamPermissionCall<'a, C> {}
24850
24851impl<'a, C> ProjectLocationServiceTestIamPermissionCall<'a, C>
24852where
24853 C: common::Connector,
24854{
24855 /// Perform the operation you have build so far.
24856 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
24857 use std::borrow::Cow;
24858 use std::io::{Read, Seek};
24859
24860 use common::{url::Params, ToParts};
24861 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24862
24863 let mut dd = common::DefaultDelegate;
24864 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24865 dlg.begin(common::MethodInfo {
24866 id: "run.projects.locations.services.testIamPermissions",
24867 http_method: hyper::Method::POST,
24868 });
24869
24870 for &field in ["alt", "resource"].iter() {
24871 if self._additional_params.contains_key(field) {
24872 dlg.finished(false);
24873 return Err(common::Error::FieldClash(field));
24874 }
24875 }
24876
24877 let mut params = Params::with_capacity(4 + self._additional_params.len());
24878 params.push("resource", self._resource);
24879
24880 params.extend(self._additional_params.iter());
24881
24882 params.push("alt", "json");
24883 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
24884 if self._scopes.is_empty() {
24885 self._scopes
24886 .insert(Scope::CloudPlatform.as_ref().to_string());
24887 }
24888
24889 #[allow(clippy::single_element_loop)]
24890 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24891 url = params.uri_replacement(url, param_name, find_this, true);
24892 }
24893 {
24894 let to_remove = ["resource"];
24895 params.remove_params(&to_remove);
24896 }
24897
24898 let url = params.parse_with_url(&url);
24899
24900 let mut json_mime_type = mime::APPLICATION_JSON;
24901 let mut request_value_reader = {
24902 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24903 common::remove_json_null_values(&mut value);
24904 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24905 serde_json::to_writer(&mut dst, &value).unwrap();
24906 dst
24907 };
24908 let request_size = request_value_reader
24909 .seek(std::io::SeekFrom::End(0))
24910 .unwrap();
24911 request_value_reader
24912 .seek(std::io::SeekFrom::Start(0))
24913 .unwrap();
24914
24915 loop {
24916 let token = match self
24917 .hub
24918 .auth
24919 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24920 .await
24921 {
24922 Ok(token) => token,
24923 Err(e) => match dlg.token(e) {
24924 Ok(token) => token,
24925 Err(e) => {
24926 dlg.finished(false);
24927 return Err(common::Error::MissingToken(e));
24928 }
24929 },
24930 };
24931 request_value_reader
24932 .seek(std::io::SeekFrom::Start(0))
24933 .unwrap();
24934 let mut req_result = {
24935 let client = &self.hub.client;
24936 dlg.pre_request();
24937 let mut req_builder = hyper::Request::builder()
24938 .method(hyper::Method::POST)
24939 .uri(url.as_str())
24940 .header(USER_AGENT, self.hub._user_agent.clone());
24941
24942 if let Some(token) = token.as_ref() {
24943 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24944 }
24945
24946 let request = req_builder
24947 .header(CONTENT_TYPE, json_mime_type.to_string())
24948 .header(CONTENT_LENGTH, request_size as u64)
24949 .body(common::to_body(
24950 request_value_reader.get_ref().clone().into(),
24951 ));
24952
24953 client.request(request.unwrap()).await
24954 };
24955
24956 match req_result {
24957 Err(err) => {
24958 if let common::Retry::After(d) = dlg.http_error(&err) {
24959 sleep(d).await;
24960 continue;
24961 }
24962 dlg.finished(false);
24963 return Err(common::Error::HttpError(err));
24964 }
24965 Ok(res) => {
24966 let (mut parts, body) = res.into_parts();
24967 let mut body = common::Body::new(body);
24968 if !parts.status.is_success() {
24969 let bytes = common::to_bytes(body).await.unwrap_or_default();
24970 let error = serde_json::from_str(&common::to_string(&bytes));
24971 let response = common::to_response(parts, bytes.into());
24972
24973 if let common::Retry::After(d) =
24974 dlg.http_failure(&response, error.as_ref().ok())
24975 {
24976 sleep(d).await;
24977 continue;
24978 }
24979
24980 dlg.finished(false);
24981
24982 return Err(match error {
24983 Ok(value) => common::Error::BadRequest(value),
24984 _ => common::Error::Failure(response),
24985 });
24986 }
24987 let response = {
24988 let bytes = common::to_bytes(body).await.unwrap_or_default();
24989 let encoded = common::to_string(&bytes);
24990 match serde_json::from_str(&encoded) {
24991 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24992 Err(error) => {
24993 dlg.response_json_decode_error(&encoded, &error);
24994 return Err(common::Error::JsonDecodeError(
24995 encoded.to_string(),
24996 error,
24997 ));
24998 }
24999 }
25000 };
25001
25002 dlg.finished(true);
25003 return Ok(response);
25004 }
25005 }
25006 }
25007 }
25008
25009 ///
25010 /// Sets the *request* property to the given value.
25011 ///
25012 /// Even though the property as already been set when instantiating this call,
25013 /// we provide this method for API completeness.
25014 pub fn request(
25015 mut self,
25016 new_value: TestIamPermissionsRequest,
25017 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
25018 self._request = new_value;
25019 self
25020 }
25021 /// 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.
25022 ///
25023 /// Sets the *resource* path property to the given value.
25024 ///
25025 /// Even though the property as already been set when instantiating this call,
25026 /// we provide this method for API completeness.
25027 pub fn resource(
25028 mut self,
25029 new_value: &str,
25030 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
25031 self._resource = new_value.to_string();
25032 self
25033 }
25034 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25035 /// while executing the actual API request.
25036 ///
25037 /// ````text
25038 /// It should be used to handle progress information, and to implement a certain level of resilience.
25039 /// ````
25040 ///
25041 /// Sets the *delegate* property to the given value.
25042 pub fn delegate(
25043 mut self,
25044 new_value: &'a mut dyn common::Delegate,
25045 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
25046 self._delegate = Some(new_value);
25047 self
25048 }
25049
25050 /// Set any additional parameter of the query string used in the request.
25051 /// It should be used to set parameters which are not yet available through their own
25052 /// setters.
25053 ///
25054 /// Please note that this method must not be used to set any of the known parameters
25055 /// which have their own setter method. If done anyway, the request will fail.
25056 ///
25057 /// # Additional Parameters
25058 ///
25059 /// * *$.xgafv* (query-string) - V1 error format.
25060 /// * *access_token* (query-string) - OAuth access token.
25061 /// * *alt* (query-string) - Data format for response.
25062 /// * *callback* (query-string) - JSONP
25063 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25064 /// * *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.
25065 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25066 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25067 /// * *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.
25068 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25069 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25070 pub fn param<T>(
25071 mut self,
25072 name: T,
25073 value: T,
25074 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
25075 where
25076 T: AsRef<str>,
25077 {
25078 self._additional_params
25079 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25080 self
25081 }
25082
25083 /// Identifies the authorization scope for the method you are building.
25084 ///
25085 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25086 /// [`Scope::CloudPlatform`].
25087 ///
25088 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25089 /// tokens for more than one scope.
25090 ///
25091 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25092 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25093 /// sufficient, a read-write scope will do as well.
25094 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
25095 where
25096 St: AsRef<str>,
25097 {
25098 self._scopes.insert(String::from(scope.as_ref()));
25099 self
25100 }
25101 /// Identifies the authorization scope(s) for the method you are building.
25102 ///
25103 /// See [`Self::add_scope()`] for details.
25104 pub fn add_scopes<I, St>(
25105 mut self,
25106 scopes: I,
25107 ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
25108 where
25109 I: IntoIterator<Item = St>,
25110 St: AsRef<str>,
25111 {
25112 self._scopes
25113 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25114 self
25115 }
25116
25117 /// Removes all scopes, and no default scope will be used either.
25118 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25119 /// for details).
25120 pub fn clear_scopes(mut self) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
25121 self._scopes.clear();
25122 self
25123 }
25124}
25125
25126/// Get the IAM Access Control policy currently in effect for the given worker pool. This result does not include any inherited policies.
25127///
25128/// A builder for the *locations.workerpools.getIamPolicy* method supported by a *project* resource.
25129/// It is not used directly, but through a [`ProjectMethods`] instance.
25130///
25131/// # Example
25132///
25133/// Instantiate a resource method builder
25134///
25135/// ```test_harness,no_run
25136/// # extern crate hyper;
25137/// # extern crate hyper_rustls;
25138/// # extern crate google_run1 as run1;
25139/// # async fn dox() {
25140/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25141///
25142/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25143/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25144/// # .with_native_roots()
25145/// # .unwrap()
25146/// # .https_only()
25147/// # .enable_http2()
25148/// # .build();
25149///
25150/// # let executor = hyper_util::rt::TokioExecutor::new();
25151/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25152/// # secret,
25153/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25154/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25155/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25156/// # ),
25157/// # ).build().await.unwrap();
25158///
25159/// # let client = hyper_util::client::legacy::Client::builder(
25160/// # hyper_util::rt::TokioExecutor::new()
25161/// # )
25162/// # .build(
25163/// # hyper_rustls::HttpsConnectorBuilder::new()
25164/// # .with_native_roots()
25165/// # .unwrap()
25166/// # .https_or_http()
25167/// # .enable_http2()
25168/// # .build()
25169/// # );
25170/// # let mut hub = CloudRun::new(client, auth);
25171/// // You can configure optional parameters by calling the respective setters at will, and
25172/// // execute the final call using `doit()`.
25173/// // Values shown here are possibly random and not representative !
25174/// let result = hub.projects().locations_workerpools_get_iam_policy("resource")
25175/// .options_requested_policy_version(-15)
25176/// .doit().await;
25177/// # }
25178/// ```
25179pub struct ProjectLocationWorkerpoolGetIamPolicyCall<'a, C>
25180where
25181 C: 'a,
25182{
25183 hub: &'a CloudRun<C>,
25184 _resource: String,
25185 _options_requested_policy_version: Option<i32>,
25186 _delegate: Option<&'a mut dyn common::Delegate>,
25187 _additional_params: HashMap<String, String>,
25188 _scopes: BTreeSet<String>,
25189}
25190
25191impl<'a, C> common::CallBuilder for ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {}
25192
25193impl<'a, C> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C>
25194where
25195 C: common::Connector,
25196{
25197 /// Perform the operation you have build so far.
25198 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
25199 use std::borrow::Cow;
25200 use std::io::{Read, Seek};
25201
25202 use common::{url::Params, ToParts};
25203 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25204
25205 let mut dd = common::DefaultDelegate;
25206 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25207 dlg.begin(common::MethodInfo {
25208 id: "run.projects.locations.workerpools.getIamPolicy",
25209 http_method: hyper::Method::GET,
25210 });
25211
25212 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
25213 if self._additional_params.contains_key(field) {
25214 dlg.finished(false);
25215 return Err(common::Error::FieldClash(field));
25216 }
25217 }
25218
25219 let mut params = Params::with_capacity(4 + self._additional_params.len());
25220 params.push("resource", self._resource);
25221 if let Some(value) = self._options_requested_policy_version.as_ref() {
25222 params.push("options.requestedPolicyVersion", value.to_string());
25223 }
25224
25225 params.extend(self._additional_params.iter());
25226
25227 params.push("alt", "json");
25228 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
25229 if self._scopes.is_empty() {
25230 self._scopes
25231 .insert(Scope::CloudPlatform.as_ref().to_string());
25232 }
25233
25234 #[allow(clippy::single_element_loop)]
25235 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25236 url = params.uri_replacement(url, param_name, find_this, true);
25237 }
25238 {
25239 let to_remove = ["resource"];
25240 params.remove_params(&to_remove);
25241 }
25242
25243 let url = params.parse_with_url(&url);
25244
25245 loop {
25246 let token = match self
25247 .hub
25248 .auth
25249 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25250 .await
25251 {
25252 Ok(token) => token,
25253 Err(e) => match dlg.token(e) {
25254 Ok(token) => token,
25255 Err(e) => {
25256 dlg.finished(false);
25257 return Err(common::Error::MissingToken(e));
25258 }
25259 },
25260 };
25261 let mut req_result = {
25262 let client = &self.hub.client;
25263 dlg.pre_request();
25264 let mut req_builder = hyper::Request::builder()
25265 .method(hyper::Method::GET)
25266 .uri(url.as_str())
25267 .header(USER_AGENT, self.hub._user_agent.clone());
25268
25269 if let Some(token) = token.as_ref() {
25270 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25271 }
25272
25273 let request = req_builder
25274 .header(CONTENT_LENGTH, 0_u64)
25275 .body(common::to_body::<String>(None));
25276
25277 client.request(request.unwrap()).await
25278 };
25279
25280 match req_result {
25281 Err(err) => {
25282 if let common::Retry::After(d) = dlg.http_error(&err) {
25283 sleep(d).await;
25284 continue;
25285 }
25286 dlg.finished(false);
25287 return Err(common::Error::HttpError(err));
25288 }
25289 Ok(res) => {
25290 let (mut parts, body) = res.into_parts();
25291 let mut body = common::Body::new(body);
25292 if !parts.status.is_success() {
25293 let bytes = common::to_bytes(body).await.unwrap_or_default();
25294 let error = serde_json::from_str(&common::to_string(&bytes));
25295 let response = common::to_response(parts, bytes.into());
25296
25297 if let common::Retry::After(d) =
25298 dlg.http_failure(&response, error.as_ref().ok())
25299 {
25300 sleep(d).await;
25301 continue;
25302 }
25303
25304 dlg.finished(false);
25305
25306 return Err(match error {
25307 Ok(value) => common::Error::BadRequest(value),
25308 _ => common::Error::Failure(response),
25309 });
25310 }
25311 let response = {
25312 let bytes = common::to_bytes(body).await.unwrap_or_default();
25313 let encoded = common::to_string(&bytes);
25314 match serde_json::from_str(&encoded) {
25315 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25316 Err(error) => {
25317 dlg.response_json_decode_error(&encoded, &error);
25318 return Err(common::Error::JsonDecodeError(
25319 encoded.to_string(),
25320 error,
25321 ));
25322 }
25323 }
25324 };
25325
25326 dlg.finished(true);
25327 return Ok(response);
25328 }
25329 }
25330 }
25331 }
25332
25333 /// 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.
25334 ///
25335 /// Sets the *resource* path property to the given value.
25336 ///
25337 /// Even though the property as already been set when instantiating this call,
25338 /// we provide this method for API completeness.
25339 pub fn resource(mut self, new_value: &str) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {
25340 self._resource = new_value.to_string();
25341 self
25342 }
25343 /// 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).
25344 ///
25345 /// Sets the *options.requested policy version* query property to the given value.
25346 pub fn options_requested_policy_version(
25347 mut self,
25348 new_value: i32,
25349 ) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {
25350 self._options_requested_policy_version = Some(new_value);
25351 self
25352 }
25353 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25354 /// while executing the actual API request.
25355 ///
25356 /// ````text
25357 /// It should be used to handle progress information, and to implement a certain level of resilience.
25358 /// ````
25359 ///
25360 /// Sets the *delegate* property to the given value.
25361 pub fn delegate(
25362 mut self,
25363 new_value: &'a mut dyn common::Delegate,
25364 ) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {
25365 self._delegate = Some(new_value);
25366 self
25367 }
25368
25369 /// Set any additional parameter of the query string used in the request.
25370 /// It should be used to set parameters which are not yet available through their own
25371 /// setters.
25372 ///
25373 /// Please note that this method must not be used to set any of the known parameters
25374 /// which have their own setter method. If done anyway, the request will fail.
25375 ///
25376 /// # Additional Parameters
25377 ///
25378 /// * *$.xgafv* (query-string) - V1 error format.
25379 /// * *access_token* (query-string) - OAuth access token.
25380 /// * *alt* (query-string) - Data format for response.
25381 /// * *callback* (query-string) - JSONP
25382 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25383 /// * *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.
25384 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25385 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25386 /// * *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.
25387 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25388 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25389 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C>
25390 where
25391 T: AsRef<str>,
25392 {
25393 self._additional_params
25394 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25395 self
25396 }
25397
25398 /// Identifies the authorization scope for the method you are building.
25399 ///
25400 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25401 /// [`Scope::CloudPlatform`].
25402 ///
25403 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25404 /// tokens for more than one scope.
25405 ///
25406 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25407 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25408 /// sufficient, a read-write scope will do as well.
25409 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C>
25410 where
25411 St: AsRef<str>,
25412 {
25413 self._scopes.insert(String::from(scope.as_ref()));
25414 self
25415 }
25416 /// Identifies the authorization scope(s) for the method you are building.
25417 ///
25418 /// See [`Self::add_scope()`] for details.
25419 pub fn add_scopes<I, St>(
25420 mut self,
25421 scopes: I,
25422 ) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C>
25423 where
25424 I: IntoIterator<Item = St>,
25425 St: AsRef<str>,
25426 {
25427 self._scopes
25428 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25429 self
25430 }
25431
25432 /// Removes all scopes, and no default scope will be used either.
25433 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25434 /// for details).
25435 pub fn clear_scopes(mut self) -> ProjectLocationWorkerpoolGetIamPolicyCall<'a, C> {
25436 self._scopes.clear();
25437 self
25438 }
25439}
25440
25441/// Sets the IAM Access control policy for the specified worker pool. Overwrites any existing policy.
25442///
25443/// A builder for the *locations.workerpools.setIamPolicy* method supported by a *project* resource.
25444/// It is not used directly, but through a [`ProjectMethods`] instance.
25445///
25446/// # Example
25447///
25448/// Instantiate a resource method builder
25449///
25450/// ```test_harness,no_run
25451/// # extern crate hyper;
25452/// # extern crate hyper_rustls;
25453/// # extern crate google_run1 as run1;
25454/// use run1::api::SetIamPolicyRequest;
25455/// # async fn dox() {
25456/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25457///
25458/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25459/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25460/// # .with_native_roots()
25461/// # .unwrap()
25462/// # .https_only()
25463/// # .enable_http2()
25464/// # .build();
25465///
25466/// # let executor = hyper_util::rt::TokioExecutor::new();
25467/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25468/// # secret,
25469/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25470/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25471/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25472/// # ),
25473/// # ).build().await.unwrap();
25474///
25475/// # let client = hyper_util::client::legacy::Client::builder(
25476/// # hyper_util::rt::TokioExecutor::new()
25477/// # )
25478/// # .build(
25479/// # hyper_rustls::HttpsConnectorBuilder::new()
25480/// # .with_native_roots()
25481/// # .unwrap()
25482/// # .https_or_http()
25483/// # .enable_http2()
25484/// # .build()
25485/// # );
25486/// # let mut hub = CloudRun::new(client, auth);
25487/// // As the method needs a request, you would usually fill it with the desired information
25488/// // into the respective structure. Some of the parts shown here might not be applicable !
25489/// // Values shown here are possibly random and not representative !
25490/// let mut req = SetIamPolicyRequest::default();
25491///
25492/// // You can configure optional parameters by calling the respective setters at will, and
25493/// // execute the final call using `doit()`.
25494/// // Values shown here are possibly random and not representative !
25495/// let result = hub.projects().locations_workerpools_set_iam_policy(req, "resource")
25496/// .doit().await;
25497/// # }
25498/// ```
25499pub struct ProjectLocationWorkerpoolSetIamPolicyCall<'a, C>
25500where
25501 C: 'a,
25502{
25503 hub: &'a CloudRun<C>,
25504 _request: SetIamPolicyRequest,
25505 _resource: String,
25506 _delegate: Option<&'a mut dyn common::Delegate>,
25507 _additional_params: HashMap<String, String>,
25508 _scopes: BTreeSet<String>,
25509}
25510
25511impl<'a, C> common::CallBuilder for ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {}
25512
25513impl<'a, C> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C>
25514where
25515 C: common::Connector,
25516{
25517 /// Perform the operation you have build so far.
25518 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
25519 use std::borrow::Cow;
25520 use std::io::{Read, Seek};
25521
25522 use common::{url::Params, ToParts};
25523 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25524
25525 let mut dd = common::DefaultDelegate;
25526 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25527 dlg.begin(common::MethodInfo {
25528 id: "run.projects.locations.workerpools.setIamPolicy",
25529 http_method: hyper::Method::POST,
25530 });
25531
25532 for &field in ["alt", "resource"].iter() {
25533 if self._additional_params.contains_key(field) {
25534 dlg.finished(false);
25535 return Err(common::Error::FieldClash(field));
25536 }
25537 }
25538
25539 let mut params = Params::with_capacity(4 + self._additional_params.len());
25540 params.push("resource", self._resource);
25541
25542 params.extend(self._additional_params.iter());
25543
25544 params.push("alt", "json");
25545 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
25546 if self._scopes.is_empty() {
25547 self._scopes
25548 .insert(Scope::CloudPlatform.as_ref().to_string());
25549 }
25550
25551 #[allow(clippy::single_element_loop)]
25552 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25553 url = params.uri_replacement(url, param_name, find_this, true);
25554 }
25555 {
25556 let to_remove = ["resource"];
25557 params.remove_params(&to_remove);
25558 }
25559
25560 let url = params.parse_with_url(&url);
25561
25562 let mut json_mime_type = mime::APPLICATION_JSON;
25563 let mut request_value_reader = {
25564 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25565 common::remove_json_null_values(&mut value);
25566 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25567 serde_json::to_writer(&mut dst, &value).unwrap();
25568 dst
25569 };
25570 let request_size = request_value_reader
25571 .seek(std::io::SeekFrom::End(0))
25572 .unwrap();
25573 request_value_reader
25574 .seek(std::io::SeekFrom::Start(0))
25575 .unwrap();
25576
25577 loop {
25578 let token = match self
25579 .hub
25580 .auth
25581 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25582 .await
25583 {
25584 Ok(token) => token,
25585 Err(e) => match dlg.token(e) {
25586 Ok(token) => token,
25587 Err(e) => {
25588 dlg.finished(false);
25589 return Err(common::Error::MissingToken(e));
25590 }
25591 },
25592 };
25593 request_value_reader
25594 .seek(std::io::SeekFrom::Start(0))
25595 .unwrap();
25596 let mut req_result = {
25597 let client = &self.hub.client;
25598 dlg.pre_request();
25599 let mut req_builder = hyper::Request::builder()
25600 .method(hyper::Method::POST)
25601 .uri(url.as_str())
25602 .header(USER_AGENT, self.hub._user_agent.clone());
25603
25604 if let Some(token) = token.as_ref() {
25605 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25606 }
25607
25608 let request = req_builder
25609 .header(CONTENT_TYPE, json_mime_type.to_string())
25610 .header(CONTENT_LENGTH, request_size as u64)
25611 .body(common::to_body(
25612 request_value_reader.get_ref().clone().into(),
25613 ));
25614
25615 client.request(request.unwrap()).await
25616 };
25617
25618 match req_result {
25619 Err(err) => {
25620 if let common::Retry::After(d) = dlg.http_error(&err) {
25621 sleep(d).await;
25622 continue;
25623 }
25624 dlg.finished(false);
25625 return Err(common::Error::HttpError(err));
25626 }
25627 Ok(res) => {
25628 let (mut parts, body) = res.into_parts();
25629 let mut body = common::Body::new(body);
25630 if !parts.status.is_success() {
25631 let bytes = common::to_bytes(body).await.unwrap_or_default();
25632 let error = serde_json::from_str(&common::to_string(&bytes));
25633 let response = common::to_response(parts, bytes.into());
25634
25635 if let common::Retry::After(d) =
25636 dlg.http_failure(&response, error.as_ref().ok())
25637 {
25638 sleep(d).await;
25639 continue;
25640 }
25641
25642 dlg.finished(false);
25643
25644 return Err(match error {
25645 Ok(value) => common::Error::BadRequest(value),
25646 _ => common::Error::Failure(response),
25647 });
25648 }
25649 let response = {
25650 let bytes = common::to_bytes(body).await.unwrap_or_default();
25651 let encoded = common::to_string(&bytes);
25652 match serde_json::from_str(&encoded) {
25653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25654 Err(error) => {
25655 dlg.response_json_decode_error(&encoded, &error);
25656 return Err(common::Error::JsonDecodeError(
25657 encoded.to_string(),
25658 error,
25659 ));
25660 }
25661 }
25662 };
25663
25664 dlg.finished(true);
25665 return Ok(response);
25666 }
25667 }
25668 }
25669 }
25670
25671 ///
25672 /// Sets the *request* property to the given value.
25673 ///
25674 /// Even though the property as already been set when instantiating this call,
25675 /// we provide this method for API completeness.
25676 pub fn request(
25677 mut self,
25678 new_value: SetIamPolicyRequest,
25679 ) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {
25680 self._request = new_value;
25681 self
25682 }
25683 /// 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.
25684 ///
25685 /// Sets the *resource* path property to the given value.
25686 ///
25687 /// Even though the property as already been set when instantiating this call,
25688 /// we provide this method for API completeness.
25689 pub fn resource(mut self, new_value: &str) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {
25690 self._resource = new_value.to_string();
25691 self
25692 }
25693 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25694 /// while executing the actual API request.
25695 ///
25696 /// ````text
25697 /// It should be used to handle progress information, and to implement a certain level of resilience.
25698 /// ````
25699 ///
25700 /// Sets the *delegate* property to the given value.
25701 pub fn delegate(
25702 mut self,
25703 new_value: &'a mut dyn common::Delegate,
25704 ) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {
25705 self._delegate = Some(new_value);
25706 self
25707 }
25708
25709 /// Set any additional parameter of the query string used in the request.
25710 /// It should be used to set parameters which are not yet available through their own
25711 /// setters.
25712 ///
25713 /// Please note that this method must not be used to set any of the known parameters
25714 /// which have their own setter method. If done anyway, the request will fail.
25715 ///
25716 /// # Additional Parameters
25717 ///
25718 /// * *$.xgafv* (query-string) - V1 error format.
25719 /// * *access_token* (query-string) - OAuth access token.
25720 /// * *alt* (query-string) - Data format for response.
25721 /// * *callback* (query-string) - JSONP
25722 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25723 /// * *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.
25724 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25725 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25726 /// * *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.
25727 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25728 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25729 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C>
25730 where
25731 T: AsRef<str>,
25732 {
25733 self._additional_params
25734 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25735 self
25736 }
25737
25738 /// Identifies the authorization scope for the method you are building.
25739 ///
25740 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25741 /// [`Scope::CloudPlatform`].
25742 ///
25743 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25744 /// tokens for more than one scope.
25745 ///
25746 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25747 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25748 /// sufficient, a read-write scope will do as well.
25749 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C>
25750 where
25751 St: AsRef<str>,
25752 {
25753 self._scopes.insert(String::from(scope.as_ref()));
25754 self
25755 }
25756 /// Identifies the authorization scope(s) for the method you are building.
25757 ///
25758 /// See [`Self::add_scope()`] for details.
25759 pub fn add_scopes<I, St>(
25760 mut self,
25761 scopes: I,
25762 ) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C>
25763 where
25764 I: IntoIterator<Item = St>,
25765 St: AsRef<str>,
25766 {
25767 self._scopes
25768 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25769 self
25770 }
25771
25772 /// Removes all scopes, and no default scope will be used either.
25773 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25774 /// for details).
25775 pub fn clear_scopes(mut self) -> ProjectLocationWorkerpoolSetIamPolicyCall<'a, C> {
25776 self._scopes.clear();
25777 self
25778 }
25779}
25780
25781/// Returns permissions that a caller has on the specified worker pool. There are no permissions required for making this API call.
25782///
25783/// A builder for the *locations.workerpools.testIamPermissions* method supported by a *project* resource.
25784/// It is not used directly, but through a [`ProjectMethods`] instance.
25785///
25786/// # Example
25787///
25788/// Instantiate a resource method builder
25789///
25790/// ```test_harness,no_run
25791/// # extern crate hyper;
25792/// # extern crate hyper_rustls;
25793/// # extern crate google_run1 as run1;
25794/// use run1::api::TestIamPermissionsRequest;
25795/// # async fn dox() {
25796/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25797///
25798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25799/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25800/// # .with_native_roots()
25801/// # .unwrap()
25802/// # .https_only()
25803/// # .enable_http2()
25804/// # .build();
25805///
25806/// # let executor = hyper_util::rt::TokioExecutor::new();
25807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25808/// # secret,
25809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25810/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25811/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25812/// # ),
25813/// # ).build().await.unwrap();
25814///
25815/// # let client = hyper_util::client::legacy::Client::builder(
25816/// # hyper_util::rt::TokioExecutor::new()
25817/// # )
25818/// # .build(
25819/// # hyper_rustls::HttpsConnectorBuilder::new()
25820/// # .with_native_roots()
25821/// # .unwrap()
25822/// # .https_or_http()
25823/// # .enable_http2()
25824/// # .build()
25825/// # );
25826/// # let mut hub = CloudRun::new(client, auth);
25827/// // As the method needs a request, you would usually fill it with the desired information
25828/// // into the respective structure. Some of the parts shown here might not be applicable !
25829/// // Values shown here are possibly random and not representative !
25830/// let mut req = TestIamPermissionsRequest::default();
25831///
25832/// // You can configure optional parameters by calling the respective setters at will, and
25833/// // execute the final call using `doit()`.
25834/// // Values shown here are possibly random and not representative !
25835/// let result = hub.projects().locations_workerpools_test_iam_permissions(req, "resource")
25836/// .doit().await;
25837/// # }
25838/// ```
25839pub struct ProjectLocationWorkerpoolTestIamPermissionCall<'a, C>
25840where
25841 C: 'a,
25842{
25843 hub: &'a CloudRun<C>,
25844 _request: TestIamPermissionsRequest,
25845 _resource: String,
25846 _delegate: Option<&'a mut dyn common::Delegate>,
25847 _additional_params: HashMap<String, String>,
25848 _scopes: BTreeSet<String>,
25849}
25850
25851impl<'a, C> common::CallBuilder for ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {}
25852
25853impl<'a, C> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C>
25854where
25855 C: common::Connector,
25856{
25857 /// Perform the operation you have build so far.
25858 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
25859 use std::borrow::Cow;
25860 use std::io::{Read, Seek};
25861
25862 use common::{url::Params, ToParts};
25863 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25864
25865 let mut dd = common::DefaultDelegate;
25866 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25867 dlg.begin(common::MethodInfo {
25868 id: "run.projects.locations.workerpools.testIamPermissions",
25869 http_method: hyper::Method::POST,
25870 });
25871
25872 for &field in ["alt", "resource"].iter() {
25873 if self._additional_params.contains_key(field) {
25874 dlg.finished(false);
25875 return Err(common::Error::FieldClash(field));
25876 }
25877 }
25878
25879 let mut params = Params::with_capacity(4 + self._additional_params.len());
25880 params.push("resource", self._resource);
25881
25882 params.extend(self._additional_params.iter());
25883
25884 params.push("alt", "json");
25885 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
25886 if self._scopes.is_empty() {
25887 self._scopes
25888 .insert(Scope::CloudPlatform.as_ref().to_string());
25889 }
25890
25891 #[allow(clippy::single_element_loop)]
25892 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25893 url = params.uri_replacement(url, param_name, find_this, true);
25894 }
25895 {
25896 let to_remove = ["resource"];
25897 params.remove_params(&to_remove);
25898 }
25899
25900 let url = params.parse_with_url(&url);
25901
25902 let mut json_mime_type = mime::APPLICATION_JSON;
25903 let mut request_value_reader = {
25904 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25905 common::remove_json_null_values(&mut value);
25906 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25907 serde_json::to_writer(&mut dst, &value).unwrap();
25908 dst
25909 };
25910 let request_size = request_value_reader
25911 .seek(std::io::SeekFrom::End(0))
25912 .unwrap();
25913 request_value_reader
25914 .seek(std::io::SeekFrom::Start(0))
25915 .unwrap();
25916
25917 loop {
25918 let token = match self
25919 .hub
25920 .auth
25921 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25922 .await
25923 {
25924 Ok(token) => token,
25925 Err(e) => match dlg.token(e) {
25926 Ok(token) => token,
25927 Err(e) => {
25928 dlg.finished(false);
25929 return Err(common::Error::MissingToken(e));
25930 }
25931 },
25932 };
25933 request_value_reader
25934 .seek(std::io::SeekFrom::Start(0))
25935 .unwrap();
25936 let mut req_result = {
25937 let client = &self.hub.client;
25938 dlg.pre_request();
25939 let mut req_builder = hyper::Request::builder()
25940 .method(hyper::Method::POST)
25941 .uri(url.as_str())
25942 .header(USER_AGENT, self.hub._user_agent.clone());
25943
25944 if let Some(token) = token.as_ref() {
25945 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25946 }
25947
25948 let request = req_builder
25949 .header(CONTENT_TYPE, json_mime_type.to_string())
25950 .header(CONTENT_LENGTH, request_size as u64)
25951 .body(common::to_body(
25952 request_value_reader.get_ref().clone().into(),
25953 ));
25954
25955 client.request(request.unwrap()).await
25956 };
25957
25958 match req_result {
25959 Err(err) => {
25960 if let common::Retry::After(d) = dlg.http_error(&err) {
25961 sleep(d).await;
25962 continue;
25963 }
25964 dlg.finished(false);
25965 return Err(common::Error::HttpError(err));
25966 }
25967 Ok(res) => {
25968 let (mut parts, body) = res.into_parts();
25969 let mut body = common::Body::new(body);
25970 if !parts.status.is_success() {
25971 let bytes = common::to_bytes(body).await.unwrap_or_default();
25972 let error = serde_json::from_str(&common::to_string(&bytes));
25973 let response = common::to_response(parts, bytes.into());
25974
25975 if let common::Retry::After(d) =
25976 dlg.http_failure(&response, error.as_ref().ok())
25977 {
25978 sleep(d).await;
25979 continue;
25980 }
25981
25982 dlg.finished(false);
25983
25984 return Err(match error {
25985 Ok(value) => common::Error::BadRequest(value),
25986 _ => common::Error::Failure(response),
25987 });
25988 }
25989 let response = {
25990 let bytes = common::to_bytes(body).await.unwrap_or_default();
25991 let encoded = common::to_string(&bytes);
25992 match serde_json::from_str(&encoded) {
25993 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25994 Err(error) => {
25995 dlg.response_json_decode_error(&encoded, &error);
25996 return Err(common::Error::JsonDecodeError(
25997 encoded.to_string(),
25998 error,
25999 ));
26000 }
26001 }
26002 };
26003
26004 dlg.finished(true);
26005 return Ok(response);
26006 }
26007 }
26008 }
26009 }
26010
26011 ///
26012 /// Sets the *request* property to the given value.
26013 ///
26014 /// Even though the property as already been set when instantiating this call,
26015 /// we provide this method for API completeness.
26016 pub fn request(
26017 mut self,
26018 new_value: TestIamPermissionsRequest,
26019 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {
26020 self._request = new_value;
26021 self
26022 }
26023 /// 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.
26024 ///
26025 /// Sets the *resource* path property to the given value.
26026 ///
26027 /// Even though the property as already been set when instantiating this call,
26028 /// we provide this method for API completeness.
26029 pub fn resource(
26030 mut self,
26031 new_value: &str,
26032 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {
26033 self._resource = new_value.to_string();
26034 self
26035 }
26036 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26037 /// while executing the actual API request.
26038 ///
26039 /// ````text
26040 /// It should be used to handle progress information, and to implement a certain level of resilience.
26041 /// ````
26042 ///
26043 /// Sets the *delegate* property to the given value.
26044 pub fn delegate(
26045 mut self,
26046 new_value: &'a mut dyn common::Delegate,
26047 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {
26048 self._delegate = Some(new_value);
26049 self
26050 }
26051
26052 /// Set any additional parameter of the query string used in the request.
26053 /// It should be used to set parameters which are not yet available through their own
26054 /// setters.
26055 ///
26056 /// Please note that this method must not be used to set any of the known parameters
26057 /// which have their own setter method. If done anyway, the request will fail.
26058 ///
26059 /// # Additional Parameters
26060 ///
26061 /// * *$.xgafv* (query-string) - V1 error format.
26062 /// * *access_token* (query-string) - OAuth access token.
26063 /// * *alt* (query-string) - Data format for response.
26064 /// * *callback* (query-string) - JSONP
26065 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26066 /// * *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.
26067 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26068 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26069 /// * *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.
26070 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26071 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26072 pub fn param<T>(
26073 mut self,
26074 name: T,
26075 value: T,
26076 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C>
26077 where
26078 T: AsRef<str>,
26079 {
26080 self._additional_params
26081 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26082 self
26083 }
26084
26085 /// Identifies the authorization scope for the method you are building.
26086 ///
26087 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26088 /// [`Scope::CloudPlatform`].
26089 ///
26090 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26091 /// tokens for more than one scope.
26092 ///
26093 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26094 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26095 /// sufficient, a read-write scope will do as well.
26096 pub fn add_scope<St>(
26097 mut self,
26098 scope: St,
26099 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C>
26100 where
26101 St: AsRef<str>,
26102 {
26103 self._scopes.insert(String::from(scope.as_ref()));
26104 self
26105 }
26106 /// Identifies the authorization scope(s) for the method you are building.
26107 ///
26108 /// See [`Self::add_scope()`] for details.
26109 pub fn add_scopes<I, St>(
26110 mut self,
26111 scopes: I,
26112 ) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C>
26113 where
26114 I: IntoIterator<Item = St>,
26115 St: AsRef<str>,
26116 {
26117 self._scopes
26118 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26119 self
26120 }
26121
26122 /// Removes all scopes, and no default scope will be used either.
26123 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26124 /// for details).
26125 pub fn clear_scopes(mut self) -> ProjectLocationWorkerpoolTestIamPermissionCall<'a, C> {
26126 self._scopes.clear();
26127 self
26128 }
26129}
26130
26131/// Lists information about the supported locations for this service.
26132///
26133/// A builder for the *locations.list* method supported by a *project* resource.
26134/// It is not used directly, but through a [`ProjectMethods`] instance.
26135///
26136/// # Example
26137///
26138/// Instantiate a resource method builder
26139///
26140/// ```test_harness,no_run
26141/// # extern crate hyper;
26142/// # extern crate hyper_rustls;
26143/// # extern crate google_run1 as run1;
26144/// # async fn dox() {
26145/// # use run1::{CloudRun, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26146///
26147/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26148/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26149/// # .with_native_roots()
26150/// # .unwrap()
26151/// # .https_only()
26152/// # .enable_http2()
26153/// # .build();
26154///
26155/// # let executor = hyper_util::rt::TokioExecutor::new();
26156/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26157/// # secret,
26158/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26159/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26160/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26161/// # ),
26162/// # ).build().await.unwrap();
26163///
26164/// # let client = hyper_util::client::legacy::Client::builder(
26165/// # hyper_util::rt::TokioExecutor::new()
26166/// # )
26167/// # .build(
26168/// # hyper_rustls::HttpsConnectorBuilder::new()
26169/// # .with_native_roots()
26170/// # .unwrap()
26171/// # .https_or_http()
26172/// # .enable_http2()
26173/// # .build()
26174/// # );
26175/// # let mut hub = CloudRun::new(client, auth);
26176/// // You can configure optional parameters by calling the respective setters at will, and
26177/// // execute the final call using `doit()`.
26178/// // Values shown here are possibly random and not representative !
26179/// let result = hub.projects().locations_list("name")
26180/// .page_token("vero")
26181/// .page_size(-16)
26182/// .filter("dolores")
26183/// .add_extra_location_types("consetetur")
26184/// .doit().await;
26185/// # }
26186/// ```
26187pub struct ProjectLocationListCall<'a, C>
26188where
26189 C: 'a,
26190{
26191 hub: &'a CloudRun<C>,
26192 _name: String,
26193 _page_token: Option<String>,
26194 _page_size: Option<i32>,
26195 _filter: Option<String>,
26196 _extra_location_types: Vec<String>,
26197 _delegate: Option<&'a mut dyn common::Delegate>,
26198 _additional_params: HashMap<String, String>,
26199 _scopes: BTreeSet<String>,
26200}
26201
26202impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
26203
26204impl<'a, C> ProjectLocationListCall<'a, C>
26205where
26206 C: common::Connector,
26207{
26208 /// Perform the operation you have build so far.
26209 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
26210 use std::borrow::Cow;
26211 use std::io::{Read, Seek};
26212
26213 use common::{url::Params, ToParts};
26214 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26215
26216 let mut dd = common::DefaultDelegate;
26217 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26218 dlg.begin(common::MethodInfo {
26219 id: "run.projects.locations.list",
26220 http_method: hyper::Method::GET,
26221 });
26222
26223 for &field in [
26224 "alt",
26225 "name",
26226 "pageToken",
26227 "pageSize",
26228 "filter",
26229 "extraLocationTypes",
26230 ]
26231 .iter()
26232 {
26233 if self._additional_params.contains_key(field) {
26234 dlg.finished(false);
26235 return Err(common::Error::FieldClash(field));
26236 }
26237 }
26238
26239 let mut params = Params::with_capacity(7 + self._additional_params.len());
26240 params.push("name", self._name);
26241 if let Some(value) = self._page_token.as_ref() {
26242 params.push("pageToken", value);
26243 }
26244 if let Some(value) = self._page_size.as_ref() {
26245 params.push("pageSize", value.to_string());
26246 }
26247 if let Some(value) = self._filter.as_ref() {
26248 params.push("filter", value);
26249 }
26250 if !self._extra_location_types.is_empty() {
26251 for f in self._extra_location_types.iter() {
26252 params.push("extraLocationTypes", f);
26253 }
26254 }
26255
26256 params.extend(self._additional_params.iter());
26257
26258 params.push("alt", "json");
26259 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
26260 if self._scopes.is_empty() {
26261 self._scopes
26262 .insert(Scope::CloudPlatform.as_ref().to_string());
26263 }
26264
26265 #[allow(clippy::single_element_loop)]
26266 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26267 url = params.uri_replacement(url, param_name, find_this, true);
26268 }
26269 {
26270 let to_remove = ["name"];
26271 params.remove_params(&to_remove);
26272 }
26273
26274 let url = params.parse_with_url(&url);
26275
26276 loop {
26277 let token = match self
26278 .hub
26279 .auth
26280 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26281 .await
26282 {
26283 Ok(token) => token,
26284 Err(e) => match dlg.token(e) {
26285 Ok(token) => token,
26286 Err(e) => {
26287 dlg.finished(false);
26288 return Err(common::Error::MissingToken(e));
26289 }
26290 },
26291 };
26292 let mut req_result = {
26293 let client = &self.hub.client;
26294 dlg.pre_request();
26295 let mut req_builder = hyper::Request::builder()
26296 .method(hyper::Method::GET)
26297 .uri(url.as_str())
26298 .header(USER_AGENT, self.hub._user_agent.clone());
26299
26300 if let Some(token) = token.as_ref() {
26301 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26302 }
26303
26304 let request = req_builder
26305 .header(CONTENT_LENGTH, 0_u64)
26306 .body(common::to_body::<String>(None));
26307
26308 client.request(request.unwrap()).await
26309 };
26310
26311 match req_result {
26312 Err(err) => {
26313 if let common::Retry::After(d) = dlg.http_error(&err) {
26314 sleep(d).await;
26315 continue;
26316 }
26317 dlg.finished(false);
26318 return Err(common::Error::HttpError(err));
26319 }
26320 Ok(res) => {
26321 let (mut parts, body) = res.into_parts();
26322 let mut body = common::Body::new(body);
26323 if !parts.status.is_success() {
26324 let bytes = common::to_bytes(body).await.unwrap_or_default();
26325 let error = serde_json::from_str(&common::to_string(&bytes));
26326 let response = common::to_response(parts, bytes.into());
26327
26328 if let common::Retry::After(d) =
26329 dlg.http_failure(&response, error.as_ref().ok())
26330 {
26331 sleep(d).await;
26332 continue;
26333 }
26334
26335 dlg.finished(false);
26336
26337 return Err(match error {
26338 Ok(value) => common::Error::BadRequest(value),
26339 _ => common::Error::Failure(response),
26340 });
26341 }
26342 let response = {
26343 let bytes = common::to_bytes(body).await.unwrap_or_default();
26344 let encoded = common::to_string(&bytes);
26345 match serde_json::from_str(&encoded) {
26346 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26347 Err(error) => {
26348 dlg.response_json_decode_error(&encoded, &error);
26349 return Err(common::Error::JsonDecodeError(
26350 encoded.to_string(),
26351 error,
26352 ));
26353 }
26354 }
26355 };
26356
26357 dlg.finished(true);
26358 return Ok(response);
26359 }
26360 }
26361 }
26362 }
26363
26364 /// The resource that owns the locations collection, if applicable.
26365 ///
26366 /// Sets the *name* path property to the given value.
26367 ///
26368 /// Even though the property as already been set when instantiating this call,
26369 /// we provide this method for API completeness.
26370 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26371 self._name = new_value.to_string();
26372 self
26373 }
26374 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
26375 ///
26376 /// Sets the *page token* query property to the given value.
26377 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26378 self._page_token = Some(new_value.to_string());
26379 self
26380 }
26381 /// The maximum number of results to return. If not set, the service selects a default.
26382 ///
26383 /// Sets the *page size* query property to the given value.
26384 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
26385 self._page_size = Some(new_value);
26386 self
26387 }
26388 /// 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).
26389 ///
26390 /// Sets the *filter* query property to the given value.
26391 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26392 self._filter = Some(new_value.to_string());
26393 self
26394 }
26395 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
26396 ///
26397 /// Append the given value to the *extra location types* query property.
26398 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
26399 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26400 self._extra_location_types.push(new_value.to_string());
26401 self
26402 }
26403 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26404 /// while executing the actual API request.
26405 ///
26406 /// ````text
26407 /// It should be used to handle progress information, and to implement a certain level of resilience.
26408 /// ````
26409 ///
26410 /// Sets the *delegate* property to the given value.
26411 pub fn delegate(
26412 mut self,
26413 new_value: &'a mut dyn common::Delegate,
26414 ) -> ProjectLocationListCall<'a, C> {
26415 self._delegate = Some(new_value);
26416 self
26417 }
26418
26419 /// Set any additional parameter of the query string used in the request.
26420 /// It should be used to set parameters which are not yet available through their own
26421 /// setters.
26422 ///
26423 /// Please note that this method must not be used to set any of the known parameters
26424 /// which have their own setter method. If done anyway, the request will fail.
26425 ///
26426 /// # Additional Parameters
26427 ///
26428 /// * *$.xgafv* (query-string) - V1 error format.
26429 /// * *access_token* (query-string) - OAuth access token.
26430 /// * *alt* (query-string) - Data format for response.
26431 /// * *callback* (query-string) - JSONP
26432 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26433 /// * *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.
26434 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26435 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26436 /// * *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.
26437 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26438 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26439 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
26440 where
26441 T: AsRef<str>,
26442 {
26443 self._additional_params
26444 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26445 self
26446 }
26447
26448 /// Identifies the authorization scope for the method you are building.
26449 ///
26450 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26451 /// [`Scope::CloudPlatform`].
26452 ///
26453 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26454 /// tokens for more than one scope.
26455 ///
26456 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26457 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26458 /// sufficient, a read-write scope will do as well.
26459 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
26460 where
26461 St: AsRef<str>,
26462 {
26463 self._scopes.insert(String::from(scope.as_ref()));
26464 self
26465 }
26466 /// Identifies the authorization scope(s) for the method you are building.
26467 ///
26468 /// See [`Self::add_scope()`] for details.
26469 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
26470 where
26471 I: IntoIterator<Item = St>,
26472 St: AsRef<str>,
26473 {
26474 self._scopes
26475 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26476 self
26477 }
26478
26479 /// Removes all scopes, and no default scope will be used either.
26480 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26481 /// for details).
26482 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
26483 self._scopes.clear();
26484 self
26485 }
26486}