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