google_datastream1/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 Datastream 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_datastream1 as datastream1;
49/// use datastream1::api::ConnectionProfile;
50/// use datastream1::{Result, Error};
51/// # async fn dox() {
52/// use datastream1::{Datastream, 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 = Datastream::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 = ConnectionProfile::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_connection_profiles_create(req, "parent")
99/// .validate_only(false)
100/// .request_id("dolor")
101/// .force(true)
102/// .connection_profile_id("invidunt")
103/// .doit().await;
104///
105/// match result {
106/// Err(e) => match e {
107/// // The Error enum provides details about what exactly happened.
108/// // You can also just use its `Debug`, `Display` or `Error` traits
109/// Error::HttpError(_)
110/// |Error::Io(_)
111/// |Error::MissingAPIKey
112/// |Error::MissingToken(_)
113/// |Error::Cancelled
114/// |Error::UploadSizeLimitExceeded(_, _)
115/// |Error::Failure(_)
116/// |Error::BadRequest(_)
117/// |Error::FieldClash(_)
118/// |Error::JsonDecodeError(_, _) => println!("{}", e),
119/// },
120/// Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct Datastream<C> {
126 pub client: common::Client<C>,
127 pub auth: Box<dyn common::GetToken>,
128 _user_agent: String,
129 _base_url: String,
130 _root_url: String,
131}
132
133impl<C> common::Hub for Datastream<C> {}
134
135impl<'a, C> Datastream<C> {
136 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Datastream<C> {
137 Datastream {
138 client,
139 auth: Box::new(auth),
140 _user_agent: "google-api-rust-client/7.0.0".to_string(),
141 _base_url: "https://datastream.googleapis.com/".to_string(),
142 _root_url: "https://datastream.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://datastream.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://datastream.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/// AppendOnly mode defines that all changes to a table will be written to the destination table.
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 AppendOnly {
186 _never_set: Option<bool>,
187}
188
189impl common::Part for AppendOnly {}
190
191/// AVRO file format configuration.
192///
193/// This type is not used in any activity, and only used as *part* of another schema.
194///
195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
196#[serde_with::serde_as]
197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
198pub struct AvroFileFormat {
199 _never_set: Option<bool>,
200}
201
202impl common::Part for AvroFileFormat {}
203
204/// Backfill strategy to automatically backfill the Stream's objects. Specific objects can be excluded.
205///
206/// This type is not used in any activity, and only used as *part* of another schema.
207///
208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
209#[serde_with::serde_as]
210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
211pub struct BackfillAllStrategy {
212 /// MongoDB data source objects to avoid backfilling
213 #[serde(rename = "mongodbExcludedObjects")]
214 pub mongodb_excluded_objects: Option<MongodbCluster>,
215 /// MySQL data source objects to avoid backfilling.
216 #[serde(rename = "mysqlExcludedObjects")]
217 pub mysql_excluded_objects: Option<MysqlRdbms>,
218 /// Oracle data source objects to avoid backfilling.
219 #[serde(rename = "oracleExcludedObjects")]
220 pub oracle_excluded_objects: Option<OracleRdbms>,
221 /// PostgreSQL data source objects to avoid backfilling.
222 #[serde(rename = "postgresqlExcludedObjects")]
223 pub postgresql_excluded_objects: Option<PostgresqlRdbms>,
224 /// Salesforce data source objects to avoid backfilling
225 #[serde(rename = "salesforceExcludedObjects")]
226 pub salesforce_excluded_objects: Option<SalesforceOrg>,
227 /// SQLServer data source objects to avoid backfilling
228 #[serde(rename = "sqlServerExcludedObjects")]
229 pub sql_server_excluded_objects: Option<SqlServerRdbms>,
230}
231
232impl common::Part for BackfillAllStrategy {}
233
234/// Represents a backfill job on a specific stream object.
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct BackfillJob {
242 /// Output only. Errors which caused the backfill job to fail.
243 pub errors: Option<Vec<Error>>,
244 /// Output only. Backfill job's end time.
245 #[serde(rename = "lastEndTime")]
246 pub last_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
247 /// Output only. Backfill job's start time.
248 #[serde(rename = "lastStartTime")]
249 pub last_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
250 /// Output only. Backfill job state.
251 pub state: Option<String>,
252 /// Backfill job's triggering reason.
253 pub trigger: Option<String>,
254}
255
256impl common::Part for BackfillJob {}
257
258/// Backfill strategy to disable automatic backfill for the Stream's objects.
259///
260/// This type is not used in any activity, and only used as *part* of another schema.
261///
262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
263#[serde_with::serde_as]
264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
265pub struct BackfillNoneStrategy {
266 _never_set: Option<bool>,
267}
268
269impl common::Part for BackfillNoneStrategy {}
270
271/// Message to represent the option where Datastream will enforce encryption without authenticating server identity. Server certificates will be trusted by default.
272///
273/// This type is not used in any activity, and only used as *part* of another schema.
274///
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct BasicEncryption {
279 _never_set: Option<bool>,
280}
281
282impl common::Part for BasicEncryption {}
283
284/// BigQuery clustering configuration.
285///
286/// This type is not used in any activity, and only used as *part* of another schema.
287///
288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
289#[serde_with::serde_as]
290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
291pub struct BigQueryClustering {
292 /// Required. Column names to set as clustering columns.
293 pub columns: Option<Vec<String>>,
294}
295
296impl common::Part for BigQueryClustering {}
297
298/// BigQuery destination configuration
299///
300/// This type is not used in any activity, and only used as *part* of another schema.
301///
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct BigQueryDestinationConfig {
306 /// Append only mode
307 #[serde(rename = "appendOnly")]
308 pub append_only: Option<AppendOnly>,
309 /// Optional. Big Lake Managed Tables (BLMT) configuration.
310 #[serde(rename = "blmtConfig")]
311 pub blmt_config: Option<BlmtConfig>,
312 /// The guaranteed data freshness (in seconds) when querying tables created by the stream. Editing this field will only affect new tables created in the future, but existing tables will not be impacted. Lower values mean that queries will return fresher data, but may result in higher cost.
313 #[serde(rename = "dataFreshness")]
314 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
315 pub data_freshness: Option<chrono::Duration>,
316 /// The standard mode
317 pub merge: Option<Merge>,
318 /// Single destination dataset.
319 #[serde(rename = "singleTargetDataset")]
320 pub single_target_dataset: Option<SingleTargetDataset>,
321 /// Source hierarchy datasets.
322 #[serde(rename = "sourceHierarchyDatasets")]
323 pub source_hierarchy_datasets: Option<SourceHierarchyDatasets>,
324}
325
326impl common::Part for BigQueryDestinationConfig {}
327
328/// BigQuery partitioning configuration.
329///
330/// This type is not used in any activity, and only used as *part* of another schema.
331///
332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
333#[serde_with::serde_as]
334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
335pub struct BigQueryPartitioning {
336 /// Ingestion time partitioning.
337 #[serde(rename = "ingestionTimePartition")]
338 pub ingestion_time_partition: Option<IngestionTimePartition>,
339 /// Integer range partitioning.
340 #[serde(rename = "integerRangePartition")]
341 pub integer_range_partition: Option<IntegerRangePartition>,
342 /// Optional. If true, queries over the table require a partition filter.
343 #[serde(rename = "requirePartitionFilter")]
344 pub require_partition_filter: Option<bool>,
345 /// Time unit column partitioning.
346 #[serde(rename = "timeUnitPartition")]
347 pub time_unit_partition: Option<TimeUnitPartition>,
348}
349
350impl common::Part for BigQueryPartitioning {}
351
352/// BigQuery warehouse profile.
353///
354/// This type is not used in any activity, and only used as *part* of another schema.
355///
356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
357#[serde_with::serde_as]
358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
359pub struct BigQueryProfile {
360 _never_set: Option<bool>,
361}
362
363impl common::Part for BigQueryProfile {}
364
365/// Configuration to use Binary Log Parser CDC technique.
366///
367/// This type is not used in any activity, and only used as *part* of another schema.
368///
369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
370#[serde_with::serde_as]
371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
372pub struct BinaryLogParser {
373 /// Use Oracle directories.
374 #[serde(rename = "logFileDirectories")]
375 pub log_file_directories: Option<LogFileDirectories>,
376 /// Use Oracle ASM.
377 #[serde(rename = "oracleAsmLogFileAccess")]
378 pub oracle_asm_log_file_access: Option<OracleAsmLogFileAccess>,
379}
380
381impl common::Part for BinaryLogParser {}
382
383/// Use Binary log position based replication.
384///
385/// This type is not used in any activity, and only used as *part* of another schema.
386///
387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
388#[serde_with::serde_as]
389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct BinaryLogPosition {
391 _never_set: Option<bool>,
392}
393
394impl common::Part for BinaryLogPosition {}
395
396/// The configuration for BLMT.
397///
398/// This type is not used in any activity, and only used as *part* of another schema.
399///
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct BlmtConfig {
404 /// Required. The Cloud Storage bucket name.
405 pub bucket: Option<String>,
406 /// Required. The bigquery connection. Format: `{project}.{location}.{name}`
407 #[serde(rename = "connectionName")]
408 pub connection_name: Option<String>,
409 /// Required. The file format.
410 #[serde(rename = "fileFormat")]
411 pub file_format: Option<String>,
412 /// The root path inside the Cloud Storage bucket.
413 #[serde(rename = "rootPath")]
414 pub root_path: Option<String>,
415 /// Required. The table format.
416 #[serde(rename = "tableFormat")]
417 pub table_format: Option<String>,
418}
419
420impl common::Part for BlmtConfig {}
421
422/// The request message for Operations.CancelOperation.
423///
424/// # Activities
425///
426/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
427/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
428///
429/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
431#[serde_with::serde_as]
432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
433pub struct CancelOperationRequest {
434 _never_set: Option<bool>,
435}
436
437impl common::RequestValue for CancelOperationRequest {}
438
439/// The strategy that the stream uses for CDC replication.
440///
441/// This type is not used in any activity, and only used as *part* of another schema.
442///
443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
444#[serde_with::serde_as]
445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
446pub struct CdcStrategy {
447 /// Optional. Start replicating from the most recent position in the source.
448 #[serde(rename = "mostRecentStartPosition")]
449 pub most_recent_start_position: Option<MostRecentStartPosition>,
450 /// Optional. Resume replication from the next available position in the source.
451 #[serde(rename = "nextAvailableStartPosition")]
452 pub next_available_start_position: Option<NextAvailableStartPosition>,
453 /// Optional. Start replicating from a specific position in the source.
454 #[serde(rename = "specificStartPosition")]
455 pub specific_start_position: Option<SpecificStartPosition>,
456}
457
458impl common::Part for CdcStrategy {}
459
460/// A set of reusable connection configurations to be used as a source or destination for a stream.
461///
462/// # Activities
463///
464/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
465/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
466///
467/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (request)
468/// * [locations connection profiles get projects](ProjectLocationConnectionProfileGetCall) (response)
469/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (request)
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct ConnectionProfile {
474 /// BigQuery Connection Profile configuration.
475 #[serde(rename = "bigqueryProfile")]
476 pub bigquery_profile: Option<BigQueryProfile>,
477 /// Output only. The create time of the resource.
478 #[serde(rename = "createTime")]
479 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
480 /// Required. Display name.
481 #[serde(rename = "displayName")]
482 pub display_name: Option<String>,
483 /// Forward SSH tunnel connectivity.
484 #[serde(rename = "forwardSshConnectivity")]
485 pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
486 /// Cloud Storage ConnectionProfile configuration.
487 #[serde(rename = "gcsProfile")]
488 pub gcs_profile: Option<GcsProfile>,
489 /// Labels.
490 pub labels: Option<HashMap<String, String>>,
491 /// MongoDB Connection Profile configuration.
492 #[serde(rename = "mongodbProfile")]
493 pub mongodb_profile: Option<MongodbProfile>,
494 /// MySQL ConnectionProfile configuration.
495 #[serde(rename = "mysqlProfile")]
496 pub mysql_profile: Option<MysqlProfile>,
497 /// Output only. Identifier. The resource's name.
498 pub name: Option<String>,
499 /// Oracle ConnectionProfile configuration.
500 #[serde(rename = "oracleProfile")]
501 pub oracle_profile: Option<OracleProfile>,
502 /// PostgreSQL Connection Profile configuration.
503 #[serde(rename = "postgresqlProfile")]
504 pub postgresql_profile: Option<PostgresqlProfile>,
505 /// Private connectivity.
506 #[serde(rename = "privateConnectivity")]
507 pub private_connectivity: Option<PrivateConnectivity>,
508 /// Salesforce Connection Profile configuration.
509 #[serde(rename = "salesforceProfile")]
510 pub salesforce_profile: Option<SalesforceProfile>,
511 /// Output only. Reserved for future use.
512 #[serde(rename = "satisfiesPzi")]
513 pub satisfies_pzi: Option<bool>,
514 /// Output only. Reserved for future use.
515 #[serde(rename = "satisfiesPzs")]
516 pub satisfies_pzs: Option<bool>,
517 /// SQLServer Connection Profile configuration.
518 #[serde(rename = "sqlServerProfile")]
519 pub sql_server_profile: Option<SqlServerProfile>,
520 /// Static Service IP connectivity.
521 #[serde(rename = "staticServiceIpConnectivity")]
522 pub static_service_ip_connectivity: Option<StaticServiceIpConnectivity>,
523 /// Output only. The update time of the resource.
524 #[serde(rename = "updateTime")]
525 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
526}
527
528impl common::RequestValue for ConnectionProfile {}
529impl common::ResponseResult for ConnectionProfile {}
530
531/// A customization rule to apply to a set of objects.
532///
533/// This type is not used in any activity, and only used as *part* of another schema.
534///
535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
536#[serde_with::serde_as]
537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
538pub struct CustomizationRule {
539 /// BigQuery clustering rule.
540 #[serde(rename = "bigqueryClustering")]
541 pub bigquery_clustering: Option<BigQueryClustering>,
542 /// BigQuery partitioning rule.
543 #[serde(rename = "bigqueryPartitioning")]
544 pub bigquery_partitioning: Option<BigQueryPartitioning>,
545}
546
547impl common::Part for CustomizationRule {}
548
549/// Dataset template used for dynamic dataset creation.
550///
551/// This type is not used in any activity, and only used as *part* of another schema.
552///
553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
554#[serde_with::serde_as]
555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
556pub struct DatasetTemplate {
557 /// If supplied, every created dataset will have its name prefixed by the provided value. The prefix and name will be separated by an underscore. i.e. _.
558 #[serde(rename = "datasetIdPrefix")]
559 pub dataset_id_prefix: Option<String>,
560 /// Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key. i.e. projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryptoKey}. See https://cloud.google.com/bigquery/docs/customer-managed-encryption for more information.
561 #[serde(rename = "kmsKeyName")]
562 pub kms_key_name: Option<String>,
563 /// Required. The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.
564 pub location: Option<String>,
565}
566
567impl common::Part for DatasetTemplate {}
568
569/// The configuration of the stream destination.
570///
571/// This type is not used in any activity, and only used as *part* of another schema.
572///
573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
574#[serde_with::serde_as]
575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
576pub struct DestinationConfig {
577 /// BigQuery destination configuration.
578 #[serde(rename = "bigqueryDestinationConfig")]
579 pub bigquery_destination_config: Option<BigQueryDestinationConfig>,
580 /// Required. Destination connection profile resource. Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
581 #[serde(rename = "destinationConnectionProfile")]
582 pub destination_connection_profile: Option<String>,
583 /// A configuration for how data should be loaded to Cloud Storage.
584 #[serde(rename = "gcsDestinationConfig")]
585 pub gcs_destination_config: Option<GcsDestinationConfig>,
586}
587
588impl common::Part for DestinationConfig {}
589
590/// Request message for ‘discover’ ConnectionProfile request.
591///
592/// # Activities
593///
594/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
595/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
596///
597/// * [locations connection profiles discover projects](ProjectLocationConnectionProfileDiscoverCall) (request)
598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
599#[serde_with::serde_as]
600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
601pub struct DiscoverConnectionProfileRequest {
602 /// An ad-hoc connection profile configuration.
603 #[serde(rename = "connectionProfile")]
604 pub connection_profile: Option<ConnectionProfile>,
605 /// A reference to an existing connection profile.
606 #[serde(rename = "connectionProfileName")]
607 pub connection_profile_name: Option<String>,
608 /// Whether to retrieve the full hierarchy of data objects (TRUE) or only the current level (FALSE).
609 #[serde(rename = "fullHierarchy")]
610 pub full_hierarchy: Option<bool>,
611 /// The number of hierarchy levels below the current level to be retrieved.
612 #[serde(rename = "hierarchyDepth")]
613 pub hierarchy_depth: Option<i32>,
614 /// MongoDB cluster to enrich with child data objects and metadata.
615 #[serde(rename = "mongodbCluster")]
616 pub mongodb_cluster: Option<MongodbCluster>,
617 /// MySQL RDBMS to enrich with child data objects and metadata.
618 #[serde(rename = "mysqlRdbms")]
619 pub mysql_rdbms: Option<MysqlRdbms>,
620 /// Oracle RDBMS to enrich with child data objects and metadata.
621 #[serde(rename = "oracleRdbms")]
622 pub oracle_rdbms: Option<OracleRdbms>,
623 /// PostgreSQL RDBMS to enrich with child data objects and metadata.
624 #[serde(rename = "postgresqlRdbms")]
625 pub postgresql_rdbms: Option<PostgresqlRdbms>,
626 /// Salesforce organization to enrich with child data objects and metadata.
627 #[serde(rename = "salesforceOrg")]
628 pub salesforce_org: Option<SalesforceOrg>,
629 /// SQLServer RDBMS to enrich with child data objects and metadata.
630 #[serde(rename = "sqlServerRdbms")]
631 pub sql_server_rdbms: Option<SqlServerRdbms>,
632}
633
634impl common::RequestValue for DiscoverConnectionProfileRequest {}
635
636/// Response from a discover request.
637///
638/// # Activities
639///
640/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
641/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
642///
643/// * [locations connection profiles discover projects](ProjectLocationConnectionProfileDiscoverCall) (response)
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct DiscoverConnectionProfileResponse {
648 /// Enriched MongoDB cluster.
649 #[serde(rename = "mongodbCluster")]
650 pub mongodb_cluster: Option<MongodbCluster>,
651 /// Enriched MySQL RDBMS object.
652 #[serde(rename = "mysqlRdbms")]
653 pub mysql_rdbms: Option<MysqlRdbms>,
654 /// Enriched Oracle RDBMS object.
655 #[serde(rename = "oracleRdbms")]
656 pub oracle_rdbms: Option<OracleRdbms>,
657 /// Enriched PostgreSQL RDBMS object.
658 #[serde(rename = "postgresqlRdbms")]
659 pub postgresql_rdbms: Option<PostgresqlRdbms>,
660 /// Enriched Salesforce organization.
661 #[serde(rename = "salesforceOrg")]
662 pub salesforce_org: Option<SalesforceOrg>,
663 /// Enriched SQLServer RDBMS object.
664 #[serde(rename = "sqlServerRdbms")]
665 pub sql_server_rdbms: Option<SqlServerRdbms>,
666}
667
668impl common::ResponseResult for DiscoverConnectionProfileResponse {}
669
670/// Configuration to drop large object values.
671///
672/// This type is not used in any activity, and only used as *part* of another schema.
673///
674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
675#[serde_with::serde_as]
676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
677pub struct DropLargeObjects {
678 _never_set: Option<bool>,
679}
680
681impl common::Part for DropLargeObjects {}
682
683/// 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); }
684///
685/// # Activities
686///
687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
689///
690/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
691/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct Empty {
696 _never_set: Option<bool>,
697}
698
699impl common::ResponseResult for Empty {}
700
701/// Message to represent the option where Datastream will enforce encryption and authenticate server identity. ca_certificate must be set if user selects this option.
702///
703/// This type is not used in any activity, and only used as *part* of another schema.
704///
705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
706#[serde_with::serde_as]
707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
708pub struct EncryptionAndServerValidation {
709 /// Optional. Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
710 #[serde(rename = "caCertificate")]
711 pub ca_certificate: Option<String>,
712 /// Optional. The hostname mentioned in the Subject or SAN extension of the server certificate. This field is used for bypassing the hostname validation while verifying server certificate. This is required for scenarios where the host name that datastream connects to is different from the certificate's subject. This specifically happens for private connectivity. It could also happen when the customer provides a public IP in connection profile but the same is not present in the server certificate.
713 #[serde(rename = "serverCertificateHostname")]
714 pub server_certificate_hostname: Option<String>,
715}
716
717impl common::Part for EncryptionAndServerValidation {}
718
719/// Message to represent the option where encryption is not enforced. An empty message right now to allow future extensibility.
720///
721/// This type is not used in any activity, and only used as *part* of another schema.
722///
723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
724#[serde_with::serde_as]
725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
726pub struct EncryptionNotEnforced {
727 _never_set: Option<bool>,
728}
729
730impl common::Part for EncryptionNotEnforced {}
731
732/// Represent a user-facing Error.
733///
734/// This type is not used in any activity, and only used as *part* of another schema.
735///
736#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
737#[serde_with::serde_as]
738#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
739pub struct Error {
740 /// Additional information about the error.
741 pub details: Option<HashMap<String, String>>,
742 /// The time when the error occurred.
743 #[serde(rename = "errorTime")]
744 pub error_time: Option<chrono::DateTime<chrono::offset::Utc>>,
745 /// A unique identifier for this specific error, allowing it to be traced throughout the system in logs and API responses.
746 #[serde(rename = "errorUuid")]
747 pub error_uuid: Option<String>,
748 /// A message containing more information about the error that occurred.
749 pub message: Option<String>,
750 /// A title that explains the reason for the error.
751 pub reason: Option<String>,
752}
753
754impl common::Part for Error {}
755
756/// Represents a filter for included data on a stream object.
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct EventFilter {
764 /// An SQL-query Where clause selecting which data should be included, not including the "WHERE" keyword. E.g., "t.key1 = 'value1' AND t.key2 = 'value2'".
765 #[serde(rename = "sqlWhereClause")]
766 pub sql_where_clause: Option<String>,
767}
768
769impl common::Part for EventFilter {}
770
771/// Response message for a ‘FetchStaticIps’ response.
772///
773/// # Activities
774///
775/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
776/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
777///
778/// * [locations fetch static ips projects](ProjectLocationFetchStaticIpCall) (response)
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct FetchStaticIpsResponse {
783 /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
784 #[serde(rename = "nextPageToken")]
785 pub next_page_token: Option<String>,
786 /// list of static ips by account
787 #[serde(rename = "staticIps")]
788 pub static_ips: Option<Vec<String>>,
789}
790
791impl common::ResponseResult for FetchStaticIpsResponse {}
792
793/// Forward SSH Tunnel connectivity.
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct ForwardSshTunnelConnectivity {
801 /// Required. Hostname for the SSH tunnel.
802 pub hostname: Option<String>,
803 /// Input only. SSH password.
804 pub password: Option<String>,
805 /// Port for the SSH tunnel, default value is 22.
806 pub port: Option<i32>,
807 /// Input only. SSH private key.
808 #[serde(rename = "privateKey")]
809 pub private_key: Option<String>,
810 /// Required. Username for the SSH tunnel.
811 pub username: Option<String>,
812}
813
814impl common::Part for ForwardSshTunnelConnectivity {}
815
816/// Google Cloud Storage destination configuration
817///
818/// This type is not used in any activity, and only used as *part* of another schema.
819///
820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
821#[serde_with::serde_as]
822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
823pub struct GcsDestinationConfig {
824 /// AVRO file format configuration.
825 #[serde(rename = "avroFileFormat")]
826 pub avro_file_format: Option<AvroFileFormat>,
827 /// The maximum duration for which new events are added before a file is closed and a new file is created. Values within the range of 15-60 seconds are allowed.
828 #[serde(rename = "fileRotationInterval")]
829 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
830 pub file_rotation_interval: Option<chrono::Duration>,
831 /// The maximum file size to be saved in the bucket.
832 #[serde(rename = "fileRotationMb")]
833 pub file_rotation_mb: Option<i32>,
834 /// JSON file format configuration.
835 #[serde(rename = "jsonFileFormat")]
836 pub json_file_format: Option<JsonFileFormat>,
837 /// Path inside the Cloud Storage bucket to write data to.
838 pub path: Option<String>,
839}
840
841impl common::Part for GcsDestinationConfig {}
842
843/// Cloud Storage bucket profile.
844///
845/// This type is not used in any activity, and only used as *part* of another schema.
846///
847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
848#[serde_with::serde_as]
849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
850pub struct GcsProfile {
851 /// Required. The Cloud Storage bucket name.
852 pub bucket: Option<String>,
853 /// The root path inside the Cloud Storage bucket.
854 #[serde(rename = "rootPath")]
855 pub root_path: Option<String>,
856}
857
858impl common::Part for GcsProfile {}
859
860/// Use GTID based replication.
861///
862/// This type is not used in any activity, and only used as *part* of another schema.
863///
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct Gtid {
868 _never_set: Option<bool>,
869}
870
871impl common::Part for Gtid {}
872
873/// A HostAddress represents a transport end point, which is the combination of an IP address or hostname and a port number.
874///
875/// This type is not used in any activity, and only used as *part* of another schema.
876///
877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
878#[serde_with::serde_as]
879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
880pub struct HostAddress {
881 /// Required. Hostname for the connection.
882 pub hostname: Option<String>,
883 /// Optional. Port for the connection.
884 pub port: Option<i32>,
885}
886
887impl common::Part for HostAddress {}
888
889/// Ingestion time partitioning. see https://cloud.google.com/bigquery/docs/partitioned-tables#ingestion_time
890///
891/// This type is not used in any activity, and only used as *part* of another schema.
892///
893#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
894#[serde_with::serde_as]
895#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
896pub struct IngestionTimePartition {
897 /// Optional. Partition granularity
898 #[serde(rename = "partitioningTimeGranularity")]
899 pub partitioning_time_granularity: Option<String>,
900}
901
902impl common::Part for IngestionTimePartition {}
903
904/// Integer range partitioning. see https://cloud.google.com/bigquery/docs/partitioned-tables#integer_range
905///
906/// This type is not used in any activity, and only used as *part* of another schema.
907///
908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
909#[serde_with::serde_as]
910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
911pub struct IntegerRangePartition {
912 /// Required. The partitioning column.
913 pub column: Option<String>,
914 /// Required. The ending value for range partitioning (exclusive).
915 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
916 pub end: Option<i64>,
917 /// Required. The interval of each range within the partition.
918 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
919 pub interval: Option<i64>,
920 /// Required. The starting value for range partitioning (inclusive).
921 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
922 pub start: Option<i64>,
923}
924
925impl common::Part for IntegerRangePartition {}
926
927/// JSON file format configuration.
928///
929/// This type is not used in any activity, and only used as *part* of another schema.
930///
931#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
932#[serde_with::serde_as]
933#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
934pub struct JsonFileFormat {
935 /// Compression of the loaded JSON file.
936 pub compression: Option<String>,
937 /// The schema file format along JSON data files.
938 #[serde(rename = "schemaFileFormat")]
939 pub schema_file_format: Option<String>,
940}
941
942impl common::Part for JsonFileFormat {}
943
944/// Response message for listing connection profiles.
945///
946/// # Activities
947///
948/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
949/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
950///
951/// * [locations connection profiles list projects](ProjectLocationConnectionProfileListCall) (response)
952#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
953#[serde_with::serde_as]
954#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
955pub struct ListConnectionProfilesResponse {
956 /// List of connection profiles.
957 #[serde(rename = "connectionProfiles")]
958 pub connection_profiles: Option<Vec<ConnectionProfile>>,
959 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
960 #[serde(rename = "nextPageToken")]
961 pub next_page_token: Option<String>,
962 /// Locations that could not be reached.
963 pub unreachable: Option<Vec<String>>,
964}
965
966impl common::ResponseResult for ListConnectionProfilesResponse {}
967
968/// The response message for Locations.ListLocations.
969///
970/// # Activities
971///
972/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
973/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
974///
975/// * [locations list projects](ProjectLocationListCall) (response)
976#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
977#[serde_with::serde_as]
978#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
979pub struct ListLocationsResponse {
980 /// A list of locations that matches the specified filter in the request.
981 pub locations: Option<Vec<Location>>,
982 /// The standard List next-page token.
983 #[serde(rename = "nextPageToken")]
984 pub next_page_token: Option<String>,
985}
986
987impl common::ResponseResult for ListLocationsResponse {}
988
989/// The response message for Operations.ListOperations.
990///
991/// # Activities
992///
993/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
994/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
995///
996/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
998#[serde_with::serde_as]
999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1000pub struct ListOperationsResponse {
1001 /// The standard List next-page token.
1002 #[serde(rename = "nextPageToken")]
1003 pub next_page_token: Option<String>,
1004 /// A list of operations that matches the specified filter in the request.
1005 pub operations: Option<Vec<Operation>>,
1006 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
1007 pub unreachable: Option<Vec<String>>,
1008}
1009
1010impl common::ResponseResult for ListOperationsResponse {}
1011
1012/// Response containing a list of private connection configurations.
1013///
1014/// # Activities
1015///
1016/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1017/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1018///
1019/// * [locations private connections list projects](ProjectLocationPrivateConnectionListCall) (response)
1020#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1021#[serde_with::serde_as]
1022#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1023pub struct ListPrivateConnectionsResponse {
1024 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1025 #[serde(rename = "nextPageToken")]
1026 pub next_page_token: Option<String>,
1027 /// List of private connectivity configurations.
1028 #[serde(rename = "privateConnections")]
1029 pub private_connections: Option<Vec<PrivateConnection>>,
1030 /// Locations that could not be reached.
1031 pub unreachable: Option<Vec<String>>,
1032}
1033
1034impl common::ResponseResult for ListPrivateConnectionsResponse {}
1035
1036/// Route list response.
1037///
1038/// # Activities
1039///
1040/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1041/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1042///
1043/// * [locations private connections routes list projects](ProjectLocationPrivateConnectionRouteListCall) (response)
1044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1045#[serde_with::serde_as]
1046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1047pub struct ListRoutesResponse {
1048 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1049 #[serde(rename = "nextPageToken")]
1050 pub next_page_token: Option<String>,
1051 /// List of Routes.
1052 pub routes: Option<Vec<Route>>,
1053 /// Locations that could not be reached.
1054 pub unreachable: Option<Vec<String>>,
1055}
1056
1057impl common::ResponseResult for ListRoutesResponse {}
1058
1059/// Response containing the objects for a stream.
1060///
1061/// # Activities
1062///
1063/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1064/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1065///
1066/// * [locations streams objects list projects](ProjectLocationStreamObjectListCall) (response)
1067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1068#[serde_with::serde_as]
1069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1070pub struct ListStreamObjectsResponse {
1071 /// A token, which can be sent as `page_token` to retrieve the next page.
1072 #[serde(rename = "nextPageToken")]
1073 pub next_page_token: Option<String>,
1074 /// List of stream objects.
1075 #[serde(rename = "streamObjects")]
1076 pub stream_objects: Option<Vec<StreamObject>>,
1077}
1078
1079impl common::ResponseResult for ListStreamObjectsResponse {}
1080
1081/// Response message for listing streams.
1082///
1083/// # Activities
1084///
1085/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1086/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1087///
1088/// * [locations streams list projects](ProjectLocationStreamListCall) (response)
1089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1090#[serde_with::serde_as]
1091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1092pub struct ListStreamsResponse {
1093 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1094 #[serde(rename = "nextPageToken")]
1095 pub next_page_token: Option<String>,
1096 /// List of streams
1097 pub streams: Option<Vec<Stream>>,
1098 /// Locations that could not be reached.
1099 pub unreachable: Option<Vec<String>>,
1100}
1101
1102impl common::ResponseResult for ListStreamsResponse {}
1103
1104/// A resource that represents a Google Cloud location.
1105///
1106/// # Activities
1107///
1108/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1109/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1110///
1111/// * [locations get projects](ProjectLocationGetCall) (response)
1112#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1113#[serde_with::serde_as]
1114#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1115pub struct Location {
1116 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1117 #[serde(rename = "displayName")]
1118 pub display_name: Option<String>,
1119 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1120 pub labels: Option<HashMap<String, String>>,
1121 /// The canonical id for this location. For example: `"us-east1"`.
1122 #[serde(rename = "locationId")]
1123 pub location_id: Option<String>,
1124 /// Service-specific metadata. For example the available capacity at the given location.
1125 pub metadata: Option<HashMap<String, serde_json::Value>>,
1126 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1127 pub name: Option<String>,
1128}
1129
1130impl common::ResponseResult for Location {}
1131
1132/// Configuration to specify the Oracle directories to access the log files.
1133///
1134/// This type is not used in any activity, and only used as *part* of another schema.
1135///
1136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1137#[serde_with::serde_as]
1138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1139pub struct LogFileDirectories {
1140 /// Required. Oracle directory for archived logs.
1141 #[serde(rename = "archivedLogDirectory")]
1142 pub archived_log_directory: Option<String>,
1143 /// Required. Oracle directory for online logs.
1144 #[serde(rename = "onlineLogDirectory")]
1145 pub online_log_directory: Option<String>,
1146}
1147
1148impl common::Part for LogFileDirectories {}
1149
1150/// Configuration to use LogMiner CDC method.
1151///
1152/// This type is not used in any activity, and only used as *part* of another schema.
1153///
1154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1155#[serde_with::serde_as]
1156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1157pub struct LogMiner {
1158 _never_set: Option<bool>,
1159}
1160
1161impl common::Part for LogMiner {}
1162
1163/// Request for looking up a specific stream object by its source object identifier.
1164///
1165/// # Activities
1166///
1167/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1168/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1169///
1170/// * [locations streams objects lookup projects](ProjectLocationStreamObjectLookupCall) (request)
1171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1172#[serde_with::serde_as]
1173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1174pub struct LookupStreamObjectRequest {
1175 /// Required. The source object identifier which maps to the stream object.
1176 #[serde(rename = "sourceObjectIdentifier")]
1177 pub source_object_identifier: Option<SourceObjectIdentifier>,
1178}
1179
1180impl common::RequestValue for LookupStreamObjectRequest {}
1181
1182/// Merge mode defines that all changes to a table will be merged at the destination table.
1183///
1184/// This type is not used in any activity, and only used as *part* of another schema.
1185///
1186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1187#[serde_with::serde_as]
1188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1189pub struct Merge {
1190 _never_set: Option<bool>,
1191}
1192
1193impl common::Part for Merge {}
1194
1195/// MongoDB change stream position
1196///
1197/// This type is not used in any activity, and only used as *part* of another schema.
1198///
1199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1200#[serde_with::serde_as]
1201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1202pub struct MongodbChangeStreamPosition {
1203 /// Required. The timestamp to start change stream from.
1204 #[serde(rename = "startTime")]
1205 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1206}
1207
1208impl common::Part for MongodbChangeStreamPosition {}
1209
1210/// MongoDB Cluster structure.
1211///
1212/// This type is not used in any activity, and only used as *part* of another schema.
1213///
1214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1215#[serde_with::serde_as]
1216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1217pub struct MongodbCluster {
1218 /// MongoDB databases in the cluster.
1219 pub databases: Option<Vec<MongodbDatabase>>,
1220}
1221
1222impl common::Part for MongodbCluster {}
1223
1224/// MongoDB Collection.
1225///
1226/// This type is not used in any activity, and only used as *part* of another schema.
1227///
1228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1229#[serde_with::serde_as]
1230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1231pub struct MongodbCollection {
1232 /// Collection name.
1233 pub collection: Option<String>,
1234 /// Fields in the collection.
1235 pub fields: Option<Vec<MongodbField>>,
1236}
1237
1238impl common::Part for MongodbCollection {}
1239
1240/// MongoDB Database.
1241///
1242/// This type is not used in any activity, and only used as *part* of another schema.
1243///
1244#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1245#[serde_with::serde_as]
1246#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1247pub struct MongodbDatabase {
1248 /// Collections in the database.
1249 pub collections: Option<Vec<MongodbCollection>>,
1250 /// Database name.
1251 pub database: Option<String>,
1252}
1253
1254impl common::Part for MongodbDatabase {}
1255
1256/// MongoDB Field.
1257///
1258/// This type is not used in any activity, and only used as *part* of another schema.
1259///
1260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1261#[serde_with::serde_as]
1262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1263pub struct MongodbField {
1264 /// Field name.
1265 pub field: Option<String>,
1266}
1267
1268impl common::Part for MongodbField {}
1269
1270/// MongoDB data source object identifier.
1271///
1272/// This type is not used in any activity, and only used as *part* of another schema.
1273///
1274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1275#[serde_with::serde_as]
1276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1277pub struct MongodbObjectIdentifier {
1278 /// Required. The collection name.
1279 pub collection: Option<String>,
1280 /// Required. The database name.
1281 pub database: Option<String>,
1282}
1283
1284impl common::Part for MongodbObjectIdentifier {}
1285
1286/// MongoDB profile.
1287///
1288/// This type is not used in any activity, and only used as *part* of another schema.
1289///
1290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1291#[serde_with::serde_as]
1292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1293pub struct MongodbProfile {
1294 /// Optional. Specifies additional options for the MongoDB connection. The options should be sent as key-value pairs, for example: `additional_options = {"serverSelectionTimeoutMS": "10000", "directConnection": "true"}`. Keys are case-sensitive and should match the official MongoDB connection string options: https://www.mongodb.com/docs/manual/reference/connection-string-options/ The server will not modify the values provided by the user.
1295 #[serde(rename = "additionalOptions")]
1296 pub additional_options: Option<HashMap<String, String>>,
1297 /// Required. List of host addresses for a MongoDB cluster. For SRV connection format, this list must contain exactly one DNS host without a port. For Standard connection format, this list must contain all the required hosts in the cluster with their respective ports.
1298 #[serde(rename = "hostAddresses")]
1299 pub host_addresses: Option<Vec<HostAddress>>,
1300 /// Optional. Password for the MongoDB connection. Mutually exclusive with the `secret_manager_stored_password` field.
1301 pub password: Option<String>,
1302 /// Optional. Name of the replica set. Only needed for self hosted replica set type MongoDB cluster. For SRV connection format, this field must be empty. For Standard connection format, this field must be specified.
1303 #[serde(rename = "replicaSet")]
1304 pub replica_set: Option<String>,
1305 /// Optional. A reference to a Secret Manager resource name storing the SQLServer connection password. Mutually exclusive with the `password` field.
1306 #[serde(rename = "secretManagerStoredPassword")]
1307 pub secret_manager_stored_password: Option<String>,
1308 /// Srv connection format.
1309 #[serde(rename = "srvConnectionFormat")]
1310 pub srv_connection_format: Option<SrvConnectionFormat>,
1311 /// Optional. SSL configuration for the MongoDB connection.
1312 #[serde(rename = "sslConfig")]
1313 pub ssl_config: Option<MongodbSslConfig>,
1314 /// Standard connection format.
1315 #[serde(rename = "standardConnectionFormat")]
1316 pub standard_connection_format: Option<StandardConnectionFormat>,
1317 /// Required. Username for the MongoDB connection.
1318 pub username: Option<String>,
1319}
1320
1321impl common::Part for MongodbProfile {}
1322
1323/// MongoDB source configuration.
1324///
1325/// This type is not used in any activity, and only used as *part* of another schema.
1326///
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct MongodbSourceConfig {
1331 /// MongoDB collections to exclude from the stream.
1332 #[serde(rename = "excludeObjects")]
1333 pub exclude_objects: Option<MongodbCluster>,
1334 /// MongoDB collections to include in the stream.
1335 #[serde(rename = "includeObjects")]
1336 pub include_objects: Option<MongodbCluster>,
1337 /// Optional. MongoDB JSON mode to use for the stream.
1338 #[serde(rename = "jsonMode")]
1339 pub json_mode: Option<String>,
1340 /// Optional. Maximum number of concurrent backfill tasks. The number should be non-negative and less than or equal to 50. If not set (or set to 0), the system's default value is used
1341 #[serde(rename = "maxConcurrentBackfillTasks")]
1342 pub max_concurrent_backfill_tasks: Option<i32>,
1343}
1344
1345impl common::Part for MongodbSourceConfig {}
1346
1347/// MongoDB SSL configuration information.
1348///
1349/// This type is not used in any activity, and only used as *part* of another schema.
1350///
1351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1352#[serde_with::serde_as]
1353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1354pub struct MongodbSslConfig {
1355 /// Optional. Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
1356 #[serde(rename = "caCertificate")]
1357 pub ca_certificate: Option<String>,
1358 /// Output only. Indicates whether the ca_certificate field is set.
1359 #[serde(rename = "caCertificateSet")]
1360 pub ca_certificate_set: Option<bool>,
1361 /// Optional. Input only. PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'client_key' and the 'ca_certificate' fields are mandatory.
1362 #[serde(rename = "clientCertificate")]
1363 pub client_certificate: Option<String>,
1364 /// Output only. Indicates whether the client_certificate field is set.
1365 #[serde(rename = "clientCertificateSet")]
1366 pub client_certificate_set: Option<bool>,
1367 /// Optional. Input only. PEM-encoded private key associated with the Client Certificate. If this field is used then the 'client_certificate' and the 'ca_certificate' fields are mandatory.
1368 #[serde(rename = "clientKey")]
1369 pub client_key: Option<String>,
1370 /// Output only. Indicates whether the client_key field is set.
1371 #[serde(rename = "clientKeySet")]
1372 pub client_key_set: Option<bool>,
1373 /// Optional. Input only. A reference to a Secret Manager resource name storing the PEM-encoded private key associated with the Client Certificate. If this field is used then the 'client_certificate' and the 'ca_certificate' fields are mandatory. Mutually exclusive with the `client_key` field.
1374 #[serde(rename = "secretManagerStoredClientKey")]
1375 pub secret_manager_stored_client_key: Option<String>,
1376}
1377
1378impl common::Part for MongodbSslConfig {}
1379
1380/// CDC strategy to start replicating from the most recent position in the source.
1381///
1382/// This type is not used in any activity, and only used as *part* of another schema.
1383///
1384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1385#[serde_with::serde_as]
1386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1387pub struct MostRecentStartPosition {
1388 _never_set: Option<bool>,
1389}
1390
1391impl common::Part for MostRecentStartPosition {}
1392
1393/// MySQL Column.
1394///
1395/// This type is not used in any activity, and only used as *part* of another schema.
1396///
1397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1398#[serde_with::serde_as]
1399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1400pub struct MysqlColumn {
1401 /// Column collation.
1402 pub collation: Option<String>,
1403 /// Column name.
1404 pub column: Option<String>,
1405 /// The MySQL data type. Full data types list can be found here: https://dev.mysql.com/doc/refman/8.0/en/data-types.html
1406 #[serde(rename = "dataType")]
1407 pub data_type: Option<String>,
1408 /// Column length.
1409 pub length: Option<i32>,
1410 /// Whether or not the column can accept a null value.
1411 pub nullable: Option<bool>,
1412 /// The ordinal position of the column in the table.
1413 #[serde(rename = "ordinalPosition")]
1414 pub ordinal_position: Option<i32>,
1415 /// Column precision.
1416 pub precision: Option<i32>,
1417 /// Whether or not the column represents a primary key.
1418 #[serde(rename = "primaryKey")]
1419 pub primary_key: Option<bool>,
1420 /// Column scale.
1421 pub scale: Option<i32>,
1422}
1423
1424impl common::Part for MysqlColumn {}
1425
1426/// MySQL database.
1427///
1428/// This type is not used in any activity, and only used as *part* of another schema.
1429///
1430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1431#[serde_with::serde_as]
1432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1433pub struct MysqlDatabase {
1434 /// Database name.
1435 pub database: Option<String>,
1436 /// Tables in the database.
1437 #[serde(rename = "mysqlTables")]
1438 pub mysql_tables: Option<Vec<MysqlTable>>,
1439}
1440
1441impl common::Part for MysqlDatabase {}
1442
1443/// MySQL GTID position
1444///
1445/// This type is not used in any activity, and only used as *part* of another schema.
1446///
1447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1448#[serde_with::serde_as]
1449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1450pub struct MysqlGtidPosition {
1451 /// Required. The gtid set to start replication from.
1452 #[serde(rename = "gtidSet")]
1453 pub gtid_set: Option<String>,
1454}
1455
1456impl common::Part for MysqlGtidPosition {}
1457
1458/// MySQL log position
1459///
1460/// This type is not used in any activity, and only used as *part* of another schema.
1461///
1462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1463#[serde_with::serde_as]
1464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1465pub struct MysqlLogPosition {
1466 /// Required. The binary log file name.
1467 #[serde(rename = "logFile")]
1468 pub log_file: Option<String>,
1469 /// Optional. The position within the binary log file. Default is head of file.
1470 #[serde(rename = "logPosition")]
1471 pub log_position: Option<i32>,
1472}
1473
1474impl common::Part for MysqlLogPosition {}
1475
1476/// Mysql data source object identifier.
1477///
1478/// This type is not used in any activity, and only used as *part* of another schema.
1479///
1480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1481#[serde_with::serde_as]
1482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1483pub struct MysqlObjectIdentifier {
1484 /// Required. The database name.
1485 pub database: Option<String>,
1486 /// Required. The table name.
1487 pub table: Option<String>,
1488}
1489
1490impl common::Part for MysqlObjectIdentifier {}
1491
1492/// MySQL database profile.
1493///
1494/// This type is not used in any activity, and only used as *part* of another schema.
1495///
1496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1497#[serde_with::serde_as]
1498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1499pub struct MysqlProfile {
1500 /// Required. Hostname for the MySQL connection.
1501 pub hostname: Option<String>,
1502 /// Optional. Input only. Password for the MySQL connection. Mutually exclusive with the `secret_manager_stored_password` field.
1503 pub password: Option<String>,
1504 /// Port for the MySQL connection, default value is 3306.
1505 pub port: Option<i32>,
1506 /// Optional. A reference to a Secret Manager resource name storing the MySQL connection password. Mutually exclusive with the `password` field.
1507 #[serde(rename = "secretManagerStoredPassword")]
1508 pub secret_manager_stored_password: Option<String>,
1509 /// SSL configuration for the MySQL connection.
1510 #[serde(rename = "sslConfig")]
1511 pub ssl_config: Option<MysqlSslConfig>,
1512 /// Required. Username for the MySQL connection.
1513 pub username: Option<String>,
1514}
1515
1516impl common::Part for MysqlProfile {}
1517
1518/// MySQL database structure
1519///
1520/// This type is not used in any activity, and only used as *part* of another schema.
1521///
1522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1523#[serde_with::serde_as]
1524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1525pub struct MysqlRdbms {
1526 /// Mysql databases on the server
1527 #[serde(rename = "mysqlDatabases")]
1528 pub mysql_databases: Option<Vec<MysqlDatabase>>,
1529}
1530
1531impl common::Part for MysqlRdbms {}
1532
1533/// MySQL source configuration
1534///
1535/// This type is not used in any activity, and only used as *part* of another schema.
1536///
1537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1538#[serde_with::serde_as]
1539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1540pub struct MysqlSourceConfig {
1541 /// Use Binary log position based replication.
1542 #[serde(rename = "binaryLogPosition")]
1543 pub binary_log_position: Option<BinaryLogPosition>,
1544 /// MySQL objects to exclude from the stream.
1545 #[serde(rename = "excludeObjects")]
1546 pub exclude_objects: Option<MysqlRdbms>,
1547 /// Use GTID based replication.
1548 pub gtid: Option<Gtid>,
1549 /// MySQL objects to retrieve from the source.
1550 #[serde(rename = "includeObjects")]
1551 pub include_objects: Option<MysqlRdbms>,
1552 /// Maximum number of concurrent backfill tasks. The number should be non negative. If not set (or set to 0), the system's default value will be used.
1553 #[serde(rename = "maxConcurrentBackfillTasks")]
1554 pub max_concurrent_backfill_tasks: Option<i32>,
1555 /// Maximum number of concurrent CDC tasks. The number should be non negative. If not set (or set to 0), the system's default value will be used.
1556 #[serde(rename = "maxConcurrentCdcTasks")]
1557 pub max_concurrent_cdc_tasks: Option<i32>,
1558}
1559
1560impl common::Part for MysqlSourceConfig {}
1561
1562/// MySQL SSL configuration information.
1563///
1564/// This type is not used in any activity, and only used as *part* of another schema.
1565///
1566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1567#[serde_with::serde_as]
1568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1569pub struct MysqlSslConfig {
1570 /// Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
1571 #[serde(rename = "caCertificate")]
1572 pub ca_certificate: Option<String>,
1573 /// Output only. Indicates whether the ca_certificate field is set.
1574 #[serde(rename = "caCertificateSet")]
1575 pub ca_certificate_set: Option<bool>,
1576 /// Optional. Input only. PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'client_key' and the 'ca_certificate' fields are mandatory.
1577 #[serde(rename = "clientCertificate")]
1578 pub client_certificate: Option<String>,
1579 /// Output only. Indicates whether the client_certificate field is set.
1580 #[serde(rename = "clientCertificateSet")]
1581 pub client_certificate_set: Option<bool>,
1582 /// Optional. Input only. PEM-encoded private key associated with the Client Certificate. If this field is used then the 'client_certificate' and the 'ca_certificate' fields are mandatory.
1583 #[serde(rename = "clientKey")]
1584 pub client_key: Option<String>,
1585 /// Output only. Indicates whether the client_key field is set.
1586 #[serde(rename = "clientKeySet")]
1587 pub client_key_set: Option<bool>,
1588}
1589
1590impl common::Part for MysqlSslConfig {}
1591
1592/// MySQL table.
1593///
1594/// This type is not used in any activity, and only used as *part* of another schema.
1595///
1596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1597#[serde_with::serde_as]
1598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1599pub struct MysqlTable {
1600 /// MySQL columns in the database. When unspecified as part of include/exclude objects, includes/excludes everything.
1601 #[serde(rename = "mysqlColumns")]
1602 pub mysql_columns: Option<Vec<MysqlColumn>>,
1603 /// Table name.
1604 pub table: Option<String>,
1605}
1606
1607impl common::Part for MysqlTable {}
1608
1609/// CDC strategy to resume replication from the next available position in the source.
1610///
1611/// This type is not used in any activity, and only used as *part* of another schema.
1612///
1613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1614#[serde_with::serde_as]
1615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1616pub struct NextAvailableStartPosition {
1617 _never_set: Option<bool>,
1618}
1619
1620impl common::Part for NextAvailableStartPosition {}
1621
1622/// OAuth2 Client Credentials.
1623///
1624/// This type is not used in any activity, and only used as *part* of another schema.
1625///
1626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1627#[serde_with::serde_as]
1628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1629pub struct Oauth2ClientCredentials {
1630 /// Required. Client ID for Salesforce OAuth2 Client Credentials.
1631 #[serde(rename = "clientId")]
1632 pub client_id: Option<String>,
1633 /// Optional. Client secret for Salesforce OAuth2 Client Credentials. Mutually exclusive with the `secret_manager_stored_client_secret` field.
1634 #[serde(rename = "clientSecret")]
1635 pub client_secret: Option<String>,
1636 /// Optional. A reference to a Secret Manager resource name storing the Salesforce OAuth2 client_secret. Mutually exclusive with the `client_secret` field.
1637 #[serde(rename = "secretManagerStoredClientSecret")]
1638 pub secret_manager_stored_client_secret: Option<String>,
1639}
1640
1641impl common::Part for Oauth2ClientCredentials {}
1642
1643/// Object filter to apply the rules to.
1644///
1645/// This type is not used in any activity, and only used as *part* of another schema.
1646///
1647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1648#[serde_with::serde_as]
1649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1650pub struct ObjectFilter {
1651 /// Specific source object identifier.
1652 #[serde(rename = "sourceObjectIdentifier")]
1653 pub source_object_identifier: Option<SourceObjectIdentifier>,
1654}
1655
1656impl common::Part for ObjectFilter {}
1657
1658/// This resource represents a long-running operation that is the result of a network API call.
1659///
1660/// # Activities
1661///
1662/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1663/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1664///
1665/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (response)
1666/// * [locations connection profiles delete projects](ProjectLocationConnectionProfileDeleteCall) (response)
1667/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (response)
1668/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1669/// * [locations private connections routes create projects](ProjectLocationPrivateConnectionRouteCreateCall) (response)
1670/// * [locations private connections routes delete projects](ProjectLocationPrivateConnectionRouteDeleteCall) (response)
1671/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (response)
1672/// * [locations private connections delete projects](ProjectLocationPrivateConnectionDeleteCall) (response)
1673/// * [locations streams create projects](ProjectLocationStreamCreateCall) (response)
1674/// * [locations streams delete projects](ProjectLocationStreamDeleteCall) (response)
1675/// * [locations streams patch projects](ProjectLocationStreamPatchCall) (response)
1676/// * [locations streams run projects](ProjectLocationStreamRunCall) (response)
1677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1678#[serde_with::serde_as]
1679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1680pub struct Operation {
1681 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1682 pub done: Option<bool>,
1683 /// The error result of the operation in case of failure or cancellation.
1684 pub error: Option<Status>,
1685 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1686 pub metadata: Option<HashMap<String, serde_json::Value>>,
1687 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1688 pub name: Option<String>,
1689 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1690 pub response: Option<HashMap<String, serde_json::Value>>,
1691}
1692
1693impl common::ResponseResult for Operation {}
1694
1695/// Configuration for Oracle Automatic Storage Management (ASM) connection.
1696///
1697/// This type is not used in any activity, and only used as *part* of another schema.
1698///
1699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1700#[serde_with::serde_as]
1701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1702pub struct OracleAsmConfig {
1703 /// Required. ASM service name for the Oracle ASM connection.
1704 #[serde(rename = "asmService")]
1705 pub asm_service: Option<String>,
1706 /// Optional. Connection string attributes
1707 #[serde(rename = "connectionAttributes")]
1708 pub connection_attributes: Option<HashMap<String, String>>,
1709 /// Required. Hostname for the Oracle ASM connection.
1710 pub hostname: Option<String>,
1711 /// Optional. SSL configuration for the Oracle connection.
1712 #[serde(rename = "oracleSslConfig")]
1713 pub oracle_ssl_config: Option<OracleSslConfig>,
1714 /// Optional. Password for the Oracle ASM connection. Mutually exclusive with the `secret_manager_stored_password` field.
1715 pub password: Option<String>,
1716 /// Required. Port for the Oracle ASM connection.
1717 pub port: Option<i32>,
1718 /// Optional. A reference to a Secret Manager resource name storing the Oracle ASM connection password. Mutually exclusive with the `password` field.
1719 #[serde(rename = "secretManagerStoredPassword")]
1720 pub secret_manager_stored_password: Option<String>,
1721 /// Required. Username for the Oracle ASM connection.
1722 pub username: Option<String>,
1723}
1724
1725impl common::Part for OracleAsmConfig {}
1726
1727/// Configuration to use Oracle ASM to access the log files.
1728///
1729/// This type is not used in any activity, and only used as *part* of another schema.
1730///
1731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1732#[serde_with::serde_as]
1733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1734pub struct OracleAsmLogFileAccess {
1735 _never_set: Option<bool>,
1736}
1737
1738impl common::Part for OracleAsmLogFileAccess {}
1739
1740/// Oracle Column.
1741///
1742/// This type is not used in any activity, and only used as *part* of another schema.
1743///
1744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1745#[serde_with::serde_as]
1746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1747pub struct OracleColumn {
1748 /// Column name.
1749 pub column: Option<String>,
1750 /// The Oracle data type.
1751 #[serde(rename = "dataType")]
1752 pub data_type: Option<String>,
1753 /// Column encoding.
1754 pub encoding: Option<String>,
1755 /// Column length.
1756 pub length: Option<i32>,
1757 /// Whether or not the column can accept a null value.
1758 pub nullable: Option<bool>,
1759 /// The ordinal position of the column in the table.
1760 #[serde(rename = "ordinalPosition")]
1761 pub ordinal_position: Option<i32>,
1762 /// Column precision.
1763 pub precision: Option<i32>,
1764 /// Whether or not the column represents a primary key.
1765 #[serde(rename = "primaryKey")]
1766 pub primary_key: Option<bool>,
1767 /// Column scale.
1768 pub scale: Option<i32>,
1769}
1770
1771impl common::Part for OracleColumn {}
1772
1773/// Oracle data source object identifier.
1774///
1775/// This type is not used in any activity, and only used as *part* of another schema.
1776///
1777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1778#[serde_with::serde_as]
1779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1780pub struct OracleObjectIdentifier {
1781 /// Required. The schema name.
1782 pub schema: Option<String>,
1783 /// Required. The table name.
1784 pub table: Option<String>,
1785}
1786
1787impl common::Part for OracleObjectIdentifier {}
1788
1789/// Oracle database profile.
1790///
1791/// This type is not used in any activity, and only used as *part* of another schema.
1792///
1793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1794#[serde_with::serde_as]
1795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1796pub struct OracleProfile {
1797 /// Connection string attributes
1798 #[serde(rename = "connectionAttributes")]
1799 pub connection_attributes: Option<HashMap<String, String>>,
1800 /// Required. Database for the Oracle connection.
1801 #[serde(rename = "databaseService")]
1802 pub database_service: Option<String>,
1803 /// Required. Hostname for the Oracle connection.
1804 pub hostname: Option<String>,
1805 /// Optional. Configuration for Oracle ASM connection.
1806 #[serde(rename = "oracleAsmConfig")]
1807 pub oracle_asm_config: Option<OracleAsmConfig>,
1808 /// Optional. SSL configuration for the Oracle connection.
1809 #[serde(rename = "oracleSslConfig")]
1810 pub oracle_ssl_config: Option<OracleSslConfig>,
1811 /// Optional. Password for the Oracle connection. Mutually exclusive with the `secret_manager_stored_password` field.
1812 pub password: Option<String>,
1813 /// Port for the Oracle connection, default value is 1521.
1814 pub port: Option<i32>,
1815 /// Optional. A reference to a Secret Manager resource name storing the Oracle connection password. Mutually exclusive with the `password` field.
1816 #[serde(rename = "secretManagerStoredPassword")]
1817 pub secret_manager_stored_password: Option<String>,
1818 /// Required. Username for the Oracle connection.
1819 pub username: Option<String>,
1820}
1821
1822impl common::Part for OracleProfile {}
1823
1824/// Oracle database structure.
1825///
1826/// This type is not used in any activity, and only used as *part* of another schema.
1827///
1828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1829#[serde_with::serde_as]
1830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1831pub struct OracleRdbms {
1832 /// Oracle schemas/databases in the database server.
1833 #[serde(rename = "oracleSchemas")]
1834 pub oracle_schemas: Option<Vec<OracleSchema>>,
1835}
1836
1837impl common::Part for OracleRdbms {}
1838
1839/// Oracle schema.
1840///
1841/// This type is not used in any activity, and only used as *part* of another schema.
1842///
1843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1844#[serde_with::serde_as]
1845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1846pub struct OracleSchema {
1847 /// Tables in the schema.
1848 #[serde(rename = "oracleTables")]
1849 pub oracle_tables: Option<Vec<OracleTable>>,
1850 /// Schema name.
1851 pub schema: Option<String>,
1852}
1853
1854impl common::Part for OracleSchema {}
1855
1856/// Oracle SCN position
1857///
1858/// This type is not used in any activity, and only used as *part* of another schema.
1859///
1860#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1861#[serde_with::serde_as]
1862#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1863pub struct OracleScnPosition {
1864 /// Required. SCN number from where Logs will be read
1865 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1866 pub scn: Option<i64>,
1867}
1868
1869impl common::Part for OracleScnPosition {}
1870
1871/// Oracle data source configuration
1872///
1873/// This type is not used in any activity, and only used as *part* of another schema.
1874///
1875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1876#[serde_with::serde_as]
1877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1878pub struct OracleSourceConfig {
1879 /// Use Binary Log Parser.
1880 #[serde(rename = "binaryLogParser")]
1881 pub binary_log_parser: Option<BinaryLogParser>,
1882 /// Drop large object values.
1883 #[serde(rename = "dropLargeObjects")]
1884 pub drop_large_objects: Option<DropLargeObjects>,
1885 /// Oracle objects to exclude from the stream.
1886 #[serde(rename = "excludeObjects")]
1887 pub exclude_objects: Option<OracleRdbms>,
1888 /// Oracle objects to include in the stream.
1889 #[serde(rename = "includeObjects")]
1890 pub include_objects: Option<OracleRdbms>,
1891 /// Use LogMiner.
1892 #[serde(rename = "logMiner")]
1893 pub log_miner: Option<LogMiner>,
1894 /// Maximum number of concurrent backfill tasks. The number should be non-negative. If not set (or set to 0), the system's default value is used.
1895 #[serde(rename = "maxConcurrentBackfillTasks")]
1896 pub max_concurrent_backfill_tasks: Option<i32>,
1897 /// Maximum number of concurrent CDC tasks. The number should be non-negative. If not set (or set to 0), the system's default value is used.
1898 #[serde(rename = "maxConcurrentCdcTasks")]
1899 pub max_concurrent_cdc_tasks: Option<i32>,
1900 /// Stream large object values.
1901 #[serde(rename = "streamLargeObjects")]
1902 pub stream_large_objects: Option<StreamLargeObjects>,
1903}
1904
1905impl common::Part for OracleSourceConfig {}
1906
1907/// Oracle SSL configuration information.
1908///
1909/// This type is not used in any activity, and only used as *part* of another schema.
1910///
1911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1912#[serde_with::serde_as]
1913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1914pub struct OracleSslConfig {
1915 /// Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
1916 #[serde(rename = "caCertificate")]
1917 pub ca_certificate: Option<String>,
1918 /// Output only. Indicates whether the ca_certificate field has been set for this Connection-Profile.
1919 #[serde(rename = "caCertificateSet")]
1920 pub ca_certificate_set: Option<bool>,
1921 /// Optional. The distinguished name (DN) mentioned in the server certificate. This corresponds to SSL_SERVER_CERT_DN sqlnet parameter. Refer https://docs.oracle.com/en/database/oracle/oracle-database/19/netrf/local-naming-parameters-in-tns-ora-file.html#GUID-70AB0695-A9AA-4A94-B141-4C605236EEB7 If this field is not provided, the DN matching is not enforced.
1922 #[serde(rename = "serverCertificateDistinguishedName")]
1923 pub server_certificate_distinguished_name: Option<String>,
1924}
1925
1926impl common::Part for OracleSslConfig {}
1927
1928/// Oracle table.
1929///
1930/// This type is not used in any activity, and only used as *part* of another schema.
1931///
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct OracleTable {
1936 /// Oracle columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
1937 #[serde(rename = "oracleColumns")]
1938 pub oracle_columns: Option<Vec<OracleColumn>>,
1939 /// Table name.
1940 pub table: Option<String>,
1941}
1942
1943impl common::Part for OracleTable {}
1944
1945/// PostgreSQL Column.
1946///
1947/// This type is not used in any activity, and only used as *part* of another schema.
1948///
1949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1950#[serde_with::serde_as]
1951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1952pub struct PostgresqlColumn {
1953 /// Column name.
1954 pub column: Option<String>,
1955 /// The PostgreSQL data type.
1956 #[serde(rename = "dataType")]
1957 pub data_type: Option<String>,
1958 /// Column length.
1959 pub length: Option<i32>,
1960 /// Whether or not the column can accept a null value.
1961 pub nullable: Option<bool>,
1962 /// The ordinal position of the column in the table.
1963 #[serde(rename = "ordinalPosition")]
1964 pub ordinal_position: Option<i32>,
1965 /// Column precision.
1966 pub precision: Option<i32>,
1967 /// Whether or not the column represents a primary key.
1968 #[serde(rename = "primaryKey")]
1969 pub primary_key: Option<bool>,
1970 /// Column scale.
1971 pub scale: Option<i32>,
1972}
1973
1974impl common::Part for PostgresqlColumn {}
1975
1976/// PostgreSQL data source object identifier.
1977///
1978/// This type is not used in any activity, and only used as *part* of another schema.
1979///
1980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1981#[serde_with::serde_as]
1982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1983pub struct PostgresqlObjectIdentifier {
1984 /// Required. The schema name.
1985 pub schema: Option<String>,
1986 /// Required. The table name.
1987 pub table: Option<String>,
1988}
1989
1990impl common::Part for PostgresqlObjectIdentifier {}
1991
1992/// PostgreSQL database profile.
1993///
1994/// This type is not used in any activity, and only used as *part* of another schema.
1995///
1996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1997#[serde_with::serde_as]
1998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1999pub struct PostgresqlProfile {
2000 /// Required. Database for the PostgreSQL connection.
2001 pub database: Option<String>,
2002 /// Required. Hostname for the PostgreSQL connection.
2003 pub hostname: Option<String>,
2004 /// Optional. Password for the PostgreSQL connection. Mutually exclusive with the `secret_manager_stored_password` field.
2005 pub password: Option<String>,
2006 /// Port for the PostgreSQL connection, default value is 5432.
2007 pub port: Option<i32>,
2008 /// Optional. A reference to a Secret Manager resource name storing the PostgreSQL connection password. Mutually exclusive with the `password` field.
2009 #[serde(rename = "secretManagerStoredPassword")]
2010 pub secret_manager_stored_password: Option<String>,
2011 /// Optional. SSL configuration for the PostgreSQL connection. In case PostgresqlSslConfig is not set, the connection will use the default SSL mode, which is `prefer` (i.e. this mode will only use encryption if enabled from database side, otherwise will use unencrypted communication)
2012 #[serde(rename = "sslConfig")]
2013 pub ssl_config: Option<PostgresqlSslConfig>,
2014 /// Required. Username for the PostgreSQL connection.
2015 pub username: Option<String>,
2016}
2017
2018impl common::Part for PostgresqlProfile {}
2019
2020/// PostgreSQL database structure.
2021///
2022/// This type is not used in any activity, and only used as *part* of another schema.
2023///
2024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2025#[serde_with::serde_as]
2026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2027pub struct PostgresqlRdbms {
2028 /// PostgreSQL schemas in the database server.
2029 #[serde(rename = "postgresqlSchemas")]
2030 pub postgresql_schemas: Option<Vec<PostgresqlSchema>>,
2031}
2032
2033impl common::Part for PostgresqlRdbms {}
2034
2035/// PostgreSQL schema.
2036///
2037/// This type is not used in any activity, and only used as *part* of another schema.
2038///
2039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2040#[serde_with::serde_as]
2041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2042pub struct PostgresqlSchema {
2043 /// Tables in the schema.
2044 #[serde(rename = "postgresqlTables")]
2045 pub postgresql_tables: Option<Vec<PostgresqlTable>>,
2046 /// Schema name.
2047 pub schema: Option<String>,
2048}
2049
2050impl common::Part for PostgresqlSchema {}
2051
2052/// PostgreSQL data source configuration
2053///
2054/// This type is not used in any activity, and only used as *part* of another schema.
2055///
2056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2057#[serde_with::serde_as]
2058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2059pub struct PostgresqlSourceConfig {
2060 /// PostgreSQL objects to exclude from the stream.
2061 #[serde(rename = "excludeObjects")]
2062 pub exclude_objects: Option<PostgresqlRdbms>,
2063 /// PostgreSQL objects to include in the stream.
2064 #[serde(rename = "includeObjects")]
2065 pub include_objects: Option<PostgresqlRdbms>,
2066 /// Maximum number of concurrent backfill tasks. The number should be non negative. If not set (or set to 0), the system's default value will be used.
2067 #[serde(rename = "maxConcurrentBackfillTasks")]
2068 pub max_concurrent_backfill_tasks: Option<i32>,
2069 /// Required. The name of the publication that includes the set of all tables that are defined in the stream's include_objects.
2070 pub publication: Option<String>,
2071 /// Required. Immutable. The name of the logical replication slot that's configured with the pgoutput plugin.
2072 #[serde(rename = "replicationSlot")]
2073 pub replication_slot: Option<String>,
2074}
2075
2076impl common::Part for PostgresqlSourceConfig {}
2077
2078/// PostgreSQL SSL configuration information.
2079///
2080/// This type is not used in any activity, and only used as *part* of another schema.
2081///
2082#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2083#[serde_with::serde_as]
2084#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2085pub struct PostgresqlSslConfig {
2086 /// If this field is set, the communication will be encrypted with TLS encryption and both the server identity and the client identity will be authenticated.
2087 #[serde(rename = "serverAndClientVerification")]
2088 pub server_and_client_verification: Option<ServerAndClientVerification>,
2089 /// If this field is set, the communication will be encrypted with TLS encryption and the server identity will be authenticated.
2090 #[serde(rename = "serverVerification")]
2091 pub server_verification: Option<ServerVerification>,
2092}
2093
2094impl common::Part for PostgresqlSslConfig {}
2095
2096/// PostgreSQL table.
2097///
2098/// This type is not used in any activity, and only used as *part* of another schema.
2099///
2100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2101#[serde_with::serde_as]
2102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2103pub struct PostgresqlTable {
2104 /// PostgreSQL columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
2105 #[serde(rename = "postgresqlColumns")]
2106 pub postgresql_columns: Option<Vec<PostgresqlColumn>>,
2107 /// Table name.
2108 pub table: Option<String>,
2109}
2110
2111impl common::Part for PostgresqlTable {}
2112
2113/// The PrivateConnection resource is used to establish private connectivity between Datastream and a customer’s network.
2114///
2115/// # Activities
2116///
2117/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2118/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2119///
2120/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (request)
2121/// * [locations private connections get projects](ProjectLocationPrivateConnectionGetCall) (response)
2122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2123#[serde_with::serde_as]
2124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2125pub struct PrivateConnection {
2126 /// Output only. The create time of the resource.
2127 #[serde(rename = "createTime")]
2128 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2129 /// Required. Display name.
2130 #[serde(rename = "displayName")]
2131 pub display_name: Option<String>,
2132 /// Output only. In case of error, the details of the error in a user-friendly format.
2133 pub error: Option<Error>,
2134 /// Labels.
2135 pub labels: Option<HashMap<String, String>>,
2136 /// Output only. Identifier. The resource's name.
2137 pub name: Option<String>,
2138 /// PSC Interface Config.
2139 #[serde(rename = "pscInterfaceConfig")]
2140 pub psc_interface_config: Option<PscInterfaceConfig>,
2141 /// Output only. Reserved for future use.
2142 #[serde(rename = "satisfiesPzi")]
2143 pub satisfies_pzi: Option<bool>,
2144 /// Output only. Reserved for future use.
2145 #[serde(rename = "satisfiesPzs")]
2146 pub satisfies_pzs: Option<bool>,
2147 /// Output only. The state of the Private Connection.
2148 pub state: Option<String>,
2149 /// Output only. The update time of the resource.
2150 #[serde(rename = "updateTime")]
2151 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2152 /// VPC Peering Config.
2153 #[serde(rename = "vpcPeeringConfig")]
2154 pub vpc_peering_config: Option<VpcPeeringConfig>,
2155}
2156
2157impl common::RequestValue for PrivateConnection {}
2158impl common::ResponseResult for PrivateConnection {}
2159
2160/// Private Connectivity
2161///
2162/// This type is not used in any activity, and only used as *part* of another schema.
2163///
2164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2165#[serde_with::serde_as]
2166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2167pub struct PrivateConnectivity {
2168 /// Required. A reference to a private connection resource. Format: `projects/{project}/locations/{location}/privateConnections/{name}`
2169 #[serde(rename = "privateConnection")]
2170 pub private_connection: Option<String>,
2171}
2172
2173impl common::Part for PrivateConnectivity {}
2174
2175/// The PSC Interface configuration is used to create PSC Interface between Datastream and the consumer's PSC.
2176///
2177/// This type is not used in any activity, and only used as *part* of another schema.
2178///
2179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2180#[serde_with::serde_as]
2181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2182pub struct PscInterfaceConfig {
2183 /// Required. Fully qualified name of the Network Attachment that Datastream will connect to. Format: `projects/{project}/regions/{region}/networkAttachments/{name}`
2184 #[serde(rename = "networkAttachment")]
2185 pub network_attachment: Option<String>,
2186}
2187
2188impl common::Part for PscInterfaceConfig {}
2189
2190/// The route resource is the child of the private connection resource, used for defining a route for a private connection.
2191///
2192/// # Activities
2193///
2194/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2195/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2196///
2197/// * [locations private connections routes create projects](ProjectLocationPrivateConnectionRouteCreateCall) (request)
2198/// * [locations private connections routes get projects](ProjectLocationPrivateConnectionRouteGetCall) (response)
2199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2200#[serde_with::serde_as]
2201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2202pub struct Route {
2203 /// Output only. The create time of the resource.
2204 #[serde(rename = "createTime")]
2205 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2206 /// Required. Destination address for connection
2207 #[serde(rename = "destinationAddress")]
2208 pub destination_address: Option<String>,
2209 /// Destination port for connection
2210 #[serde(rename = "destinationPort")]
2211 pub destination_port: Option<i32>,
2212 /// Required. Display name.
2213 #[serde(rename = "displayName")]
2214 pub display_name: Option<String>,
2215 /// Labels.
2216 pub labels: Option<HashMap<String, String>>,
2217 /// Output only. Identifier. The resource's name.
2218 pub name: Option<String>,
2219 /// Output only. The update time of the resource.
2220 #[serde(rename = "updateTime")]
2221 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2222}
2223
2224impl common::RequestValue for Route {}
2225impl common::ResponseResult for Route {}
2226
2227/// A set of rules to apply to a set of objects.
2228///
2229/// This type is not used in any activity, and only used as *part* of another schema.
2230///
2231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2232#[serde_with::serde_as]
2233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2234pub struct RuleSet {
2235 /// Required. List of customization rules to apply.
2236 #[serde(rename = "customizationRules")]
2237 pub customization_rules: Option<Vec<CustomizationRule>>,
2238 /// Required. Object filter to apply the customization rules to.
2239 #[serde(rename = "objectFilter")]
2240 pub object_filter: Option<ObjectFilter>,
2241}
2242
2243impl common::Part for RuleSet {}
2244
2245/// Request message for running a stream.
2246///
2247/// # Activities
2248///
2249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2251///
2252/// * [locations streams run projects](ProjectLocationStreamRunCall) (request)
2253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2254#[serde_with::serde_as]
2255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2256pub struct RunStreamRequest {
2257 /// Optional. The CDC strategy of the stream. If not set, the system's default value will be used.
2258 #[serde(rename = "cdcStrategy")]
2259 pub cdc_strategy: Option<CdcStrategy>,
2260 /// Optional. Update the stream without validating it.
2261 pub force: Option<bool>,
2262}
2263
2264impl common::RequestValue for RunStreamRequest {}
2265
2266/// Salesforce field.
2267///
2268/// This type is not used in any activity, and only used as *part* of another schema.
2269///
2270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2271#[serde_with::serde_as]
2272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2273pub struct SalesforceField {
2274 /// The data type.
2275 #[serde(rename = "dataType")]
2276 pub data_type: Option<String>,
2277 /// Field name.
2278 pub name: Option<String>,
2279 /// Indicates whether the field can accept nil values.
2280 pub nillable: Option<bool>,
2281}
2282
2283impl common::Part for SalesforceField {}
2284
2285/// Salesforce object.
2286///
2287/// This type is not used in any activity, and only used as *part* of another schema.
2288///
2289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2290#[serde_with::serde_as]
2291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2292pub struct SalesforceObject {
2293 /// Salesforce fields. When unspecified as part of include objects, includes everything, when unspecified as part of exclude objects, excludes nothing.
2294 pub fields: Option<Vec<SalesforceField>>,
2295 /// Object name.
2296 #[serde(rename = "objectName")]
2297 pub object_name: Option<String>,
2298}
2299
2300impl common::Part for SalesforceObject {}
2301
2302/// Salesforce data source object identifier.
2303///
2304/// This type is not used in any activity, and only used as *part* of another schema.
2305///
2306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2307#[serde_with::serde_as]
2308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2309pub struct SalesforceObjectIdentifier {
2310 /// Required. The object name.
2311 #[serde(rename = "objectName")]
2312 pub object_name: Option<String>,
2313}
2314
2315impl common::Part for SalesforceObjectIdentifier {}
2316
2317/// Salesforce organization structure.
2318///
2319/// This type is not used in any activity, and only used as *part* of another schema.
2320///
2321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2322#[serde_with::serde_as]
2323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2324pub struct SalesforceOrg {
2325 /// Salesforce objects in the database server.
2326 pub objects: Option<Vec<SalesforceObject>>,
2327}
2328
2329impl common::Part for SalesforceOrg {}
2330
2331/// Salesforce profile
2332///
2333/// This type is not used in any activity, and only used as *part* of another schema.
2334///
2335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2336#[serde_with::serde_as]
2337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2338pub struct SalesforceProfile {
2339 /// Required. Domain endpoint for the Salesforce connection.
2340 pub domain: Option<String>,
2341 /// Connected app authentication.
2342 #[serde(rename = "oauth2ClientCredentials")]
2343 pub oauth2_client_credentials: Option<Oauth2ClientCredentials>,
2344 /// User-password authentication.
2345 #[serde(rename = "userCredentials")]
2346 pub user_credentials: Option<UserCredentials>,
2347}
2348
2349impl common::Part for SalesforceProfile {}
2350
2351/// Salesforce source configuration
2352///
2353/// This type is not used in any activity, and only used as *part* of another schema.
2354///
2355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2356#[serde_with::serde_as]
2357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2358pub struct SalesforceSourceConfig {
2359 /// Salesforce objects to exclude from the stream.
2360 #[serde(rename = "excludeObjects")]
2361 pub exclude_objects: Option<SalesforceOrg>,
2362 /// Salesforce objects to retrieve from the source.
2363 #[serde(rename = "includeObjects")]
2364 pub include_objects: Option<SalesforceOrg>,
2365 /// Required. Salesforce objects polling interval. The interval at which new changes will be polled for each object. The duration must be between 5 minutes and 24 hours.
2366 #[serde(rename = "pollingInterval")]
2367 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2368 pub polling_interval: Option<chrono::Duration>,
2369}
2370
2371impl common::Part for SalesforceSourceConfig {}
2372
2373/// Message represents the option where Datastream will enforce the encryption and authenticate the server identity as well as the client identity. ca_certificate, client_certificate and client_key must be set if user selects this option.
2374///
2375/// This type is not used in any activity, and only used as *part* of another schema.
2376///
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct ServerAndClientVerification {
2381 /// Required. Input only. PEM-encoded server root CA certificate.
2382 #[serde(rename = "caCertificate")]
2383 pub ca_certificate: Option<String>,
2384 /// Required. Input only. PEM-encoded certificate used by the source database to authenticate the client identity (i.e., the Datastream's identity). This certificate is signed by either a root certificate trusted by the server or one or more intermediate certificates (which is stored with the leaf certificate) to link the this certificate to the trusted root certificate.
2385 #[serde(rename = "clientCertificate")]
2386 pub client_certificate: Option<String>,
2387 /// Optional. Input only. PEM-encoded private key associated with the client certificate. This value will be used during the SSL/TLS handshake, allowing the PostgreSQL server to authenticate the client's identity, i.e. identity of the Datastream.
2388 #[serde(rename = "clientKey")]
2389 pub client_key: Option<String>,
2390 /// Optional. The hostname mentioned in the Subject or SAN extension of the server certificate. If this field is not provided, the hostname in the server certificate is not validated.
2391 #[serde(rename = "serverCertificateHostname")]
2392 pub server_certificate_hostname: Option<String>,
2393}
2394
2395impl common::Part for ServerAndClientVerification {}
2396
2397/// Message represents the option where Datastream will enforce the encryption and authenticate the server identity. ca_certificate must be set if user selects this option.
2398///
2399/// This type is not used in any activity, and only used as *part* of another schema.
2400///
2401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2402#[serde_with::serde_as]
2403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2404pub struct ServerVerification {
2405 /// Required. Input only. PEM-encoded server root CA certificate.
2406 #[serde(rename = "caCertificate")]
2407 pub ca_certificate: Option<String>,
2408 /// Optional. The hostname mentioned in the Subject or SAN extension of the server certificate. If this field is not provided, the hostname in the server certificate is not validated.
2409 #[serde(rename = "serverCertificateHostname")]
2410 pub server_certificate_hostname: Option<String>,
2411}
2412
2413impl common::Part for ServerVerification {}
2414
2415/// A single target dataset to which all data will be streamed.
2416///
2417/// This type is not used in any activity, and only used as *part* of another schema.
2418///
2419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2420#[serde_with::serde_as]
2421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2422pub struct SingleTargetDataset {
2423 /// The dataset ID of the target dataset. DatasetIds allowed characters: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#datasetreference.
2424 #[serde(rename = "datasetId")]
2425 pub dataset_id: Option<String>,
2426}
2427
2428impl common::Part for SingleTargetDataset {}
2429
2430/// The configuration of the stream source.
2431///
2432/// This type is not used in any activity, and only used as *part* of another schema.
2433///
2434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2435#[serde_with::serde_as]
2436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2437pub struct SourceConfig {
2438 /// MongoDB data source configuration.
2439 #[serde(rename = "mongodbSourceConfig")]
2440 pub mongodb_source_config: Option<MongodbSourceConfig>,
2441 /// MySQL data source configuration.
2442 #[serde(rename = "mysqlSourceConfig")]
2443 pub mysql_source_config: Option<MysqlSourceConfig>,
2444 /// Oracle data source configuration.
2445 #[serde(rename = "oracleSourceConfig")]
2446 pub oracle_source_config: Option<OracleSourceConfig>,
2447 /// PostgreSQL data source configuration.
2448 #[serde(rename = "postgresqlSourceConfig")]
2449 pub postgresql_source_config: Option<PostgresqlSourceConfig>,
2450 /// Salesforce data source configuration.
2451 #[serde(rename = "salesforceSourceConfig")]
2452 pub salesforce_source_config: Option<SalesforceSourceConfig>,
2453 /// Required. Source connection profile resource. Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
2454 #[serde(rename = "sourceConnectionProfile")]
2455 pub source_connection_profile: Option<String>,
2456 /// SQLServer data source configuration.
2457 #[serde(rename = "sqlServerSourceConfig")]
2458 pub sql_server_source_config: Option<SqlServerSourceConfig>,
2459}
2460
2461impl common::Part for SourceConfig {}
2462
2463/// Destination datasets are created so that hierarchy of the destination data objects matches the source hierarchy.
2464///
2465/// This type is not used in any activity, and only used as *part* of another schema.
2466///
2467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2468#[serde_with::serde_as]
2469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2470pub struct SourceHierarchyDatasets {
2471 /// The dataset template to use for dynamic dataset creation.
2472 #[serde(rename = "datasetTemplate")]
2473 pub dataset_template: Option<DatasetTemplate>,
2474 /// Optional. The project id of the BigQuery dataset. If not specified, the project will be inferred from the stream resource.
2475 #[serde(rename = "projectId")]
2476 pub project_id: Option<String>,
2477}
2478
2479impl common::Part for SourceHierarchyDatasets {}
2480
2481/// Represents an identifier of an object in the data source.
2482///
2483/// This type is not used in any activity, and only used as *part* of another schema.
2484///
2485#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2486#[serde_with::serde_as]
2487#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2488pub struct SourceObjectIdentifier {
2489 /// MongoDB data source object identifier.
2490 #[serde(rename = "mongodbIdentifier")]
2491 pub mongodb_identifier: Option<MongodbObjectIdentifier>,
2492 /// Mysql data source object identifier.
2493 #[serde(rename = "mysqlIdentifier")]
2494 pub mysql_identifier: Option<MysqlObjectIdentifier>,
2495 /// Oracle data source object identifier.
2496 #[serde(rename = "oracleIdentifier")]
2497 pub oracle_identifier: Option<OracleObjectIdentifier>,
2498 /// PostgreSQL data source object identifier.
2499 #[serde(rename = "postgresqlIdentifier")]
2500 pub postgresql_identifier: Option<PostgresqlObjectIdentifier>,
2501 /// Salesforce data source object identifier.
2502 #[serde(rename = "salesforceIdentifier")]
2503 pub salesforce_identifier: Option<SalesforceObjectIdentifier>,
2504 /// SQLServer data source object identifier.
2505 #[serde(rename = "sqlServerIdentifier")]
2506 pub sql_server_identifier: Option<SqlServerObjectIdentifier>,
2507}
2508
2509impl common::Part for SourceObjectIdentifier {}
2510
2511/// CDC strategy to start replicating from a specific position in the source.
2512///
2513/// This type is not used in any activity, and only used as *part* of another schema.
2514///
2515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2516#[serde_with::serde_as]
2517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2518pub struct SpecificStartPosition {
2519 /// MongoDB change stream position to start replicating from.
2520 #[serde(rename = "mongodbChangeStreamPosition")]
2521 pub mongodb_change_stream_position: Option<MongodbChangeStreamPosition>,
2522 /// MySQL GTID set to start replicating from.
2523 #[serde(rename = "mysqlGtidPosition")]
2524 pub mysql_gtid_position: Option<MysqlGtidPosition>,
2525 /// MySQL specific log position to start replicating from.
2526 #[serde(rename = "mysqlLogPosition")]
2527 pub mysql_log_position: Option<MysqlLogPosition>,
2528 /// Oracle SCN to start replicating from.
2529 #[serde(rename = "oracleScnPosition")]
2530 pub oracle_scn_position: Option<OracleScnPosition>,
2531 /// SqlServer LSN to start replicating from.
2532 #[serde(rename = "sqlServerLsnPosition")]
2533 pub sql_server_lsn_position: Option<SqlServerLsnPosition>,
2534}
2535
2536impl common::Part for SpecificStartPosition {}
2537
2538/// Configuration to use Change Tables CDC read method.
2539///
2540/// This type is not used in any activity, and only used as *part* of another schema.
2541///
2542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2543#[serde_with::serde_as]
2544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2545pub struct SqlServerChangeTables {
2546 _never_set: Option<bool>,
2547}
2548
2549impl common::Part for SqlServerChangeTables {}
2550
2551/// SQLServer Column.
2552///
2553/// This type is not used in any activity, and only used as *part* of another schema.
2554///
2555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2556#[serde_with::serde_as]
2557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2558pub struct SqlServerColumn {
2559 /// Column name.
2560 pub column: Option<String>,
2561 /// The SQLServer data type.
2562 #[serde(rename = "dataType")]
2563 pub data_type: Option<String>,
2564 /// Column length.
2565 pub length: Option<i32>,
2566 /// Whether or not the column can accept a null value.
2567 pub nullable: Option<bool>,
2568 /// The ordinal position of the column in the table.
2569 #[serde(rename = "ordinalPosition")]
2570 pub ordinal_position: Option<i32>,
2571 /// Column precision.
2572 pub precision: Option<i32>,
2573 /// Whether or not the column represents a primary key.
2574 #[serde(rename = "primaryKey")]
2575 pub primary_key: Option<bool>,
2576 /// Column scale.
2577 pub scale: Option<i32>,
2578}
2579
2580impl common::Part for SqlServerColumn {}
2581
2582/// SQL Server LSN position
2583///
2584/// This type is not used in any activity, and only used as *part* of another schema.
2585///
2586#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2587#[serde_with::serde_as]
2588#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2589pub struct SqlServerLsnPosition {
2590 /// Required. Log sequence number (LSN) from where Logs will be read
2591 pub lsn: Option<String>,
2592}
2593
2594impl common::Part for SqlServerLsnPosition {}
2595
2596/// SQLServer data source object identifier.
2597///
2598/// This type is not used in any activity, and only used as *part* of another schema.
2599///
2600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2601#[serde_with::serde_as]
2602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2603pub struct SqlServerObjectIdentifier {
2604 /// Required. The schema name.
2605 pub schema: Option<String>,
2606 /// Required. The table name.
2607 pub table: Option<String>,
2608}
2609
2610impl common::Part for SqlServerObjectIdentifier {}
2611
2612/// SQLServer database profile.
2613///
2614/// This type is not used in any activity, and only used as *part* of another schema.
2615///
2616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2617#[serde_with::serde_as]
2618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2619pub struct SqlServerProfile {
2620 /// Required. Database for the SQLServer connection.
2621 pub database: Option<String>,
2622 /// Required. Hostname for the SQLServer connection.
2623 pub hostname: Option<String>,
2624 /// Optional. Password for the SQLServer connection. Mutually exclusive with the `secret_manager_stored_password` field.
2625 pub password: Option<String>,
2626 /// Port for the SQLServer connection, default value is 1433.
2627 pub port: Option<i32>,
2628 /// Optional. A reference to a Secret Manager resource name storing the SQLServer connection password. Mutually exclusive with the `password` field.
2629 #[serde(rename = "secretManagerStoredPassword")]
2630 pub secret_manager_stored_password: Option<String>,
2631 /// Optional. SSL configuration for the SQLServer connection.
2632 #[serde(rename = "sslConfig")]
2633 pub ssl_config: Option<SqlServerSslConfig>,
2634 /// Required. Username for the SQLServer connection.
2635 pub username: Option<String>,
2636}
2637
2638impl common::Part for SqlServerProfile {}
2639
2640/// SQLServer database structure.
2641///
2642/// This type is not used in any activity, and only used as *part* of another schema.
2643///
2644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2645#[serde_with::serde_as]
2646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2647pub struct SqlServerRdbms {
2648 /// SQLServer schemas in the database server.
2649 pub schemas: Option<Vec<SqlServerSchema>>,
2650}
2651
2652impl common::Part for SqlServerRdbms {}
2653
2654/// SQLServer schema.
2655///
2656/// This type is not used in any activity, and only used as *part* of another schema.
2657///
2658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2659#[serde_with::serde_as]
2660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2661pub struct SqlServerSchema {
2662 /// Schema name.
2663 pub schema: Option<String>,
2664 /// Tables in the schema.
2665 pub tables: Option<Vec<SqlServerTable>>,
2666}
2667
2668impl common::Part for SqlServerSchema {}
2669
2670/// SQLServer data source configuration
2671///
2672/// This type is not used in any activity, and only used as *part* of another schema.
2673///
2674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2675#[serde_with::serde_as]
2676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2677pub struct SqlServerSourceConfig {
2678 /// CDC reader reads from change tables.
2679 #[serde(rename = "changeTables")]
2680 pub change_tables: Option<SqlServerChangeTables>,
2681 /// SQLServer objects to exclude from the stream.
2682 #[serde(rename = "excludeObjects")]
2683 pub exclude_objects: Option<SqlServerRdbms>,
2684 /// SQLServer objects to include in the stream.
2685 #[serde(rename = "includeObjects")]
2686 pub include_objects: Option<SqlServerRdbms>,
2687 /// Max concurrent backfill tasks.
2688 #[serde(rename = "maxConcurrentBackfillTasks")]
2689 pub max_concurrent_backfill_tasks: Option<i32>,
2690 /// Max concurrent CDC tasks.
2691 #[serde(rename = "maxConcurrentCdcTasks")]
2692 pub max_concurrent_cdc_tasks: Option<i32>,
2693 /// CDC reader reads from transaction logs.
2694 #[serde(rename = "transactionLogs")]
2695 pub transaction_logs: Option<SqlServerTransactionLogs>,
2696}
2697
2698impl common::Part for SqlServerSourceConfig {}
2699
2700/// SQL Server SSL configuration information.
2701///
2702/// This type is not used in any activity, and only used as *part* of another schema.
2703///
2704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2705#[serde_with::serde_as]
2706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2707pub struct SqlServerSslConfig {
2708 /// If set, Datastream will enforce encryption without authenticating server identity. Server certificates will be trusted by default.
2709 #[serde(rename = "basicEncryption")]
2710 pub basic_encryption: Option<BasicEncryption>,
2711 /// If set, Datastream will enforce encryption and authenticate server identity.
2712 #[serde(rename = "encryptionAndServerValidation")]
2713 pub encryption_and_server_validation: Option<EncryptionAndServerValidation>,
2714 /// If set, Datastream will not enforce encryption. If the DB server mandates encryption, then connection will be encrypted but server identity will not be authenticated.
2715 #[serde(rename = "encryptionNotEnforced")]
2716 pub encryption_not_enforced: Option<EncryptionNotEnforced>,
2717}
2718
2719impl common::Part for SqlServerSslConfig {}
2720
2721/// SQLServer table.
2722///
2723/// This type is not used in any activity, and only used as *part* of another schema.
2724///
2725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2726#[serde_with::serde_as]
2727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2728pub struct SqlServerTable {
2729 /// SQLServer columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
2730 pub columns: Option<Vec<SqlServerColumn>>,
2731 /// Table name.
2732 pub table: Option<String>,
2733}
2734
2735impl common::Part for SqlServerTable {}
2736
2737/// Configuration to use Transaction Logs CDC read method.
2738///
2739/// This type is not used in any activity, and only used as *part* of another schema.
2740///
2741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2742#[serde_with::serde_as]
2743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2744pub struct SqlServerTransactionLogs {
2745 _never_set: Option<bool>,
2746}
2747
2748impl common::Part for SqlServerTransactionLogs {}
2749
2750/// Srv connection format.
2751///
2752/// This type is not used in any activity, and only used as *part* of another schema.
2753///
2754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2755#[serde_with::serde_as]
2756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2757pub struct SrvConnectionFormat {
2758 _never_set: Option<bool>,
2759}
2760
2761impl common::Part for SrvConnectionFormat {}
2762
2763/// Standard connection format.
2764///
2765/// This type is not used in any activity, and only used as *part* of another schema.
2766///
2767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2768#[serde_with::serde_as]
2769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2770pub struct StandardConnectionFormat {
2771 /// Optional. Deprecated: Use the `additional_options` map to specify the `directConnection` parameter instead. For example: `additional_options = {"directConnection": "true"}`. Specifies whether the client connects directly to the host[:port] in the connection URI.
2772 #[serde(rename = "directConnection")]
2773 pub direct_connection: Option<bool>,
2774}
2775
2776impl common::Part for StandardConnectionFormat {}
2777
2778/// Request for manually initiating a backfill job for a specific stream object.
2779///
2780/// # Activities
2781///
2782/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2783/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2784///
2785/// * [locations streams objects start backfill job projects](ProjectLocationStreamObjectStartBackfillJobCall) (request)
2786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2787#[serde_with::serde_as]
2788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2789pub struct StartBackfillJobRequest {
2790 /// Optional. Optional event filter. If not set, or empty, the backfill will be performed on the entire object. This is currently used for partial backfill and only supported for SQL Server sources.
2791 #[serde(rename = "eventFilter")]
2792 pub event_filter: Option<EventFilter>,
2793}
2794
2795impl common::RequestValue for StartBackfillJobRequest {}
2796
2797/// Response for manually initiating a backfill job for a specific stream object.
2798///
2799/// # Activities
2800///
2801/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2802/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2803///
2804/// * [locations streams objects start backfill job projects](ProjectLocationStreamObjectStartBackfillJobCall) (response)
2805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2806#[serde_with::serde_as]
2807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2808pub struct StartBackfillJobResponse {
2809 /// The stream object resource a backfill job was started for.
2810 pub object: Option<StreamObject>,
2811}
2812
2813impl common::ResponseResult for StartBackfillJobResponse {}
2814
2815/// Static IP address connectivity. Used when the source database is configured to allow incoming connections from the Datastream public IP addresses for the region specified in the connection profile.
2816///
2817/// This type is not used in any activity, and only used as *part* of another schema.
2818///
2819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2820#[serde_with::serde_as]
2821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2822pub struct StaticServiceIpConnectivity {
2823 _never_set: Option<bool>,
2824}
2825
2826impl common::Part for StaticServiceIpConnectivity {}
2827
2828/// 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).
2829///
2830/// This type is not used in any activity, and only used as *part* of another schema.
2831///
2832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2833#[serde_with::serde_as]
2834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2835pub struct Status {
2836 /// The status code, which should be an enum value of google.rpc.Code.
2837 pub code: Option<i32>,
2838 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2839 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2840 /// 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.
2841 pub message: Option<String>,
2842}
2843
2844impl common::Part for Status {}
2845
2846/// Request for manually stopping a running backfill job for a specific stream object.
2847///
2848/// # Activities
2849///
2850/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2851/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2852///
2853/// * [locations streams objects stop backfill job projects](ProjectLocationStreamObjectStopBackfillJobCall) (request)
2854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2855#[serde_with::serde_as]
2856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2857pub struct StopBackfillJobRequest {
2858 _never_set: Option<bool>,
2859}
2860
2861impl common::RequestValue for StopBackfillJobRequest {}
2862
2863/// Response for manually stop a backfill job for a specific stream object.
2864///
2865/// # Activities
2866///
2867/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2868/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2869///
2870/// * [locations streams objects stop backfill job projects](ProjectLocationStreamObjectStopBackfillJobCall) (response)
2871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2872#[serde_with::serde_as]
2873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2874pub struct StopBackfillJobResponse {
2875 /// The stream object resource the backfill job was stopped for.
2876 pub object: Option<StreamObject>,
2877}
2878
2879impl common::ResponseResult for StopBackfillJobResponse {}
2880
2881/// A resource representing streaming data from a source to a destination.
2882///
2883/// # Activities
2884///
2885/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2886/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2887///
2888/// * [locations streams create projects](ProjectLocationStreamCreateCall) (request)
2889/// * [locations streams get projects](ProjectLocationStreamGetCall) (response)
2890/// * [locations streams patch projects](ProjectLocationStreamPatchCall) (request)
2891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2892#[serde_with::serde_as]
2893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2894pub struct Stream {
2895 /// Automatically backfill objects included in the stream source configuration. Specific objects can be excluded.
2896 #[serde(rename = "backfillAll")]
2897 pub backfill_all: Option<BackfillAllStrategy>,
2898 /// Do not automatically backfill any objects.
2899 #[serde(rename = "backfillNone")]
2900 pub backfill_none: Option<BackfillNoneStrategy>,
2901 /// Output only. The creation time of the stream.
2902 #[serde(rename = "createTime")]
2903 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2904 /// Immutable. A reference to a KMS encryption key. If provided, it will be used to encrypt the data. If left blank, data will be encrypted using an internal Stream-specific encryption key provisioned through KMS.
2905 #[serde(rename = "customerManagedEncryptionKey")]
2906 pub customer_managed_encryption_key: Option<String>,
2907 /// Required. Destination connection profile configuration.
2908 #[serde(rename = "destinationConfig")]
2909 pub destination_config: Option<DestinationConfig>,
2910 /// Required. Display name.
2911 #[serde(rename = "displayName")]
2912 pub display_name: Option<String>,
2913 /// Output only. Errors on the Stream.
2914 pub errors: Option<Vec<Error>>,
2915 /// Labels.
2916 pub labels: Option<HashMap<String, String>>,
2917 /// Output only. If the stream was recovered, the time of the last recovery. Note: This field is currently experimental.
2918 #[serde(rename = "lastRecoveryTime")]
2919 pub last_recovery_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2920 /// Output only. Identifier. The stream's name.
2921 pub name: Option<String>,
2922 /// Optional. Rule sets to apply to the stream.
2923 #[serde(rename = "ruleSets")]
2924 pub rule_sets: Option<Vec<RuleSet>>,
2925 /// Output only. Reserved for future use.
2926 #[serde(rename = "satisfiesPzi")]
2927 pub satisfies_pzi: Option<bool>,
2928 /// Output only. Reserved for future use.
2929 #[serde(rename = "satisfiesPzs")]
2930 pub satisfies_pzs: Option<bool>,
2931 /// Required. Source connection profile configuration.
2932 #[serde(rename = "sourceConfig")]
2933 pub source_config: Option<SourceConfig>,
2934 /// The state of the stream.
2935 pub state: Option<String>,
2936 /// Output only. The last update time of the stream.
2937 #[serde(rename = "updateTime")]
2938 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2939}
2940
2941impl common::RequestValue for Stream {}
2942impl common::ResponseResult for Stream {}
2943
2944/// Configuration to stream large object values.
2945///
2946/// This type is not used in any activity, and only used as *part* of another schema.
2947///
2948#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2949#[serde_with::serde_as]
2950#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2951pub struct StreamLargeObjects {
2952 _never_set: Option<bool>,
2953}
2954
2955impl common::Part for StreamLargeObjects {}
2956
2957/// A specific stream object (e.g a specific DB table).
2958///
2959/// # Activities
2960///
2961/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2962/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2963///
2964/// * [locations streams objects get projects](ProjectLocationStreamObjectGetCall) (response)
2965/// * [locations streams objects lookup projects](ProjectLocationStreamObjectLookupCall) (response)
2966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2967#[serde_with::serde_as]
2968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2969pub struct StreamObject {
2970 /// The latest backfill job that was initiated for the stream object.
2971 #[serde(rename = "backfillJob")]
2972 pub backfill_job: Option<BackfillJob>,
2973 /// Output only. The creation time of the object.
2974 #[serde(rename = "createTime")]
2975 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2976 /// Output only. The customization rules for the object. These rules are derived from the parent Stream's `rule_sets` and represent the intended configuration for the object.
2977 #[serde(rename = "customizationRules")]
2978 pub customization_rules: Option<Vec<CustomizationRule>>,
2979 /// Required. Display name.
2980 #[serde(rename = "displayName")]
2981 pub display_name: Option<String>,
2982 /// Output only. Active errors on the object.
2983 pub errors: Option<Vec<Error>>,
2984 /// Output only. Identifier. The object resource's name.
2985 pub name: Option<String>,
2986 /// The object identifier in the data source.
2987 #[serde(rename = "sourceObject")]
2988 pub source_object: Option<SourceObjectIdentifier>,
2989 /// Output only. The last update time of the object.
2990 #[serde(rename = "updateTime")]
2991 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2992}
2993
2994impl common::ResponseResult for StreamObject {}
2995
2996/// Time unit column partitioning. see https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables
2997///
2998/// This type is not used in any activity, and only used as *part* of another schema.
2999///
3000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3001#[serde_with::serde_as]
3002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3003pub struct TimeUnitPartition {
3004 /// Required. The partitioning column.
3005 pub column: Option<String>,
3006 /// Optional. Partition granularity.
3007 #[serde(rename = "partitioningTimeGranularity")]
3008 pub partitioning_time_granularity: Option<String>,
3009}
3010
3011impl common::Part for TimeUnitPartition {}
3012
3013/// Username-password credentials.
3014///
3015/// This type is not used in any activity, and only used as *part* of another schema.
3016///
3017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3018#[serde_with::serde_as]
3019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3020pub struct UserCredentials {
3021 /// Optional. Password for the Salesforce connection. Mutually exclusive with the `secret_manager_stored_password` field.
3022 pub password: Option<String>,
3023 /// Optional. A reference to a Secret Manager resource name storing the Salesforce connection's password. Mutually exclusive with the `password` field.
3024 #[serde(rename = "secretManagerStoredPassword")]
3025 pub secret_manager_stored_password: Option<String>,
3026 /// Optional. A reference to a Secret Manager resource name storing the Salesforce connection's security token. Mutually exclusive with the `security_token` field.
3027 #[serde(rename = "secretManagerStoredSecurityToken")]
3028 pub secret_manager_stored_security_token: Option<String>,
3029 /// Optional. Security token for the Salesforce connection. Mutually exclusive with the `secret_manager_stored_security_token` field.
3030 #[serde(rename = "securityToken")]
3031 pub security_token: Option<String>,
3032 /// Required. Username for the Salesforce connection.
3033 pub username: Option<String>,
3034}
3035
3036impl common::Part for UserCredentials {}
3037
3038/// The VPC Peering configuration is used to create VPC peering between Datastream and the consumer's VPC.
3039///
3040/// This type is not used in any activity, and only used as *part* of another schema.
3041///
3042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3043#[serde_with::serde_as]
3044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3045pub struct VpcPeeringConfig {
3046 /// Required. A free subnet for peering. (CIDR of /29)
3047 pub subnet: Option<String>,
3048 /// Required. Fully qualified name of the VPC that Datastream will peer to. Format: `projects/{project}/global/{networks}/{name}`
3049 pub vpc: Option<String>,
3050}
3051
3052impl common::Part for VpcPeeringConfig {}
3053
3054// ###################
3055// MethodBuilders ###
3056// #################
3057
3058/// A builder providing access to all methods supported on *project* resources.
3059/// It is not used directly, but through the [`Datastream`] hub.
3060///
3061/// # Example
3062///
3063/// Instantiate a resource builder
3064///
3065/// ```test_harness,no_run
3066/// extern crate hyper;
3067/// extern crate hyper_rustls;
3068/// extern crate google_datastream1 as datastream1;
3069///
3070/// # async fn dox() {
3071/// use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3072///
3073/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3074/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3075/// .with_native_roots()
3076/// .unwrap()
3077/// .https_only()
3078/// .enable_http2()
3079/// .build();
3080///
3081/// let executor = hyper_util::rt::TokioExecutor::new();
3082/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3083/// secret,
3084/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3085/// yup_oauth2::client::CustomHyperClientBuilder::from(
3086/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3087/// ),
3088/// ).build().await.unwrap();
3089///
3090/// let client = hyper_util::client::legacy::Client::builder(
3091/// hyper_util::rt::TokioExecutor::new()
3092/// )
3093/// .build(
3094/// hyper_rustls::HttpsConnectorBuilder::new()
3095/// .with_native_roots()
3096/// .unwrap()
3097/// .https_or_http()
3098/// .enable_http2()
3099/// .build()
3100/// );
3101/// let mut hub = Datastream::new(client, auth);
3102/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3103/// // like `locations_connection_profiles_create(...)`, `locations_connection_profiles_delete(...)`, `locations_connection_profiles_discover(...)`, `locations_connection_profiles_get(...)`, `locations_connection_profiles_list(...)`, `locations_connection_profiles_patch(...)`, `locations_fetch_static_ips(...)`, `locations_get(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_private_connections_create(...)`, `locations_private_connections_delete(...)`, `locations_private_connections_get(...)`, `locations_private_connections_list(...)`, `locations_private_connections_routes_create(...)`, `locations_private_connections_routes_delete(...)`, `locations_private_connections_routes_get(...)`, `locations_private_connections_routes_list(...)`, `locations_streams_create(...)`, `locations_streams_delete(...)`, `locations_streams_get(...)`, `locations_streams_list(...)`, `locations_streams_objects_get(...)`, `locations_streams_objects_list(...)`, `locations_streams_objects_lookup(...)`, `locations_streams_objects_start_backfill_job(...)`, `locations_streams_objects_stop_backfill_job(...)`, `locations_streams_patch(...)` and `locations_streams_run(...)`
3104/// // to build up your call.
3105/// let rb = hub.projects();
3106/// # }
3107/// ```
3108pub struct ProjectMethods<'a, C>
3109where
3110 C: 'a,
3111{
3112 hub: &'a Datastream<C>,
3113}
3114
3115impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3116
3117impl<'a, C> ProjectMethods<'a, C> {
3118 /// Create a builder to help you perform the following task:
3119 ///
3120 /// Use this method to create a connection profile in a project and location.
3121 ///
3122 /// # Arguments
3123 ///
3124 /// * `request` - No description provided.
3125 /// * `parent` - Required. The parent that owns the collection of ConnectionProfiles.
3126 pub fn locations_connection_profiles_create(
3127 &self,
3128 request: ConnectionProfile,
3129 parent: &str,
3130 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3131 ProjectLocationConnectionProfileCreateCall {
3132 hub: self.hub,
3133 _request: request,
3134 _parent: parent.to_string(),
3135 _validate_only: Default::default(),
3136 _request_id: Default::default(),
3137 _force: Default::default(),
3138 _connection_profile_id: Default::default(),
3139 _delegate: Default::default(),
3140 _additional_params: Default::default(),
3141 _scopes: Default::default(),
3142 }
3143 }
3144
3145 /// Create a builder to help you perform the following task:
3146 ///
3147 /// Use this method to delete a connection profile.
3148 ///
3149 /// # Arguments
3150 ///
3151 /// * `name` - Required. The name of the connection profile resource to delete.
3152 pub fn locations_connection_profiles_delete(
3153 &self,
3154 name: &str,
3155 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3156 ProjectLocationConnectionProfileDeleteCall {
3157 hub: self.hub,
3158 _name: name.to_string(),
3159 _request_id: Default::default(),
3160 _delegate: Default::default(),
3161 _additional_params: Default::default(),
3162 _scopes: Default::default(),
3163 }
3164 }
3165
3166 /// Create a builder to help you perform the following task:
3167 ///
3168 /// Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects of a parent data object that's optionally supplied in the request.
3169 ///
3170 /// # Arguments
3171 ///
3172 /// * `request` - No description provided.
3173 /// * `parent` - Required. The parent resource of the connection profile type. Must be in the format `projects/*/locations/*`.
3174 pub fn locations_connection_profiles_discover(
3175 &self,
3176 request: DiscoverConnectionProfileRequest,
3177 parent: &str,
3178 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
3179 ProjectLocationConnectionProfileDiscoverCall {
3180 hub: self.hub,
3181 _request: request,
3182 _parent: parent.to_string(),
3183 _delegate: Default::default(),
3184 _additional_params: Default::default(),
3185 _scopes: Default::default(),
3186 }
3187 }
3188
3189 /// Create a builder to help you perform the following task:
3190 ///
3191 /// Use this method to get details about a connection profile.
3192 ///
3193 /// # Arguments
3194 ///
3195 /// * `name` - Required. The name of the connection profile resource to get.
3196 pub fn locations_connection_profiles_get(
3197 &self,
3198 name: &str,
3199 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
3200 ProjectLocationConnectionProfileGetCall {
3201 hub: self.hub,
3202 _name: name.to_string(),
3203 _delegate: Default::default(),
3204 _additional_params: Default::default(),
3205 _scopes: Default::default(),
3206 }
3207 }
3208
3209 /// Create a builder to help you perform the following task:
3210 ///
3211 /// Use this method to list connection profiles created in a project and location.
3212 ///
3213 /// # Arguments
3214 ///
3215 /// * `parent` - Required. The parent that owns the collection of connection profiles.
3216 pub fn locations_connection_profiles_list(
3217 &self,
3218 parent: &str,
3219 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
3220 ProjectLocationConnectionProfileListCall {
3221 hub: self.hub,
3222 _parent: parent.to_string(),
3223 _page_token: Default::default(),
3224 _page_size: Default::default(),
3225 _order_by: Default::default(),
3226 _filter: Default::default(),
3227 _delegate: Default::default(),
3228 _additional_params: Default::default(),
3229 _scopes: Default::default(),
3230 }
3231 }
3232
3233 /// Create a builder to help you perform the following task:
3234 ///
3235 /// Use this method to update the parameters of a connection profile.
3236 ///
3237 /// # Arguments
3238 ///
3239 /// * `request` - No description provided.
3240 /// * `name` - Output only. Identifier. The resource's name.
3241 pub fn locations_connection_profiles_patch(
3242 &self,
3243 request: ConnectionProfile,
3244 name: &str,
3245 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
3246 ProjectLocationConnectionProfilePatchCall {
3247 hub: self.hub,
3248 _request: request,
3249 _name: name.to_string(),
3250 _validate_only: Default::default(),
3251 _update_mask: Default::default(),
3252 _request_id: Default::default(),
3253 _force: Default::default(),
3254 _delegate: Default::default(),
3255 _additional_params: Default::default(),
3256 _scopes: Default::default(),
3257 }
3258 }
3259
3260 /// Create a builder to help you perform the following task:
3261 ///
3262 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
3263 ///
3264 /// # Arguments
3265 ///
3266 /// * `request` - No description provided.
3267 /// * `name` - The name of the operation resource to be cancelled.
3268 pub fn locations_operations_cancel(
3269 &self,
3270 request: CancelOperationRequest,
3271 name: &str,
3272 ) -> ProjectLocationOperationCancelCall<'a, C> {
3273 ProjectLocationOperationCancelCall {
3274 hub: self.hub,
3275 _request: request,
3276 _name: name.to_string(),
3277 _delegate: Default::default(),
3278 _additional_params: Default::default(),
3279 _scopes: Default::default(),
3280 }
3281 }
3282
3283 /// Create a builder to help you perform the following task:
3284 ///
3285 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
3286 ///
3287 /// # Arguments
3288 ///
3289 /// * `name` - The name of the operation resource to be deleted.
3290 pub fn locations_operations_delete(
3291 &self,
3292 name: &str,
3293 ) -> ProjectLocationOperationDeleteCall<'a, C> {
3294 ProjectLocationOperationDeleteCall {
3295 hub: self.hub,
3296 _name: name.to_string(),
3297 _delegate: Default::default(),
3298 _additional_params: Default::default(),
3299 _scopes: Default::default(),
3300 }
3301 }
3302
3303 /// Create a builder to help you perform the following task:
3304 ///
3305 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3306 ///
3307 /// # Arguments
3308 ///
3309 /// * `name` - The name of the operation resource.
3310 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3311 ProjectLocationOperationGetCall {
3312 hub: self.hub,
3313 _name: name.to_string(),
3314 _delegate: Default::default(),
3315 _additional_params: Default::default(),
3316 _scopes: Default::default(),
3317 }
3318 }
3319
3320 /// Create a builder to help you perform the following task:
3321 ///
3322 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3323 ///
3324 /// # Arguments
3325 ///
3326 /// * `name` - The name of the operation's parent resource.
3327 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3328 ProjectLocationOperationListCall {
3329 hub: self.hub,
3330 _name: name.to_string(),
3331 _return_partial_success: Default::default(),
3332 _page_token: Default::default(),
3333 _page_size: Default::default(),
3334 _filter: Default::default(),
3335 _delegate: Default::default(),
3336 _additional_params: Default::default(),
3337 _scopes: Default::default(),
3338 }
3339 }
3340
3341 /// Create a builder to help you perform the following task:
3342 ///
3343 /// Use this method to create a route for a private connectivity configuration in a project and location.
3344 ///
3345 /// # Arguments
3346 ///
3347 /// * `request` - No description provided.
3348 /// * `parent` - Required. The parent that owns the collection of Routes.
3349 pub fn locations_private_connections_routes_create(
3350 &self,
3351 request: Route,
3352 parent: &str,
3353 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
3354 ProjectLocationPrivateConnectionRouteCreateCall {
3355 hub: self.hub,
3356 _request: request,
3357 _parent: parent.to_string(),
3358 _route_id: Default::default(),
3359 _request_id: Default::default(),
3360 _delegate: Default::default(),
3361 _additional_params: Default::default(),
3362 _scopes: Default::default(),
3363 }
3364 }
3365
3366 /// Create a builder to help you perform the following task:
3367 ///
3368 /// Use this method to delete a route.
3369 ///
3370 /// # Arguments
3371 ///
3372 /// * `name` - Required. The name of the Route resource to delete.
3373 pub fn locations_private_connections_routes_delete(
3374 &self,
3375 name: &str,
3376 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
3377 ProjectLocationPrivateConnectionRouteDeleteCall {
3378 hub: self.hub,
3379 _name: name.to_string(),
3380 _request_id: Default::default(),
3381 _delegate: Default::default(),
3382 _additional_params: Default::default(),
3383 _scopes: Default::default(),
3384 }
3385 }
3386
3387 /// Create a builder to help you perform the following task:
3388 ///
3389 /// Use this method to get details about a route.
3390 ///
3391 /// # Arguments
3392 ///
3393 /// * `name` - Required. The name of the Route resource to get.
3394 pub fn locations_private_connections_routes_get(
3395 &self,
3396 name: &str,
3397 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
3398 ProjectLocationPrivateConnectionRouteGetCall {
3399 hub: self.hub,
3400 _name: name.to_string(),
3401 _delegate: Default::default(),
3402 _additional_params: Default::default(),
3403 _scopes: Default::default(),
3404 }
3405 }
3406
3407 /// Create a builder to help you perform the following task:
3408 ///
3409 /// Use this method to list routes created for a private connectivity configuration in a project and location.
3410 ///
3411 /// # Arguments
3412 ///
3413 /// * `parent` - Required. The parent that owns the collection of Routess.
3414 pub fn locations_private_connections_routes_list(
3415 &self,
3416 parent: &str,
3417 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
3418 ProjectLocationPrivateConnectionRouteListCall {
3419 hub: self.hub,
3420 _parent: parent.to_string(),
3421 _page_token: Default::default(),
3422 _page_size: Default::default(),
3423 _order_by: Default::default(),
3424 _filter: Default::default(),
3425 _delegate: Default::default(),
3426 _additional_params: Default::default(),
3427 _scopes: Default::default(),
3428 }
3429 }
3430
3431 /// Create a builder to help you perform the following task:
3432 ///
3433 /// Use this method to create a private connectivity configuration.
3434 ///
3435 /// # Arguments
3436 ///
3437 /// * `request` - No description provided.
3438 /// * `parent` - Required. The parent that owns the collection of PrivateConnections.
3439 pub fn locations_private_connections_create(
3440 &self,
3441 request: PrivateConnection,
3442 parent: &str,
3443 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
3444 ProjectLocationPrivateConnectionCreateCall {
3445 hub: self.hub,
3446 _request: request,
3447 _parent: parent.to_string(),
3448 _validate_only: Default::default(),
3449 _request_id: Default::default(),
3450 _private_connection_id: Default::default(),
3451 _force: Default::default(),
3452 _delegate: Default::default(),
3453 _additional_params: Default::default(),
3454 _scopes: Default::default(),
3455 }
3456 }
3457
3458 /// Create a builder to help you perform the following task:
3459 ///
3460 /// Use this method to delete a private connectivity configuration.
3461 ///
3462 /// # Arguments
3463 ///
3464 /// * `name` - Required. The name of the private connectivity configuration to delete.
3465 pub fn locations_private_connections_delete(
3466 &self,
3467 name: &str,
3468 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
3469 ProjectLocationPrivateConnectionDeleteCall {
3470 hub: self.hub,
3471 _name: name.to_string(),
3472 _request_id: Default::default(),
3473 _force: Default::default(),
3474 _delegate: Default::default(),
3475 _additional_params: Default::default(),
3476 _scopes: Default::default(),
3477 }
3478 }
3479
3480 /// Create a builder to help you perform the following task:
3481 ///
3482 /// Use this method to get details about a private connectivity configuration.
3483 ///
3484 /// # Arguments
3485 ///
3486 /// * `name` - Required. The name of the private connectivity configuration to get.
3487 pub fn locations_private_connections_get(
3488 &self,
3489 name: &str,
3490 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
3491 ProjectLocationPrivateConnectionGetCall {
3492 hub: self.hub,
3493 _name: name.to_string(),
3494 _delegate: Default::default(),
3495 _additional_params: Default::default(),
3496 _scopes: Default::default(),
3497 }
3498 }
3499
3500 /// Create a builder to help you perform the following task:
3501 ///
3502 /// Use this method to list private connectivity configurations in a project and location.
3503 ///
3504 /// # Arguments
3505 ///
3506 /// * `parent` - Required. The parent that owns the collection of private connectivity configurations.
3507 pub fn locations_private_connections_list(
3508 &self,
3509 parent: &str,
3510 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
3511 ProjectLocationPrivateConnectionListCall {
3512 hub: self.hub,
3513 _parent: parent.to_string(),
3514 _page_token: Default::default(),
3515 _page_size: Default::default(),
3516 _order_by: Default::default(),
3517 _filter: Default::default(),
3518 _delegate: Default::default(),
3519 _additional_params: Default::default(),
3520 _scopes: Default::default(),
3521 }
3522 }
3523
3524 /// Create a builder to help you perform the following task:
3525 ///
3526 /// Use this method to get details about a stream object.
3527 ///
3528 /// # Arguments
3529 ///
3530 /// * `name` - Required. The name of the stream object resource to get.
3531 pub fn locations_streams_objects_get(
3532 &self,
3533 name: &str,
3534 ) -> ProjectLocationStreamObjectGetCall<'a, C> {
3535 ProjectLocationStreamObjectGetCall {
3536 hub: self.hub,
3537 _name: name.to_string(),
3538 _delegate: Default::default(),
3539 _additional_params: Default::default(),
3540 _scopes: Default::default(),
3541 }
3542 }
3543
3544 /// Create a builder to help you perform the following task:
3545 ///
3546 /// Use this method to list the objects of a specific stream.
3547 ///
3548 /// # Arguments
3549 ///
3550 /// * `parent` - Required. The parent stream that owns the collection of objects.
3551 pub fn locations_streams_objects_list(
3552 &self,
3553 parent: &str,
3554 ) -> ProjectLocationStreamObjectListCall<'a, C> {
3555 ProjectLocationStreamObjectListCall {
3556 hub: self.hub,
3557 _parent: parent.to_string(),
3558 _page_token: Default::default(),
3559 _page_size: Default::default(),
3560 _delegate: Default::default(),
3561 _additional_params: Default::default(),
3562 _scopes: Default::default(),
3563 }
3564 }
3565
3566 /// Create a builder to help you perform the following task:
3567 ///
3568 /// Use this method to look up a stream object by its source object identifier.
3569 ///
3570 /// # Arguments
3571 ///
3572 /// * `request` - No description provided.
3573 /// * `parent` - Required. The parent stream that owns the collection of objects.
3574 pub fn locations_streams_objects_lookup(
3575 &self,
3576 request: LookupStreamObjectRequest,
3577 parent: &str,
3578 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
3579 ProjectLocationStreamObjectLookupCall {
3580 hub: self.hub,
3581 _request: request,
3582 _parent: parent.to_string(),
3583 _delegate: Default::default(),
3584 _additional_params: Default::default(),
3585 _scopes: Default::default(),
3586 }
3587 }
3588
3589 /// Create a builder to help you perform the following task:
3590 ///
3591 /// Use this method to start a backfill job for the specified stream object.
3592 ///
3593 /// # Arguments
3594 ///
3595 /// * `request` - No description provided.
3596 /// * `object` - Required. The name of the stream object resource to start a backfill job for.
3597 pub fn locations_streams_objects_start_backfill_job(
3598 &self,
3599 request: StartBackfillJobRequest,
3600 object: &str,
3601 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
3602 ProjectLocationStreamObjectStartBackfillJobCall {
3603 hub: self.hub,
3604 _request: request,
3605 _object: object.to_string(),
3606 _delegate: Default::default(),
3607 _additional_params: Default::default(),
3608 _scopes: Default::default(),
3609 }
3610 }
3611
3612 /// Create a builder to help you perform the following task:
3613 ///
3614 /// Use this method to stop a backfill job for the specified stream object.
3615 ///
3616 /// # Arguments
3617 ///
3618 /// * `request` - No description provided.
3619 /// * `object` - Required. The name of the stream object resource to stop the backfill job for.
3620 pub fn locations_streams_objects_stop_backfill_job(
3621 &self,
3622 request: StopBackfillJobRequest,
3623 object: &str,
3624 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
3625 ProjectLocationStreamObjectStopBackfillJobCall {
3626 hub: self.hub,
3627 _request: request,
3628 _object: object.to_string(),
3629 _delegate: Default::default(),
3630 _additional_params: Default::default(),
3631 _scopes: Default::default(),
3632 }
3633 }
3634
3635 /// Create a builder to help you perform the following task:
3636 ///
3637 /// Use this method to create a stream.
3638 ///
3639 /// # Arguments
3640 ///
3641 /// * `request` - No description provided.
3642 /// * `parent` - Required. The parent that owns the collection of streams.
3643 pub fn locations_streams_create(
3644 &self,
3645 request: Stream,
3646 parent: &str,
3647 ) -> ProjectLocationStreamCreateCall<'a, C> {
3648 ProjectLocationStreamCreateCall {
3649 hub: self.hub,
3650 _request: request,
3651 _parent: parent.to_string(),
3652 _validate_only: Default::default(),
3653 _stream_id: Default::default(),
3654 _request_id: Default::default(),
3655 _force: Default::default(),
3656 _delegate: Default::default(),
3657 _additional_params: Default::default(),
3658 _scopes: Default::default(),
3659 }
3660 }
3661
3662 /// Create a builder to help you perform the following task:
3663 ///
3664 /// Use this method to delete a stream.
3665 ///
3666 /// # Arguments
3667 ///
3668 /// * `name` - Required. The name of the stream resource to delete.
3669 pub fn locations_streams_delete(&self, name: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
3670 ProjectLocationStreamDeleteCall {
3671 hub: self.hub,
3672 _name: name.to_string(),
3673 _request_id: Default::default(),
3674 _delegate: Default::default(),
3675 _additional_params: Default::default(),
3676 _scopes: Default::default(),
3677 }
3678 }
3679
3680 /// Create a builder to help you perform the following task:
3681 ///
3682 /// Use this method to get details about a stream.
3683 ///
3684 /// # Arguments
3685 ///
3686 /// * `name` - Required. The name of the stream resource to get.
3687 pub fn locations_streams_get(&self, name: &str) -> ProjectLocationStreamGetCall<'a, C> {
3688 ProjectLocationStreamGetCall {
3689 hub: self.hub,
3690 _name: name.to_string(),
3691 _delegate: Default::default(),
3692 _additional_params: Default::default(),
3693 _scopes: Default::default(),
3694 }
3695 }
3696
3697 /// Create a builder to help you perform the following task:
3698 ///
3699 /// Use this method to list streams in a project and location.
3700 ///
3701 /// # Arguments
3702 ///
3703 /// * `parent` - Required. The parent that owns the collection of streams.
3704 pub fn locations_streams_list(&self, parent: &str) -> ProjectLocationStreamListCall<'a, C> {
3705 ProjectLocationStreamListCall {
3706 hub: self.hub,
3707 _parent: parent.to_string(),
3708 _page_token: Default::default(),
3709 _page_size: Default::default(),
3710 _order_by: Default::default(),
3711 _filter: Default::default(),
3712 _delegate: Default::default(),
3713 _additional_params: Default::default(),
3714 _scopes: Default::default(),
3715 }
3716 }
3717
3718 /// Create a builder to help you perform the following task:
3719 ///
3720 /// Use this method to update the configuration of a stream.
3721 ///
3722 /// # Arguments
3723 ///
3724 /// * `request` - No description provided.
3725 /// * `name` - Output only. Identifier. The stream's name.
3726 pub fn locations_streams_patch(
3727 &self,
3728 request: Stream,
3729 name: &str,
3730 ) -> ProjectLocationStreamPatchCall<'a, C> {
3731 ProjectLocationStreamPatchCall {
3732 hub: self.hub,
3733 _request: request,
3734 _name: name.to_string(),
3735 _validate_only: Default::default(),
3736 _update_mask: Default::default(),
3737 _request_id: Default::default(),
3738 _force: Default::default(),
3739 _delegate: Default::default(),
3740 _additional_params: Default::default(),
3741 _scopes: Default::default(),
3742 }
3743 }
3744
3745 /// Create a builder to help you perform the following task:
3746 ///
3747 /// Use this method to start, resume or recover a stream with a non default CDC strategy.
3748 ///
3749 /// # Arguments
3750 ///
3751 /// * `request` - No description provided.
3752 /// * `name` - Required. Name of the stream resource to start, in the format: projects/{project_id}/locations/{location}/streams/{stream_name}
3753 pub fn locations_streams_run(
3754 &self,
3755 request: RunStreamRequest,
3756 name: &str,
3757 ) -> ProjectLocationStreamRunCall<'a, C> {
3758 ProjectLocationStreamRunCall {
3759 hub: self.hub,
3760 _request: request,
3761 _name: name.to_string(),
3762 _delegate: Default::default(),
3763 _additional_params: Default::default(),
3764 _scopes: Default::default(),
3765 }
3766 }
3767
3768 /// Create a builder to help you perform the following task:
3769 ///
3770 /// The FetchStaticIps API call exposes the static IP addresses used by Datastream.
3771 ///
3772 /// # Arguments
3773 ///
3774 /// * `name` - Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
3775 pub fn locations_fetch_static_ips(
3776 &self,
3777 name: &str,
3778 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
3779 ProjectLocationFetchStaticIpCall {
3780 hub: self.hub,
3781 _name: name.to_string(),
3782 _page_token: Default::default(),
3783 _page_size: Default::default(),
3784 _delegate: Default::default(),
3785 _additional_params: Default::default(),
3786 _scopes: Default::default(),
3787 }
3788 }
3789
3790 /// Create a builder to help you perform the following task:
3791 ///
3792 /// Gets information about a location.
3793 ///
3794 /// # Arguments
3795 ///
3796 /// * `name` - Resource name for the location.
3797 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
3798 ProjectLocationGetCall {
3799 hub: self.hub,
3800 _name: name.to_string(),
3801 _delegate: Default::default(),
3802 _additional_params: Default::default(),
3803 _scopes: Default::default(),
3804 }
3805 }
3806
3807 /// Create a builder to help you perform the following task:
3808 ///
3809 /// Lists information about the supported locations for this service.
3810 ///
3811 /// # Arguments
3812 ///
3813 /// * `name` - The resource that owns the locations collection, if applicable.
3814 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
3815 ProjectLocationListCall {
3816 hub: self.hub,
3817 _name: name.to_string(),
3818 _page_token: Default::default(),
3819 _page_size: Default::default(),
3820 _filter: Default::default(),
3821 _extra_location_types: Default::default(),
3822 _delegate: Default::default(),
3823 _additional_params: Default::default(),
3824 _scopes: Default::default(),
3825 }
3826 }
3827}
3828
3829// ###################
3830// CallBuilders ###
3831// #################
3832
3833/// Use this method to create a connection profile in a project and location.
3834///
3835/// A builder for the *locations.connectionProfiles.create* method supported by a *project* resource.
3836/// It is not used directly, but through a [`ProjectMethods`] instance.
3837///
3838/// # Example
3839///
3840/// Instantiate a resource method builder
3841///
3842/// ```test_harness,no_run
3843/// # extern crate hyper;
3844/// # extern crate hyper_rustls;
3845/// # extern crate google_datastream1 as datastream1;
3846/// use datastream1::api::ConnectionProfile;
3847/// # async fn dox() {
3848/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3849///
3850/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3851/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3852/// # .with_native_roots()
3853/// # .unwrap()
3854/// # .https_only()
3855/// # .enable_http2()
3856/// # .build();
3857///
3858/// # let executor = hyper_util::rt::TokioExecutor::new();
3859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3860/// # secret,
3861/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3862/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3863/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3864/// # ),
3865/// # ).build().await.unwrap();
3866///
3867/// # let client = hyper_util::client::legacy::Client::builder(
3868/// # hyper_util::rt::TokioExecutor::new()
3869/// # )
3870/// # .build(
3871/// # hyper_rustls::HttpsConnectorBuilder::new()
3872/// # .with_native_roots()
3873/// # .unwrap()
3874/// # .https_or_http()
3875/// # .enable_http2()
3876/// # .build()
3877/// # );
3878/// # let mut hub = Datastream::new(client, auth);
3879/// // As the method needs a request, you would usually fill it with the desired information
3880/// // into the respective structure. Some of the parts shown here might not be applicable !
3881/// // Values shown here are possibly random and not representative !
3882/// let mut req = ConnectionProfile::default();
3883///
3884/// // You can configure optional parameters by calling the respective setters at will, and
3885/// // execute the final call using `doit()`.
3886/// // Values shown here are possibly random and not representative !
3887/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
3888/// .validate_only(true)
3889/// .request_id("sed")
3890/// .force(true)
3891/// .connection_profile_id("ipsum")
3892/// .doit().await;
3893/// # }
3894/// ```
3895pub struct ProjectLocationConnectionProfileCreateCall<'a, C>
3896where
3897 C: 'a,
3898{
3899 hub: &'a Datastream<C>,
3900 _request: ConnectionProfile,
3901 _parent: String,
3902 _validate_only: Option<bool>,
3903 _request_id: Option<String>,
3904 _force: Option<bool>,
3905 _connection_profile_id: Option<String>,
3906 _delegate: Option<&'a mut dyn common::Delegate>,
3907 _additional_params: HashMap<String, String>,
3908 _scopes: BTreeSet<String>,
3909}
3910
3911impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileCreateCall<'a, C> {}
3912
3913impl<'a, C> ProjectLocationConnectionProfileCreateCall<'a, C>
3914where
3915 C: common::Connector,
3916{
3917 /// Perform the operation you have build so far.
3918 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3919 use std::borrow::Cow;
3920 use std::io::{Read, Seek};
3921
3922 use common::{url::Params, ToParts};
3923 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3924
3925 let mut dd = common::DefaultDelegate;
3926 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3927 dlg.begin(common::MethodInfo {
3928 id: "datastream.projects.locations.connectionProfiles.create",
3929 http_method: hyper::Method::POST,
3930 });
3931
3932 for &field in [
3933 "alt",
3934 "parent",
3935 "validateOnly",
3936 "requestId",
3937 "force",
3938 "connectionProfileId",
3939 ]
3940 .iter()
3941 {
3942 if self._additional_params.contains_key(field) {
3943 dlg.finished(false);
3944 return Err(common::Error::FieldClash(field));
3945 }
3946 }
3947
3948 let mut params = Params::with_capacity(8 + self._additional_params.len());
3949 params.push("parent", self._parent);
3950 if let Some(value) = self._validate_only.as_ref() {
3951 params.push("validateOnly", value.to_string());
3952 }
3953 if let Some(value) = self._request_id.as_ref() {
3954 params.push("requestId", value);
3955 }
3956 if let Some(value) = self._force.as_ref() {
3957 params.push("force", value.to_string());
3958 }
3959 if let Some(value) = self._connection_profile_id.as_ref() {
3960 params.push("connectionProfileId", value);
3961 }
3962
3963 params.extend(self._additional_params.iter());
3964
3965 params.push("alt", "json");
3966 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
3967 if self._scopes.is_empty() {
3968 self._scopes
3969 .insert(Scope::CloudPlatform.as_ref().to_string());
3970 }
3971
3972 #[allow(clippy::single_element_loop)]
3973 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3974 url = params.uri_replacement(url, param_name, find_this, true);
3975 }
3976 {
3977 let to_remove = ["parent"];
3978 params.remove_params(&to_remove);
3979 }
3980
3981 let url = params.parse_with_url(&url);
3982
3983 let mut json_mime_type = mime::APPLICATION_JSON;
3984 let mut request_value_reader = {
3985 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3986 common::remove_json_null_values(&mut value);
3987 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3988 serde_json::to_writer(&mut dst, &value).unwrap();
3989 dst
3990 };
3991 let request_size = request_value_reader
3992 .seek(std::io::SeekFrom::End(0))
3993 .unwrap();
3994 request_value_reader
3995 .seek(std::io::SeekFrom::Start(0))
3996 .unwrap();
3997
3998 loop {
3999 let token = match self
4000 .hub
4001 .auth
4002 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4003 .await
4004 {
4005 Ok(token) => token,
4006 Err(e) => match dlg.token(e) {
4007 Ok(token) => token,
4008 Err(e) => {
4009 dlg.finished(false);
4010 return Err(common::Error::MissingToken(e));
4011 }
4012 },
4013 };
4014 request_value_reader
4015 .seek(std::io::SeekFrom::Start(0))
4016 .unwrap();
4017 let mut req_result = {
4018 let client = &self.hub.client;
4019 dlg.pre_request();
4020 let mut req_builder = hyper::Request::builder()
4021 .method(hyper::Method::POST)
4022 .uri(url.as_str())
4023 .header(USER_AGENT, self.hub._user_agent.clone());
4024
4025 if let Some(token) = token.as_ref() {
4026 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4027 }
4028
4029 let request = req_builder
4030 .header(CONTENT_TYPE, json_mime_type.to_string())
4031 .header(CONTENT_LENGTH, request_size as u64)
4032 .body(common::to_body(
4033 request_value_reader.get_ref().clone().into(),
4034 ));
4035
4036 client.request(request.unwrap()).await
4037 };
4038
4039 match req_result {
4040 Err(err) => {
4041 if let common::Retry::After(d) = dlg.http_error(&err) {
4042 sleep(d).await;
4043 continue;
4044 }
4045 dlg.finished(false);
4046 return Err(common::Error::HttpError(err));
4047 }
4048 Ok(res) => {
4049 let (mut parts, body) = res.into_parts();
4050 let mut body = common::Body::new(body);
4051 if !parts.status.is_success() {
4052 let bytes = common::to_bytes(body).await.unwrap_or_default();
4053 let error = serde_json::from_str(&common::to_string(&bytes));
4054 let response = common::to_response(parts, bytes.into());
4055
4056 if let common::Retry::After(d) =
4057 dlg.http_failure(&response, error.as_ref().ok())
4058 {
4059 sleep(d).await;
4060 continue;
4061 }
4062
4063 dlg.finished(false);
4064
4065 return Err(match error {
4066 Ok(value) => common::Error::BadRequest(value),
4067 _ => common::Error::Failure(response),
4068 });
4069 }
4070 let response = {
4071 let bytes = common::to_bytes(body).await.unwrap_or_default();
4072 let encoded = common::to_string(&bytes);
4073 match serde_json::from_str(&encoded) {
4074 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4075 Err(error) => {
4076 dlg.response_json_decode_error(&encoded, &error);
4077 return Err(common::Error::JsonDecodeError(
4078 encoded.to_string(),
4079 error,
4080 ));
4081 }
4082 }
4083 };
4084
4085 dlg.finished(true);
4086 return Ok(response);
4087 }
4088 }
4089 }
4090 }
4091
4092 ///
4093 /// Sets the *request* property to the given value.
4094 ///
4095 /// Even though the property as already been set when instantiating this call,
4096 /// we provide this method for API completeness.
4097 pub fn request(
4098 mut self,
4099 new_value: ConnectionProfile,
4100 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4101 self._request = new_value;
4102 self
4103 }
4104 /// Required. The parent that owns the collection of ConnectionProfiles.
4105 ///
4106 /// Sets the *parent* path property to the given value.
4107 ///
4108 /// Even though the property as already been set when instantiating this call,
4109 /// we provide this method for API completeness.
4110 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4111 self._parent = new_value.to_string();
4112 self
4113 }
4114 /// Optional. Only validate the connection profile, but don't create any resources. The default is false.
4115 ///
4116 /// Sets the *validate only* query property to the given value.
4117 pub fn validate_only(
4118 mut self,
4119 new_value: bool,
4120 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4121 self._validate_only = Some(new_value);
4122 self
4123 }
4124 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4125 ///
4126 /// Sets the *request id* query property to the given value.
4127 pub fn request_id(
4128 mut self,
4129 new_value: &str,
4130 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4131 self._request_id = Some(new_value.to_string());
4132 self
4133 }
4134 /// Optional. Create the connection profile without validating it.
4135 ///
4136 /// Sets the *force* query property to the given value.
4137 pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4138 self._force = Some(new_value);
4139 self
4140 }
4141 /// Required. The connection profile identifier.
4142 ///
4143 /// Sets the *connection profile id* query property to the given value.
4144 pub fn connection_profile_id(
4145 mut self,
4146 new_value: &str,
4147 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4148 self._connection_profile_id = Some(new_value.to_string());
4149 self
4150 }
4151 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4152 /// while executing the actual API request.
4153 ///
4154 /// ````text
4155 /// It should be used to handle progress information, and to implement a certain level of resilience.
4156 /// ````
4157 ///
4158 /// Sets the *delegate* property to the given value.
4159 pub fn delegate(
4160 mut self,
4161 new_value: &'a mut dyn common::Delegate,
4162 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4163 self._delegate = Some(new_value);
4164 self
4165 }
4166
4167 /// Set any additional parameter of the query string used in the request.
4168 /// It should be used to set parameters which are not yet available through their own
4169 /// setters.
4170 ///
4171 /// Please note that this method must not be used to set any of the known parameters
4172 /// which have their own setter method. If done anyway, the request will fail.
4173 ///
4174 /// # Additional Parameters
4175 ///
4176 /// * *$.xgafv* (query-string) - V1 error format.
4177 /// * *access_token* (query-string) - OAuth access token.
4178 /// * *alt* (query-string) - Data format for response.
4179 /// * *callback* (query-string) - JSONP
4180 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4181 /// * *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.
4182 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4183 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4184 /// * *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.
4185 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4186 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4187 pub fn param<T>(
4188 mut self,
4189 name: T,
4190 value: T,
4191 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
4192 where
4193 T: AsRef<str>,
4194 {
4195 self._additional_params
4196 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4197 self
4198 }
4199
4200 /// Identifies the authorization scope for the method you are building.
4201 ///
4202 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4203 /// [`Scope::CloudPlatform`].
4204 ///
4205 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4206 /// tokens for more than one scope.
4207 ///
4208 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4209 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4210 /// sufficient, a read-write scope will do as well.
4211 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileCreateCall<'a, C>
4212 where
4213 St: AsRef<str>,
4214 {
4215 self._scopes.insert(String::from(scope.as_ref()));
4216 self
4217 }
4218 /// Identifies the authorization scope(s) for the method you are building.
4219 ///
4220 /// See [`Self::add_scope()`] for details.
4221 pub fn add_scopes<I, St>(
4222 mut self,
4223 scopes: I,
4224 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
4225 where
4226 I: IntoIterator<Item = St>,
4227 St: AsRef<str>,
4228 {
4229 self._scopes
4230 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4231 self
4232 }
4233
4234 /// Removes all scopes, and no default scope will be used either.
4235 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4236 /// for details).
4237 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4238 self._scopes.clear();
4239 self
4240 }
4241}
4242
4243/// Use this method to delete a connection profile.
4244///
4245/// A builder for the *locations.connectionProfiles.delete* method supported by a *project* resource.
4246/// It is not used directly, but through a [`ProjectMethods`] instance.
4247///
4248/// # Example
4249///
4250/// Instantiate a resource method builder
4251///
4252/// ```test_harness,no_run
4253/// # extern crate hyper;
4254/// # extern crate hyper_rustls;
4255/// # extern crate google_datastream1 as datastream1;
4256/// # async fn dox() {
4257/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4258///
4259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4260/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4261/// # .with_native_roots()
4262/// # .unwrap()
4263/// # .https_only()
4264/// # .enable_http2()
4265/// # .build();
4266///
4267/// # let executor = hyper_util::rt::TokioExecutor::new();
4268/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4269/// # secret,
4270/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4271/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4272/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4273/// # ),
4274/// # ).build().await.unwrap();
4275///
4276/// # let client = hyper_util::client::legacy::Client::builder(
4277/// # hyper_util::rt::TokioExecutor::new()
4278/// # )
4279/// # .build(
4280/// # hyper_rustls::HttpsConnectorBuilder::new()
4281/// # .with_native_roots()
4282/// # .unwrap()
4283/// # .https_or_http()
4284/// # .enable_http2()
4285/// # .build()
4286/// # );
4287/// # let mut hub = Datastream::new(client, auth);
4288/// // You can configure optional parameters by calling the respective setters at will, and
4289/// // execute the final call using `doit()`.
4290/// // Values shown here are possibly random and not representative !
4291/// let result = hub.projects().locations_connection_profiles_delete("name")
4292/// .request_id("est")
4293/// .doit().await;
4294/// # }
4295/// ```
4296pub struct ProjectLocationConnectionProfileDeleteCall<'a, C>
4297where
4298 C: 'a,
4299{
4300 hub: &'a Datastream<C>,
4301 _name: String,
4302 _request_id: Option<String>,
4303 _delegate: Option<&'a mut dyn common::Delegate>,
4304 _additional_params: HashMap<String, String>,
4305 _scopes: BTreeSet<String>,
4306}
4307
4308impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDeleteCall<'a, C> {}
4309
4310impl<'a, C> ProjectLocationConnectionProfileDeleteCall<'a, C>
4311where
4312 C: common::Connector,
4313{
4314 /// Perform the operation you have build so far.
4315 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4316 use std::borrow::Cow;
4317 use std::io::{Read, Seek};
4318
4319 use common::{url::Params, ToParts};
4320 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4321
4322 let mut dd = common::DefaultDelegate;
4323 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4324 dlg.begin(common::MethodInfo {
4325 id: "datastream.projects.locations.connectionProfiles.delete",
4326 http_method: hyper::Method::DELETE,
4327 });
4328
4329 for &field in ["alt", "name", "requestId"].iter() {
4330 if self._additional_params.contains_key(field) {
4331 dlg.finished(false);
4332 return Err(common::Error::FieldClash(field));
4333 }
4334 }
4335
4336 let mut params = Params::with_capacity(4 + self._additional_params.len());
4337 params.push("name", self._name);
4338 if let Some(value) = self._request_id.as_ref() {
4339 params.push("requestId", value);
4340 }
4341
4342 params.extend(self._additional_params.iter());
4343
4344 params.push("alt", "json");
4345 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4346 if self._scopes.is_empty() {
4347 self._scopes
4348 .insert(Scope::CloudPlatform.as_ref().to_string());
4349 }
4350
4351 #[allow(clippy::single_element_loop)]
4352 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4353 url = params.uri_replacement(url, param_name, find_this, true);
4354 }
4355 {
4356 let to_remove = ["name"];
4357 params.remove_params(&to_remove);
4358 }
4359
4360 let url = params.parse_with_url(&url);
4361
4362 loop {
4363 let token = match self
4364 .hub
4365 .auth
4366 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4367 .await
4368 {
4369 Ok(token) => token,
4370 Err(e) => match dlg.token(e) {
4371 Ok(token) => token,
4372 Err(e) => {
4373 dlg.finished(false);
4374 return Err(common::Error::MissingToken(e));
4375 }
4376 },
4377 };
4378 let mut req_result = {
4379 let client = &self.hub.client;
4380 dlg.pre_request();
4381 let mut req_builder = hyper::Request::builder()
4382 .method(hyper::Method::DELETE)
4383 .uri(url.as_str())
4384 .header(USER_AGENT, self.hub._user_agent.clone());
4385
4386 if let Some(token) = token.as_ref() {
4387 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4388 }
4389
4390 let request = req_builder
4391 .header(CONTENT_LENGTH, 0_u64)
4392 .body(common::to_body::<String>(None));
4393
4394 client.request(request.unwrap()).await
4395 };
4396
4397 match req_result {
4398 Err(err) => {
4399 if let common::Retry::After(d) = dlg.http_error(&err) {
4400 sleep(d).await;
4401 continue;
4402 }
4403 dlg.finished(false);
4404 return Err(common::Error::HttpError(err));
4405 }
4406 Ok(res) => {
4407 let (mut parts, body) = res.into_parts();
4408 let mut body = common::Body::new(body);
4409 if !parts.status.is_success() {
4410 let bytes = common::to_bytes(body).await.unwrap_or_default();
4411 let error = serde_json::from_str(&common::to_string(&bytes));
4412 let response = common::to_response(parts, bytes.into());
4413
4414 if let common::Retry::After(d) =
4415 dlg.http_failure(&response, error.as_ref().ok())
4416 {
4417 sleep(d).await;
4418 continue;
4419 }
4420
4421 dlg.finished(false);
4422
4423 return Err(match error {
4424 Ok(value) => common::Error::BadRequest(value),
4425 _ => common::Error::Failure(response),
4426 });
4427 }
4428 let response = {
4429 let bytes = common::to_bytes(body).await.unwrap_or_default();
4430 let encoded = common::to_string(&bytes);
4431 match serde_json::from_str(&encoded) {
4432 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4433 Err(error) => {
4434 dlg.response_json_decode_error(&encoded, &error);
4435 return Err(common::Error::JsonDecodeError(
4436 encoded.to_string(),
4437 error,
4438 ));
4439 }
4440 }
4441 };
4442
4443 dlg.finished(true);
4444 return Ok(response);
4445 }
4446 }
4447 }
4448 }
4449
4450 /// Required. The name of the connection profile resource to delete.
4451 ///
4452 /// Sets the *name* path property to the given value.
4453 ///
4454 /// Even though the property as already been set when instantiating this call,
4455 /// we provide this method for API completeness.
4456 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
4457 self._name = new_value.to_string();
4458 self
4459 }
4460 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4461 ///
4462 /// Sets the *request id* query property to the given value.
4463 pub fn request_id(
4464 mut self,
4465 new_value: &str,
4466 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
4467 self._request_id = Some(new_value.to_string());
4468 self
4469 }
4470 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4471 /// while executing the actual API request.
4472 ///
4473 /// ````text
4474 /// It should be used to handle progress information, and to implement a certain level of resilience.
4475 /// ````
4476 ///
4477 /// Sets the *delegate* property to the given value.
4478 pub fn delegate(
4479 mut self,
4480 new_value: &'a mut dyn common::Delegate,
4481 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
4482 self._delegate = Some(new_value);
4483 self
4484 }
4485
4486 /// Set any additional parameter of the query string used in the request.
4487 /// It should be used to set parameters which are not yet available through their own
4488 /// setters.
4489 ///
4490 /// Please note that this method must not be used to set any of the known parameters
4491 /// which have their own setter method. If done anyway, the request will fail.
4492 ///
4493 /// # Additional Parameters
4494 ///
4495 /// * *$.xgafv* (query-string) - V1 error format.
4496 /// * *access_token* (query-string) - OAuth access token.
4497 /// * *alt* (query-string) - Data format for response.
4498 /// * *callback* (query-string) - JSONP
4499 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4500 /// * *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.
4501 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4502 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4503 /// * *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.
4504 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4505 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4506 pub fn param<T>(
4507 mut self,
4508 name: T,
4509 value: T,
4510 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
4511 where
4512 T: AsRef<str>,
4513 {
4514 self._additional_params
4515 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4516 self
4517 }
4518
4519 /// Identifies the authorization scope for the method you are building.
4520 ///
4521 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4522 /// [`Scope::CloudPlatform`].
4523 ///
4524 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4525 /// tokens for more than one scope.
4526 ///
4527 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4528 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4529 /// sufficient, a read-write scope will do as well.
4530 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
4531 where
4532 St: AsRef<str>,
4533 {
4534 self._scopes.insert(String::from(scope.as_ref()));
4535 self
4536 }
4537 /// Identifies the authorization scope(s) for the method you are building.
4538 ///
4539 /// See [`Self::add_scope()`] for details.
4540 pub fn add_scopes<I, St>(
4541 mut self,
4542 scopes: I,
4543 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
4544 where
4545 I: IntoIterator<Item = St>,
4546 St: AsRef<str>,
4547 {
4548 self._scopes
4549 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4550 self
4551 }
4552
4553 /// Removes all scopes, and no default scope will be used either.
4554 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4555 /// for details).
4556 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
4557 self._scopes.clear();
4558 self
4559 }
4560}
4561
4562/// Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects of a parent data object that's optionally supplied in the request.
4563///
4564/// A builder for the *locations.connectionProfiles.discover* method supported by a *project* resource.
4565/// It is not used directly, but through a [`ProjectMethods`] instance.
4566///
4567/// # Example
4568///
4569/// Instantiate a resource method builder
4570///
4571/// ```test_harness,no_run
4572/// # extern crate hyper;
4573/// # extern crate hyper_rustls;
4574/// # extern crate google_datastream1 as datastream1;
4575/// use datastream1::api::DiscoverConnectionProfileRequest;
4576/// # async fn dox() {
4577/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4578///
4579/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4580/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4581/// # .with_native_roots()
4582/// # .unwrap()
4583/// # .https_only()
4584/// # .enable_http2()
4585/// # .build();
4586///
4587/// # let executor = hyper_util::rt::TokioExecutor::new();
4588/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4589/// # secret,
4590/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4591/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4592/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4593/// # ),
4594/// # ).build().await.unwrap();
4595///
4596/// # let client = hyper_util::client::legacy::Client::builder(
4597/// # hyper_util::rt::TokioExecutor::new()
4598/// # )
4599/// # .build(
4600/// # hyper_rustls::HttpsConnectorBuilder::new()
4601/// # .with_native_roots()
4602/// # .unwrap()
4603/// # .https_or_http()
4604/// # .enable_http2()
4605/// # .build()
4606/// # );
4607/// # let mut hub = Datastream::new(client, auth);
4608/// // As the method needs a request, you would usually fill it with the desired information
4609/// // into the respective structure. Some of the parts shown here might not be applicable !
4610/// // Values shown here are possibly random and not representative !
4611/// let mut req = DiscoverConnectionProfileRequest::default();
4612///
4613/// // You can configure optional parameters by calling the respective setters at will, and
4614/// // execute the final call using `doit()`.
4615/// // Values shown here are possibly random and not representative !
4616/// let result = hub.projects().locations_connection_profiles_discover(req, "parent")
4617/// .doit().await;
4618/// # }
4619/// ```
4620pub struct ProjectLocationConnectionProfileDiscoverCall<'a, C>
4621where
4622 C: 'a,
4623{
4624 hub: &'a Datastream<C>,
4625 _request: DiscoverConnectionProfileRequest,
4626 _parent: String,
4627 _delegate: Option<&'a mut dyn common::Delegate>,
4628 _additional_params: HashMap<String, String>,
4629 _scopes: BTreeSet<String>,
4630}
4631
4632impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDiscoverCall<'a, C> {}
4633
4634impl<'a, C> ProjectLocationConnectionProfileDiscoverCall<'a, C>
4635where
4636 C: common::Connector,
4637{
4638 /// Perform the operation you have build so far.
4639 pub async fn doit(
4640 mut self,
4641 ) -> common::Result<(common::Response, DiscoverConnectionProfileResponse)> {
4642 use std::borrow::Cow;
4643 use std::io::{Read, Seek};
4644
4645 use common::{url::Params, ToParts};
4646 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4647
4648 let mut dd = common::DefaultDelegate;
4649 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4650 dlg.begin(common::MethodInfo {
4651 id: "datastream.projects.locations.connectionProfiles.discover",
4652 http_method: hyper::Method::POST,
4653 });
4654
4655 for &field in ["alt", "parent"].iter() {
4656 if self._additional_params.contains_key(field) {
4657 dlg.finished(false);
4658 return Err(common::Error::FieldClash(field));
4659 }
4660 }
4661
4662 let mut params = Params::with_capacity(4 + self._additional_params.len());
4663 params.push("parent", self._parent);
4664
4665 params.extend(self._additional_params.iter());
4666
4667 params.push("alt", "json");
4668 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles:discover";
4669 if self._scopes.is_empty() {
4670 self._scopes
4671 .insert(Scope::CloudPlatform.as_ref().to_string());
4672 }
4673
4674 #[allow(clippy::single_element_loop)]
4675 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4676 url = params.uri_replacement(url, param_name, find_this, true);
4677 }
4678 {
4679 let to_remove = ["parent"];
4680 params.remove_params(&to_remove);
4681 }
4682
4683 let url = params.parse_with_url(&url);
4684
4685 let mut json_mime_type = mime::APPLICATION_JSON;
4686 let mut request_value_reader = {
4687 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4688 common::remove_json_null_values(&mut value);
4689 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4690 serde_json::to_writer(&mut dst, &value).unwrap();
4691 dst
4692 };
4693 let request_size = request_value_reader
4694 .seek(std::io::SeekFrom::End(0))
4695 .unwrap();
4696 request_value_reader
4697 .seek(std::io::SeekFrom::Start(0))
4698 .unwrap();
4699
4700 loop {
4701 let token = match self
4702 .hub
4703 .auth
4704 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4705 .await
4706 {
4707 Ok(token) => token,
4708 Err(e) => match dlg.token(e) {
4709 Ok(token) => token,
4710 Err(e) => {
4711 dlg.finished(false);
4712 return Err(common::Error::MissingToken(e));
4713 }
4714 },
4715 };
4716 request_value_reader
4717 .seek(std::io::SeekFrom::Start(0))
4718 .unwrap();
4719 let mut req_result = {
4720 let client = &self.hub.client;
4721 dlg.pre_request();
4722 let mut req_builder = hyper::Request::builder()
4723 .method(hyper::Method::POST)
4724 .uri(url.as_str())
4725 .header(USER_AGENT, self.hub._user_agent.clone());
4726
4727 if let Some(token) = token.as_ref() {
4728 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4729 }
4730
4731 let request = req_builder
4732 .header(CONTENT_TYPE, json_mime_type.to_string())
4733 .header(CONTENT_LENGTH, request_size as u64)
4734 .body(common::to_body(
4735 request_value_reader.get_ref().clone().into(),
4736 ));
4737
4738 client.request(request.unwrap()).await
4739 };
4740
4741 match req_result {
4742 Err(err) => {
4743 if let common::Retry::After(d) = dlg.http_error(&err) {
4744 sleep(d).await;
4745 continue;
4746 }
4747 dlg.finished(false);
4748 return Err(common::Error::HttpError(err));
4749 }
4750 Ok(res) => {
4751 let (mut parts, body) = res.into_parts();
4752 let mut body = common::Body::new(body);
4753 if !parts.status.is_success() {
4754 let bytes = common::to_bytes(body).await.unwrap_or_default();
4755 let error = serde_json::from_str(&common::to_string(&bytes));
4756 let response = common::to_response(parts, bytes.into());
4757
4758 if let common::Retry::After(d) =
4759 dlg.http_failure(&response, error.as_ref().ok())
4760 {
4761 sleep(d).await;
4762 continue;
4763 }
4764
4765 dlg.finished(false);
4766
4767 return Err(match error {
4768 Ok(value) => common::Error::BadRequest(value),
4769 _ => common::Error::Failure(response),
4770 });
4771 }
4772 let response = {
4773 let bytes = common::to_bytes(body).await.unwrap_or_default();
4774 let encoded = common::to_string(&bytes);
4775 match serde_json::from_str(&encoded) {
4776 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4777 Err(error) => {
4778 dlg.response_json_decode_error(&encoded, &error);
4779 return Err(common::Error::JsonDecodeError(
4780 encoded.to_string(),
4781 error,
4782 ));
4783 }
4784 }
4785 };
4786
4787 dlg.finished(true);
4788 return Ok(response);
4789 }
4790 }
4791 }
4792 }
4793
4794 ///
4795 /// Sets the *request* property to the given value.
4796 ///
4797 /// Even though the property as already been set when instantiating this call,
4798 /// we provide this method for API completeness.
4799 pub fn request(
4800 mut self,
4801 new_value: DiscoverConnectionProfileRequest,
4802 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
4803 self._request = new_value;
4804 self
4805 }
4806 /// Required. The parent resource of the connection profile type. Must be in the format `projects/*/locations/*`.
4807 ///
4808 /// Sets the *parent* path property to the given value.
4809 ///
4810 /// Even though the property as already been set when instantiating this call,
4811 /// we provide this method for API completeness.
4812 pub fn parent(
4813 mut self,
4814 new_value: &str,
4815 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
4816 self._parent = new_value.to_string();
4817 self
4818 }
4819 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4820 /// while executing the actual API request.
4821 ///
4822 /// ````text
4823 /// It should be used to handle progress information, and to implement a certain level of resilience.
4824 /// ````
4825 ///
4826 /// Sets the *delegate* property to the given value.
4827 pub fn delegate(
4828 mut self,
4829 new_value: &'a mut dyn common::Delegate,
4830 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
4831 self._delegate = Some(new_value);
4832 self
4833 }
4834
4835 /// Set any additional parameter of the query string used in the request.
4836 /// It should be used to set parameters which are not yet available through their own
4837 /// setters.
4838 ///
4839 /// Please note that this method must not be used to set any of the known parameters
4840 /// which have their own setter method. If done anyway, the request will fail.
4841 ///
4842 /// # Additional Parameters
4843 ///
4844 /// * *$.xgafv* (query-string) - V1 error format.
4845 /// * *access_token* (query-string) - OAuth access token.
4846 /// * *alt* (query-string) - Data format for response.
4847 /// * *callback* (query-string) - JSONP
4848 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4849 /// * *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.
4850 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4851 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4852 /// * *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.
4853 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4854 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4855 pub fn param<T>(
4856 mut self,
4857 name: T,
4858 value: T,
4859 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
4860 where
4861 T: AsRef<str>,
4862 {
4863 self._additional_params
4864 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4865 self
4866 }
4867
4868 /// Identifies the authorization scope for the method you are building.
4869 ///
4870 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4871 /// [`Scope::CloudPlatform`].
4872 ///
4873 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4874 /// tokens for more than one scope.
4875 ///
4876 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4877 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4878 /// sufficient, a read-write scope will do as well.
4879 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
4880 where
4881 St: AsRef<str>,
4882 {
4883 self._scopes.insert(String::from(scope.as_ref()));
4884 self
4885 }
4886 /// Identifies the authorization scope(s) for the method you are building.
4887 ///
4888 /// See [`Self::add_scope()`] for details.
4889 pub fn add_scopes<I, St>(
4890 mut self,
4891 scopes: I,
4892 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
4893 where
4894 I: IntoIterator<Item = St>,
4895 St: AsRef<str>,
4896 {
4897 self._scopes
4898 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4899 self
4900 }
4901
4902 /// Removes all scopes, and no default scope will be used either.
4903 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4904 /// for details).
4905 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
4906 self._scopes.clear();
4907 self
4908 }
4909}
4910
4911/// Use this method to get details about a connection profile.
4912///
4913/// A builder for the *locations.connectionProfiles.get* method supported by a *project* resource.
4914/// It is not used directly, but through a [`ProjectMethods`] instance.
4915///
4916/// # Example
4917///
4918/// Instantiate a resource method builder
4919///
4920/// ```test_harness,no_run
4921/// # extern crate hyper;
4922/// # extern crate hyper_rustls;
4923/// # extern crate google_datastream1 as datastream1;
4924/// # async fn dox() {
4925/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4926///
4927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4928/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4929/// # .with_native_roots()
4930/// # .unwrap()
4931/// # .https_only()
4932/// # .enable_http2()
4933/// # .build();
4934///
4935/// # let executor = hyper_util::rt::TokioExecutor::new();
4936/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4937/// # secret,
4938/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4939/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4940/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4941/// # ),
4942/// # ).build().await.unwrap();
4943///
4944/// # let client = hyper_util::client::legacy::Client::builder(
4945/// # hyper_util::rt::TokioExecutor::new()
4946/// # )
4947/// # .build(
4948/// # hyper_rustls::HttpsConnectorBuilder::new()
4949/// # .with_native_roots()
4950/// # .unwrap()
4951/// # .https_or_http()
4952/// # .enable_http2()
4953/// # .build()
4954/// # );
4955/// # let mut hub = Datastream::new(client, auth);
4956/// // You can configure optional parameters by calling the respective setters at will, and
4957/// // execute the final call using `doit()`.
4958/// // Values shown here are possibly random and not representative !
4959/// let result = hub.projects().locations_connection_profiles_get("name")
4960/// .doit().await;
4961/// # }
4962/// ```
4963pub struct ProjectLocationConnectionProfileGetCall<'a, C>
4964where
4965 C: 'a,
4966{
4967 hub: &'a Datastream<C>,
4968 _name: String,
4969 _delegate: Option<&'a mut dyn common::Delegate>,
4970 _additional_params: HashMap<String, String>,
4971 _scopes: BTreeSet<String>,
4972}
4973
4974impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetCall<'a, C> {}
4975
4976impl<'a, C> ProjectLocationConnectionProfileGetCall<'a, C>
4977where
4978 C: common::Connector,
4979{
4980 /// Perform the operation you have build so far.
4981 pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionProfile)> {
4982 use std::borrow::Cow;
4983 use std::io::{Read, Seek};
4984
4985 use common::{url::Params, ToParts};
4986 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4987
4988 let mut dd = common::DefaultDelegate;
4989 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4990 dlg.begin(common::MethodInfo {
4991 id: "datastream.projects.locations.connectionProfiles.get",
4992 http_method: hyper::Method::GET,
4993 });
4994
4995 for &field in ["alt", "name"].iter() {
4996 if self._additional_params.contains_key(field) {
4997 dlg.finished(false);
4998 return Err(common::Error::FieldClash(field));
4999 }
5000 }
5001
5002 let mut params = Params::with_capacity(3 + self._additional_params.len());
5003 params.push("name", self._name);
5004
5005 params.extend(self._additional_params.iter());
5006
5007 params.push("alt", "json");
5008 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5009 if self._scopes.is_empty() {
5010 self._scopes
5011 .insert(Scope::CloudPlatform.as_ref().to_string());
5012 }
5013
5014 #[allow(clippy::single_element_loop)]
5015 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5016 url = params.uri_replacement(url, param_name, find_this, true);
5017 }
5018 {
5019 let to_remove = ["name"];
5020 params.remove_params(&to_remove);
5021 }
5022
5023 let url = params.parse_with_url(&url);
5024
5025 loop {
5026 let token = match self
5027 .hub
5028 .auth
5029 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5030 .await
5031 {
5032 Ok(token) => token,
5033 Err(e) => match dlg.token(e) {
5034 Ok(token) => token,
5035 Err(e) => {
5036 dlg.finished(false);
5037 return Err(common::Error::MissingToken(e));
5038 }
5039 },
5040 };
5041 let mut req_result = {
5042 let client = &self.hub.client;
5043 dlg.pre_request();
5044 let mut req_builder = hyper::Request::builder()
5045 .method(hyper::Method::GET)
5046 .uri(url.as_str())
5047 .header(USER_AGENT, self.hub._user_agent.clone());
5048
5049 if let Some(token) = token.as_ref() {
5050 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5051 }
5052
5053 let request = req_builder
5054 .header(CONTENT_LENGTH, 0_u64)
5055 .body(common::to_body::<String>(None));
5056
5057 client.request(request.unwrap()).await
5058 };
5059
5060 match req_result {
5061 Err(err) => {
5062 if let common::Retry::After(d) = dlg.http_error(&err) {
5063 sleep(d).await;
5064 continue;
5065 }
5066 dlg.finished(false);
5067 return Err(common::Error::HttpError(err));
5068 }
5069 Ok(res) => {
5070 let (mut parts, body) = res.into_parts();
5071 let mut body = common::Body::new(body);
5072 if !parts.status.is_success() {
5073 let bytes = common::to_bytes(body).await.unwrap_or_default();
5074 let error = serde_json::from_str(&common::to_string(&bytes));
5075 let response = common::to_response(parts, bytes.into());
5076
5077 if let common::Retry::After(d) =
5078 dlg.http_failure(&response, error.as_ref().ok())
5079 {
5080 sleep(d).await;
5081 continue;
5082 }
5083
5084 dlg.finished(false);
5085
5086 return Err(match error {
5087 Ok(value) => common::Error::BadRequest(value),
5088 _ => common::Error::Failure(response),
5089 });
5090 }
5091 let response = {
5092 let bytes = common::to_bytes(body).await.unwrap_or_default();
5093 let encoded = common::to_string(&bytes);
5094 match serde_json::from_str(&encoded) {
5095 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5096 Err(error) => {
5097 dlg.response_json_decode_error(&encoded, &error);
5098 return Err(common::Error::JsonDecodeError(
5099 encoded.to_string(),
5100 error,
5101 ));
5102 }
5103 }
5104 };
5105
5106 dlg.finished(true);
5107 return Ok(response);
5108 }
5109 }
5110 }
5111 }
5112
5113 /// Required. The name of the connection profile resource to get.
5114 ///
5115 /// Sets the *name* path property to the given value.
5116 ///
5117 /// Even though the property as already been set when instantiating this call,
5118 /// we provide this method for API completeness.
5119 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5120 self._name = new_value.to_string();
5121 self
5122 }
5123 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5124 /// while executing the actual API request.
5125 ///
5126 /// ````text
5127 /// It should be used to handle progress information, and to implement a certain level of resilience.
5128 /// ````
5129 ///
5130 /// Sets the *delegate* property to the given value.
5131 pub fn delegate(
5132 mut self,
5133 new_value: &'a mut dyn common::Delegate,
5134 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5135 self._delegate = Some(new_value);
5136 self
5137 }
5138
5139 /// Set any additional parameter of the query string used in the request.
5140 /// It should be used to set parameters which are not yet available through their own
5141 /// setters.
5142 ///
5143 /// Please note that this method must not be used to set any of the known parameters
5144 /// which have their own setter method. If done anyway, the request will fail.
5145 ///
5146 /// # Additional Parameters
5147 ///
5148 /// * *$.xgafv* (query-string) - V1 error format.
5149 /// * *access_token* (query-string) - OAuth access token.
5150 /// * *alt* (query-string) - Data format for response.
5151 /// * *callback* (query-string) - JSONP
5152 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5153 /// * *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.
5154 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5155 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5156 /// * *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.
5157 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5158 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5159 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileGetCall<'a, C>
5160 where
5161 T: AsRef<str>,
5162 {
5163 self._additional_params
5164 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5165 self
5166 }
5167
5168 /// Identifies the authorization scope for the method you are building.
5169 ///
5170 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5171 /// [`Scope::CloudPlatform`].
5172 ///
5173 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5174 /// tokens for more than one scope.
5175 ///
5176 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5177 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5178 /// sufficient, a read-write scope will do as well.
5179 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileGetCall<'a, C>
5180 where
5181 St: AsRef<str>,
5182 {
5183 self._scopes.insert(String::from(scope.as_ref()));
5184 self
5185 }
5186 /// Identifies the authorization scope(s) for the method you are building.
5187 ///
5188 /// See [`Self::add_scope()`] for details.
5189 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileGetCall<'a, C>
5190 where
5191 I: IntoIterator<Item = St>,
5192 St: AsRef<str>,
5193 {
5194 self._scopes
5195 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5196 self
5197 }
5198
5199 /// Removes all scopes, and no default scope will be used either.
5200 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5201 /// for details).
5202 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5203 self._scopes.clear();
5204 self
5205 }
5206}
5207
5208/// Use this method to list connection profiles created in a project and location.
5209///
5210/// A builder for the *locations.connectionProfiles.list* method supported by a *project* resource.
5211/// It is not used directly, but through a [`ProjectMethods`] instance.
5212///
5213/// # Example
5214///
5215/// Instantiate a resource method builder
5216///
5217/// ```test_harness,no_run
5218/// # extern crate hyper;
5219/// # extern crate hyper_rustls;
5220/// # extern crate google_datastream1 as datastream1;
5221/// # async fn dox() {
5222/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5223///
5224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5225/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5226/// # .with_native_roots()
5227/// # .unwrap()
5228/// # .https_only()
5229/// # .enable_http2()
5230/// # .build();
5231///
5232/// # let executor = hyper_util::rt::TokioExecutor::new();
5233/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5234/// # secret,
5235/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5236/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5237/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5238/// # ),
5239/// # ).build().await.unwrap();
5240///
5241/// # let client = hyper_util::client::legacy::Client::builder(
5242/// # hyper_util::rt::TokioExecutor::new()
5243/// # )
5244/// # .build(
5245/// # hyper_rustls::HttpsConnectorBuilder::new()
5246/// # .with_native_roots()
5247/// # .unwrap()
5248/// # .https_or_http()
5249/// # .enable_http2()
5250/// # .build()
5251/// # );
5252/// # let mut hub = Datastream::new(client, auth);
5253/// // You can configure optional parameters by calling the respective setters at will, and
5254/// // execute the final call using `doit()`.
5255/// // Values shown here are possibly random and not representative !
5256/// let result = hub.projects().locations_connection_profiles_list("parent")
5257/// .page_token("Lorem")
5258/// .page_size(-25)
5259/// .order_by("labore")
5260/// .filter("sed")
5261/// .doit().await;
5262/// # }
5263/// ```
5264pub struct ProjectLocationConnectionProfileListCall<'a, C>
5265where
5266 C: 'a,
5267{
5268 hub: &'a Datastream<C>,
5269 _parent: String,
5270 _page_token: Option<String>,
5271 _page_size: Option<i32>,
5272 _order_by: Option<String>,
5273 _filter: Option<String>,
5274 _delegate: Option<&'a mut dyn common::Delegate>,
5275 _additional_params: HashMap<String, String>,
5276 _scopes: BTreeSet<String>,
5277}
5278
5279impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileListCall<'a, C> {}
5280
5281impl<'a, C> ProjectLocationConnectionProfileListCall<'a, C>
5282where
5283 C: common::Connector,
5284{
5285 /// Perform the operation you have build so far.
5286 pub async fn doit(
5287 mut self,
5288 ) -> common::Result<(common::Response, ListConnectionProfilesResponse)> {
5289 use std::borrow::Cow;
5290 use std::io::{Read, Seek};
5291
5292 use common::{url::Params, ToParts};
5293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5294
5295 let mut dd = common::DefaultDelegate;
5296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5297 dlg.begin(common::MethodInfo {
5298 id: "datastream.projects.locations.connectionProfiles.list",
5299 http_method: hyper::Method::GET,
5300 });
5301
5302 for &field in [
5303 "alt",
5304 "parent",
5305 "pageToken",
5306 "pageSize",
5307 "orderBy",
5308 "filter",
5309 ]
5310 .iter()
5311 {
5312 if self._additional_params.contains_key(field) {
5313 dlg.finished(false);
5314 return Err(common::Error::FieldClash(field));
5315 }
5316 }
5317
5318 let mut params = Params::with_capacity(7 + self._additional_params.len());
5319 params.push("parent", self._parent);
5320 if let Some(value) = self._page_token.as_ref() {
5321 params.push("pageToken", value);
5322 }
5323 if let Some(value) = self._page_size.as_ref() {
5324 params.push("pageSize", value.to_string());
5325 }
5326 if let Some(value) = self._order_by.as_ref() {
5327 params.push("orderBy", value);
5328 }
5329 if let Some(value) = self._filter.as_ref() {
5330 params.push("filter", value);
5331 }
5332
5333 params.extend(self._additional_params.iter());
5334
5335 params.push("alt", "json");
5336 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
5337 if self._scopes.is_empty() {
5338 self._scopes
5339 .insert(Scope::CloudPlatform.as_ref().to_string());
5340 }
5341
5342 #[allow(clippy::single_element_loop)]
5343 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5344 url = params.uri_replacement(url, param_name, find_this, true);
5345 }
5346 {
5347 let to_remove = ["parent"];
5348 params.remove_params(&to_remove);
5349 }
5350
5351 let url = params.parse_with_url(&url);
5352
5353 loop {
5354 let token = match self
5355 .hub
5356 .auth
5357 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5358 .await
5359 {
5360 Ok(token) => token,
5361 Err(e) => match dlg.token(e) {
5362 Ok(token) => token,
5363 Err(e) => {
5364 dlg.finished(false);
5365 return Err(common::Error::MissingToken(e));
5366 }
5367 },
5368 };
5369 let mut req_result = {
5370 let client = &self.hub.client;
5371 dlg.pre_request();
5372 let mut req_builder = hyper::Request::builder()
5373 .method(hyper::Method::GET)
5374 .uri(url.as_str())
5375 .header(USER_AGENT, self.hub._user_agent.clone());
5376
5377 if let Some(token) = token.as_ref() {
5378 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5379 }
5380
5381 let request = req_builder
5382 .header(CONTENT_LENGTH, 0_u64)
5383 .body(common::to_body::<String>(None));
5384
5385 client.request(request.unwrap()).await
5386 };
5387
5388 match req_result {
5389 Err(err) => {
5390 if let common::Retry::After(d) = dlg.http_error(&err) {
5391 sleep(d).await;
5392 continue;
5393 }
5394 dlg.finished(false);
5395 return Err(common::Error::HttpError(err));
5396 }
5397 Ok(res) => {
5398 let (mut parts, body) = res.into_parts();
5399 let mut body = common::Body::new(body);
5400 if !parts.status.is_success() {
5401 let bytes = common::to_bytes(body).await.unwrap_or_default();
5402 let error = serde_json::from_str(&common::to_string(&bytes));
5403 let response = common::to_response(parts, bytes.into());
5404
5405 if let common::Retry::After(d) =
5406 dlg.http_failure(&response, error.as_ref().ok())
5407 {
5408 sleep(d).await;
5409 continue;
5410 }
5411
5412 dlg.finished(false);
5413
5414 return Err(match error {
5415 Ok(value) => common::Error::BadRequest(value),
5416 _ => common::Error::Failure(response),
5417 });
5418 }
5419 let response = {
5420 let bytes = common::to_bytes(body).await.unwrap_or_default();
5421 let encoded = common::to_string(&bytes);
5422 match serde_json::from_str(&encoded) {
5423 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5424 Err(error) => {
5425 dlg.response_json_decode_error(&encoded, &error);
5426 return Err(common::Error::JsonDecodeError(
5427 encoded.to_string(),
5428 error,
5429 ));
5430 }
5431 }
5432 };
5433
5434 dlg.finished(true);
5435 return Ok(response);
5436 }
5437 }
5438 }
5439 }
5440
5441 /// Required. The parent that owns the collection of connection profiles.
5442 ///
5443 /// Sets the *parent* path property to the given value.
5444 ///
5445 /// Even though the property as already been set when instantiating this call,
5446 /// we provide this method for API completeness.
5447 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
5448 self._parent = new_value.to_string();
5449 self
5450 }
5451 /// Page token received from a previous `ListConnectionProfiles` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListConnectionProfiles` must match the call that provided the page token.
5452 ///
5453 /// Sets the *page token* query property to the given value.
5454 pub fn page_token(
5455 mut self,
5456 new_value: &str,
5457 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
5458 self._page_token = Some(new_value.to_string());
5459 self
5460 }
5461 /// Maximum number of connection profiles to return. If unspecified, at most 50 connection profiles will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
5462 ///
5463 /// Sets the *page size* query property to the given value.
5464 pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionProfileListCall<'a, C> {
5465 self._page_size = Some(new_value);
5466 self
5467 }
5468 /// Order by fields for the result.
5469 ///
5470 /// Sets the *order by* query property to the given value.
5471 pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
5472 self._order_by = Some(new_value.to_string());
5473 self
5474 }
5475 /// Filter request.
5476 ///
5477 /// Sets the *filter* query property to the given value.
5478 pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
5479 self._filter = Some(new_value.to_string());
5480 self
5481 }
5482 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5483 /// while executing the actual API request.
5484 ///
5485 /// ````text
5486 /// It should be used to handle progress information, and to implement a certain level of resilience.
5487 /// ````
5488 ///
5489 /// Sets the *delegate* property to the given value.
5490 pub fn delegate(
5491 mut self,
5492 new_value: &'a mut dyn common::Delegate,
5493 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
5494 self._delegate = Some(new_value);
5495 self
5496 }
5497
5498 /// Set any additional parameter of the query string used in the request.
5499 /// It should be used to set parameters which are not yet available through their own
5500 /// setters.
5501 ///
5502 /// Please note that this method must not be used to set any of the known parameters
5503 /// which have their own setter method. If done anyway, the request will fail.
5504 ///
5505 /// # Additional Parameters
5506 ///
5507 /// * *$.xgafv* (query-string) - V1 error format.
5508 /// * *access_token* (query-string) - OAuth access token.
5509 /// * *alt* (query-string) - Data format for response.
5510 /// * *callback* (query-string) - JSONP
5511 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5512 /// * *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.
5513 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5514 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5515 /// * *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.
5516 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5517 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5518 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileListCall<'a, C>
5519 where
5520 T: AsRef<str>,
5521 {
5522 self._additional_params
5523 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5524 self
5525 }
5526
5527 /// Identifies the authorization scope for the method you are building.
5528 ///
5529 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5530 /// [`Scope::CloudPlatform`].
5531 ///
5532 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5533 /// tokens for more than one scope.
5534 ///
5535 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5536 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5537 /// sufficient, a read-write scope will do as well.
5538 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileListCall<'a, C>
5539 where
5540 St: AsRef<str>,
5541 {
5542 self._scopes.insert(String::from(scope.as_ref()));
5543 self
5544 }
5545 /// Identifies the authorization scope(s) for the method you are building.
5546 ///
5547 /// See [`Self::add_scope()`] for details.
5548 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileListCall<'a, C>
5549 where
5550 I: IntoIterator<Item = St>,
5551 St: AsRef<str>,
5552 {
5553 self._scopes
5554 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5555 self
5556 }
5557
5558 /// Removes all scopes, and no default scope will be used either.
5559 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5560 /// for details).
5561 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileListCall<'a, C> {
5562 self._scopes.clear();
5563 self
5564 }
5565}
5566
5567/// Use this method to update the parameters of a connection profile.
5568///
5569/// A builder for the *locations.connectionProfiles.patch* method supported by a *project* resource.
5570/// It is not used directly, but through a [`ProjectMethods`] instance.
5571///
5572/// # Example
5573///
5574/// Instantiate a resource method builder
5575///
5576/// ```test_harness,no_run
5577/// # extern crate hyper;
5578/// # extern crate hyper_rustls;
5579/// # extern crate google_datastream1 as datastream1;
5580/// use datastream1::api::ConnectionProfile;
5581/// # async fn dox() {
5582/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5583///
5584/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5585/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5586/// # .with_native_roots()
5587/// # .unwrap()
5588/// # .https_only()
5589/// # .enable_http2()
5590/// # .build();
5591///
5592/// # let executor = hyper_util::rt::TokioExecutor::new();
5593/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5594/// # secret,
5595/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5596/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5597/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5598/// # ),
5599/// # ).build().await.unwrap();
5600///
5601/// # let client = hyper_util::client::legacy::Client::builder(
5602/// # hyper_util::rt::TokioExecutor::new()
5603/// # )
5604/// # .build(
5605/// # hyper_rustls::HttpsConnectorBuilder::new()
5606/// # .with_native_roots()
5607/// # .unwrap()
5608/// # .https_or_http()
5609/// # .enable_http2()
5610/// # .build()
5611/// # );
5612/// # let mut hub = Datastream::new(client, auth);
5613/// // As the method needs a request, you would usually fill it with the desired information
5614/// // into the respective structure. Some of the parts shown here might not be applicable !
5615/// // Values shown here are possibly random and not representative !
5616/// let mut req = ConnectionProfile::default();
5617///
5618/// // You can configure optional parameters by calling the respective setters at will, and
5619/// // execute the final call using `doit()`.
5620/// // Values shown here are possibly random and not representative !
5621/// let result = hub.projects().locations_connection_profiles_patch(req, "name")
5622/// .validate_only(false)
5623/// .update_mask(FieldMask::new::<&str>(&[]))
5624/// .request_id("no")
5625/// .force(true)
5626/// .doit().await;
5627/// # }
5628/// ```
5629pub struct ProjectLocationConnectionProfilePatchCall<'a, C>
5630where
5631 C: 'a,
5632{
5633 hub: &'a Datastream<C>,
5634 _request: ConnectionProfile,
5635 _name: String,
5636 _validate_only: Option<bool>,
5637 _update_mask: Option<common::FieldMask>,
5638 _request_id: Option<String>,
5639 _force: Option<bool>,
5640 _delegate: Option<&'a mut dyn common::Delegate>,
5641 _additional_params: HashMap<String, String>,
5642 _scopes: BTreeSet<String>,
5643}
5644
5645impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfilePatchCall<'a, C> {}
5646
5647impl<'a, C> ProjectLocationConnectionProfilePatchCall<'a, C>
5648where
5649 C: common::Connector,
5650{
5651 /// Perform the operation you have build so far.
5652 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5653 use std::borrow::Cow;
5654 use std::io::{Read, Seek};
5655
5656 use common::{url::Params, ToParts};
5657 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5658
5659 let mut dd = common::DefaultDelegate;
5660 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5661 dlg.begin(common::MethodInfo {
5662 id: "datastream.projects.locations.connectionProfiles.patch",
5663 http_method: hyper::Method::PATCH,
5664 });
5665
5666 for &field in [
5667 "alt",
5668 "name",
5669 "validateOnly",
5670 "updateMask",
5671 "requestId",
5672 "force",
5673 ]
5674 .iter()
5675 {
5676 if self._additional_params.contains_key(field) {
5677 dlg.finished(false);
5678 return Err(common::Error::FieldClash(field));
5679 }
5680 }
5681
5682 let mut params = Params::with_capacity(8 + self._additional_params.len());
5683 params.push("name", self._name);
5684 if let Some(value) = self._validate_only.as_ref() {
5685 params.push("validateOnly", value.to_string());
5686 }
5687 if let Some(value) = self._update_mask.as_ref() {
5688 params.push("updateMask", value.to_string());
5689 }
5690 if let Some(value) = self._request_id.as_ref() {
5691 params.push("requestId", value);
5692 }
5693 if let Some(value) = self._force.as_ref() {
5694 params.push("force", value.to_string());
5695 }
5696
5697 params.extend(self._additional_params.iter());
5698
5699 params.push("alt", "json");
5700 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5701 if self._scopes.is_empty() {
5702 self._scopes
5703 .insert(Scope::CloudPlatform.as_ref().to_string());
5704 }
5705
5706 #[allow(clippy::single_element_loop)]
5707 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5708 url = params.uri_replacement(url, param_name, find_this, true);
5709 }
5710 {
5711 let to_remove = ["name"];
5712 params.remove_params(&to_remove);
5713 }
5714
5715 let url = params.parse_with_url(&url);
5716
5717 let mut json_mime_type = mime::APPLICATION_JSON;
5718 let mut request_value_reader = {
5719 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5720 common::remove_json_null_values(&mut value);
5721 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5722 serde_json::to_writer(&mut dst, &value).unwrap();
5723 dst
5724 };
5725 let request_size = request_value_reader
5726 .seek(std::io::SeekFrom::End(0))
5727 .unwrap();
5728 request_value_reader
5729 .seek(std::io::SeekFrom::Start(0))
5730 .unwrap();
5731
5732 loop {
5733 let token = match self
5734 .hub
5735 .auth
5736 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5737 .await
5738 {
5739 Ok(token) => token,
5740 Err(e) => match dlg.token(e) {
5741 Ok(token) => token,
5742 Err(e) => {
5743 dlg.finished(false);
5744 return Err(common::Error::MissingToken(e));
5745 }
5746 },
5747 };
5748 request_value_reader
5749 .seek(std::io::SeekFrom::Start(0))
5750 .unwrap();
5751 let mut req_result = {
5752 let client = &self.hub.client;
5753 dlg.pre_request();
5754 let mut req_builder = hyper::Request::builder()
5755 .method(hyper::Method::PATCH)
5756 .uri(url.as_str())
5757 .header(USER_AGENT, self.hub._user_agent.clone());
5758
5759 if let Some(token) = token.as_ref() {
5760 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5761 }
5762
5763 let request = req_builder
5764 .header(CONTENT_TYPE, json_mime_type.to_string())
5765 .header(CONTENT_LENGTH, request_size as u64)
5766 .body(common::to_body(
5767 request_value_reader.get_ref().clone().into(),
5768 ));
5769
5770 client.request(request.unwrap()).await
5771 };
5772
5773 match req_result {
5774 Err(err) => {
5775 if let common::Retry::After(d) = dlg.http_error(&err) {
5776 sleep(d).await;
5777 continue;
5778 }
5779 dlg.finished(false);
5780 return Err(common::Error::HttpError(err));
5781 }
5782 Ok(res) => {
5783 let (mut parts, body) = res.into_parts();
5784 let mut body = common::Body::new(body);
5785 if !parts.status.is_success() {
5786 let bytes = common::to_bytes(body).await.unwrap_or_default();
5787 let error = serde_json::from_str(&common::to_string(&bytes));
5788 let response = common::to_response(parts, bytes.into());
5789
5790 if let common::Retry::After(d) =
5791 dlg.http_failure(&response, error.as_ref().ok())
5792 {
5793 sleep(d).await;
5794 continue;
5795 }
5796
5797 dlg.finished(false);
5798
5799 return Err(match error {
5800 Ok(value) => common::Error::BadRequest(value),
5801 _ => common::Error::Failure(response),
5802 });
5803 }
5804 let response = {
5805 let bytes = common::to_bytes(body).await.unwrap_or_default();
5806 let encoded = common::to_string(&bytes);
5807 match serde_json::from_str(&encoded) {
5808 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5809 Err(error) => {
5810 dlg.response_json_decode_error(&encoded, &error);
5811 return Err(common::Error::JsonDecodeError(
5812 encoded.to_string(),
5813 error,
5814 ));
5815 }
5816 }
5817 };
5818
5819 dlg.finished(true);
5820 return Ok(response);
5821 }
5822 }
5823 }
5824 }
5825
5826 ///
5827 /// Sets the *request* property to the given value.
5828 ///
5829 /// Even though the property as already been set when instantiating this call,
5830 /// we provide this method for API completeness.
5831 pub fn request(
5832 mut self,
5833 new_value: ConnectionProfile,
5834 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5835 self._request = new_value;
5836 self
5837 }
5838 /// Output only. Identifier. The resource's name.
5839 ///
5840 /// Sets the *name* path property to the given value.
5841 ///
5842 /// Even though the property as already been set when instantiating this call,
5843 /// we provide this method for API completeness.
5844 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5845 self._name = new_value.to_string();
5846 self
5847 }
5848 /// Optional. Only validate the connection profile, but don't update any resources. The default is false.
5849 ///
5850 /// Sets the *validate only* query property to the given value.
5851 pub fn validate_only(
5852 mut self,
5853 new_value: bool,
5854 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5855 self._validate_only = Some(new_value);
5856 self
5857 }
5858 /// Optional. Field mask is used to specify the fields to be overwritten in the ConnectionProfile resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
5859 ///
5860 /// Sets the *update mask* query property to the given value.
5861 pub fn update_mask(
5862 mut self,
5863 new_value: common::FieldMask,
5864 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5865 self._update_mask = Some(new_value);
5866 self
5867 }
5868 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
5869 ///
5870 /// Sets the *request id* query property to the given value.
5871 pub fn request_id(
5872 mut self,
5873 new_value: &str,
5874 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5875 self._request_id = Some(new_value.to_string());
5876 self
5877 }
5878 /// Optional. Update the connection profile without validating it.
5879 ///
5880 /// Sets the *force* query property to the given value.
5881 pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5882 self._force = Some(new_value);
5883 self
5884 }
5885 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5886 /// while executing the actual API request.
5887 ///
5888 /// ````text
5889 /// It should be used to handle progress information, and to implement a certain level of resilience.
5890 /// ````
5891 ///
5892 /// Sets the *delegate* property to the given value.
5893 pub fn delegate(
5894 mut self,
5895 new_value: &'a mut dyn common::Delegate,
5896 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5897 self._delegate = Some(new_value);
5898 self
5899 }
5900
5901 /// Set any additional parameter of the query string used in the request.
5902 /// It should be used to set parameters which are not yet available through their own
5903 /// setters.
5904 ///
5905 /// Please note that this method must not be used to set any of the known parameters
5906 /// which have their own setter method. If done anyway, the request will fail.
5907 ///
5908 /// # Additional Parameters
5909 ///
5910 /// * *$.xgafv* (query-string) - V1 error format.
5911 /// * *access_token* (query-string) - OAuth access token.
5912 /// * *alt* (query-string) - Data format for response.
5913 /// * *callback* (query-string) - JSONP
5914 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5915 /// * *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.
5916 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5917 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5918 /// * *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.
5919 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5920 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5921 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfilePatchCall<'a, C>
5922 where
5923 T: AsRef<str>,
5924 {
5925 self._additional_params
5926 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5927 self
5928 }
5929
5930 /// Identifies the authorization scope for the method you are building.
5931 ///
5932 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5933 /// [`Scope::CloudPlatform`].
5934 ///
5935 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5936 /// tokens for more than one scope.
5937 ///
5938 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5939 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5940 /// sufficient, a read-write scope will do as well.
5941 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfilePatchCall<'a, C>
5942 where
5943 St: AsRef<str>,
5944 {
5945 self._scopes.insert(String::from(scope.as_ref()));
5946 self
5947 }
5948 /// Identifies the authorization scope(s) for the method you are building.
5949 ///
5950 /// See [`Self::add_scope()`] for details.
5951 pub fn add_scopes<I, St>(
5952 mut self,
5953 scopes: I,
5954 ) -> ProjectLocationConnectionProfilePatchCall<'a, C>
5955 where
5956 I: IntoIterator<Item = St>,
5957 St: AsRef<str>,
5958 {
5959 self._scopes
5960 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5961 self
5962 }
5963
5964 /// Removes all scopes, and no default scope will be used either.
5965 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5966 /// for details).
5967 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
5968 self._scopes.clear();
5969 self
5970 }
5971}
5972
5973/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
5974///
5975/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
5976/// It is not used directly, but through a [`ProjectMethods`] instance.
5977///
5978/// # Example
5979///
5980/// Instantiate a resource method builder
5981///
5982/// ```test_harness,no_run
5983/// # extern crate hyper;
5984/// # extern crate hyper_rustls;
5985/// # extern crate google_datastream1 as datastream1;
5986/// use datastream1::api::CancelOperationRequest;
5987/// # async fn dox() {
5988/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5989///
5990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5992/// # .with_native_roots()
5993/// # .unwrap()
5994/// # .https_only()
5995/// # .enable_http2()
5996/// # .build();
5997///
5998/// # let executor = hyper_util::rt::TokioExecutor::new();
5999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6000/// # secret,
6001/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6002/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6003/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6004/// # ),
6005/// # ).build().await.unwrap();
6006///
6007/// # let client = hyper_util::client::legacy::Client::builder(
6008/// # hyper_util::rt::TokioExecutor::new()
6009/// # )
6010/// # .build(
6011/// # hyper_rustls::HttpsConnectorBuilder::new()
6012/// # .with_native_roots()
6013/// # .unwrap()
6014/// # .https_or_http()
6015/// # .enable_http2()
6016/// # .build()
6017/// # );
6018/// # let mut hub = Datastream::new(client, auth);
6019/// // As the method needs a request, you would usually fill it with the desired information
6020/// // into the respective structure. Some of the parts shown here might not be applicable !
6021/// // Values shown here are possibly random and not representative !
6022/// let mut req = CancelOperationRequest::default();
6023///
6024/// // You can configure optional parameters by calling the respective setters at will, and
6025/// // execute the final call using `doit()`.
6026/// // Values shown here are possibly random and not representative !
6027/// let result = hub.projects().locations_operations_cancel(req, "name")
6028/// .doit().await;
6029/// # }
6030/// ```
6031pub struct ProjectLocationOperationCancelCall<'a, C>
6032where
6033 C: 'a,
6034{
6035 hub: &'a Datastream<C>,
6036 _request: CancelOperationRequest,
6037 _name: String,
6038 _delegate: Option<&'a mut dyn common::Delegate>,
6039 _additional_params: HashMap<String, String>,
6040 _scopes: BTreeSet<String>,
6041}
6042
6043impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
6044
6045impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
6046where
6047 C: common::Connector,
6048{
6049 /// Perform the operation you have build so far.
6050 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6051 use std::borrow::Cow;
6052 use std::io::{Read, Seek};
6053
6054 use common::{url::Params, ToParts};
6055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6056
6057 let mut dd = common::DefaultDelegate;
6058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6059 dlg.begin(common::MethodInfo {
6060 id: "datastream.projects.locations.operations.cancel",
6061 http_method: hyper::Method::POST,
6062 });
6063
6064 for &field in ["alt", "name"].iter() {
6065 if self._additional_params.contains_key(field) {
6066 dlg.finished(false);
6067 return Err(common::Error::FieldClash(field));
6068 }
6069 }
6070
6071 let mut params = Params::with_capacity(4 + self._additional_params.len());
6072 params.push("name", self._name);
6073
6074 params.extend(self._additional_params.iter());
6075
6076 params.push("alt", "json");
6077 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
6078 if self._scopes.is_empty() {
6079 self._scopes
6080 .insert(Scope::CloudPlatform.as_ref().to_string());
6081 }
6082
6083 #[allow(clippy::single_element_loop)]
6084 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6085 url = params.uri_replacement(url, param_name, find_this, true);
6086 }
6087 {
6088 let to_remove = ["name"];
6089 params.remove_params(&to_remove);
6090 }
6091
6092 let url = params.parse_with_url(&url);
6093
6094 let mut json_mime_type = mime::APPLICATION_JSON;
6095 let mut request_value_reader = {
6096 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6097 common::remove_json_null_values(&mut value);
6098 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6099 serde_json::to_writer(&mut dst, &value).unwrap();
6100 dst
6101 };
6102 let request_size = request_value_reader
6103 .seek(std::io::SeekFrom::End(0))
6104 .unwrap();
6105 request_value_reader
6106 .seek(std::io::SeekFrom::Start(0))
6107 .unwrap();
6108
6109 loop {
6110 let token = match self
6111 .hub
6112 .auth
6113 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6114 .await
6115 {
6116 Ok(token) => token,
6117 Err(e) => match dlg.token(e) {
6118 Ok(token) => token,
6119 Err(e) => {
6120 dlg.finished(false);
6121 return Err(common::Error::MissingToken(e));
6122 }
6123 },
6124 };
6125 request_value_reader
6126 .seek(std::io::SeekFrom::Start(0))
6127 .unwrap();
6128 let mut req_result = {
6129 let client = &self.hub.client;
6130 dlg.pre_request();
6131 let mut req_builder = hyper::Request::builder()
6132 .method(hyper::Method::POST)
6133 .uri(url.as_str())
6134 .header(USER_AGENT, self.hub._user_agent.clone());
6135
6136 if let Some(token) = token.as_ref() {
6137 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6138 }
6139
6140 let request = req_builder
6141 .header(CONTENT_TYPE, json_mime_type.to_string())
6142 .header(CONTENT_LENGTH, request_size as u64)
6143 .body(common::to_body(
6144 request_value_reader.get_ref().clone().into(),
6145 ));
6146
6147 client.request(request.unwrap()).await
6148 };
6149
6150 match req_result {
6151 Err(err) => {
6152 if let common::Retry::After(d) = dlg.http_error(&err) {
6153 sleep(d).await;
6154 continue;
6155 }
6156 dlg.finished(false);
6157 return Err(common::Error::HttpError(err));
6158 }
6159 Ok(res) => {
6160 let (mut parts, body) = res.into_parts();
6161 let mut body = common::Body::new(body);
6162 if !parts.status.is_success() {
6163 let bytes = common::to_bytes(body).await.unwrap_or_default();
6164 let error = serde_json::from_str(&common::to_string(&bytes));
6165 let response = common::to_response(parts, bytes.into());
6166
6167 if let common::Retry::After(d) =
6168 dlg.http_failure(&response, error.as_ref().ok())
6169 {
6170 sleep(d).await;
6171 continue;
6172 }
6173
6174 dlg.finished(false);
6175
6176 return Err(match error {
6177 Ok(value) => common::Error::BadRequest(value),
6178 _ => common::Error::Failure(response),
6179 });
6180 }
6181 let response = {
6182 let bytes = common::to_bytes(body).await.unwrap_or_default();
6183 let encoded = common::to_string(&bytes);
6184 match serde_json::from_str(&encoded) {
6185 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6186 Err(error) => {
6187 dlg.response_json_decode_error(&encoded, &error);
6188 return Err(common::Error::JsonDecodeError(
6189 encoded.to_string(),
6190 error,
6191 ));
6192 }
6193 }
6194 };
6195
6196 dlg.finished(true);
6197 return Ok(response);
6198 }
6199 }
6200 }
6201 }
6202
6203 ///
6204 /// Sets the *request* property to the given value.
6205 ///
6206 /// Even though the property as already been set when instantiating this call,
6207 /// we provide this method for API completeness.
6208 pub fn request(
6209 mut self,
6210 new_value: CancelOperationRequest,
6211 ) -> ProjectLocationOperationCancelCall<'a, C> {
6212 self._request = new_value;
6213 self
6214 }
6215 /// The name of the operation resource to be cancelled.
6216 ///
6217 /// Sets the *name* path property to the given value.
6218 ///
6219 /// Even though the property as already been set when instantiating this call,
6220 /// we provide this method for API completeness.
6221 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
6222 self._name = new_value.to_string();
6223 self
6224 }
6225 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6226 /// while executing the actual API request.
6227 ///
6228 /// ````text
6229 /// It should be used to handle progress information, and to implement a certain level of resilience.
6230 /// ````
6231 ///
6232 /// Sets the *delegate* property to the given value.
6233 pub fn delegate(
6234 mut self,
6235 new_value: &'a mut dyn common::Delegate,
6236 ) -> ProjectLocationOperationCancelCall<'a, C> {
6237 self._delegate = Some(new_value);
6238 self
6239 }
6240
6241 /// Set any additional parameter of the query string used in the request.
6242 /// It should be used to set parameters which are not yet available through their own
6243 /// setters.
6244 ///
6245 /// Please note that this method must not be used to set any of the known parameters
6246 /// which have their own setter method. If done anyway, the request will fail.
6247 ///
6248 /// # Additional Parameters
6249 ///
6250 /// * *$.xgafv* (query-string) - V1 error format.
6251 /// * *access_token* (query-string) - OAuth access token.
6252 /// * *alt* (query-string) - Data format for response.
6253 /// * *callback* (query-string) - JSONP
6254 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6255 /// * *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.
6256 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6257 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6258 /// * *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.
6259 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6260 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6261 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
6262 where
6263 T: AsRef<str>,
6264 {
6265 self._additional_params
6266 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6267 self
6268 }
6269
6270 /// Identifies the authorization scope for the method you are building.
6271 ///
6272 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6273 /// [`Scope::CloudPlatform`].
6274 ///
6275 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6276 /// tokens for more than one scope.
6277 ///
6278 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6279 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6280 /// sufficient, a read-write scope will do as well.
6281 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
6282 where
6283 St: AsRef<str>,
6284 {
6285 self._scopes.insert(String::from(scope.as_ref()));
6286 self
6287 }
6288 /// Identifies the authorization scope(s) for the method you are building.
6289 ///
6290 /// See [`Self::add_scope()`] for details.
6291 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
6292 where
6293 I: IntoIterator<Item = St>,
6294 St: AsRef<str>,
6295 {
6296 self._scopes
6297 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6298 self
6299 }
6300
6301 /// Removes all scopes, and no default scope will be used either.
6302 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6303 /// for details).
6304 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
6305 self._scopes.clear();
6306 self
6307 }
6308}
6309
6310/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
6311///
6312/// A builder for the *locations.operations.delete* method supported by a *project* resource.
6313/// It is not used directly, but through a [`ProjectMethods`] instance.
6314///
6315/// # Example
6316///
6317/// Instantiate a resource method builder
6318///
6319/// ```test_harness,no_run
6320/// # extern crate hyper;
6321/// # extern crate hyper_rustls;
6322/// # extern crate google_datastream1 as datastream1;
6323/// # async fn dox() {
6324/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6325///
6326/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6327/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6328/// # .with_native_roots()
6329/// # .unwrap()
6330/// # .https_only()
6331/// # .enable_http2()
6332/// # .build();
6333///
6334/// # let executor = hyper_util::rt::TokioExecutor::new();
6335/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6336/// # secret,
6337/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6338/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6339/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6340/// # ),
6341/// # ).build().await.unwrap();
6342///
6343/// # let client = hyper_util::client::legacy::Client::builder(
6344/// # hyper_util::rt::TokioExecutor::new()
6345/// # )
6346/// # .build(
6347/// # hyper_rustls::HttpsConnectorBuilder::new()
6348/// # .with_native_roots()
6349/// # .unwrap()
6350/// # .https_or_http()
6351/// # .enable_http2()
6352/// # .build()
6353/// # );
6354/// # let mut hub = Datastream::new(client, auth);
6355/// // You can configure optional parameters by calling the respective setters at will, and
6356/// // execute the final call using `doit()`.
6357/// // Values shown here are possibly random and not representative !
6358/// let result = hub.projects().locations_operations_delete("name")
6359/// .doit().await;
6360/// # }
6361/// ```
6362pub struct ProjectLocationOperationDeleteCall<'a, C>
6363where
6364 C: 'a,
6365{
6366 hub: &'a Datastream<C>,
6367 _name: String,
6368 _delegate: Option<&'a mut dyn common::Delegate>,
6369 _additional_params: HashMap<String, String>,
6370 _scopes: BTreeSet<String>,
6371}
6372
6373impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
6374
6375impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
6376where
6377 C: common::Connector,
6378{
6379 /// Perform the operation you have build so far.
6380 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6381 use std::borrow::Cow;
6382 use std::io::{Read, Seek};
6383
6384 use common::{url::Params, ToParts};
6385 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6386
6387 let mut dd = common::DefaultDelegate;
6388 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6389 dlg.begin(common::MethodInfo {
6390 id: "datastream.projects.locations.operations.delete",
6391 http_method: hyper::Method::DELETE,
6392 });
6393
6394 for &field in ["alt", "name"].iter() {
6395 if self._additional_params.contains_key(field) {
6396 dlg.finished(false);
6397 return Err(common::Error::FieldClash(field));
6398 }
6399 }
6400
6401 let mut params = Params::with_capacity(3 + self._additional_params.len());
6402 params.push("name", self._name);
6403
6404 params.extend(self._additional_params.iter());
6405
6406 params.push("alt", "json");
6407 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6408 if self._scopes.is_empty() {
6409 self._scopes
6410 .insert(Scope::CloudPlatform.as_ref().to_string());
6411 }
6412
6413 #[allow(clippy::single_element_loop)]
6414 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6415 url = params.uri_replacement(url, param_name, find_this, true);
6416 }
6417 {
6418 let to_remove = ["name"];
6419 params.remove_params(&to_remove);
6420 }
6421
6422 let url = params.parse_with_url(&url);
6423
6424 loop {
6425 let token = match self
6426 .hub
6427 .auth
6428 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6429 .await
6430 {
6431 Ok(token) => token,
6432 Err(e) => match dlg.token(e) {
6433 Ok(token) => token,
6434 Err(e) => {
6435 dlg.finished(false);
6436 return Err(common::Error::MissingToken(e));
6437 }
6438 },
6439 };
6440 let mut req_result = {
6441 let client = &self.hub.client;
6442 dlg.pre_request();
6443 let mut req_builder = hyper::Request::builder()
6444 .method(hyper::Method::DELETE)
6445 .uri(url.as_str())
6446 .header(USER_AGENT, self.hub._user_agent.clone());
6447
6448 if let Some(token) = token.as_ref() {
6449 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6450 }
6451
6452 let request = req_builder
6453 .header(CONTENT_LENGTH, 0_u64)
6454 .body(common::to_body::<String>(None));
6455
6456 client.request(request.unwrap()).await
6457 };
6458
6459 match req_result {
6460 Err(err) => {
6461 if let common::Retry::After(d) = dlg.http_error(&err) {
6462 sleep(d).await;
6463 continue;
6464 }
6465 dlg.finished(false);
6466 return Err(common::Error::HttpError(err));
6467 }
6468 Ok(res) => {
6469 let (mut parts, body) = res.into_parts();
6470 let mut body = common::Body::new(body);
6471 if !parts.status.is_success() {
6472 let bytes = common::to_bytes(body).await.unwrap_or_default();
6473 let error = serde_json::from_str(&common::to_string(&bytes));
6474 let response = common::to_response(parts, bytes.into());
6475
6476 if let common::Retry::After(d) =
6477 dlg.http_failure(&response, error.as_ref().ok())
6478 {
6479 sleep(d).await;
6480 continue;
6481 }
6482
6483 dlg.finished(false);
6484
6485 return Err(match error {
6486 Ok(value) => common::Error::BadRequest(value),
6487 _ => common::Error::Failure(response),
6488 });
6489 }
6490 let response = {
6491 let bytes = common::to_bytes(body).await.unwrap_or_default();
6492 let encoded = common::to_string(&bytes);
6493 match serde_json::from_str(&encoded) {
6494 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6495 Err(error) => {
6496 dlg.response_json_decode_error(&encoded, &error);
6497 return Err(common::Error::JsonDecodeError(
6498 encoded.to_string(),
6499 error,
6500 ));
6501 }
6502 }
6503 };
6504
6505 dlg.finished(true);
6506 return Ok(response);
6507 }
6508 }
6509 }
6510 }
6511
6512 /// The name of the operation resource to be deleted.
6513 ///
6514 /// Sets the *name* path property to the given value.
6515 ///
6516 /// Even though the property as already been set when instantiating this call,
6517 /// we provide this method for API completeness.
6518 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
6519 self._name = new_value.to_string();
6520 self
6521 }
6522 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6523 /// while executing the actual API request.
6524 ///
6525 /// ````text
6526 /// It should be used to handle progress information, and to implement a certain level of resilience.
6527 /// ````
6528 ///
6529 /// Sets the *delegate* property to the given value.
6530 pub fn delegate(
6531 mut self,
6532 new_value: &'a mut dyn common::Delegate,
6533 ) -> ProjectLocationOperationDeleteCall<'a, C> {
6534 self._delegate = Some(new_value);
6535 self
6536 }
6537
6538 /// Set any additional parameter of the query string used in the request.
6539 /// It should be used to set parameters which are not yet available through their own
6540 /// setters.
6541 ///
6542 /// Please note that this method must not be used to set any of the known parameters
6543 /// which have their own setter method. If done anyway, the request will fail.
6544 ///
6545 /// # Additional Parameters
6546 ///
6547 /// * *$.xgafv* (query-string) - V1 error format.
6548 /// * *access_token* (query-string) - OAuth access token.
6549 /// * *alt* (query-string) - Data format for response.
6550 /// * *callback* (query-string) - JSONP
6551 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6552 /// * *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.
6553 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6554 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6555 /// * *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.
6556 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6557 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6558 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
6559 where
6560 T: AsRef<str>,
6561 {
6562 self._additional_params
6563 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6564 self
6565 }
6566
6567 /// Identifies the authorization scope for the method you are building.
6568 ///
6569 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6570 /// [`Scope::CloudPlatform`].
6571 ///
6572 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6573 /// tokens for more than one scope.
6574 ///
6575 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6576 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6577 /// sufficient, a read-write scope will do as well.
6578 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
6579 where
6580 St: AsRef<str>,
6581 {
6582 self._scopes.insert(String::from(scope.as_ref()));
6583 self
6584 }
6585 /// Identifies the authorization scope(s) for the method you are building.
6586 ///
6587 /// See [`Self::add_scope()`] for details.
6588 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
6589 where
6590 I: IntoIterator<Item = St>,
6591 St: AsRef<str>,
6592 {
6593 self._scopes
6594 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6595 self
6596 }
6597
6598 /// Removes all scopes, and no default scope will be used either.
6599 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6600 /// for details).
6601 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
6602 self._scopes.clear();
6603 self
6604 }
6605}
6606
6607/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
6608///
6609/// A builder for the *locations.operations.get* method supported by a *project* resource.
6610/// It is not used directly, but through a [`ProjectMethods`] instance.
6611///
6612/// # Example
6613///
6614/// Instantiate a resource method builder
6615///
6616/// ```test_harness,no_run
6617/// # extern crate hyper;
6618/// # extern crate hyper_rustls;
6619/// # extern crate google_datastream1 as datastream1;
6620/// # async fn dox() {
6621/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6622///
6623/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6624/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6625/// # .with_native_roots()
6626/// # .unwrap()
6627/// # .https_only()
6628/// # .enable_http2()
6629/// # .build();
6630///
6631/// # let executor = hyper_util::rt::TokioExecutor::new();
6632/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6633/// # secret,
6634/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6635/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6636/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6637/// # ),
6638/// # ).build().await.unwrap();
6639///
6640/// # let client = hyper_util::client::legacy::Client::builder(
6641/// # hyper_util::rt::TokioExecutor::new()
6642/// # )
6643/// # .build(
6644/// # hyper_rustls::HttpsConnectorBuilder::new()
6645/// # .with_native_roots()
6646/// # .unwrap()
6647/// # .https_or_http()
6648/// # .enable_http2()
6649/// # .build()
6650/// # );
6651/// # let mut hub = Datastream::new(client, auth);
6652/// // You can configure optional parameters by calling the respective setters at will, and
6653/// // execute the final call using `doit()`.
6654/// // Values shown here are possibly random and not representative !
6655/// let result = hub.projects().locations_operations_get("name")
6656/// .doit().await;
6657/// # }
6658/// ```
6659pub struct ProjectLocationOperationGetCall<'a, C>
6660where
6661 C: 'a,
6662{
6663 hub: &'a Datastream<C>,
6664 _name: String,
6665 _delegate: Option<&'a mut dyn common::Delegate>,
6666 _additional_params: HashMap<String, String>,
6667 _scopes: BTreeSet<String>,
6668}
6669
6670impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
6671
6672impl<'a, C> ProjectLocationOperationGetCall<'a, C>
6673where
6674 C: common::Connector,
6675{
6676 /// Perform the operation you have build so far.
6677 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6678 use std::borrow::Cow;
6679 use std::io::{Read, Seek};
6680
6681 use common::{url::Params, ToParts};
6682 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6683
6684 let mut dd = common::DefaultDelegate;
6685 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6686 dlg.begin(common::MethodInfo {
6687 id: "datastream.projects.locations.operations.get",
6688 http_method: hyper::Method::GET,
6689 });
6690
6691 for &field in ["alt", "name"].iter() {
6692 if self._additional_params.contains_key(field) {
6693 dlg.finished(false);
6694 return Err(common::Error::FieldClash(field));
6695 }
6696 }
6697
6698 let mut params = Params::with_capacity(3 + self._additional_params.len());
6699 params.push("name", self._name);
6700
6701 params.extend(self._additional_params.iter());
6702
6703 params.push("alt", "json");
6704 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6705 if self._scopes.is_empty() {
6706 self._scopes
6707 .insert(Scope::CloudPlatform.as_ref().to_string());
6708 }
6709
6710 #[allow(clippy::single_element_loop)]
6711 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6712 url = params.uri_replacement(url, param_name, find_this, true);
6713 }
6714 {
6715 let to_remove = ["name"];
6716 params.remove_params(&to_remove);
6717 }
6718
6719 let url = params.parse_with_url(&url);
6720
6721 loop {
6722 let token = match self
6723 .hub
6724 .auth
6725 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6726 .await
6727 {
6728 Ok(token) => token,
6729 Err(e) => match dlg.token(e) {
6730 Ok(token) => token,
6731 Err(e) => {
6732 dlg.finished(false);
6733 return Err(common::Error::MissingToken(e));
6734 }
6735 },
6736 };
6737 let mut req_result = {
6738 let client = &self.hub.client;
6739 dlg.pre_request();
6740 let mut req_builder = hyper::Request::builder()
6741 .method(hyper::Method::GET)
6742 .uri(url.as_str())
6743 .header(USER_AGENT, self.hub._user_agent.clone());
6744
6745 if let Some(token) = token.as_ref() {
6746 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6747 }
6748
6749 let request = req_builder
6750 .header(CONTENT_LENGTH, 0_u64)
6751 .body(common::to_body::<String>(None));
6752
6753 client.request(request.unwrap()).await
6754 };
6755
6756 match req_result {
6757 Err(err) => {
6758 if let common::Retry::After(d) = dlg.http_error(&err) {
6759 sleep(d).await;
6760 continue;
6761 }
6762 dlg.finished(false);
6763 return Err(common::Error::HttpError(err));
6764 }
6765 Ok(res) => {
6766 let (mut parts, body) = res.into_parts();
6767 let mut body = common::Body::new(body);
6768 if !parts.status.is_success() {
6769 let bytes = common::to_bytes(body).await.unwrap_or_default();
6770 let error = serde_json::from_str(&common::to_string(&bytes));
6771 let response = common::to_response(parts, bytes.into());
6772
6773 if let common::Retry::After(d) =
6774 dlg.http_failure(&response, error.as_ref().ok())
6775 {
6776 sleep(d).await;
6777 continue;
6778 }
6779
6780 dlg.finished(false);
6781
6782 return Err(match error {
6783 Ok(value) => common::Error::BadRequest(value),
6784 _ => common::Error::Failure(response),
6785 });
6786 }
6787 let response = {
6788 let bytes = common::to_bytes(body).await.unwrap_or_default();
6789 let encoded = common::to_string(&bytes);
6790 match serde_json::from_str(&encoded) {
6791 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6792 Err(error) => {
6793 dlg.response_json_decode_error(&encoded, &error);
6794 return Err(common::Error::JsonDecodeError(
6795 encoded.to_string(),
6796 error,
6797 ));
6798 }
6799 }
6800 };
6801
6802 dlg.finished(true);
6803 return Ok(response);
6804 }
6805 }
6806 }
6807 }
6808
6809 /// The name of the operation resource.
6810 ///
6811 /// Sets the *name* path property to the given value.
6812 ///
6813 /// Even though the property as already been set when instantiating this call,
6814 /// we provide this method for API completeness.
6815 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
6816 self._name = new_value.to_string();
6817 self
6818 }
6819 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6820 /// while executing the actual API request.
6821 ///
6822 /// ````text
6823 /// It should be used to handle progress information, and to implement a certain level of resilience.
6824 /// ````
6825 ///
6826 /// Sets the *delegate* property to the given value.
6827 pub fn delegate(
6828 mut self,
6829 new_value: &'a mut dyn common::Delegate,
6830 ) -> ProjectLocationOperationGetCall<'a, C> {
6831 self._delegate = Some(new_value);
6832 self
6833 }
6834
6835 /// Set any additional parameter of the query string used in the request.
6836 /// It should be used to set parameters which are not yet available through their own
6837 /// setters.
6838 ///
6839 /// Please note that this method must not be used to set any of the known parameters
6840 /// which have their own setter method. If done anyway, the request will fail.
6841 ///
6842 /// # Additional Parameters
6843 ///
6844 /// * *$.xgafv* (query-string) - V1 error format.
6845 /// * *access_token* (query-string) - OAuth access token.
6846 /// * *alt* (query-string) - Data format for response.
6847 /// * *callback* (query-string) - JSONP
6848 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6849 /// * *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.
6850 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6851 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6852 /// * *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.
6853 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6854 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6855 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
6856 where
6857 T: AsRef<str>,
6858 {
6859 self._additional_params
6860 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6861 self
6862 }
6863
6864 /// Identifies the authorization scope for the method you are building.
6865 ///
6866 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6867 /// [`Scope::CloudPlatform`].
6868 ///
6869 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6870 /// tokens for more than one scope.
6871 ///
6872 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6873 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6874 /// sufficient, a read-write scope will do as well.
6875 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
6876 where
6877 St: AsRef<str>,
6878 {
6879 self._scopes.insert(String::from(scope.as_ref()));
6880 self
6881 }
6882 /// Identifies the authorization scope(s) for the method you are building.
6883 ///
6884 /// See [`Self::add_scope()`] for details.
6885 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
6886 where
6887 I: IntoIterator<Item = St>,
6888 St: AsRef<str>,
6889 {
6890 self._scopes
6891 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6892 self
6893 }
6894
6895 /// Removes all scopes, and no default scope will be used either.
6896 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6897 /// for details).
6898 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
6899 self._scopes.clear();
6900 self
6901 }
6902}
6903
6904/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
6905///
6906/// A builder for the *locations.operations.list* method supported by a *project* resource.
6907/// It is not used directly, but through a [`ProjectMethods`] instance.
6908///
6909/// # Example
6910///
6911/// Instantiate a resource method builder
6912///
6913/// ```test_harness,no_run
6914/// # extern crate hyper;
6915/// # extern crate hyper_rustls;
6916/// # extern crate google_datastream1 as datastream1;
6917/// # async fn dox() {
6918/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6919///
6920/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6921/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6922/// # .with_native_roots()
6923/// # .unwrap()
6924/// # .https_only()
6925/// # .enable_http2()
6926/// # .build();
6927///
6928/// # let executor = hyper_util::rt::TokioExecutor::new();
6929/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6930/// # secret,
6931/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6932/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6933/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6934/// # ),
6935/// # ).build().await.unwrap();
6936///
6937/// # let client = hyper_util::client::legacy::Client::builder(
6938/// # hyper_util::rt::TokioExecutor::new()
6939/// # )
6940/// # .build(
6941/// # hyper_rustls::HttpsConnectorBuilder::new()
6942/// # .with_native_roots()
6943/// # .unwrap()
6944/// # .https_or_http()
6945/// # .enable_http2()
6946/// # .build()
6947/// # );
6948/// # let mut hub = Datastream::new(client, auth);
6949/// // You can configure optional parameters by calling the respective setters at will, and
6950/// // execute the final call using `doit()`.
6951/// // Values shown here are possibly random and not representative !
6952/// let result = hub.projects().locations_operations_list("name")
6953/// .return_partial_success(false)
6954/// .page_token("duo")
6955/// .page_size(-34)
6956/// .filter("et")
6957/// .doit().await;
6958/// # }
6959/// ```
6960pub struct ProjectLocationOperationListCall<'a, C>
6961where
6962 C: 'a,
6963{
6964 hub: &'a Datastream<C>,
6965 _name: String,
6966 _return_partial_success: Option<bool>,
6967 _page_token: Option<String>,
6968 _page_size: Option<i32>,
6969 _filter: Option<String>,
6970 _delegate: Option<&'a mut dyn common::Delegate>,
6971 _additional_params: HashMap<String, String>,
6972 _scopes: BTreeSet<String>,
6973}
6974
6975impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
6976
6977impl<'a, C> ProjectLocationOperationListCall<'a, C>
6978where
6979 C: common::Connector,
6980{
6981 /// Perform the operation you have build so far.
6982 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
6983 use std::borrow::Cow;
6984 use std::io::{Read, Seek};
6985
6986 use common::{url::Params, ToParts};
6987 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6988
6989 let mut dd = common::DefaultDelegate;
6990 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6991 dlg.begin(common::MethodInfo {
6992 id: "datastream.projects.locations.operations.list",
6993 http_method: hyper::Method::GET,
6994 });
6995
6996 for &field in [
6997 "alt",
6998 "name",
6999 "returnPartialSuccess",
7000 "pageToken",
7001 "pageSize",
7002 "filter",
7003 ]
7004 .iter()
7005 {
7006 if self._additional_params.contains_key(field) {
7007 dlg.finished(false);
7008 return Err(common::Error::FieldClash(field));
7009 }
7010 }
7011
7012 let mut params = Params::with_capacity(7 + self._additional_params.len());
7013 params.push("name", self._name);
7014 if let Some(value) = self._return_partial_success.as_ref() {
7015 params.push("returnPartialSuccess", value.to_string());
7016 }
7017 if let Some(value) = self._page_token.as_ref() {
7018 params.push("pageToken", value);
7019 }
7020 if let Some(value) = self._page_size.as_ref() {
7021 params.push("pageSize", value.to_string());
7022 }
7023 if let Some(value) = self._filter.as_ref() {
7024 params.push("filter", value);
7025 }
7026
7027 params.extend(self._additional_params.iter());
7028
7029 params.push("alt", "json");
7030 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
7031 if self._scopes.is_empty() {
7032 self._scopes
7033 .insert(Scope::CloudPlatform.as_ref().to_string());
7034 }
7035
7036 #[allow(clippy::single_element_loop)]
7037 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7038 url = params.uri_replacement(url, param_name, find_this, true);
7039 }
7040 {
7041 let to_remove = ["name"];
7042 params.remove_params(&to_remove);
7043 }
7044
7045 let url = params.parse_with_url(&url);
7046
7047 loop {
7048 let token = match self
7049 .hub
7050 .auth
7051 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7052 .await
7053 {
7054 Ok(token) => token,
7055 Err(e) => match dlg.token(e) {
7056 Ok(token) => token,
7057 Err(e) => {
7058 dlg.finished(false);
7059 return Err(common::Error::MissingToken(e));
7060 }
7061 },
7062 };
7063 let mut req_result = {
7064 let client = &self.hub.client;
7065 dlg.pre_request();
7066 let mut req_builder = hyper::Request::builder()
7067 .method(hyper::Method::GET)
7068 .uri(url.as_str())
7069 .header(USER_AGENT, self.hub._user_agent.clone());
7070
7071 if let Some(token) = token.as_ref() {
7072 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7073 }
7074
7075 let request = req_builder
7076 .header(CONTENT_LENGTH, 0_u64)
7077 .body(common::to_body::<String>(None));
7078
7079 client.request(request.unwrap()).await
7080 };
7081
7082 match req_result {
7083 Err(err) => {
7084 if let common::Retry::After(d) = dlg.http_error(&err) {
7085 sleep(d).await;
7086 continue;
7087 }
7088 dlg.finished(false);
7089 return Err(common::Error::HttpError(err));
7090 }
7091 Ok(res) => {
7092 let (mut parts, body) = res.into_parts();
7093 let mut body = common::Body::new(body);
7094 if !parts.status.is_success() {
7095 let bytes = common::to_bytes(body).await.unwrap_or_default();
7096 let error = serde_json::from_str(&common::to_string(&bytes));
7097 let response = common::to_response(parts, bytes.into());
7098
7099 if let common::Retry::After(d) =
7100 dlg.http_failure(&response, error.as_ref().ok())
7101 {
7102 sleep(d).await;
7103 continue;
7104 }
7105
7106 dlg.finished(false);
7107
7108 return Err(match error {
7109 Ok(value) => common::Error::BadRequest(value),
7110 _ => common::Error::Failure(response),
7111 });
7112 }
7113 let response = {
7114 let bytes = common::to_bytes(body).await.unwrap_or_default();
7115 let encoded = common::to_string(&bytes);
7116 match serde_json::from_str(&encoded) {
7117 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7118 Err(error) => {
7119 dlg.response_json_decode_error(&encoded, &error);
7120 return Err(common::Error::JsonDecodeError(
7121 encoded.to_string(),
7122 error,
7123 ));
7124 }
7125 }
7126 };
7127
7128 dlg.finished(true);
7129 return Ok(response);
7130 }
7131 }
7132 }
7133 }
7134
7135 /// The name of the operation's parent resource.
7136 ///
7137 /// Sets the *name* path property to the given value.
7138 ///
7139 /// Even though the property as already been set when instantiating this call,
7140 /// we provide this method for API completeness.
7141 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
7142 self._name = new_value.to_string();
7143 self
7144 }
7145 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
7146 ///
7147 /// Sets the *return partial success* query property to the given value.
7148 pub fn return_partial_success(
7149 mut self,
7150 new_value: bool,
7151 ) -> ProjectLocationOperationListCall<'a, C> {
7152 self._return_partial_success = Some(new_value);
7153 self
7154 }
7155 /// The standard list page token.
7156 ///
7157 /// Sets the *page token* query property to the given value.
7158 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
7159 self._page_token = Some(new_value.to_string());
7160 self
7161 }
7162 /// The standard list page size.
7163 ///
7164 /// Sets the *page size* query property to the given value.
7165 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
7166 self._page_size = Some(new_value);
7167 self
7168 }
7169 /// The standard list filter.
7170 ///
7171 /// Sets the *filter* query property to the given value.
7172 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
7173 self._filter = Some(new_value.to_string());
7174 self
7175 }
7176 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7177 /// while executing the actual API request.
7178 ///
7179 /// ````text
7180 /// It should be used to handle progress information, and to implement a certain level of resilience.
7181 /// ````
7182 ///
7183 /// Sets the *delegate* property to the given value.
7184 pub fn delegate(
7185 mut self,
7186 new_value: &'a mut dyn common::Delegate,
7187 ) -> ProjectLocationOperationListCall<'a, C> {
7188 self._delegate = Some(new_value);
7189 self
7190 }
7191
7192 /// Set any additional parameter of the query string used in the request.
7193 /// It should be used to set parameters which are not yet available through their own
7194 /// setters.
7195 ///
7196 /// Please note that this method must not be used to set any of the known parameters
7197 /// which have their own setter method. If done anyway, the request will fail.
7198 ///
7199 /// # Additional Parameters
7200 ///
7201 /// * *$.xgafv* (query-string) - V1 error format.
7202 /// * *access_token* (query-string) - OAuth access token.
7203 /// * *alt* (query-string) - Data format for response.
7204 /// * *callback* (query-string) - JSONP
7205 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7206 /// * *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.
7207 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7208 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7209 /// * *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.
7210 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7211 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7212 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
7213 where
7214 T: AsRef<str>,
7215 {
7216 self._additional_params
7217 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7218 self
7219 }
7220
7221 /// Identifies the authorization scope for the method you are building.
7222 ///
7223 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7224 /// [`Scope::CloudPlatform`].
7225 ///
7226 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7227 /// tokens for more than one scope.
7228 ///
7229 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7230 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7231 /// sufficient, a read-write scope will do as well.
7232 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
7233 where
7234 St: AsRef<str>,
7235 {
7236 self._scopes.insert(String::from(scope.as_ref()));
7237 self
7238 }
7239 /// Identifies the authorization scope(s) for the method you are building.
7240 ///
7241 /// See [`Self::add_scope()`] for details.
7242 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
7243 where
7244 I: IntoIterator<Item = St>,
7245 St: AsRef<str>,
7246 {
7247 self._scopes
7248 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7249 self
7250 }
7251
7252 /// Removes all scopes, and no default scope will be used either.
7253 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7254 /// for details).
7255 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
7256 self._scopes.clear();
7257 self
7258 }
7259}
7260
7261/// Use this method to create a route for a private connectivity configuration in a project and location.
7262///
7263/// A builder for the *locations.privateConnections.routes.create* method supported by a *project* resource.
7264/// It is not used directly, but through a [`ProjectMethods`] instance.
7265///
7266/// # Example
7267///
7268/// Instantiate a resource method builder
7269///
7270/// ```test_harness,no_run
7271/// # extern crate hyper;
7272/// # extern crate hyper_rustls;
7273/// # extern crate google_datastream1 as datastream1;
7274/// use datastream1::api::Route;
7275/// # async fn dox() {
7276/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7277///
7278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7279/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7280/// # .with_native_roots()
7281/// # .unwrap()
7282/// # .https_only()
7283/// # .enable_http2()
7284/// # .build();
7285///
7286/// # let executor = hyper_util::rt::TokioExecutor::new();
7287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7288/// # secret,
7289/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7290/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7291/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7292/// # ),
7293/// # ).build().await.unwrap();
7294///
7295/// # let client = hyper_util::client::legacy::Client::builder(
7296/// # hyper_util::rt::TokioExecutor::new()
7297/// # )
7298/// # .build(
7299/// # hyper_rustls::HttpsConnectorBuilder::new()
7300/// # .with_native_roots()
7301/// # .unwrap()
7302/// # .https_or_http()
7303/// # .enable_http2()
7304/// # .build()
7305/// # );
7306/// # let mut hub = Datastream::new(client, auth);
7307/// // As the method needs a request, you would usually fill it with the desired information
7308/// // into the respective structure. Some of the parts shown here might not be applicable !
7309/// // Values shown here are possibly random and not representative !
7310/// let mut req = Route::default();
7311///
7312/// // You can configure optional parameters by calling the respective setters at will, and
7313/// // execute the final call using `doit()`.
7314/// // Values shown here are possibly random and not representative !
7315/// let result = hub.projects().locations_private_connections_routes_create(req, "parent")
7316/// .route_id("amet.")
7317/// .request_id("consetetur")
7318/// .doit().await;
7319/// # }
7320/// ```
7321pub struct ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
7322where
7323 C: 'a,
7324{
7325 hub: &'a Datastream<C>,
7326 _request: Route,
7327 _parent: String,
7328 _route_id: Option<String>,
7329 _request_id: Option<String>,
7330 _delegate: Option<&'a mut dyn common::Delegate>,
7331 _additional_params: HashMap<String, String>,
7332 _scopes: BTreeSet<String>,
7333}
7334
7335impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {}
7336
7337impl<'a, C> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
7338where
7339 C: common::Connector,
7340{
7341 /// Perform the operation you have build so far.
7342 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7343 use std::borrow::Cow;
7344 use std::io::{Read, Seek};
7345
7346 use common::{url::Params, ToParts};
7347 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7348
7349 let mut dd = common::DefaultDelegate;
7350 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7351 dlg.begin(common::MethodInfo {
7352 id: "datastream.projects.locations.privateConnections.routes.create",
7353 http_method: hyper::Method::POST,
7354 });
7355
7356 for &field in ["alt", "parent", "routeId", "requestId"].iter() {
7357 if self._additional_params.contains_key(field) {
7358 dlg.finished(false);
7359 return Err(common::Error::FieldClash(field));
7360 }
7361 }
7362
7363 let mut params = Params::with_capacity(6 + self._additional_params.len());
7364 params.push("parent", self._parent);
7365 if let Some(value) = self._route_id.as_ref() {
7366 params.push("routeId", value);
7367 }
7368 if let Some(value) = self._request_id.as_ref() {
7369 params.push("requestId", value);
7370 }
7371
7372 params.extend(self._additional_params.iter());
7373
7374 params.push("alt", "json");
7375 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
7376 if self._scopes.is_empty() {
7377 self._scopes
7378 .insert(Scope::CloudPlatform.as_ref().to_string());
7379 }
7380
7381 #[allow(clippy::single_element_loop)]
7382 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7383 url = params.uri_replacement(url, param_name, find_this, true);
7384 }
7385 {
7386 let to_remove = ["parent"];
7387 params.remove_params(&to_remove);
7388 }
7389
7390 let url = params.parse_with_url(&url);
7391
7392 let mut json_mime_type = mime::APPLICATION_JSON;
7393 let mut request_value_reader = {
7394 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7395 common::remove_json_null_values(&mut value);
7396 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7397 serde_json::to_writer(&mut dst, &value).unwrap();
7398 dst
7399 };
7400 let request_size = request_value_reader
7401 .seek(std::io::SeekFrom::End(0))
7402 .unwrap();
7403 request_value_reader
7404 .seek(std::io::SeekFrom::Start(0))
7405 .unwrap();
7406
7407 loop {
7408 let token = match self
7409 .hub
7410 .auth
7411 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7412 .await
7413 {
7414 Ok(token) => token,
7415 Err(e) => match dlg.token(e) {
7416 Ok(token) => token,
7417 Err(e) => {
7418 dlg.finished(false);
7419 return Err(common::Error::MissingToken(e));
7420 }
7421 },
7422 };
7423 request_value_reader
7424 .seek(std::io::SeekFrom::Start(0))
7425 .unwrap();
7426 let mut req_result = {
7427 let client = &self.hub.client;
7428 dlg.pre_request();
7429 let mut req_builder = hyper::Request::builder()
7430 .method(hyper::Method::POST)
7431 .uri(url.as_str())
7432 .header(USER_AGENT, self.hub._user_agent.clone());
7433
7434 if let Some(token) = token.as_ref() {
7435 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7436 }
7437
7438 let request = req_builder
7439 .header(CONTENT_TYPE, json_mime_type.to_string())
7440 .header(CONTENT_LENGTH, request_size as u64)
7441 .body(common::to_body(
7442 request_value_reader.get_ref().clone().into(),
7443 ));
7444
7445 client.request(request.unwrap()).await
7446 };
7447
7448 match req_result {
7449 Err(err) => {
7450 if let common::Retry::After(d) = dlg.http_error(&err) {
7451 sleep(d).await;
7452 continue;
7453 }
7454 dlg.finished(false);
7455 return Err(common::Error::HttpError(err));
7456 }
7457 Ok(res) => {
7458 let (mut parts, body) = res.into_parts();
7459 let mut body = common::Body::new(body);
7460 if !parts.status.is_success() {
7461 let bytes = common::to_bytes(body).await.unwrap_or_default();
7462 let error = serde_json::from_str(&common::to_string(&bytes));
7463 let response = common::to_response(parts, bytes.into());
7464
7465 if let common::Retry::After(d) =
7466 dlg.http_failure(&response, error.as_ref().ok())
7467 {
7468 sleep(d).await;
7469 continue;
7470 }
7471
7472 dlg.finished(false);
7473
7474 return Err(match error {
7475 Ok(value) => common::Error::BadRequest(value),
7476 _ => common::Error::Failure(response),
7477 });
7478 }
7479 let response = {
7480 let bytes = common::to_bytes(body).await.unwrap_or_default();
7481 let encoded = common::to_string(&bytes);
7482 match serde_json::from_str(&encoded) {
7483 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7484 Err(error) => {
7485 dlg.response_json_decode_error(&encoded, &error);
7486 return Err(common::Error::JsonDecodeError(
7487 encoded.to_string(),
7488 error,
7489 ));
7490 }
7491 }
7492 };
7493
7494 dlg.finished(true);
7495 return Ok(response);
7496 }
7497 }
7498 }
7499 }
7500
7501 ///
7502 /// Sets the *request* property to the given value.
7503 ///
7504 /// Even though the property as already been set when instantiating this call,
7505 /// we provide this method for API completeness.
7506 pub fn request(
7507 mut self,
7508 new_value: Route,
7509 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7510 self._request = new_value;
7511 self
7512 }
7513 /// Required. The parent that owns the collection of Routes.
7514 ///
7515 /// Sets the *parent* path property to the given value.
7516 ///
7517 /// Even though the property as already been set when instantiating this call,
7518 /// we provide this method for API completeness.
7519 pub fn parent(
7520 mut self,
7521 new_value: &str,
7522 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7523 self._parent = new_value.to_string();
7524 self
7525 }
7526 /// Required. The Route identifier.
7527 ///
7528 /// Sets the *route id* query property to the given value.
7529 pub fn route_id(
7530 mut self,
7531 new_value: &str,
7532 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7533 self._route_id = Some(new_value.to_string());
7534 self
7535 }
7536 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
7537 ///
7538 /// Sets the *request id* query property to the given value.
7539 pub fn request_id(
7540 mut self,
7541 new_value: &str,
7542 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7543 self._request_id = Some(new_value.to_string());
7544 self
7545 }
7546 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7547 /// while executing the actual API request.
7548 ///
7549 /// ````text
7550 /// It should be used to handle progress information, and to implement a certain level of resilience.
7551 /// ````
7552 ///
7553 /// Sets the *delegate* property to the given value.
7554 pub fn delegate(
7555 mut self,
7556 new_value: &'a mut dyn common::Delegate,
7557 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7558 self._delegate = Some(new_value);
7559 self
7560 }
7561
7562 /// Set any additional parameter of the query string used in the request.
7563 /// It should be used to set parameters which are not yet available through their own
7564 /// setters.
7565 ///
7566 /// Please note that this method must not be used to set any of the known parameters
7567 /// which have their own setter method. If done anyway, the request will fail.
7568 ///
7569 /// # Additional Parameters
7570 ///
7571 /// * *$.xgafv* (query-string) - V1 error format.
7572 /// * *access_token* (query-string) - OAuth access token.
7573 /// * *alt* (query-string) - Data format for response.
7574 /// * *callback* (query-string) - JSONP
7575 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7576 /// * *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.
7577 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7578 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7579 /// * *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.
7580 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7581 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7582 pub fn param<T>(
7583 mut self,
7584 name: T,
7585 value: T,
7586 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
7587 where
7588 T: AsRef<str>,
7589 {
7590 self._additional_params
7591 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7592 self
7593 }
7594
7595 /// Identifies the authorization scope for the method you are building.
7596 ///
7597 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7598 /// [`Scope::CloudPlatform`].
7599 ///
7600 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7601 /// tokens for more than one scope.
7602 ///
7603 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7604 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7605 /// sufficient, a read-write scope will do as well.
7606 pub fn add_scope<St>(
7607 mut self,
7608 scope: St,
7609 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
7610 where
7611 St: AsRef<str>,
7612 {
7613 self._scopes.insert(String::from(scope.as_ref()));
7614 self
7615 }
7616 /// Identifies the authorization scope(s) for the method you are building.
7617 ///
7618 /// See [`Self::add_scope()`] for details.
7619 pub fn add_scopes<I, St>(
7620 mut self,
7621 scopes: I,
7622 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
7623 where
7624 I: IntoIterator<Item = St>,
7625 St: AsRef<str>,
7626 {
7627 self._scopes
7628 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7629 self
7630 }
7631
7632 /// Removes all scopes, and no default scope will be used either.
7633 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7634 /// for details).
7635 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
7636 self._scopes.clear();
7637 self
7638 }
7639}
7640
7641/// Use this method to delete a route.
7642///
7643/// A builder for the *locations.privateConnections.routes.delete* method supported by a *project* resource.
7644/// It is not used directly, but through a [`ProjectMethods`] instance.
7645///
7646/// # Example
7647///
7648/// Instantiate a resource method builder
7649///
7650/// ```test_harness,no_run
7651/// # extern crate hyper;
7652/// # extern crate hyper_rustls;
7653/// # extern crate google_datastream1 as datastream1;
7654/// # async fn dox() {
7655/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7656///
7657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7658/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7659/// # .with_native_roots()
7660/// # .unwrap()
7661/// # .https_only()
7662/// # .enable_http2()
7663/// # .build();
7664///
7665/// # let executor = hyper_util::rt::TokioExecutor::new();
7666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7667/// # secret,
7668/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7669/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7670/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7671/// # ),
7672/// # ).build().await.unwrap();
7673///
7674/// # let client = hyper_util::client::legacy::Client::builder(
7675/// # hyper_util::rt::TokioExecutor::new()
7676/// # )
7677/// # .build(
7678/// # hyper_rustls::HttpsConnectorBuilder::new()
7679/// # .with_native_roots()
7680/// # .unwrap()
7681/// # .https_or_http()
7682/// # .enable_http2()
7683/// # .build()
7684/// # );
7685/// # let mut hub = Datastream::new(client, auth);
7686/// // You can configure optional parameters by calling the respective setters at will, and
7687/// // execute the final call using `doit()`.
7688/// // Values shown here are possibly random and not representative !
7689/// let result = hub.projects().locations_private_connections_routes_delete("name")
7690/// .request_id("dolor")
7691/// .doit().await;
7692/// # }
7693/// ```
7694pub struct ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
7695where
7696 C: 'a,
7697{
7698 hub: &'a Datastream<C>,
7699 _name: String,
7700 _request_id: Option<String>,
7701 _delegate: Option<&'a mut dyn common::Delegate>,
7702 _additional_params: HashMap<String, String>,
7703 _scopes: BTreeSet<String>,
7704}
7705
7706impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {}
7707
7708impl<'a, C> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
7709where
7710 C: common::Connector,
7711{
7712 /// Perform the operation you have build so far.
7713 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7714 use std::borrow::Cow;
7715 use std::io::{Read, Seek};
7716
7717 use common::{url::Params, ToParts};
7718 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7719
7720 let mut dd = common::DefaultDelegate;
7721 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7722 dlg.begin(common::MethodInfo {
7723 id: "datastream.projects.locations.privateConnections.routes.delete",
7724 http_method: hyper::Method::DELETE,
7725 });
7726
7727 for &field in ["alt", "name", "requestId"].iter() {
7728 if self._additional_params.contains_key(field) {
7729 dlg.finished(false);
7730 return Err(common::Error::FieldClash(field));
7731 }
7732 }
7733
7734 let mut params = Params::with_capacity(4 + self._additional_params.len());
7735 params.push("name", self._name);
7736 if let Some(value) = self._request_id.as_ref() {
7737 params.push("requestId", value);
7738 }
7739
7740 params.extend(self._additional_params.iter());
7741
7742 params.push("alt", "json");
7743 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7744 if self._scopes.is_empty() {
7745 self._scopes
7746 .insert(Scope::CloudPlatform.as_ref().to_string());
7747 }
7748
7749 #[allow(clippy::single_element_loop)]
7750 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7751 url = params.uri_replacement(url, param_name, find_this, true);
7752 }
7753 {
7754 let to_remove = ["name"];
7755 params.remove_params(&to_remove);
7756 }
7757
7758 let url = params.parse_with_url(&url);
7759
7760 loop {
7761 let token = match self
7762 .hub
7763 .auth
7764 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7765 .await
7766 {
7767 Ok(token) => token,
7768 Err(e) => match dlg.token(e) {
7769 Ok(token) => token,
7770 Err(e) => {
7771 dlg.finished(false);
7772 return Err(common::Error::MissingToken(e));
7773 }
7774 },
7775 };
7776 let mut req_result = {
7777 let client = &self.hub.client;
7778 dlg.pre_request();
7779 let mut req_builder = hyper::Request::builder()
7780 .method(hyper::Method::DELETE)
7781 .uri(url.as_str())
7782 .header(USER_AGENT, self.hub._user_agent.clone());
7783
7784 if let Some(token) = token.as_ref() {
7785 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7786 }
7787
7788 let request = req_builder
7789 .header(CONTENT_LENGTH, 0_u64)
7790 .body(common::to_body::<String>(None));
7791
7792 client.request(request.unwrap()).await
7793 };
7794
7795 match req_result {
7796 Err(err) => {
7797 if let common::Retry::After(d) = dlg.http_error(&err) {
7798 sleep(d).await;
7799 continue;
7800 }
7801 dlg.finished(false);
7802 return Err(common::Error::HttpError(err));
7803 }
7804 Ok(res) => {
7805 let (mut parts, body) = res.into_parts();
7806 let mut body = common::Body::new(body);
7807 if !parts.status.is_success() {
7808 let bytes = common::to_bytes(body).await.unwrap_or_default();
7809 let error = serde_json::from_str(&common::to_string(&bytes));
7810 let response = common::to_response(parts, bytes.into());
7811
7812 if let common::Retry::After(d) =
7813 dlg.http_failure(&response, error.as_ref().ok())
7814 {
7815 sleep(d).await;
7816 continue;
7817 }
7818
7819 dlg.finished(false);
7820
7821 return Err(match error {
7822 Ok(value) => common::Error::BadRequest(value),
7823 _ => common::Error::Failure(response),
7824 });
7825 }
7826 let response = {
7827 let bytes = common::to_bytes(body).await.unwrap_or_default();
7828 let encoded = common::to_string(&bytes);
7829 match serde_json::from_str(&encoded) {
7830 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7831 Err(error) => {
7832 dlg.response_json_decode_error(&encoded, &error);
7833 return Err(common::Error::JsonDecodeError(
7834 encoded.to_string(),
7835 error,
7836 ));
7837 }
7838 }
7839 };
7840
7841 dlg.finished(true);
7842 return Ok(response);
7843 }
7844 }
7845 }
7846 }
7847
7848 /// Required. The name of the Route resource to delete.
7849 ///
7850 /// Sets the *name* path property to the given value.
7851 ///
7852 /// Even though the property as already been set when instantiating this call,
7853 /// we provide this method for API completeness.
7854 pub fn name(
7855 mut self,
7856 new_value: &str,
7857 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
7858 self._name = new_value.to_string();
7859 self
7860 }
7861 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
7862 ///
7863 /// Sets the *request id* query property to the given value.
7864 pub fn request_id(
7865 mut self,
7866 new_value: &str,
7867 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
7868 self._request_id = Some(new_value.to_string());
7869 self
7870 }
7871 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7872 /// while executing the actual API request.
7873 ///
7874 /// ````text
7875 /// It should be used to handle progress information, and to implement a certain level of resilience.
7876 /// ````
7877 ///
7878 /// Sets the *delegate* property to the given value.
7879 pub fn delegate(
7880 mut self,
7881 new_value: &'a mut dyn common::Delegate,
7882 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
7883 self._delegate = Some(new_value);
7884 self
7885 }
7886
7887 /// Set any additional parameter of the query string used in the request.
7888 /// It should be used to set parameters which are not yet available through their own
7889 /// setters.
7890 ///
7891 /// Please note that this method must not be used to set any of the known parameters
7892 /// which have their own setter method. If done anyway, the request will fail.
7893 ///
7894 /// # Additional Parameters
7895 ///
7896 /// * *$.xgafv* (query-string) - V1 error format.
7897 /// * *access_token* (query-string) - OAuth access token.
7898 /// * *alt* (query-string) - Data format for response.
7899 /// * *callback* (query-string) - JSONP
7900 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7901 /// * *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.
7902 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7903 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7904 /// * *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.
7905 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7906 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7907 pub fn param<T>(
7908 mut self,
7909 name: T,
7910 value: T,
7911 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
7912 where
7913 T: AsRef<str>,
7914 {
7915 self._additional_params
7916 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7917 self
7918 }
7919
7920 /// Identifies the authorization scope for the method you are building.
7921 ///
7922 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7923 /// [`Scope::CloudPlatform`].
7924 ///
7925 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7926 /// tokens for more than one scope.
7927 ///
7928 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7929 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7930 /// sufficient, a read-write scope will do as well.
7931 pub fn add_scope<St>(
7932 mut self,
7933 scope: St,
7934 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
7935 where
7936 St: AsRef<str>,
7937 {
7938 self._scopes.insert(String::from(scope.as_ref()));
7939 self
7940 }
7941 /// Identifies the authorization scope(s) for the method you are building.
7942 ///
7943 /// See [`Self::add_scope()`] for details.
7944 pub fn add_scopes<I, St>(
7945 mut self,
7946 scopes: I,
7947 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
7948 where
7949 I: IntoIterator<Item = St>,
7950 St: AsRef<str>,
7951 {
7952 self._scopes
7953 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7954 self
7955 }
7956
7957 /// Removes all scopes, and no default scope will be used either.
7958 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7959 /// for details).
7960 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
7961 self._scopes.clear();
7962 self
7963 }
7964}
7965
7966/// Use this method to get details about a route.
7967///
7968/// A builder for the *locations.privateConnections.routes.get* method supported by a *project* resource.
7969/// It is not used directly, but through a [`ProjectMethods`] instance.
7970///
7971/// # Example
7972///
7973/// Instantiate a resource method builder
7974///
7975/// ```test_harness,no_run
7976/// # extern crate hyper;
7977/// # extern crate hyper_rustls;
7978/// # extern crate google_datastream1 as datastream1;
7979/// # async fn dox() {
7980/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7981///
7982/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7983/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7984/// # .with_native_roots()
7985/// # .unwrap()
7986/// # .https_only()
7987/// # .enable_http2()
7988/// # .build();
7989///
7990/// # let executor = hyper_util::rt::TokioExecutor::new();
7991/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7992/// # secret,
7993/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7994/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7995/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7996/// # ),
7997/// # ).build().await.unwrap();
7998///
7999/// # let client = hyper_util::client::legacy::Client::builder(
8000/// # hyper_util::rt::TokioExecutor::new()
8001/// # )
8002/// # .build(
8003/// # hyper_rustls::HttpsConnectorBuilder::new()
8004/// # .with_native_roots()
8005/// # .unwrap()
8006/// # .https_or_http()
8007/// # .enable_http2()
8008/// # .build()
8009/// # );
8010/// # let mut hub = Datastream::new(client, auth);
8011/// // You can configure optional parameters by calling the respective setters at will, and
8012/// // execute the final call using `doit()`.
8013/// // Values shown here are possibly random and not representative !
8014/// let result = hub.projects().locations_private_connections_routes_get("name")
8015/// .doit().await;
8016/// # }
8017/// ```
8018pub struct ProjectLocationPrivateConnectionRouteGetCall<'a, C>
8019where
8020 C: 'a,
8021{
8022 hub: &'a Datastream<C>,
8023 _name: String,
8024 _delegate: Option<&'a mut dyn common::Delegate>,
8025 _additional_params: HashMap<String, String>,
8026 _scopes: BTreeSet<String>,
8027}
8028
8029impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteGetCall<'a, C> {}
8030
8031impl<'a, C> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
8032where
8033 C: common::Connector,
8034{
8035 /// Perform the operation you have build so far.
8036 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
8037 use std::borrow::Cow;
8038 use std::io::{Read, Seek};
8039
8040 use common::{url::Params, ToParts};
8041 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8042
8043 let mut dd = common::DefaultDelegate;
8044 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8045 dlg.begin(common::MethodInfo {
8046 id: "datastream.projects.locations.privateConnections.routes.get",
8047 http_method: hyper::Method::GET,
8048 });
8049
8050 for &field in ["alt", "name"].iter() {
8051 if self._additional_params.contains_key(field) {
8052 dlg.finished(false);
8053 return Err(common::Error::FieldClash(field));
8054 }
8055 }
8056
8057 let mut params = Params::with_capacity(3 + self._additional_params.len());
8058 params.push("name", self._name);
8059
8060 params.extend(self._additional_params.iter());
8061
8062 params.push("alt", "json");
8063 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8064 if self._scopes.is_empty() {
8065 self._scopes
8066 .insert(Scope::CloudPlatform.as_ref().to_string());
8067 }
8068
8069 #[allow(clippy::single_element_loop)]
8070 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8071 url = params.uri_replacement(url, param_name, find_this, true);
8072 }
8073 {
8074 let to_remove = ["name"];
8075 params.remove_params(&to_remove);
8076 }
8077
8078 let url = params.parse_with_url(&url);
8079
8080 loop {
8081 let token = match self
8082 .hub
8083 .auth
8084 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8085 .await
8086 {
8087 Ok(token) => token,
8088 Err(e) => match dlg.token(e) {
8089 Ok(token) => token,
8090 Err(e) => {
8091 dlg.finished(false);
8092 return Err(common::Error::MissingToken(e));
8093 }
8094 },
8095 };
8096 let mut req_result = {
8097 let client = &self.hub.client;
8098 dlg.pre_request();
8099 let mut req_builder = hyper::Request::builder()
8100 .method(hyper::Method::GET)
8101 .uri(url.as_str())
8102 .header(USER_AGENT, self.hub._user_agent.clone());
8103
8104 if let Some(token) = token.as_ref() {
8105 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8106 }
8107
8108 let request = req_builder
8109 .header(CONTENT_LENGTH, 0_u64)
8110 .body(common::to_body::<String>(None));
8111
8112 client.request(request.unwrap()).await
8113 };
8114
8115 match req_result {
8116 Err(err) => {
8117 if let common::Retry::After(d) = dlg.http_error(&err) {
8118 sleep(d).await;
8119 continue;
8120 }
8121 dlg.finished(false);
8122 return Err(common::Error::HttpError(err));
8123 }
8124 Ok(res) => {
8125 let (mut parts, body) = res.into_parts();
8126 let mut body = common::Body::new(body);
8127 if !parts.status.is_success() {
8128 let bytes = common::to_bytes(body).await.unwrap_or_default();
8129 let error = serde_json::from_str(&common::to_string(&bytes));
8130 let response = common::to_response(parts, bytes.into());
8131
8132 if let common::Retry::After(d) =
8133 dlg.http_failure(&response, error.as_ref().ok())
8134 {
8135 sleep(d).await;
8136 continue;
8137 }
8138
8139 dlg.finished(false);
8140
8141 return Err(match error {
8142 Ok(value) => common::Error::BadRequest(value),
8143 _ => common::Error::Failure(response),
8144 });
8145 }
8146 let response = {
8147 let bytes = common::to_bytes(body).await.unwrap_or_default();
8148 let encoded = common::to_string(&bytes);
8149 match serde_json::from_str(&encoded) {
8150 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8151 Err(error) => {
8152 dlg.response_json_decode_error(&encoded, &error);
8153 return Err(common::Error::JsonDecodeError(
8154 encoded.to_string(),
8155 error,
8156 ));
8157 }
8158 }
8159 };
8160
8161 dlg.finished(true);
8162 return Ok(response);
8163 }
8164 }
8165 }
8166 }
8167
8168 /// Required. The name of the Route resource to get.
8169 ///
8170 /// Sets the *name* path property to the given value.
8171 ///
8172 /// Even though the property as already been set when instantiating this call,
8173 /// we provide this method for API completeness.
8174 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
8175 self._name = new_value.to_string();
8176 self
8177 }
8178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8179 /// while executing the actual API request.
8180 ///
8181 /// ````text
8182 /// It should be used to handle progress information, and to implement a certain level of resilience.
8183 /// ````
8184 ///
8185 /// Sets the *delegate* property to the given value.
8186 pub fn delegate(
8187 mut self,
8188 new_value: &'a mut dyn common::Delegate,
8189 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
8190 self._delegate = Some(new_value);
8191 self
8192 }
8193
8194 /// Set any additional parameter of the query string used in the request.
8195 /// It should be used to set parameters which are not yet available through their own
8196 /// setters.
8197 ///
8198 /// Please note that this method must not be used to set any of the known parameters
8199 /// which have their own setter method. If done anyway, the request will fail.
8200 ///
8201 /// # Additional Parameters
8202 ///
8203 /// * *$.xgafv* (query-string) - V1 error format.
8204 /// * *access_token* (query-string) - OAuth access token.
8205 /// * *alt* (query-string) - Data format for response.
8206 /// * *callback* (query-string) - JSONP
8207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8208 /// * *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.
8209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8211 /// * *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.
8212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8214 pub fn param<T>(
8215 mut self,
8216 name: T,
8217 value: T,
8218 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
8219 where
8220 T: AsRef<str>,
8221 {
8222 self._additional_params
8223 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8224 self
8225 }
8226
8227 /// Identifies the authorization scope for the method you are building.
8228 ///
8229 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8230 /// [`Scope::CloudPlatform`].
8231 ///
8232 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8233 /// tokens for more than one scope.
8234 ///
8235 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8236 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8237 /// sufficient, a read-write scope will do as well.
8238 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
8239 where
8240 St: AsRef<str>,
8241 {
8242 self._scopes.insert(String::from(scope.as_ref()));
8243 self
8244 }
8245 /// Identifies the authorization scope(s) for the method you are building.
8246 ///
8247 /// See [`Self::add_scope()`] for details.
8248 pub fn add_scopes<I, St>(
8249 mut self,
8250 scopes: I,
8251 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
8252 where
8253 I: IntoIterator<Item = St>,
8254 St: AsRef<str>,
8255 {
8256 self._scopes
8257 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8258 self
8259 }
8260
8261 /// Removes all scopes, and no default scope will be used either.
8262 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8263 /// for details).
8264 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
8265 self._scopes.clear();
8266 self
8267 }
8268}
8269
8270/// Use this method to list routes created for a private connectivity configuration in a project and location.
8271///
8272/// A builder for the *locations.privateConnections.routes.list* method supported by a *project* resource.
8273/// It is not used directly, but through a [`ProjectMethods`] instance.
8274///
8275/// # Example
8276///
8277/// Instantiate a resource method builder
8278///
8279/// ```test_harness,no_run
8280/// # extern crate hyper;
8281/// # extern crate hyper_rustls;
8282/// # extern crate google_datastream1 as datastream1;
8283/// # async fn dox() {
8284/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8285///
8286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8288/// # .with_native_roots()
8289/// # .unwrap()
8290/// # .https_only()
8291/// # .enable_http2()
8292/// # .build();
8293///
8294/// # let executor = hyper_util::rt::TokioExecutor::new();
8295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8296/// # secret,
8297/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8298/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8299/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8300/// # ),
8301/// # ).build().await.unwrap();
8302///
8303/// # let client = hyper_util::client::legacy::Client::builder(
8304/// # hyper_util::rt::TokioExecutor::new()
8305/// # )
8306/// # .build(
8307/// # hyper_rustls::HttpsConnectorBuilder::new()
8308/// # .with_native_roots()
8309/// # .unwrap()
8310/// # .https_or_http()
8311/// # .enable_http2()
8312/// # .build()
8313/// # );
8314/// # let mut hub = Datastream::new(client, auth);
8315/// // You can configure optional parameters by calling the respective setters at will, and
8316/// // execute the final call using `doit()`.
8317/// // Values shown here are possibly random and not representative !
8318/// let result = hub.projects().locations_private_connections_routes_list("parent")
8319/// .page_token("sadipscing")
8320/// .page_size(-15)
8321/// .order_by("dolor")
8322/// .filter("duo")
8323/// .doit().await;
8324/// # }
8325/// ```
8326pub struct ProjectLocationPrivateConnectionRouteListCall<'a, C>
8327where
8328 C: 'a,
8329{
8330 hub: &'a Datastream<C>,
8331 _parent: String,
8332 _page_token: Option<String>,
8333 _page_size: Option<i32>,
8334 _order_by: Option<String>,
8335 _filter: Option<String>,
8336 _delegate: Option<&'a mut dyn common::Delegate>,
8337 _additional_params: HashMap<String, String>,
8338 _scopes: BTreeSet<String>,
8339}
8340
8341impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteListCall<'a, C> {}
8342
8343impl<'a, C> ProjectLocationPrivateConnectionRouteListCall<'a, C>
8344where
8345 C: common::Connector,
8346{
8347 /// Perform the operation you have build so far.
8348 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
8349 use std::borrow::Cow;
8350 use std::io::{Read, Seek};
8351
8352 use common::{url::Params, ToParts};
8353 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8354
8355 let mut dd = common::DefaultDelegate;
8356 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8357 dlg.begin(common::MethodInfo {
8358 id: "datastream.projects.locations.privateConnections.routes.list",
8359 http_method: hyper::Method::GET,
8360 });
8361
8362 for &field in [
8363 "alt",
8364 "parent",
8365 "pageToken",
8366 "pageSize",
8367 "orderBy",
8368 "filter",
8369 ]
8370 .iter()
8371 {
8372 if self._additional_params.contains_key(field) {
8373 dlg.finished(false);
8374 return Err(common::Error::FieldClash(field));
8375 }
8376 }
8377
8378 let mut params = Params::with_capacity(7 + self._additional_params.len());
8379 params.push("parent", self._parent);
8380 if let Some(value) = self._page_token.as_ref() {
8381 params.push("pageToken", value);
8382 }
8383 if let Some(value) = self._page_size.as_ref() {
8384 params.push("pageSize", value.to_string());
8385 }
8386 if let Some(value) = self._order_by.as_ref() {
8387 params.push("orderBy", value);
8388 }
8389 if let Some(value) = self._filter.as_ref() {
8390 params.push("filter", value);
8391 }
8392
8393 params.extend(self._additional_params.iter());
8394
8395 params.push("alt", "json");
8396 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
8397 if self._scopes.is_empty() {
8398 self._scopes
8399 .insert(Scope::CloudPlatform.as_ref().to_string());
8400 }
8401
8402 #[allow(clippy::single_element_loop)]
8403 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8404 url = params.uri_replacement(url, param_name, find_this, true);
8405 }
8406 {
8407 let to_remove = ["parent"];
8408 params.remove_params(&to_remove);
8409 }
8410
8411 let url = params.parse_with_url(&url);
8412
8413 loop {
8414 let token = match self
8415 .hub
8416 .auth
8417 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8418 .await
8419 {
8420 Ok(token) => token,
8421 Err(e) => match dlg.token(e) {
8422 Ok(token) => token,
8423 Err(e) => {
8424 dlg.finished(false);
8425 return Err(common::Error::MissingToken(e));
8426 }
8427 },
8428 };
8429 let mut req_result = {
8430 let client = &self.hub.client;
8431 dlg.pre_request();
8432 let mut req_builder = hyper::Request::builder()
8433 .method(hyper::Method::GET)
8434 .uri(url.as_str())
8435 .header(USER_AGENT, self.hub._user_agent.clone());
8436
8437 if let Some(token) = token.as_ref() {
8438 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8439 }
8440
8441 let request = req_builder
8442 .header(CONTENT_LENGTH, 0_u64)
8443 .body(common::to_body::<String>(None));
8444
8445 client.request(request.unwrap()).await
8446 };
8447
8448 match req_result {
8449 Err(err) => {
8450 if let common::Retry::After(d) = dlg.http_error(&err) {
8451 sleep(d).await;
8452 continue;
8453 }
8454 dlg.finished(false);
8455 return Err(common::Error::HttpError(err));
8456 }
8457 Ok(res) => {
8458 let (mut parts, body) = res.into_parts();
8459 let mut body = common::Body::new(body);
8460 if !parts.status.is_success() {
8461 let bytes = common::to_bytes(body).await.unwrap_or_default();
8462 let error = serde_json::from_str(&common::to_string(&bytes));
8463 let response = common::to_response(parts, bytes.into());
8464
8465 if let common::Retry::After(d) =
8466 dlg.http_failure(&response, error.as_ref().ok())
8467 {
8468 sleep(d).await;
8469 continue;
8470 }
8471
8472 dlg.finished(false);
8473
8474 return Err(match error {
8475 Ok(value) => common::Error::BadRequest(value),
8476 _ => common::Error::Failure(response),
8477 });
8478 }
8479 let response = {
8480 let bytes = common::to_bytes(body).await.unwrap_or_default();
8481 let encoded = common::to_string(&bytes);
8482 match serde_json::from_str(&encoded) {
8483 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8484 Err(error) => {
8485 dlg.response_json_decode_error(&encoded, &error);
8486 return Err(common::Error::JsonDecodeError(
8487 encoded.to_string(),
8488 error,
8489 ));
8490 }
8491 }
8492 };
8493
8494 dlg.finished(true);
8495 return Ok(response);
8496 }
8497 }
8498 }
8499 }
8500
8501 /// Required. The parent that owns the collection of Routess.
8502 ///
8503 /// Sets the *parent* path property to the given value.
8504 ///
8505 /// Even though the property as already been set when instantiating this call,
8506 /// we provide this method for API completeness.
8507 pub fn parent(
8508 mut self,
8509 new_value: &str,
8510 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8511 self._parent = new_value.to_string();
8512 self
8513 }
8514 /// Page token received from a previous `ListRoutes` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListRoutes` must match the call that provided the page token.
8515 ///
8516 /// Sets the *page token* query property to the given value.
8517 pub fn page_token(
8518 mut self,
8519 new_value: &str,
8520 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8521 self._page_token = Some(new_value.to_string());
8522 self
8523 }
8524 /// Maximum number of Routes to return. The service may return fewer than this value. If unspecified, at most 50 Routes will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
8525 ///
8526 /// Sets the *page size* query property to the given value.
8527 pub fn page_size(
8528 mut self,
8529 new_value: i32,
8530 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8531 self._page_size = Some(new_value);
8532 self
8533 }
8534 /// Order by fields for the result.
8535 ///
8536 /// Sets the *order by* query property to the given value.
8537 pub fn order_by(
8538 mut self,
8539 new_value: &str,
8540 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8541 self._order_by = Some(new_value.to_string());
8542 self
8543 }
8544 /// Filter request.
8545 ///
8546 /// Sets the *filter* query property to the given value.
8547 pub fn filter(
8548 mut self,
8549 new_value: &str,
8550 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8551 self._filter = Some(new_value.to_string());
8552 self
8553 }
8554 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8555 /// while executing the actual API request.
8556 ///
8557 /// ````text
8558 /// It should be used to handle progress information, and to implement a certain level of resilience.
8559 /// ````
8560 ///
8561 /// Sets the *delegate* property to the given value.
8562 pub fn delegate(
8563 mut self,
8564 new_value: &'a mut dyn common::Delegate,
8565 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8566 self._delegate = Some(new_value);
8567 self
8568 }
8569
8570 /// Set any additional parameter of the query string used in the request.
8571 /// It should be used to set parameters which are not yet available through their own
8572 /// setters.
8573 ///
8574 /// Please note that this method must not be used to set any of the known parameters
8575 /// which have their own setter method. If done anyway, the request will fail.
8576 ///
8577 /// # Additional Parameters
8578 ///
8579 /// * *$.xgafv* (query-string) - V1 error format.
8580 /// * *access_token* (query-string) - OAuth access token.
8581 /// * *alt* (query-string) - Data format for response.
8582 /// * *callback* (query-string) - JSONP
8583 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8584 /// * *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.
8585 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8586 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8587 /// * *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.
8588 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8589 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8590 pub fn param<T>(
8591 mut self,
8592 name: T,
8593 value: T,
8594 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
8595 where
8596 T: AsRef<str>,
8597 {
8598 self._additional_params
8599 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8600 self
8601 }
8602
8603 /// Identifies the authorization scope for the method you are building.
8604 ///
8605 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8606 /// [`Scope::CloudPlatform`].
8607 ///
8608 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8609 /// tokens for more than one scope.
8610 ///
8611 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8612 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8613 /// sufficient, a read-write scope will do as well.
8614 pub fn add_scope<St>(
8615 mut self,
8616 scope: St,
8617 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
8618 where
8619 St: AsRef<str>,
8620 {
8621 self._scopes.insert(String::from(scope.as_ref()));
8622 self
8623 }
8624 /// Identifies the authorization scope(s) for the method you are building.
8625 ///
8626 /// See [`Self::add_scope()`] for details.
8627 pub fn add_scopes<I, St>(
8628 mut self,
8629 scopes: I,
8630 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
8631 where
8632 I: IntoIterator<Item = St>,
8633 St: AsRef<str>,
8634 {
8635 self._scopes
8636 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8637 self
8638 }
8639
8640 /// Removes all scopes, and no default scope will be used either.
8641 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8642 /// for details).
8643 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
8644 self._scopes.clear();
8645 self
8646 }
8647}
8648
8649/// Use this method to create a private connectivity configuration.
8650///
8651/// A builder for the *locations.privateConnections.create* method supported by a *project* resource.
8652/// It is not used directly, but through a [`ProjectMethods`] instance.
8653///
8654/// # Example
8655///
8656/// Instantiate a resource method builder
8657///
8658/// ```test_harness,no_run
8659/// # extern crate hyper;
8660/// # extern crate hyper_rustls;
8661/// # extern crate google_datastream1 as datastream1;
8662/// use datastream1::api::PrivateConnection;
8663/// # async fn dox() {
8664/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8665///
8666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8668/// # .with_native_roots()
8669/// # .unwrap()
8670/// # .https_only()
8671/// # .enable_http2()
8672/// # .build();
8673///
8674/// # let executor = hyper_util::rt::TokioExecutor::new();
8675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8676/// # secret,
8677/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8678/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8679/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8680/// # ),
8681/// # ).build().await.unwrap();
8682///
8683/// # let client = hyper_util::client::legacy::Client::builder(
8684/// # hyper_util::rt::TokioExecutor::new()
8685/// # )
8686/// # .build(
8687/// # hyper_rustls::HttpsConnectorBuilder::new()
8688/// # .with_native_roots()
8689/// # .unwrap()
8690/// # .https_or_http()
8691/// # .enable_http2()
8692/// # .build()
8693/// # );
8694/// # let mut hub = Datastream::new(client, auth);
8695/// // As the method needs a request, you would usually fill it with the desired information
8696/// // into the respective structure. Some of the parts shown here might not be applicable !
8697/// // Values shown here are possibly random and not representative !
8698/// let mut req = PrivateConnection::default();
8699///
8700/// // You can configure optional parameters by calling the respective setters at will, and
8701/// // execute the final call using `doit()`.
8702/// // Values shown here are possibly random and not representative !
8703/// let result = hub.projects().locations_private_connections_create(req, "parent")
8704/// .validate_only(false)
8705/// .request_id("invidunt")
8706/// .private_connection_id("Stet")
8707/// .force(false)
8708/// .doit().await;
8709/// # }
8710/// ```
8711pub struct ProjectLocationPrivateConnectionCreateCall<'a, C>
8712where
8713 C: 'a,
8714{
8715 hub: &'a Datastream<C>,
8716 _request: PrivateConnection,
8717 _parent: String,
8718 _validate_only: Option<bool>,
8719 _request_id: Option<String>,
8720 _private_connection_id: Option<String>,
8721 _force: Option<bool>,
8722 _delegate: Option<&'a mut dyn common::Delegate>,
8723 _additional_params: HashMap<String, String>,
8724 _scopes: BTreeSet<String>,
8725}
8726
8727impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionCreateCall<'a, C> {}
8728
8729impl<'a, C> ProjectLocationPrivateConnectionCreateCall<'a, C>
8730where
8731 C: common::Connector,
8732{
8733 /// Perform the operation you have build so far.
8734 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8735 use std::borrow::Cow;
8736 use std::io::{Read, Seek};
8737
8738 use common::{url::Params, ToParts};
8739 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8740
8741 let mut dd = common::DefaultDelegate;
8742 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8743 dlg.begin(common::MethodInfo {
8744 id: "datastream.projects.locations.privateConnections.create",
8745 http_method: hyper::Method::POST,
8746 });
8747
8748 for &field in [
8749 "alt",
8750 "parent",
8751 "validateOnly",
8752 "requestId",
8753 "privateConnectionId",
8754 "force",
8755 ]
8756 .iter()
8757 {
8758 if self._additional_params.contains_key(field) {
8759 dlg.finished(false);
8760 return Err(common::Error::FieldClash(field));
8761 }
8762 }
8763
8764 let mut params = Params::with_capacity(8 + self._additional_params.len());
8765 params.push("parent", self._parent);
8766 if let Some(value) = self._validate_only.as_ref() {
8767 params.push("validateOnly", value.to_string());
8768 }
8769 if let Some(value) = self._request_id.as_ref() {
8770 params.push("requestId", value);
8771 }
8772 if let Some(value) = self._private_connection_id.as_ref() {
8773 params.push("privateConnectionId", value);
8774 }
8775 if let Some(value) = self._force.as_ref() {
8776 params.push("force", value.to_string());
8777 }
8778
8779 params.extend(self._additional_params.iter());
8780
8781 params.push("alt", "json");
8782 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
8783 if self._scopes.is_empty() {
8784 self._scopes
8785 .insert(Scope::CloudPlatform.as_ref().to_string());
8786 }
8787
8788 #[allow(clippy::single_element_loop)]
8789 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8790 url = params.uri_replacement(url, param_name, find_this, true);
8791 }
8792 {
8793 let to_remove = ["parent"];
8794 params.remove_params(&to_remove);
8795 }
8796
8797 let url = params.parse_with_url(&url);
8798
8799 let mut json_mime_type = mime::APPLICATION_JSON;
8800 let mut request_value_reader = {
8801 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8802 common::remove_json_null_values(&mut value);
8803 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8804 serde_json::to_writer(&mut dst, &value).unwrap();
8805 dst
8806 };
8807 let request_size = request_value_reader
8808 .seek(std::io::SeekFrom::End(0))
8809 .unwrap();
8810 request_value_reader
8811 .seek(std::io::SeekFrom::Start(0))
8812 .unwrap();
8813
8814 loop {
8815 let token = match self
8816 .hub
8817 .auth
8818 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8819 .await
8820 {
8821 Ok(token) => token,
8822 Err(e) => match dlg.token(e) {
8823 Ok(token) => token,
8824 Err(e) => {
8825 dlg.finished(false);
8826 return Err(common::Error::MissingToken(e));
8827 }
8828 },
8829 };
8830 request_value_reader
8831 .seek(std::io::SeekFrom::Start(0))
8832 .unwrap();
8833 let mut req_result = {
8834 let client = &self.hub.client;
8835 dlg.pre_request();
8836 let mut req_builder = hyper::Request::builder()
8837 .method(hyper::Method::POST)
8838 .uri(url.as_str())
8839 .header(USER_AGENT, self.hub._user_agent.clone());
8840
8841 if let Some(token) = token.as_ref() {
8842 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8843 }
8844
8845 let request = req_builder
8846 .header(CONTENT_TYPE, json_mime_type.to_string())
8847 .header(CONTENT_LENGTH, request_size as u64)
8848 .body(common::to_body(
8849 request_value_reader.get_ref().clone().into(),
8850 ));
8851
8852 client.request(request.unwrap()).await
8853 };
8854
8855 match req_result {
8856 Err(err) => {
8857 if let common::Retry::After(d) = dlg.http_error(&err) {
8858 sleep(d).await;
8859 continue;
8860 }
8861 dlg.finished(false);
8862 return Err(common::Error::HttpError(err));
8863 }
8864 Ok(res) => {
8865 let (mut parts, body) = res.into_parts();
8866 let mut body = common::Body::new(body);
8867 if !parts.status.is_success() {
8868 let bytes = common::to_bytes(body).await.unwrap_or_default();
8869 let error = serde_json::from_str(&common::to_string(&bytes));
8870 let response = common::to_response(parts, bytes.into());
8871
8872 if let common::Retry::After(d) =
8873 dlg.http_failure(&response, error.as_ref().ok())
8874 {
8875 sleep(d).await;
8876 continue;
8877 }
8878
8879 dlg.finished(false);
8880
8881 return Err(match error {
8882 Ok(value) => common::Error::BadRequest(value),
8883 _ => common::Error::Failure(response),
8884 });
8885 }
8886 let response = {
8887 let bytes = common::to_bytes(body).await.unwrap_or_default();
8888 let encoded = common::to_string(&bytes);
8889 match serde_json::from_str(&encoded) {
8890 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8891 Err(error) => {
8892 dlg.response_json_decode_error(&encoded, &error);
8893 return Err(common::Error::JsonDecodeError(
8894 encoded.to_string(),
8895 error,
8896 ));
8897 }
8898 }
8899 };
8900
8901 dlg.finished(true);
8902 return Ok(response);
8903 }
8904 }
8905 }
8906 }
8907
8908 ///
8909 /// Sets the *request* property to the given value.
8910 ///
8911 /// Even though the property as already been set when instantiating this call,
8912 /// we provide this method for API completeness.
8913 pub fn request(
8914 mut self,
8915 new_value: PrivateConnection,
8916 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8917 self._request = new_value;
8918 self
8919 }
8920 /// Required. The parent that owns the collection of PrivateConnections.
8921 ///
8922 /// Sets the *parent* path property to the given value.
8923 ///
8924 /// Even though the property as already been set when instantiating this call,
8925 /// we provide this method for API completeness.
8926 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8927 self._parent = new_value.to_string();
8928 self
8929 }
8930 /// Optional. When supplied with PSC Interface config, will get/create the tenant project required for the customer to allow list and won't actually create the private connection.
8931 ///
8932 /// Sets the *validate only* query property to the given value.
8933 pub fn validate_only(
8934 mut self,
8935 new_value: bool,
8936 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8937 self._validate_only = Some(new_value);
8938 self
8939 }
8940 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
8941 ///
8942 /// Sets the *request id* query property to the given value.
8943 pub fn request_id(
8944 mut self,
8945 new_value: &str,
8946 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8947 self._request_id = Some(new_value.to_string());
8948 self
8949 }
8950 /// Required. The private connectivity identifier.
8951 ///
8952 /// Sets the *private connection id* query property to the given value.
8953 pub fn private_connection_id(
8954 mut self,
8955 new_value: &str,
8956 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8957 self._private_connection_id = Some(new_value.to_string());
8958 self
8959 }
8960 /// Optional. If set to true, will skip validations.
8961 ///
8962 /// Sets the *force* query property to the given value.
8963 pub fn force(mut self, new_value: bool) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8964 self._force = Some(new_value);
8965 self
8966 }
8967 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8968 /// while executing the actual API request.
8969 ///
8970 /// ````text
8971 /// It should be used to handle progress information, and to implement a certain level of resilience.
8972 /// ````
8973 ///
8974 /// Sets the *delegate* property to the given value.
8975 pub fn delegate(
8976 mut self,
8977 new_value: &'a mut dyn common::Delegate,
8978 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
8979 self._delegate = Some(new_value);
8980 self
8981 }
8982
8983 /// Set any additional parameter of the query string used in the request.
8984 /// It should be used to set parameters which are not yet available through their own
8985 /// setters.
8986 ///
8987 /// Please note that this method must not be used to set any of the known parameters
8988 /// which have their own setter method. If done anyway, the request will fail.
8989 ///
8990 /// # Additional Parameters
8991 ///
8992 /// * *$.xgafv* (query-string) - V1 error format.
8993 /// * *access_token* (query-string) - OAuth access token.
8994 /// * *alt* (query-string) - Data format for response.
8995 /// * *callback* (query-string) - JSONP
8996 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8997 /// * *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.
8998 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8999 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9000 /// * *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.
9001 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9002 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9003 pub fn param<T>(
9004 mut self,
9005 name: T,
9006 value: T,
9007 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
9008 where
9009 T: AsRef<str>,
9010 {
9011 self._additional_params
9012 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9013 self
9014 }
9015
9016 /// Identifies the authorization scope for the method you are building.
9017 ///
9018 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9019 /// [`Scope::CloudPlatform`].
9020 ///
9021 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9022 /// tokens for more than one scope.
9023 ///
9024 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9025 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9026 /// sufficient, a read-write scope will do as well.
9027 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
9028 where
9029 St: AsRef<str>,
9030 {
9031 self._scopes.insert(String::from(scope.as_ref()));
9032 self
9033 }
9034 /// Identifies the authorization scope(s) for the method you are building.
9035 ///
9036 /// See [`Self::add_scope()`] for details.
9037 pub fn add_scopes<I, St>(
9038 mut self,
9039 scopes: I,
9040 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
9041 where
9042 I: IntoIterator<Item = St>,
9043 St: AsRef<str>,
9044 {
9045 self._scopes
9046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9047 self
9048 }
9049
9050 /// Removes all scopes, and no default scope will be used either.
9051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9052 /// for details).
9053 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
9054 self._scopes.clear();
9055 self
9056 }
9057}
9058
9059/// Use this method to delete a private connectivity configuration.
9060///
9061/// A builder for the *locations.privateConnections.delete* method supported by a *project* resource.
9062/// It is not used directly, but through a [`ProjectMethods`] instance.
9063///
9064/// # Example
9065///
9066/// Instantiate a resource method builder
9067///
9068/// ```test_harness,no_run
9069/// # extern crate hyper;
9070/// # extern crate hyper_rustls;
9071/// # extern crate google_datastream1 as datastream1;
9072/// # async fn dox() {
9073/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9074///
9075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9076/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9077/// # .with_native_roots()
9078/// # .unwrap()
9079/// # .https_only()
9080/// # .enable_http2()
9081/// # .build();
9082///
9083/// # let executor = hyper_util::rt::TokioExecutor::new();
9084/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9085/// # secret,
9086/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9087/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9088/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9089/// # ),
9090/// # ).build().await.unwrap();
9091///
9092/// # let client = hyper_util::client::legacy::Client::builder(
9093/// # hyper_util::rt::TokioExecutor::new()
9094/// # )
9095/// # .build(
9096/// # hyper_rustls::HttpsConnectorBuilder::new()
9097/// # .with_native_roots()
9098/// # .unwrap()
9099/// # .https_or_http()
9100/// # .enable_http2()
9101/// # .build()
9102/// # );
9103/// # let mut hub = Datastream::new(client, auth);
9104/// // You can configure optional parameters by calling the respective setters at will, and
9105/// // execute the final call using `doit()`.
9106/// // Values shown here are possibly random and not representative !
9107/// let result = hub.projects().locations_private_connections_delete("name")
9108/// .request_id("Lorem")
9109/// .force(true)
9110/// .doit().await;
9111/// # }
9112/// ```
9113pub struct ProjectLocationPrivateConnectionDeleteCall<'a, C>
9114where
9115 C: 'a,
9116{
9117 hub: &'a Datastream<C>,
9118 _name: String,
9119 _request_id: Option<String>,
9120 _force: Option<bool>,
9121 _delegate: Option<&'a mut dyn common::Delegate>,
9122 _additional_params: HashMap<String, String>,
9123 _scopes: BTreeSet<String>,
9124}
9125
9126impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionDeleteCall<'a, C> {}
9127
9128impl<'a, C> ProjectLocationPrivateConnectionDeleteCall<'a, C>
9129where
9130 C: common::Connector,
9131{
9132 /// Perform the operation you have build so far.
9133 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9134 use std::borrow::Cow;
9135 use std::io::{Read, Seek};
9136
9137 use common::{url::Params, ToParts};
9138 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9139
9140 let mut dd = common::DefaultDelegate;
9141 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9142 dlg.begin(common::MethodInfo {
9143 id: "datastream.projects.locations.privateConnections.delete",
9144 http_method: hyper::Method::DELETE,
9145 });
9146
9147 for &field in ["alt", "name", "requestId", "force"].iter() {
9148 if self._additional_params.contains_key(field) {
9149 dlg.finished(false);
9150 return Err(common::Error::FieldClash(field));
9151 }
9152 }
9153
9154 let mut params = Params::with_capacity(5 + self._additional_params.len());
9155 params.push("name", self._name);
9156 if let Some(value) = self._request_id.as_ref() {
9157 params.push("requestId", value);
9158 }
9159 if let Some(value) = self._force.as_ref() {
9160 params.push("force", value.to_string());
9161 }
9162
9163 params.extend(self._additional_params.iter());
9164
9165 params.push("alt", "json");
9166 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9167 if self._scopes.is_empty() {
9168 self._scopes
9169 .insert(Scope::CloudPlatform.as_ref().to_string());
9170 }
9171
9172 #[allow(clippy::single_element_loop)]
9173 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9174 url = params.uri_replacement(url, param_name, find_this, true);
9175 }
9176 {
9177 let to_remove = ["name"];
9178 params.remove_params(&to_remove);
9179 }
9180
9181 let url = params.parse_with_url(&url);
9182
9183 loop {
9184 let token = match self
9185 .hub
9186 .auth
9187 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9188 .await
9189 {
9190 Ok(token) => token,
9191 Err(e) => match dlg.token(e) {
9192 Ok(token) => token,
9193 Err(e) => {
9194 dlg.finished(false);
9195 return Err(common::Error::MissingToken(e));
9196 }
9197 },
9198 };
9199 let mut req_result = {
9200 let client = &self.hub.client;
9201 dlg.pre_request();
9202 let mut req_builder = hyper::Request::builder()
9203 .method(hyper::Method::DELETE)
9204 .uri(url.as_str())
9205 .header(USER_AGENT, self.hub._user_agent.clone());
9206
9207 if let Some(token) = token.as_ref() {
9208 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9209 }
9210
9211 let request = req_builder
9212 .header(CONTENT_LENGTH, 0_u64)
9213 .body(common::to_body::<String>(None));
9214
9215 client.request(request.unwrap()).await
9216 };
9217
9218 match req_result {
9219 Err(err) => {
9220 if let common::Retry::After(d) = dlg.http_error(&err) {
9221 sleep(d).await;
9222 continue;
9223 }
9224 dlg.finished(false);
9225 return Err(common::Error::HttpError(err));
9226 }
9227 Ok(res) => {
9228 let (mut parts, body) = res.into_parts();
9229 let mut body = common::Body::new(body);
9230 if !parts.status.is_success() {
9231 let bytes = common::to_bytes(body).await.unwrap_or_default();
9232 let error = serde_json::from_str(&common::to_string(&bytes));
9233 let response = common::to_response(parts, bytes.into());
9234
9235 if let common::Retry::After(d) =
9236 dlg.http_failure(&response, error.as_ref().ok())
9237 {
9238 sleep(d).await;
9239 continue;
9240 }
9241
9242 dlg.finished(false);
9243
9244 return Err(match error {
9245 Ok(value) => common::Error::BadRequest(value),
9246 _ => common::Error::Failure(response),
9247 });
9248 }
9249 let response = {
9250 let bytes = common::to_bytes(body).await.unwrap_or_default();
9251 let encoded = common::to_string(&bytes);
9252 match serde_json::from_str(&encoded) {
9253 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9254 Err(error) => {
9255 dlg.response_json_decode_error(&encoded, &error);
9256 return Err(common::Error::JsonDecodeError(
9257 encoded.to_string(),
9258 error,
9259 ));
9260 }
9261 }
9262 };
9263
9264 dlg.finished(true);
9265 return Ok(response);
9266 }
9267 }
9268 }
9269 }
9270
9271 /// Required. The name of the private connectivity configuration to delete.
9272 ///
9273 /// Sets the *name* path property to the given value.
9274 ///
9275 /// Even though the property as already been set when instantiating this call,
9276 /// we provide this method for API completeness.
9277 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
9278 self._name = new_value.to_string();
9279 self
9280 }
9281 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
9282 ///
9283 /// Sets the *request id* query property to the given value.
9284 pub fn request_id(
9285 mut self,
9286 new_value: &str,
9287 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
9288 self._request_id = Some(new_value.to_string());
9289 self
9290 }
9291 /// Optional. If set to true, any child routes that belong to this PrivateConnection will also be deleted.
9292 ///
9293 /// Sets the *force* query property to the given value.
9294 pub fn force(mut self, new_value: bool) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
9295 self._force = Some(new_value);
9296 self
9297 }
9298 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9299 /// while executing the actual API request.
9300 ///
9301 /// ````text
9302 /// It should be used to handle progress information, and to implement a certain level of resilience.
9303 /// ````
9304 ///
9305 /// Sets the *delegate* property to the given value.
9306 pub fn delegate(
9307 mut self,
9308 new_value: &'a mut dyn common::Delegate,
9309 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
9310 self._delegate = Some(new_value);
9311 self
9312 }
9313
9314 /// Set any additional parameter of the query string used in the request.
9315 /// It should be used to set parameters which are not yet available through their own
9316 /// setters.
9317 ///
9318 /// Please note that this method must not be used to set any of the known parameters
9319 /// which have their own setter method. If done anyway, the request will fail.
9320 ///
9321 /// # Additional Parameters
9322 ///
9323 /// * *$.xgafv* (query-string) - V1 error format.
9324 /// * *access_token* (query-string) - OAuth access token.
9325 /// * *alt* (query-string) - Data format for response.
9326 /// * *callback* (query-string) - JSONP
9327 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9328 /// * *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.
9329 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9330 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9331 /// * *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.
9332 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9333 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9334 pub fn param<T>(
9335 mut self,
9336 name: T,
9337 value: T,
9338 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
9339 where
9340 T: AsRef<str>,
9341 {
9342 self._additional_params
9343 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9344 self
9345 }
9346
9347 /// Identifies the authorization scope for the method you are building.
9348 ///
9349 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9350 /// [`Scope::CloudPlatform`].
9351 ///
9352 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9353 /// tokens for more than one scope.
9354 ///
9355 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9356 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9357 /// sufficient, a read-write scope will do as well.
9358 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
9359 where
9360 St: AsRef<str>,
9361 {
9362 self._scopes.insert(String::from(scope.as_ref()));
9363 self
9364 }
9365 /// Identifies the authorization scope(s) for the method you are building.
9366 ///
9367 /// See [`Self::add_scope()`] for details.
9368 pub fn add_scopes<I, St>(
9369 mut self,
9370 scopes: I,
9371 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
9372 where
9373 I: IntoIterator<Item = St>,
9374 St: AsRef<str>,
9375 {
9376 self._scopes
9377 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9378 self
9379 }
9380
9381 /// Removes all scopes, and no default scope will be used either.
9382 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9383 /// for details).
9384 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
9385 self._scopes.clear();
9386 self
9387 }
9388}
9389
9390/// Use this method to get details about a private connectivity configuration.
9391///
9392/// A builder for the *locations.privateConnections.get* method supported by a *project* resource.
9393/// It is not used directly, but through a [`ProjectMethods`] instance.
9394///
9395/// # Example
9396///
9397/// Instantiate a resource method builder
9398///
9399/// ```test_harness,no_run
9400/// # extern crate hyper;
9401/// # extern crate hyper_rustls;
9402/// # extern crate google_datastream1 as datastream1;
9403/// # async fn dox() {
9404/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9405///
9406/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9407/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9408/// # .with_native_roots()
9409/// # .unwrap()
9410/// # .https_only()
9411/// # .enable_http2()
9412/// # .build();
9413///
9414/// # let executor = hyper_util::rt::TokioExecutor::new();
9415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9416/// # secret,
9417/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9418/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9419/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9420/// # ),
9421/// # ).build().await.unwrap();
9422///
9423/// # let client = hyper_util::client::legacy::Client::builder(
9424/// # hyper_util::rt::TokioExecutor::new()
9425/// # )
9426/// # .build(
9427/// # hyper_rustls::HttpsConnectorBuilder::new()
9428/// # .with_native_roots()
9429/// # .unwrap()
9430/// # .https_or_http()
9431/// # .enable_http2()
9432/// # .build()
9433/// # );
9434/// # let mut hub = Datastream::new(client, auth);
9435/// // You can configure optional parameters by calling the respective setters at will, and
9436/// // execute the final call using `doit()`.
9437/// // Values shown here are possibly random and not representative !
9438/// let result = hub.projects().locations_private_connections_get("name")
9439/// .doit().await;
9440/// # }
9441/// ```
9442pub struct ProjectLocationPrivateConnectionGetCall<'a, C>
9443where
9444 C: 'a,
9445{
9446 hub: &'a Datastream<C>,
9447 _name: String,
9448 _delegate: Option<&'a mut dyn common::Delegate>,
9449 _additional_params: HashMap<String, String>,
9450 _scopes: BTreeSet<String>,
9451}
9452
9453impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetCall<'a, C> {}
9454
9455impl<'a, C> ProjectLocationPrivateConnectionGetCall<'a, C>
9456where
9457 C: common::Connector,
9458{
9459 /// Perform the operation you have build so far.
9460 pub async fn doit(mut self) -> common::Result<(common::Response, PrivateConnection)> {
9461 use std::borrow::Cow;
9462 use std::io::{Read, Seek};
9463
9464 use common::{url::Params, ToParts};
9465 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9466
9467 let mut dd = common::DefaultDelegate;
9468 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9469 dlg.begin(common::MethodInfo {
9470 id: "datastream.projects.locations.privateConnections.get",
9471 http_method: hyper::Method::GET,
9472 });
9473
9474 for &field in ["alt", "name"].iter() {
9475 if self._additional_params.contains_key(field) {
9476 dlg.finished(false);
9477 return Err(common::Error::FieldClash(field));
9478 }
9479 }
9480
9481 let mut params = Params::with_capacity(3 + self._additional_params.len());
9482 params.push("name", self._name);
9483
9484 params.extend(self._additional_params.iter());
9485
9486 params.push("alt", "json");
9487 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9488 if self._scopes.is_empty() {
9489 self._scopes
9490 .insert(Scope::CloudPlatform.as_ref().to_string());
9491 }
9492
9493 #[allow(clippy::single_element_loop)]
9494 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9495 url = params.uri_replacement(url, param_name, find_this, true);
9496 }
9497 {
9498 let to_remove = ["name"];
9499 params.remove_params(&to_remove);
9500 }
9501
9502 let url = params.parse_with_url(&url);
9503
9504 loop {
9505 let token = match self
9506 .hub
9507 .auth
9508 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9509 .await
9510 {
9511 Ok(token) => token,
9512 Err(e) => match dlg.token(e) {
9513 Ok(token) => token,
9514 Err(e) => {
9515 dlg.finished(false);
9516 return Err(common::Error::MissingToken(e));
9517 }
9518 },
9519 };
9520 let mut req_result = {
9521 let client = &self.hub.client;
9522 dlg.pre_request();
9523 let mut req_builder = hyper::Request::builder()
9524 .method(hyper::Method::GET)
9525 .uri(url.as_str())
9526 .header(USER_AGENT, self.hub._user_agent.clone());
9527
9528 if let Some(token) = token.as_ref() {
9529 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9530 }
9531
9532 let request = req_builder
9533 .header(CONTENT_LENGTH, 0_u64)
9534 .body(common::to_body::<String>(None));
9535
9536 client.request(request.unwrap()).await
9537 };
9538
9539 match req_result {
9540 Err(err) => {
9541 if let common::Retry::After(d) = dlg.http_error(&err) {
9542 sleep(d).await;
9543 continue;
9544 }
9545 dlg.finished(false);
9546 return Err(common::Error::HttpError(err));
9547 }
9548 Ok(res) => {
9549 let (mut parts, body) = res.into_parts();
9550 let mut body = common::Body::new(body);
9551 if !parts.status.is_success() {
9552 let bytes = common::to_bytes(body).await.unwrap_or_default();
9553 let error = serde_json::from_str(&common::to_string(&bytes));
9554 let response = common::to_response(parts, bytes.into());
9555
9556 if let common::Retry::After(d) =
9557 dlg.http_failure(&response, error.as_ref().ok())
9558 {
9559 sleep(d).await;
9560 continue;
9561 }
9562
9563 dlg.finished(false);
9564
9565 return Err(match error {
9566 Ok(value) => common::Error::BadRequest(value),
9567 _ => common::Error::Failure(response),
9568 });
9569 }
9570 let response = {
9571 let bytes = common::to_bytes(body).await.unwrap_or_default();
9572 let encoded = common::to_string(&bytes);
9573 match serde_json::from_str(&encoded) {
9574 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9575 Err(error) => {
9576 dlg.response_json_decode_error(&encoded, &error);
9577 return Err(common::Error::JsonDecodeError(
9578 encoded.to_string(),
9579 error,
9580 ));
9581 }
9582 }
9583 };
9584
9585 dlg.finished(true);
9586 return Ok(response);
9587 }
9588 }
9589 }
9590 }
9591
9592 /// Required. The name of the private connectivity configuration to get.
9593 ///
9594 /// Sets the *name* path property to the given value.
9595 ///
9596 /// Even though the property as already been set when instantiating this call,
9597 /// we provide this method for API completeness.
9598 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
9599 self._name = new_value.to_string();
9600 self
9601 }
9602 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9603 /// while executing the actual API request.
9604 ///
9605 /// ````text
9606 /// It should be used to handle progress information, and to implement a certain level of resilience.
9607 /// ````
9608 ///
9609 /// Sets the *delegate* property to the given value.
9610 pub fn delegate(
9611 mut self,
9612 new_value: &'a mut dyn common::Delegate,
9613 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
9614 self._delegate = Some(new_value);
9615 self
9616 }
9617
9618 /// Set any additional parameter of the query string used in the request.
9619 /// It should be used to set parameters which are not yet available through their own
9620 /// setters.
9621 ///
9622 /// Please note that this method must not be used to set any of the known parameters
9623 /// which have their own setter method. If done anyway, the request will fail.
9624 ///
9625 /// # Additional Parameters
9626 ///
9627 /// * *$.xgafv* (query-string) - V1 error format.
9628 /// * *access_token* (query-string) - OAuth access token.
9629 /// * *alt* (query-string) - Data format for response.
9630 /// * *callback* (query-string) - JSONP
9631 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9632 /// * *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.
9633 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9634 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9635 /// * *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.
9636 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9637 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9638 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionGetCall<'a, C>
9639 where
9640 T: AsRef<str>,
9641 {
9642 self._additional_params
9643 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9644 self
9645 }
9646
9647 /// Identifies the authorization scope for the method you are building.
9648 ///
9649 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9650 /// [`Scope::CloudPlatform`].
9651 ///
9652 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9653 /// tokens for more than one scope.
9654 ///
9655 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9656 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9657 /// sufficient, a read-write scope will do as well.
9658 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionGetCall<'a, C>
9659 where
9660 St: AsRef<str>,
9661 {
9662 self._scopes.insert(String::from(scope.as_ref()));
9663 self
9664 }
9665 /// Identifies the authorization scope(s) for the method you are building.
9666 ///
9667 /// See [`Self::add_scope()`] for details.
9668 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionGetCall<'a, C>
9669 where
9670 I: IntoIterator<Item = St>,
9671 St: AsRef<str>,
9672 {
9673 self._scopes
9674 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9675 self
9676 }
9677
9678 /// Removes all scopes, and no default scope will be used either.
9679 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9680 /// for details).
9681 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
9682 self._scopes.clear();
9683 self
9684 }
9685}
9686
9687/// Use this method to list private connectivity configurations in a project and location.
9688///
9689/// A builder for the *locations.privateConnections.list* method supported by a *project* resource.
9690/// It is not used directly, but through a [`ProjectMethods`] instance.
9691///
9692/// # Example
9693///
9694/// Instantiate a resource method builder
9695///
9696/// ```test_harness,no_run
9697/// # extern crate hyper;
9698/// # extern crate hyper_rustls;
9699/// # extern crate google_datastream1 as datastream1;
9700/// # async fn dox() {
9701/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9702///
9703/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9704/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9705/// # .with_native_roots()
9706/// # .unwrap()
9707/// # .https_only()
9708/// # .enable_http2()
9709/// # .build();
9710///
9711/// # let executor = hyper_util::rt::TokioExecutor::new();
9712/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9713/// # secret,
9714/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9715/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9716/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9717/// # ),
9718/// # ).build().await.unwrap();
9719///
9720/// # let client = hyper_util::client::legacy::Client::builder(
9721/// # hyper_util::rt::TokioExecutor::new()
9722/// # )
9723/// # .build(
9724/// # hyper_rustls::HttpsConnectorBuilder::new()
9725/// # .with_native_roots()
9726/// # .unwrap()
9727/// # .https_or_http()
9728/// # .enable_http2()
9729/// # .build()
9730/// # );
9731/// # let mut hub = Datastream::new(client, auth);
9732/// // You can configure optional parameters by calling the respective setters at will, and
9733/// // execute the final call using `doit()`.
9734/// // Values shown here are possibly random and not representative !
9735/// let result = hub.projects().locations_private_connections_list("parent")
9736/// .page_token("takimata")
9737/// .page_size(-46)
9738/// .order_by("voluptua.")
9739/// .filter("et")
9740/// .doit().await;
9741/// # }
9742/// ```
9743pub struct ProjectLocationPrivateConnectionListCall<'a, C>
9744where
9745 C: 'a,
9746{
9747 hub: &'a Datastream<C>,
9748 _parent: String,
9749 _page_token: Option<String>,
9750 _page_size: Option<i32>,
9751 _order_by: Option<String>,
9752 _filter: Option<String>,
9753 _delegate: Option<&'a mut dyn common::Delegate>,
9754 _additional_params: HashMap<String, String>,
9755 _scopes: BTreeSet<String>,
9756}
9757
9758impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionListCall<'a, C> {}
9759
9760impl<'a, C> ProjectLocationPrivateConnectionListCall<'a, C>
9761where
9762 C: common::Connector,
9763{
9764 /// Perform the operation you have build so far.
9765 pub async fn doit(
9766 mut self,
9767 ) -> common::Result<(common::Response, ListPrivateConnectionsResponse)> {
9768 use std::borrow::Cow;
9769 use std::io::{Read, Seek};
9770
9771 use common::{url::Params, ToParts};
9772 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9773
9774 let mut dd = common::DefaultDelegate;
9775 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9776 dlg.begin(common::MethodInfo {
9777 id: "datastream.projects.locations.privateConnections.list",
9778 http_method: hyper::Method::GET,
9779 });
9780
9781 for &field in [
9782 "alt",
9783 "parent",
9784 "pageToken",
9785 "pageSize",
9786 "orderBy",
9787 "filter",
9788 ]
9789 .iter()
9790 {
9791 if self._additional_params.contains_key(field) {
9792 dlg.finished(false);
9793 return Err(common::Error::FieldClash(field));
9794 }
9795 }
9796
9797 let mut params = Params::with_capacity(7 + self._additional_params.len());
9798 params.push("parent", self._parent);
9799 if let Some(value) = self._page_token.as_ref() {
9800 params.push("pageToken", value);
9801 }
9802 if let Some(value) = self._page_size.as_ref() {
9803 params.push("pageSize", value.to_string());
9804 }
9805 if let Some(value) = self._order_by.as_ref() {
9806 params.push("orderBy", value);
9807 }
9808 if let Some(value) = self._filter.as_ref() {
9809 params.push("filter", value);
9810 }
9811
9812 params.extend(self._additional_params.iter());
9813
9814 params.push("alt", "json");
9815 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
9816 if self._scopes.is_empty() {
9817 self._scopes
9818 .insert(Scope::CloudPlatform.as_ref().to_string());
9819 }
9820
9821 #[allow(clippy::single_element_loop)]
9822 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9823 url = params.uri_replacement(url, param_name, find_this, true);
9824 }
9825 {
9826 let to_remove = ["parent"];
9827 params.remove_params(&to_remove);
9828 }
9829
9830 let url = params.parse_with_url(&url);
9831
9832 loop {
9833 let token = match self
9834 .hub
9835 .auth
9836 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9837 .await
9838 {
9839 Ok(token) => token,
9840 Err(e) => match dlg.token(e) {
9841 Ok(token) => token,
9842 Err(e) => {
9843 dlg.finished(false);
9844 return Err(common::Error::MissingToken(e));
9845 }
9846 },
9847 };
9848 let mut req_result = {
9849 let client = &self.hub.client;
9850 dlg.pre_request();
9851 let mut req_builder = hyper::Request::builder()
9852 .method(hyper::Method::GET)
9853 .uri(url.as_str())
9854 .header(USER_AGENT, self.hub._user_agent.clone());
9855
9856 if let Some(token) = token.as_ref() {
9857 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9858 }
9859
9860 let request = req_builder
9861 .header(CONTENT_LENGTH, 0_u64)
9862 .body(common::to_body::<String>(None));
9863
9864 client.request(request.unwrap()).await
9865 };
9866
9867 match req_result {
9868 Err(err) => {
9869 if let common::Retry::After(d) = dlg.http_error(&err) {
9870 sleep(d).await;
9871 continue;
9872 }
9873 dlg.finished(false);
9874 return Err(common::Error::HttpError(err));
9875 }
9876 Ok(res) => {
9877 let (mut parts, body) = res.into_parts();
9878 let mut body = common::Body::new(body);
9879 if !parts.status.is_success() {
9880 let bytes = common::to_bytes(body).await.unwrap_or_default();
9881 let error = serde_json::from_str(&common::to_string(&bytes));
9882 let response = common::to_response(parts, bytes.into());
9883
9884 if let common::Retry::After(d) =
9885 dlg.http_failure(&response, error.as_ref().ok())
9886 {
9887 sleep(d).await;
9888 continue;
9889 }
9890
9891 dlg.finished(false);
9892
9893 return Err(match error {
9894 Ok(value) => common::Error::BadRequest(value),
9895 _ => common::Error::Failure(response),
9896 });
9897 }
9898 let response = {
9899 let bytes = common::to_bytes(body).await.unwrap_or_default();
9900 let encoded = common::to_string(&bytes);
9901 match serde_json::from_str(&encoded) {
9902 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9903 Err(error) => {
9904 dlg.response_json_decode_error(&encoded, &error);
9905 return Err(common::Error::JsonDecodeError(
9906 encoded.to_string(),
9907 error,
9908 ));
9909 }
9910 }
9911 };
9912
9913 dlg.finished(true);
9914 return Ok(response);
9915 }
9916 }
9917 }
9918 }
9919
9920 /// Required. The parent that owns the collection of private connectivity configurations.
9921 ///
9922 /// Sets the *parent* path property to the given value.
9923 ///
9924 /// Even though the property as already been set when instantiating this call,
9925 /// we provide this method for API completeness.
9926 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9927 self._parent = new_value.to_string();
9928 self
9929 }
9930 /// Page token received from a previous `ListPrivateConnections` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPrivateConnections` must match the call that provided the page token.
9931 ///
9932 /// Sets the *page token* query property to the given value.
9933 pub fn page_token(
9934 mut self,
9935 new_value: &str,
9936 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9937 self._page_token = Some(new_value.to_string());
9938 self
9939 }
9940 /// Maximum number of private connectivity configurations to return. If unspecified, at most 50 private connectivity configurations that will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
9941 ///
9942 /// Sets the *page size* query property to the given value.
9943 pub fn page_size(mut self, new_value: i32) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9944 self._page_size = Some(new_value);
9945 self
9946 }
9947 /// Order by fields for the result.
9948 ///
9949 /// Sets the *order by* query property to the given value.
9950 pub fn order_by(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9951 self._order_by = Some(new_value.to_string());
9952 self
9953 }
9954 /// Filter request.
9955 ///
9956 /// Sets the *filter* query property to the given value.
9957 pub fn filter(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9958 self._filter = Some(new_value.to_string());
9959 self
9960 }
9961 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9962 /// while executing the actual API request.
9963 ///
9964 /// ````text
9965 /// It should be used to handle progress information, and to implement a certain level of resilience.
9966 /// ````
9967 ///
9968 /// Sets the *delegate* property to the given value.
9969 pub fn delegate(
9970 mut self,
9971 new_value: &'a mut dyn common::Delegate,
9972 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
9973 self._delegate = Some(new_value);
9974 self
9975 }
9976
9977 /// Set any additional parameter of the query string used in the request.
9978 /// It should be used to set parameters which are not yet available through their own
9979 /// setters.
9980 ///
9981 /// Please note that this method must not be used to set any of the known parameters
9982 /// which have their own setter method. If done anyway, the request will fail.
9983 ///
9984 /// # Additional Parameters
9985 ///
9986 /// * *$.xgafv* (query-string) - V1 error format.
9987 /// * *access_token* (query-string) - OAuth access token.
9988 /// * *alt* (query-string) - Data format for response.
9989 /// * *callback* (query-string) - JSONP
9990 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9991 /// * *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.
9992 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9993 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9994 /// * *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.
9995 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9996 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9997 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionListCall<'a, C>
9998 where
9999 T: AsRef<str>,
10000 {
10001 self._additional_params
10002 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10003 self
10004 }
10005
10006 /// Identifies the authorization scope for the method you are building.
10007 ///
10008 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10009 /// [`Scope::CloudPlatform`].
10010 ///
10011 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10012 /// tokens for more than one scope.
10013 ///
10014 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10015 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10016 /// sufficient, a read-write scope will do as well.
10017 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionListCall<'a, C>
10018 where
10019 St: AsRef<str>,
10020 {
10021 self._scopes.insert(String::from(scope.as_ref()));
10022 self
10023 }
10024 /// Identifies the authorization scope(s) for the method you are building.
10025 ///
10026 /// See [`Self::add_scope()`] for details.
10027 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionListCall<'a, C>
10028 where
10029 I: IntoIterator<Item = St>,
10030 St: AsRef<str>,
10031 {
10032 self._scopes
10033 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10034 self
10035 }
10036
10037 /// Removes all scopes, and no default scope will be used either.
10038 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10039 /// for details).
10040 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionListCall<'a, C> {
10041 self._scopes.clear();
10042 self
10043 }
10044}
10045
10046/// Use this method to get details about a stream object.
10047///
10048/// A builder for the *locations.streams.objects.get* method supported by a *project* resource.
10049/// It is not used directly, but through a [`ProjectMethods`] instance.
10050///
10051/// # Example
10052///
10053/// Instantiate a resource method builder
10054///
10055/// ```test_harness,no_run
10056/// # extern crate hyper;
10057/// # extern crate hyper_rustls;
10058/// # extern crate google_datastream1 as datastream1;
10059/// # async fn dox() {
10060/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10061///
10062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10063/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10064/// # .with_native_roots()
10065/// # .unwrap()
10066/// # .https_only()
10067/// # .enable_http2()
10068/// # .build();
10069///
10070/// # let executor = hyper_util::rt::TokioExecutor::new();
10071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10072/// # secret,
10073/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10074/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10075/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10076/// # ),
10077/// # ).build().await.unwrap();
10078///
10079/// # let client = hyper_util::client::legacy::Client::builder(
10080/// # hyper_util::rt::TokioExecutor::new()
10081/// # )
10082/// # .build(
10083/// # hyper_rustls::HttpsConnectorBuilder::new()
10084/// # .with_native_roots()
10085/// # .unwrap()
10086/// # .https_or_http()
10087/// # .enable_http2()
10088/// # .build()
10089/// # );
10090/// # let mut hub = Datastream::new(client, auth);
10091/// // You can configure optional parameters by calling the respective setters at will, and
10092/// // execute the final call using `doit()`.
10093/// // Values shown here are possibly random and not representative !
10094/// let result = hub.projects().locations_streams_objects_get("name")
10095/// .doit().await;
10096/// # }
10097/// ```
10098pub struct ProjectLocationStreamObjectGetCall<'a, C>
10099where
10100 C: 'a,
10101{
10102 hub: &'a Datastream<C>,
10103 _name: String,
10104 _delegate: Option<&'a mut dyn common::Delegate>,
10105 _additional_params: HashMap<String, String>,
10106 _scopes: BTreeSet<String>,
10107}
10108
10109impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectGetCall<'a, C> {}
10110
10111impl<'a, C> ProjectLocationStreamObjectGetCall<'a, C>
10112where
10113 C: common::Connector,
10114{
10115 /// Perform the operation you have build so far.
10116 pub async fn doit(mut self) -> common::Result<(common::Response, StreamObject)> {
10117 use std::borrow::Cow;
10118 use std::io::{Read, Seek};
10119
10120 use common::{url::Params, ToParts};
10121 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10122
10123 let mut dd = common::DefaultDelegate;
10124 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10125 dlg.begin(common::MethodInfo {
10126 id: "datastream.projects.locations.streams.objects.get",
10127 http_method: hyper::Method::GET,
10128 });
10129
10130 for &field in ["alt", "name"].iter() {
10131 if self._additional_params.contains_key(field) {
10132 dlg.finished(false);
10133 return Err(common::Error::FieldClash(field));
10134 }
10135 }
10136
10137 let mut params = Params::with_capacity(3 + self._additional_params.len());
10138 params.push("name", self._name);
10139
10140 params.extend(self._additional_params.iter());
10141
10142 params.push("alt", "json");
10143 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10144 if self._scopes.is_empty() {
10145 self._scopes
10146 .insert(Scope::CloudPlatform.as_ref().to_string());
10147 }
10148
10149 #[allow(clippy::single_element_loop)]
10150 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10151 url = params.uri_replacement(url, param_name, find_this, true);
10152 }
10153 {
10154 let to_remove = ["name"];
10155 params.remove_params(&to_remove);
10156 }
10157
10158 let url = params.parse_with_url(&url);
10159
10160 loop {
10161 let token = match self
10162 .hub
10163 .auth
10164 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10165 .await
10166 {
10167 Ok(token) => token,
10168 Err(e) => match dlg.token(e) {
10169 Ok(token) => token,
10170 Err(e) => {
10171 dlg.finished(false);
10172 return Err(common::Error::MissingToken(e));
10173 }
10174 },
10175 };
10176 let mut req_result = {
10177 let client = &self.hub.client;
10178 dlg.pre_request();
10179 let mut req_builder = hyper::Request::builder()
10180 .method(hyper::Method::GET)
10181 .uri(url.as_str())
10182 .header(USER_AGENT, self.hub._user_agent.clone());
10183
10184 if let Some(token) = token.as_ref() {
10185 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10186 }
10187
10188 let request = req_builder
10189 .header(CONTENT_LENGTH, 0_u64)
10190 .body(common::to_body::<String>(None));
10191
10192 client.request(request.unwrap()).await
10193 };
10194
10195 match req_result {
10196 Err(err) => {
10197 if let common::Retry::After(d) = dlg.http_error(&err) {
10198 sleep(d).await;
10199 continue;
10200 }
10201 dlg.finished(false);
10202 return Err(common::Error::HttpError(err));
10203 }
10204 Ok(res) => {
10205 let (mut parts, body) = res.into_parts();
10206 let mut body = common::Body::new(body);
10207 if !parts.status.is_success() {
10208 let bytes = common::to_bytes(body).await.unwrap_or_default();
10209 let error = serde_json::from_str(&common::to_string(&bytes));
10210 let response = common::to_response(parts, bytes.into());
10211
10212 if let common::Retry::After(d) =
10213 dlg.http_failure(&response, error.as_ref().ok())
10214 {
10215 sleep(d).await;
10216 continue;
10217 }
10218
10219 dlg.finished(false);
10220
10221 return Err(match error {
10222 Ok(value) => common::Error::BadRequest(value),
10223 _ => common::Error::Failure(response),
10224 });
10225 }
10226 let response = {
10227 let bytes = common::to_bytes(body).await.unwrap_or_default();
10228 let encoded = common::to_string(&bytes);
10229 match serde_json::from_str(&encoded) {
10230 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10231 Err(error) => {
10232 dlg.response_json_decode_error(&encoded, &error);
10233 return Err(common::Error::JsonDecodeError(
10234 encoded.to_string(),
10235 error,
10236 ));
10237 }
10238 }
10239 };
10240
10241 dlg.finished(true);
10242 return Ok(response);
10243 }
10244 }
10245 }
10246 }
10247
10248 /// Required. The name of the stream object resource to get.
10249 ///
10250 /// Sets the *name* path property to the given value.
10251 ///
10252 /// Even though the property as already been set when instantiating this call,
10253 /// we provide this method for API completeness.
10254 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamObjectGetCall<'a, C> {
10255 self._name = new_value.to_string();
10256 self
10257 }
10258 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10259 /// while executing the actual API request.
10260 ///
10261 /// ````text
10262 /// It should be used to handle progress information, and to implement a certain level of resilience.
10263 /// ````
10264 ///
10265 /// Sets the *delegate* property to the given value.
10266 pub fn delegate(
10267 mut self,
10268 new_value: &'a mut dyn common::Delegate,
10269 ) -> ProjectLocationStreamObjectGetCall<'a, C> {
10270 self._delegate = Some(new_value);
10271 self
10272 }
10273
10274 /// Set any additional parameter of the query string used in the request.
10275 /// It should be used to set parameters which are not yet available through their own
10276 /// setters.
10277 ///
10278 /// Please note that this method must not be used to set any of the known parameters
10279 /// which have their own setter method. If done anyway, the request will fail.
10280 ///
10281 /// # Additional Parameters
10282 ///
10283 /// * *$.xgafv* (query-string) - V1 error format.
10284 /// * *access_token* (query-string) - OAuth access token.
10285 /// * *alt* (query-string) - Data format for response.
10286 /// * *callback* (query-string) - JSONP
10287 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10288 /// * *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.
10289 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10290 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10291 /// * *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.
10292 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10293 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10294 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectGetCall<'a, C>
10295 where
10296 T: AsRef<str>,
10297 {
10298 self._additional_params
10299 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10300 self
10301 }
10302
10303 /// Identifies the authorization scope for the method you are building.
10304 ///
10305 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10306 /// [`Scope::CloudPlatform`].
10307 ///
10308 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10309 /// tokens for more than one scope.
10310 ///
10311 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10312 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10313 /// sufficient, a read-write scope will do as well.
10314 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectGetCall<'a, C>
10315 where
10316 St: AsRef<str>,
10317 {
10318 self._scopes.insert(String::from(scope.as_ref()));
10319 self
10320 }
10321 /// Identifies the authorization scope(s) for the method you are building.
10322 ///
10323 /// See [`Self::add_scope()`] for details.
10324 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectGetCall<'a, C>
10325 where
10326 I: IntoIterator<Item = St>,
10327 St: AsRef<str>,
10328 {
10329 self._scopes
10330 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10331 self
10332 }
10333
10334 /// Removes all scopes, and no default scope will be used either.
10335 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10336 /// for details).
10337 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectGetCall<'a, C> {
10338 self._scopes.clear();
10339 self
10340 }
10341}
10342
10343/// Use this method to list the objects of a specific stream.
10344///
10345/// A builder for the *locations.streams.objects.list* method supported by a *project* resource.
10346/// It is not used directly, but through a [`ProjectMethods`] instance.
10347///
10348/// # Example
10349///
10350/// Instantiate a resource method builder
10351///
10352/// ```test_harness,no_run
10353/// # extern crate hyper;
10354/// # extern crate hyper_rustls;
10355/// # extern crate google_datastream1 as datastream1;
10356/// # async fn dox() {
10357/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10358///
10359/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10360/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10361/// # .with_native_roots()
10362/// # .unwrap()
10363/// # .https_only()
10364/// # .enable_http2()
10365/// # .build();
10366///
10367/// # let executor = hyper_util::rt::TokioExecutor::new();
10368/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10369/// # secret,
10370/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10371/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10372/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10373/// # ),
10374/// # ).build().await.unwrap();
10375///
10376/// # let client = hyper_util::client::legacy::Client::builder(
10377/// # hyper_util::rt::TokioExecutor::new()
10378/// # )
10379/// # .build(
10380/// # hyper_rustls::HttpsConnectorBuilder::new()
10381/// # .with_native_roots()
10382/// # .unwrap()
10383/// # .https_or_http()
10384/// # .enable_http2()
10385/// # .build()
10386/// # );
10387/// # let mut hub = Datastream::new(client, auth);
10388/// // You can configure optional parameters by calling the respective setters at will, and
10389/// // execute the final call using `doit()`.
10390/// // Values shown here are possibly random and not representative !
10391/// let result = hub.projects().locations_streams_objects_list("parent")
10392/// .page_token("amet.")
10393/// .page_size(-30)
10394/// .doit().await;
10395/// # }
10396/// ```
10397pub struct ProjectLocationStreamObjectListCall<'a, C>
10398where
10399 C: 'a,
10400{
10401 hub: &'a Datastream<C>,
10402 _parent: String,
10403 _page_token: Option<String>,
10404 _page_size: Option<i32>,
10405 _delegate: Option<&'a mut dyn common::Delegate>,
10406 _additional_params: HashMap<String, String>,
10407 _scopes: BTreeSet<String>,
10408}
10409
10410impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectListCall<'a, C> {}
10411
10412impl<'a, C> ProjectLocationStreamObjectListCall<'a, C>
10413where
10414 C: common::Connector,
10415{
10416 /// Perform the operation you have build so far.
10417 pub async fn doit(mut self) -> common::Result<(common::Response, ListStreamObjectsResponse)> {
10418 use std::borrow::Cow;
10419 use std::io::{Read, Seek};
10420
10421 use common::{url::Params, ToParts};
10422 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10423
10424 let mut dd = common::DefaultDelegate;
10425 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10426 dlg.begin(common::MethodInfo {
10427 id: "datastream.projects.locations.streams.objects.list",
10428 http_method: hyper::Method::GET,
10429 });
10430
10431 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
10432 if self._additional_params.contains_key(field) {
10433 dlg.finished(false);
10434 return Err(common::Error::FieldClash(field));
10435 }
10436 }
10437
10438 let mut params = Params::with_capacity(5 + self._additional_params.len());
10439 params.push("parent", self._parent);
10440 if let Some(value) = self._page_token.as_ref() {
10441 params.push("pageToken", value);
10442 }
10443 if let Some(value) = self._page_size.as_ref() {
10444 params.push("pageSize", value.to_string());
10445 }
10446
10447 params.extend(self._additional_params.iter());
10448
10449 params.push("alt", "json");
10450 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects";
10451 if self._scopes.is_empty() {
10452 self._scopes
10453 .insert(Scope::CloudPlatform.as_ref().to_string());
10454 }
10455
10456 #[allow(clippy::single_element_loop)]
10457 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10458 url = params.uri_replacement(url, param_name, find_this, true);
10459 }
10460 {
10461 let to_remove = ["parent"];
10462 params.remove_params(&to_remove);
10463 }
10464
10465 let url = params.parse_with_url(&url);
10466
10467 loop {
10468 let token = match self
10469 .hub
10470 .auth
10471 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10472 .await
10473 {
10474 Ok(token) => token,
10475 Err(e) => match dlg.token(e) {
10476 Ok(token) => token,
10477 Err(e) => {
10478 dlg.finished(false);
10479 return Err(common::Error::MissingToken(e));
10480 }
10481 },
10482 };
10483 let mut req_result = {
10484 let client = &self.hub.client;
10485 dlg.pre_request();
10486 let mut req_builder = hyper::Request::builder()
10487 .method(hyper::Method::GET)
10488 .uri(url.as_str())
10489 .header(USER_AGENT, self.hub._user_agent.clone());
10490
10491 if let Some(token) = token.as_ref() {
10492 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10493 }
10494
10495 let request = req_builder
10496 .header(CONTENT_LENGTH, 0_u64)
10497 .body(common::to_body::<String>(None));
10498
10499 client.request(request.unwrap()).await
10500 };
10501
10502 match req_result {
10503 Err(err) => {
10504 if let common::Retry::After(d) = dlg.http_error(&err) {
10505 sleep(d).await;
10506 continue;
10507 }
10508 dlg.finished(false);
10509 return Err(common::Error::HttpError(err));
10510 }
10511 Ok(res) => {
10512 let (mut parts, body) = res.into_parts();
10513 let mut body = common::Body::new(body);
10514 if !parts.status.is_success() {
10515 let bytes = common::to_bytes(body).await.unwrap_or_default();
10516 let error = serde_json::from_str(&common::to_string(&bytes));
10517 let response = common::to_response(parts, bytes.into());
10518
10519 if let common::Retry::After(d) =
10520 dlg.http_failure(&response, error.as_ref().ok())
10521 {
10522 sleep(d).await;
10523 continue;
10524 }
10525
10526 dlg.finished(false);
10527
10528 return Err(match error {
10529 Ok(value) => common::Error::BadRequest(value),
10530 _ => common::Error::Failure(response),
10531 });
10532 }
10533 let response = {
10534 let bytes = common::to_bytes(body).await.unwrap_or_default();
10535 let encoded = common::to_string(&bytes);
10536 match serde_json::from_str(&encoded) {
10537 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10538 Err(error) => {
10539 dlg.response_json_decode_error(&encoded, &error);
10540 return Err(common::Error::JsonDecodeError(
10541 encoded.to_string(),
10542 error,
10543 ));
10544 }
10545 }
10546 };
10547
10548 dlg.finished(true);
10549 return Ok(response);
10550 }
10551 }
10552 }
10553 }
10554
10555 /// Required. The parent stream that owns the collection of objects.
10556 ///
10557 /// Sets the *parent* path property to the given value.
10558 ///
10559 /// Even though the property as already been set when instantiating this call,
10560 /// we provide this method for API completeness.
10561 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamObjectListCall<'a, C> {
10562 self._parent = new_value.to_string();
10563 self
10564 }
10565 /// Page token received from a previous `ListStreamObjectsRequest` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListStreamObjectsRequest` must match the call that provided the page token.
10566 ///
10567 /// Sets the *page token* query property to the given value.
10568 pub fn page_token(mut self, new_value: &str) -> ProjectLocationStreamObjectListCall<'a, C> {
10569 self._page_token = Some(new_value.to_string());
10570 self
10571 }
10572 /// Maximum number of objects to return. Default is 50. The maximum value is 1000; values above 1000 will be coerced to 1000.
10573 ///
10574 /// Sets the *page size* query property to the given value.
10575 pub fn page_size(mut self, new_value: i32) -> ProjectLocationStreamObjectListCall<'a, C> {
10576 self._page_size = Some(new_value);
10577 self
10578 }
10579 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10580 /// while executing the actual API request.
10581 ///
10582 /// ````text
10583 /// It should be used to handle progress information, and to implement a certain level of resilience.
10584 /// ````
10585 ///
10586 /// Sets the *delegate* property to the given value.
10587 pub fn delegate(
10588 mut self,
10589 new_value: &'a mut dyn common::Delegate,
10590 ) -> ProjectLocationStreamObjectListCall<'a, C> {
10591 self._delegate = Some(new_value);
10592 self
10593 }
10594
10595 /// Set any additional parameter of the query string used in the request.
10596 /// It should be used to set parameters which are not yet available through their own
10597 /// setters.
10598 ///
10599 /// Please note that this method must not be used to set any of the known parameters
10600 /// which have their own setter method. If done anyway, the request will fail.
10601 ///
10602 /// # Additional Parameters
10603 ///
10604 /// * *$.xgafv* (query-string) - V1 error format.
10605 /// * *access_token* (query-string) - OAuth access token.
10606 /// * *alt* (query-string) - Data format for response.
10607 /// * *callback* (query-string) - JSONP
10608 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10609 /// * *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.
10610 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10611 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10612 /// * *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.
10613 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10614 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10615 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectListCall<'a, C>
10616 where
10617 T: AsRef<str>,
10618 {
10619 self._additional_params
10620 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10621 self
10622 }
10623
10624 /// Identifies the authorization scope for the method you are building.
10625 ///
10626 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10627 /// [`Scope::CloudPlatform`].
10628 ///
10629 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10630 /// tokens for more than one scope.
10631 ///
10632 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10633 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10634 /// sufficient, a read-write scope will do as well.
10635 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectListCall<'a, C>
10636 where
10637 St: AsRef<str>,
10638 {
10639 self._scopes.insert(String::from(scope.as_ref()));
10640 self
10641 }
10642 /// Identifies the authorization scope(s) for the method you are building.
10643 ///
10644 /// See [`Self::add_scope()`] for details.
10645 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectListCall<'a, C>
10646 where
10647 I: IntoIterator<Item = St>,
10648 St: AsRef<str>,
10649 {
10650 self._scopes
10651 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10652 self
10653 }
10654
10655 /// Removes all scopes, and no default scope will be used either.
10656 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10657 /// for details).
10658 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectListCall<'a, C> {
10659 self._scopes.clear();
10660 self
10661 }
10662}
10663
10664/// Use this method to look up a stream object by its source object identifier.
10665///
10666/// A builder for the *locations.streams.objects.lookup* method supported by a *project* resource.
10667/// It is not used directly, but through a [`ProjectMethods`] instance.
10668///
10669/// # Example
10670///
10671/// Instantiate a resource method builder
10672///
10673/// ```test_harness,no_run
10674/// # extern crate hyper;
10675/// # extern crate hyper_rustls;
10676/// # extern crate google_datastream1 as datastream1;
10677/// use datastream1::api::LookupStreamObjectRequest;
10678/// # async fn dox() {
10679/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10680///
10681/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10682/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10683/// # .with_native_roots()
10684/// # .unwrap()
10685/// # .https_only()
10686/// # .enable_http2()
10687/// # .build();
10688///
10689/// # let executor = hyper_util::rt::TokioExecutor::new();
10690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10691/// # secret,
10692/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10693/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10694/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10695/// # ),
10696/// # ).build().await.unwrap();
10697///
10698/// # let client = hyper_util::client::legacy::Client::builder(
10699/// # hyper_util::rt::TokioExecutor::new()
10700/// # )
10701/// # .build(
10702/// # hyper_rustls::HttpsConnectorBuilder::new()
10703/// # .with_native_roots()
10704/// # .unwrap()
10705/// # .https_or_http()
10706/// # .enable_http2()
10707/// # .build()
10708/// # );
10709/// # let mut hub = Datastream::new(client, auth);
10710/// // As the method needs a request, you would usually fill it with the desired information
10711/// // into the respective structure. Some of the parts shown here might not be applicable !
10712/// // Values shown here are possibly random and not representative !
10713/// let mut req = LookupStreamObjectRequest::default();
10714///
10715/// // You can configure optional parameters by calling the respective setters at will, and
10716/// // execute the final call using `doit()`.
10717/// // Values shown here are possibly random and not representative !
10718/// let result = hub.projects().locations_streams_objects_lookup(req, "parent")
10719/// .doit().await;
10720/// # }
10721/// ```
10722pub struct ProjectLocationStreamObjectLookupCall<'a, C>
10723where
10724 C: 'a,
10725{
10726 hub: &'a Datastream<C>,
10727 _request: LookupStreamObjectRequest,
10728 _parent: String,
10729 _delegate: Option<&'a mut dyn common::Delegate>,
10730 _additional_params: HashMap<String, String>,
10731 _scopes: BTreeSet<String>,
10732}
10733
10734impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectLookupCall<'a, C> {}
10735
10736impl<'a, C> ProjectLocationStreamObjectLookupCall<'a, C>
10737where
10738 C: common::Connector,
10739{
10740 /// Perform the operation you have build so far.
10741 pub async fn doit(mut self) -> common::Result<(common::Response, StreamObject)> {
10742 use std::borrow::Cow;
10743 use std::io::{Read, Seek};
10744
10745 use common::{url::Params, ToParts};
10746 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10747
10748 let mut dd = common::DefaultDelegate;
10749 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10750 dlg.begin(common::MethodInfo {
10751 id: "datastream.projects.locations.streams.objects.lookup",
10752 http_method: hyper::Method::POST,
10753 });
10754
10755 for &field in ["alt", "parent"].iter() {
10756 if self._additional_params.contains_key(field) {
10757 dlg.finished(false);
10758 return Err(common::Error::FieldClash(field));
10759 }
10760 }
10761
10762 let mut params = Params::with_capacity(4 + self._additional_params.len());
10763 params.push("parent", self._parent);
10764
10765 params.extend(self._additional_params.iter());
10766
10767 params.push("alt", "json");
10768 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects:lookup";
10769 if self._scopes.is_empty() {
10770 self._scopes
10771 .insert(Scope::CloudPlatform.as_ref().to_string());
10772 }
10773
10774 #[allow(clippy::single_element_loop)]
10775 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10776 url = params.uri_replacement(url, param_name, find_this, true);
10777 }
10778 {
10779 let to_remove = ["parent"];
10780 params.remove_params(&to_remove);
10781 }
10782
10783 let url = params.parse_with_url(&url);
10784
10785 let mut json_mime_type = mime::APPLICATION_JSON;
10786 let mut request_value_reader = {
10787 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10788 common::remove_json_null_values(&mut value);
10789 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10790 serde_json::to_writer(&mut dst, &value).unwrap();
10791 dst
10792 };
10793 let request_size = request_value_reader
10794 .seek(std::io::SeekFrom::End(0))
10795 .unwrap();
10796 request_value_reader
10797 .seek(std::io::SeekFrom::Start(0))
10798 .unwrap();
10799
10800 loop {
10801 let token = match self
10802 .hub
10803 .auth
10804 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10805 .await
10806 {
10807 Ok(token) => token,
10808 Err(e) => match dlg.token(e) {
10809 Ok(token) => token,
10810 Err(e) => {
10811 dlg.finished(false);
10812 return Err(common::Error::MissingToken(e));
10813 }
10814 },
10815 };
10816 request_value_reader
10817 .seek(std::io::SeekFrom::Start(0))
10818 .unwrap();
10819 let mut req_result = {
10820 let client = &self.hub.client;
10821 dlg.pre_request();
10822 let mut req_builder = hyper::Request::builder()
10823 .method(hyper::Method::POST)
10824 .uri(url.as_str())
10825 .header(USER_AGENT, self.hub._user_agent.clone());
10826
10827 if let Some(token) = token.as_ref() {
10828 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10829 }
10830
10831 let request = req_builder
10832 .header(CONTENT_TYPE, json_mime_type.to_string())
10833 .header(CONTENT_LENGTH, request_size as u64)
10834 .body(common::to_body(
10835 request_value_reader.get_ref().clone().into(),
10836 ));
10837
10838 client.request(request.unwrap()).await
10839 };
10840
10841 match req_result {
10842 Err(err) => {
10843 if let common::Retry::After(d) = dlg.http_error(&err) {
10844 sleep(d).await;
10845 continue;
10846 }
10847 dlg.finished(false);
10848 return Err(common::Error::HttpError(err));
10849 }
10850 Ok(res) => {
10851 let (mut parts, body) = res.into_parts();
10852 let mut body = common::Body::new(body);
10853 if !parts.status.is_success() {
10854 let bytes = common::to_bytes(body).await.unwrap_or_default();
10855 let error = serde_json::from_str(&common::to_string(&bytes));
10856 let response = common::to_response(parts, bytes.into());
10857
10858 if let common::Retry::After(d) =
10859 dlg.http_failure(&response, error.as_ref().ok())
10860 {
10861 sleep(d).await;
10862 continue;
10863 }
10864
10865 dlg.finished(false);
10866
10867 return Err(match error {
10868 Ok(value) => common::Error::BadRequest(value),
10869 _ => common::Error::Failure(response),
10870 });
10871 }
10872 let response = {
10873 let bytes = common::to_bytes(body).await.unwrap_or_default();
10874 let encoded = common::to_string(&bytes);
10875 match serde_json::from_str(&encoded) {
10876 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10877 Err(error) => {
10878 dlg.response_json_decode_error(&encoded, &error);
10879 return Err(common::Error::JsonDecodeError(
10880 encoded.to_string(),
10881 error,
10882 ));
10883 }
10884 }
10885 };
10886
10887 dlg.finished(true);
10888 return Ok(response);
10889 }
10890 }
10891 }
10892 }
10893
10894 ///
10895 /// Sets the *request* property to the given value.
10896 ///
10897 /// Even though the property as already been set when instantiating this call,
10898 /// we provide this method for API completeness.
10899 pub fn request(
10900 mut self,
10901 new_value: LookupStreamObjectRequest,
10902 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
10903 self._request = new_value;
10904 self
10905 }
10906 /// Required. The parent stream that owns the collection of objects.
10907 ///
10908 /// Sets the *parent* path property to the given value.
10909 ///
10910 /// Even though the property as already been set when instantiating this call,
10911 /// we provide this method for API completeness.
10912 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamObjectLookupCall<'a, C> {
10913 self._parent = new_value.to_string();
10914 self
10915 }
10916 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10917 /// while executing the actual API request.
10918 ///
10919 /// ````text
10920 /// It should be used to handle progress information, and to implement a certain level of resilience.
10921 /// ````
10922 ///
10923 /// Sets the *delegate* property to the given value.
10924 pub fn delegate(
10925 mut self,
10926 new_value: &'a mut dyn common::Delegate,
10927 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
10928 self._delegate = Some(new_value);
10929 self
10930 }
10931
10932 /// Set any additional parameter of the query string used in the request.
10933 /// It should be used to set parameters which are not yet available through their own
10934 /// setters.
10935 ///
10936 /// Please note that this method must not be used to set any of the known parameters
10937 /// which have their own setter method. If done anyway, the request will fail.
10938 ///
10939 /// # Additional Parameters
10940 ///
10941 /// * *$.xgafv* (query-string) - V1 error format.
10942 /// * *access_token* (query-string) - OAuth access token.
10943 /// * *alt* (query-string) - Data format for response.
10944 /// * *callback* (query-string) - JSONP
10945 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10946 /// * *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.
10947 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10948 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10949 /// * *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.
10950 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10951 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10952 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectLookupCall<'a, C>
10953 where
10954 T: AsRef<str>,
10955 {
10956 self._additional_params
10957 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10958 self
10959 }
10960
10961 /// Identifies the authorization scope for the method you are building.
10962 ///
10963 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10964 /// [`Scope::CloudPlatform`].
10965 ///
10966 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10967 /// tokens for more than one scope.
10968 ///
10969 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10970 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10971 /// sufficient, a read-write scope will do as well.
10972 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectLookupCall<'a, C>
10973 where
10974 St: AsRef<str>,
10975 {
10976 self._scopes.insert(String::from(scope.as_ref()));
10977 self
10978 }
10979 /// Identifies the authorization scope(s) for the method you are building.
10980 ///
10981 /// See [`Self::add_scope()`] for details.
10982 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectLookupCall<'a, C>
10983 where
10984 I: IntoIterator<Item = St>,
10985 St: AsRef<str>,
10986 {
10987 self._scopes
10988 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10989 self
10990 }
10991
10992 /// Removes all scopes, and no default scope will be used either.
10993 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10994 /// for details).
10995 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectLookupCall<'a, C> {
10996 self._scopes.clear();
10997 self
10998 }
10999}
11000
11001/// Use this method to start a backfill job for the specified stream object.
11002///
11003/// A builder for the *locations.streams.objects.startBackfillJob* method supported by a *project* resource.
11004/// It is not used directly, but through a [`ProjectMethods`] instance.
11005///
11006/// # Example
11007///
11008/// Instantiate a resource method builder
11009///
11010/// ```test_harness,no_run
11011/// # extern crate hyper;
11012/// # extern crate hyper_rustls;
11013/// # extern crate google_datastream1 as datastream1;
11014/// use datastream1::api::StartBackfillJobRequest;
11015/// # async fn dox() {
11016/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11017///
11018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11020/// # .with_native_roots()
11021/// # .unwrap()
11022/// # .https_only()
11023/// # .enable_http2()
11024/// # .build();
11025///
11026/// # let executor = hyper_util::rt::TokioExecutor::new();
11027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11028/// # secret,
11029/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11030/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11031/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11032/// # ),
11033/// # ).build().await.unwrap();
11034///
11035/// # let client = hyper_util::client::legacy::Client::builder(
11036/// # hyper_util::rt::TokioExecutor::new()
11037/// # )
11038/// # .build(
11039/// # hyper_rustls::HttpsConnectorBuilder::new()
11040/// # .with_native_roots()
11041/// # .unwrap()
11042/// # .https_or_http()
11043/// # .enable_http2()
11044/// # .build()
11045/// # );
11046/// # let mut hub = Datastream::new(client, auth);
11047/// // As the method needs a request, you would usually fill it with the desired information
11048/// // into the respective structure. Some of the parts shown here might not be applicable !
11049/// // Values shown here are possibly random and not representative !
11050/// let mut req = StartBackfillJobRequest::default();
11051///
11052/// // You can configure optional parameters by calling the respective setters at will, and
11053/// // execute the final call using `doit()`.
11054/// // Values shown here are possibly random and not representative !
11055/// let result = hub.projects().locations_streams_objects_start_backfill_job(req, "object")
11056/// .doit().await;
11057/// # }
11058/// ```
11059pub struct ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
11060where
11061 C: 'a,
11062{
11063 hub: &'a Datastream<C>,
11064 _request: StartBackfillJobRequest,
11065 _object: String,
11066 _delegate: Option<&'a mut dyn common::Delegate>,
11067 _additional_params: HashMap<String, String>,
11068 _scopes: BTreeSet<String>,
11069}
11070
11071impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {}
11072
11073impl<'a, C> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
11074where
11075 C: common::Connector,
11076{
11077 /// Perform the operation you have build so far.
11078 pub async fn doit(mut self) -> common::Result<(common::Response, StartBackfillJobResponse)> {
11079 use std::borrow::Cow;
11080 use std::io::{Read, Seek};
11081
11082 use common::{url::Params, ToParts};
11083 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11084
11085 let mut dd = common::DefaultDelegate;
11086 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11087 dlg.begin(common::MethodInfo {
11088 id: "datastream.projects.locations.streams.objects.startBackfillJob",
11089 http_method: hyper::Method::POST,
11090 });
11091
11092 for &field in ["alt", "object"].iter() {
11093 if self._additional_params.contains_key(field) {
11094 dlg.finished(false);
11095 return Err(common::Error::FieldClash(field));
11096 }
11097 }
11098
11099 let mut params = Params::with_capacity(4 + self._additional_params.len());
11100 params.push("object", self._object);
11101
11102 params.extend(self._additional_params.iter());
11103
11104 params.push("alt", "json");
11105 let mut url = self.hub._base_url.clone() + "v1/{+object}:startBackfillJob";
11106 if self._scopes.is_empty() {
11107 self._scopes
11108 .insert(Scope::CloudPlatform.as_ref().to_string());
11109 }
11110
11111 #[allow(clippy::single_element_loop)]
11112 for &(find_this, param_name) in [("{+object}", "object")].iter() {
11113 url = params.uri_replacement(url, param_name, find_this, true);
11114 }
11115 {
11116 let to_remove = ["object"];
11117 params.remove_params(&to_remove);
11118 }
11119
11120 let url = params.parse_with_url(&url);
11121
11122 let mut json_mime_type = mime::APPLICATION_JSON;
11123 let mut request_value_reader = {
11124 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11125 common::remove_json_null_values(&mut value);
11126 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11127 serde_json::to_writer(&mut dst, &value).unwrap();
11128 dst
11129 };
11130 let request_size = request_value_reader
11131 .seek(std::io::SeekFrom::End(0))
11132 .unwrap();
11133 request_value_reader
11134 .seek(std::io::SeekFrom::Start(0))
11135 .unwrap();
11136
11137 loop {
11138 let token = match self
11139 .hub
11140 .auth
11141 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11142 .await
11143 {
11144 Ok(token) => token,
11145 Err(e) => match dlg.token(e) {
11146 Ok(token) => token,
11147 Err(e) => {
11148 dlg.finished(false);
11149 return Err(common::Error::MissingToken(e));
11150 }
11151 },
11152 };
11153 request_value_reader
11154 .seek(std::io::SeekFrom::Start(0))
11155 .unwrap();
11156 let mut req_result = {
11157 let client = &self.hub.client;
11158 dlg.pre_request();
11159 let mut req_builder = hyper::Request::builder()
11160 .method(hyper::Method::POST)
11161 .uri(url.as_str())
11162 .header(USER_AGENT, self.hub._user_agent.clone());
11163
11164 if let Some(token) = token.as_ref() {
11165 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11166 }
11167
11168 let request = req_builder
11169 .header(CONTENT_TYPE, json_mime_type.to_string())
11170 .header(CONTENT_LENGTH, request_size as u64)
11171 .body(common::to_body(
11172 request_value_reader.get_ref().clone().into(),
11173 ));
11174
11175 client.request(request.unwrap()).await
11176 };
11177
11178 match req_result {
11179 Err(err) => {
11180 if let common::Retry::After(d) = dlg.http_error(&err) {
11181 sleep(d).await;
11182 continue;
11183 }
11184 dlg.finished(false);
11185 return Err(common::Error::HttpError(err));
11186 }
11187 Ok(res) => {
11188 let (mut parts, body) = res.into_parts();
11189 let mut body = common::Body::new(body);
11190 if !parts.status.is_success() {
11191 let bytes = common::to_bytes(body).await.unwrap_or_default();
11192 let error = serde_json::from_str(&common::to_string(&bytes));
11193 let response = common::to_response(parts, bytes.into());
11194
11195 if let common::Retry::After(d) =
11196 dlg.http_failure(&response, error.as_ref().ok())
11197 {
11198 sleep(d).await;
11199 continue;
11200 }
11201
11202 dlg.finished(false);
11203
11204 return Err(match error {
11205 Ok(value) => common::Error::BadRequest(value),
11206 _ => common::Error::Failure(response),
11207 });
11208 }
11209 let response = {
11210 let bytes = common::to_bytes(body).await.unwrap_or_default();
11211 let encoded = common::to_string(&bytes);
11212 match serde_json::from_str(&encoded) {
11213 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11214 Err(error) => {
11215 dlg.response_json_decode_error(&encoded, &error);
11216 return Err(common::Error::JsonDecodeError(
11217 encoded.to_string(),
11218 error,
11219 ));
11220 }
11221 }
11222 };
11223
11224 dlg.finished(true);
11225 return Ok(response);
11226 }
11227 }
11228 }
11229 }
11230
11231 ///
11232 /// Sets the *request* property to the given value.
11233 ///
11234 /// Even though the property as already been set when instantiating this call,
11235 /// we provide this method for API completeness.
11236 pub fn request(
11237 mut self,
11238 new_value: StartBackfillJobRequest,
11239 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
11240 self._request = new_value;
11241 self
11242 }
11243 /// Required. The name of the stream object resource to start a backfill job for.
11244 ///
11245 /// Sets the *object* path property to the given value.
11246 ///
11247 /// Even though the property as already been set when instantiating this call,
11248 /// we provide this method for API completeness.
11249 pub fn object(
11250 mut self,
11251 new_value: &str,
11252 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
11253 self._object = new_value.to_string();
11254 self
11255 }
11256 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11257 /// while executing the actual API request.
11258 ///
11259 /// ````text
11260 /// It should be used to handle progress information, and to implement a certain level of resilience.
11261 /// ````
11262 ///
11263 /// Sets the *delegate* property to the given value.
11264 pub fn delegate(
11265 mut self,
11266 new_value: &'a mut dyn common::Delegate,
11267 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
11268 self._delegate = Some(new_value);
11269 self
11270 }
11271
11272 /// Set any additional parameter of the query string used in the request.
11273 /// It should be used to set parameters which are not yet available through their own
11274 /// setters.
11275 ///
11276 /// Please note that this method must not be used to set any of the known parameters
11277 /// which have their own setter method. If done anyway, the request will fail.
11278 ///
11279 /// # Additional Parameters
11280 ///
11281 /// * *$.xgafv* (query-string) - V1 error format.
11282 /// * *access_token* (query-string) - OAuth access token.
11283 /// * *alt* (query-string) - Data format for response.
11284 /// * *callback* (query-string) - JSONP
11285 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11286 /// * *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.
11287 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11288 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11289 /// * *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.
11290 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11291 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11292 pub fn param<T>(
11293 mut self,
11294 name: T,
11295 value: T,
11296 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
11297 where
11298 T: AsRef<str>,
11299 {
11300 self._additional_params
11301 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11302 self
11303 }
11304
11305 /// Identifies the authorization scope for the method you are building.
11306 ///
11307 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11308 /// [`Scope::CloudPlatform`].
11309 ///
11310 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11311 /// tokens for more than one scope.
11312 ///
11313 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11314 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11315 /// sufficient, a read-write scope will do as well.
11316 pub fn add_scope<St>(
11317 mut self,
11318 scope: St,
11319 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
11320 where
11321 St: AsRef<str>,
11322 {
11323 self._scopes.insert(String::from(scope.as_ref()));
11324 self
11325 }
11326 /// Identifies the authorization scope(s) for the method you are building.
11327 ///
11328 /// See [`Self::add_scope()`] for details.
11329 pub fn add_scopes<I, St>(
11330 mut self,
11331 scopes: I,
11332 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
11333 where
11334 I: IntoIterator<Item = St>,
11335 St: AsRef<str>,
11336 {
11337 self._scopes
11338 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11339 self
11340 }
11341
11342 /// Removes all scopes, and no default scope will be used either.
11343 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11344 /// for details).
11345 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
11346 self._scopes.clear();
11347 self
11348 }
11349}
11350
11351/// Use this method to stop a backfill job for the specified stream object.
11352///
11353/// A builder for the *locations.streams.objects.stopBackfillJob* method supported by a *project* resource.
11354/// It is not used directly, but through a [`ProjectMethods`] instance.
11355///
11356/// # Example
11357///
11358/// Instantiate a resource method builder
11359///
11360/// ```test_harness,no_run
11361/// # extern crate hyper;
11362/// # extern crate hyper_rustls;
11363/// # extern crate google_datastream1 as datastream1;
11364/// use datastream1::api::StopBackfillJobRequest;
11365/// # async fn dox() {
11366/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11367///
11368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11370/// # .with_native_roots()
11371/// # .unwrap()
11372/// # .https_only()
11373/// # .enable_http2()
11374/// # .build();
11375///
11376/// # let executor = hyper_util::rt::TokioExecutor::new();
11377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11378/// # secret,
11379/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11380/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11381/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11382/// # ),
11383/// # ).build().await.unwrap();
11384///
11385/// # let client = hyper_util::client::legacy::Client::builder(
11386/// # hyper_util::rt::TokioExecutor::new()
11387/// # )
11388/// # .build(
11389/// # hyper_rustls::HttpsConnectorBuilder::new()
11390/// # .with_native_roots()
11391/// # .unwrap()
11392/// # .https_or_http()
11393/// # .enable_http2()
11394/// # .build()
11395/// # );
11396/// # let mut hub = Datastream::new(client, auth);
11397/// // As the method needs a request, you would usually fill it with the desired information
11398/// // into the respective structure. Some of the parts shown here might not be applicable !
11399/// // Values shown here are possibly random and not representative !
11400/// let mut req = StopBackfillJobRequest::default();
11401///
11402/// // You can configure optional parameters by calling the respective setters at will, and
11403/// // execute the final call using `doit()`.
11404/// // Values shown here are possibly random and not representative !
11405/// let result = hub.projects().locations_streams_objects_stop_backfill_job(req, "object")
11406/// .doit().await;
11407/// # }
11408/// ```
11409pub struct ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
11410where
11411 C: 'a,
11412{
11413 hub: &'a Datastream<C>,
11414 _request: StopBackfillJobRequest,
11415 _object: String,
11416 _delegate: Option<&'a mut dyn common::Delegate>,
11417 _additional_params: HashMap<String, String>,
11418 _scopes: BTreeSet<String>,
11419}
11420
11421impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {}
11422
11423impl<'a, C> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
11424where
11425 C: common::Connector,
11426{
11427 /// Perform the operation you have build so far.
11428 pub async fn doit(mut self) -> common::Result<(common::Response, StopBackfillJobResponse)> {
11429 use std::borrow::Cow;
11430 use std::io::{Read, Seek};
11431
11432 use common::{url::Params, ToParts};
11433 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11434
11435 let mut dd = common::DefaultDelegate;
11436 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11437 dlg.begin(common::MethodInfo {
11438 id: "datastream.projects.locations.streams.objects.stopBackfillJob",
11439 http_method: hyper::Method::POST,
11440 });
11441
11442 for &field in ["alt", "object"].iter() {
11443 if self._additional_params.contains_key(field) {
11444 dlg.finished(false);
11445 return Err(common::Error::FieldClash(field));
11446 }
11447 }
11448
11449 let mut params = Params::with_capacity(4 + self._additional_params.len());
11450 params.push("object", self._object);
11451
11452 params.extend(self._additional_params.iter());
11453
11454 params.push("alt", "json");
11455 let mut url = self.hub._base_url.clone() + "v1/{+object}:stopBackfillJob";
11456 if self._scopes.is_empty() {
11457 self._scopes
11458 .insert(Scope::CloudPlatform.as_ref().to_string());
11459 }
11460
11461 #[allow(clippy::single_element_loop)]
11462 for &(find_this, param_name) in [("{+object}", "object")].iter() {
11463 url = params.uri_replacement(url, param_name, find_this, true);
11464 }
11465 {
11466 let to_remove = ["object"];
11467 params.remove_params(&to_remove);
11468 }
11469
11470 let url = params.parse_with_url(&url);
11471
11472 let mut json_mime_type = mime::APPLICATION_JSON;
11473 let mut request_value_reader = {
11474 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11475 common::remove_json_null_values(&mut value);
11476 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11477 serde_json::to_writer(&mut dst, &value).unwrap();
11478 dst
11479 };
11480 let request_size = request_value_reader
11481 .seek(std::io::SeekFrom::End(0))
11482 .unwrap();
11483 request_value_reader
11484 .seek(std::io::SeekFrom::Start(0))
11485 .unwrap();
11486
11487 loop {
11488 let token = match self
11489 .hub
11490 .auth
11491 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11492 .await
11493 {
11494 Ok(token) => token,
11495 Err(e) => match dlg.token(e) {
11496 Ok(token) => token,
11497 Err(e) => {
11498 dlg.finished(false);
11499 return Err(common::Error::MissingToken(e));
11500 }
11501 },
11502 };
11503 request_value_reader
11504 .seek(std::io::SeekFrom::Start(0))
11505 .unwrap();
11506 let mut req_result = {
11507 let client = &self.hub.client;
11508 dlg.pre_request();
11509 let mut req_builder = hyper::Request::builder()
11510 .method(hyper::Method::POST)
11511 .uri(url.as_str())
11512 .header(USER_AGENT, self.hub._user_agent.clone());
11513
11514 if let Some(token) = token.as_ref() {
11515 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11516 }
11517
11518 let request = req_builder
11519 .header(CONTENT_TYPE, json_mime_type.to_string())
11520 .header(CONTENT_LENGTH, request_size as u64)
11521 .body(common::to_body(
11522 request_value_reader.get_ref().clone().into(),
11523 ));
11524
11525 client.request(request.unwrap()).await
11526 };
11527
11528 match req_result {
11529 Err(err) => {
11530 if let common::Retry::After(d) = dlg.http_error(&err) {
11531 sleep(d).await;
11532 continue;
11533 }
11534 dlg.finished(false);
11535 return Err(common::Error::HttpError(err));
11536 }
11537 Ok(res) => {
11538 let (mut parts, body) = res.into_parts();
11539 let mut body = common::Body::new(body);
11540 if !parts.status.is_success() {
11541 let bytes = common::to_bytes(body).await.unwrap_or_default();
11542 let error = serde_json::from_str(&common::to_string(&bytes));
11543 let response = common::to_response(parts, bytes.into());
11544
11545 if let common::Retry::After(d) =
11546 dlg.http_failure(&response, error.as_ref().ok())
11547 {
11548 sleep(d).await;
11549 continue;
11550 }
11551
11552 dlg.finished(false);
11553
11554 return Err(match error {
11555 Ok(value) => common::Error::BadRequest(value),
11556 _ => common::Error::Failure(response),
11557 });
11558 }
11559 let response = {
11560 let bytes = common::to_bytes(body).await.unwrap_or_default();
11561 let encoded = common::to_string(&bytes);
11562 match serde_json::from_str(&encoded) {
11563 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11564 Err(error) => {
11565 dlg.response_json_decode_error(&encoded, &error);
11566 return Err(common::Error::JsonDecodeError(
11567 encoded.to_string(),
11568 error,
11569 ));
11570 }
11571 }
11572 };
11573
11574 dlg.finished(true);
11575 return Ok(response);
11576 }
11577 }
11578 }
11579 }
11580
11581 ///
11582 /// Sets the *request* property to the given value.
11583 ///
11584 /// Even though the property as already been set when instantiating this call,
11585 /// we provide this method for API completeness.
11586 pub fn request(
11587 mut self,
11588 new_value: StopBackfillJobRequest,
11589 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
11590 self._request = new_value;
11591 self
11592 }
11593 /// Required. The name of the stream object resource to stop the backfill job for.
11594 ///
11595 /// Sets the *object* path property to the given value.
11596 ///
11597 /// Even though the property as already been set when instantiating this call,
11598 /// we provide this method for API completeness.
11599 pub fn object(
11600 mut self,
11601 new_value: &str,
11602 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
11603 self._object = new_value.to_string();
11604 self
11605 }
11606 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11607 /// while executing the actual API request.
11608 ///
11609 /// ````text
11610 /// It should be used to handle progress information, and to implement a certain level of resilience.
11611 /// ````
11612 ///
11613 /// Sets the *delegate* property to the given value.
11614 pub fn delegate(
11615 mut self,
11616 new_value: &'a mut dyn common::Delegate,
11617 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
11618 self._delegate = Some(new_value);
11619 self
11620 }
11621
11622 /// Set any additional parameter of the query string used in the request.
11623 /// It should be used to set parameters which are not yet available through their own
11624 /// setters.
11625 ///
11626 /// Please note that this method must not be used to set any of the known parameters
11627 /// which have their own setter method. If done anyway, the request will fail.
11628 ///
11629 /// # Additional Parameters
11630 ///
11631 /// * *$.xgafv* (query-string) - V1 error format.
11632 /// * *access_token* (query-string) - OAuth access token.
11633 /// * *alt* (query-string) - Data format for response.
11634 /// * *callback* (query-string) - JSONP
11635 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11636 /// * *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.
11637 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11638 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11639 /// * *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.
11640 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11641 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11642 pub fn param<T>(
11643 mut self,
11644 name: T,
11645 value: T,
11646 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
11647 where
11648 T: AsRef<str>,
11649 {
11650 self._additional_params
11651 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11652 self
11653 }
11654
11655 /// Identifies the authorization scope for the method you are building.
11656 ///
11657 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11658 /// [`Scope::CloudPlatform`].
11659 ///
11660 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11661 /// tokens for more than one scope.
11662 ///
11663 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11664 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11665 /// sufficient, a read-write scope will do as well.
11666 pub fn add_scope<St>(
11667 mut self,
11668 scope: St,
11669 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
11670 where
11671 St: AsRef<str>,
11672 {
11673 self._scopes.insert(String::from(scope.as_ref()));
11674 self
11675 }
11676 /// Identifies the authorization scope(s) for the method you are building.
11677 ///
11678 /// See [`Self::add_scope()`] for details.
11679 pub fn add_scopes<I, St>(
11680 mut self,
11681 scopes: I,
11682 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
11683 where
11684 I: IntoIterator<Item = St>,
11685 St: AsRef<str>,
11686 {
11687 self._scopes
11688 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11689 self
11690 }
11691
11692 /// Removes all scopes, and no default scope will be used either.
11693 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11694 /// for details).
11695 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
11696 self._scopes.clear();
11697 self
11698 }
11699}
11700
11701/// Use this method to create a stream.
11702///
11703/// A builder for the *locations.streams.create* method supported by a *project* resource.
11704/// It is not used directly, but through a [`ProjectMethods`] instance.
11705///
11706/// # Example
11707///
11708/// Instantiate a resource method builder
11709///
11710/// ```test_harness,no_run
11711/// # extern crate hyper;
11712/// # extern crate hyper_rustls;
11713/// # extern crate google_datastream1 as datastream1;
11714/// use datastream1::api::Stream;
11715/// # async fn dox() {
11716/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11717///
11718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11720/// # .with_native_roots()
11721/// # .unwrap()
11722/// # .https_only()
11723/// # .enable_http2()
11724/// # .build();
11725///
11726/// # let executor = hyper_util::rt::TokioExecutor::new();
11727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11728/// # secret,
11729/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11730/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11731/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11732/// # ),
11733/// # ).build().await.unwrap();
11734///
11735/// # let client = hyper_util::client::legacy::Client::builder(
11736/// # hyper_util::rt::TokioExecutor::new()
11737/// # )
11738/// # .build(
11739/// # hyper_rustls::HttpsConnectorBuilder::new()
11740/// # .with_native_roots()
11741/// # .unwrap()
11742/// # .https_or_http()
11743/// # .enable_http2()
11744/// # .build()
11745/// # );
11746/// # let mut hub = Datastream::new(client, auth);
11747/// // As the method needs a request, you would usually fill it with the desired information
11748/// // into the respective structure. Some of the parts shown here might not be applicable !
11749/// // Values shown here are possibly random and not representative !
11750/// let mut req = Stream::default();
11751///
11752/// // You can configure optional parameters by calling the respective setters at will, and
11753/// // execute the final call using `doit()`.
11754/// // Values shown here are possibly random and not representative !
11755/// let result = hub.projects().locations_streams_create(req, "parent")
11756/// .validate_only(false)
11757/// .stream_id("dolore")
11758/// .request_id("dolore")
11759/// .force(false)
11760/// .doit().await;
11761/// # }
11762/// ```
11763pub struct ProjectLocationStreamCreateCall<'a, C>
11764where
11765 C: 'a,
11766{
11767 hub: &'a Datastream<C>,
11768 _request: Stream,
11769 _parent: String,
11770 _validate_only: Option<bool>,
11771 _stream_id: Option<String>,
11772 _request_id: Option<String>,
11773 _force: Option<bool>,
11774 _delegate: Option<&'a mut dyn common::Delegate>,
11775 _additional_params: HashMap<String, String>,
11776 _scopes: BTreeSet<String>,
11777}
11778
11779impl<'a, C> common::CallBuilder for ProjectLocationStreamCreateCall<'a, C> {}
11780
11781impl<'a, C> ProjectLocationStreamCreateCall<'a, C>
11782where
11783 C: common::Connector,
11784{
11785 /// Perform the operation you have build so far.
11786 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11787 use std::borrow::Cow;
11788 use std::io::{Read, Seek};
11789
11790 use common::{url::Params, ToParts};
11791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11792
11793 let mut dd = common::DefaultDelegate;
11794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11795 dlg.begin(common::MethodInfo {
11796 id: "datastream.projects.locations.streams.create",
11797 http_method: hyper::Method::POST,
11798 });
11799
11800 for &field in [
11801 "alt",
11802 "parent",
11803 "validateOnly",
11804 "streamId",
11805 "requestId",
11806 "force",
11807 ]
11808 .iter()
11809 {
11810 if self._additional_params.contains_key(field) {
11811 dlg.finished(false);
11812 return Err(common::Error::FieldClash(field));
11813 }
11814 }
11815
11816 let mut params = Params::with_capacity(8 + self._additional_params.len());
11817 params.push("parent", self._parent);
11818 if let Some(value) = self._validate_only.as_ref() {
11819 params.push("validateOnly", value.to_string());
11820 }
11821 if let Some(value) = self._stream_id.as_ref() {
11822 params.push("streamId", value);
11823 }
11824 if let Some(value) = self._request_id.as_ref() {
11825 params.push("requestId", value);
11826 }
11827 if let Some(value) = self._force.as_ref() {
11828 params.push("force", value.to_string());
11829 }
11830
11831 params.extend(self._additional_params.iter());
11832
11833 params.push("alt", "json");
11834 let mut url = self.hub._base_url.clone() + "v1/{+parent}/streams";
11835 if self._scopes.is_empty() {
11836 self._scopes
11837 .insert(Scope::CloudPlatform.as_ref().to_string());
11838 }
11839
11840 #[allow(clippy::single_element_loop)]
11841 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11842 url = params.uri_replacement(url, param_name, find_this, true);
11843 }
11844 {
11845 let to_remove = ["parent"];
11846 params.remove_params(&to_remove);
11847 }
11848
11849 let url = params.parse_with_url(&url);
11850
11851 let mut json_mime_type = mime::APPLICATION_JSON;
11852 let mut request_value_reader = {
11853 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11854 common::remove_json_null_values(&mut value);
11855 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11856 serde_json::to_writer(&mut dst, &value).unwrap();
11857 dst
11858 };
11859 let request_size = request_value_reader
11860 .seek(std::io::SeekFrom::End(0))
11861 .unwrap();
11862 request_value_reader
11863 .seek(std::io::SeekFrom::Start(0))
11864 .unwrap();
11865
11866 loop {
11867 let token = match self
11868 .hub
11869 .auth
11870 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11871 .await
11872 {
11873 Ok(token) => token,
11874 Err(e) => match dlg.token(e) {
11875 Ok(token) => token,
11876 Err(e) => {
11877 dlg.finished(false);
11878 return Err(common::Error::MissingToken(e));
11879 }
11880 },
11881 };
11882 request_value_reader
11883 .seek(std::io::SeekFrom::Start(0))
11884 .unwrap();
11885 let mut req_result = {
11886 let client = &self.hub.client;
11887 dlg.pre_request();
11888 let mut req_builder = hyper::Request::builder()
11889 .method(hyper::Method::POST)
11890 .uri(url.as_str())
11891 .header(USER_AGENT, self.hub._user_agent.clone());
11892
11893 if let Some(token) = token.as_ref() {
11894 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11895 }
11896
11897 let request = req_builder
11898 .header(CONTENT_TYPE, json_mime_type.to_string())
11899 .header(CONTENT_LENGTH, request_size as u64)
11900 .body(common::to_body(
11901 request_value_reader.get_ref().clone().into(),
11902 ));
11903
11904 client.request(request.unwrap()).await
11905 };
11906
11907 match req_result {
11908 Err(err) => {
11909 if let common::Retry::After(d) = dlg.http_error(&err) {
11910 sleep(d).await;
11911 continue;
11912 }
11913 dlg.finished(false);
11914 return Err(common::Error::HttpError(err));
11915 }
11916 Ok(res) => {
11917 let (mut parts, body) = res.into_parts();
11918 let mut body = common::Body::new(body);
11919 if !parts.status.is_success() {
11920 let bytes = common::to_bytes(body).await.unwrap_or_default();
11921 let error = serde_json::from_str(&common::to_string(&bytes));
11922 let response = common::to_response(parts, bytes.into());
11923
11924 if let common::Retry::After(d) =
11925 dlg.http_failure(&response, error.as_ref().ok())
11926 {
11927 sleep(d).await;
11928 continue;
11929 }
11930
11931 dlg.finished(false);
11932
11933 return Err(match error {
11934 Ok(value) => common::Error::BadRequest(value),
11935 _ => common::Error::Failure(response),
11936 });
11937 }
11938 let response = {
11939 let bytes = common::to_bytes(body).await.unwrap_or_default();
11940 let encoded = common::to_string(&bytes);
11941 match serde_json::from_str(&encoded) {
11942 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11943 Err(error) => {
11944 dlg.response_json_decode_error(&encoded, &error);
11945 return Err(common::Error::JsonDecodeError(
11946 encoded.to_string(),
11947 error,
11948 ));
11949 }
11950 }
11951 };
11952
11953 dlg.finished(true);
11954 return Ok(response);
11955 }
11956 }
11957 }
11958 }
11959
11960 ///
11961 /// Sets the *request* property to the given value.
11962 ///
11963 /// Even though the property as already been set when instantiating this call,
11964 /// we provide this method for API completeness.
11965 pub fn request(mut self, new_value: Stream) -> ProjectLocationStreamCreateCall<'a, C> {
11966 self._request = new_value;
11967 self
11968 }
11969 /// Required. The parent that owns the collection of streams.
11970 ///
11971 /// Sets the *parent* path property to the given value.
11972 ///
11973 /// Even though the property as already been set when instantiating this call,
11974 /// we provide this method for API completeness.
11975 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
11976 self._parent = new_value.to_string();
11977 self
11978 }
11979 /// Optional. Only validate the stream, but don't create any resources. The default is false.
11980 ///
11981 /// Sets the *validate only* query property to the given value.
11982 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationStreamCreateCall<'a, C> {
11983 self._validate_only = Some(new_value);
11984 self
11985 }
11986 /// Required. The stream identifier.
11987 ///
11988 /// Sets the *stream id* query property to the given value.
11989 pub fn stream_id(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
11990 self._stream_id = Some(new_value.to_string());
11991 self
11992 }
11993 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
11994 ///
11995 /// Sets the *request id* query property to the given value.
11996 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
11997 self._request_id = Some(new_value.to_string());
11998 self
11999 }
12000 /// Optional. Create the stream without validating it.
12001 ///
12002 /// Sets the *force* query property to the given value.
12003 pub fn force(mut self, new_value: bool) -> ProjectLocationStreamCreateCall<'a, C> {
12004 self._force = Some(new_value);
12005 self
12006 }
12007 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12008 /// while executing the actual API request.
12009 ///
12010 /// ````text
12011 /// It should be used to handle progress information, and to implement a certain level of resilience.
12012 /// ````
12013 ///
12014 /// Sets the *delegate* property to the given value.
12015 pub fn delegate(
12016 mut self,
12017 new_value: &'a mut dyn common::Delegate,
12018 ) -> ProjectLocationStreamCreateCall<'a, C> {
12019 self._delegate = Some(new_value);
12020 self
12021 }
12022
12023 /// Set any additional parameter of the query string used in the request.
12024 /// It should be used to set parameters which are not yet available through their own
12025 /// setters.
12026 ///
12027 /// Please note that this method must not be used to set any of the known parameters
12028 /// which have their own setter method. If done anyway, the request will fail.
12029 ///
12030 /// # Additional Parameters
12031 ///
12032 /// * *$.xgafv* (query-string) - V1 error format.
12033 /// * *access_token* (query-string) - OAuth access token.
12034 /// * *alt* (query-string) - Data format for response.
12035 /// * *callback* (query-string) - JSONP
12036 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12037 /// * *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.
12038 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12039 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12040 /// * *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.
12041 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12042 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12043 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamCreateCall<'a, C>
12044 where
12045 T: AsRef<str>,
12046 {
12047 self._additional_params
12048 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12049 self
12050 }
12051
12052 /// Identifies the authorization scope for the method you are building.
12053 ///
12054 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12055 /// [`Scope::CloudPlatform`].
12056 ///
12057 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12058 /// tokens for more than one scope.
12059 ///
12060 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12061 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12062 /// sufficient, a read-write scope will do as well.
12063 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamCreateCall<'a, C>
12064 where
12065 St: AsRef<str>,
12066 {
12067 self._scopes.insert(String::from(scope.as_ref()));
12068 self
12069 }
12070 /// Identifies the authorization scope(s) for the method you are building.
12071 ///
12072 /// See [`Self::add_scope()`] for details.
12073 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamCreateCall<'a, C>
12074 where
12075 I: IntoIterator<Item = St>,
12076 St: AsRef<str>,
12077 {
12078 self._scopes
12079 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12080 self
12081 }
12082
12083 /// Removes all scopes, and no default scope will be used either.
12084 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12085 /// for details).
12086 pub fn clear_scopes(mut self) -> ProjectLocationStreamCreateCall<'a, C> {
12087 self._scopes.clear();
12088 self
12089 }
12090}
12091
12092/// Use this method to delete a stream.
12093///
12094/// A builder for the *locations.streams.delete* method supported by a *project* resource.
12095/// It is not used directly, but through a [`ProjectMethods`] instance.
12096///
12097/// # Example
12098///
12099/// Instantiate a resource method builder
12100///
12101/// ```test_harness,no_run
12102/// # extern crate hyper;
12103/// # extern crate hyper_rustls;
12104/// # extern crate google_datastream1 as datastream1;
12105/// # async fn dox() {
12106/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12107///
12108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12109/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12110/// # .with_native_roots()
12111/// # .unwrap()
12112/// # .https_only()
12113/// # .enable_http2()
12114/// # .build();
12115///
12116/// # let executor = hyper_util::rt::TokioExecutor::new();
12117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12118/// # secret,
12119/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12120/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12121/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12122/// # ),
12123/// # ).build().await.unwrap();
12124///
12125/// # let client = hyper_util::client::legacy::Client::builder(
12126/// # hyper_util::rt::TokioExecutor::new()
12127/// # )
12128/// # .build(
12129/// # hyper_rustls::HttpsConnectorBuilder::new()
12130/// # .with_native_roots()
12131/// # .unwrap()
12132/// # .https_or_http()
12133/// # .enable_http2()
12134/// # .build()
12135/// # );
12136/// # let mut hub = Datastream::new(client, auth);
12137/// // You can configure optional parameters by calling the respective setters at will, and
12138/// // execute the final call using `doit()`.
12139/// // Values shown here are possibly random and not representative !
12140/// let result = hub.projects().locations_streams_delete("name")
12141/// .request_id("ea")
12142/// .doit().await;
12143/// # }
12144/// ```
12145pub struct ProjectLocationStreamDeleteCall<'a, C>
12146where
12147 C: 'a,
12148{
12149 hub: &'a Datastream<C>,
12150 _name: String,
12151 _request_id: Option<String>,
12152 _delegate: Option<&'a mut dyn common::Delegate>,
12153 _additional_params: HashMap<String, String>,
12154 _scopes: BTreeSet<String>,
12155}
12156
12157impl<'a, C> common::CallBuilder for ProjectLocationStreamDeleteCall<'a, C> {}
12158
12159impl<'a, C> ProjectLocationStreamDeleteCall<'a, C>
12160where
12161 C: common::Connector,
12162{
12163 /// Perform the operation you have build so far.
12164 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12165 use std::borrow::Cow;
12166 use std::io::{Read, Seek};
12167
12168 use common::{url::Params, ToParts};
12169 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12170
12171 let mut dd = common::DefaultDelegate;
12172 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12173 dlg.begin(common::MethodInfo {
12174 id: "datastream.projects.locations.streams.delete",
12175 http_method: hyper::Method::DELETE,
12176 });
12177
12178 for &field in ["alt", "name", "requestId"].iter() {
12179 if self._additional_params.contains_key(field) {
12180 dlg.finished(false);
12181 return Err(common::Error::FieldClash(field));
12182 }
12183 }
12184
12185 let mut params = Params::with_capacity(4 + self._additional_params.len());
12186 params.push("name", self._name);
12187 if let Some(value) = self._request_id.as_ref() {
12188 params.push("requestId", value);
12189 }
12190
12191 params.extend(self._additional_params.iter());
12192
12193 params.push("alt", "json");
12194 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12195 if self._scopes.is_empty() {
12196 self._scopes
12197 .insert(Scope::CloudPlatform.as_ref().to_string());
12198 }
12199
12200 #[allow(clippy::single_element_loop)]
12201 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12202 url = params.uri_replacement(url, param_name, find_this, true);
12203 }
12204 {
12205 let to_remove = ["name"];
12206 params.remove_params(&to_remove);
12207 }
12208
12209 let url = params.parse_with_url(&url);
12210
12211 loop {
12212 let token = match self
12213 .hub
12214 .auth
12215 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12216 .await
12217 {
12218 Ok(token) => token,
12219 Err(e) => match dlg.token(e) {
12220 Ok(token) => token,
12221 Err(e) => {
12222 dlg.finished(false);
12223 return Err(common::Error::MissingToken(e));
12224 }
12225 },
12226 };
12227 let mut req_result = {
12228 let client = &self.hub.client;
12229 dlg.pre_request();
12230 let mut req_builder = hyper::Request::builder()
12231 .method(hyper::Method::DELETE)
12232 .uri(url.as_str())
12233 .header(USER_AGENT, self.hub._user_agent.clone());
12234
12235 if let Some(token) = token.as_ref() {
12236 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12237 }
12238
12239 let request = req_builder
12240 .header(CONTENT_LENGTH, 0_u64)
12241 .body(common::to_body::<String>(None));
12242
12243 client.request(request.unwrap()).await
12244 };
12245
12246 match req_result {
12247 Err(err) => {
12248 if let common::Retry::After(d) = dlg.http_error(&err) {
12249 sleep(d).await;
12250 continue;
12251 }
12252 dlg.finished(false);
12253 return Err(common::Error::HttpError(err));
12254 }
12255 Ok(res) => {
12256 let (mut parts, body) = res.into_parts();
12257 let mut body = common::Body::new(body);
12258 if !parts.status.is_success() {
12259 let bytes = common::to_bytes(body).await.unwrap_or_default();
12260 let error = serde_json::from_str(&common::to_string(&bytes));
12261 let response = common::to_response(parts, bytes.into());
12262
12263 if let common::Retry::After(d) =
12264 dlg.http_failure(&response, error.as_ref().ok())
12265 {
12266 sleep(d).await;
12267 continue;
12268 }
12269
12270 dlg.finished(false);
12271
12272 return Err(match error {
12273 Ok(value) => common::Error::BadRequest(value),
12274 _ => common::Error::Failure(response),
12275 });
12276 }
12277 let response = {
12278 let bytes = common::to_bytes(body).await.unwrap_or_default();
12279 let encoded = common::to_string(&bytes);
12280 match serde_json::from_str(&encoded) {
12281 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12282 Err(error) => {
12283 dlg.response_json_decode_error(&encoded, &error);
12284 return Err(common::Error::JsonDecodeError(
12285 encoded.to_string(),
12286 error,
12287 ));
12288 }
12289 }
12290 };
12291
12292 dlg.finished(true);
12293 return Ok(response);
12294 }
12295 }
12296 }
12297 }
12298
12299 /// Required. The name of the stream resource to delete.
12300 ///
12301 /// Sets the *name* path property to the given value.
12302 ///
12303 /// Even though the property as already been set when instantiating this call,
12304 /// we provide this method for API completeness.
12305 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
12306 self._name = new_value.to_string();
12307 self
12308 }
12309 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
12310 ///
12311 /// Sets the *request id* query property to the given value.
12312 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
12313 self._request_id = Some(new_value.to_string());
12314 self
12315 }
12316 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12317 /// while executing the actual API request.
12318 ///
12319 /// ````text
12320 /// It should be used to handle progress information, and to implement a certain level of resilience.
12321 /// ````
12322 ///
12323 /// Sets the *delegate* property to the given value.
12324 pub fn delegate(
12325 mut self,
12326 new_value: &'a mut dyn common::Delegate,
12327 ) -> ProjectLocationStreamDeleteCall<'a, C> {
12328 self._delegate = Some(new_value);
12329 self
12330 }
12331
12332 /// Set any additional parameter of the query string used in the request.
12333 /// It should be used to set parameters which are not yet available through their own
12334 /// setters.
12335 ///
12336 /// Please note that this method must not be used to set any of the known parameters
12337 /// which have their own setter method. If done anyway, the request will fail.
12338 ///
12339 /// # Additional Parameters
12340 ///
12341 /// * *$.xgafv* (query-string) - V1 error format.
12342 /// * *access_token* (query-string) - OAuth access token.
12343 /// * *alt* (query-string) - Data format for response.
12344 /// * *callback* (query-string) - JSONP
12345 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12346 /// * *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.
12347 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12348 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12349 /// * *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.
12350 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12351 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12352 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamDeleteCall<'a, C>
12353 where
12354 T: AsRef<str>,
12355 {
12356 self._additional_params
12357 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12358 self
12359 }
12360
12361 /// Identifies the authorization scope for the method you are building.
12362 ///
12363 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12364 /// [`Scope::CloudPlatform`].
12365 ///
12366 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12367 /// tokens for more than one scope.
12368 ///
12369 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12370 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12371 /// sufficient, a read-write scope will do as well.
12372 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamDeleteCall<'a, C>
12373 where
12374 St: AsRef<str>,
12375 {
12376 self._scopes.insert(String::from(scope.as_ref()));
12377 self
12378 }
12379 /// Identifies the authorization scope(s) for the method you are building.
12380 ///
12381 /// See [`Self::add_scope()`] for details.
12382 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamDeleteCall<'a, C>
12383 where
12384 I: IntoIterator<Item = St>,
12385 St: AsRef<str>,
12386 {
12387 self._scopes
12388 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12389 self
12390 }
12391
12392 /// Removes all scopes, and no default scope will be used either.
12393 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12394 /// for details).
12395 pub fn clear_scopes(mut self) -> ProjectLocationStreamDeleteCall<'a, C> {
12396 self._scopes.clear();
12397 self
12398 }
12399}
12400
12401/// Use this method to get details about a stream.
12402///
12403/// A builder for the *locations.streams.get* method supported by a *project* resource.
12404/// It is not used directly, but through a [`ProjectMethods`] instance.
12405///
12406/// # Example
12407///
12408/// Instantiate a resource method builder
12409///
12410/// ```test_harness,no_run
12411/// # extern crate hyper;
12412/// # extern crate hyper_rustls;
12413/// # extern crate google_datastream1 as datastream1;
12414/// # async fn dox() {
12415/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12416///
12417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12419/// # .with_native_roots()
12420/// # .unwrap()
12421/// # .https_only()
12422/// # .enable_http2()
12423/// # .build();
12424///
12425/// # let executor = hyper_util::rt::TokioExecutor::new();
12426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12427/// # secret,
12428/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12429/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12430/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12431/// # ),
12432/// # ).build().await.unwrap();
12433///
12434/// # let client = hyper_util::client::legacy::Client::builder(
12435/// # hyper_util::rt::TokioExecutor::new()
12436/// # )
12437/// # .build(
12438/// # hyper_rustls::HttpsConnectorBuilder::new()
12439/// # .with_native_roots()
12440/// # .unwrap()
12441/// # .https_or_http()
12442/// # .enable_http2()
12443/// # .build()
12444/// # );
12445/// # let mut hub = Datastream::new(client, auth);
12446/// // You can configure optional parameters by calling the respective setters at will, and
12447/// // execute the final call using `doit()`.
12448/// // Values shown here are possibly random and not representative !
12449/// let result = hub.projects().locations_streams_get("name")
12450/// .doit().await;
12451/// # }
12452/// ```
12453pub struct ProjectLocationStreamGetCall<'a, C>
12454where
12455 C: 'a,
12456{
12457 hub: &'a Datastream<C>,
12458 _name: String,
12459 _delegate: Option<&'a mut dyn common::Delegate>,
12460 _additional_params: HashMap<String, String>,
12461 _scopes: BTreeSet<String>,
12462}
12463
12464impl<'a, C> common::CallBuilder for ProjectLocationStreamGetCall<'a, C> {}
12465
12466impl<'a, C> ProjectLocationStreamGetCall<'a, C>
12467where
12468 C: common::Connector,
12469{
12470 /// Perform the operation you have build so far.
12471 pub async fn doit(mut self) -> common::Result<(common::Response, Stream)> {
12472 use std::borrow::Cow;
12473 use std::io::{Read, Seek};
12474
12475 use common::{url::Params, ToParts};
12476 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12477
12478 let mut dd = common::DefaultDelegate;
12479 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12480 dlg.begin(common::MethodInfo {
12481 id: "datastream.projects.locations.streams.get",
12482 http_method: hyper::Method::GET,
12483 });
12484
12485 for &field in ["alt", "name"].iter() {
12486 if self._additional_params.contains_key(field) {
12487 dlg.finished(false);
12488 return Err(common::Error::FieldClash(field));
12489 }
12490 }
12491
12492 let mut params = Params::with_capacity(3 + self._additional_params.len());
12493 params.push("name", self._name);
12494
12495 params.extend(self._additional_params.iter());
12496
12497 params.push("alt", "json");
12498 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12499 if self._scopes.is_empty() {
12500 self._scopes
12501 .insert(Scope::CloudPlatform.as_ref().to_string());
12502 }
12503
12504 #[allow(clippy::single_element_loop)]
12505 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12506 url = params.uri_replacement(url, param_name, find_this, true);
12507 }
12508 {
12509 let to_remove = ["name"];
12510 params.remove_params(&to_remove);
12511 }
12512
12513 let url = params.parse_with_url(&url);
12514
12515 loop {
12516 let token = match self
12517 .hub
12518 .auth
12519 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12520 .await
12521 {
12522 Ok(token) => token,
12523 Err(e) => match dlg.token(e) {
12524 Ok(token) => token,
12525 Err(e) => {
12526 dlg.finished(false);
12527 return Err(common::Error::MissingToken(e));
12528 }
12529 },
12530 };
12531 let mut req_result = {
12532 let client = &self.hub.client;
12533 dlg.pre_request();
12534 let mut req_builder = hyper::Request::builder()
12535 .method(hyper::Method::GET)
12536 .uri(url.as_str())
12537 .header(USER_AGENT, self.hub._user_agent.clone());
12538
12539 if let Some(token) = token.as_ref() {
12540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12541 }
12542
12543 let request = req_builder
12544 .header(CONTENT_LENGTH, 0_u64)
12545 .body(common::to_body::<String>(None));
12546
12547 client.request(request.unwrap()).await
12548 };
12549
12550 match req_result {
12551 Err(err) => {
12552 if let common::Retry::After(d) = dlg.http_error(&err) {
12553 sleep(d).await;
12554 continue;
12555 }
12556 dlg.finished(false);
12557 return Err(common::Error::HttpError(err));
12558 }
12559 Ok(res) => {
12560 let (mut parts, body) = res.into_parts();
12561 let mut body = common::Body::new(body);
12562 if !parts.status.is_success() {
12563 let bytes = common::to_bytes(body).await.unwrap_or_default();
12564 let error = serde_json::from_str(&common::to_string(&bytes));
12565 let response = common::to_response(parts, bytes.into());
12566
12567 if let common::Retry::After(d) =
12568 dlg.http_failure(&response, error.as_ref().ok())
12569 {
12570 sleep(d).await;
12571 continue;
12572 }
12573
12574 dlg.finished(false);
12575
12576 return Err(match error {
12577 Ok(value) => common::Error::BadRequest(value),
12578 _ => common::Error::Failure(response),
12579 });
12580 }
12581 let response = {
12582 let bytes = common::to_bytes(body).await.unwrap_or_default();
12583 let encoded = common::to_string(&bytes);
12584 match serde_json::from_str(&encoded) {
12585 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12586 Err(error) => {
12587 dlg.response_json_decode_error(&encoded, &error);
12588 return Err(common::Error::JsonDecodeError(
12589 encoded.to_string(),
12590 error,
12591 ));
12592 }
12593 }
12594 };
12595
12596 dlg.finished(true);
12597 return Ok(response);
12598 }
12599 }
12600 }
12601 }
12602
12603 /// Required. The name of the stream resource to get.
12604 ///
12605 /// Sets the *name* path property to the given value.
12606 ///
12607 /// Even though the property as already been set when instantiating this call,
12608 /// we provide this method for API completeness.
12609 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamGetCall<'a, C> {
12610 self._name = new_value.to_string();
12611 self
12612 }
12613 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12614 /// while executing the actual API request.
12615 ///
12616 /// ````text
12617 /// It should be used to handle progress information, and to implement a certain level of resilience.
12618 /// ````
12619 ///
12620 /// Sets the *delegate* property to the given value.
12621 pub fn delegate(
12622 mut self,
12623 new_value: &'a mut dyn common::Delegate,
12624 ) -> ProjectLocationStreamGetCall<'a, C> {
12625 self._delegate = Some(new_value);
12626 self
12627 }
12628
12629 /// Set any additional parameter of the query string used in the request.
12630 /// It should be used to set parameters which are not yet available through their own
12631 /// setters.
12632 ///
12633 /// Please note that this method must not be used to set any of the known parameters
12634 /// which have their own setter method. If done anyway, the request will fail.
12635 ///
12636 /// # Additional Parameters
12637 ///
12638 /// * *$.xgafv* (query-string) - V1 error format.
12639 /// * *access_token* (query-string) - OAuth access token.
12640 /// * *alt* (query-string) - Data format for response.
12641 /// * *callback* (query-string) - JSONP
12642 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12643 /// * *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.
12644 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12645 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12646 /// * *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.
12647 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12648 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12649 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamGetCall<'a, C>
12650 where
12651 T: AsRef<str>,
12652 {
12653 self._additional_params
12654 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12655 self
12656 }
12657
12658 /// Identifies the authorization scope for the method you are building.
12659 ///
12660 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12661 /// [`Scope::CloudPlatform`].
12662 ///
12663 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12664 /// tokens for more than one scope.
12665 ///
12666 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12667 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12668 /// sufficient, a read-write scope will do as well.
12669 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamGetCall<'a, C>
12670 where
12671 St: AsRef<str>,
12672 {
12673 self._scopes.insert(String::from(scope.as_ref()));
12674 self
12675 }
12676 /// Identifies the authorization scope(s) for the method you are building.
12677 ///
12678 /// See [`Self::add_scope()`] for details.
12679 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamGetCall<'a, C>
12680 where
12681 I: IntoIterator<Item = St>,
12682 St: AsRef<str>,
12683 {
12684 self._scopes
12685 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12686 self
12687 }
12688
12689 /// Removes all scopes, and no default scope will be used either.
12690 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12691 /// for details).
12692 pub fn clear_scopes(mut self) -> ProjectLocationStreamGetCall<'a, C> {
12693 self._scopes.clear();
12694 self
12695 }
12696}
12697
12698/// Use this method to list streams in a project and location.
12699///
12700/// A builder for the *locations.streams.list* method supported by a *project* resource.
12701/// It is not used directly, but through a [`ProjectMethods`] instance.
12702///
12703/// # Example
12704///
12705/// Instantiate a resource method builder
12706///
12707/// ```test_harness,no_run
12708/// # extern crate hyper;
12709/// # extern crate hyper_rustls;
12710/// # extern crate google_datastream1 as datastream1;
12711/// # async fn dox() {
12712/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12713///
12714/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12715/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12716/// # .with_native_roots()
12717/// # .unwrap()
12718/// # .https_only()
12719/// # .enable_http2()
12720/// # .build();
12721///
12722/// # let executor = hyper_util::rt::TokioExecutor::new();
12723/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12724/// # secret,
12725/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12726/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12727/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12728/// # ),
12729/// # ).build().await.unwrap();
12730///
12731/// # let client = hyper_util::client::legacy::Client::builder(
12732/// # hyper_util::rt::TokioExecutor::new()
12733/// # )
12734/// # .build(
12735/// # hyper_rustls::HttpsConnectorBuilder::new()
12736/// # .with_native_roots()
12737/// # .unwrap()
12738/// # .https_or_http()
12739/// # .enable_http2()
12740/// # .build()
12741/// # );
12742/// # let mut hub = Datastream::new(client, auth);
12743/// // You can configure optional parameters by calling the respective setters at will, and
12744/// // execute the final call using `doit()`.
12745/// // Values shown here are possibly random and not representative !
12746/// let result = hub.projects().locations_streams_list("parent")
12747/// .page_token("invidunt")
12748/// .page_size(-11)
12749/// .order_by("est")
12750/// .filter("At")
12751/// .doit().await;
12752/// # }
12753/// ```
12754pub struct ProjectLocationStreamListCall<'a, C>
12755where
12756 C: 'a,
12757{
12758 hub: &'a Datastream<C>,
12759 _parent: String,
12760 _page_token: Option<String>,
12761 _page_size: Option<i32>,
12762 _order_by: Option<String>,
12763 _filter: Option<String>,
12764 _delegate: Option<&'a mut dyn common::Delegate>,
12765 _additional_params: HashMap<String, String>,
12766 _scopes: BTreeSet<String>,
12767}
12768
12769impl<'a, C> common::CallBuilder for ProjectLocationStreamListCall<'a, C> {}
12770
12771impl<'a, C> ProjectLocationStreamListCall<'a, C>
12772where
12773 C: common::Connector,
12774{
12775 /// Perform the operation you have build so far.
12776 pub async fn doit(mut self) -> common::Result<(common::Response, ListStreamsResponse)> {
12777 use std::borrow::Cow;
12778 use std::io::{Read, Seek};
12779
12780 use common::{url::Params, ToParts};
12781 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12782
12783 let mut dd = common::DefaultDelegate;
12784 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12785 dlg.begin(common::MethodInfo {
12786 id: "datastream.projects.locations.streams.list",
12787 http_method: hyper::Method::GET,
12788 });
12789
12790 for &field in [
12791 "alt",
12792 "parent",
12793 "pageToken",
12794 "pageSize",
12795 "orderBy",
12796 "filter",
12797 ]
12798 .iter()
12799 {
12800 if self._additional_params.contains_key(field) {
12801 dlg.finished(false);
12802 return Err(common::Error::FieldClash(field));
12803 }
12804 }
12805
12806 let mut params = Params::with_capacity(7 + self._additional_params.len());
12807 params.push("parent", self._parent);
12808 if let Some(value) = self._page_token.as_ref() {
12809 params.push("pageToken", value);
12810 }
12811 if let Some(value) = self._page_size.as_ref() {
12812 params.push("pageSize", value.to_string());
12813 }
12814 if let Some(value) = self._order_by.as_ref() {
12815 params.push("orderBy", value);
12816 }
12817 if let Some(value) = self._filter.as_ref() {
12818 params.push("filter", value);
12819 }
12820
12821 params.extend(self._additional_params.iter());
12822
12823 params.push("alt", "json");
12824 let mut url = self.hub._base_url.clone() + "v1/{+parent}/streams";
12825 if self._scopes.is_empty() {
12826 self._scopes
12827 .insert(Scope::CloudPlatform.as_ref().to_string());
12828 }
12829
12830 #[allow(clippy::single_element_loop)]
12831 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12832 url = params.uri_replacement(url, param_name, find_this, true);
12833 }
12834 {
12835 let to_remove = ["parent"];
12836 params.remove_params(&to_remove);
12837 }
12838
12839 let url = params.parse_with_url(&url);
12840
12841 loop {
12842 let token = match self
12843 .hub
12844 .auth
12845 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12846 .await
12847 {
12848 Ok(token) => token,
12849 Err(e) => match dlg.token(e) {
12850 Ok(token) => token,
12851 Err(e) => {
12852 dlg.finished(false);
12853 return Err(common::Error::MissingToken(e));
12854 }
12855 },
12856 };
12857 let mut req_result = {
12858 let client = &self.hub.client;
12859 dlg.pre_request();
12860 let mut req_builder = hyper::Request::builder()
12861 .method(hyper::Method::GET)
12862 .uri(url.as_str())
12863 .header(USER_AGENT, self.hub._user_agent.clone());
12864
12865 if let Some(token) = token.as_ref() {
12866 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12867 }
12868
12869 let request = req_builder
12870 .header(CONTENT_LENGTH, 0_u64)
12871 .body(common::to_body::<String>(None));
12872
12873 client.request(request.unwrap()).await
12874 };
12875
12876 match req_result {
12877 Err(err) => {
12878 if let common::Retry::After(d) = dlg.http_error(&err) {
12879 sleep(d).await;
12880 continue;
12881 }
12882 dlg.finished(false);
12883 return Err(common::Error::HttpError(err));
12884 }
12885 Ok(res) => {
12886 let (mut parts, body) = res.into_parts();
12887 let mut body = common::Body::new(body);
12888 if !parts.status.is_success() {
12889 let bytes = common::to_bytes(body).await.unwrap_or_default();
12890 let error = serde_json::from_str(&common::to_string(&bytes));
12891 let response = common::to_response(parts, bytes.into());
12892
12893 if let common::Retry::After(d) =
12894 dlg.http_failure(&response, error.as_ref().ok())
12895 {
12896 sleep(d).await;
12897 continue;
12898 }
12899
12900 dlg.finished(false);
12901
12902 return Err(match error {
12903 Ok(value) => common::Error::BadRequest(value),
12904 _ => common::Error::Failure(response),
12905 });
12906 }
12907 let response = {
12908 let bytes = common::to_bytes(body).await.unwrap_or_default();
12909 let encoded = common::to_string(&bytes);
12910 match serde_json::from_str(&encoded) {
12911 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12912 Err(error) => {
12913 dlg.response_json_decode_error(&encoded, &error);
12914 return Err(common::Error::JsonDecodeError(
12915 encoded.to_string(),
12916 error,
12917 ));
12918 }
12919 }
12920 };
12921
12922 dlg.finished(true);
12923 return Ok(response);
12924 }
12925 }
12926 }
12927 }
12928
12929 /// Required. The parent that owns the collection of streams.
12930 ///
12931 /// Sets the *parent* path property to the given value.
12932 ///
12933 /// Even though the property as already been set when instantiating this call,
12934 /// we provide this method for API completeness.
12935 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
12936 self._parent = new_value.to_string();
12937 self
12938 }
12939 /// Page token received from a previous `ListStreams` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListStreams` must match the call that provided the page token.
12940 ///
12941 /// Sets the *page token* query property to the given value.
12942 pub fn page_token(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
12943 self._page_token = Some(new_value.to_string());
12944 self
12945 }
12946 /// Maximum number of streams to return. If unspecified, at most 50 streams will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
12947 ///
12948 /// Sets the *page size* query property to the given value.
12949 pub fn page_size(mut self, new_value: i32) -> ProjectLocationStreamListCall<'a, C> {
12950 self._page_size = Some(new_value);
12951 self
12952 }
12953 /// Order by fields for the result.
12954 ///
12955 /// Sets the *order by* query property to the given value.
12956 pub fn order_by(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
12957 self._order_by = Some(new_value.to_string());
12958 self
12959 }
12960 /// Filter request.
12961 ///
12962 /// Sets the *filter* query property to the given value.
12963 pub fn filter(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
12964 self._filter = Some(new_value.to_string());
12965 self
12966 }
12967 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12968 /// while executing the actual API request.
12969 ///
12970 /// ````text
12971 /// It should be used to handle progress information, and to implement a certain level of resilience.
12972 /// ````
12973 ///
12974 /// Sets the *delegate* property to the given value.
12975 pub fn delegate(
12976 mut self,
12977 new_value: &'a mut dyn common::Delegate,
12978 ) -> ProjectLocationStreamListCall<'a, C> {
12979 self._delegate = Some(new_value);
12980 self
12981 }
12982
12983 /// Set any additional parameter of the query string used in the request.
12984 /// It should be used to set parameters which are not yet available through their own
12985 /// setters.
12986 ///
12987 /// Please note that this method must not be used to set any of the known parameters
12988 /// which have their own setter method. If done anyway, the request will fail.
12989 ///
12990 /// # Additional Parameters
12991 ///
12992 /// * *$.xgafv* (query-string) - V1 error format.
12993 /// * *access_token* (query-string) - OAuth access token.
12994 /// * *alt* (query-string) - Data format for response.
12995 /// * *callback* (query-string) - JSONP
12996 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12997 /// * *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.
12998 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12999 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13000 /// * *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.
13001 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13002 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13003 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamListCall<'a, C>
13004 where
13005 T: AsRef<str>,
13006 {
13007 self._additional_params
13008 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13009 self
13010 }
13011
13012 /// Identifies the authorization scope for the method you are building.
13013 ///
13014 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13015 /// [`Scope::CloudPlatform`].
13016 ///
13017 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13018 /// tokens for more than one scope.
13019 ///
13020 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13021 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13022 /// sufficient, a read-write scope will do as well.
13023 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamListCall<'a, C>
13024 where
13025 St: AsRef<str>,
13026 {
13027 self._scopes.insert(String::from(scope.as_ref()));
13028 self
13029 }
13030 /// Identifies the authorization scope(s) for the method you are building.
13031 ///
13032 /// See [`Self::add_scope()`] for details.
13033 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamListCall<'a, C>
13034 where
13035 I: IntoIterator<Item = St>,
13036 St: AsRef<str>,
13037 {
13038 self._scopes
13039 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13040 self
13041 }
13042
13043 /// Removes all scopes, and no default scope will be used either.
13044 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13045 /// for details).
13046 pub fn clear_scopes(mut self) -> ProjectLocationStreamListCall<'a, C> {
13047 self._scopes.clear();
13048 self
13049 }
13050}
13051
13052/// Use this method to update the configuration of a stream.
13053///
13054/// A builder for the *locations.streams.patch* method supported by a *project* resource.
13055/// It is not used directly, but through a [`ProjectMethods`] instance.
13056///
13057/// # Example
13058///
13059/// Instantiate a resource method builder
13060///
13061/// ```test_harness,no_run
13062/// # extern crate hyper;
13063/// # extern crate hyper_rustls;
13064/// # extern crate google_datastream1 as datastream1;
13065/// use datastream1::api::Stream;
13066/// # async fn dox() {
13067/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13068///
13069/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13070/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13071/// # .with_native_roots()
13072/// # .unwrap()
13073/// # .https_only()
13074/// # .enable_http2()
13075/// # .build();
13076///
13077/// # let executor = hyper_util::rt::TokioExecutor::new();
13078/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13079/// # secret,
13080/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13081/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13082/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13083/// # ),
13084/// # ).build().await.unwrap();
13085///
13086/// # let client = hyper_util::client::legacy::Client::builder(
13087/// # hyper_util::rt::TokioExecutor::new()
13088/// # )
13089/// # .build(
13090/// # hyper_rustls::HttpsConnectorBuilder::new()
13091/// # .with_native_roots()
13092/// # .unwrap()
13093/// # .https_or_http()
13094/// # .enable_http2()
13095/// # .build()
13096/// # );
13097/// # let mut hub = Datastream::new(client, auth);
13098/// // As the method needs a request, you would usually fill it with the desired information
13099/// // into the respective structure. Some of the parts shown here might not be applicable !
13100/// // Values shown here are possibly random and not representative !
13101/// let mut req = Stream::default();
13102///
13103/// // You can configure optional parameters by calling the respective setters at will, and
13104/// // execute the final call using `doit()`.
13105/// // Values shown here are possibly random and not representative !
13106/// let result = hub.projects().locations_streams_patch(req, "name")
13107/// .validate_only(false)
13108/// .update_mask(FieldMask::new::<&str>(&[]))
13109/// .request_id("et")
13110/// .force(true)
13111/// .doit().await;
13112/// # }
13113/// ```
13114pub struct ProjectLocationStreamPatchCall<'a, C>
13115where
13116 C: 'a,
13117{
13118 hub: &'a Datastream<C>,
13119 _request: Stream,
13120 _name: String,
13121 _validate_only: Option<bool>,
13122 _update_mask: Option<common::FieldMask>,
13123 _request_id: Option<String>,
13124 _force: Option<bool>,
13125 _delegate: Option<&'a mut dyn common::Delegate>,
13126 _additional_params: HashMap<String, String>,
13127 _scopes: BTreeSet<String>,
13128}
13129
13130impl<'a, C> common::CallBuilder for ProjectLocationStreamPatchCall<'a, C> {}
13131
13132impl<'a, C> ProjectLocationStreamPatchCall<'a, C>
13133where
13134 C: common::Connector,
13135{
13136 /// Perform the operation you have build so far.
13137 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13138 use std::borrow::Cow;
13139 use std::io::{Read, Seek};
13140
13141 use common::{url::Params, ToParts};
13142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13143
13144 let mut dd = common::DefaultDelegate;
13145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13146 dlg.begin(common::MethodInfo {
13147 id: "datastream.projects.locations.streams.patch",
13148 http_method: hyper::Method::PATCH,
13149 });
13150
13151 for &field in [
13152 "alt",
13153 "name",
13154 "validateOnly",
13155 "updateMask",
13156 "requestId",
13157 "force",
13158 ]
13159 .iter()
13160 {
13161 if self._additional_params.contains_key(field) {
13162 dlg.finished(false);
13163 return Err(common::Error::FieldClash(field));
13164 }
13165 }
13166
13167 let mut params = Params::with_capacity(8 + self._additional_params.len());
13168 params.push("name", self._name);
13169 if let Some(value) = self._validate_only.as_ref() {
13170 params.push("validateOnly", value.to_string());
13171 }
13172 if let Some(value) = self._update_mask.as_ref() {
13173 params.push("updateMask", value.to_string());
13174 }
13175 if let Some(value) = self._request_id.as_ref() {
13176 params.push("requestId", value);
13177 }
13178 if let Some(value) = self._force.as_ref() {
13179 params.push("force", value.to_string());
13180 }
13181
13182 params.extend(self._additional_params.iter());
13183
13184 params.push("alt", "json");
13185 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13186 if self._scopes.is_empty() {
13187 self._scopes
13188 .insert(Scope::CloudPlatform.as_ref().to_string());
13189 }
13190
13191 #[allow(clippy::single_element_loop)]
13192 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13193 url = params.uri_replacement(url, param_name, find_this, true);
13194 }
13195 {
13196 let to_remove = ["name"];
13197 params.remove_params(&to_remove);
13198 }
13199
13200 let url = params.parse_with_url(&url);
13201
13202 let mut json_mime_type = mime::APPLICATION_JSON;
13203 let mut request_value_reader = {
13204 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13205 common::remove_json_null_values(&mut value);
13206 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13207 serde_json::to_writer(&mut dst, &value).unwrap();
13208 dst
13209 };
13210 let request_size = request_value_reader
13211 .seek(std::io::SeekFrom::End(0))
13212 .unwrap();
13213 request_value_reader
13214 .seek(std::io::SeekFrom::Start(0))
13215 .unwrap();
13216
13217 loop {
13218 let token = match self
13219 .hub
13220 .auth
13221 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13222 .await
13223 {
13224 Ok(token) => token,
13225 Err(e) => match dlg.token(e) {
13226 Ok(token) => token,
13227 Err(e) => {
13228 dlg.finished(false);
13229 return Err(common::Error::MissingToken(e));
13230 }
13231 },
13232 };
13233 request_value_reader
13234 .seek(std::io::SeekFrom::Start(0))
13235 .unwrap();
13236 let mut req_result = {
13237 let client = &self.hub.client;
13238 dlg.pre_request();
13239 let mut req_builder = hyper::Request::builder()
13240 .method(hyper::Method::PATCH)
13241 .uri(url.as_str())
13242 .header(USER_AGENT, self.hub._user_agent.clone());
13243
13244 if let Some(token) = token.as_ref() {
13245 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13246 }
13247
13248 let request = req_builder
13249 .header(CONTENT_TYPE, json_mime_type.to_string())
13250 .header(CONTENT_LENGTH, request_size as u64)
13251 .body(common::to_body(
13252 request_value_reader.get_ref().clone().into(),
13253 ));
13254
13255 client.request(request.unwrap()).await
13256 };
13257
13258 match req_result {
13259 Err(err) => {
13260 if let common::Retry::After(d) = dlg.http_error(&err) {
13261 sleep(d).await;
13262 continue;
13263 }
13264 dlg.finished(false);
13265 return Err(common::Error::HttpError(err));
13266 }
13267 Ok(res) => {
13268 let (mut parts, body) = res.into_parts();
13269 let mut body = common::Body::new(body);
13270 if !parts.status.is_success() {
13271 let bytes = common::to_bytes(body).await.unwrap_or_default();
13272 let error = serde_json::from_str(&common::to_string(&bytes));
13273 let response = common::to_response(parts, bytes.into());
13274
13275 if let common::Retry::After(d) =
13276 dlg.http_failure(&response, error.as_ref().ok())
13277 {
13278 sleep(d).await;
13279 continue;
13280 }
13281
13282 dlg.finished(false);
13283
13284 return Err(match error {
13285 Ok(value) => common::Error::BadRequest(value),
13286 _ => common::Error::Failure(response),
13287 });
13288 }
13289 let response = {
13290 let bytes = common::to_bytes(body).await.unwrap_or_default();
13291 let encoded = common::to_string(&bytes);
13292 match serde_json::from_str(&encoded) {
13293 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13294 Err(error) => {
13295 dlg.response_json_decode_error(&encoded, &error);
13296 return Err(common::Error::JsonDecodeError(
13297 encoded.to_string(),
13298 error,
13299 ));
13300 }
13301 }
13302 };
13303
13304 dlg.finished(true);
13305 return Ok(response);
13306 }
13307 }
13308 }
13309 }
13310
13311 ///
13312 /// Sets the *request* property to the given value.
13313 ///
13314 /// Even though the property as already been set when instantiating this call,
13315 /// we provide this method for API completeness.
13316 pub fn request(mut self, new_value: Stream) -> ProjectLocationStreamPatchCall<'a, C> {
13317 self._request = new_value;
13318 self
13319 }
13320 /// Output only. Identifier. The stream's name.
13321 ///
13322 /// Sets the *name* path property to the given value.
13323 ///
13324 /// Even though the property as already been set when instantiating this call,
13325 /// we provide this method for API completeness.
13326 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamPatchCall<'a, C> {
13327 self._name = new_value.to_string();
13328 self
13329 }
13330 /// Optional. Only validate the stream with the changes, without actually updating it. The default is false.
13331 ///
13332 /// Sets the *validate only* query property to the given value.
13333 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationStreamPatchCall<'a, C> {
13334 self._validate_only = Some(new_value);
13335 self
13336 }
13337 /// Optional. Field mask is used to specify the fields to be overwritten in the stream resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
13338 ///
13339 /// Sets the *update mask* query property to the given value.
13340 pub fn update_mask(
13341 mut self,
13342 new_value: common::FieldMask,
13343 ) -> ProjectLocationStreamPatchCall<'a, C> {
13344 self._update_mask = Some(new_value);
13345 self
13346 }
13347 /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
13348 ///
13349 /// Sets the *request id* query property to the given value.
13350 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamPatchCall<'a, C> {
13351 self._request_id = Some(new_value.to_string());
13352 self
13353 }
13354 /// Optional. Update the stream without validating it.
13355 ///
13356 /// Sets the *force* query property to the given value.
13357 pub fn force(mut self, new_value: bool) -> ProjectLocationStreamPatchCall<'a, C> {
13358 self._force = Some(new_value);
13359 self
13360 }
13361 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13362 /// while executing the actual API request.
13363 ///
13364 /// ````text
13365 /// It should be used to handle progress information, and to implement a certain level of resilience.
13366 /// ````
13367 ///
13368 /// Sets the *delegate* property to the given value.
13369 pub fn delegate(
13370 mut self,
13371 new_value: &'a mut dyn common::Delegate,
13372 ) -> ProjectLocationStreamPatchCall<'a, C> {
13373 self._delegate = Some(new_value);
13374 self
13375 }
13376
13377 /// Set any additional parameter of the query string used in the request.
13378 /// It should be used to set parameters which are not yet available through their own
13379 /// setters.
13380 ///
13381 /// Please note that this method must not be used to set any of the known parameters
13382 /// which have their own setter method. If done anyway, the request will fail.
13383 ///
13384 /// # Additional Parameters
13385 ///
13386 /// * *$.xgafv* (query-string) - V1 error format.
13387 /// * *access_token* (query-string) - OAuth access token.
13388 /// * *alt* (query-string) - Data format for response.
13389 /// * *callback* (query-string) - JSONP
13390 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13391 /// * *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.
13392 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13393 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13394 /// * *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.
13395 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13396 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13397 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamPatchCall<'a, C>
13398 where
13399 T: AsRef<str>,
13400 {
13401 self._additional_params
13402 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13403 self
13404 }
13405
13406 /// Identifies the authorization scope for the method you are building.
13407 ///
13408 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13409 /// [`Scope::CloudPlatform`].
13410 ///
13411 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13412 /// tokens for more than one scope.
13413 ///
13414 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13415 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13416 /// sufficient, a read-write scope will do as well.
13417 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamPatchCall<'a, C>
13418 where
13419 St: AsRef<str>,
13420 {
13421 self._scopes.insert(String::from(scope.as_ref()));
13422 self
13423 }
13424 /// Identifies the authorization scope(s) for the method you are building.
13425 ///
13426 /// See [`Self::add_scope()`] for details.
13427 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamPatchCall<'a, C>
13428 where
13429 I: IntoIterator<Item = St>,
13430 St: AsRef<str>,
13431 {
13432 self._scopes
13433 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13434 self
13435 }
13436
13437 /// Removes all scopes, and no default scope will be used either.
13438 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13439 /// for details).
13440 pub fn clear_scopes(mut self) -> ProjectLocationStreamPatchCall<'a, C> {
13441 self._scopes.clear();
13442 self
13443 }
13444}
13445
13446/// Use this method to start, resume or recover a stream with a non default CDC strategy.
13447///
13448/// A builder for the *locations.streams.run* method supported by a *project* resource.
13449/// It is not used directly, but through a [`ProjectMethods`] instance.
13450///
13451/// # Example
13452///
13453/// Instantiate a resource method builder
13454///
13455/// ```test_harness,no_run
13456/// # extern crate hyper;
13457/// # extern crate hyper_rustls;
13458/// # extern crate google_datastream1 as datastream1;
13459/// use datastream1::api::RunStreamRequest;
13460/// # async fn dox() {
13461/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13462///
13463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13464/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13465/// # .with_native_roots()
13466/// # .unwrap()
13467/// # .https_only()
13468/// # .enable_http2()
13469/// # .build();
13470///
13471/// # let executor = hyper_util::rt::TokioExecutor::new();
13472/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13473/// # secret,
13474/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13475/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13476/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13477/// # ),
13478/// # ).build().await.unwrap();
13479///
13480/// # let client = hyper_util::client::legacy::Client::builder(
13481/// # hyper_util::rt::TokioExecutor::new()
13482/// # )
13483/// # .build(
13484/// # hyper_rustls::HttpsConnectorBuilder::new()
13485/// # .with_native_roots()
13486/// # .unwrap()
13487/// # .https_or_http()
13488/// # .enable_http2()
13489/// # .build()
13490/// # );
13491/// # let mut hub = Datastream::new(client, auth);
13492/// // As the method needs a request, you would usually fill it with the desired information
13493/// // into the respective structure. Some of the parts shown here might not be applicable !
13494/// // Values shown here are possibly random and not representative !
13495/// let mut req = RunStreamRequest::default();
13496///
13497/// // You can configure optional parameters by calling the respective setters at will, and
13498/// // execute the final call using `doit()`.
13499/// // Values shown here are possibly random and not representative !
13500/// let result = hub.projects().locations_streams_run(req, "name")
13501/// .doit().await;
13502/// # }
13503/// ```
13504pub struct ProjectLocationStreamRunCall<'a, C>
13505where
13506 C: 'a,
13507{
13508 hub: &'a Datastream<C>,
13509 _request: RunStreamRequest,
13510 _name: String,
13511 _delegate: Option<&'a mut dyn common::Delegate>,
13512 _additional_params: HashMap<String, String>,
13513 _scopes: BTreeSet<String>,
13514}
13515
13516impl<'a, C> common::CallBuilder for ProjectLocationStreamRunCall<'a, C> {}
13517
13518impl<'a, C> ProjectLocationStreamRunCall<'a, C>
13519where
13520 C: common::Connector,
13521{
13522 /// Perform the operation you have build so far.
13523 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13524 use std::borrow::Cow;
13525 use std::io::{Read, Seek};
13526
13527 use common::{url::Params, ToParts};
13528 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13529
13530 let mut dd = common::DefaultDelegate;
13531 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13532 dlg.begin(common::MethodInfo {
13533 id: "datastream.projects.locations.streams.run",
13534 http_method: hyper::Method::POST,
13535 });
13536
13537 for &field in ["alt", "name"].iter() {
13538 if self._additional_params.contains_key(field) {
13539 dlg.finished(false);
13540 return Err(common::Error::FieldClash(field));
13541 }
13542 }
13543
13544 let mut params = Params::with_capacity(4 + self._additional_params.len());
13545 params.push("name", self._name);
13546
13547 params.extend(self._additional_params.iter());
13548
13549 params.push("alt", "json");
13550 let mut url = self.hub._base_url.clone() + "v1/{+name}:run";
13551 if self._scopes.is_empty() {
13552 self._scopes
13553 .insert(Scope::CloudPlatform.as_ref().to_string());
13554 }
13555
13556 #[allow(clippy::single_element_loop)]
13557 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13558 url = params.uri_replacement(url, param_name, find_this, true);
13559 }
13560 {
13561 let to_remove = ["name"];
13562 params.remove_params(&to_remove);
13563 }
13564
13565 let url = params.parse_with_url(&url);
13566
13567 let mut json_mime_type = mime::APPLICATION_JSON;
13568 let mut request_value_reader = {
13569 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13570 common::remove_json_null_values(&mut value);
13571 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13572 serde_json::to_writer(&mut dst, &value).unwrap();
13573 dst
13574 };
13575 let request_size = request_value_reader
13576 .seek(std::io::SeekFrom::End(0))
13577 .unwrap();
13578 request_value_reader
13579 .seek(std::io::SeekFrom::Start(0))
13580 .unwrap();
13581
13582 loop {
13583 let token = match self
13584 .hub
13585 .auth
13586 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13587 .await
13588 {
13589 Ok(token) => token,
13590 Err(e) => match dlg.token(e) {
13591 Ok(token) => token,
13592 Err(e) => {
13593 dlg.finished(false);
13594 return Err(common::Error::MissingToken(e));
13595 }
13596 },
13597 };
13598 request_value_reader
13599 .seek(std::io::SeekFrom::Start(0))
13600 .unwrap();
13601 let mut req_result = {
13602 let client = &self.hub.client;
13603 dlg.pre_request();
13604 let mut req_builder = hyper::Request::builder()
13605 .method(hyper::Method::POST)
13606 .uri(url.as_str())
13607 .header(USER_AGENT, self.hub._user_agent.clone());
13608
13609 if let Some(token) = token.as_ref() {
13610 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13611 }
13612
13613 let request = req_builder
13614 .header(CONTENT_TYPE, json_mime_type.to_string())
13615 .header(CONTENT_LENGTH, request_size as u64)
13616 .body(common::to_body(
13617 request_value_reader.get_ref().clone().into(),
13618 ));
13619
13620 client.request(request.unwrap()).await
13621 };
13622
13623 match req_result {
13624 Err(err) => {
13625 if let common::Retry::After(d) = dlg.http_error(&err) {
13626 sleep(d).await;
13627 continue;
13628 }
13629 dlg.finished(false);
13630 return Err(common::Error::HttpError(err));
13631 }
13632 Ok(res) => {
13633 let (mut parts, body) = res.into_parts();
13634 let mut body = common::Body::new(body);
13635 if !parts.status.is_success() {
13636 let bytes = common::to_bytes(body).await.unwrap_or_default();
13637 let error = serde_json::from_str(&common::to_string(&bytes));
13638 let response = common::to_response(parts, bytes.into());
13639
13640 if let common::Retry::After(d) =
13641 dlg.http_failure(&response, error.as_ref().ok())
13642 {
13643 sleep(d).await;
13644 continue;
13645 }
13646
13647 dlg.finished(false);
13648
13649 return Err(match error {
13650 Ok(value) => common::Error::BadRequest(value),
13651 _ => common::Error::Failure(response),
13652 });
13653 }
13654 let response = {
13655 let bytes = common::to_bytes(body).await.unwrap_or_default();
13656 let encoded = common::to_string(&bytes);
13657 match serde_json::from_str(&encoded) {
13658 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13659 Err(error) => {
13660 dlg.response_json_decode_error(&encoded, &error);
13661 return Err(common::Error::JsonDecodeError(
13662 encoded.to_string(),
13663 error,
13664 ));
13665 }
13666 }
13667 };
13668
13669 dlg.finished(true);
13670 return Ok(response);
13671 }
13672 }
13673 }
13674 }
13675
13676 ///
13677 /// Sets the *request* property to the given value.
13678 ///
13679 /// Even though the property as already been set when instantiating this call,
13680 /// we provide this method for API completeness.
13681 pub fn request(mut self, new_value: RunStreamRequest) -> ProjectLocationStreamRunCall<'a, C> {
13682 self._request = new_value;
13683 self
13684 }
13685 /// Required. Name of the stream resource to start, in the format: projects/{project_id}/locations/{location}/streams/{stream_name}
13686 ///
13687 /// Sets the *name* path property to the given value.
13688 ///
13689 /// Even though the property as already been set when instantiating this call,
13690 /// we provide this method for API completeness.
13691 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamRunCall<'a, C> {
13692 self._name = new_value.to_string();
13693 self
13694 }
13695 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13696 /// while executing the actual API request.
13697 ///
13698 /// ````text
13699 /// It should be used to handle progress information, and to implement a certain level of resilience.
13700 /// ````
13701 ///
13702 /// Sets the *delegate* property to the given value.
13703 pub fn delegate(
13704 mut self,
13705 new_value: &'a mut dyn common::Delegate,
13706 ) -> ProjectLocationStreamRunCall<'a, C> {
13707 self._delegate = Some(new_value);
13708 self
13709 }
13710
13711 /// Set any additional parameter of the query string used in the request.
13712 /// It should be used to set parameters which are not yet available through their own
13713 /// setters.
13714 ///
13715 /// Please note that this method must not be used to set any of the known parameters
13716 /// which have their own setter method. If done anyway, the request will fail.
13717 ///
13718 /// # Additional Parameters
13719 ///
13720 /// * *$.xgafv* (query-string) - V1 error format.
13721 /// * *access_token* (query-string) - OAuth access token.
13722 /// * *alt* (query-string) - Data format for response.
13723 /// * *callback* (query-string) - JSONP
13724 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13725 /// * *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.
13726 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13727 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13728 /// * *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.
13729 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13730 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13731 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamRunCall<'a, C>
13732 where
13733 T: AsRef<str>,
13734 {
13735 self._additional_params
13736 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13737 self
13738 }
13739
13740 /// Identifies the authorization scope for the method you are building.
13741 ///
13742 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13743 /// [`Scope::CloudPlatform`].
13744 ///
13745 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13746 /// tokens for more than one scope.
13747 ///
13748 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13749 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13750 /// sufficient, a read-write scope will do as well.
13751 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamRunCall<'a, C>
13752 where
13753 St: AsRef<str>,
13754 {
13755 self._scopes.insert(String::from(scope.as_ref()));
13756 self
13757 }
13758 /// Identifies the authorization scope(s) for the method you are building.
13759 ///
13760 /// See [`Self::add_scope()`] for details.
13761 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamRunCall<'a, C>
13762 where
13763 I: IntoIterator<Item = St>,
13764 St: AsRef<str>,
13765 {
13766 self._scopes
13767 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13768 self
13769 }
13770
13771 /// Removes all scopes, and no default scope will be used either.
13772 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13773 /// for details).
13774 pub fn clear_scopes(mut self) -> ProjectLocationStreamRunCall<'a, C> {
13775 self._scopes.clear();
13776 self
13777 }
13778}
13779
13780/// The FetchStaticIps API call exposes the static IP addresses used by Datastream.
13781///
13782/// A builder for the *locations.fetchStaticIps* method supported by a *project* resource.
13783/// It is not used directly, but through a [`ProjectMethods`] instance.
13784///
13785/// # Example
13786///
13787/// Instantiate a resource method builder
13788///
13789/// ```test_harness,no_run
13790/// # extern crate hyper;
13791/// # extern crate hyper_rustls;
13792/// # extern crate google_datastream1 as datastream1;
13793/// # async fn dox() {
13794/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13795///
13796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13797/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13798/// # .with_native_roots()
13799/// # .unwrap()
13800/// # .https_only()
13801/// # .enable_http2()
13802/// # .build();
13803///
13804/// # let executor = hyper_util::rt::TokioExecutor::new();
13805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13806/// # secret,
13807/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13808/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13809/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13810/// # ),
13811/// # ).build().await.unwrap();
13812///
13813/// # let client = hyper_util::client::legacy::Client::builder(
13814/// # hyper_util::rt::TokioExecutor::new()
13815/// # )
13816/// # .build(
13817/// # hyper_rustls::HttpsConnectorBuilder::new()
13818/// # .with_native_roots()
13819/// # .unwrap()
13820/// # .https_or_http()
13821/// # .enable_http2()
13822/// # .build()
13823/// # );
13824/// # let mut hub = Datastream::new(client, auth);
13825/// // You can configure optional parameters by calling the respective setters at will, and
13826/// // execute the final call using `doit()`.
13827/// // Values shown here are possibly random and not representative !
13828/// let result = hub.projects().locations_fetch_static_ips("name")
13829/// .page_token("et")
13830/// .page_size(-8)
13831/// .doit().await;
13832/// # }
13833/// ```
13834pub struct ProjectLocationFetchStaticIpCall<'a, C>
13835where
13836 C: 'a,
13837{
13838 hub: &'a Datastream<C>,
13839 _name: String,
13840 _page_token: Option<String>,
13841 _page_size: Option<i32>,
13842 _delegate: Option<&'a mut dyn common::Delegate>,
13843 _additional_params: HashMap<String, String>,
13844 _scopes: BTreeSet<String>,
13845}
13846
13847impl<'a, C> common::CallBuilder for ProjectLocationFetchStaticIpCall<'a, C> {}
13848
13849impl<'a, C> ProjectLocationFetchStaticIpCall<'a, C>
13850where
13851 C: common::Connector,
13852{
13853 /// Perform the operation you have build so far.
13854 pub async fn doit(mut self) -> common::Result<(common::Response, FetchStaticIpsResponse)> {
13855 use std::borrow::Cow;
13856 use std::io::{Read, Seek};
13857
13858 use common::{url::Params, ToParts};
13859 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13860
13861 let mut dd = common::DefaultDelegate;
13862 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13863 dlg.begin(common::MethodInfo {
13864 id: "datastream.projects.locations.fetchStaticIps",
13865 http_method: hyper::Method::GET,
13866 });
13867
13868 for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
13869 if self._additional_params.contains_key(field) {
13870 dlg.finished(false);
13871 return Err(common::Error::FieldClash(field));
13872 }
13873 }
13874
13875 let mut params = Params::with_capacity(5 + self._additional_params.len());
13876 params.push("name", self._name);
13877 if let Some(value) = self._page_token.as_ref() {
13878 params.push("pageToken", value);
13879 }
13880 if let Some(value) = self._page_size.as_ref() {
13881 params.push("pageSize", value.to_string());
13882 }
13883
13884 params.extend(self._additional_params.iter());
13885
13886 params.push("alt", "json");
13887 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchStaticIps";
13888 if self._scopes.is_empty() {
13889 self._scopes
13890 .insert(Scope::CloudPlatform.as_ref().to_string());
13891 }
13892
13893 #[allow(clippy::single_element_loop)]
13894 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13895 url = params.uri_replacement(url, param_name, find_this, true);
13896 }
13897 {
13898 let to_remove = ["name"];
13899 params.remove_params(&to_remove);
13900 }
13901
13902 let url = params.parse_with_url(&url);
13903
13904 loop {
13905 let token = match self
13906 .hub
13907 .auth
13908 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13909 .await
13910 {
13911 Ok(token) => token,
13912 Err(e) => match dlg.token(e) {
13913 Ok(token) => token,
13914 Err(e) => {
13915 dlg.finished(false);
13916 return Err(common::Error::MissingToken(e));
13917 }
13918 },
13919 };
13920 let mut req_result = {
13921 let client = &self.hub.client;
13922 dlg.pre_request();
13923 let mut req_builder = hyper::Request::builder()
13924 .method(hyper::Method::GET)
13925 .uri(url.as_str())
13926 .header(USER_AGENT, self.hub._user_agent.clone());
13927
13928 if let Some(token) = token.as_ref() {
13929 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13930 }
13931
13932 let request = req_builder
13933 .header(CONTENT_LENGTH, 0_u64)
13934 .body(common::to_body::<String>(None));
13935
13936 client.request(request.unwrap()).await
13937 };
13938
13939 match req_result {
13940 Err(err) => {
13941 if let common::Retry::After(d) = dlg.http_error(&err) {
13942 sleep(d).await;
13943 continue;
13944 }
13945 dlg.finished(false);
13946 return Err(common::Error::HttpError(err));
13947 }
13948 Ok(res) => {
13949 let (mut parts, body) = res.into_parts();
13950 let mut body = common::Body::new(body);
13951 if !parts.status.is_success() {
13952 let bytes = common::to_bytes(body).await.unwrap_or_default();
13953 let error = serde_json::from_str(&common::to_string(&bytes));
13954 let response = common::to_response(parts, bytes.into());
13955
13956 if let common::Retry::After(d) =
13957 dlg.http_failure(&response, error.as_ref().ok())
13958 {
13959 sleep(d).await;
13960 continue;
13961 }
13962
13963 dlg.finished(false);
13964
13965 return Err(match error {
13966 Ok(value) => common::Error::BadRequest(value),
13967 _ => common::Error::Failure(response),
13968 });
13969 }
13970 let response = {
13971 let bytes = common::to_bytes(body).await.unwrap_or_default();
13972 let encoded = common::to_string(&bytes);
13973 match serde_json::from_str(&encoded) {
13974 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13975 Err(error) => {
13976 dlg.response_json_decode_error(&encoded, &error);
13977 return Err(common::Error::JsonDecodeError(
13978 encoded.to_string(),
13979 error,
13980 ));
13981 }
13982 }
13983 };
13984
13985 dlg.finished(true);
13986 return Ok(response);
13987 }
13988 }
13989 }
13990 }
13991
13992 /// Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
13993 ///
13994 /// Sets the *name* path property to the given value.
13995 ///
13996 /// Even though the property as already been set when instantiating this call,
13997 /// we provide this method for API completeness.
13998 pub fn name(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
13999 self._name = new_value.to_string();
14000 self
14001 }
14002 /// A page token, received from a previous `ListStaticIps` call. will likely not be specified.
14003 ///
14004 /// Sets the *page token* query property to the given value.
14005 pub fn page_token(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
14006 self._page_token = Some(new_value.to_string());
14007 self
14008 }
14009 /// Maximum number of Ips to return, will likely not be specified.
14010 ///
14011 /// Sets the *page size* query property to the given value.
14012 pub fn page_size(mut self, new_value: i32) -> ProjectLocationFetchStaticIpCall<'a, C> {
14013 self._page_size = Some(new_value);
14014 self
14015 }
14016 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14017 /// while executing the actual API request.
14018 ///
14019 /// ````text
14020 /// It should be used to handle progress information, and to implement a certain level of resilience.
14021 /// ````
14022 ///
14023 /// Sets the *delegate* property to the given value.
14024 pub fn delegate(
14025 mut self,
14026 new_value: &'a mut dyn common::Delegate,
14027 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
14028 self._delegate = Some(new_value);
14029 self
14030 }
14031
14032 /// Set any additional parameter of the query string used in the request.
14033 /// It should be used to set parameters which are not yet available through their own
14034 /// setters.
14035 ///
14036 /// Please note that this method must not be used to set any of the known parameters
14037 /// which have their own setter method. If done anyway, the request will fail.
14038 ///
14039 /// # Additional Parameters
14040 ///
14041 /// * *$.xgafv* (query-string) - V1 error format.
14042 /// * *access_token* (query-string) - OAuth access token.
14043 /// * *alt* (query-string) - Data format for response.
14044 /// * *callback* (query-string) - JSONP
14045 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14046 /// * *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.
14047 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14048 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14049 /// * *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.
14050 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14051 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14052 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFetchStaticIpCall<'a, C>
14053 where
14054 T: AsRef<str>,
14055 {
14056 self._additional_params
14057 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14058 self
14059 }
14060
14061 /// Identifies the authorization scope for the method you are building.
14062 ///
14063 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14064 /// [`Scope::CloudPlatform`].
14065 ///
14066 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14067 /// tokens for more than one scope.
14068 ///
14069 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14070 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14071 /// sufficient, a read-write scope will do as well.
14072 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFetchStaticIpCall<'a, C>
14073 where
14074 St: AsRef<str>,
14075 {
14076 self._scopes.insert(String::from(scope.as_ref()));
14077 self
14078 }
14079 /// Identifies the authorization scope(s) for the method you are building.
14080 ///
14081 /// See [`Self::add_scope()`] for details.
14082 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFetchStaticIpCall<'a, C>
14083 where
14084 I: IntoIterator<Item = St>,
14085 St: AsRef<str>,
14086 {
14087 self._scopes
14088 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14089 self
14090 }
14091
14092 /// Removes all scopes, and no default scope will be used either.
14093 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14094 /// for details).
14095 pub fn clear_scopes(mut self) -> ProjectLocationFetchStaticIpCall<'a, C> {
14096 self._scopes.clear();
14097 self
14098 }
14099}
14100
14101/// Gets information about a location.
14102///
14103/// A builder for the *locations.get* method supported by a *project* resource.
14104/// It is not used directly, but through a [`ProjectMethods`] instance.
14105///
14106/// # Example
14107///
14108/// Instantiate a resource method builder
14109///
14110/// ```test_harness,no_run
14111/// # extern crate hyper;
14112/// # extern crate hyper_rustls;
14113/// # extern crate google_datastream1 as datastream1;
14114/// # async fn dox() {
14115/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14116///
14117/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14118/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14119/// # .with_native_roots()
14120/// # .unwrap()
14121/// # .https_only()
14122/// # .enable_http2()
14123/// # .build();
14124///
14125/// # let executor = hyper_util::rt::TokioExecutor::new();
14126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14127/// # secret,
14128/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14129/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14130/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14131/// # ),
14132/// # ).build().await.unwrap();
14133///
14134/// # let client = hyper_util::client::legacy::Client::builder(
14135/// # hyper_util::rt::TokioExecutor::new()
14136/// # )
14137/// # .build(
14138/// # hyper_rustls::HttpsConnectorBuilder::new()
14139/// # .with_native_roots()
14140/// # .unwrap()
14141/// # .https_or_http()
14142/// # .enable_http2()
14143/// # .build()
14144/// # );
14145/// # let mut hub = Datastream::new(client, auth);
14146/// // You can configure optional parameters by calling the respective setters at will, and
14147/// // execute the final call using `doit()`.
14148/// // Values shown here are possibly random and not representative !
14149/// let result = hub.projects().locations_get("name")
14150/// .doit().await;
14151/// # }
14152/// ```
14153pub struct ProjectLocationGetCall<'a, C>
14154where
14155 C: 'a,
14156{
14157 hub: &'a Datastream<C>,
14158 _name: String,
14159 _delegate: Option<&'a mut dyn common::Delegate>,
14160 _additional_params: HashMap<String, String>,
14161 _scopes: BTreeSet<String>,
14162}
14163
14164impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
14165
14166impl<'a, C> ProjectLocationGetCall<'a, C>
14167where
14168 C: common::Connector,
14169{
14170 /// Perform the operation you have build so far.
14171 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
14172 use std::borrow::Cow;
14173 use std::io::{Read, Seek};
14174
14175 use common::{url::Params, ToParts};
14176 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14177
14178 let mut dd = common::DefaultDelegate;
14179 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14180 dlg.begin(common::MethodInfo {
14181 id: "datastream.projects.locations.get",
14182 http_method: hyper::Method::GET,
14183 });
14184
14185 for &field in ["alt", "name"].iter() {
14186 if self._additional_params.contains_key(field) {
14187 dlg.finished(false);
14188 return Err(common::Error::FieldClash(field));
14189 }
14190 }
14191
14192 let mut params = Params::with_capacity(3 + self._additional_params.len());
14193 params.push("name", self._name);
14194
14195 params.extend(self._additional_params.iter());
14196
14197 params.push("alt", "json");
14198 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14199 if self._scopes.is_empty() {
14200 self._scopes
14201 .insert(Scope::CloudPlatform.as_ref().to_string());
14202 }
14203
14204 #[allow(clippy::single_element_loop)]
14205 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14206 url = params.uri_replacement(url, param_name, find_this, true);
14207 }
14208 {
14209 let to_remove = ["name"];
14210 params.remove_params(&to_remove);
14211 }
14212
14213 let url = params.parse_with_url(&url);
14214
14215 loop {
14216 let token = match self
14217 .hub
14218 .auth
14219 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14220 .await
14221 {
14222 Ok(token) => token,
14223 Err(e) => match dlg.token(e) {
14224 Ok(token) => token,
14225 Err(e) => {
14226 dlg.finished(false);
14227 return Err(common::Error::MissingToken(e));
14228 }
14229 },
14230 };
14231 let mut req_result = {
14232 let client = &self.hub.client;
14233 dlg.pre_request();
14234 let mut req_builder = hyper::Request::builder()
14235 .method(hyper::Method::GET)
14236 .uri(url.as_str())
14237 .header(USER_AGENT, self.hub._user_agent.clone());
14238
14239 if let Some(token) = token.as_ref() {
14240 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14241 }
14242
14243 let request = req_builder
14244 .header(CONTENT_LENGTH, 0_u64)
14245 .body(common::to_body::<String>(None));
14246
14247 client.request(request.unwrap()).await
14248 };
14249
14250 match req_result {
14251 Err(err) => {
14252 if let common::Retry::After(d) = dlg.http_error(&err) {
14253 sleep(d).await;
14254 continue;
14255 }
14256 dlg.finished(false);
14257 return Err(common::Error::HttpError(err));
14258 }
14259 Ok(res) => {
14260 let (mut parts, body) = res.into_parts();
14261 let mut body = common::Body::new(body);
14262 if !parts.status.is_success() {
14263 let bytes = common::to_bytes(body).await.unwrap_or_default();
14264 let error = serde_json::from_str(&common::to_string(&bytes));
14265 let response = common::to_response(parts, bytes.into());
14266
14267 if let common::Retry::After(d) =
14268 dlg.http_failure(&response, error.as_ref().ok())
14269 {
14270 sleep(d).await;
14271 continue;
14272 }
14273
14274 dlg.finished(false);
14275
14276 return Err(match error {
14277 Ok(value) => common::Error::BadRequest(value),
14278 _ => common::Error::Failure(response),
14279 });
14280 }
14281 let response = {
14282 let bytes = common::to_bytes(body).await.unwrap_or_default();
14283 let encoded = common::to_string(&bytes);
14284 match serde_json::from_str(&encoded) {
14285 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14286 Err(error) => {
14287 dlg.response_json_decode_error(&encoded, &error);
14288 return Err(common::Error::JsonDecodeError(
14289 encoded.to_string(),
14290 error,
14291 ));
14292 }
14293 }
14294 };
14295
14296 dlg.finished(true);
14297 return Ok(response);
14298 }
14299 }
14300 }
14301 }
14302
14303 /// Resource name for the location.
14304 ///
14305 /// Sets the *name* path property to the given value.
14306 ///
14307 /// Even though the property as already been set when instantiating this call,
14308 /// we provide this method for API completeness.
14309 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
14310 self._name = new_value.to_string();
14311 self
14312 }
14313 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14314 /// while executing the actual API request.
14315 ///
14316 /// ````text
14317 /// It should be used to handle progress information, and to implement a certain level of resilience.
14318 /// ````
14319 ///
14320 /// Sets the *delegate* property to the given value.
14321 pub fn delegate(
14322 mut self,
14323 new_value: &'a mut dyn common::Delegate,
14324 ) -> ProjectLocationGetCall<'a, C> {
14325 self._delegate = Some(new_value);
14326 self
14327 }
14328
14329 /// Set any additional parameter of the query string used in the request.
14330 /// It should be used to set parameters which are not yet available through their own
14331 /// setters.
14332 ///
14333 /// Please note that this method must not be used to set any of the known parameters
14334 /// which have their own setter method. If done anyway, the request will fail.
14335 ///
14336 /// # Additional Parameters
14337 ///
14338 /// * *$.xgafv* (query-string) - V1 error format.
14339 /// * *access_token* (query-string) - OAuth access token.
14340 /// * *alt* (query-string) - Data format for response.
14341 /// * *callback* (query-string) - JSONP
14342 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14343 /// * *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.
14344 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14345 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14346 /// * *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.
14347 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14348 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14349 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
14350 where
14351 T: AsRef<str>,
14352 {
14353 self._additional_params
14354 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14355 self
14356 }
14357
14358 /// Identifies the authorization scope for the method you are building.
14359 ///
14360 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14361 /// [`Scope::CloudPlatform`].
14362 ///
14363 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14364 /// tokens for more than one scope.
14365 ///
14366 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14367 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14368 /// sufficient, a read-write scope will do as well.
14369 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
14370 where
14371 St: AsRef<str>,
14372 {
14373 self._scopes.insert(String::from(scope.as_ref()));
14374 self
14375 }
14376 /// Identifies the authorization scope(s) for the method you are building.
14377 ///
14378 /// See [`Self::add_scope()`] for details.
14379 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
14380 where
14381 I: IntoIterator<Item = St>,
14382 St: AsRef<str>,
14383 {
14384 self._scopes
14385 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14386 self
14387 }
14388
14389 /// Removes all scopes, and no default scope will be used either.
14390 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14391 /// for details).
14392 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
14393 self._scopes.clear();
14394 self
14395 }
14396}
14397
14398/// Lists information about the supported locations for this service.
14399///
14400/// A builder for the *locations.list* method supported by a *project* resource.
14401/// It is not used directly, but through a [`ProjectMethods`] instance.
14402///
14403/// # Example
14404///
14405/// Instantiate a resource method builder
14406///
14407/// ```test_harness,no_run
14408/// # extern crate hyper;
14409/// # extern crate hyper_rustls;
14410/// # extern crate google_datastream1 as datastream1;
14411/// # async fn dox() {
14412/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14413///
14414/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14415/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14416/// # .with_native_roots()
14417/// # .unwrap()
14418/// # .https_only()
14419/// # .enable_http2()
14420/// # .build();
14421///
14422/// # let executor = hyper_util::rt::TokioExecutor::new();
14423/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14424/// # secret,
14425/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14426/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14427/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14428/// # ),
14429/// # ).build().await.unwrap();
14430///
14431/// # let client = hyper_util::client::legacy::Client::builder(
14432/// # hyper_util::rt::TokioExecutor::new()
14433/// # )
14434/// # .build(
14435/// # hyper_rustls::HttpsConnectorBuilder::new()
14436/// # .with_native_roots()
14437/// # .unwrap()
14438/// # .https_or_http()
14439/// # .enable_http2()
14440/// # .build()
14441/// # );
14442/// # let mut hub = Datastream::new(client, auth);
14443/// // You can configure optional parameters by calling the respective setters at will, and
14444/// // execute the final call using `doit()`.
14445/// // Values shown here are possibly random and not representative !
14446/// let result = hub.projects().locations_list("name")
14447/// .page_token("sed")
14448/// .page_size(-29)
14449/// .filter("dolores")
14450/// .add_extra_location_types("dolores")
14451/// .doit().await;
14452/// # }
14453/// ```
14454pub struct ProjectLocationListCall<'a, C>
14455where
14456 C: 'a,
14457{
14458 hub: &'a Datastream<C>,
14459 _name: String,
14460 _page_token: Option<String>,
14461 _page_size: Option<i32>,
14462 _filter: Option<String>,
14463 _extra_location_types: Vec<String>,
14464 _delegate: Option<&'a mut dyn common::Delegate>,
14465 _additional_params: HashMap<String, String>,
14466 _scopes: BTreeSet<String>,
14467}
14468
14469impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
14470
14471impl<'a, C> ProjectLocationListCall<'a, C>
14472where
14473 C: common::Connector,
14474{
14475 /// Perform the operation you have build so far.
14476 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
14477 use std::borrow::Cow;
14478 use std::io::{Read, Seek};
14479
14480 use common::{url::Params, ToParts};
14481 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14482
14483 let mut dd = common::DefaultDelegate;
14484 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14485 dlg.begin(common::MethodInfo {
14486 id: "datastream.projects.locations.list",
14487 http_method: hyper::Method::GET,
14488 });
14489
14490 for &field in [
14491 "alt",
14492 "name",
14493 "pageToken",
14494 "pageSize",
14495 "filter",
14496 "extraLocationTypes",
14497 ]
14498 .iter()
14499 {
14500 if self._additional_params.contains_key(field) {
14501 dlg.finished(false);
14502 return Err(common::Error::FieldClash(field));
14503 }
14504 }
14505
14506 let mut params = Params::with_capacity(7 + self._additional_params.len());
14507 params.push("name", self._name);
14508 if let Some(value) = self._page_token.as_ref() {
14509 params.push("pageToken", value);
14510 }
14511 if let Some(value) = self._page_size.as_ref() {
14512 params.push("pageSize", value.to_string());
14513 }
14514 if let Some(value) = self._filter.as_ref() {
14515 params.push("filter", value);
14516 }
14517 if !self._extra_location_types.is_empty() {
14518 for f in self._extra_location_types.iter() {
14519 params.push("extraLocationTypes", f);
14520 }
14521 }
14522
14523 params.extend(self._additional_params.iter());
14524
14525 params.push("alt", "json");
14526 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
14527 if self._scopes.is_empty() {
14528 self._scopes
14529 .insert(Scope::CloudPlatform.as_ref().to_string());
14530 }
14531
14532 #[allow(clippy::single_element_loop)]
14533 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14534 url = params.uri_replacement(url, param_name, find_this, true);
14535 }
14536 {
14537 let to_remove = ["name"];
14538 params.remove_params(&to_remove);
14539 }
14540
14541 let url = params.parse_with_url(&url);
14542
14543 loop {
14544 let token = match self
14545 .hub
14546 .auth
14547 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14548 .await
14549 {
14550 Ok(token) => token,
14551 Err(e) => match dlg.token(e) {
14552 Ok(token) => token,
14553 Err(e) => {
14554 dlg.finished(false);
14555 return Err(common::Error::MissingToken(e));
14556 }
14557 },
14558 };
14559 let mut req_result = {
14560 let client = &self.hub.client;
14561 dlg.pre_request();
14562 let mut req_builder = hyper::Request::builder()
14563 .method(hyper::Method::GET)
14564 .uri(url.as_str())
14565 .header(USER_AGENT, self.hub._user_agent.clone());
14566
14567 if let Some(token) = token.as_ref() {
14568 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14569 }
14570
14571 let request = req_builder
14572 .header(CONTENT_LENGTH, 0_u64)
14573 .body(common::to_body::<String>(None));
14574
14575 client.request(request.unwrap()).await
14576 };
14577
14578 match req_result {
14579 Err(err) => {
14580 if let common::Retry::After(d) = dlg.http_error(&err) {
14581 sleep(d).await;
14582 continue;
14583 }
14584 dlg.finished(false);
14585 return Err(common::Error::HttpError(err));
14586 }
14587 Ok(res) => {
14588 let (mut parts, body) = res.into_parts();
14589 let mut body = common::Body::new(body);
14590 if !parts.status.is_success() {
14591 let bytes = common::to_bytes(body).await.unwrap_or_default();
14592 let error = serde_json::from_str(&common::to_string(&bytes));
14593 let response = common::to_response(parts, bytes.into());
14594
14595 if let common::Retry::After(d) =
14596 dlg.http_failure(&response, error.as_ref().ok())
14597 {
14598 sleep(d).await;
14599 continue;
14600 }
14601
14602 dlg.finished(false);
14603
14604 return Err(match error {
14605 Ok(value) => common::Error::BadRequest(value),
14606 _ => common::Error::Failure(response),
14607 });
14608 }
14609 let response = {
14610 let bytes = common::to_bytes(body).await.unwrap_or_default();
14611 let encoded = common::to_string(&bytes);
14612 match serde_json::from_str(&encoded) {
14613 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14614 Err(error) => {
14615 dlg.response_json_decode_error(&encoded, &error);
14616 return Err(common::Error::JsonDecodeError(
14617 encoded.to_string(),
14618 error,
14619 ));
14620 }
14621 }
14622 };
14623
14624 dlg.finished(true);
14625 return Ok(response);
14626 }
14627 }
14628 }
14629 }
14630
14631 /// The resource that owns the locations collection, if applicable.
14632 ///
14633 /// Sets the *name* path property to the given value.
14634 ///
14635 /// Even though the property as already been set when instantiating this call,
14636 /// we provide this method for API completeness.
14637 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14638 self._name = new_value.to_string();
14639 self
14640 }
14641 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
14642 ///
14643 /// Sets the *page token* query property to the given value.
14644 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14645 self._page_token = Some(new_value.to_string());
14646 self
14647 }
14648 /// The maximum number of results to return. If not set, the service selects a default.
14649 ///
14650 /// Sets the *page size* query property to the given value.
14651 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
14652 self._page_size = Some(new_value);
14653 self
14654 }
14655 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
14656 ///
14657 /// Sets the *filter* query property to the given value.
14658 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14659 self._filter = Some(new_value.to_string());
14660 self
14661 }
14662 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
14663 ///
14664 /// Append the given value to the *extra location types* query property.
14665 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
14666 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14667 self._extra_location_types.push(new_value.to_string());
14668 self
14669 }
14670 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14671 /// while executing the actual API request.
14672 ///
14673 /// ````text
14674 /// It should be used to handle progress information, and to implement a certain level of resilience.
14675 /// ````
14676 ///
14677 /// Sets the *delegate* property to the given value.
14678 pub fn delegate(
14679 mut self,
14680 new_value: &'a mut dyn common::Delegate,
14681 ) -> ProjectLocationListCall<'a, C> {
14682 self._delegate = Some(new_value);
14683 self
14684 }
14685
14686 /// Set any additional parameter of the query string used in the request.
14687 /// It should be used to set parameters which are not yet available through their own
14688 /// setters.
14689 ///
14690 /// Please note that this method must not be used to set any of the known parameters
14691 /// which have their own setter method. If done anyway, the request will fail.
14692 ///
14693 /// # Additional Parameters
14694 ///
14695 /// * *$.xgafv* (query-string) - V1 error format.
14696 /// * *access_token* (query-string) - OAuth access token.
14697 /// * *alt* (query-string) - Data format for response.
14698 /// * *callback* (query-string) - JSONP
14699 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14700 /// * *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.
14701 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14702 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14703 /// * *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.
14704 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14705 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14706 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
14707 where
14708 T: AsRef<str>,
14709 {
14710 self._additional_params
14711 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14712 self
14713 }
14714
14715 /// Identifies the authorization scope for the method you are building.
14716 ///
14717 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14718 /// [`Scope::CloudPlatform`].
14719 ///
14720 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14721 /// tokens for more than one scope.
14722 ///
14723 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14724 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14725 /// sufficient, a read-write scope will do as well.
14726 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
14727 where
14728 St: AsRef<str>,
14729 {
14730 self._scopes.insert(String::from(scope.as_ref()));
14731 self
14732 }
14733 /// Identifies the authorization scope(s) for the method you are building.
14734 ///
14735 /// See [`Self::add_scope()`] for details.
14736 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
14737 where
14738 I: IntoIterator<Item = St>,
14739 St: AsRef<str>,
14740 {
14741 self._scopes
14742 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14743 self
14744 }
14745
14746 /// Removes all scopes, and no default scope will be used either.
14747 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14748 /// for details).
14749 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
14750 self._scopes.clear();
14751 self
14752 }
14753}