google_datapipelines1/
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 Datapipelines 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_datapipelines1 as datapipelines1;
49/// use datapipelines1::api::GoogleCloudDatapipelinesV1Pipeline;
50/// use datapipelines1::{Result, Error};
51/// # async fn dox() {
52/// use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = Datapipelines::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = GoogleCloudDatapipelinesV1Pipeline::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_pipelines_patch(req, "name")
88///              .update_mask(FieldMask::new::<&str>(&[]))
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct Datapipelines<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for Datapipelines<C> {}
120
121impl<'a, C> Datapipelines<C> {
122    pub fn new<A: 'static + common::GetToken>(
123        client: common::Client<C>,
124        auth: A,
125    ) -> Datapipelines<C> {
126        Datapipelines {
127            client,
128            auth: Box::new(auth),
129            _user_agent: "google-api-rust-client/6.0.0".to_string(),
130            _base_url: "https://datapipelines.googleapis.com/".to_string(),
131            _root_url: "https://datapipelines.googleapis.com/".to_string(),
132        }
133    }
134
135    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136        ProjectMethods { hub: self }
137    }
138
139    /// Set the user-agent header field to use in all requests to the server.
140    /// It defaults to `google-api-rust-client/6.0.0`.
141    ///
142    /// Returns the previously set user-agent.
143    pub fn user_agent(&mut self, agent_name: String) -> String {
144        std::mem::replace(&mut self._user_agent, agent_name)
145    }
146
147    /// Set the base url to use in all requests to the server.
148    /// It defaults to `https://datapipelines.googleapis.com/`.
149    ///
150    /// Returns the previously set base url.
151    pub fn base_url(&mut self, new_base_url: String) -> String {
152        std::mem::replace(&mut self._base_url, new_base_url)
153    }
154
155    /// Set the root url to use in all requests to the server.
156    /// It defaults to `https://datapipelines.googleapis.com/`.
157    ///
158    /// Returns the previously set root url.
159    pub fn root_url(&mut self, new_root_url: String) -> String {
160        std::mem::replace(&mut self._root_url, new_root_url)
161    }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// Pipeline job details specific to the Dataflow API. This is encapsulated here to allow for more executors to store their specific details separately.
168///
169/// This type is not used in any activity, and only used as *part* of another schema.
170///
171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
172#[serde_with::serde_as]
173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
174pub struct GoogleCloudDatapipelinesV1DataflowJobDetails {
175    /// Output only. The current number of workers used to run the jobs. Only set to a value if the job is still running.
176    #[serde(rename = "currentWorkers")]
177    pub current_workers: Option<i32>,
178    /// Cached version of all the metrics of interest for the job. This value gets stored here when the job is terminated. As long as the job is running, this field is populated from the Dataflow API.
179    #[serde(rename = "resourceInfo")]
180    pub resource_info: Option<HashMap<String, f64>>,
181    /// Output only. The SDK version used to run the job.
182    #[serde(rename = "sdkVersion")]
183    pub sdk_version: Option<GoogleCloudDatapipelinesV1SdkVersion>,
184}
185
186impl common::Part for GoogleCloudDatapipelinesV1DataflowJobDetails {}
187
188/// The environment values to be set at runtime for a Flex Template.
189///
190/// This type is not used in any activity, and only used as *part* of another schema.
191///
192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
193#[serde_with::serde_as]
194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
195pub struct GoogleCloudDatapipelinesV1FlexTemplateRuntimeEnvironment {
196    /// Additional experiment flags for the job.
197    #[serde(rename = "additionalExperiments")]
198    pub additional_experiments: Option<Vec<String>>,
199    /// Additional user labels to be specified for the job. Keys and values must follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions). An object containing a list of key/value pairs. Example: `{ "name": "wrench", "mass": "1kg", "count": "3" }`.
200    #[serde(rename = "additionalUserLabels")]
201    pub additional_user_labels: Option<HashMap<String, String>>,
202    /// Whether to enable Streaming Engine for the job.
203    #[serde(rename = "enableStreamingEngine")]
204    pub enable_streaming_engine: Option<bool>,
205    /// Set FlexRS goal for the job. https://cloud.google.com/dataflow/docs/guides/flexrs
206    #[serde(rename = "flexrsGoal")]
207    pub flexrs_goal: Option<String>,
208    /// Configuration for VM IPs.
209    #[serde(rename = "ipConfiguration")]
210    pub ip_configuration: Option<String>,
211    /// Name for the Cloud KMS key for the job. Key format is: projects//locations//keyRings//cryptoKeys/
212    #[serde(rename = "kmsKeyName")]
213    pub kms_key_name: Option<String>,
214    /// The machine type to use for the job. Defaults to the value from the template if not specified.
215    #[serde(rename = "machineType")]
216    pub machine_type: Option<String>,
217    /// The maximum number of Compute Engine instances to be made available to your pipeline during execution, from 1 to 1000.
218    #[serde(rename = "maxWorkers")]
219    pub max_workers: Option<i32>,
220    /// Network to which VMs will be assigned. If empty or unspecified, the service will use the network "default".
221    pub network: Option<String>,
222    /// The initial number of Compute Engine instances for the job.
223    #[serde(rename = "numWorkers")]
224    pub num_workers: Option<i32>,
225    /// The email address of the service account to run the job as.
226    #[serde(rename = "serviceAccountEmail")]
227    pub service_account_email: Option<String>,
228    /// Subnetwork to which VMs will be assigned, if desired. You can specify a subnetwork using either a complete URL or an abbreviated path. Expected to be of the form "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in a Shared VPC network, you must use the complete URL.
229    pub subnetwork: Option<String>,
230    /// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with `gs://`.
231    #[serde(rename = "tempLocation")]
232    pub temp_location: Option<String>,
233    /// The Compute Engine region (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1". Mutually exclusive with worker_zone. If neither worker_region nor worker_zone is specified, defaults to the control plane region.
234    #[serde(rename = "workerRegion")]
235    pub worker_region: Option<String>,
236    /// The Compute Engine zone (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with worker_region. If neither worker_region nor worker_zone is specified, a zone in the control plane region is chosen based on available capacity. If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
237    #[serde(rename = "workerZone")]
238    pub worker_zone: Option<String>,
239    /// The Compute Engine [availability zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) for launching worker instances to run your pipeline. In the future, worker_zone will take precedence.
240    pub zone: Option<String>,
241}
242
243impl common::Part for GoogleCloudDatapipelinesV1FlexTemplateRuntimeEnvironment {}
244
245/// Definition of the job information maintained by the pipeline. Fields in this entity are retrieved from the executor API (e.g. Dataflow API).
246///
247/// This type is not used in any activity, and only used as *part* of another schema.
248///
249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
250#[serde_with::serde_as]
251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
252pub struct GoogleCloudDatapipelinesV1Job {
253    /// Output only. The time of job creation.
254    #[serde(rename = "createTime")]
255    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
256    /// All the details that are specific to a Dataflow job.
257    #[serde(rename = "dataflowJobDetails")]
258    pub dataflow_job_details: Option<GoogleCloudDatapipelinesV1DataflowJobDetails>,
259    /// Output only. The time of job termination. This is absent if the job is still running.
260    #[serde(rename = "endTime")]
261    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
262    /// Output only. The internal ID for the job.
263    pub id: Option<String>,
264    /// Required. The fully qualified resource name for the job.
265    pub name: Option<String>,
266    /// The current state of the job.
267    pub state: Option<String>,
268    /// Status capturing any error code or message related to job creation or execution.
269    pub status: Option<GoogleRpcStatus>,
270}
271
272impl common::Part for GoogleCloudDatapipelinesV1Job {}
273
274/// Launch Flex Template parameter.
275///
276/// This type is not used in any activity, and only used as *part* of another schema.
277///
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct GoogleCloudDatapipelinesV1LaunchFlexTemplateParameter {
282    /// Cloud Storage path to a file with a JSON-serialized ContainerSpec as content.
283    #[serde(rename = "containerSpecGcsPath")]
284    pub container_spec_gcs_path: Option<String>,
285    /// The runtime environment for the Flex Template job.
286    pub environment: Option<GoogleCloudDatapipelinesV1FlexTemplateRuntimeEnvironment>,
287    /// Required. The job name to use for the created job. For an update job request, the job name should be the same as the existing running job.
288    #[serde(rename = "jobName")]
289    pub job_name: Option<String>,
290    /// Launch options for this Flex Template job. This is a common set of options across languages and templates. This should not be used to pass job parameters.
291    #[serde(rename = "launchOptions")]
292    pub launch_options: Option<HashMap<String, String>>,
293    /// The parameters for the Flex Template. Example: `{"num_workers":"5"}`
294    pub parameters: Option<HashMap<String, String>>,
295    /// Use this to pass transform name mappings for streaming update jobs. Example: `{"oldTransformName":"newTransformName",...}`
296    #[serde(rename = "transformNameMappings")]
297    pub transform_name_mappings: Option<HashMap<String, String>>,
298    /// Set this to true if you are sending a request to update a running streaming job. When set, the job name should be the same as the running job.
299    pub update: Option<bool>,
300}
301
302impl common::Part for GoogleCloudDatapipelinesV1LaunchFlexTemplateParameter {}
303
304/// A request to launch a Dataflow job from a Flex Template.
305///
306/// This type is not used in any activity, and only used as *part* of another schema.
307///
308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
309#[serde_with::serde_as]
310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
311pub struct GoogleCloudDatapipelinesV1LaunchFlexTemplateRequest {
312    /// Required. Parameter to launch a job from a Flex Template.
313    #[serde(rename = "launchParameter")]
314    pub launch_parameter: Option<GoogleCloudDatapipelinesV1LaunchFlexTemplateParameter>,
315    /// Required. The [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which to direct the request. For example, `us-central1`, `us-west1`.
316    pub location: Option<String>,
317    /// Required. The ID of the Cloud Platform project that the job belongs to.
318    #[serde(rename = "projectId")]
319    pub project_id: Option<String>,
320    /// If true, the request is validated but not actually executed. Defaults to false.
321    #[serde(rename = "validateOnly")]
322    pub validate_only: Option<bool>,
323}
324
325impl common::Part for GoogleCloudDatapipelinesV1LaunchFlexTemplateRequest {}
326
327/// Parameters to provide to the template being launched.
328///
329/// This type is not used in any activity, and only used as *part* of another schema.
330///
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct GoogleCloudDatapipelinesV1LaunchTemplateParameters {
335    /// The runtime environment for the job.
336    pub environment: Option<GoogleCloudDatapipelinesV1RuntimeEnvironment>,
337    /// Required. The job name to use for the created job.
338    #[serde(rename = "jobName")]
339    pub job_name: Option<String>,
340    /// The runtime parameters to pass to the job.
341    pub parameters: Option<HashMap<String, String>>,
342    /// Map of transform name prefixes of the job to be replaced to the corresponding name prefixes of the new job. Only applicable when updating a pipeline.
343    #[serde(rename = "transformNameMapping")]
344    pub transform_name_mapping: Option<HashMap<String, String>>,
345    /// If set, replace the existing pipeline with the name specified by jobName with this pipeline, preserving state.
346    pub update: Option<bool>,
347}
348
349impl common::Part for GoogleCloudDatapipelinesV1LaunchTemplateParameters {}
350
351/// A request to launch a template.
352///
353/// This type is not used in any activity, and only used as *part* of another schema.
354///
355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
356#[serde_with::serde_as]
357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
358pub struct GoogleCloudDatapipelinesV1LaunchTemplateRequest {
359    /// A Cloud Storage path to the template from which to create the job. Must be a valid Cloud Storage URL, beginning with 'gs://'.
360    #[serde(rename = "gcsPath")]
361    pub gcs_path: Option<String>,
362    /// The parameters of the template to launch. This should be part of the body of the POST request.
363    #[serde(rename = "launchParameters")]
364    pub launch_parameters: Option<GoogleCloudDatapipelinesV1LaunchTemplateParameters>,
365    /// The [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) to which to direct the request.
366    pub location: Option<String>,
367    /// Required. The ID of the Cloud Platform project that the job belongs to.
368    #[serde(rename = "projectId")]
369    pub project_id: Option<String>,
370    /// If true, the request is validated but not actually executed. Defaults to false.
371    #[serde(rename = "validateOnly")]
372    pub validate_only: Option<bool>,
373}
374
375impl common::Part for GoogleCloudDatapipelinesV1LaunchTemplateRequest {}
376
377/// Response message for ListJobs
378///
379/// # Activities
380///
381/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
383///
384/// * [locations pipelines jobs list projects](ProjectLocationPipelineJobListCall) (response)
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct GoogleCloudDatapipelinesV1ListJobsResponse {
389    /// Results that were accessible to the caller. Results are always in descending order of job creation date.
390    pub jobs: Option<Vec<GoogleCloudDatapipelinesV1Job>>,
391    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
392    #[serde(rename = "nextPageToken")]
393    pub next_page_token: Option<String>,
394}
395
396impl common::ResponseResult for GoogleCloudDatapipelinesV1ListJobsResponse {}
397
398/// Response message for ListPipelines.
399///
400/// # Activities
401///
402/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
403/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
404///
405/// * [locations pipelines list projects](ProjectLocationPipelineListCall) (response)
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct GoogleCloudDatapipelinesV1ListPipelinesResponse {
410    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
411    #[serde(rename = "nextPageToken")]
412    pub next_page_token: Option<String>,
413    /// Results that matched the filter criteria and were accessible to the caller. Results are always in descending order of pipeline creation date.
414    pub pipelines: Option<Vec<GoogleCloudDatapipelinesV1Pipeline>>,
415}
416
417impl common::ResponseResult for GoogleCloudDatapipelinesV1ListPipelinesResponse {}
418
419/// The main pipeline entity and all the necessary metadata for launching and managing linked jobs.
420///
421/// # Activities
422///
423/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
424/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
425///
426/// * [locations pipelines create projects](ProjectLocationPipelineCreateCall) (request|response)
427/// * [locations pipelines get projects](ProjectLocationPipelineGetCall) (response)
428/// * [locations pipelines patch projects](ProjectLocationPipelinePatchCall) (request|response)
429/// * [locations pipelines stop projects](ProjectLocationPipelineStopCall) (response)
430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
431#[serde_with::serde_as]
432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
433pub struct GoogleCloudDatapipelinesV1Pipeline {
434    /// Output only. Immutable. The timestamp when the pipeline was initially created. Set by the Data Pipelines service.
435    #[serde(rename = "createTime")]
436    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
437    /// Required. The display name of the pipeline. It can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), and underscores (_).
438    #[serde(rename = "displayName")]
439    pub display_name: Option<String>,
440    /// Output only. Number of jobs.
441    #[serde(rename = "jobCount")]
442    pub job_count: Option<i32>,
443    /// Output only. Immutable. The timestamp when the pipeline was last modified. Set by the Data Pipelines service.
444    #[serde(rename = "lastUpdateTime")]
445    pub last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
446    /// The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`. * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), and periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects). * `LOCATION_ID` is the canonical ID for the pipeline's location. The list of available locations can be obtained by calling `google.cloud.location.Locations.ListLocations`. Note that the Data Pipelines service is not available in all regions. It depends on Cloud Scheduler, an App Engine application, so it's only available in [App Engine regions](https://cloud.google.com/about/locations#region). * `PIPELINE_ID` is the ID of the pipeline. Must be unique for the selected project and location.
447    pub name: Option<String>,
448    /// Immutable. The sources of the pipeline (for example, Dataplex). The keys and values are set by the corresponding sources during pipeline creation.
449    #[serde(rename = "pipelineSources")]
450    pub pipeline_sources: Option<HashMap<String, String>>,
451    /// Internal scheduling information for a pipeline. If this information is provided, periodic jobs will be created per the schedule. If not, users are responsible for creating jobs externally.
452    #[serde(rename = "scheduleInfo")]
453    pub schedule_info: Option<GoogleCloudDatapipelinesV1ScheduleSpec>,
454    /// Optional. A service account email to be used with the Cloud Scheduler job. If not specified, the default compute engine service account will be used.
455    #[serde(rename = "schedulerServiceAccountEmail")]
456    pub scheduler_service_account_email: Option<String>,
457    /// Required. The state of the pipeline. When the pipeline is created, the state is set to 'PIPELINE_STATE_ACTIVE' by default. State changes can be requested by setting the state to stopping, paused, or resuming. State cannot be changed through UpdatePipeline requests.
458    pub state: Option<String>,
459    /// Required. The type of the pipeline. This field affects the scheduling of the pipeline and the type of metrics to show for the pipeline.
460    #[serde(rename = "type")]
461    pub type_: Option<String>,
462    /// Workload information for creating new jobs.
463    pub workload: Option<GoogleCloudDatapipelinesV1Workload>,
464}
465
466impl common::RequestValue for GoogleCloudDatapipelinesV1Pipeline {}
467impl common::ResponseResult for GoogleCloudDatapipelinesV1Pipeline {}
468
469/// Request message for RunPipeline
470///
471/// # Activities
472///
473/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
474/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
475///
476/// * [locations pipelines run projects](ProjectLocationPipelineRunCall) (request)
477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
478#[serde_with::serde_as]
479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
480pub struct GoogleCloudDatapipelinesV1RunPipelineRequest {
481    _never_set: Option<bool>,
482}
483
484impl common::RequestValue for GoogleCloudDatapipelinesV1RunPipelineRequest {}
485
486/// Response message for RunPipeline
487///
488/// # Activities
489///
490/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
491/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
492///
493/// * [locations pipelines run projects](ProjectLocationPipelineRunCall) (response)
494#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
495#[serde_with::serde_as]
496#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
497pub struct GoogleCloudDatapipelinesV1RunPipelineResponse {
498    /// Job that was created as part of RunPipeline operation.
499    pub job: Option<GoogleCloudDatapipelinesV1Job>,
500}
501
502impl common::ResponseResult for GoogleCloudDatapipelinesV1RunPipelineResponse {}
503
504/// The environment values to set at runtime.
505///
506/// This type is not used in any activity, and only used as *part* of another schema.
507///
508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
509#[serde_with::serde_as]
510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct GoogleCloudDatapipelinesV1RuntimeEnvironment {
512    /// Additional experiment flags for the job.
513    #[serde(rename = "additionalExperiments")]
514    pub additional_experiments: Option<Vec<String>>,
515    /// Additional user labels to be specified for the job. Keys and values should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) page. An object containing a list of key/value pairs. Example: { "name": "wrench", "mass": "1kg", "count": "3" }.
516    #[serde(rename = "additionalUserLabels")]
517    pub additional_user_labels: Option<HashMap<String, String>>,
518    /// Whether to bypass the safety checks for the job's temporary directory. Use with caution.
519    #[serde(rename = "bypassTempDirValidation")]
520    pub bypass_temp_dir_validation: Option<bool>,
521    /// Whether to enable Streaming Engine for the job.
522    #[serde(rename = "enableStreamingEngine")]
523    pub enable_streaming_engine: Option<bool>,
524    /// Configuration for VM IPs.
525    #[serde(rename = "ipConfiguration")]
526    pub ip_configuration: Option<String>,
527    /// Name for the Cloud KMS key for the job. The key format is: projects//locations//keyRings//cryptoKeys/
528    #[serde(rename = "kmsKeyName")]
529    pub kms_key_name: Option<String>,
530    /// The machine type to use for the job. Defaults to the value from the template if not specified.
531    #[serde(rename = "machineType")]
532    pub machine_type: Option<String>,
533    /// The maximum number of Compute Engine instances to be made available to your pipeline during execution, from 1 to 1000.
534    #[serde(rename = "maxWorkers")]
535    pub max_workers: Option<i32>,
536    /// Network to which VMs will be assigned. If empty or unspecified, the service will use the network "default".
537    pub network: Option<String>,
538    /// The initial number of Compute Engine instances for the job.
539    #[serde(rename = "numWorkers")]
540    pub num_workers: Option<i32>,
541    /// The email address of the service account to run the job as.
542    #[serde(rename = "serviceAccountEmail")]
543    pub service_account_email: Option<String>,
544    /// Subnetwork to which VMs will be assigned, if desired. You can specify a subnetwork using either a complete URL or an abbreviated path. Expected to be of the form "https://www.googleapis.com/compute/v1/projects/HOST_PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK" or "regions/REGION/subnetworks/SUBNETWORK". If the subnetwork is located in a Shared VPC network, you must use the complete URL.
545    pub subnetwork: Option<String>,
546    /// The Cloud Storage path to use for temporary files. Must be a valid Cloud Storage URL, beginning with `gs://`.
547    #[serde(rename = "tempLocation")]
548    pub temp_location: Option<String>,
549    /// The Compute Engine region (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1". Mutually exclusive with worker_zone. If neither worker_region nor worker_zone is specified, default to the control plane's region.
550    #[serde(rename = "workerRegion")]
551    pub worker_region: Option<String>,
552    /// The Compute Engine zone (https://cloud.google.com/compute/docs/regions-zones/regions-zones) in which worker processing should occur, e.g. "us-west1-a". Mutually exclusive with worker_region. If neither worker_region nor worker_zone is specified, a zone in the control plane's region is chosen based on available capacity. If both `worker_zone` and `zone` are set, `worker_zone` takes precedence.
553    #[serde(rename = "workerZone")]
554    pub worker_zone: Option<String>,
555    /// The Compute Engine [availability zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones) for launching worker instances to run your pipeline. In the future, worker_zone will take precedence.
556    pub zone: Option<String>,
557}
558
559impl common::Part for GoogleCloudDatapipelinesV1RuntimeEnvironment {}
560
561/// Details of the schedule the pipeline runs on.
562///
563/// This type is not used in any activity, and only used as *part* of another schema.
564///
565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
566#[serde_with::serde_as]
567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
568pub struct GoogleCloudDatapipelinesV1ScheduleSpec {
569    /// Output only. When the next Scheduler job is going to run.
570    #[serde(rename = "nextJobTime")]
571    pub next_job_time: Option<chrono::DateTime<chrono::offset::Utc>>,
572    /// Unix-cron format of the schedule. This information is retrieved from the linked Cloud Scheduler.
573    pub schedule: Option<String>,
574    /// Timezone ID. This matches the timezone IDs used by the Cloud Scheduler API. If empty, UTC time is assumed.
575    #[serde(rename = "timeZone")]
576    pub time_zone: Option<String>,
577}
578
579impl common::Part for GoogleCloudDatapipelinesV1ScheduleSpec {}
580
581/// The version of the SDK used to run the job.
582///
583/// This type is not used in any activity, and only used as *part* of another schema.
584///
585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
586#[serde_with::serde_as]
587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
588pub struct GoogleCloudDatapipelinesV1SdkVersion {
589    /// The support status for this SDK version.
590    #[serde(rename = "sdkSupportStatus")]
591    pub sdk_support_status: Option<String>,
592    /// The version of the SDK used to run the job.
593    pub version: Option<String>,
594    /// A readable string describing the version of the SDK.
595    #[serde(rename = "versionDisplayName")]
596    pub version_display_name: Option<String>,
597}
598
599impl common::Part for GoogleCloudDatapipelinesV1SdkVersion {}
600
601/// Request message for StopPipeline.
602///
603/// # Activities
604///
605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
607///
608/// * [locations pipelines stop projects](ProjectLocationPipelineStopCall) (request)
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct GoogleCloudDatapipelinesV1StopPipelineRequest {
613    _never_set: Option<bool>,
614}
615
616impl common::RequestValue for GoogleCloudDatapipelinesV1StopPipelineRequest {}
617
618/// Workload details for creating the pipeline jobs.
619///
620/// This type is not used in any activity, and only used as *part* of another schema.
621///
622#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
623#[serde_with::serde_as]
624#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
625pub struct GoogleCloudDatapipelinesV1Workload {
626    /// Template information and additional parameters needed to launch a Dataflow job using the flex launch API.
627    #[serde(rename = "dataflowFlexTemplateRequest")]
628    pub dataflow_flex_template_request: Option<GoogleCloudDatapipelinesV1LaunchFlexTemplateRequest>,
629    /// Template information and additional parameters needed to launch a Dataflow job using the standard launch API.
630    #[serde(rename = "dataflowLaunchTemplateRequest")]
631    pub dataflow_launch_template_request: Option<GoogleCloudDatapipelinesV1LaunchTemplateRequest>,
632}
633
634impl common::Part for GoogleCloudDatapipelinesV1Workload {}
635
636/// 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); }
637///
638/// # Activities
639///
640/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
641/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
642///
643/// * [locations pipelines delete projects](ProjectLocationPipelineDeleteCall) (response)
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct GoogleProtobufEmpty {
648    _never_set: Option<bool>,
649}
650
651impl common::ResponseResult for GoogleProtobufEmpty {}
652
653/// 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).
654///
655/// This type is not used in any activity, and only used as *part* of another schema.
656///
657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
658#[serde_with::serde_as]
659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
660pub struct GoogleRpcStatus {
661    /// The status code, which should be an enum value of google.rpc.Code.
662    pub code: Option<i32>,
663    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
664    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
665    /// 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.
666    pub message: Option<String>,
667}
668
669impl common::Part for GoogleRpcStatus {}
670
671// ###################
672// MethodBuilders ###
673// #################
674
675/// A builder providing access to all methods supported on *project* resources.
676/// It is not used directly, but through the [`Datapipelines`] hub.
677///
678/// # Example
679///
680/// Instantiate a resource builder
681///
682/// ```test_harness,no_run
683/// extern crate hyper;
684/// extern crate hyper_rustls;
685/// extern crate google_datapipelines1 as datapipelines1;
686///
687/// # async fn dox() {
688/// use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
689///
690/// let secret: yup_oauth2::ApplicationSecret = Default::default();
691/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
692///     secret,
693///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
694/// ).build().await.unwrap();
695///
696/// let client = hyper_util::client::legacy::Client::builder(
697///     hyper_util::rt::TokioExecutor::new()
698/// )
699/// .build(
700///     hyper_rustls::HttpsConnectorBuilder::new()
701///         .with_native_roots()
702///         .unwrap()
703///         .https_or_http()
704///         .enable_http1()
705///         .build()
706/// );
707/// let mut hub = Datapipelines::new(client, auth);
708/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
709/// // like `locations_pipelines_create(...)`, `locations_pipelines_delete(...)`, `locations_pipelines_get(...)`, `locations_pipelines_jobs_list(...)`, `locations_pipelines_list(...)`, `locations_pipelines_patch(...)`, `locations_pipelines_run(...)` and `locations_pipelines_stop(...)`
710/// // to build up your call.
711/// let rb = hub.projects();
712/// # }
713/// ```
714pub struct ProjectMethods<'a, C>
715where
716    C: 'a,
717{
718    hub: &'a Datapipelines<C>,
719}
720
721impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
722
723impl<'a, C> ProjectMethods<'a, C> {
724    /// Create a builder to help you perform the following task:
725    ///
726    /// Lists jobs for a given pipeline. Throws a "FORBIDDEN" error if the caller doesn't have permission to access it.
727    ///
728    /// # Arguments
729    ///
730    /// * `parent` - Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
731    pub fn locations_pipelines_jobs_list(
732        &self,
733        parent: &str,
734    ) -> ProjectLocationPipelineJobListCall<'a, C> {
735        ProjectLocationPipelineJobListCall {
736            hub: self.hub,
737            _parent: parent.to_string(),
738            _page_token: Default::default(),
739            _page_size: Default::default(),
740            _delegate: Default::default(),
741            _additional_params: Default::default(),
742            _scopes: Default::default(),
743        }
744    }
745
746    /// Create a builder to help you perform the following task:
747    ///
748    /// Creates a pipeline. For a batch pipeline, you can pass scheduler information. Data Pipelines uses the scheduler information to create an internal scheduler that runs jobs periodically. If the internal scheduler is not configured, you can use RunPipeline to run jobs.
749    ///
750    /// # Arguments
751    ///
752    /// * `request` - No description provided.
753    /// * `parent` - Required. The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
754    pub fn locations_pipelines_create(
755        &self,
756        request: GoogleCloudDatapipelinesV1Pipeline,
757        parent: &str,
758    ) -> ProjectLocationPipelineCreateCall<'a, C> {
759        ProjectLocationPipelineCreateCall {
760            hub: self.hub,
761            _request: request,
762            _parent: parent.to_string(),
763            _delegate: Default::default(),
764            _additional_params: Default::default(),
765            _scopes: Default::default(),
766        }
767    }
768
769    /// Create a builder to help you perform the following task:
770    ///
771    /// Deletes a pipeline. If a scheduler job is attached to the pipeline, it will be deleted.
772    ///
773    /// # Arguments
774    ///
775    /// * `name` - Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
776    pub fn locations_pipelines_delete(
777        &self,
778        name: &str,
779    ) -> ProjectLocationPipelineDeleteCall<'a, C> {
780        ProjectLocationPipelineDeleteCall {
781            hub: self.hub,
782            _name: name.to_string(),
783            _delegate: Default::default(),
784            _additional_params: Default::default(),
785            _scopes: Default::default(),
786        }
787    }
788
789    /// Create a builder to help you perform the following task:
790    ///
791    /// Looks up a single pipeline. Returns a "NOT_FOUND" error if no such pipeline exists. Returns a "FORBIDDEN" error if the caller doesn't have permission to access it.
792    ///
793    /// # Arguments
794    ///
795    /// * `name` - Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
796    pub fn locations_pipelines_get(&self, name: &str) -> ProjectLocationPipelineGetCall<'a, C> {
797        ProjectLocationPipelineGetCall {
798            hub: self.hub,
799            _name: name.to_string(),
800            _delegate: Default::default(),
801            _additional_params: Default::default(),
802            _scopes: Default::default(),
803        }
804    }
805
806    /// Create a builder to help you perform the following task:
807    ///
808    /// Lists pipelines. Returns a "FORBIDDEN" error if the caller doesn't have permission to access it.
809    ///
810    /// # Arguments
811    ///
812    /// * `parent` - Required. The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
813    pub fn locations_pipelines_list(&self, parent: &str) -> ProjectLocationPipelineListCall<'a, C> {
814        ProjectLocationPipelineListCall {
815            hub: self.hub,
816            _parent: parent.to_string(),
817            _page_token: Default::default(),
818            _page_size: Default::default(),
819            _filter: Default::default(),
820            _delegate: Default::default(),
821            _additional_params: Default::default(),
822            _scopes: Default::default(),
823        }
824    }
825
826    /// Create a builder to help you perform the following task:
827    ///
828    /// Updates a pipeline. If successful, the updated Pipeline is returned. Returns `NOT_FOUND` if the pipeline doesn't exist. If UpdatePipeline does not return successfully, you can retry the UpdatePipeline request until you receive a successful response.
829    ///
830    /// # Arguments
831    ///
832    /// * `request` - No description provided.
833    /// * `name` - The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`. * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), and periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects). * `LOCATION_ID` is the canonical ID for the pipeline's location. The list of available locations can be obtained by calling `google.cloud.location.Locations.ListLocations`. Note that the Data Pipelines service is not available in all regions. It depends on Cloud Scheduler, an App Engine application, so it's only available in [App Engine regions](https://cloud.google.com/about/locations#region). * `PIPELINE_ID` is the ID of the pipeline. Must be unique for the selected project and location.
834    pub fn locations_pipelines_patch(
835        &self,
836        request: GoogleCloudDatapipelinesV1Pipeline,
837        name: &str,
838    ) -> ProjectLocationPipelinePatchCall<'a, C> {
839        ProjectLocationPipelinePatchCall {
840            hub: self.hub,
841            _request: request,
842            _name: name.to_string(),
843            _update_mask: Default::default(),
844            _delegate: Default::default(),
845            _additional_params: Default::default(),
846            _scopes: Default::default(),
847        }
848    }
849
850    /// Create a builder to help you perform the following task:
851    ///
852    /// Creates a job for the specified pipeline directly. You can use this method when the internal scheduler is not configured and you want to trigger the job directly or through an external system. Returns a "NOT_FOUND" error if the pipeline doesn't exist. Returns a "FORBIDDEN" error if the user doesn't have permission to access the pipeline or run jobs for the pipeline.
853    ///
854    /// # Arguments
855    ///
856    /// * `request` - No description provided.
857    /// * `name` - Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
858    pub fn locations_pipelines_run(
859        &self,
860        request: GoogleCloudDatapipelinesV1RunPipelineRequest,
861        name: &str,
862    ) -> ProjectLocationPipelineRunCall<'a, C> {
863        ProjectLocationPipelineRunCall {
864            hub: self.hub,
865            _request: request,
866            _name: name.to_string(),
867            _delegate: Default::default(),
868            _additional_params: Default::default(),
869            _scopes: Default::default(),
870        }
871    }
872
873    /// Create a builder to help you perform the following task:
874    ///
875    /// Freezes pipeline execution permanently. If there's a corresponding scheduler entry, it's deleted, and the pipeline state is changed to "ARCHIVED". However, pipeline metadata is retained.
876    ///
877    /// # Arguments
878    ///
879    /// * `request` - No description provided.
880    /// * `name` - Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
881    pub fn locations_pipelines_stop(
882        &self,
883        request: GoogleCloudDatapipelinesV1StopPipelineRequest,
884        name: &str,
885    ) -> ProjectLocationPipelineStopCall<'a, C> {
886        ProjectLocationPipelineStopCall {
887            hub: self.hub,
888            _request: request,
889            _name: name.to_string(),
890            _delegate: Default::default(),
891            _additional_params: Default::default(),
892            _scopes: Default::default(),
893        }
894    }
895}
896
897// ###################
898// CallBuilders   ###
899// #################
900
901/// Lists jobs for a given pipeline. Throws a "FORBIDDEN" error if the caller doesn't have permission to access it.
902///
903/// A builder for the *locations.pipelines.jobs.list* method supported by a *project* resource.
904/// It is not used directly, but through a [`ProjectMethods`] instance.
905///
906/// # Example
907///
908/// Instantiate a resource method builder
909///
910/// ```test_harness,no_run
911/// # extern crate hyper;
912/// # extern crate hyper_rustls;
913/// # extern crate google_datapipelines1 as datapipelines1;
914/// # async fn dox() {
915/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
916///
917/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
918/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
919/// #     secret,
920/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
921/// # ).build().await.unwrap();
922///
923/// # let client = hyper_util::client::legacy::Client::builder(
924/// #     hyper_util::rt::TokioExecutor::new()
925/// # )
926/// # .build(
927/// #     hyper_rustls::HttpsConnectorBuilder::new()
928/// #         .with_native_roots()
929/// #         .unwrap()
930/// #         .https_or_http()
931/// #         .enable_http1()
932/// #         .build()
933/// # );
934/// # let mut hub = Datapipelines::new(client, auth);
935/// // You can configure optional parameters by calling the respective setters at will, and
936/// // execute the final call using `doit()`.
937/// // Values shown here are possibly random and not representative !
938/// let result = hub.projects().locations_pipelines_jobs_list("parent")
939///              .page_token("voluptua.")
940///              .page_size(-27)
941///              .doit().await;
942/// # }
943/// ```
944pub struct ProjectLocationPipelineJobListCall<'a, C>
945where
946    C: 'a,
947{
948    hub: &'a Datapipelines<C>,
949    _parent: String,
950    _page_token: Option<String>,
951    _page_size: Option<i32>,
952    _delegate: Option<&'a mut dyn common::Delegate>,
953    _additional_params: HashMap<String, String>,
954    _scopes: BTreeSet<String>,
955}
956
957impl<'a, C> common::CallBuilder for ProjectLocationPipelineJobListCall<'a, C> {}
958
959impl<'a, C> ProjectLocationPipelineJobListCall<'a, C>
960where
961    C: common::Connector,
962{
963    /// Perform the operation you have build so far.
964    pub async fn doit(
965        mut self,
966    ) -> common::Result<(common::Response, GoogleCloudDatapipelinesV1ListJobsResponse)> {
967        use std::borrow::Cow;
968        use std::io::{Read, Seek};
969
970        use common::{url::Params, ToParts};
971        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
972
973        let mut dd = common::DefaultDelegate;
974        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
975        dlg.begin(common::MethodInfo {
976            id: "datapipelines.projects.locations.pipelines.jobs.list",
977            http_method: hyper::Method::GET,
978        });
979
980        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
981            if self._additional_params.contains_key(field) {
982                dlg.finished(false);
983                return Err(common::Error::FieldClash(field));
984            }
985        }
986
987        let mut params = Params::with_capacity(5 + self._additional_params.len());
988        params.push("parent", self._parent);
989        if let Some(value) = self._page_token.as_ref() {
990            params.push("pageToken", value);
991        }
992        if let Some(value) = self._page_size.as_ref() {
993            params.push("pageSize", value.to_string());
994        }
995
996        params.extend(self._additional_params.iter());
997
998        params.push("alt", "json");
999        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobs";
1000        if self._scopes.is_empty() {
1001            self._scopes
1002                .insert(Scope::CloudPlatform.as_ref().to_string());
1003        }
1004
1005        #[allow(clippy::single_element_loop)]
1006        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1007            url = params.uri_replacement(url, param_name, find_this, true);
1008        }
1009        {
1010            let to_remove = ["parent"];
1011            params.remove_params(&to_remove);
1012        }
1013
1014        let url = params.parse_with_url(&url);
1015
1016        loop {
1017            let token = match self
1018                .hub
1019                .auth
1020                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1021                .await
1022            {
1023                Ok(token) => token,
1024                Err(e) => match dlg.token(e) {
1025                    Ok(token) => token,
1026                    Err(e) => {
1027                        dlg.finished(false);
1028                        return Err(common::Error::MissingToken(e));
1029                    }
1030                },
1031            };
1032            let mut req_result = {
1033                let client = &self.hub.client;
1034                dlg.pre_request();
1035                let mut req_builder = hyper::Request::builder()
1036                    .method(hyper::Method::GET)
1037                    .uri(url.as_str())
1038                    .header(USER_AGENT, self.hub._user_agent.clone());
1039
1040                if let Some(token) = token.as_ref() {
1041                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1042                }
1043
1044                let request = req_builder
1045                    .header(CONTENT_LENGTH, 0_u64)
1046                    .body(common::to_body::<String>(None));
1047
1048                client.request(request.unwrap()).await
1049            };
1050
1051            match req_result {
1052                Err(err) => {
1053                    if let common::Retry::After(d) = dlg.http_error(&err) {
1054                        sleep(d).await;
1055                        continue;
1056                    }
1057                    dlg.finished(false);
1058                    return Err(common::Error::HttpError(err));
1059                }
1060                Ok(res) => {
1061                    let (mut parts, body) = res.into_parts();
1062                    let mut body = common::Body::new(body);
1063                    if !parts.status.is_success() {
1064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1065                        let error = serde_json::from_str(&common::to_string(&bytes));
1066                        let response = common::to_response(parts, bytes.into());
1067
1068                        if let common::Retry::After(d) =
1069                            dlg.http_failure(&response, error.as_ref().ok())
1070                        {
1071                            sleep(d).await;
1072                            continue;
1073                        }
1074
1075                        dlg.finished(false);
1076
1077                        return Err(match error {
1078                            Ok(value) => common::Error::BadRequest(value),
1079                            _ => common::Error::Failure(response),
1080                        });
1081                    }
1082                    let response = {
1083                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1084                        let encoded = common::to_string(&bytes);
1085                        match serde_json::from_str(&encoded) {
1086                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1087                            Err(error) => {
1088                                dlg.response_json_decode_error(&encoded, &error);
1089                                return Err(common::Error::JsonDecodeError(
1090                                    encoded.to_string(),
1091                                    error,
1092                                ));
1093                            }
1094                        }
1095                    };
1096
1097                    dlg.finished(true);
1098                    return Ok(response);
1099                }
1100            }
1101        }
1102    }
1103
1104    /// Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
1105    ///
1106    /// Sets the *parent* path property to the given value.
1107    ///
1108    /// Even though the property as already been set when instantiating this call,
1109    /// we provide this method for API completeness.
1110    pub fn parent(mut self, new_value: &str) -> ProjectLocationPipelineJobListCall<'a, C> {
1111        self._parent = new_value.to_string();
1112        self
1113    }
1114    /// A page token, received from a previous `ListJobs` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListJobs` must match the call that provided the page token.
1115    ///
1116    /// Sets the *page token* query property to the given value.
1117    pub fn page_token(mut self, new_value: &str) -> ProjectLocationPipelineJobListCall<'a, C> {
1118        self._page_token = Some(new_value.to_string());
1119        self
1120    }
1121    /// The maximum number of entities to return. The service may return fewer than this value, even if there are additional pages. If unspecified, the max limit will be determined by the backend implementation.
1122    ///
1123    /// Sets the *page size* query property to the given value.
1124    pub fn page_size(mut self, new_value: i32) -> ProjectLocationPipelineJobListCall<'a, C> {
1125        self._page_size = Some(new_value);
1126        self
1127    }
1128    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1129    /// while executing the actual API request.
1130    ///
1131    /// ````text
1132    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1133    /// ````
1134    ///
1135    /// Sets the *delegate* property to the given value.
1136    pub fn delegate(
1137        mut self,
1138        new_value: &'a mut dyn common::Delegate,
1139    ) -> ProjectLocationPipelineJobListCall<'a, C> {
1140        self._delegate = Some(new_value);
1141        self
1142    }
1143
1144    /// Set any additional parameter of the query string used in the request.
1145    /// It should be used to set parameters which are not yet available through their own
1146    /// setters.
1147    ///
1148    /// Please note that this method must not be used to set any of the known parameters
1149    /// which have their own setter method. If done anyway, the request will fail.
1150    ///
1151    /// # Additional Parameters
1152    ///
1153    /// * *$.xgafv* (query-string) - V1 error format.
1154    /// * *access_token* (query-string) - OAuth access token.
1155    /// * *alt* (query-string) - Data format for response.
1156    /// * *callback* (query-string) - JSONP
1157    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1158    /// * *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.
1159    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1160    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1161    /// * *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.
1162    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1163    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1164    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineJobListCall<'a, C>
1165    where
1166        T: AsRef<str>,
1167    {
1168        self._additional_params
1169            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1170        self
1171    }
1172
1173    /// Identifies the authorization scope for the method you are building.
1174    ///
1175    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1176    /// [`Scope::CloudPlatform`].
1177    ///
1178    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1179    /// tokens for more than one scope.
1180    ///
1181    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1182    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1183    /// sufficient, a read-write scope will do as well.
1184    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineJobListCall<'a, C>
1185    where
1186        St: AsRef<str>,
1187    {
1188        self._scopes.insert(String::from(scope.as_ref()));
1189        self
1190    }
1191    /// Identifies the authorization scope(s) for the method you are building.
1192    ///
1193    /// See [`Self::add_scope()`] for details.
1194    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineJobListCall<'a, C>
1195    where
1196        I: IntoIterator<Item = St>,
1197        St: AsRef<str>,
1198    {
1199        self._scopes
1200            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1201        self
1202    }
1203
1204    /// Removes all scopes, and no default scope will be used either.
1205    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1206    /// for details).
1207    pub fn clear_scopes(mut self) -> ProjectLocationPipelineJobListCall<'a, C> {
1208        self._scopes.clear();
1209        self
1210    }
1211}
1212
1213/// Creates a pipeline. For a batch pipeline, you can pass scheduler information. Data Pipelines uses the scheduler information to create an internal scheduler that runs jobs periodically. If the internal scheduler is not configured, you can use RunPipeline to run jobs.
1214///
1215/// A builder for the *locations.pipelines.create* method supported by a *project* resource.
1216/// It is not used directly, but through a [`ProjectMethods`] instance.
1217///
1218/// # Example
1219///
1220/// Instantiate a resource method builder
1221///
1222/// ```test_harness,no_run
1223/// # extern crate hyper;
1224/// # extern crate hyper_rustls;
1225/// # extern crate google_datapipelines1 as datapipelines1;
1226/// use datapipelines1::api::GoogleCloudDatapipelinesV1Pipeline;
1227/// # async fn dox() {
1228/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1229///
1230/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1232/// #     secret,
1233/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1234/// # ).build().await.unwrap();
1235///
1236/// # let client = hyper_util::client::legacy::Client::builder(
1237/// #     hyper_util::rt::TokioExecutor::new()
1238/// # )
1239/// # .build(
1240/// #     hyper_rustls::HttpsConnectorBuilder::new()
1241/// #         .with_native_roots()
1242/// #         .unwrap()
1243/// #         .https_or_http()
1244/// #         .enable_http1()
1245/// #         .build()
1246/// # );
1247/// # let mut hub = Datapipelines::new(client, auth);
1248/// // As the method needs a request, you would usually fill it with the desired information
1249/// // into the respective structure. Some of the parts shown here might not be applicable !
1250/// // Values shown here are possibly random and not representative !
1251/// let mut req = GoogleCloudDatapipelinesV1Pipeline::default();
1252///
1253/// // You can configure optional parameters by calling the respective setters at will, and
1254/// // execute the final call using `doit()`.
1255/// // Values shown here are possibly random and not representative !
1256/// let result = hub.projects().locations_pipelines_create(req, "parent")
1257///              .doit().await;
1258/// # }
1259/// ```
1260pub struct ProjectLocationPipelineCreateCall<'a, C>
1261where
1262    C: 'a,
1263{
1264    hub: &'a Datapipelines<C>,
1265    _request: GoogleCloudDatapipelinesV1Pipeline,
1266    _parent: String,
1267    _delegate: Option<&'a mut dyn common::Delegate>,
1268    _additional_params: HashMap<String, String>,
1269    _scopes: BTreeSet<String>,
1270}
1271
1272impl<'a, C> common::CallBuilder for ProjectLocationPipelineCreateCall<'a, C> {}
1273
1274impl<'a, C> ProjectLocationPipelineCreateCall<'a, C>
1275where
1276    C: common::Connector,
1277{
1278    /// Perform the operation you have build so far.
1279    pub async fn doit(
1280        mut self,
1281    ) -> common::Result<(common::Response, GoogleCloudDatapipelinesV1Pipeline)> {
1282        use std::borrow::Cow;
1283        use std::io::{Read, Seek};
1284
1285        use common::{url::Params, ToParts};
1286        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1287
1288        let mut dd = common::DefaultDelegate;
1289        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1290        dlg.begin(common::MethodInfo {
1291            id: "datapipelines.projects.locations.pipelines.create",
1292            http_method: hyper::Method::POST,
1293        });
1294
1295        for &field in ["alt", "parent"].iter() {
1296            if self._additional_params.contains_key(field) {
1297                dlg.finished(false);
1298                return Err(common::Error::FieldClash(field));
1299            }
1300        }
1301
1302        let mut params = Params::with_capacity(4 + self._additional_params.len());
1303        params.push("parent", self._parent);
1304
1305        params.extend(self._additional_params.iter());
1306
1307        params.push("alt", "json");
1308        let mut url = self.hub._base_url.clone() + "v1/{+parent}/pipelines";
1309        if self._scopes.is_empty() {
1310            self._scopes
1311                .insert(Scope::CloudPlatform.as_ref().to_string());
1312        }
1313
1314        #[allow(clippy::single_element_loop)]
1315        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1316            url = params.uri_replacement(url, param_name, find_this, true);
1317        }
1318        {
1319            let to_remove = ["parent"];
1320            params.remove_params(&to_remove);
1321        }
1322
1323        let url = params.parse_with_url(&url);
1324
1325        let mut json_mime_type = mime::APPLICATION_JSON;
1326        let mut request_value_reader = {
1327            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1328            common::remove_json_null_values(&mut value);
1329            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1330            serde_json::to_writer(&mut dst, &value).unwrap();
1331            dst
1332        };
1333        let request_size = request_value_reader
1334            .seek(std::io::SeekFrom::End(0))
1335            .unwrap();
1336        request_value_reader
1337            .seek(std::io::SeekFrom::Start(0))
1338            .unwrap();
1339
1340        loop {
1341            let token = match self
1342                .hub
1343                .auth
1344                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1345                .await
1346            {
1347                Ok(token) => token,
1348                Err(e) => match dlg.token(e) {
1349                    Ok(token) => token,
1350                    Err(e) => {
1351                        dlg.finished(false);
1352                        return Err(common::Error::MissingToken(e));
1353                    }
1354                },
1355            };
1356            request_value_reader
1357                .seek(std::io::SeekFrom::Start(0))
1358                .unwrap();
1359            let mut req_result = {
1360                let client = &self.hub.client;
1361                dlg.pre_request();
1362                let mut req_builder = hyper::Request::builder()
1363                    .method(hyper::Method::POST)
1364                    .uri(url.as_str())
1365                    .header(USER_AGENT, self.hub._user_agent.clone());
1366
1367                if let Some(token) = token.as_ref() {
1368                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1369                }
1370
1371                let request = req_builder
1372                    .header(CONTENT_TYPE, json_mime_type.to_string())
1373                    .header(CONTENT_LENGTH, request_size as u64)
1374                    .body(common::to_body(
1375                        request_value_reader.get_ref().clone().into(),
1376                    ));
1377
1378                client.request(request.unwrap()).await
1379            };
1380
1381            match req_result {
1382                Err(err) => {
1383                    if let common::Retry::After(d) = dlg.http_error(&err) {
1384                        sleep(d).await;
1385                        continue;
1386                    }
1387                    dlg.finished(false);
1388                    return Err(common::Error::HttpError(err));
1389                }
1390                Ok(res) => {
1391                    let (mut parts, body) = res.into_parts();
1392                    let mut body = common::Body::new(body);
1393                    if !parts.status.is_success() {
1394                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1395                        let error = serde_json::from_str(&common::to_string(&bytes));
1396                        let response = common::to_response(parts, bytes.into());
1397
1398                        if let common::Retry::After(d) =
1399                            dlg.http_failure(&response, error.as_ref().ok())
1400                        {
1401                            sleep(d).await;
1402                            continue;
1403                        }
1404
1405                        dlg.finished(false);
1406
1407                        return Err(match error {
1408                            Ok(value) => common::Error::BadRequest(value),
1409                            _ => common::Error::Failure(response),
1410                        });
1411                    }
1412                    let response = {
1413                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1414                        let encoded = common::to_string(&bytes);
1415                        match serde_json::from_str(&encoded) {
1416                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1417                            Err(error) => {
1418                                dlg.response_json_decode_error(&encoded, &error);
1419                                return Err(common::Error::JsonDecodeError(
1420                                    encoded.to_string(),
1421                                    error,
1422                                ));
1423                            }
1424                        }
1425                    };
1426
1427                    dlg.finished(true);
1428                    return Ok(response);
1429                }
1430            }
1431        }
1432    }
1433
1434    ///
1435    /// Sets the *request* property to the given value.
1436    ///
1437    /// Even though the property as already been set when instantiating this call,
1438    /// we provide this method for API completeness.
1439    pub fn request(
1440        mut self,
1441        new_value: GoogleCloudDatapipelinesV1Pipeline,
1442    ) -> ProjectLocationPipelineCreateCall<'a, C> {
1443        self._request = new_value;
1444        self
1445    }
1446    /// Required. The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
1447    ///
1448    /// Sets the *parent* path property to the given value.
1449    ///
1450    /// Even though the property as already been set when instantiating this call,
1451    /// we provide this method for API completeness.
1452    pub fn parent(mut self, new_value: &str) -> ProjectLocationPipelineCreateCall<'a, C> {
1453        self._parent = new_value.to_string();
1454        self
1455    }
1456    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1457    /// while executing the actual API request.
1458    ///
1459    /// ````text
1460    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1461    /// ````
1462    ///
1463    /// Sets the *delegate* property to the given value.
1464    pub fn delegate(
1465        mut self,
1466        new_value: &'a mut dyn common::Delegate,
1467    ) -> ProjectLocationPipelineCreateCall<'a, C> {
1468        self._delegate = Some(new_value);
1469        self
1470    }
1471
1472    /// Set any additional parameter of the query string used in the request.
1473    /// It should be used to set parameters which are not yet available through their own
1474    /// setters.
1475    ///
1476    /// Please note that this method must not be used to set any of the known parameters
1477    /// which have their own setter method. If done anyway, the request will fail.
1478    ///
1479    /// # Additional Parameters
1480    ///
1481    /// * *$.xgafv* (query-string) - V1 error format.
1482    /// * *access_token* (query-string) - OAuth access token.
1483    /// * *alt* (query-string) - Data format for response.
1484    /// * *callback* (query-string) - JSONP
1485    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1486    /// * *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.
1487    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1488    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1489    /// * *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.
1490    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1491    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1492    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineCreateCall<'a, C>
1493    where
1494        T: AsRef<str>,
1495    {
1496        self._additional_params
1497            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1498        self
1499    }
1500
1501    /// Identifies the authorization scope for the method you are building.
1502    ///
1503    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1504    /// [`Scope::CloudPlatform`].
1505    ///
1506    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1507    /// tokens for more than one scope.
1508    ///
1509    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1510    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1511    /// sufficient, a read-write scope will do as well.
1512    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineCreateCall<'a, C>
1513    where
1514        St: AsRef<str>,
1515    {
1516        self._scopes.insert(String::from(scope.as_ref()));
1517        self
1518    }
1519    /// Identifies the authorization scope(s) for the method you are building.
1520    ///
1521    /// See [`Self::add_scope()`] for details.
1522    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineCreateCall<'a, C>
1523    where
1524        I: IntoIterator<Item = St>,
1525        St: AsRef<str>,
1526    {
1527        self._scopes
1528            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1529        self
1530    }
1531
1532    /// Removes all scopes, and no default scope will be used either.
1533    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1534    /// for details).
1535    pub fn clear_scopes(mut self) -> ProjectLocationPipelineCreateCall<'a, C> {
1536        self._scopes.clear();
1537        self
1538    }
1539}
1540
1541/// Deletes a pipeline. If a scheduler job is attached to the pipeline, it will be deleted.
1542///
1543/// A builder for the *locations.pipelines.delete* method supported by a *project* resource.
1544/// It is not used directly, but through a [`ProjectMethods`] instance.
1545///
1546/// # Example
1547///
1548/// Instantiate a resource method builder
1549///
1550/// ```test_harness,no_run
1551/// # extern crate hyper;
1552/// # extern crate hyper_rustls;
1553/// # extern crate google_datapipelines1 as datapipelines1;
1554/// # async fn dox() {
1555/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1556///
1557/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1558/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1559/// #     secret,
1560/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1561/// # ).build().await.unwrap();
1562///
1563/// # let client = hyper_util::client::legacy::Client::builder(
1564/// #     hyper_util::rt::TokioExecutor::new()
1565/// # )
1566/// # .build(
1567/// #     hyper_rustls::HttpsConnectorBuilder::new()
1568/// #         .with_native_roots()
1569/// #         .unwrap()
1570/// #         .https_or_http()
1571/// #         .enable_http1()
1572/// #         .build()
1573/// # );
1574/// # let mut hub = Datapipelines::new(client, auth);
1575/// // You can configure optional parameters by calling the respective setters at will, and
1576/// // execute the final call using `doit()`.
1577/// // Values shown here are possibly random and not representative !
1578/// let result = hub.projects().locations_pipelines_delete("name")
1579///              .doit().await;
1580/// # }
1581/// ```
1582pub struct ProjectLocationPipelineDeleteCall<'a, C>
1583where
1584    C: 'a,
1585{
1586    hub: &'a Datapipelines<C>,
1587    _name: String,
1588    _delegate: Option<&'a mut dyn common::Delegate>,
1589    _additional_params: HashMap<String, String>,
1590    _scopes: BTreeSet<String>,
1591}
1592
1593impl<'a, C> common::CallBuilder for ProjectLocationPipelineDeleteCall<'a, C> {}
1594
1595impl<'a, C> ProjectLocationPipelineDeleteCall<'a, C>
1596where
1597    C: common::Connector,
1598{
1599    /// Perform the operation you have build so far.
1600    pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
1601        use std::borrow::Cow;
1602        use std::io::{Read, Seek};
1603
1604        use common::{url::Params, ToParts};
1605        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1606
1607        let mut dd = common::DefaultDelegate;
1608        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1609        dlg.begin(common::MethodInfo {
1610            id: "datapipelines.projects.locations.pipelines.delete",
1611            http_method: hyper::Method::DELETE,
1612        });
1613
1614        for &field in ["alt", "name"].iter() {
1615            if self._additional_params.contains_key(field) {
1616                dlg.finished(false);
1617                return Err(common::Error::FieldClash(field));
1618            }
1619        }
1620
1621        let mut params = Params::with_capacity(3 + self._additional_params.len());
1622        params.push("name", self._name);
1623
1624        params.extend(self._additional_params.iter());
1625
1626        params.push("alt", "json");
1627        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1628        if self._scopes.is_empty() {
1629            self._scopes
1630                .insert(Scope::CloudPlatform.as_ref().to_string());
1631        }
1632
1633        #[allow(clippy::single_element_loop)]
1634        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1635            url = params.uri_replacement(url, param_name, find_this, true);
1636        }
1637        {
1638            let to_remove = ["name"];
1639            params.remove_params(&to_remove);
1640        }
1641
1642        let url = params.parse_with_url(&url);
1643
1644        loop {
1645            let token = match self
1646                .hub
1647                .auth
1648                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1649                .await
1650            {
1651                Ok(token) => token,
1652                Err(e) => match dlg.token(e) {
1653                    Ok(token) => token,
1654                    Err(e) => {
1655                        dlg.finished(false);
1656                        return Err(common::Error::MissingToken(e));
1657                    }
1658                },
1659            };
1660            let mut req_result = {
1661                let client = &self.hub.client;
1662                dlg.pre_request();
1663                let mut req_builder = hyper::Request::builder()
1664                    .method(hyper::Method::DELETE)
1665                    .uri(url.as_str())
1666                    .header(USER_AGENT, self.hub._user_agent.clone());
1667
1668                if let Some(token) = token.as_ref() {
1669                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1670                }
1671
1672                let request = req_builder
1673                    .header(CONTENT_LENGTH, 0_u64)
1674                    .body(common::to_body::<String>(None));
1675
1676                client.request(request.unwrap()).await
1677            };
1678
1679            match req_result {
1680                Err(err) => {
1681                    if let common::Retry::After(d) = dlg.http_error(&err) {
1682                        sleep(d).await;
1683                        continue;
1684                    }
1685                    dlg.finished(false);
1686                    return Err(common::Error::HttpError(err));
1687                }
1688                Ok(res) => {
1689                    let (mut parts, body) = res.into_parts();
1690                    let mut body = common::Body::new(body);
1691                    if !parts.status.is_success() {
1692                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1693                        let error = serde_json::from_str(&common::to_string(&bytes));
1694                        let response = common::to_response(parts, bytes.into());
1695
1696                        if let common::Retry::After(d) =
1697                            dlg.http_failure(&response, error.as_ref().ok())
1698                        {
1699                            sleep(d).await;
1700                            continue;
1701                        }
1702
1703                        dlg.finished(false);
1704
1705                        return Err(match error {
1706                            Ok(value) => common::Error::BadRequest(value),
1707                            _ => common::Error::Failure(response),
1708                        });
1709                    }
1710                    let response = {
1711                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1712                        let encoded = common::to_string(&bytes);
1713                        match serde_json::from_str(&encoded) {
1714                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1715                            Err(error) => {
1716                                dlg.response_json_decode_error(&encoded, &error);
1717                                return Err(common::Error::JsonDecodeError(
1718                                    encoded.to_string(),
1719                                    error,
1720                                ));
1721                            }
1722                        }
1723                    };
1724
1725                    dlg.finished(true);
1726                    return Ok(response);
1727                }
1728            }
1729        }
1730    }
1731
1732    /// Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
1733    ///
1734    /// Sets the *name* path property to the given value.
1735    ///
1736    /// Even though the property as already been set when instantiating this call,
1737    /// we provide this method for API completeness.
1738    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineDeleteCall<'a, C> {
1739        self._name = new_value.to_string();
1740        self
1741    }
1742    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1743    /// while executing the actual API request.
1744    ///
1745    /// ````text
1746    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1747    /// ````
1748    ///
1749    /// Sets the *delegate* property to the given value.
1750    pub fn delegate(
1751        mut self,
1752        new_value: &'a mut dyn common::Delegate,
1753    ) -> ProjectLocationPipelineDeleteCall<'a, C> {
1754        self._delegate = Some(new_value);
1755        self
1756    }
1757
1758    /// Set any additional parameter of the query string used in the request.
1759    /// It should be used to set parameters which are not yet available through their own
1760    /// setters.
1761    ///
1762    /// Please note that this method must not be used to set any of the known parameters
1763    /// which have their own setter method. If done anyway, the request will fail.
1764    ///
1765    /// # Additional Parameters
1766    ///
1767    /// * *$.xgafv* (query-string) - V1 error format.
1768    /// * *access_token* (query-string) - OAuth access token.
1769    /// * *alt* (query-string) - Data format for response.
1770    /// * *callback* (query-string) - JSONP
1771    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1772    /// * *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.
1773    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1774    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1775    /// * *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.
1776    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1777    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1778    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineDeleteCall<'a, C>
1779    where
1780        T: AsRef<str>,
1781    {
1782        self._additional_params
1783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1784        self
1785    }
1786
1787    /// Identifies the authorization scope for the method you are building.
1788    ///
1789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1790    /// [`Scope::CloudPlatform`].
1791    ///
1792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1793    /// tokens for more than one scope.
1794    ///
1795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1797    /// sufficient, a read-write scope will do as well.
1798    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineDeleteCall<'a, C>
1799    where
1800        St: AsRef<str>,
1801    {
1802        self._scopes.insert(String::from(scope.as_ref()));
1803        self
1804    }
1805    /// Identifies the authorization scope(s) for the method you are building.
1806    ///
1807    /// See [`Self::add_scope()`] for details.
1808    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineDeleteCall<'a, C>
1809    where
1810        I: IntoIterator<Item = St>,
1811        St: AsRef<str>,
1812    {
1813        self._scopes
1814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1815        self
1816    }
1817
1818    /// Removes all scopes, and no default scope will be used either.
1819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1820    /// for details).
1821    pub fn clear_scopes(mut self) -> ProjectLocationPipelineDeleteCall<'a, C> {
1822        self._scopes.clear();
1823        self
1824    }
1825}
1826
1827/// Looks up a single pipeline. Returns a "NOT_FOUND" error if no such pipeline exists. Returns a "FORBIDDEN" error if the caller doesn't have permission to access it.
1828///
1829/// A builder for the *locations.pipelines.get* method supported by a *project* resource.
1830/// It is not used directly, but through a [`ProjectMethods`] instance.
1831///
1832/// # Example
1833///
1834/// Instantiate a resource method builder
1835///
1836/// ```test_harness,no_run
1837/// # extern crate hyper;
1838/// # extern crate hyper_rustls;
1839/// # extern crate google_datapipelines1 as datapipelines1;
1840/// # async fn dox() {
1841/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1842///
1843/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1845/// #     secret,
1846/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1847/// # ).build().await.unwrap();
1848///
1849/// # let client = hyper_util::client::legacy::Client::builder(
1850/// #     hyper_util::rt::TokioExecutor::new()
1851/// # )
1852/// # .build(
1853/// #     hyper_rustls::HttpsConnectorBuilder::new()
1854/// #         .with_native_roots()
1855/// #         .unwrap()
1856/// #         .https_or_http()
1857/// #         .enable_http1()
1858/// #         .build()
1859/// # );
1860/// # let mut hub = Datapipelines::new(client, auth);
1861/// // You can configure optional parameters by calling the respective setters at will, and
1862/// // execute the final call using `doit()`.
1863/// // Values shown here are possibly random and not representative !
1864/// let result = hub.projects().locations_pipelines_get("name")
1865///              .doit().await;
1866/// # }
1867/// ```
1868pub struct ProjectLocationPipelineGetCall<'a, C>
1869where
1870    C: 'a,
1871{
1872    hub: &'a Datapipelines<C>,
1873    _name: String,
1874    _delegate: Option<&'a mut dyn common::Delegate>,
1875    _additional_params: HashMap<String, String>,
1876    _scopes: BTreeSet<String>,
1877}
1878
1879impl<'a, C> common::CallBuilder for ProjectLocationPipelineGetCall<'a, C> {}
1880
1881impl<'a, C> ProjectLocationPipelineGetCall<'a, C>
1882where
1883    C: common::Connector,
1884{
1885    /// Perform the operation you have build so far.
1886    pub async fn doit(
1887        mut self,
1888    ) -> common::Result<(common::Response, GoogleCloudDatapipelinesV1Pipeline)> {
1889        use std::borrow::Cow;
1890        use std::io::{Read, Seek};
1891
1892        use common::{url::Params, ToParts};
1893        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1894
1895        let mut dd = common::DefaultDelegate;
1896        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1897        dlg.begin(common::MethodInfo {
1898            id: "datapipelines.projects.locations.pipelines.get",
1899            http_method: hyper::Method::GET,
1900        });
1901
1902        for &field in ["alt", "name"].iter() {
1903            if self._additional_params.contains_key(field) {
1904                dlg.finished(false);
1905                return Err(common::Error::FieldClash(field));
1906            }
1907        }
1908
1909        let mut params = Params::with_capacity(3 + self._additional_params.len());
1910        params.push("name", self._name);
1911
1912        params.extend(self._additional_params.iter());
1913
1914        params.push("alt", "json");
1915        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1916        if self._scopes.is_empty() {
1917            self._scopes
1918                .insert(Scope::CloudPlatform.as_ref().to_string());
1919        }
1920
1921        #[allow(clippy::single_element_loop)]
1922        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1923            url = params.uri_replacement(url, param_name, find_this, true);
1924        }
1925        {
1926            let to_remove = ["name"];
1927            params.remove_params(&to_remove);
1928        }
1929
1930        let url = params.parse_with_url(&url);
1931
1932        loop {
1933            let token = match self
1934                .hub
1935                .auth
1936                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1937                .await
1938            {
1939                Ok(token) => token,
1940                Err(e) => match dlg.token(e) {
1941                    Ok(token) => token,
1942                    Err(e) => {
1943                        dlg.finished(false);
1944                        return Err(common::Error::MissingToken(e));
1945                    }
1946                },
1947            };
1948            let mut req_result = {
1949                let client = &self.hub.client;
1950                dlg.pre_request();
1951                let mut req_builder = hyper::Request::builder()
1952                    .method(hyper::Method::GET)
1953                    .uri(url.as_str())
1954                    .header(USER_AGENT, self.hub._user_agent.clone());
1955
1956                if let Some(token) = token.as_ref() {
1957                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1958                }
1959
1960                let request = req_builder
1961                    .header(CONTENT_LENGTH, 0_u64)
1962                    .body(common::to_body::<String>(None));
1963
1964                client.request(request.unwrap()).await
1965            };
1966
1967            match req_result {
1968                Err(err) => {
1969                    if let common::Retry::After(d) = dlg.http_error(&err) {
1970                        sleep(d).await;
1971                        continue;
1972                    }
1973                    dlg.finished(false);
1974                    return Err(common::Error::HttpError(err));
1975                }
1976                Ok(res) => {
1977                    let (mut parts, body) = res.into_parts();
1978                    let mut body = common::Body::new(body);
1979                    if !parts.status.is_success() {
1980                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1981                        let error = serde_json::from_str(&common::to_string(&bytes));
1982                        let response = common::to_response(parts, bytes.into());
1983
1984                        if let common::Retry::After(d) =
1985                            dlg.http_failure(&response, error.as_ref().ok())
1986                        {
1987                            sleep(d).await;
1988                            continue;
1989                        }
1990
1991                        dlg.finished(false);
1992
1993                        return Err(match error {
1994                            Ok(value) => common::Error::BadRequest(value),
1995                            _ => common::Error::Failure(response),
1996                        });
1997                    }
1998                    let response = {
1999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2000                        let encoded = common::to_string(&bytes);
2001                        match serde_json::from_str(&encoded) {
2002                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2003                            Err(error) => {
2004                                dlg.response_json_decode_error(&encoded, &error);
2005                                return Err(common::Error::JsonDecodeError(
2006                                    encoded.to_string(),
2007                                    error,
2008                                ));
2009                            }
2010                        }
2011                    };
2012
2013                    dlg.finished(true);
2014                    return Ok(response);
2015                }
2016            }
2017        }
2018    }
2019
2020    /// Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
2021    ///
2022    /// Sets the *name* path property to the given value.
2023    ///
2024    /// Even though the property as already been set when instantiating this call,
2025    /// we provide this method for API completeness.
2026    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineGetCall<'a, C> {
2027        self._name = new_value.to_string();
2028        self
2029    }
2030    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2031    /// while executing the actual API request.
2032    ///
2033    /// ````text
2034    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2035    /// ````
2036    ///
2037    /// Sets the *delegate* property to the given value.
2038    pub fn delegate(
2039        mut self,
2040        new_value: &'a mut dyn common::Delegate,
2041    ) -> ProjectLocationPipelineGetCall<'a, C> {
2042        self._delegate = Some(new_value);
2043        self
2044    }
2045
2046    /// Set any additional parameter of the query string used in the request.
2047    /// It should be used to set parameters which are not yet available through their own
2048    /// setters.
2049    ///
2050    /// Please note that this method must not be used to set any of the known parameters
2051    /// which have their own setter method. If done anyway, the request will fail.
2052    ///
2053    /// # Additional Parameters
2054    ///
2055    /// * *$.xgafv* (query-string) - V1 error format.
2056    /// * *access_token* (query-string) - OAuth access token.
2057    /// * *alt* (query-string) - Data format for response.
2058    /// * *callback* (query-string) - JSONP
2059    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2060    /// * *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.
2061    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2062    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2063    /// * *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.
2064    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2065    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2066    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineGetCall<'a, C>
2067    where
2068        T: AsRef<str>,
2069    {
2070        self._additional_params
2071            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2072        self
2073    }
2074
2075    /// Identifies the authorization scope for the method you are building.
2076    ///
2077    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2078    /// [`Scope::CloudPlatform`].
2079    ///
2080    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2081    /// tokens for more than one scope.
2082    ///
2083    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2084    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2085    /// sufficient, a read-write scope will do as well.
2086    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineGetCall<'a, C>
2087    where
2088        St: AsRef<str>,
2089    {
2090        self._scopes.insert(String::from(scope.as_ref()));
2091        self
2092    }
2093    /// Identifies the authorization scope(s) for the method you are building.
2094    ///
2095    /// See [`Self::add_scope()`] for details.
2096    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineGetCall<'a, C>
2097    where
2098        I: IntoIterator<Item = St>,
2099        St: AsRef<str>,
2100    {
2101        self._scopes
2102            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2103        self
2104    }
2105
2106    /// Removes all scopes, and no default scope will be used either.
2107    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2108    /// for details).
2109    pub fn clear_scopes(mut self) -> ProjectLocationPipelineGetCall<'a, C> {
2110        self._scopes.clear();
2111        self
2112    }
2113}
2114
2115/// Lists pipelines. Returns a "FORBIDDEN" error if the caller doesn't have permission to access it.
2116///
2117/// A builder for the *locations.pipelines.list* method supported by a *project* resource.
2118/// It is not used directly, but through a [`ProjectMethods`] instance.
2119///
2120/// # Example
2121///
2122/// Instantiate a resource method builder
2123///
2124/// ```test_harness,no_run
2125/// # extern crate hyper;
2126/// # extern crate hyper_rustls;
2127/// # extern crate google_datapipelines1 as datapipelines1;
2128/// # async fn dox() {
2129/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2130///
2131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2132/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2133/// #     secret,
2134/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2135/// # ).build().await.unwrap();
2136///
2137/// # let client = hyper_util::client::legacy::Client::builder(
2138/// #     hyper_util::rt::TokioExecutor::new()
2139/// # )
2140/// # .build(
2141/// #     hyper_rustls::HttpsConnectorBuilder::new()
2142/// #         .with_native_roots()
2143/// #         .unwrap()
2144/// #         .https_or_http()
2145/// #         .enable_http1()
2146/// #         .build()
2147/// # );
2148/// # let mut hub = Datapipelines::new(client, auth);
2149/// // You can configure optional parameters by calling the respective setters at will, and
2150/// // execute the final call using `doit()`.
2151/// // Values shown here are possibly random and not representative !
2152/// let result = hub.projects().locations_pipelines_list("parent")
2153///              .page_token("amet.")
2154///              .page_size(-20)
2155///              .filter("ipsum")
2156///              .doit().await;
2157/// # }
2158/// ```
2159pub struct ProjectLocationPipelineListCall<'a, C>
2160where
2161    C: 'a,
2162{
2163    hub: &'a Datapipelines<C>,
2164    _parent: String,
2165    _page_token: Option<String>,
2166    _page_size: Option<i32>,
2167    _filter: Option<String>,
2168    _delegate: Option<&'a mut dyn common::Delegate>,
2169    _additional_params: HashMap<String, String>,
2170    _scopes: BTreeSet<String>,
2171}
2172
2173impl<'a, C> common::CallBuilder for ProjectLocationPipelineListCall<'a, C> {}
2174
2175impl<'a, C> ProjectLocationPipelineListCall<'a, C>
2176where
2177    C: common::Connector,
2178{
2179    /// Perform the operation you have build so far.
2180    pub async fn doit(
2181        mut self,
2182    ) -> common::Result<(
2183        common::Response,
2184        GoogleCloudDatapipelinesV1ListPipelinesResponse,
2185    )> {
2186        use std::borrow::Cow;
2187        use std::io::{Read, Seek};
2188
2189        use common::{url::Params, ToParts};
2190        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2191
2192        let mut dd = common::DefaultDelegate;
2193        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2194        dlg.begin(common::MethodInfo {
2195            id: "datapipelines.projects.locations.pipelines.list",
2196            http_method: hyper::Method::GET,
2197        });
2198
2199        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
2200            if self._additional_params.contains_key(field) {
2201                dlg.finished(false);
2202                return Err(common::Error::FieldClash(field));
2203            }
2204        }
2205
2206        let mut params = Params::with_capacity(6 + self._additional_params.len());
2207        params.push("parent", self._parent);
2208        if let Some(value) = self._page_token.as_ref() {
2209            params.push("pageToken", value);
2210        }
2211        if let Some(value) = self._page_size.as_ref() {
2212            params.push("pageSize", value.to_string());
2213        }
2214        if let Some(value) = self._filter.as_ref() {
2215            params.push("filter", value);
2216        }
2217
2218        params.extend(self._additional_params.iter());
2219
2220        params.push("alt", "json");
2221        let mut url = self.hub._base_url.clone() + "v1/{+parent}/pipelines";
2222        if self._scopes.is_empty() {
2223            self._scopes
2224                .insert(Scope::CloudPlatform.as_ref().to_string());
2225        }
2226
2227        #[allow(clippy::single_element_loop)]
2228        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2229            url = params.uri_replacement(url, param_name, find_this, true);
2230        }
2231        {
2232            let to_remove = ["parent"];
2233            params.remove_params(&to_remove);
2234        }
2235
2236        let url = params.parse_with_url(&url);
2237
2238        loop {
2239            let token = match self
2240                .hub
2241                .auth
2242                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2243                .await
2244            {
2245                Ok(token) => token,
2246                Err(e) => match dlg.token(e) {
2247                    Ok(token) => token,
2248                    Err(e) => {
2249                        dlg.finished(false);
2250                        return Err(common::Error::MissingToken(e));
2251                    }
2252                },
2253            };
2254            let mut req_result = {
2255                let client = &self.hub.client;
2256                dlg.pre_request();
2257                let mut req_builder = hyper::Request::builder()
2258                    .method(hyper::Method::GET)
2259                    .uri(url.as_str())
2260                    .header(USER_AGENT, self.hub._user_agent.clone());
2261
2262                if let Some(token) = token.as_ref() {
2263                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2264                }
2265
2266                let request = req_builder
2267                    .header(CONTENT_LENGTH, 0_u64)
2268                    .body(common::to_body::<String>(None));
2269
2270                client.request(request.unwrap()).await
2271            };
2272
2273            match req_result {
2274                Err(err) => {
2275                    if let common::Retry::After(d) = dlg.http_error(&err) {
2276                        sleep(d).await;
2277                        continue;
2278                    }
2279                    dlg.finished(false);
2280                    return Err(common::Error::HttpError(err));
2281                }
2282                Ok(res) => {
2283                    let (mut parts, body) = res.into_parts();
2284                    let mut body = common::Body::new(body);
2285                    if !parts.status.is_success() {
2286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2287                        let error = serde_json::from_str(&common::to_string(&bytes));
2288                        let response = common::to_response(parts, bytes.into());
2289
2290                        if let common::Retry::After(d) =
2291                            dlg.http_failure(&response, error.as_ref().ok())
2292                        {
2293                            sleep(d).await;
2294                            continue;
2295                        }
2296
2297                        dlg.finished(false);
2298
2299                        return Err(match error {
2300                            Ok(value) => common::Error::BadRequest(value),
2301                            _ => common::Error::Failure(response),
2302                        });
2303                    }
2304                    let response = {
2305                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2306                        let encoded = common::to_string(&bytes);
2307                        match serde_json::from_str(&encoded) {
2308                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2309                            Err(error) => {
2310                                dlg.response_json_decode_error(&encoded, &error);
2311                                return Err(common::Error::JsonDecodeError(
2312                                    encoded.to_string(),
2313                                    error,
2314                                ));
2315                            }
2316                        }
2317                    };
2318
2319                    dlg.finished(true);
2320                    return Ok(response);
2321                }
2322            }
2323        }
2324    }
2325
2326    /// Required. The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
2327    ///
2328    /// Sets the *parent* path property to the given value.
2329    ///
2330    /// Even though the property as already been set when instantiating this call,
2331    /// we provide this method for API completeness.
2332    pub fn parent(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
2333        self._parent = new_value.to_string();
2334        self
2335    }
2336    /// A page token, received from a previous `ListPipelines` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPipelines` must match the call that provided the page token.
2337    ///
2338    /// Sets the *page token* query property to the given value.
2339    pub fn page_token(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
2340        self._page_token = Some(new_value.to_string());
2341        self
2342    }
2343    /// The maximum number of entities to return. The service may return fewer than this value, even if there are additional pages. If unspecified, the max limit is yet to be determined by the backend implementation.
2344    ///
2345    /// Sets the *page size* query property to the given value.
2346    pub fn page_size(mut self, new_value: i32) -> ProjectLocationPipelineListCall<'a, C> {
2347        self._page_size = Some(new_value);
2348        self
2349    }
2350    /// An expression for filtering the results of the request. If unspecified, all pipelines will be returned. Multiple filters can be applied and must be comma separated. Fields eligible for filtering are: + `type`: The type of the pipeline (streaming or batch). Allowed values are `ALL`, `BATCH`, and `STREAMING`. + `status`: The activity status of the pipeline. Allowed values are `ALL`, `ACTIVE`, `ARCHIVED`, and `PAUSED`. For example, to limit results to active batch processing pipelines: type:BATCH,status:ACTIVE
2351    ///
2352    /// Sets the *filter* query property to the given value.
2353    pub fn filter(mut self, new_value: &str) -> ProjectLocationPipelineListCall<'a, C> {
2354        self._filter = Some(new_value.to_string());
2355        self
2356    }
2357    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2358    /// while executing the actual API request.
2359    ///
2360    /// ````text
2361    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2362    /// ````
2363    ///
2364    /// Sets the *delegate* property to the given value.
2365    pub fn delegate(
2366        mut self,
2367        new_value: &'a mut dyn common::Delegate,
2368    ) -> ProjectLocationPipelineListCall<'a, C> {
2369        self._delegate = Some(new_value);
2370        self
2371    }
2372
2373    /// Set any additional parameter of the query string used in the request.
2374    /// It should be used to set parameters which are not yet available through their own
2375    /// setters.
2376    ///
2377    /// Please note that this method must not be used to set any of the known parameters
2378    /// which have their own setter method. If done anyway, the request will fail.
2379    ///
2380    /// # Additional Parameters
2381    ///
2382    /// * *$.xgafv* (query-string) - V1 error format.
2383    /// * *access_token* (query-string) - OAuth access token.
2384    /// * *alt* (query-string) - Data format for response.
2385    /// * *callback* (query-string) - JSONP
2386    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2387    /// * *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.
2388    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2389    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2390    /// * *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.
2391    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2392    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2393    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineListCall<'a, C>
2394    where
2395        T: AsRef<str>,
2396    {
2397        self._additional_params
2398            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2399        self
2400    }
2401
2402    /// Identifies the authorization scope for the method you are building.
2403    ///
2404    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2405    /// [`Scope::CloudPlatform`].
2406    ///
2407    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2408    /// tokens for more than one scope.
2409    ///
2410    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2411    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2412    /// sufficient, a read-write scope will do as well.
2413    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineListCall<'a, C>
2414    where
2415        St: AsRef<str>,
2416    {
2417        self._scopes.insert(String::from(scope.as_ref()));
2418        self
2419    }
2420    /// Identifies the authorization scope(s) for the method you are building.
2421    ///
2422    /// See [`Self::add_scope()`] for details.
2423    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineListCall<'a, C>
2424    where
2425        I: IntoIterator<Item = St>,
2426        St: AsRef<str>,
2427    {
2428        self._scopes
2429            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2430        self
2431    }
2432
2433    /// Removes all scopes, and no default scope will be used either.
2434    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2435    /// for details).
2436    pub fn clear_scopes(mut self) -> ProjectLocationPipelineListCall<'a, C> {
2437        self._scopes.clear();
2438        self
2439    }
2440}
2441
2442/// Updates a pipeline. If successful, the updated Pipeline is returned. Returns `NOT_FOUND` if the pipeline doesn't exist. If UpdatePipeline does not return successfully, you can retry the UpdatePipeline request until you receive a successful response.
2443///
2444/// A builder for the *locations.pipelines.patch* method supported by a *project* resource.
2445/// It is not used directly, but through a [`ProjectMethods`] instance.
2446///
2447/// # Example
2448///
2449/// Instantiate a resource method builder
2450///
2451/// ```test_harness,no_run
2452/// # extern crate hyper;
2453/// # extern crate hyper_rustls;
2454/// # extern crate google_datapipelines1 as datapipelines1;
2455/// use datapipelines1::api::GoogleCloudDatapipelinesV1Pipeline;
2456/// # async fn dox() {
2457/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2458///
2459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2460/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2461/// #     secret,
2462/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2463/// # ).build().await.unwrap();
2464///
2465/// # let client = hyper_util::client::legacy::Client::builder(
2466/// #     hyper_util::rt::TokioExecutor::new()
2467/// # )
2468/// # .build(
2469/// #     hyper_rustls::HttpsConnectorBuilder::new()
2470/// #         .with_native_roots()
2471/// #         .unwrap()
2472/// #         .https_or_http()
2473/// #         .enable_http1()
2474/// #         .build()
2475/// # );
2476/// # let mut hub = Datapipelines::new(client, auth);
2477/// // As the method needs a request, you would usually fill it with the desired information
2478/// // into the respective structure. Some of the parts shown here might not be applicable !
2479/// // Values shown here are possibly random and not representative !
2480/// let mut req = GoogleCloudDatapipelinesV1Pipeline::default();
2481///
2482/// // You can configure optional parameters by calling the respective setters at will, and
2483/// // execute the final call using `doit()`.
2484/// // Values shown here are possibly random and not representative !
2485/// let result = hub.projects().locations_pipelines_patch(req, "name")
2486///              .update_mask(FieldMask::new::<&str>(&[]))
2487///              .doit().await;
2488/// # }
2489/// ```
2490pub struct ProjectLocationPipelinePatchCall<'a, C>
2491where
2492    C: 'a,
2493{
2494    hub: &'a Datapipelines<C>,
2495    _request: GoogleCloudDatapipelinesV1Pipeline,
2496    _name: String,
2497    _update_mask: Option<common::FieldMask>,
2498    _delegate: Option<&'a mut dyn common::Delegate>,
2499    _additional_params: HashMap<String, String>,
2500    _scopes: BTreeSet<String>,
2501}
2502
2503impl<'a, C> common::CallBuilder for ProjectLocationPipelinePatchCall<'a, C> {}
2504
2505impl<'a, C> ProjectLocationPipelinePatchCall<'a, C>
2506where
2507    C: common::Connector,
2508{
2509    /// Perform the operation you have build so far.
2510    pub async fn doit(
2511        mut self,
2512    ) -> common::Result<(common::Response, GoogleCloudDatapipelinesV1Pipeline)> {
2513        use std::borrow::Cow;
2514        use std::io::{Read, Seek};
2515
2516        use common::{url::Params, ToParts};
2517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2518
2519        let mut dd = common::DefaultDelegate;
2520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2521        dlg.begin(common::MethodInfo {
2522            id: "datapipelines.projects.locations.pipelines.patch",
2523            http_method: hyper::Method::PATCH,
2524        });
2525
2526        for &field in ["alt", "name", "updateMask"].iter() {
2527            if self._additional_params.contains_key(field) {
2528                dlg.finished(false);
2529                return Err(common::Error::FieldClash(field));
2530            }
2531        }
2532
2533        let mut params = Params::with_capacity(5 + self._additional_params.len());
2534        params.push("name", self._name);
2535        if let Some(value) = self._update_mask.as_ref() {
2536            params.push("updateMask", value.to_string());
2537        }
2538
2539        params.extend(self._additional_params.iter());
2540
2541        params.push("alt", "json");
2542        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2543        if self._scopes.is_empty() {
2544            self._scopes
2545                .insert(Scope::CloudPlatform.as_ref().to_string());
2546        }
2547
2548        #[allow(clippy::single_element_loop)]
2549        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2550            url = params.uri_replacement(url, param_name, find_this, true);
2551        }
2552        {
2553            let to_remove = ["name"];
2554            params.remove_params(&to_remove);
2555        }
2556
2557        let url = params.parse_with_url(&url);
2558
2559        let mut json_mime_type = mime::APPLICATION_JSON;
2560        let mut request_value_reader = {
2561            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2562            common::remove_json_null_values(&mut value);
2563            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2564            serde_json::to_writer(&mut dst, &value).unwrap();
2565            dst
2566        };
2567        let request_size = request_value_reader
2568            .seek(std::io::SeekFrom::End(0))
2569            .unwrap();
2570        request_value_reader
2571            .seek(std::io::SeekFrom::Start(0))
2572            .unwrap();
2573
2574        loop {
2575            let token = match self
2576                .hub
2577                .auth
2578                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2579                .await
2580            {
2581                Ok(token) => token,
2582                Err(e) => match dlg.token(e) {
2583                    Ok(token) => token,
2584                    Err(e) => {
2585                        dlg.finished(false);
2586                        return Err(common::Error::MissingToken(e));
2587                    }
2588                },
2589            };
2590            request_value_reader
2591                .seek(std::io::SeekFrom::Start(0))
2592                .unwrap();
2593            let mut req_result = {
2594                let client = &self.hub.client;
2595                dlg.pre_request();
2596                let mut req_builder = hyper::Request::builder()
2597                    .method(hyper::Method::PATCH)
2598                    .uri(url.as_str())
2599                    .header(USER_AGENT, self.hub._user_agent.clone());
2600
2601                if let Some(token) = token.as_ref() {
2602                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2603                }
2604
2605                let request = req_builder
2606                    .header(CONTENT_TYPE, json_mime_type.to_string())
2607                    .header(CONTENT_LENGTH, request_size as u64)
2608                    .body(common::to_body(
2609                        request_value_reader.get_ref().clone().into(),
2610                    ));
2611
2612                client.request(request.unwrap()).await
2613            };
2614
2615            match req_result {
2616                Err(err) => {
2617                    if let common::Retry::After(d) = dlg.http_error(&err) {
2618                        sleep(d).await;
2619                        continue;
2620                    }
2621                    dlg.finished(false);
2622                    return Err(common::Error::HttpError(err));
2623                }
2624                Ok(res) => {
2625                    let (mut parts, body) = res.into_parts();
2626                    let mut body = common::Body::new(body);
2627                    if !parts.status.is_success() {
2628                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2629                        let error = serde_json::from_str(&common::to_string(&bytes));
2630                        let response = common::to_response(parts, bytes.into());
2631
2632                        if let common::Retry::After(d) =
2633                            dlg.http_failure(&response, error.as_ref().ok())
2634                        {
2635                            sleep(d).await;
2636                            continue;
2637                        }
2638
2639                        dlg.finished(false);
2640
2641                        return Err(match error {
2642                            Ok(value) => common::Error::BadRequest(value),
2643                            _ => common::Error::Failure(response),
2644                        });
2645                    }
2646                    let response = {
2647                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2648                        let encoded = common::to_string(&bytes);
2649                        match serde_json::from_str(&encoded) {
2650                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2651                            Err(error) => {
2652                                dlg.response_json_decode_error(&encoded, &error);
2653                                return Err(common::Error::JsonDecodeError(
2654                                    encoded.to_string(),
2655                                    error,
2656                                ));
2657                            }
2658                        }
2659                    };
2660
2661                    dlg.finished(true);
2662                    return Ok(response);
2663                }
2664            }
2665        }
2666    }
2667
2668    ///
2669    /// Sets the *request* property to the given value.
2670    ///
2671    /// Even though the property as already been set when instantiating this call,
2672    /// we provide this method for API completeness.
2673    pub fn request(
2674        mut self,
2675        new_value: GoogleCloudDatapipelinesV1Pipeline,
2676    ) -> ProjectLocationPipelinePatchCall<'a, C> {
2677        self._request = new_value;
2678        self
2679    }
2680    /// The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`. * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), and periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects). * `LOCATION_ID` is the canonical ID for the pipeline's location. The list of available locations can be obtained by calling `google.cloud.location.Locations.ListLocations`. Note that the Data Pipelines service is not available in all regions. It depends on Cloud Scheduler, an App Engine application, so it's only available in [App Engine regions](https://cloud.google.com/about/locations#region). * `PIPELINE_ID` is the ID of the pipeline. Must be unique for the selected project and location.
2681    ///
2682    /// Sets the *name* path property to the given value.
2683    ///
2684    /// Even though the property as already been set when instantiating this call,
2685    /// we provide this method for API completeness.
2686    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelinePatchCall<'a, C> {
2687        self._name = new_value.to_string();
2688        self
2689    }
2690    /// The list of fields to be updated.
2691    ///
2692    /// Sets the *update mask* query property to the given value.
2693    pub fn update_mask(
2694        mut self,
2695        new_value: common::FieldMask,
2696    ) -> ProjectLocationPipelinePatchCall<'a, C> {
2697        self._update_mask = Some(new_value);
2698        self
2699    }
2700    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2701    /// while executing the actual API request.
2702    ///
2703    /// ````text
2704    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2705    /// ````
2706    ///
2707    /// Sets the *delegate* property to the given value.
2708    pub fn delegate(
2709        mut self,
2710        new_value: &'a mut dyn common::Delegate,
2711    ) -> ProjectLocationPipelinePatchCall<'a, C> {
2712        self._delegate = Some(new_value);
2713        self
2714    }
2715
2716    /// Set any additional parameter of the query string used in the request.
2717    /// It should be used to set parameters which are not yet available through their own
2718    /// setters.
2719    ///
2720    /// Please note that this method must not be used to set any of the known parameters
2721    /// which have their own setter method. If done anyway, the request will fail.
2722    ///
2723    /// # Additional Parameters
2724    ///
2725    /// * *$.xgafv* (query-string) - V1 error format.
2726    /// * *access_token* (query-string) - OAuth access token.
2727    /// * *alt* (query-string) - Data format for response.
2728    /// * *callback* (query-string) - JSONP
2729    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2730    /// * *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.
2731    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2732    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2733    /// * *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.
2734    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2735    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2736    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelinePatchCall<'a, C>
2737    where
2738        T: AsRef<str>,
2739    {
2740        self._additional_params
2741            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2742        self
2743    }
2744
2745    /// Identifies the authorization scope for the method you are building.
2746    ///
2747    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2748    /// [`Scope::CloudPlatform`].
2749    ///
2750    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2751    /// tokens for more than one scope.
2752    ///
2753    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2754    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2755    /// sufficient, a read-write scope will do as well.
2756    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelinePatchCall<'a, C>
2757    where
2758        St: AsRef<str>,
2759    {
2760        self._scopes.insert(String::from(scope.as_ref()));
2761        self
2762    }
2763    /// Identifies the authorization scope(s) for the method you are building.
2764    ///
2765    /// See [`Self::add_scope()`] for details.
2766    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelinePatchCall<'a, C>
2767    where
2768        I: IntoIterator<Item = St>,
2769        St: AsRef<str>,
2770    {
2771        self._scopes
2772            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2773        self
2774    }
2775
2776    /// Removes all scopes, and no default scope will be used either.
2777    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2778    /// for details).
2779    pub fn clear_scopes(mut self) -> ProjectLocationPipelinePatchCall<'a, C> {
2780        self._scopes.clear();
2781        self
2782    }
2783}
2784
2785/// Creates a job for the specified pipeline directly. You can use this method when the internal scheduler is not configured and you want to trigger the job directly or through an external system. Returns a "NOT_FOUND" error if the pipeline doesn't exist. Returns a "FORBIDDEN" error if the user doesn't have permission to access the pipeline or run jobs for the pipeline.
2786///
2787/// A builder for the *locations.pipelines.run* method supported by a *project* resource.
2788/// It is not used directly, but through a [`ProjectMethods`] instance.
2789///
2790/// # Example
2791///
2792/// Instantiate a resource method builder
2793///
2794/// ```test_harness,no_run
2795/// # extern crate hyper;
2796/// # extern crate hyper_rustls;
2797/// # extern crate google_datapipelines1 as datapipelines1;
2798/// use datapipelines1::api::GoogleCloudDatapipelinesV1RunPipelineRequest;
2799/// # async fn dox() {
2800/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2801///
2802/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2803/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2804/// #     secret,
2805/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2806/// # ).build().await.unwrap();
2807///
2808/// # let client = hyper_util::client::legacy::Client::builder(
2809/// #     hyper_util::rt::TokioExecutor::new()
2810/// # )
2811/// # .build(
2812/// #     hyper_rustls::HttpsConnectorBuilder::new()
2813/// #         .with_native_roots()
2814/// #         .unwrap()
2815/// #         .https_or_http()
2816/// #         .enable_http1()
2817/// #         .build()
2818/// # );
2819/// # let mut hub = Datapipelines::new(client, auth);
2820/// // As the method needs a request, you would usually fill it with the desired information
2821/// // into the respective structure. Some of the parts shown here might not be applicable !
2822/// // Values shown here are possibly random and not representative !
2823/// let mut req = GoogleCloudDatapipelinesV1RunPipelineRequest::default();
2824///
2825/// // You can configure optional parameters by calling the respective setters at will, and
2826/// // execute the final call using `doit()`.
2827/// // Values shown here are possibly random and not representative !
2828/// let result = hub.projects().locations_pipelines_run(req, "name")
2829///              .doit().await;
2830/// # }
2831/// ```
2832pub struct ProjectLocationPipelineRunCall<'a, C>
2833where
2834    C: 'a,
2835{
2836    hub: &'a Datapipelines<C>,
2837    _request: GoogleCloudDatapipelinesV1RunPipelineRequest,
2838    _name: String,
2839    _delegate: Option<&'a mut dyn common::Delegate>,
2840    _additional_params: HashMap<String, String>,
2841    _scopes: BTreeSet<String>,
2842}
2843
2844impl<'a, C> common::CallBuilder for ProjectLocationPipelineRunCall<'a, C> {}
2845
2846impl<'a, C> ProjectLocationPipelineRunCall<'a, C>
2847where
2848    C: common::Connector,
2849{
2850    /// Perform the operation you have build so far.
2851    pub async fn doit(
2852        mut self,
2853    ) -> common::Result<(
2854        common::Response,
2855        GoogleCloudDatapipelinesV1RunPipelineResponse,
2856    )> {
2857        use std::borrow::Cow;
2858        use std::io::{Read, Seek};
2859
2860        use common::{url::Params, ToParts};
2861        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2862
2863        let mut dd = common::DefaultDelegate;
2864        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2865        dlg.begin(common::MethodInfo {
2866            id: "datapipelines.projects.locations.pipelines.run",
2867            http_method: hyper::Method::POST,
2868        });
2869
2870        for &field in ["alt", "name"].iter() {
2871            if self._additional_params.contains_key(field) {
2872                dlg.finished(false);
2873                return Err(common::Error::FieldClash(field));
2874            }
2875        }
2876
2877        let mut params = Params::with_capacity(4 + self._additional_params.len());
2878        params.push("name", self._name);
2879
2880        params.extend(self._additional_params.iter());
2881
2882        params.push("alt", "json");
2883        let mut url = self.hub._base_url.clone() + "v1/{+name}:run";
2884        if self._scopes.is_empty() {
2885            self._scopes
2886                .insert(Scope::CloudPlatform.as_ref().to_string());
2887        }
2888
2889        #[allow(clippy::single_element_loop)]
2890        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2891            url = params.uri_replacement(url, param_name, find_this, true);
2892        }
2893        {
2894            let to_remove = ["name"];
2895            params.remove_params(&to_remove);
2896        }
2897
2898        let url = params.parse_with_url(&url);
2899
2900        let mut json_mime_type = mime::APPLICATION_JSON;
2901        let mut request_value_reader = {
2902            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2903            common::remove_json_null_values(&mut value);
2904            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2905            serde_json::to_writer(&mut dst, &value).unwrap();
2906            dst
2907        };
2908        let request_size = request_value_reader
2909            .seek(std::io::SeekFrom::End(0))
2910            .unwrap();
2911        request_value_reader
2912            .seek(std::io::SeekFrom::Start(0))
2913            .unwrap();
2914
2915        loop {
2916            let token = match self
2917                .hub
2918                .auth
2919                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2920                .await
2921            {
2922                Ok(token) => token,
2923                Err(e) => match dlg.token(e) {
2924                    Ok(token) => token,
2925                    Err(e) => {
2926                        dlg.finished(false);
2927                        return Err(common::Error::MissingToken(e));
2928                    }
2929                },
2930            };
2931            request_value_reader
2932                .seek(std::io::SeekFrom::Start(0))
2933                .unwrap();
2934            let mut req_result = {
2935                let client = &self.hub.client;
2936                dlg.pre_request();
2937                let mut req_builder = hyper::Request::builder()
2938                    .method(hyper::Method::POST)
2939                    .uri(url.as_str())
2940                    .header(USER_AGENT, self.hub._user_agent.clone());
2941
2942                if let Some(token) = token.as_ref() {
2943                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2944                }
2945
2946                let request = req_builder
2947                    .header(CONTENT_TYPE, json_mime_type.to_string())
2948                    .header(CONTENT_LENGTH, request_size as u64)
2949                    .body(common::to_body(
2950                        request_value_reader.get_ref().clone().into(),
2951                    ));
2952
2953                client.request(request.unwrap()).await
2954            };
2955
2956            match req_result {
2957                Err(err) => {
2958                    if let common::Retry::After(d) = dlg.http_error(&err) {
2959                        sleep(d).await;
2960                        continue;
2961                    }
2962                    dlg.finished(false);
2963                    return Err(common::Error::HttpError(err));
2964                }
2965                Ok(res) => {
2966                    let (mut parts, body) = res.into_parts();
2967                    let mut body = common::Body::new(body);
2968                    if !parts.status.is_success() {
2969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2970                        let error = serde_json::from_str(&common::to_string(&bytes));
2971                        let response = common::to_response(parts, bytes.into());
2972
2973                        if let common::Retry::After(d) =
2974                            dlg.http_failure(&response, error.as_ref().ok())
2975                        {
2976                            sleep(d).await;
2977                            continue;
2978                        }
2979
2980                        dlg.finished(false);
2981
2982                        return Err(match error {
2983                            Ok(value) => common::Error::BadRequest(value),
2984                            _ => common::Error::Failure(response),
2985                        });
2986                    }
2987                    let response = {
2988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2989                        let encoded = common::to_string(&bytes);
2990                        match serde_json::from_str(&encoded) {
2991                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2992                            Err(error) => {
2993                                dlg.response_json_decode_error(&encoded, &error);
2994                                return Err(common::Error::JsonDecodeError(
2995                                    encoded.to_string(),
2996                                    error,
2997                                ));
2998                            }
2999                        }
3000                    };
3001
3002                    dlg.finished(true);
3003                    return Ok(response);
3004                }
3005            }
3006        }
3007    }
3008
3009    ///
3010    /// Sets the *request* property to the given value.
3011    ///
3012    /// Even though the property as already been set when instantiating this call,
3013    /// we provide this method for API completeness.
3014    pub fn request(
3015        mut self,
3016        new_value: GoogleCloudDatapipelinesV1RunPipelineRequest,
3017    ) -> ProjectLocationPipelineRunCall<'a, C> {
3018        self._request = new_value;
3019        self
3020    }
3021    /// Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
3022    ///
3023    /// Sets the *name* path property to the given value.
3024    ///
3025    /// Even though the property as already been set when instantiating this call,
3026    /// we provide this method for API completeness.
3027    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineRunCall<'a, C> {
3028        self._name = new_value.to_string();
3029        self
3030    }
3031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3032    /// while executing the actual API request.
3033    ///
3034    /// ````text
3035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3036    /// ````
3037    ///
3038    /// Sets the *delegate* property to the given value.
3039    pub fn delegate(
3040        mut self,
3041        new_value: &'a mut dyn common::Delegate,
3042    ) -> ProjectLocationPipelineRunCall<'a, C> {
3043        self._delegate = Some(new_value);
3044        self
3045    }
3046
3047    /// Set any additional parameter of the query string used in the request.
3048    /// It should be used to set parameters which are not yet available through their own
3049    /// setters.
3050    ///
3051    /// Please note that this method must not be used to set any of the known parameters
3052    /// which have their own setter method. If done anyway, the request will fail.
3053    ///
3054    /// # Additional Parameters
3055    ///
3056    /// * *$.xgafv* (query-string) - V1 error format.
3057    /// * *access_token* (query-string) - OAuth access token.
3058    /// * *alt* (query-string) - Data format for response.
3059    /// * *callback* (query-string) - JSONP
3060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3061    /// * *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.
3062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3064    /// * *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.
3065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3067    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineRunCall<'a, C>
3068    where
3069        T: AsRef<str>,
3070    {
3071        self._additional_params
3072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3073        self
3074    }
3075
3076    /// Identifies the authorization scope for the method you are building.
3077    ///
3078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3079    /// [`Scope::CloudPlatform`].
3080    ///
3081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3082    /// tokens for more than one scope.
3083    ///
3084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3086    /// sufficient, a read-write scope will do as well.
3087    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineRunCall<'a, C>
3088    where
3089        St: AsRef<str>,
3090    {
3091        self._scopes.insert(String::from(scope.as_ref()));
3092        self
3093    }
3094    /// Identifies the authorization scope(s) for the method you are building.
3095    ///
3096    /// See [`Self::add_scope()`] for details.
3097    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineRunCall<'a, C>
3098    where
3099        I: IntoIterator<Item = St>,
3100        St: AsRef<str>,
3101    {
3102        self._scopes
3103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3104        self
3105    }
3106
3107    /// Removes all scopes, and no default scope will be used either.
3108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3109    /// for details).
3110    pub fn clear_scopes(mut self) -> ProjectLocationPipelineRunCall<'a, C> {
3111        self._scopes.clear();
3112        self
3113    }
3114}
3115
3116/// Freezes pipeline execution permanently. If there's a corresponding scheduler entry, it's deleted, and the pipeline state is changed to "ARCHIVED". However, pipeline metadata is retained.
3117///
3118/// A builder for the *locations.pipelines.stop* method supported by a *project* resource.
3119/// It is not used directly, but through a [`ProjectMethods`] instance.
3120///
3121/// # Example
3122///
3123/// Instantiate a resource method builder
3124///
3125/// ```test_harness,no_run
3126/// # extern crate hyper;
3127/// # extern crate hyper_rustls;
3128/// # extern crate google_datapipelines1 as datapipelines1;
3129/// use datapipelines1::api::GoogleCloudDatapipelinesV1StopPipelineRequest;
3130/// # async fn dox() {
3131/// # use datapipelines1::{Datapipelines, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3132///
3133/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3135/// #     secret,
3136/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3137/// # ).build().await.unwrap();
3138///
3139/// # let client = hyper_util::client::legacy::Client::builder(
3140/// #     hyper_util::rt::TokioExecutor::new()
3141/// # )
3142/// # .build(
3143/// #     hyper_rustls::HttpsConnectorBuilder::new()
3144/// #         .with_native_roots()
3145/// #         .unwrap()
3146/// #         .https_or_http()
3147/// #         .enable_http1()
3148/// #         .build()
3149/// # );
3150/// # let mut hub = Datapipelines::new(client, auth);
3151/// // As the method needs a request, you would usually fill it with the desired information
3152/// // into the respective structure. Some of the parts shown here might not be applicable !
3153/// // Values shown here are possibly random and not representative !
3154/// let mut req = GoogleCloudDatapipelinesV1StopPipelineRequest::default();
3155///
3156/// // You can configure optional parameters by calling the respective setters at will, and
3157/// // execute the final call using `doit()`.
3158/// // Values shown here are possibly random and not representative !
3159/// let result = hub.projects().locations_pipelines_stop(req, "name")
3160///              .doit().await;
3161/// # }
3162/// ```
3163pub struct ProjectLocationPipelineStopCall<'a, C>
3164where
3165    C: 'a,
3166{
3167    hub: &'a Datapipelines<C>,
3168    _request: GoogleCloudDatapipelinesV1StopPipelineRequest,
3169    _name: String,
3170    _delegate: Option<&'a mut dyn common::Delegate>,
3171    _additional_params: HashMap<String, String>,
3172    _scopes: BTreeSet<String>,
3173}
3174
3175impl<'a, C> common::CallBuilder for ProjectLocationPipelineStopCall<'a, C> {}
3176
3177impl<'a, C> ProjectLocationPipelineStopCall<'a, C>
3178where
3179    C: common::Connector,
3180{
3181    /// Perform the operation you have build so far.
3182    pub async fn doit(
3183        mut self,
3184    ) -> common::Result<(common::Response, GoogleCloudDatapipelinesV1Pipeline)> {
3185        use std::borrow::Cow;
3186        use std::io::{Read, Seek};
3187
3188        use common::{url::Params, ToParts};
3189        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3190
3191        let mut dd = common::DefaultDelegate;
3192        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3193        dlg.begin(common::MethodInfo {
3194            id: "datapipelines.projects.locations.pipelines.stop",
3195            http_method: hyper::Method::POST,
3196        });
3197
3198        for &field in ["alt", "name"].iter() {
3199            if self._additional_params.contains_key(field) {
3200                dlg.finished(false);
3201                return Err(common::Error::FieldClash(field));
3202            }
3203        }
3204
3205        let mut params = Params::with_capacity(4 + self._additional_params.len());
3206        params.push("name", self._name);
3207
3208        params.extend(self._additional_params.iter());
3209
3210        params.push("alt", "json");
3211        let mut url = self.hub._base_url.clone() + "v1/{+name}:stop";
3212        if self._scopes.is_empty() {
3213            self._scopes
3214                .insert(Scope::CloudPlatform.as_ref().to_string());
3215        }
3216
3217        #[allow(clippy::single_element_loop)]
3218        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3219            url = params.uri_replacement(url, param_name, find_this, true);
3220        }
3221        {
3222            let to_remove = ["name"];
3223            params.remove_params(&to_remove);
3224        }
3225
3226        let url = params.parse_with_url(&url);
3227
3228        let mut json_mime_type = mime::APPLICATION_JSON;
3229        let mut request_value_reader = {
3230            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3231            common::remove_json_null_values(&mut value);
3232            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3233            serde_json::to_writer(&mut dst, &value).unwrap();
3234            dst
3235        };
3236        let request_size = request_value_reader
3237            .seek(std::io::SeekFrom::End(0))
3238            .unwrap();
3239        request_value_reader
3240            .seek(std::io::SeekFrom::Start(0))
3241            .unwrap();
3242
3243        loop {
3244            let token = match self
3245                .hub
3246                .auth
3247                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3248                .await
3249            {
3250                Ok(token) => token,
3251                Err(e) => match dlg.token(e) {
3252                    Ok(token) => token,
3253                    Err(e) => {
3254                        dlg.finished(false);
3255                        return Err(common::Error::MissingToken(e));
3256                    }
3257                },
3258            };
3259            request_value_reader
3260                .seek(std::io::SeekFrom::Start(0))
3261                .unwrap();
3262            let mut req_result = {
3263                let client = &self.hub.client;
3264                dlg.pre_request();
3265                let mut req_builder = hyper::Request::builder()
3266                    .method(hyper::Method::POST)
3267                    .uri(url.as_str())
3268                    .header(USER_AGENT, self.hub._user_agent.clone());
3269
3270                if let Some(token) = token.as_ref() {
3271                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3272                }
3273
3274                let request = req_builder
3275                    .header(CONTENT_TYPE, json_mime_type.to_string())
3276                    .header(CONTENT_LENGTH, request_size as u64)
3277                    .body(common::to_body(
3278                        request_value_reader.get_ref().clone().into(),
3279                    ));
3280
3281                client.request(request.unwrap()).await
3282            };
3283
3284            match req_result {
3285                Err(err) => {
3286                    if let common::Retry::After(d) = dlg.http_error(&err) {
3287                        sleep(d).await;
3288                        continue;
3289                    }
3290                    dlg.finished(false);
3291                    return Err(common::Error::HttpError(err));
3292                }
3293                Ok(res) => {
3294                    let (mut parts, body) = res.into_parts();
3295                    let mut body = common::Body::new(body);
3296                    if !parts.status.is_success() {
3297                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3298                        let error = serde_json::from_str(&common::to_string(&bytes));
3299                        let response = common::to_response(parts, bytes.into());
3300
3301                        if let common::Retry::After(d) =
3302                            dlg.http_failure(&response, error.as_ref().ok())
3303                        {
3304                            sleep(d).await;
3305                            continue;
3306                        }
3307
3308                        dlg.finished(false);
3309
3310                        return Err(match error {
3311                            Ok(value) => common::Error::BadRequest(value),
3312                            _ => common::Error::Failure(response),
3313                        });
3314                    }
3315                    let response = {
3316                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3317                        let encoded = common::to_string(&bytes);
3318                        match serde_json::from_str(&encoded) {
3319                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3320                            Err(error) => {
3321                                dlg.response_json_decode_error(&encoded, &error);
3322                                return Err(common::Error::JsonDecodeError(
3323                                    encoded.to_string(),
3324                                    error,
3325                                ));
3326                            }
3327                        }
3328                    };
3329
3330                    dlg.finished(true);
3331                    return Ok(response);
3332                }
3333            }
3334        }
3335    }
3336
3337    ///
3338    /// Sets the *request* property to the given value.
3339    ///
3340    /// Even though the property as already been set when instantiating this call,
3341    /// we provide this method for API completeness.
3342    pub fn request(
3343        mut self,
3344        new_value: GoogleCloudDatapipelinesV1StopPipelineRequest,
3345    ) -> ProjectLocationPipelineStopCall<'a, C> {
3346        self._request = new_value;
3347        self
3348    }
3349    /// Required. The pipeline name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/pipelines/PIPELINE_ID`.
3350    ///
3351    /// Sets the *name* path property to the given value.
3352    ///
3353    /// Even though the property as already been set when instantiating this call,
3354    /// we provide this method for API completeness.
3355    pub fn name(mut self, new_value: &str) -> ProjectLocationPipelineStopCall<'a, C> {
3356        self._name = new_value.to_string();
3357        self
3358    }
3359    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3360    /// while executing the actual API request.
3361    ///
3362    /// ````text
3363    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3364    /// ````
3365    ///
3366    /// Sets the *delegate* property to the given value.
3367    pub fn delegate(
3368        mut self,
3369        new_value: &'a mut dyn common::Delegate,
3370    ) -> ProjectLocationPipelineStopCall<'a, C> {
3371        self._delegate = Some(new_value);
3372        self
3373    }
3374
3375    /// Set any additional parameter of the query string used in the request.
3376    /// It should be used to set parameters which are not yet available through their own
3377    /// setters.
3378    ///
3379    /// Please note that this method must not be used to set any of the known parameters
3380    /// which have their own setter method. If done anyway, the request will fail.
3381    ///
3382    /// # Additional Parameters
3383    ///
3384    /// * *$.xgafv* (query-string) - V1 error format.
3385    /// * *access_token* (query-string) - OAuth access token.
3386    /// * *alt* (query-string) - Data format for response.
3387    /// * *callback* (query-string) - JSONP
3388    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3389    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3390    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3391    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3392    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3393    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3394    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3395    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPipelineStopCall<'a, C>
3396    where
3397        T: AsRef<str>,
3398    {
3399        self._additional_params
3400            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3401        self
3402    }
3403
3404    /// Identifies the authorization scope for the method you are building.
3405    ///
3406    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3407    /// [`Scope::CloudPlatform`].
3408    ///
3409    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3410    /// tokens for more than one scope.
3411    ///
3412    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3413    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3414    /// sufficient, a read-write scope will do as well.
3415    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPipelineStopCall<'a, C>
3416    where
3417        St: AsRef<str>,
3418    {
3419        self._scopes.insert(String::from(scope.as_ref()));
3420        self
3421    }
3422    /// Identifies the authorization scope(s) for the method you are building.
3423    ///
3424    /// See [`Self::add_scope()`] for details.
3425    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPipelineStopCall<'a, C>
3426    where
3427        I: IntoIterator<Item = St>,
3428        St: AsRef<str>,
3429    {
3430        self._scopes
3431            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3432        self
3433    }
3434
3435    /// Removes all scopes, and no default scope will be used either.
3436    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3437    /// for details).
3438    pub fn clear_scopes(mut self) -> ProjectLocationPipelineStopCall<'a, C> {
3439        self._scopes.clear();
3440        self
3441    }
3442}