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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63/// secret,
64/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68/// hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71/// hyper_rustls::HttpsConnectorBuilder::new()
72/// .with_native_roots()
73/// .unwrap()
74/// .https_or_http()
75/// .enable_http1()
76/// .build()
77/// );
78/// let mut hub = Datastream::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = ConnectionProfile::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
88/// .validate_only(false)
89/// .request_id("dolor")
90/// .force(true)
91/// .connection_profile_id("invidunt")
92/// .doit().await;
93///
94/// match result {
95/// Err(e) => match e {
96/// // The Error enum provides details about what exactly happened.
97/// // You can also just use its `Debug`, `Display` or `Error` traits
98/// Error::HttpError(_)
99/// |Error::Io(_)
100/// |Error::MissingAPIKey
101/// |Error::MissingToken(_)
102/// |Error::Cancelled
103/// |Error::UploadSizeLimitExceeded(_, _)
104/// |Error::Failure(_)
105/// |Error::BadRequest(_)
106/// |Error::FieldClash(_)
107/// |Error::JsonDecodeError(_, _) => println!("{}", e),
108/// },
109/// Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct Datastream<C> {
115 pub client: common::Client<C>,
116 pub auth: Box<dyn common::GetToken>,
117 _user_agent: String,
118 _base_url: String,
119 _root_url: String,
120}
121
122impl<C> common::Hub for Datastream<C> {}
123
124impl<'a, C> Datastream<C> {
125 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Datastream<C> {
126 Datastream {
127 client,
128 auth: Box::new(auth),
129 _user_agent: "google-api-rust-client/6.0.0".to_string(),
130 _base_url: "https://datastream.googleapis.com/".to_string(),
131 _root_url: "https://datastream.googleapis.com/".to_string(),
132 }
133 }
134
135 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136 ProjectMethods { hub: self }
137 }
138
139 /// Set the user-agent header field to use in all requests to the server.
140 /// It defaults to `google-api-rust-client/6.0.0`.
141 ///
142 /// Returns the previously set user-agent.
143 pub fn user_agent(&mut self, agent_name: String) -> String {
144 std::mem::replace(&mut self._user_agent, agent_name)
145 }
146
147 /// Set the base url to use in all requests to the server.
148 /// It defaults to `https://datastream.googleapis.com/`.
149 ///
150 /// Returns the previously set base url.
151 pub fn base_url(&mut self, new_base_url: String) -> String {
152 std::mem::replace(&mut self._base_url, new_base_url)
153 }
154
155 /// Set the root url to use in all requests to the server.
156 /// It defaults to `https://datastream.googleapis.com/`.
157 ///
158 /// Returns the previously set root url.
159 pub fn root_url(&mut self, new_root_url: String) -> String {
160 std::mem::replace(&mut self._root_url, new_root_url)
161 }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// AppendOnly mode defines that all changes to a table will be written to the destination table.
168///
169/// This type is not used in any activity, and only used as *part* of another schema.
170///
171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
172#[serde_with::serde_as]
173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
174pub struct AppendOnly {
175 _never_set: Option<bool>,
176}
177
178impl common::Part for AppendOnly {}
179
180/// AVRO file format configuration.
181///
182/// This type is not used in any activity, and only used as *part* of another schema.
183///
184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
185#[serde_with::serde_as]
186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
187pub struct AvroFileFormat {
188 _never_set: Option<bool>,
189}
190
191impl common::Part for AvroFileFormat {}
192
193/// Backfill strategy to automatically backfill the Stream's objects. Specific objects can be excluded.
194///
195/// This type is not used in any activity, and only used as *part* of another schema.
196///
197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
198#[serde_with::serde_as]
199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
200pub struct BackfillAllStrategy {
201 /// MySQL data source objects to avoid backfilling.
202 #[serde(rename = "mysqlExcludedObjects")]
203 pub mysql_excluded_objects: Option<MysqlRdbms>,
204 /// Oracle data source objects to avoid backfilling.
205 #[serde(rename = "oracleExcludedObjects")]
206 pub oracle_excluded_objects: Option<OracleRdbms>,
207 /// PostgreSQL data source objects to avoid backfilling.
208 #[serde(rename = "postgresqlExcludedObjects")]
209 pub postgresql_excluded_objects: Option<PostgresqlRdbms>,
210 /// SQLServer data source objects to avoid backfilling
211 #[serde(rename = "sqlServerExcludedObjects")]
212 pub sql_server_excluded_objects: Option<SqlServerRdbms>,
213}
214
215impl common::Part for BackfillAllStrategy {}
216
217/// Represents a backfill job on a specific stream object.
218///
219/// This type is not used in any activity, and only used as *part* of another schema.
220///
221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
222#[serde_with::serde_as]
223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
224pub struct BackfillJob {
225 /// Output only. Errors which caused the backfill job to fail.
226 pub errors: Option<Vec<Error>>,
227 /// Output only. Backfill job's end time.
228 #[serde(rename = "lastEndTime")]
229 pub last_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
230 /// Output only. Backfill job's start time.
231 #[serde(rename = "lastStartTime")]
232 pub last_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
233 /// Output only. Backfill job state.
234 pub state: Option<String>,
235 /// Backfill job's triggering reason.
236 pub trigger: Option<String>,
237}
238
239impl common::Part for BackfillJob {}
240
241/// Backfill strategy to disable automatic backfill for the Stream's objects.
242///
243/// This type is not used in any activity, and only used as *part* of another schema.
244///
245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
246#[serde_with::serde_as]
247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
248pub struct BackfillNoneStrategy {
249 _never_set: Option<bool>,
250}
251
252impl common::Part for BackfillNoneStrategy {}
253
254/// BigQuery destination configuration
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct BigQueryDestinationConfig {
262 /// Append only mode
263 #[serde(rename = "appendOnly")]
264 pub append_only: Option<AppendOnly>,
265 /// 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.
266 #[serde(rename = "dataFreshness")]
267 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
268 pub data_freshness: Option<chrono::Duration>,
269 /// The standard mode
270 pub merge: Option<Merge>,
271 /// Single destination dataset.
272 #[serde(rename = "singleTargetDataset")]
273 pub single_target_dataset: Option<SingleTargetDataset>,
274 /// Source hierarchy datasets.
275 #[serde(rename = "sourceHierarchyDatasets")]
276 pub source_hierarchy_datasets: Option<SourceHierarchyDatasets>,
277}
278
279impl common::Part for BigQueryDestinationConfig {}
280
281/// BigQuery warehouse profile.
282///
283/// This type is not used in any activity, and only used as *part* of another schema.
284///
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct BigQueryProfile {
289 _never_set: Option<bool>,
290}
291
292impl common::Part for BigQueryProfile {}
293
294/// The request message for Operations.CancelOperation.
295///
296/// # Activities
297///
298/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
299/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
300///
301/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct CancelOperationRequest {
306 _never_set: Option<bool>,
307}
308
309impl common::RequestValue for CancelOperationRequest {}
310
311/// The strategy that the stream uses for CDC replication.
312///
313/// This type is not used in any activity, and only used as *part* of another schema.
314///
315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
316#[serde_with::serde_as]
317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
318pub struct CdcStrategy {
319 /// Optional. Start replicating from the most recent position in the source.
320 #[serde(rename = "mostRecentStartPosition")]
321 pub most_recent_start_position: Option<MostRecentStartPosition>,
322 /// Optional. Resume replication from the next available position in the source.
323 #[serde(rename = "nextAvailableStartPosition")]
324 pub next_available_start_position: Option<NextAvailableStartPosition>,
325 /// Optional. Start replicating from a specific position in the source.
326 #[serde(rename = "specificStartPosition")]
327 pub specific_start_position: Option<SpecificStartPosition>,
328}
329
330impl common::Part for CdcStrategy {}
331
332/// A set of reusable connection configurations to be used as a source or destination for a stream.
333///
334/// # Activities
335///
336/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
337/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
338///
339/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (request)
340/// * [locations connection profiles get projects](ProjectLocationConnectionProfileGetCall) (response)
341/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (request)
342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
343#[serde_with::serde_as]
344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
345pub struct ConnectionProfile {
346 /// BigQuery Connection Profile configuration.
347 #[serde(rename = "bigqueryProfile")]
348 pub bigquery_profile: Option<BigQueryProfile>,
349 /// Output only. The create time of the resource.
350 #[serde(rename = "createTime")]
351 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
352 /// Required. Display name.
353 #[serde(rename = "displayName")]
354 pub display_name: Option<String>,
355 /// Forward SSH tunnel connectivity.
356 #[serde(rename = "forwardSshConnectivity")]
357 pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
358 /// Cloud Storage ConnectionProfile configuration.
359 #[serde(rename = "gcsProfile")]
360 pub gcs_profile: Option<GcsProfile>,
361 /// Labels.
362 pub labels: Option<HashMap<String, String>>,
363 /// MySQL ConnectionProfile configuration.
364 #[serde(rename = "mysqlProfile")]
365 pub mysql_profile: Option<MysqlProfile>,
366 /// Output only. The resource's name.
367 pub name: Option<String>,
368 /// Oracle ConnectionProfile configuration.
369 #[serde(rename = "oracleProfile")]
370 pub oracle_profile: Option<OracleProfile>,
371 /// PostgreSQL Connection Profile configuration.
372 #[serde(rename = "postgresqlProfile")]
373 pub postgresql_profile: Option<PostgresqlProfile>,
374 /// Private connectivity.
375 #[serde(rename = "privateConnectivity")]
376 pub private_connectivity: Option<PrivateConnectivity>,
377 /// SQLServer Connection Profile configuration.
378 #[serde(rename = "sqlServerProfile")]
379 pub sql_server_profile: Option<SqlServerProfile>,
380 /// Static Service IP connectivity.
381 #[serde(rename = "staticServiceIpConnectivity")]
382 pub static_service_ip_connectivity: Option<StaticServiceIpConnectivity>,
383 /// Output only. The update time of the resource.
384 #[serde(rename = "updateTime")]
385 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
386}
387
388impl common::RequestValue for ConnectionProfile {}
389impl common::ResponseResult for ConnectionProfile {}
390
391/// Dataset template used for dynamic dataset creation.
392///
393/// This type is not used in any activity, and only used as *part* of another schema.
394///
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct DatasetTemplate {
399 /// 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. _.
400 #[serde(rename = "datasetIdPrefix")]
401 pub dataset_id_prefix: Option<String>,
402 /// 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.
403 #[serde(rename = "kmsKeyName")]
404 pub kms_key_name: Option<String>,
405 /// Required. The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.
406 pub location: Option<String>,
407}
408
409impl common::Part for DatasetTemplate {}
410
411/// The configuration of the stream destination.
412///
413/// This type is not used in any activity, and only used as *part* of another schema.
414///
415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
416#[serde_with::serde_as]
417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
418pub struct DestinationConfig {
419 /// BigQuery destination configuration.
420 #[serde(rename = "bigqueryDestinationConfig")]
421 pub bigquery_destination_config: Option<BigQueryDestinationConfig>,
422 /// Required. Destination connection profile resource. Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
423 #[serde(rename = "destinationConnectionProfile")]
424 pub destination_connection_profile: Option<String>,
425 /// A configuration for how data should be loaded to Cloud Storage.
426 #[serde(rename = "gcsDestinationConfig")]
427 pub gcs_destination_config: Option<GcsDestinationConfig>,
428}
429
430impl common::Part for DestinationConfig {}
431
432/// Request message for ‘discover’ ConnectionProfile request.
433///
434/// # Activities
435///
436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
438///
439/// * [locations connection profiles discover projects](ProjectLocationConnectionProfileDiscoverCall) (request)
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct DiscoverConnectionProfileRequest {
444 /// An ad-hoc connection profile configuration.
445 #[serde(rename = "connectionProfile")]
446 pub connection_profile: Option<ConnectionProfile>,
447 /// A reference to an existing connection profile.
448 #[serde(rename = "connectionProfileName")]
449 pub connection_profile_name: Option<String>,
450 /// Whether to retrieve the full hierarchy of data objects (TRUE) or only the current level (FALSE).
451 #[serde(rename = "fullHierarchy")]
452 pub full_hierarchy: Option<bool>,
453 /// The number of hierarchy levels below the current level to be retrieved.
454 #[serde(rename = "hierarchyDepth")]
455 pub hierarchy_depth: Option<i32>,
456 /// MySQL RDBMS to enrich with child data objects and metadata.
457 #[serde(rename = "mysqlRdbms")]
458 pub mysql_rdbms: Option<MysqlRdbms>,
459 /// Oracle RDBMS to enrich with child data objects and metadata.
460 #[serde(rename = "oracleRdbms")]
461 pub oracle_rdbms: Option<OracleRdbms>,
462 /// PostgreSQL RDBMS to enrich with child data objects and metadata.
463 #[serde(rename = "postgresqlRdbms")]
464 pub postgresql_rdbms: Option<PostgresqlRdbms>,
465 /// SQLServer RDBMS to enrich with child data objects and metadata.
466 #[serde(rename = "sqlServerRdbms")]
467 pub sql_server_rdbms: Option<SqlServerRdbms>,
468}
469
470impl common::RequestValue for DiscoverConnectionProfileRequest {}
471
472/// Response from a discover request.
473///
474/// # Activities
475///
476/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
478///
479/// * [locations connection profiles discover projects](ProjectLocationConnectionProfileDiscoverCall) (response)
480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
481#[serde_with::serde_as]
482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
483pub struct DiscoverConnectionProfileResponse {
484 /// Enriched MySQL RDBMS object.
485 #[serde(rename = "mysqlRdbms")]
486 pub mysql_rdbms: Option<MysqlRdbms>,
487 /// Enriched Oracle RDBMS object.
488 #[serde(rename = "oracleRdbms")]
489 pub oracle_rdbms: Option<OracleRdbms>,
490 /// Enriched PostgreSQL RDBMS object.
491 #[serde(rename = "postgresqlRdbms")]
492 pub postgresql_rdbms: Option<PostgresqlRdbms>,
493 /// Enriched SQLServer RDBMS object.
494 #[serde(rename = "sqlServerRdbms")]
495 pub sql_server_rdbms: Option<SqlServerRdbms>,
496}
497
498impl common::ResponseResult for DiscoverConnectionProfileResponse {}
499
500/// Configuration to drop large object values.
501///
502/// This type is not used in any activity, and only used as *part* of another schema.
503///
504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
505#[serde_with::serde_as]
506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
507pub struct DropLargeObjects {
508 _never_set: Option<bool>,
509}
510
511impl common::Part for DropLargeObjects {}
512
513/// 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); }
514///
515/// # Activities
516///
517/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
518/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
519///
520/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
521/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
523#[serde_with::serde_as]
524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
525pub struct Empty {
526 _never_set: Option<bool>,
527}
528
529impl common::ResponseResult for Empty {}
530
531/// Represent a user-facing Error.
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 Error {
539 /// Additional information about the error.
540 pub details: Option<HashMap<String, String>>,
541 /// The time when the error occurred.
542 #[serde(rename = "errorTime")]
543 pub error_time: Option<chrono::DateTime<chrono::offset::Utc>>,
544 /// A unique identifier for this specific error, allowing it to be traced throughout the system in logs and API responses.
545 #[serde(rename = "errorUuid")]
546 pub error_uuid: Option<String>,
547 /// A message containing more information about the error that occurred.
548 pub message: Option<String>,
549 /// A title that explains the reason for the error.
550 pub reason: Option<String>,
551}
552
553impl common::Part for Error {}
554
555/// Response message for a ‘FetchStaticIps’ response.
556///
557/// # Activities
558///
559/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
560/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
561///
562/// * [locations fetch static ips projects](ProjectLocationFetchStaticIpCall) (response)
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct FetchStaticIpsResponse {
567 /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
568 #[serde(rename = "nextPageToken")]
569 pub next_page_token: Option<String>,
570 /// list of static ips by account
571 #[serde(rename = "staticIps")]
572 pub static_ips: Option<Vec<String>>,
573}
574
575impl common::ResponseResult for FetchStaticIpsResponse {}
576
577/// Forward SSH Tunnel connectivity.
578///
579/// This type is not used in any activity, and only used as *part* of another schema.
580///
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct ForwardSshTunnelConnectivity {
585 /// Required. Hostname for the SSH tunnel.
586 pub hostname: Option<String>,
587 /// Input only. SSH password.
588 pub password: Option<String>,
589 /// Port for the SSH tunnel, default value is 22.
590 pub port: Option<i32>,
591 /// Input only. SSH private key.
592 #[serde(rename = "privateKey")]
593 pub private_key: Option<String>,
594 /// Required. Username for the SSH tunnel.
595 pub username: Option<String>,
596}
597
598impl common::Part for ForwardSshTunnelConnectivity {}
599
600/// Google Cloud Storage destination configuration
601///
602/// This type is not used in any activity, and only used as *part* of another schema.
603///
604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
605#[serde_with::serde_as]
606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
607pub struct GcsDestinationConfig {
608 /// AVRO file format configuration.
609 #[serde(rename = "avroFileFormat")]
610 pub avro_file_format: Option<AvroFileFormat>,
611 /// 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.
612 #[serde(rename = "fileRotationInterval")]
613 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
614 pub file_rotation_interval: Option<chrono::Duration>,
615 /// The maximum file size to be saved in the bucket.
616 #[serde(rename = "fileRotationMb")]
617 pub file_rotation_mb: Option<i32>,
618 /// JSON file format configuration.
619 #[serde(rename = "jsonFileFormat")]
620 pub json_file_format: Option<JsonFileFormat>,
621 /// Path inside the Cloud Storage bucket to write data to.
622 pub path: Option<String>,
623}
624
625impl common::Part for GcsDestinationConfig {}
626
627/// Cloud Storage bucket profile.
628///
629/// This type is not used in any activity, and only used as *part* of another schema.
630///
631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
632#[serde_with::serde_as]
633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
634pub struct GcsProfile {
635 /// Required. The Cloud Storage bucket name.
636 pub bucket: Option<String>,
637 /// The root path inside the Cloud Storage bucket.
638 #[serde(rename = "rootPath")]
639 pub root_path: Option<String>,
640}
641
642impl common::Part for GcsProfile {}
643
644/// JSON file format configuration.
645///
646/// This type is not used in any activity, and only used as *part* of another schema.
647///
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct JsonFileFormat {
652 /// Compression of the loaded JSON file.
653 pub compression: Option<String>,
654 /// The schema file format along JSON data files.
655 #[serde(rename = "schemaFileFormat")]
656 pub schema_file_format: Option<String>,
657}
658
659impl common::Part for JsonFileFormat {}
660
661/// Response message for listing connection profiles.
662///
663/// # Activities
664///
665/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
666/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
667///
668/// * [locations connection profiles list projects](ProjectLocationConnectionProfileListCall) (response)
669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
670#[serde_with::serde_as]
671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
672pub struct ListConnectionProfilesResponse {
673 /// List of connection profiles.
674 #[serde(rename = "connectionProfiles")]
675 pub connection_profiles: Option<Vec<ConnectionProfile>>,
676 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
677 #[serde(rename = "nextPageToken")]
678 pub next_page_token: Option<String>,
679 /// Locations that could not be reached.
680 pub unreachable: Option<Vec<String>>,
681}
682
683impl common::ResponseResult for ListConnectionProfilesResponse {}
684
685/// The response message for Locations.ListLocations.
686///
687/// # Activities
688///
689/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
690/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
691///
692/// * [locations list projects](ProjectLocationListCall) (response)
693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
694#[serde_with::serde_as]
695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
696pub struct ListLocationsResponse {
697 /// A list of locations that matches the specified filter in the request.
698 pub locations: Option<Vec<Location>>,
699 /// The standard List next-page token.
700 #[serde(rename = "nextPageToken")]
701 pub next_page_token: Option<String>,
702}
703
704impl common::ResponseResult for ListLocationsResponse {}
705
706/// The response message for Operations.ListOperations.
707///
708/// # Activities
709///
710/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
711/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
712///
713/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct ListOperationsResponse {
718 /// The standard List next-page token.
719 #[serde(rename = "nextPageToken")]
720 pub next_page_token: Option<String>,
721 /// A list of operations that matches the specified filter in the request.
722 pub operations: Option<Vec<Operation>>,
723}
724
725impl common::ResponseResult for ListOperationsResponse {}
726
727/// Response containing a list of private connection configurations.
728///
729/// # Activities
730///
731/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
732/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
733///
734/// * [locations private connections list projects](ProjectLocationPrivateConnectionListCall) (response)
735#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
736#[serde_with::serde_as]
737#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
738pub struct ListPrivateConnectionsResponse {
739 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
740 #[serde(rename = "nextPageToken")]
741 pub next_page_token: Option<String>,
742 /// List of private connectivity configurations.
743 #[serde(rename = "privateConnections")]
744 pub private_connections: Option<Vec<PrivateConnection>>,
745 /// Locations that could not be reached.
746 pub unreachable: Option<Vec<String>>,
747}
748
749impl common::ResponseResult for ListPrivateConnectionsResponse {}
750
751/// Route list response.
752///
753/// # Activities
754///
755/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
756/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
757///
758/// * [locations private connections routes list projects](ProjectLocationPrivateConnectionRouteListCall) (response)
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct ListRoutesResponse {
763 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
764 #[serde(rename = "nextPageToken")]
765 pub next_page_token: Option<String>,
766 /// List of Routes.
767 pub routes: Option<Vec<Route>>,
768 /// Locations that could not be reached.
769 pub unreachable: Option<Vec<String>>,
770}
771
772impl common::ResponseResult for ListRoutesResponse {}
773
774/// Response containing the objects for a stream.
775///
776/// # Activities
777///
778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
780///
781/// * [locations streams objects list projects](ProjectLocationStreamObjectListCall) (response)
782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
783#[serde_with::serde_as]
784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
785pub struct ListStreamObjectsResponse {
786 /// A token, which can be sent as `page_token` to retrieve the next page.
787 #[serde(rename = "nextPageToken")]
788 pub next_page_token: Option<String>,
789 /// List of stream objects.
790 #[serde(rename = "streamObjects")]
791 pub stream_objects: Option<Vec<StreamObject>>,
792}
793
794impl common::ResponseResult for ListStreamObjectsResponse {}
795
796/// Response message for listing streams.
797///
798/// # Activities
799///
800/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
801/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
802///
803/// * [locations streams list projects](ProjectLocationStreamListCall) (response)
804#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
805#[serde_with::serde_as]
806#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
807pub struct ListStreamsResponse {
808 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
809 #[serde(rename = "nextPageToken")]
810 pub next_page_token: Option<String>,
811 /// List of streams
812 pub streams: Option<Vec<Stream>>,
813 /// Locations that could not be reached.
814 pub unreachable: Option<Vec<String>>,
815}
816
817impl common::ResponseResult for ListStreamsResponse {}
818
819/// A resource that represents a Google Cloud location.
820///
821/// # Activities
822///
823/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
824/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
825///
826/// * [locations get projects](ProjectLocationGetCall) (response)
827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
828#[serde_with::serde_as]
829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
830pub struct Location {
831 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
832 #[serde(rename = "displayName")]
833 pub display_name: Option<String>,
834 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
835 pub labels: Option<HashMap<String, String>>,
836 /// The canonical id for this location. For example: `"us-east1"`.
837 #[serde(rename = "locationId")]
838 pub location_id: Option<String>,
839 /// Service-specific metadata. For example the available capacity at the given location.
840 pub metadata: Option<HashMap<String, serde_json::Value>>,
841 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
842 pub name: Option<String>,
843}
844
845impl common::ResponseResult for Location {}
846
847/// Request for looking up a specific stream object by its source object identifier.
848///
849/// # Activities
850///
851/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
852/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
853///
854/// * [locations streams objects lookup projects](ProjectLocationStreamObjectLookupCall) (request)
855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
856#[serde_with::serde_as]
857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
858pub struct LookupStreamObjectRequest {
859 /// Required. The source object identifier which maps to the stream object.
860 #[serde(rename = "sourceObjectIdentifier")]
861 pub source_object_identifier: Option<SourceObjectIdentifier>,
862}
863
864impl common::RequestValue for LookupStreamObjectRequest {}
865
866/// Merge mode defines that all changes to a table will be merged at the destination table.
867///
868/// This type is not used in any activity, and only used as *part* of another schema.
869///
870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
871#[serde_with::serde_as]
872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
873pub struct Merge {
874 _never_set: Option<bool>,
875}
876
877impl common::Part for Merge {}
878
879/// CDC strategy to start replicating from the most recent position in the source.
880///
881/// This type is not used in any activity, and only used as *part* of another schema.
882///
883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
884#[serde_with::serde_as]
885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
886pub struct MostRecentStartPosition {
887 _never_set: Option<bool>,
888}
889
890impl common::Part for MostRecentStartPosition {}
891
892/// MySQL Column.
893///
894/// This type is not used in any activity, and only used as *part* of another schema.
895///
896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
897#[serde_with::serde_as]
898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
899pub struct MysqlColumn {
900 /// Column collation.
901 pub collation: Option<String>,
902 /// Column name.
903 pub column: Option<String>,
904 /// The MySQL data type. Full data types list can be found here: https://dev.mysql.com/doc/refman/8.0/en/data-types.html
905 #[serde(rename = "dataType")]
906 pub data_type: Option<String>,
907 /// Column length.
908 pub length: Option<i32>,
909 /// Whether or not the column can accept a null value.
910 pub nullable: Option<bool>,
911 /// The ordinal position of the column in the table.
912 #[serde(rename = "ordinalPosition")]
913 pub ordinal_position: Option<i32>,
914 /// Column precision.
915 pub precision: Option<i32>,
916 /// Whether or not the column represents a primary key.
917 #[serde(rename = "primaryKey")]
918 pub primary_key: Option<bool>,
919 /// Column scale.
920 pub scale: Option<i32>,
921}
922
923impl common::Part for MysqlColumn {}
924
925/// MySQL database.
926///
927/// This type is not used in any activity, and only used as *part* of another schema.
928///
929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
930#[serde_with::serde_as]
931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
932pub struct MysqlDatabase {
933 /// Database name.
934 pub database: Option<String>,
935 /// Tables in the database.
936 #[serde(rename = "mysqlTables")]
937 pub mysql_tables: Option<Vec<MysqlTable>>,
938}
939
940impl common::Part for MysqlDatabase {}
941
942/// MySQL log position
943///
944/// This type is not used in any activity, and only used as *part* of another schema.
945///
946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
947#[serde_with::serde_as]
948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
949pub struct MysqlLogPosition {
950 /// Required. The binary log file name.
951 #[serde(rename = "logFile")]
952 pub log_file: Option<String>,
953 /// Optional. The position within the binary log file. Default is head of file.
954 #[serde(rename = "logPosition")]
955 pub log_position: Option<i32>,
956}
957
958impl common::Part for MysqlLogPosition {}
959
960/// Mysql data source object identifier.
961///
962/// This type is not used in any activity, and only used as *part* of another schema.
963///
964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
965#[serde_with::serde_as]
966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
967pub struct MysqlObjectIdentifier {
968 /// Required. The database name.
969 pub database: Option<String>,
970 /// Required. The table name.
971 pub table: Option<String>,
972}
973
974impl common::Part for MysqlObjectIdentifier {}
975
976/// MySQL database profile.
977///
978/// This type is not used in any activity, and only used as *part* of another schema.
979///
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct MysqlProfile {
984 /// Required. Hostname for the MySQL connection.
985 pub hostname: Option<String>,
986 /// Required. Input only. Password for the MySQL connection.
987 pub password: Option<String>,
988 /// Port for the MySQL connection, default value is 3306.
989 pub port: Option<i32>,
990 /// SSL configuration for the MySQL connection.
991 #[serde(rename = "sslConfig")]
992 pub ssl_config: Option<MysqlSslConfig>,
993 /// Required. Username for the MySQL connection.
994 pub username: Option<String>,
995}
996
997impl common::Part for MysqlProfile {}
998
999/// MySQL database structure
1000///
1001/// This type is not used in any activity, and only used as *part* of another schema.
1002///
1003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1004#[serde_with::serde_as]
1005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1006pub struct MysqlRdbms {
1007 /// Mysql databases on the server
1008 #[serde(rename = "mysqlDatabases")]
1009 pub mysql_databases: Option<Vec<MysqlDatabase>>,
1010}
1011
1012impl common::Part for MysqlRdbms {}
1013
1014/// MySQL source configuration
1015///
1016/// This type is not used in any activity, and only used as *part* of another schema.
1017///
1018#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1019#[serde_with::serde_as]
1020#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1021pub struct MysqlSourceConfig {
1022 /// MySQL objects to exclude from the stream.
1023 #[serde(rename = "excludeObjects")]
1024 pub exclude_objects: Option<MysqlRdbms>,
1025 /// MySQL objects to retrieve from the source.
1026 #[serde(rename = "includeObjects")]
1027 pub include_objects: Option<MysqlRdbms>,
1028 /// 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.
1029 #[serde(rename = "maxConcurrentBackfillTasks")]
1030 pub max_concurrent_backfill_tasks: Option<i32>,
1031 /// 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.
1032 #[serde(rename = "maxConcurrentCdcTasks")]
1033 pub max_concurrent_cdc_tasks: Option<i32>,
1034}
1035
1036impl common::Part for MysqlSourceConfig {}
1037
1038/// MySQL SSL configuration information.
1039///
1040/// This type is not used in any activity, and only used as *part* of another schema.
1041///
1042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1043#[serde_with::serde_as]
1044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1045pub struct MysqlSslConfig {
1046 /// Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
1047 #[serde(rename = "caCertificate")]
1048 pub ca_certificate: Option<String>,
1049 /// Output only. Indicates whether the ca_certificate field is set.
1050 #[serde(rename = "caCertificateSet")]
1051 pub ca_certificate_set: Option<bool>,
1052 /// 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.
1053 #[serde(rename = "clientCertificate")]
1054 pub client_certificate: Option<String>,
1055 /// Output only. Indicates whether the client_certificate field is set.
1056 #[serde(rename = "clientCertificateSet")]
1057 pub client_certificate_set: Option<bool>,
1058 /// 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.
1059 #[serde(rename = "clientKey")]
1060 pub client_key: Option<String>,
1061 /// Output only. Indicates whether the client_key field is set.
1062 #[serde(rename = "clientKeySet")]
1063 pub client_key_set: Option<bool>,
1064}
1065
1066impl common::Part for MysqlSslConfig {}
1067
1068/// MySQL table.
1069///
1070/// This type is not used in any activity, and only used as *part* of another schema.
1071///
1072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1073#[serde_with::serde_as]
1074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1075pub struct MysqlTable {
1076 /// MySQL columns in the database. When unspecified as part of include/exclude objects, includes/excludes everything.
1077 #[serde(rename = "mysqlColumns")]
1078 pub mysql_columns: Option<Vec<MysqlColumn>>,
1079 /// Table name.
1080 pub table: Option<String>,
1081}
1082
1083impl common::Part for MysqlTable {}
1084
1085/// CDC strategy to resume replication from the next available position in the source.
1086///
1087/// This type is not used in any activity, and only used as *part* of another schema.
1088///
1089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1090#[serde_with::serde_as]
1091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1092pub struct NextAvailableStartPosition {
1093 _never_set: Option<bool>,
1094}
1095
1096impl common::Part for NextAvailableStartPosition {}
1097
1098/// This resource represents a long-running operation that is the result of a network API call.
1099///
1100/// # Activities
1101///
1102/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1103/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1104///
1105/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (response)
1106/// * [locations connection profiles delete projects](ProjectLocationConnectionProfileDeleteCall) (response)
1107/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (response)
1108/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1109/// * [locations private connections routes create projects](ProjectLocationPrivateConnectionRouteCreateCall) (response)
1110/// * [locations private connections routes delete projects](ProjectLocationPrivateConnectionRouteDeleteCall) (response)
1111/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (response)
1112/// * [locations private connections delete projects](ProjectLocationPrivateConnectionDeleteCall) (response)
1113/// * [locations streams create projects](ProjectLocationStreamCreateCall) (response)
1114/// * [locations streams delete projects](ProjectLocationStreamDeleteCall) (response)
1115/// * [locations streams patch projects](ProjectLocationStreamPatchCall) (response)
1116/// * [locations streams run projects](ProjectLocationStreamRunCall) (response)
1117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1118#[serde_with::serde_as]
1119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1120pub struct Operation {
1121 /// 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.
1122 pub done: Option<bool>,
1123 /// The error result of the operation in case of failure or cancellation.
1124 pub error: Option<Status>,
1125 /// 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.
1126 pub metadata: Option<HashMap<String, serde_json::Value>>,
1127 /// 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}`.
1128 pub name: Option<String>,
1129 /// 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`.
1130 pub response: Option<HashMap<String, serde_json::Value>>,
1131}
1132
1133impl common::ResponseResult for Operation {}
1134
1135/// Oracle Column.
1136///
1137/// This type is not used in any activity, and only used as *part* of another schema.
1138///
1139#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1140#[serde_with::serde_as]
1141#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1142pub struct OracleColumn {
1143 /// Column name.
1144 pub column: Option<String>,
1145 /// The Oracle data type.
1146 #[serde(rename = "dataType")]
1147 pub data_type: Option<String>,
1148 /// Column encoding.
1149 pub encoding: Option<String>,
1150 /// Column length.
1151 pub length: Option<i32>,
1152 /// Whether or not the column can accept a null value.
1153 pub nullable: Option<bool>,
1154 /// The ordinal position of the column in the table.
1155 #[serde(rename = "ordinalPosition")]
1156 pub ordinal_position: Option<i32>,
1157 /// Column precision.
1158 pub precision: Option<i32>,
1159 /// Whether or not the column represents a primary key.
1160 #[serde(rename = "primaryKey")]
1161 pub primary_key: Option<bool>,
1162 /// Column scale.
1163 pub scale: Option<i32>,
1164}
1165
1166impl common::Part for OracleColumn {}
1167
1168/// Oracle data source object identifier.
1169///
1170/// This type is not used in any activity, and only used as *part* of another schema.
1171///
1172#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1173#[serde_with::serde_as]
1174#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1175pub struct OracleObjectIdentifier {
1176 /// Required. The schema name.
1177 pub schema: Option<String>,
1178 /// Required. The table name.
1179 pub table: Option<String>,
1180}
1181
1182impl common::Part for OracleObjectIdentifier {}
1183
1184/// Oracle database profile.
1185///
1186/// This type is not used in any activity, and only used as *part* of another schema.
1187///
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct OracleProfile {
1192 /// Connection string attributes
1193 #[serde(rename = "connectionAttributes")]
1194 pub connection_attributes: Option<HashMap<String, String>>,
1195 /// Required. Database for the Oracle connection.
1196 #[serde(rename = "databaseService")]
1197 pub database_service: Option<String>,
1198 /// Required. Hostname for the Oracle connection.
1199 pub hostname: Option<String>,
1200 /// Optional. SSL configuration for the Oracle connection.
1201 #[serde(rename = "oracleSslConfig")]
1202 pub oracle_ssl_config: Option<OracleSslConfig>,
1203 /// Required. Password for the Oracle connection.
1204 pub password: Option<String>,
1205 /// Port for the Oracle connection, default value is 1521.
1206 pub port: Option<i32>,
1207 /// Required. Username for the Oracle connection.
1208 pub username: Option<String>,
1209}
1210
1211impl common::Part for OracleProfile {}
1212
1213/// Oracle database structure.
1214///
1215/// This type is not used in any activity, and only used as *part* of another schema.
1216///
1217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1218#[serde_with::serde_as]
1219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1220pub struct OracleRdbms {
1221 /// Oracle schemas/databases in the database server.
1222 #[serde(rename = "oracleSchemas")]
1223 pub oracle_schemas: Option<Vec<OracleSchema>>,
1224}
1225
1226impl common::Part for OracleRdbms {}
1227
1228/// Oracle schema.
1229///
1230/// This type is not used in any activity, and only used as *part* of another schema.
1231///
1232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1233#[serde_with::serde_as]
1234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1235pub struct OracleSchema {
1236 /// Tables in the schema.
1237 #[serde(rename = "oracleTables")]
1238 pub oracle_tables: Option<Vec<OracleTable>>,
1239 /// Schema name.
1240 pub schema: Option<String>,
1241}
1242
1243impl common::Part for OracleSchema {}
1244
1245/// Oracle SCN position
1246///
1247/// This type is not used in any activity, and only used as *part* of another schema.
1248///
1249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1250#[serde_with::serde_as]
1251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1252pub struct OracleScnPosition {
1253 /// Required. SCN number from where Logs will be read
1254 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1255 pub scn: Option<i64>,
1256}
1257
1258impl common::Part for OracleScnPosition {}
1259
1260/// Oracle data source configuration
1261///
1262/// This type is not used in any activity, and only used as *part* of another schema.
1263///
1264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1265#[serde_with::serde_as]
1266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1267pub struct OracleSourceConfig {
1268 /// Drop large object values.
1269 #[serde(rename = "dropLargeObjects")]
1270 pub drop_large_objects: Option<DropLargeObjects>,
1271 /// Oracle objects to exclude from the stream.
1272 #[serde(rename = "excludeObjects")]
1273 pub exclude_objects: Option<OracleRdbms>,
1274 /// Oracle objects to include in the stream.
1275 #[serde(rename = "includeObjects")]
1276 pub include_objects: Option<OracleRdbms>,
1277 /// 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.
1278 #[serde(rename = "maxConcurrentBackfillTasks")]
1279 pub max_concurrent_backfill_tasks: Option<i32>,
1280 /// 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.
1281 #[serde(rename = "maxConcurrentCdcTasks")]
1282 pub max_concurrent_cdc_tasks: Option<i32>,
1283 /// Stream large object values.
1284 #[serde(rename = "streamLargeObjects")]
1285 pub stream_large_objects: Option<StreamLargeObjects>,
1286}
1287
1288impl common::Part for OracleSourceConfig {}
1289
1290/// Oracle SSL configuration information.
1291///
1292/// This type is not used in any activity, and only used as *part* of another schema.
1293///
1294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1295#[serde_with::serde_as]
1296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1297pub struct OracleSslConfig {
1298 /// Input only. PEM-encoded certificate of the CA that signed the source database server's certificate.
1299 #[serde(rename = "caCertificate")]
1300 pub ca_certificate: Option<String>,
1301 /// Output only. Indicates whether the ca_certificate field has been set for this Connection-Profile.
1302 #[serde(rename = "caCertificateSet")]
1303 pub ca_certificate_set: Option<bool>,
1304}
1305
1306impl common::Part for OracleSslConfig {}
1307
1308/// Oracle table.
1309///
1310/// This type is not used in any activity, and only used as *part* of another schema.
1311///
1312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1313#[serde_with::serde_as]
1314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1315pub struct OracleTable {
1316 /// Oracle columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
1317 #[serde(rename = "oracleColumns")]
1318 pub oracle_columns: Option<Vec<OracleColumn>>,
1319 /// Table name.
1320 pub table: Option<String>,
1321}
1322
1323impl common::Part for OracleTable {}
1324
1325/// PostgreSQL Column.
1326///
1327/// This type is not used in any activity, and only used as *part* of another schema.
1328///
1329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1330#[serde_with::serde_as]
1331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1332pub struct PostgresqlColumn {
1333 /// Column name.
1334 pub column: Option<String>,
1335 /// The PostgreSQL data type.
1336 #[serde(rename = "dataType")]
1337 pub data_type: Option<String>,
1338 /// Column length.
1339 pub length: Option<i32>,
1340 /// Whether or not the column can accept a null value.
1341 pub nullable: Option<bool>,
1342 /// The ordinal position of the column in the table.
1343 #[serde(rename = "ordinalPosition")]
1344 pub ordinal_position: Option<i32>,
1345 /// Column precision.
1346 pub precision: Option<i32>,
1347 /// Whether or not the column represents a primary key.
1348 #[serde(rename = "primaryKey")]
1349 pub primary_key: Option<bool>,
1350 /// Column scale.
1351 pub scale: Option<i32>,
1352}
1353
1354impl common::Part for PostgresqlColumn {}
1355
1356/// PostgreSQL data source object identifier.
1357///
1358/// This type is not used in any activity, and only used as *part* of another schema.
1359///
1360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1361#[serde_with::serde_as]
1362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1363pub struct PostgresqlObjectIdentifier {
1364 /// Required. The schema name.
1365 pub schema: Option<String>,
1366 /// Required. The table name.
1367 pub table: Option<String>,
1368}
1369
1370impl common::Part for PostgresqlObjectIdentifier {}
1371
1372/// PostgreSQL database profile.
1373///
1374/// This type is not used in any activity, and only used as *part* of another schema.
1375///
1376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1377#[serde_with::serde_as]
1378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1379pub struct PostgresqlProfile {
1380 /// Required. Database for the PostgreSQL connection.
1381 pub database: Option<String>,
1382 /// Required. Hostname for the PostgreSQL connection.
1383 pub hostname: Option<String>,
1384 /// Required. Password for the PostgreSQL connection.
1385 pub password: Option<String>,
1386 /// Port for the PostgreSQL connection, default value is 5432.
1387 pub port: Option<i32>,
1388 /// Required. Username for the PostgreSQL connection.
1389 pub username: Option<String>,
1390}
1391
1392impl common::Part for PostgresqlProfile {}
1393
1394/// PostgreSQL database structure.
1395///
1396/// This type is not used in any activity, and only used as *part* of another schema.
1397///
1398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1399#[serde_with::serde_as]
1400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1401pub struct PostgresqlRdbms {
1402 /// PostgreSQL schemas in the database server.
1403 #[serde(rename = "postgresqlSchemas")]
1404 pub postgresql_schemas: Option<Vec<PostgresqlSchema>>,
1405}
1406
1407impl common::Part for PostgresqlRdbms {}
1408
1409/// PostgreSQL schema.
1410///
1411/// This type is not used in any activity, and only used as *part* of another schema.
1412///
1413#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1414#[serde_with::serde_as]
1415#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1416pub struct PostgresqlSchema {
1417 /// Tables in the schema.
1418 #[serde(rename = "postgresqlTables")]
1419 pub postgresql_tables: Option<Vec<PostgresqlTable>>,
1420 /// Schema name.
1421 pub schema: Option<String>,
1422}
1423
1424impl common::Part for PostgresqlSchema {}
1425
1426/// PostgreSQL data source configuration
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 PostgresqlSourceConfig {
1434 /// PostgreSQL objects to exclude from the stream.
1435 #[serde(rename = "excludeObjects")]
1436 pub exclude_objects: Option<PostgresqlRdbms>,
1437 /// PostgreSQL objects to include in the stream.
1438 #[serde(rename = "includeObjects")]
1439 pub include_objects: Option<PostgresqlRdbms>,
1440 /// 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.
1441 #[serde(rename = "maxConcurrentBackfillTasks")]
1442 pub max_concurrent_backfill_tasks: Option<i32>,
1443 /// Required. The name of the publication that includes the set of all tables that are defined in the stream's include_objects.
1444 pub publication: Option<String>,
1445 /// Required. Immutable. The name of the logical replication slot that's configured with the pgoutput plugin.
1446 #[serde(rename = "replicationSlot")]
1447 pub replication_slot: Option<String>,
1448}
1449
1450impl common::Part for PostgresqlSourceConfig {}
1451
1452/// PostgreSQL table.
1453///
1454/// This type is not used in any activity, and only used as *part* of another schema.
1455///
1456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1457#[serde_with::serde_as]
1458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1459pub struct PostgresqlTable {
1460 /// PostgreSQL columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
1461 #[serde(rename = "postgresqlColumns")]
1462 pub postgresql_columns: Option<Vec<PostgresqlColumn>>,
1463 /// Table name.
1464 pub table: Option<String>,
1465}
1466
1467impl common::Part for PostgresqlTable {}
1468
1469/// The PrivateConnection resource is used to establish private connectivity between Datastream and a customer’s network.
1470///
1471/// # Activities
1472///
1473/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1474/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1475///
1476/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (request)
1477/// * [locations private connections get projects](ProjectLocationPrivateConnectionGetCall) (response)
1478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1479#[serde_with::serde_as]
1480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1481pub struct PrivateConnection {
1482 /// Output only. The create time of the resource.
1483 #[serde(rename = "createTime")]
1484 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1485 /// Required. Display name.
1486 #[serde(rename = "displayName")]
1487 pub display_name: Option<String>,
1488 /// Output only. In case of error, the details of the error in a user-friendly format.
1489 pub error: Option<Error>,
1490 /// Labels.
1491 pub labels: Option<HashMap<String, String>>,
1492 /// Output only. The resource's name.
1493 pub name: Option<String>,
1494 /// Output only. The state of the Private Connection.
1495 pub state: Option<String>,
1496 /// Output only. The update time of the resource.
1497 #[serde(rename = "updateTime")]
1498 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1499 /// VPC Peering Config.
1500 #[serde(rename = "vpcPeeringConfig")]
1501 pub vpc_peering_config: Option<VpcPeeringConfig>,
1502}
1503
1504impl common::RequestValue for PrivateConnection {}
1505impl common::ResponseResult for PrivateConnection {}
1506
1507/// Private Connectivity
1508///
1509/// This type is not used in any activity, and only used as *part* of another schema.
1510///
1511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1512#[serde_with::serde_as]
1513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1514pub struct PrivateConnectivity {
1515 /// Required. A reference to a private connection resource. Format: `projects/{project}/locations/{location}/privateConnections/{name}`
1516 #[serde(rename = "privateConnection")]
1517 pub private_connection: Option<String>,
1518}
1519
1520impl common::Part for PrivateConnectivity {}
1521
1522/// The route resource is the child of the private connection resource, used for defining a route for a private connection.
1523///
1524/// # Activities
1525///
1526/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1527/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1528///
1529/// * [locations private connections routes create projects](ProjectLocationPrivateConnectionRouteCreateCall) (request)
1530/// * [locations private connections routes get projects](ProjectLocationPrivateConnectionRouteGetCall) (response)
1531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1532#[serde_with::serde_as]
1533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1534pub struct Route {
1535 /// Output only. The create time of the resource.
1536 #[serde(rename = "createTime")]
1537 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1538 /// Required. Destination address for connection
1539 #[serde(rename = "destinationAddress")]
1540 pub destination_address: Option<String>,
1541 /// Destination port for connection
1542 #[serde(rename = "destinationPort")]
1543 pub destination_port: Option<i32>,
1544 /// Required. Display name.
1545 #[serde(rename = "displayName")]
1546 pub display_name: Option<String>,
1547 /// Labels.
1548 pub labels: Option<HashMap<String, String>>,
1549 /// Output only. The resource's name.
1550 pub name: Option<String>,
1551 /// Output only. The update time of the resource.
1552 #[serde(rename = "updateTime")]
1553 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1554}
1555
1556impl common::RequestValue for Route {}
1557impl common::ResponseResult for Route {}
1558
1559/// Request message for running a stream.
1560///
1561/// # Activities
1562///
1563/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1564/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1565///
1566/// * [locations streams run projects](ProjectLocationStreamRunCall) (request)
1567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1568#[serde_with::serde_as]
1569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1570pub struct RunStreamRequest {
1571 /// Optional. The CDC strategy of the stream. If not set, the system's default value will be used.
1572 #[serde(rename = "cdcStrategy")]
1573 pub cdc_strategy: Option<CdcStrategy>,
1574}
1575
1576impl common::RequestValue for RunStreamRequest {}
1577
1578/// A single target dataset to which all data will be streamed.
1579///
1580/// This type is not used in any activity, and only used as *part* of another schema.
1581///
1582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1583#[serde_with::serde_as]
1584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1585pub struct SingleTargetDataset {
1586 /// The dataset ID of the target dataset. DatasetIds allowed characters: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#datasetreference.
1587 #[serde(rename = "datasetId")]
1588 pub dataset_id: Option<String>,
1589}
1590
1591impl common::Part for SingleTargetDataset {}
1592
1593/// The configuration of the stream source.
1594///
1595/// This type is not used in any activity, and only used as *part* of another schema.
1596///
1597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1598#[serde_with::serde_as]
1599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1600pub struct SourceConfig {
1601 /// MySQL data source configuration.
1602 #[serde(rename = "mysqlSourceConfig")]
1603 pub mysql_source_config: Option<MysqlSourceConfig>,
1604 /// Oracle data source configuration.
1605 #[serde(rename = "oracleSourceConfig")]
1606 pub oracle_source_config: Option<OracleSourceConfig>,
1607 /// PostgreSQL data source configuration.
1608 #[serde(rename = "postgresqlSourceConfig")]
1609 pub postgresql_source_config: Option<PostgresqlSourceConfig>,
1610 /// Required. Source connection profile resoource. Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
1611 #[serde(rename = "sourceConnectionProfile")]
1612 pub source_connection_profile: Option<String>,
1613 /// SQLServer data source configuration.
1614 #[serde(rename = "sqlServerSourceConfig")]
1615 pub sql_server_source_config: Option<SqlServerSourceConfig>,
1616}
1617
1618impl common::Part for SourceConfig {}
1619
1620/// Destination datasets are created so that hierarchy of the destination data objects matches the source hierarchy.
1621///
1622/// This type is not used in any activity, and only used as *part* of another schema.
1623///
1624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1625#[serde_with::serde_as]
1626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1627pub struct SourceHierarchyDatasets {
1628 /// The dataset template to use for dynamic dataset creation.
1629 #[serde(rename = "datasetTemplate")]
1630 pub dataset_template: Option<DatasetTemplate>,
1631}
1632
1633impl common::Part for SourceHierarchyDatasets {}
1634
1635/// Represents an identifier of an object in the data source.
1636///
1637/// This type is not used in any activity, and only used as *part* of another schema.
1638///
1639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1640#[serde_with::serde_as]
1641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1642pub struct SourceObjectIdentifier {
1643 /// Mysql data source object identifier.
1644 #[serde(rename = "mysqlIdentifier")]
1645 pub mysql_identifier: Option<MysqlObjectIdentifier>,
1646 /// Oracle data source object identifier.
1647 #[serde(rename = "oracleIdentifier")]
1648 pub oracle_identifier: Option<OracleObjectIdentifier>,
1649 /// PostgreSQL data source object identifier.
1650 #[serde(rename = "postgresqlIdentifier")]
1651 pub postgresql_identifier: Option<PostgresqlObjectIdentifier>,
1652 /// SQLServer data source object identifier.
1653 #[serde(rename = "sqlServerIdentifier")]
1654 pub sql_server_identifier: Option<SqlServerObjectIdentifier>,
1655}
1656
1657impl common::Part for SourceObjectIdentifier {}
1658
1659/// CDC strategy to start replicating from a specific position in the source.
1660///
1661/// This type is not used in any activity, and only used as *part* of another schema.
1662///
1663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1664#[serde_with::serde_as]
1665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1666pub struct SpecificStartPosition {
1667 /// MySQL specific log position to start replicating from.
1668 #[serde(rename = "mysqlLogPosition")]
1669 pub mysql_log_position: Option<MysqlLogPosition>,
1670 /// Oracle SCN to start replicating from.
1671 #[serde(rename = "oracleScnPosition")]
1672 pub oracle_scn_position: Option<OracleScnPosition>,
1673}
1674
1675impl common::Part for SpecificStartPosition {}
1676
1677/// Configuration to use Change Tables CDC read method.
1678///
1679/// This type is not used in any activity, and only used as *part* of another schema.
1680///
1681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1682#[serde_with::serde_as]
1683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1684pub struct SqlServerChangeTables {
1685 _never_set: Option<bool>,
1686}
1687
1688impl common::Part for SqlServerChangeTables {}
1689
1690/// SQLServer Column.
1691///
1692/// This type is not used in any activity, and only used as *part* of another schema.
1693///
1694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1695#[serde_with::serde_as]
1696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1697pub struct SqlServerColumn {
1698 /// Column name.
1699 pub column: Option<String>,
1700 /// The SQLServer data type.
1701 #[serde(rename = "dataType")]
1702 pub data_type: Option<String>,
1703 /// Column length.
1704 pub length: Option<i32>,
1705 /// Whether or not the column can accept a null value.
1706 pub nullable: Option<bool>,
1707 /// The ordinal position of the column in the table.
1708 #[serde(rename = "ordinalPosition")]
1709 pub ordinal_position: Option<i32>,
1710 /// Column precision.
1711 pub precision: Option<i32>,
1712 /// Whether or not the column represents a primary key.
1713 #[serde(rename = "primaryKey")]
1714 pub primary_key: Option<bool>,
1715 /// Column scale.
1716 pub scale: Option<i32>,
1717}
1718
1719impl common::Part for SqlServerColumn {}
1720
1721/// SQLServer data source object identifier.
1722///
1723/// This type is not used in any activity, and only used as *part* of another schema.
1724///
1725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1726#[serde_with::serde_as]
1727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1728pub struct SqlServerObjectIdentifier {
1729 /// Required. The schema name.
1730 pub schema: Option<String>,
1731 /// Required. The table name.
1732 pub table: Option<String>,
1733}
1734
1735impl common::Part for SqlServerObjectIdentifier {}
1736
1737/// SQLServer database profile
1738///
1739/// This type is not used in any activity, and only used as *part* of another schema.
1740///
1741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1742#[serde_with::serde_as]
1743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1744pub struct SqlServerProfile {
1745 /// Required. Database for the SQLServer connection.
1746 pub database: Option<String>,
1747 /// Required. Hostname for the SQLServer connection.
1748 pub hostname: Option<String>,
1749 /// Required. Password for the SQLServer connection.
1750 pub password: Option<String>,
1751 /// Port for the SQLServer connection, default value is 1433.
1752 pub port: Option<i32>,
1753 /// Required. Username for the SQLServer connection.
1754 pub username: Option<String>,
1755}
1756
1757impl common::Part for SqlServerProfile {}
1758
1759/// SQLServer database structure.
1760///
1761/// This type is not used in any activity, and only used as *part* of another schema.
1762///
1763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1764#[serde_with::serde_as]
1765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1766pub struct SqlServerRdbms {
1767 /// SQLServer schemas in the database server.
1768 pub schemas: Option<Vec<SqlServerSchema>>,
1769}
1770
1771impl common::Part for SqlServerRdbms {}
1772
1773/// SQLServer schema.
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 SqlServerSchema {
1781 /// Schema name.
1782 pub schema: Option<String>,
1783 /// Tables in the schema.
1784 pub tables: Option<Vec<SqlServerTable>>,
1785}
1786
1787impl common::Part for SqlServerSchema {}
1788
1789/// SQLServer data source configuration
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 SqlServerSourceConfig {
1797 /// CDC reader reads from change tables.
1798 #[serde(rename = "changeTables")]
1799 pub change_tables: Option<SqlServerChangeTables>,
1800 /// SQLServer objects to exclude from the stream.
1801 #[serde(rename = "excludeObjects")]
1802 pub exclude_objects: Option<SqlServerRdbms>,
1803 /// SQLServer objects to include in the stream.
1804 #[serde(rename = "includeObjects")]
1805 pub include_objects: Option<SqlServerRdbms>,
1806 /// Max concurrent backfill tasks.
1807 #[serde(rename = "maxConcurrentBackfillTasks")]
1808 pub max_concurrent_backfill_tasks: Option<i32>,
1809 /// Max concurrent CDC tasks.
1810 #[serde(rename = "maxConcurrentCdcTasks")]
1811 pub max_concurrent_cdc_tasks: Option<i32>,
1812 /// CDC reader reads from transaction logs.
1813 #[serde(rename = "transactionLogs")]
1814 pub transaction_logs: Option<SqlServerTransactionLogs>,
1815}
1816
1817impl common::Part for SqlServerSourceConfig {}
1818
1819/// SQLServer table.
1820///
1821/// This type is not used in any activity, and only used as *part* of another schema.
1822///
1823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1824#[serde_with::serde_as]
1825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1826pub struct SqlServerTable {
1827 /// SQLServer columns in the schema. When unspecified as part of include/exclude objects, includes/excludes everything.
1828 pub columns: Option<Vec<SqlServerColumn>>,
1829 /// Table name.
1830 pub table: Option<String>,
1831}
1832
1833impl common::Part for SqlServerTable {}
1834
1835/// Configuration to use Transaction Logs CDC read method.
1836///
1837/// This type is not used in any activity, and only used as *part* of another schema.
1838///
1839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1840#[serde_with::serde_as]
1841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1842pub struct SqlServerTransactionLogs {
1843 _never_set: Option<bool>,
1844}
1845
1846impl common::Part for SqlServerTransactionLogs {}
1847
1848/// Request for manually initiating a backfill job for a specific stream object.
1849///
1850/// # Activities
1851///
1852/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1853/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1854///
1855/// * [locations streams objects start backfill job projects](ProjectLocationStreamObjectStartBackfillJobCall) (request)
1856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1857#[serde_with::serde_as]
1858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1859pub struct StartBackfillJobRequest {
1860 _never_set: Option<bool>,
1861}
1862
1863impl common::RequestValue for StartBackfillJobRequest {}
1864
1865/// Response for manually initiating a backfill job for a specific stream object.
1866///
1867/// # Activities
1868///
1869/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1870/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1871///
1872/// * [locations streams objects start backfill job projects](ProjectLocationStreamObjectStartBackfillJobCall) (response)
1873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1874#[serde_with::serde_as]
1875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1876pub struct StartBackfillJobResponse {
1877 /// The stream object resource a backfill job was started for.
1878 pub object: Option<StreamObject>,
1879}
1880
1881impl common::ResponseResult for StartBackfillJobResponse {}
1882
1883/// 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.
1884///
1885/// This type is not used in any activity, and only used as *part* of another schema.
1886///
1887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1888#[serde_with::serde_as]
1889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1890pub struct StaticServiceIpConnectivity {
1891 _never_set: Option<bool>,
1892}
1893
1894impl common::Part for StaticServiceIpConnectivity {}
1895
1896/// 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).
1897///
1898/// This type is not used in any activity, and only used as *part* of another schema.
1899///
1900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1901#[serde_with::serde_as]
1902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1903pub struct Status {
1904 /// The status code, which should be an enum value of google.rpc.Code.
1905 pub code: Option<i32>,
1906 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1907 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1908 /// 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.
1909 pub message: Option<String>,
1910}
1911
1912impl common::Part for Status {}
1913
1914/// Request for manually stopping a running backfill job for a specific stream object.
1915///
1916/// # Activities
1917///
1918/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1919/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1920///
1921/// * [locations streams objects stop backfill job projects](ProjectLocationStreamObjectStopBackfillJobCall) (request)
1922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1923#[serde_with::serde_as]
1924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1925pub struct StopBackfillJobRequest {
1926 _never_set: Option<bool>,
1927}
1928
1929impl common::RequestValue for StopBackfillJobRequest {}
1930
1931/// Response for manually stop a backfill job for a specific stream object.
1932///
1933/// # Activities
1934///
1935/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1936/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1937///
1938/// * [locations streams objects stop backfill job projects](ProjectLocationStreamObjectStopBackfillJobCall) (response)
1939#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1940#[serde_with::serde_as]
1941#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1942pub struct StopBackfillJobResponse {
1943 /// The stream object resource the backfill job was stopped for.
1944 pub object: Option<StreamObject>,
1945}
1946
1947impl common::ResponseResult for StopBackfillJobResponse {}
1948
1949/// A resource representing streaming data from a source to a destination.
1950///
1951/// # Activities
1952///
1953/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1954/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1955///
1956/// * [locations streams create projects](ProjectLocationStreamCreateCall) (request)
1957/// * [locations streams get projects](ProjectLocationStreamGetCall) (response)
1958/// * [locations streams patch projects](ProjectLocationStreamPatchCall) (request)
1959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1960#[serde_with::serde_as]
1961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1962pub struct Stream {
1963 /// Automatically backfill objects included in the stream source configuration. Specific objects can be excluded.
1964 #[serde(rename = "backfillAll")]
1965 pub backfill_all: Option<BackfillAllStrategy>,
1966 /// Do not automatically backfill any objects.
1967 #[serde(rename = "backfillNone")]
1968 pub backfill_none: Option<BackfillNoneStrategy>,
1969 /// Output only. The creation time of the stream.
1970 #[serde(rename = "createTime")]
1971 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1972 /// 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.
1973 #[serde(rename = "customerManagedEncryptionKey")]
1974 pub customer_managed_encryption_key: Option<String>,
1975 /// Required. Destination connection profile configuration.
1976 #[serde(rename = "destinationConfig")]
1977 pub destination_config: Option<DestinationConfig>,
1978 /// Required. Display name.
1979 #[serde(rename = "displayName")]
1980 pub display_name: Option<String>,
1981 /// Output only. Errors on the Stream.
1982 pub errors: Option<Vec<Error>>,
1983 /// Labels.
1984 pub labels: Option<HashMap<String, String>>,
1985 /// Output only. If the stream was recovered, the time of the last recovery. Note: This field is currently experimental.
1986 #[serde(rename = "lastRecoveryTime")]
1987 pub last_recovery_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1988 /// Output only. The stream's name.
1989 pub name: Option<String>,
1990 /// Required. Source connection profile configuration.
1991 #[serde(rename = "sourceConfig")]
1992 pub source_config: Option<SourceConfig>,
1993 /// The state of the stream.
1994 pub state: Option<String>,
1995 /// Output only. The last update time of the stream.
1996 #[serde(rename = "updateTime")]
1997 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1998}
1999
2000impl common::RequestValue for Stream {}
2001impl common::ResponseResult for Stream {}
2002
2003/// Configuration to stream large object values.
2004///
2005/// This type is not used in any activity, and only used as *part* of another schema.
2006///
2007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2008#[serde_with::serde_as]
2009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2010pub struct StreamLargeObjects {
2011 _never_set: Option<bool>,
2012}
2013
2014impl common::Part for StreamLargeObjects {}
2015
2016/// A specific stream object (e.g a specific DB table).
2017///
2018/// # Activities
2019///
2020/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2021/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2022///
2023/// * [locations streams objects get projects](ProjectLocationStreamObjectGetCall) (response)
2024/// * [locations streams objects lookup projects](ProjectLocationStreamObjectLookupCall) (response)
2025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2026#[serde_with::serde_as]
2027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2028pub struct StreamObject {
2029 /// The latest backfill job that was initiated for the stream object.
2030 #[serde(rename = "backfillJob")]
2031 pub backfill_job: Option<BackfillJob>,
2032 /// Output only. The creation time of the object.
2033 #[serde(rename = "createTime")]
2034 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2035 /// Required. Display name.
2036 #[serde(rename = "displayName")]
2037 pub display_name: Option<String>,
2038 /// Output only. Active errors on the object.
2039 pub errors: Option<Vec<Error>>,
2040 /// Output only. The object resource's name.
2041 pub name: Option<String>,
2042 /// The object identifier in the data source.
2043 #[serde(rename = "sourceObject")]
2044 pub source_object: Option<SourceObjectIdentifier>,
2045 /// Output only. The last update time of the object.
2046 #[serde(rename = "updateTime")]
2047 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2048}
2049
2050impl common::ResponseResult for StreamObject {}
2051
2052/// The VPC Peering configuration is used to create VPC peering between Datastream and the consumer's VPC.
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 VpcPeeringConfig {
2060 /// Required. A free subnet for peering. (CIDR of /29)
2061 pub subnet: Option<String>,
2062 /// Required. Fully qualified name of the VPC that Datastream will peer to. Format: `projects/{project}/global/{networks}/{name}`
2063 pub vpc: Option<String>,
2064}
2065
2066impl common::Part for VpcPeeringConfig {}
2067
2068// ###################
2069// MethodBuilders ###
2070// #################
2071
2072/// A builder providing access to all methods supported on *project* resources.
2073/// It is not used directly, but through the [`Datastream`] hub.
2074///
2075/// # Example
2076///
2077/// Instantiate a resource builder
2078///
2079/// ```test_harness,no_run
2080/// extern crate hyper;
2081/// extern crate hyper_rustls;
2082/// extern crate google_datastream1 as datastream1;
2083///
2084/// # async fn dox() {
2085/// use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2086///
2087/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2088/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2089/// secret,
2090/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2091/// ).build().await.unwrap();
2092///
2093/// let client = hyper_util::client::legacy::Client::builder(
2094/// hyper_util::rt::TokioExecutor::new()
2095/// )
2096/// .build(
2097/// hyper_rustls::HttpsConnectorBuilder::new()
2098/// .with_native_roots()
2099/// .unwrap()
2100/// .https_or_http()
2101/// .enable_http1()
2102/// .build()
2103/// );
2104/// let mut hub = Datastream::new(client, auth);
2105/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2106/// // 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(...)`
2107/// // to build up your call.
2108/// let rb = hub.projects();
2109/// # }
2110/// ```
2111pub struct ProjectMethods<'a, C>
2112where
2113 C: 'a,
2114{
2115 hub: &'a Datastream<C>,
2116}
2117
2118impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2119
2120impl<'a, C> ProjectMethods<'a, C> {
2121 /// Create a builder to help you perform the following task:
2122 ///
2123 /// Use this method to create a connection profile in a project and location.
2124 ///
2125 /// # Arguments
2126 ///
2127 /// * `request` - No description provided.
2128 /// * `parent` - Required. The parent that owns the collection of ConnectionProfiles.
2129 pub fn locations_connection_profiles_create(
2130 &self,
2131 request: ConnectionProfile,
2132 parent: &str,
2133 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
2134 ProjectLocationConnectionProfileCreateCall {
2135 hub: self.hub,
2136 _request: request,
2137 _parent: parent.to_string(),
2138 _validate_only: Default::default(),
2139 _request_id: Default::default(),
2140 _force: Default::default(),
2141 _connection_profile_id: Default::default(),
2142 _delegate: Default::default(),
2143 _additional_params: Default::default(),
2144 _scopes: Default::default(),
2145 }
2146 }
2147
2148 /// Create a builder to help you perform the following task:
2149 ///
2150 /// Use this method to delete a connection profile.
2151 ///
2152 /// # Arguments
2153 ///
2154 /// * `name` - Required. The name of the connection profile resource to delete.
2155 pub fn locations_connection_profiles_delete(
2156 &self,
2157 name: &str,
2158 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
2159 ProjectLocationConnectionProfileDeleteCall {
2160 hub: self.hub,
2161 _name: name.to_string(),
2162 _request_id: Default::default(),
2163 _delegate: Default::default(),
2164 _additional_params: Default::default(),
2165 _scopes: Default::default(),
2166 }
2167 }
2168
2169 /// Create a builder to help you perform the following task:
2170 ///
2171 /// 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.
2172 ///
2173 /// # Arguments
2174 ///
2175 /// * `request` - No description provided.
2176 /// * `parent` - Required. The parent resource of the connection profile type. Must be in the format `projects/*/locations/*`.
2177 pub fn locations_connection_profiles_discover(
2178 &self,
2179 request: DiscoverConnectionProfileRequest,
2180 parent: &str,
2181 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
2182 ProjectLocationConnectionProfileDiscoverCall {
2183 hub: self.hub,
2184 _request: request,
2185 _parent: parent.to_string(),
2186 _delegate: Default::default(),
2187 _additional_params: Default::default(),
2188 _scopes: Default::default(),
2189 }
2190 }
2191
2192 /// Create a builder to help you perform the following task:
2193 ///
2194 /// Use this method to get details about a connection profile.
2195 ///
2196 /// # Arguments
2197 ///
2198 /// * `name` - Required. The name of the connection profile resource to get.
2199 pub fn locations_connection_profiles_get(
2200 &self,
2201 name: &str,
2202 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
2203 ProjectLocationConnectionProfileGetCall {
2204 hub: self.hub,
2205 _name: name.to_string(),
2206 _delegate: Default::default(),
2207 _additional_params: Default::default(),
2208 _scopes: Default::default(),
2209 }
2210 }
2211
2212 /// Create a builder to help you perform the following task:
2213 ///
2214 /// Use this method to list connection profiles created in a project and location.
2215 ///
2216 /// # Arguments
2217 ///
2218 /// * `parent` - Required. The parent that owns the collection of connection profiles.
2219 pub fn locations_connection_profiles_list(
2220 &self,
2221 parent: &str,
2222 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
2223 ProjectLocationConnectionProfileListCall {
2224 hub: self.hub,
2225 _parent: parent.to_string(),
2226 _page_token: Default::default(),
2227 _page_size: Default::default(),
2228 _order_by: Default::default(),
2229 _filter: Default::default(),
2230 _delegate: Default::default(),
2231 _additional_params: Default::default(),
2232 _scopes: Default::default(),
2233 }
2234 }
2235
2236 /// Create a builder to help you perform the following task:
2237 ///
2238 /// Use this method to update the parameters of a connection profile.
2239 ///
2240 /// # Arguments
2241 ///
2242 /// * `request` - No description provided.
2243 /// * `name` - Output only. The resource's name.
2244 pub fn locations_connection_profiles_patch(
2245 &self,
2246 request: ConnectionProfile,
2247 name: &str,
2248 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
2249 ProjectLocationConnectionProfilePatchCall {
2250 hub: self.hub,
2251 _request: request,
2252 _name: name.to_string(),
2253 _validate_only: Default::default(),
2254 _update_mask: Default::default(),
2255 _request_id: Default::default(),
2256 _force: Default::default(),
2257 _delegate: Default::default(),
2258 _additional_params: Default::default(),
2259 _scopes: Default::default(),
2260 }
2261 }
2262
2263 /// Create a builder to help you perform the following task:
2264 ///
2265 /// 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`.
2266 ///
2267 /// # Arguments
2268 ///
2269 /// * `request` - No description provided.
2270 /// * `name` - The name of the operation resource to be cancelled.
2271 pub fn locations_operations_cancel(
2272 &self,
2273 request: CancelOperationRequest,
2274 name: &str,
2275 ) -> ProjectLocationOperationCancelCall<'a, C> {
2276 ProjectLocationOperationCancelCall {
2277 hub: self.hub,
2278 _request: request,
2279 _name: name.to_string(),
2280 _delegate: Default::default(),
2281 _additional_params: Default::default(),
2282 _scopes: Default::default(),
2283 }
2284 }
2285
2286 /// Create a builder to help you perform the following task:
2287 ///
2288 /// 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`.
2289 ///
2290 /// # Arguments
2291 ///
2292 /// * `name` - The name of the operation resource to be deleted.
2293 pub fn locations_operations_delete(
2294 &self,
2295 name: &str,
2296 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2297 ProjectLocationOperationDeleteCall {
2298 hub: self.hub,
2299 _name: name.to_string(),
2300 _delegate: Default::default(),
2301 _additional_params: Default::default(),
2302 _scopes: Default::default(),
2303 }
2304 }
2305
2306 /// Create a builder to help you perform the following task:
2307 ///
2308 /// 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.
2309 ///
2310 /// # Arguments
2311 ///
2312 /// * `name` - The name of the operation resource.
2313 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2314 ProjectLocationOperationGetCall {
2315 hub: self.hub,
2316 _name: name.to_string(),
2317 _delegate: Default::default(),
2318 _additional_params: Default::default(),
2319 _scopes: Default::default(),
2320 }
2321 }
2322
2323 /// Create a builder to help you perform the following task:
2324 ///
2325 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2326 ///
2327 /// # Arguments
2328 ///
2329 /// * `name` - The name of the operation's parent resource.
2330 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2331 ProjectLocationOperationListCall {
2332 hub: self.hub,
2333 _name: name.to_string(),
2334 _page_token: Default::default(),
2335 _page_size: Default::default(),
2336 _filter: Default::default(),
2337 _delegate: Default::default(),
2338 _additional_params: Default::default(),
2339 _scopes: Default::default(),
2340 }
2341 }
2342
2343 /// Create a builder to help you perform the following task:
2344 ///
2345 /// Use this method to create a route for a private connectivity configuration in a project and location.
2346 ///
2347 /// # Arguments
2348 ///
2349 /// * `request` - No description provided.
2350 /// * `parent` - Required. The parent that owns the collection of Routes.
2351 pub fn locations_private_connections_routes_create(
2352 &self,
2353 request: Route,
2354 parent: &str,
2355 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
2356 ProjectLocationPrivateConnectionRouteCreateCall {
2357 hub: self.hub,
2358 _request: request,
2359 _parent: parent.to_string(),
2360 _route_id: Default::default(),
2361 _request_id: Default::default(),
2362 _delegate: Default::default(),
2363 _additional_params: Default::default(),
2364 _scopes: Default::default(),
2365 }
2366 }
2367
2368 /// Create a builder to help you perform the following task:
2369 ///
2370 /// Use this method to delete a route.
2371 ///
2372 /// # Arguments
2373 ///
2374 /// * `name` - Required. The name of the Route resource to delete.
2375 pub fn locations_private_connections_routes_delete(
2376 &self,
2377 name: &str,
2378 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
2379 ProjectLocationPrivateConnectionRouteDeleteCall {
2380 hub: self.hub,
2381 _name: name.to_string(),
2382 _request_id: Default::default(),
2383 _delegate: Default::default(),
2384 _additional_params: Default::default(),
2385 _scopes: Default::default(),
2386 }
2387 }
2388
2389 /// Create a builder to help you perform the following task:
2390 ///
2391 /// Use this method to get details about a route.
2392 ///
2393 /// # Arguments
2394 ///
2395 /// * `name` - Required. The name of the Route resource to get.
2396 pub fn locations_private_connections_routes_get(
2397 &self,
2398 name: &str,
2399 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
2400 ProjectLocationPrivateConnectionRouteGetCall {
2401 hub: self.hub,
2402 _name: name.to_string(),
2403 _delegate: Default::default(),
2404 _additional_params: Default::default(),
2405 _scopes: Default::default(),
2406 }
2407 }
2408
2409 /// Create a builder to help you perform the following task:
2410 ///
2411 /// Use this method to list routes created for a private connectivity configuration in a project and location.
2412 ///
2413 /// # Arguments
2414 ///
2415 /// * `parent` - Required. The parent that owns the collection of Routess.
2416 pub fn locations_private_connections_routes_list(
2417 &self,
2418 parent: &str,
2419 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
2420 ProjectLocationPrivateConnectionRouteListCall {
2421 hub: self.hub,
2422 _parent: parent.to_string(),
2423 _page_token: Default::default(),
2424 _page_size: Default::default(),
2425 _order_by: Default::default(),
2426 _filter: Default::default(),
2427 _delegate: Default::default(),
2428 _additional_params: Default::default(),
2429 _scopes: Default::default(),
2430 }
2431 }
2432
2433 /// Create a builder to help you perform the following task:
2434 ///
2435 /// Use this method to create a private connectivity configuration.
2436 ///
2437 /// # Arguments
2438 ///
2439 /// * `request` - No description provided.
2440 /// * `parent` - Required. The parent that owns the collection of PrivateConnections.
2441 pub fn locations_private_connections_create(
2442 &self,
2443 request: PrivateConnection,
2444 parent: &str,
2445 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
2446 ProjectLocationPrivateConnectionCreateCall {
2447 hub: self.hub,
2448 _request: request,
2449 _parent: parent.to_string(),
2450 _request_id: Default::default(),
2451 _private_connection_id: Default::default(),
2452 _force: Default::default(),
2453 _delegate: Default::default(),
2454 _additional_params: Default::default(),
2455 _scopes: Default::default(),
2456 }
2457 }
2458
2459 /// Create a builder to help you perform the following task:
2460 ///
2461 /// Use this method to delete a private connectivity configuration.
2462 ///
2463 /// # Arguments
2464 ///
2465 /// * `name` - Required. The name of the private connectivity configuration to delete.
2466 pub fn locations_private_connections_delete(
2467 &self,
2468 name: &str,
2469 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
2470 ProjectLocationPrivateConnectionDeleteCall {
2471 hub: self.hub,
2472 _name: name.to_string(),
2473 _request_id: Default::default(),
2474 _force: Default::default(),
2475 _delegate: Default::default(),
2476 _additional_params: Default::default(),
2477 _scopes: Default::default(),
2478 }
2479 }
2480
2481 /// Create a builder to help you perform the following task:
2482 ///
2483 /// Use this method to get details about a private connectivity configuration.
2484 ///
2485 /// # Arguments
2486 ///
2487 /// * `name` - Required. The name of the private connectivity configuration to get.
2488 pub fn locations_private_connections_get(
2489 &self,
2490 name: &str,
2491 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
2492 ProjectLocationPrivateConnectionGetCall {
2493 hub: self.hub,
2494 _name: name.to_string(),
2495 _delegate: Default::default(),
2496 _additional_params: Default::default(),
2497 _scopes: Default::default(),
2498 }
2499 }
2500
2501 /// Create a builder to help you perform the following task:
2502 ///
2503 /// Use this method to list private connectivity configurations in a project and location.
2504 ///
2505 /// # Arguments
2506 ///
2507 /// * `parent` - Required. The parent that owns the collection of private connectivity configurations.
2508 pub fn locations_private_connections_list(
2509 &self,
2510 parent: &str,
2511 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
2512 ProjectLocationPrivateConnectionListCall {
2513 hub: self.hub,
2514 _parent: parent.to_string(),
2515 _page_token: Default::default(),
2516 _page_size: Default::default(),
2517 _order_by: Default::default(),
2518 _filter: Default::default(),
2519 _delegate: Default::default(),
2520 _additional_params: Default::default(),
2521 _scopes: Default::default(),
2522 }
2523 }
2524
2525 /// Create a builder to help you perform the following task:
2526 ///
2527 /// Use this method to get details about a stream object.
2528 ///
2529 /// # Arguments
2530 ///
2531 /// * `name` - Required. The name of the stream object resource to get.
2532 pub fn locations_streams_objects_get(
2533 &self,
2534 name: &str,
2535 ) -> ProjectLocationStreamObjectGetCall<'a, C> {
2536 ProjectLocationStreamObjectGetCall {
2537 hub: self.hub,
2538 _name: name.to_string(),
2539 _delegate: Default::default(),
2540 _additional_params: Default::default(),
2541 _scopes: Default::default(),
2542 }
2543 }
2544
2545 /// Create a builder to help you perform the following task:
2546 ///
2547 /// Use this method to list the objects of a specific stream.
2548 ///
2549 /// # Arguments
2550 ///
2551 /// * `parent` - Required. The parent stream that owns the collection of objects.
2552 pub fn locations_streams_objects_list(
2553 &self,
2554 parent: &str,
2555 ) -> ProjectLocationStreamObjectListCall<'a, C> {
2556 ProjectLocationStreamObjectListCall {
2557 hub: self.hub,
2558 _parent: parent.to_string(),
2559 _page_token: Default::default(),
2560 _page_size: Default::default(),
2561 _delegate: Default::default(),
2562 _additional_params: Default::default(),
2563 _scopes: Default::default(),
2564 }
2565 }
2566
2567 /// Create a builder to help you perform the following task:
2568 ///
2569 /// Use this method to look up a stream object by its source object identifier.
2570 ///
2571 /// # Arguments
2572 ///
2573 /// * `request` - No description provided.
2574 /// * `parent` - Required. The parent stream that owns the collection of objects.
2575 pub fn locations_streams_objects_lookup(
2576 &self,
2577 request: LookupStreamObjectRequest,
2578 parent: &str,
2579 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
2580 ProjectLocationStreamObjectLookupCall {
2581 hub: self.hub,
2582 _request: request,
2583 _parent: parent.to_string(),
2584 _delegate: Default::default(),
2585 _additional_params: Default::default(),
2586 _scopes: Default::default(),
2587 }
2588 }
2589
2590 /// Create a builder to help you perform the following task:
2591 ///
2592 /// Use this method to start a backfill job for the specified stream object.
2593 ///
2594 /// # Arguments
2595 ///
2596 /// * `request` - No description provided.
2597 /// * `object` - Required. The name of the stream object resource to start a backfill job for.
2598 pub fn locations_streams_objects_start_backfill_job(
2599 &self,
2600 request: StartBackfillJobRequest,
2601 object: &str,
2602 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
2603 ProjectLocationStreamObjectStartBackfillJobCall {
2604 hub: self.hub,
2605 _request: request,
2606 _object: object.to_string(),
2607 _delegate: Default::default(),
2608 _additional_params: Default::default(),
2609 _scopes: Default::default(),
2610 }
2611 }
2612
2613 /// Create a builder to help you perform the following task:
2614 ///
2615 /// Use this method to stop a backfill job for the specified stream object.
2616 ///
2617 /// # Arguments
2618 ///
2619 /// * `request` - No description provided.
2620 /// * `object` - Required. The name of the stream object resource to stop the backfill job for.
2621 pub fn locations_streams_objects_stop_backfill_job(
2622 &self,
2623 request: StopBackfillJobRequest,
2624 object: &str,
2625 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
2626 ProjectLocationStreamObjectStopBackfillJobCall {
2627 hub: self.hub,
2628 _request: request,
2629 _object: object.to_string(),
2630 _delegate: Default::default(),
2631 _additional_params: Default::default(),
2632 _scopes: Default::default(),
2633 }
2634 }
2635
2636 /// Create a builder to help you perform the following task:
2637 ///
2638 /// Use this method to create a stream.
2639 ///
2640 /// # Arguments
2641 ///
2642 /// * `request` - No description provided.
2643 /// * `parent` - Required. The parent that owns the collection of streams.
2644 pub fn locations_streams_create(
2645 &self,
2646 request: Stream,
2647 parent: &str,
2648 ) -> ProjectLocationStreamCreateCall<'a, C> {
2649 ProjectLocationStreamCreateCall {
2650 hub: self.hub,
2651 _request: request,
2652 _parent: parent.to_string(),
2653 _validate_only: Default::default(),
2654 _stream_id: Default::default(),
2655 _request_id: Default::default(),
2656 _force: Default::default(),
2657 _delegate: Default::default(),
2658 _additional_params: Default::default(),
2659 _scopes: Default::default(),
2660 }
2661 }
2662
2663 /// Create a builder to help you perform the following task:
2664 ///
2665 /// Use this method to delete a stream.
2666 ///
2667 /// # Arguments
2668 ///
2669 /// * `name` - Required. The name of the stream resource to delete.
2670 pub fn locations_streams_delete(&self, name: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
2671 ProjectLocationStreamDeleteCall {
2672 hub: self.hub,
2673 _name: name.to_string(),
2674 _request_id: Default::default(),
2675 _delegate: Default::default(),
2676 _additional_params: Default::default(),
2677 _scopes: Default::default(),
2678 }
2679 }
2680
2681 /// Create a builder to help you perform the following task:
2682 ///
2683 /// Use this method to get details about a stream.
2684 ///
2685 /// # Arguments
2686 ///
2687 /// * `name` - Required. The name of the stream resource to get.
2688 pub fn locations_streams_get(&self, name: &str) -> ProjectLocationStreamGetCall<'a, C> {
2689 ProjectLocationStreamGetCall {
2690 hub: self.hub,
2691 _name: name.to_string(),
2692 _delegate: Default::default(),
2693 _additional_params: Default::default(),
2694 _scopes: Default::default(),
2695 }
2696 }
2697
2698 /// Create a builder to help you perform the following task:
2699 ///
2700 /// Use this method to list streams in a project and location.
2701 ///
2702 /// # Arguments
2703 ///
2704 /// * `parent` - Required. The parent that owns the collection of streams.
2705 pub fn locations_streams_list(&self, parent: &str) -> ProjectLocationStreamListCall<'a, C> {
2706 ProjectLocationStreamListCall {
2707 hub: self.hub,
2708 _parent: parent.to_string(),
2709 _page_token: Default::default(),
2710 _page_size: Default::default(),
2711 _order_by: Default::default(),
2712 _filter: Default::default(),
2713 _delegate: Default::default(),
2714 _additional_params: Default::default(),
2715 _scopes: Default::default(),
2716 }
2717 }
2718
2719 /// Create a builder to help you perform the following task:
2720 ///
2721 /// Use this method to update the configuration of a stream.
2722 ///
2723 /// # Arguments
2724 ///
2725 /// * `request` - No description provided.
2726 /// * `name` - Output only. The stream's name.
2727 pub fn locations_streams_patch(
2728 &self,
2729 request: Stream,
2730 name: &str,
2731 ) -> ProjectLocationStreamPatchCall<'a, C> {
2732 ProjectLocationStreamPatchCall {
2733 hub: self.hub,
2734 _request: request,
2735 _name: name.to_string(),
2736 _validate_only: Default::default(),
2737 _update_mask: Default::default(),
2738 _request_id: Default::default(),
2739 _force: Default::default(),
2740 _delegate: Default::default(),
2741 _additional_params: Default::default(),
2742 _scopes: Default::default(),
2743 }
2744 }
2745
2746 /// Create a builder to help you perform the following task:
2747 ///
2748 /// Use this method to start, resume or recover a stream with a non default CDC strategy. NOTE: This feature is currently experimental.
2749 ///
2750 /// # Arguments
2751 ///
2752 /// * `request` - No description provided.
2753 /// * `name` - Required. Name of the stream resource to start, in the format: projects/{project_id}/locations/{location}/streams/{stream_name}
2754 pub fn locations_streams_run(
2755 &self,
2756 request: RunStreamRequest,
2757 name: &str,
2758 ) -> ProjectLocationStreamRunCall<'a, C> {
2759 ProjectLocationStreamRunCall {
2760 hub: self.hub,
2761 _request: request,
2762 _name: name.to_string(),
2763 _delegate: Default::default(),
2764 _additional_params: Default::default(),
2765 _scopes: Default::default(),
2766 }
2767 }
2768
2769 /// Create a builder to help you perform the following task:
2770 ///
2771 /// The FetchStaticIps API call exposes the static IP addresses used by Datastream.
2772 ///
2773 /// # Arguments
2774 ///
2775 /// * `name` - Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
2776 pub fn locations_fetch_static_ips(
2777 &self,
2778 name: &str,
2779 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
2780 ProjectLocationFetchStaticIpCall {
2781 hub: self.hub,
2782 _name: name.to_string(),
2783 _page_token: Default::default(),
2784 _page_size: Default::default(),
2785 _delegate: Default::default(),
2786 _additional_params: Default::default(),
2787 _scopes: Default::default(),
2788 }
2789 }
2790
2791 /// Create a builder to help you perform the following task:
2792 ///
2793 /// Gets information about a location.
2794 ///
2795 /// # Arguments
2796 ///
2797 /// * `name` - Resource name for the location.
2798 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2799 ProjectLocationGetCall {
2800 hub: self.hub,
2801 _name: name.to_string(),
2802 _delegate: Default::default(),
2803 _additional_params: Default::default(),
2804 _scopes: Default::default(),
2805 }
2806 }
2807
2808 /// Create a builder to help you perform the following task:
2809 ///
2810 /// Lists information about the supported locations for this service.
2811 ///
2812 /// # Arguments
2813 ///
2814 /// * `name` - The resource that owns the locations collection, if applicable.
2815 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2816 ProjectLocationListCall {
2817 hub: self.hub,
2818 _name: name.to_string(),
2819 _page_token: Default::default(),
2820 _page_size: Default::default(),
2821 _filter: Default::default(),
2822 _delegate: Default::default(),
2823 _additional_params: Default::default(),
2824 _scopes: Default::default(),
2825 }
2826 }
2827}
2828
2829// ###################
2830// CallBuilders ###
2831// #################
2832
2833/// Use this method to create a connection profile in a project and location.
2834///
2835/// A builder for the *locations.connectionProfiles.create* method supported by a *project* resource.
2836/// It is not used directly, but through a [`ProjectMethods`] instance.
2837///
2838/// # Example
2839///
2840/// Instantiate a resource method builder
2841///
2842/// ```test_harness,no_run
2843/// # extern crate hyper;
2844/// # extern crate hyper_rustls;
2845/// # extern crate google_datastream1 as datastream1;
2846/// use datastream1::api::ConnectionProfile;
2847/// # async fn dox() {
2848/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2849///
2850/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2851/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2852/// # secret,
2853/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2854/// # ).build().await.unwrap();
2855///
2856/// # let client = hyper_util::client::legacy::Client::builder(
2857/// # hyper_util::rt::TokioExecutor::new()
2858/// # )
2859/// # .build(
2860/// # hyper_rustls::HttpsConnectorBuilder::new()
2861/// # .with_native_roots()
2862/// # .unwrap()
2863/// # .https_or_http()
2864/// # .enable_http1()
2865/// # .build()
2866/// # );
2867/// # let mut hub = Datastream::new(client, auth);
2868/// // As the method needs a request, you would usually fill it with the desired information
2869/// // into the respective structure. Some of the parts shown here might not be applicable !
2870/// // Values shown here are possibly random and not representative !
2871/// let mut req = ConnectionProfile::default();
2872///
2873/// // You can configure optional parameters by calling the respective setters at will, and
2874/// // execute the final call using `doit()`.
2875/// // Values shown here are possibly random and not representative !
2876/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
2877/// .validate_only(true)
2878/// .request_id("sed")
2879/// .force(true)
2880/// .connection_profile_id("ipsum")
2881/// .doit().await;
2882/// # }
2883/// ```
2884pub struct ProjectLocationConnectionProfileCreateCall<'a, C>
2885where
2886 C: 'a,
2887{
2888 hub: &'a Datastream<C>,
2889 _request: ConnectionProfile,
2890 _parent: String,
2891 _validate_only: Option<bool>,
2892 _request_id: Option<String>,
2893 _force: Option<bool>,
2894 _connection_profile_id: Option<String>,
2895 _delegate: Option<&'a mut dyn common::Delegate>,
2896 _additional_params: HashMap<String, String>,
2897 _scopes: BTreeSet<String>,
2898}
2899
2900impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileCreateCall<'a, C> {}
2901
2902impl<'a, C> ProjectLocationConnectionProfileCreateCall<'a, C>
2903where
2904 C: common::Connector,
2905{
2906 /// Perform the operation you have build so far.
2907 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2908 use std::borrow::Cow;
2909 use std::io::{Read, Seek};
2910
2911 use common::{url::Params, ToParts};
2912 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2913
2914 let mut dd = common::DefaultDelegate;
2915 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2916 dlg.begin(common::MethodInfo {
2917 id: "datastream.projects.locations.connectionProfiles.create",
2918 http_method: hyper::Method::POST,
2919 });
2920
2921 for &field in [
2922 "alt",
2923 "parent",
2924 "validateOnly",
2925 "requestId",
2926 "force",
2927 "connectionProfileId",
2928 ]
2929 .iter()
2930 {
2931 if self._additional_params.contains_key(field) {
2932 dlg.finished(false);
2933 return Err(common::Error::FieldClash(field));
2934 }
2935 }
2936
2937 let mut params = Params::with_capacity(8 + self._additional_params.len());
2938 params.push("parent", self._parent);
2939 if let Some(value) = self._validate_only.as_ref() {
2940 params.push("validateOnly", value.to_string());
2941 }
2942 if let Some(value) = self._request_id.as_ref() {
2943 params.push("requestId", value);
2944 }
2945 if let Some(value) = self._force.as_ref() {
2946 params.push("force", value.to_string());
2947 }
2948 if let Some(value) = self._connection_profile_id.as_ref() {
2949 params.push("connectionProfileId", value);
2950 }
2951
2952 params.extend(self._additional_params.iter());
2953
2954 params.push("alt", "json");
2955 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
2956 if self._scopes.is_empty() {
2957 self._scopes
2958 .insert(Scope::CloudPlatform.as_ref().to_string());
2959 }
2960
2961 #[allow(clippy::single_element_loop)]
2962 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2963 url = params.uri_replacement(url, param_name, find_this, true);
2964 }
2965 {
2966 let to_remove = ["parent"];
2967 params.remove_params(&to_remove);
2968 }
2969
2970 let url = params.parse_with_url(&url);
2971
2972 let mut json_mime_type = mime::APPLICATION_JSON;
2973 let mut request_value_reader = {
2974 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2975 common::remove_json_null_values(&mut value);
2976 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2977 serde_json::to_writer(&mut dst, &value).unwrap();
2978 dst
2979 };
2980 let request_size = request_value_reader
2981 .seek(std::io::SeekFrom::End(0))
2982 .unwrap();
2983 request_value_reader
2984 .seek(std::io::SeekFrom::Start(0))
2985 .unwrap();
2986
2987 loop {
2988 let token = match self
2989 .hub
2990 .auth
2991 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2992 .await
2993 {
2994 Ok(token) => token,
2995 Err(e) => match dlg.token(e) {
2996 Ok(token) => token,
2997 Err(e) => {
2998 dlg.finished(false);
2999 return Err(common::Error::MissingToken(e));
3000 }
3001 },
3002 };
3003 request_value_reader
3004 .seek(std::io::SeekFrom::Start(0))
3005 .unwrap();
3006 let mut req_result = {
3007 let client = &self.hub.client;
3008 dlg.pre_request();
3009 let mut req_builder = hyper::Request::builder()
3010 .method(hyper::Method::POST)
3011 .uri(url.as_str())
3012 .header(USER_AGENT, self.hub._user_agent.clone());
3013
3014 if let Some(token) = token.as_ref() {
3015 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3016 }
3017
3018 let request = req_builder
3019 .header(CONTENT_TYPE, json_mime_type.to_string())
3020 .header(CONTENT_LENGTH, request_size as u64)
3021 .body(common::to_body(
3022 request_value_reader.get_ref().clone().into(),
3023 ));
3024
3025 client.request(request.unwrap()).await
3026 };
3027
3028 match req_result {
3029 Err(err) => {
3030 if let common::Retry::After(d) = dlg.http_error(&err) {
3031 sleep(d).await;
3032 continue;
3033 }
3034 dlg.finished(false);
3035 return Err(common::Error::HttpError(err));
3036 }
3037 Ok(res) => {
3038 let (mut parts, body) = res.into_parts();
3039 let mut body = common::Body::new(body);
3040 if !parts.status.is_success() {
3041 let bytes = common::to_bytes(body).await.unwrap_or_default();
3042 let error = serde_json::from_str(&common::to_string(&bytes));
3043 let response = common::to_response(parts, bytes.into());
3044
3045 if let common::Retry::After(d) =
3046 dlg.http_failure(&response, error.as_ref().ok())
3047 {
3048 sleep(d).await;
3049 continue;
3050 }
3051
3052 dlg.finished(false);
3053
3054 return Err(match error {
3055 Ok(value) => common::Error::BadRequest(value),
3056 _ => common::Error::Failure(response),
3057 });
3058 }
3059 let response = {
3060 let bytes = common::to_bytes(body).await.unwrap_or_default();
3061 let encoded = common::to_string(&bytes);
3062 match serde_json::from_str(&encoded) {
3063 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3064 Err(error) => {
3065 dlg.response_json_decode_error(&encoded, &error);
3066 return Err(common::Error::JsonDecodeError(
3067 encoded.to_string(),
3068 error,
3069 ));
3070 }
3071 }
3072 };
3073
3074 dlg.finished(true);
3075 return Ok(response);
3076 }
3077 }
3078 }
3079 }
3080
3081 ///
3082 /// Sets the *request* property to the given value.
3083 ///
3084 /// Even though the property as already been set when instantiating this call,
3085 /// we provide this method for API completeness.
3086 pub fn request(
3087 mut self,
3088 new_value: ConnectionProfile,
3089 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3090 self._request = new_value;
3091 self
3092 }
3093 /// Required. The parent that owns the collection of ConnectionProfiles.
3094 ///
3095 /// Sets the *parent* path property to the given value.
3096 ///
3097 /// Even though the property as already been set when instantiating this call,
3098 /// we provide this method for API completeness.
3099 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3100 self._parent = new_value.to_string();
3101 self
3102 }
3103 /// Optional. Only validate the connection profile, but don't create any resources. The default is false.
3104 ///
3105 /// Sets the *validate only* query property to the given value.
3106 pub fn validate_only(
3107 mut self,
3108 new_value: bool,
3109 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3110 self._validate_only = Some(new_value);
3111 self
3112 }
3113 /// 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).
3114 ///
3115 /// Sets the *request id* query property to the given value.
3116 pub fn request_id(
3117 mut self,
3118 new_value: &str,
3119 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3120 self._request_id = Some(new_value.to_string());
3121 self
3122 }
3123 /// Optional. Create the connection profile without validating it.
3124 ///
3125 /// Sets the *force* query property to the given value.
3126 pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3127 self._force = Some(new_value);
3128 self
3129 }
3130 /// Required. The connection profile identifier.
3131 ///
3132 /// Sets the *connection profile id* query property to the given value.
3133 pub fn connection_profile_id(
3134 mut self,
3135 new_value: &str,
3136 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3137 self._connection_profile_id = Some(new_value.to_string());
3138 self
3139 }
3140 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3141 /// while executing the actual API request.
3142 ///
3143 /// ````text
3144 /// It should be used to handle progress information, and to implement a certain level of resilience.
3145 /// ````
3146 ///
3147 /// Sets the *delegate* property to the given value.
3148 pub fn delegate(
3149 mut self,
3150 new_value: &'a mut dyn common::Delegate,
3151 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3152 self._delegate = Some(new_value);
3153 self
3154 }
3155
3156 /// Set any additional parameter of the query string used in the request.
3157 /// It should be used to set parameters which are not yet available through their own
3158 /// setters.
3159 ///
3160 /// Please note that this method must not be used to set any of the known parameters
3161 /// which have their own setter method. If done anyway, the request will fail.
3162 ///
3163 /// # Additional Parameters
3164 ///
3165 /// * *$.xgafv* (query-string) - V1 error format.
3166 /// * *access_token* (query-string) - OAuth access token.
3167 /// * *alt* (query-string) - Data format for response.
3168 /// * *callback* (query-string) - JSONP
3169 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3170 /// * *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.
3171 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3172 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3173 /// * *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.
3174 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3175 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3176 pub fn param<T>(
3177 mut self,
3178 name: T,
3179 value: T,
3180 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
3181 where
3182 T: AsRef<str>,
3183 {
3184 self._additional_params
3185 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3186 self
3187 }
3188
3189 /// Identifies the authorization scope for the method you are building.
3190 ///
3191 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3192 /// [`Scope::CloudPlatform`].
3193 ///
3194 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3195 /// tokens for more than one scope.
3196 ///
3197 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3198 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3199 /// sufficient, a read-write scope will do as well.
3200 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileCreateCall<'a, C>
3201 where
3202 St: AsRef<str>,
3203 {
3204 self._scopes.insert(String::from(scope.as_ref()));
3205 self
3206 }
3207 /// Identifies the authorization scope(s) for the method you are building.
3208 ///
3209 /// See [`Self::add_scope()`] for details.
3210 pub fn add_scopes<I, St>(
3211 mut self,
3212 scopes: I,
3213 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
3214 where
3215 I: IntoIterator<Item = St>,
3216 St: AsRef<str>,
3217 {
3218 self._scopes
3219 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3220 self
3221 }
3222
3223 /// Removes all scopes, and no default scope will be used either.
3224 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3225 /// for details).
3226 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3227 self._scopes.clear();
3228 self
3229 }
3230}
3231
3232/// Use this method to delete a connection profile.
3233///
3234/// A builder for the *locations.connectionProfiles.delete* method supported by a *project* resource.
3235/// It is not used directly, but through a [`ProjectMethods`] instance.
3236///
3237/// # Example
3238///
3239/// Instantiate a resource method builder
3240///
3241/// ```test_harness,no_run
3242/// # extern crate hyper;
3243/// # extern crate hyper_rustls;
3244/// # extern crate google_datastream1 as datastream1;
3245/// # async fn dox() {
3246/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3247///
3248/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3249/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3250/// # secret,
3251/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3252/// # ).build().await.unwrap();
3253///
3254/// # let client = hyper_util::client::legacy::Client::builder(
3255/// # hyper_util::rt::TokioExecutor::new()
3256/// # )
3257/// # .build(
3258/// # hyper_rustls::HttpsConnectorBuilder::new()
3259/// # .with_native_roots()
3260/// # .unwrap()
3261/// # .https_or_http()
3262/// # .enable_http1()
3263/// # .build()
3264/// # );
3265/// # let mut hub = Datastream::new(client, auth);
3266/// // You can configure optional parameters by calling the respective setters at will, and
3267/// // execute the final call using `doit()`.
3268/// // Values shown here are possibly random and not representative !
3269/// let result = hub.projects().locations_connection_profiles_delete("name")
3270/// .request_id("est")
3271/// .doit().await;
3272/// # }
3273/// ```
3274pub struct ProjectLocationConnectionProfileDeleteCall<'a, C>
3275where
3276 C: 'a,
3277{
3278 hub: &'a Datastream<C>,
3279 _name: String,
3280 _request_id: Option<String>,
3281 _delegate: Option<&'a mut dyn common::Delegate>,
3282 _additional_params: HashMap<String, String>,
3283 _scopes: BTreeSet<String>,
3284}
3285
3286impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDeleteCall<'a, C> {}
3287
3288impl<'a, C> ProjectLocationConnectionProfileDeleteCall<'a, C>
3289where
3290 C: common::Connector,
3291{
3292 /// Perform the operation you have build so far.
3293 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3294 use std::borrow::Cow;
3295 use std::io::{Read, Seek};
3296
3297 use common::{url::Params, ToParts};
3298 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3299
3300 let mut dd = common::DefaultDelegate;
3301 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3302 dlg.begin(common::MethodInfo {
3303 id: "datastream.projects.locations.connectionProfiles.delete",
3304 http_method: hyper::Method::DELETE,
3305 });
3306
3307 for &field in ["alt", "name", "requestId"].iter() {
3308 if self._additional_params.contains_key(field) {
3309 dlg.finished(false);
3310 return Err(common::Error::FieldClash(field));
3311 }
3312 }
3313
3314 let mut params = Params::with_capacity(4 + self._additional_params.len());
3315 params.push("name", self._name);
3316 if let Some(value) = self._request_id.as_ref() {
3317 params.push("requestId", value);
3318 }
3319
3320 params.extend(self._additional_params.iter());
3321
3322 params.push("alt", "json");
3323 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3324 if self._scopes.is_empty() {
3325 self._scopes
3326 .insert(Scope::CloudPlatform.as_ref().to_string());
3327 }
3328
3329 #[allow(clippy::single_element_loop)]
3330 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3331 url = params.uri_replacement(url, param_name, find_this, true);
3332 }
3333 {
3334 let to_remove = ["name"];
3335 params.remove_params(&to_remove);
3336 }
3337
3338 let url = params.parse_with_url(&url);
3339
3340 loop {
3341 let token = match self
3342 .hub
3343 .auth
3344 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3345 .await
3346 {
3347 Ok(token) => token,
3348 Err(e) => match dlg.token(e) {
3349 Ok(token) => token,
3350 Err(e) => {
3351 dlg.finished(false);
3352 return Err(common::Error::MissingToken(e));
3353 }
3354 },
3355 };
3356 let mut req_result = {
3357 let client = &self.hub.client;
3358 dlg.pre_request();
3359 let mut req_builder = hyper::Request::builder()
3360 .method(hyper::Method::DELETE)
3361 .uri(url.as_str())
3362 .header(USER_AGENT, self.hub._user_agent.clone());
3363
3364 if let Some(token) = token.as_ref() {
3365 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3366 }
3367
3368 let request = req_builder
3369 .header(CONTENT_LENGTH, 0_u64)
3370 .body(common::to_body::<String>(None));
3371
3372 client.request(request.unwrap()).await
3373 };
3374
3375 match req_result {
3376 Err(err) => {
3377 if let common::Retry::After(d) = dlg.http_error(&err) {
3378 sleep(d).await;
3379 continue;
3380 }
3381 dlg.finished(false);
3382 return Err(common::Error::HttpError(err));
3383 }
3384 Ok(res) => {
3385 let (mut parts, body) = res.into_parts();
3386 let mut body = common::Body::new(body);
3387 if !parts.status.is_success() {
3388 let bytes = common::to_bytes(body).await.unwrap_or_default();
3389 let error = serde_json::from_str(&common::to_string(&bytes));
3390 let response = common::to_response(parts, bytes.into());
3391
3392 if let common::Retry::After(d) =
3393 dlg.http_failure(&response, error.as_ref().ok())
3394 {
3395 sleep(d).await;
3396 continue;
3397 }
3398
3399 dlg.finished(false);
3400
3401 return Err(match error {
3402 Ok(value) => common::Error::BadRequest(value),
3403 _ => common::Error::Failure(response),
3404 });
3405 }
3406 let response = {
3407 let bytes = common::to_bytes(body).await.unwrap_or_default();
3408 let encoded = common::to_string(&bytes);
3409 match serde_json::from_str(&encoded) {
3410 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3411 Err(error) => {
3412 dlg.response_json_decode_error(&encoded, &error);
3413 return Err(common::Error::JsonDecodeError(
3414 encoded.to_string(),
3415 error,
3416 ));
3417 }
3418 }
3419 };
3420
3421 dlg.finished(true);
3422 return Ok(response);
3423 }
3424 }
3425 }
3426 }
3427
3428 /// Required. The name of the connection profile resource to delete.
3429 ///
3430 /// Sets the *name* path property to the given value.
3431 ///
3432 /// Even though the property as already been set when instantiating this call,
3433 /// we provide this method for API completeness.
3434 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3435 self._name = new_value.to_string();
3436 self
3437 }
3438 /// 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).
3439 ///
3440 /// Sets the *request id* query property to the given value.
3441 pub fn request_id(
3442 mut self,
3443 new_value: &str,
3444 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3445 self._request_id = Some(new_value.to_string());
3446 self
3447 }
3448 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3449 /// while executing the actual API request.
3450 ///
3451 /// ````text
3452 /// It should be used to handle progress information, and to implement a certain level of resilience.
3453 /// ````
3454 ///
3455 /// Sets the *delegate* property to the given value.
3456 pub fn delegate(
3457 mut self,
3458 new_value: &'a mut dyn common::Delegate,
3459 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3460 self._delegate = Some(new_value);
3461 self
3462 }
3463
3464 /// Set any additional parameter of the query string used in the request.
3465 /// It should be used to set parameters which are not yet available through their own
3466 /// setters.
3467 ///
3468 /// Please note that this method must not be used to set any of the known parameters
3469 /// which have their own setter method. If done anyway, the request will fail.
3470 ///
3471 /// # Additional Parameters
3472 ///
3473 /// * *$.xgafv* (query-string) - V1 error format.
3474 /// * *access_token* (query-string) - OAuth access token.
3475 /// * *alt* (query-string) - Data format for response.
3476 /// * *callback* (query-string) - JSONP
3477 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3478 /// * *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.
3479 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3480 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3481 /// * *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.
3482 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3483 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3484 pub fn param<T>(
3485 mut self,
3486 name: T,
3487 value: T,
3488 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
3489 where
3490 T: AsRef<str>,
3491 {
3492 self._additional_params
3493 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3494 self
3495 }
3496
3497 /// Identifies the authorization scope for the method you are building.
3498 ///
3499 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3500 /// [`Scope::CloudPlatform`].
3501 ///
3502 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3503 /// tokens for more than one scope.
3504 ///
3505 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3506 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3507 /// sufficient, a read-write scope will do as well.
3508 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
3509 where
3510 St: AsRef<str>,
3511 {
3512 self._scopes.insert(String::from(scope.as_ref()));
3513 self
3514 }
3515 /// Identifies the authorization scope(s) for the method you are building.
3516 ///
3517 /// See [`Self::add_scope()`] for details.
3518 pub fn add_scopes<I, St>(
3519 mut self,
3520 scopes: I,
3521 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
3522 where
3523 I: IntoIterator<Item = St>,
3524 St: AsRef<str>,
3525 {
3526 self._scopes
3527 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3528 self
3529 }
3530
3531 /// Removes all scopes, and no default scope will be used either.
3532 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3533 /// for details).
3534 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3535 self._scopes.clear();
3536 self
3537 }
3538}
3539
3540/// 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.
3541///
3542/// A builder for the *locations.connectionProfiles.discover* method supported by a *project* resource.
3543/// It is not used directly, but through a [`ProjectMethods`] instance.
3544///
3545/// # Example
3546///
3547/// Instantiate a resource method builder
3548///
3549/// ```test_harness,no_run
3550/// # extern crate hyper;
3551/// # extern crate hyper_rustls;
3552/// # extern crate google_datastream1 as datastream1;
3553/// use datastream1::api::DiscoverConnectionProfileRequest;
3554/// # async fn dox() {
3555/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3556///
3557/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3558/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3559/// # secret,
3560/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3561/// # ).build().await.unwrap();
3562///
3563/// # let client = hyper_util::client::legacy::Client::builder(
3564/// # hyper_util::rt::TokioExecutor::new()
3565/// # )
3566/// # .build(
3567/// # hyper_rustls::HttpsConnectorBuilder::new()
3568/// # .with_native_roots()
3569/// # .unwrap()
3570/// # .https_or_http()
3571/// # .enable_http1()
3572/// # .build()
3573/// # );
3574/// # let mut hub = Datastream::new(client, auth);
3575/// // As the method needs a request, you would usually fill it with the desired information
3576/// // into the respective structure. Some of the parts shown here might not be applicable !
3577/// // Values shown here are possibly random and not representative !
3578/// let mut req = DiscoverConnectionProfileRequest::default();
3579///
3580/// // You can configure optional parameters by calling the respective setters at will, and
3581/// // execute the final call using `doit()`.
3582/// // Values shown here are possibly random and not representative !
3583/// let result = hub.projects().locations_connection_profiles_discover(req, "parent")
3584/// .doit().await;
3585/// # }
3586/// ```
3587pub struct ProjectLocationConnectionProfileDiscoverCall<'a, C>
3588where
3589 C: 'a,
3590{
3591 hub: &'a Datastream<C>,
3592 _request: DiscoverConnectionProfileRequest,
3593 _parent: String,
3594 _delegate: Option<&'a mut dyn common::Delegate>,
3595 _additional_params: HashMap<String, String>,
3596 _scopes: BTreeSet<String>,
3597}
3598
3599impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDiscoverCall<'a, C> {}
3600
3601impl<'a, C> ProjectLocationConnectionProfileDiscoverCall<'a, C>
3602where
3603 C: common::Connector,
3604{
3605 /// Perform the operation you have build so far.
3606 pub async fn doit(
3607 mut self,
3608 ) -> common::Result<(common::Response, DiscoverConnectionProfileResponse)> {
3609 use std::borrow::Cow;
3610 use std::io::{Read, Seek};
3611
3612 use common::{url::Params, ToParts};
3613 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3614
3615 let mut dd = common::DefaultDelegate;
3616 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3617 dlg.begin(common::MethodInfo {
3618 id: "datastream.projects.locations.connectionProfiles.discover",
3619 http_method: hyper::Method::POST,
3620 });
3621
3622 for &field in ["alt", "parent"].iter() {
3623 if self._additional_params.contains_key(field) {
3624 dlg.finished(false);
3625 return Err(common::Error::FieldClash(field));
3626 }
3627 }
3628
3629 let mut params = Params::with_capacity(4 + self._additional_params.len());
3630 params.push("parent", self._parent);
3631
3632 params.extend(self._additional_params.iter());
3633
3634 params.push("alt", "json");
3635 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles:discover";
3636 if self._scopes.is_empty() {
3637 self._scopes
3638 .insert(Scope::CloudPlatform.as_ref().to_string());
3639 }
3640
3641 #[allow(clippy::single_element_loop)]
3642 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3643 url = params.uri_replacement(url, param_name, find_this, true);
3644 }
3645 {
3646 let to_remove = ["parent"];
3647 params.remove_params(&to_remove);
3648 }
3649
3650 let url = params.parse_with_url(&url);
3651
3652 let mut json_mime_type = mime::APPLICATION_JSON;
3653 let mut request_value_reader = {
3654 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3655 common::remove_json_null_values(&mut value);
3656 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3657 serde_json::to_writer(&mut dst, &value).unwrap();
3658 dst
3659 };
3660 let request_size = request_value_reader
3661 .seek(std::io::SeekFrom::End(0))
3662 .unwrap();
3663 request_value_reader
3664 .seek(std::io::SeekFrom::Start(0))
3665 .unwrap();
3666
3667 loop {
3668 let token = match self
3669 .hub
3670 .auth
3671 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3672 .await
3673 {
3674 Ok(token) => token,
3675 Err(e) => match dlg.token(e) {
3676 Ok(token) => token,
3677 Err(e) => {
3678 dlg.finished(false);
3679 return Err(common::Error::MissingToken(e));
3680 }
3681 },
3682 };
3683 request_value_reader
3684 .seek(std::io::SeekFrom::Start(0))
3685 .unwrap();
3686 let mut req_result = {
3687 let client = &self.hub.client;
3688 dlg.pre_request();
3689 let mut req_builder = hyper::Request::builder()
3690 .method(hyper::Method::POST)
3691 .uri(url.as_str())
3692 .header(USER_AGENT, self.hub._user_agent.clone());
3693
3694 if let Some(token) = token.as_ref() {
3695 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3696 }
3697
3698 let request = req_builder
3699 .header(CONTENT_TYPE, json_mime_type.to_string())
3700 .header(CONTENT_LENGTH, request_size as u64)
3701 .body(common::to_body(
3702 request_value_reader.get_ref().clone().into(),
3703 ));
3704
3705 client.request(request.unwrap()).await
3706 };
3707
3708 match req_result {
3709 Err(err) => {
3710 if let common::Retry::After(d) = dlg.http_error(&err) {
3711 sleep(d).await;
3712 continue;
3713 }
3714 dlg.finished(false);
3715 return Err(common::Error::HttpError(err));
3716 }
3717 Ok(res) => {
3718 let (mut parts, body) = res.into_parts();
3719 let mut body = common::Body::new(body);
3720 if !parts.status.is_success() {
3721 let bytes = common::to_bytes(body).await.unwrap_or_default();
3722 let error = serde_json::from_str(&common::to_string(&bytes));
3723 let response = common::to_response(parts, bytes.into());
3724
3725 if let common::Retry::After(d) =
3726 dlg.http_failure(&response, error.as_ref().ok())
3727 {
3728 sleep(d).await;
3729 continue;
3730 }
3731
3732 dlg.finished(false);
3733
3734 return Err(match error {
3735 Ok(value) => common::Error::BadRequest(value),
3736 _ => common::Error::Failure(response),
3737 });
3738 }
3739 let response = {
3740 let bytes = common::to_bytes(body).await.unwrap_or_default();
3741 let encoded = common::to_string(&bytes);
3742 match serde_json::from_str(&encoded) {
3743 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3744 Err(error) => {
3745 dlg.response_json_decode_error(&encoded, &error);
3746 return Err(common::Error::JsonDecodeError(
3747 encoded.to_string(),
3748 error,
3749 ));
3750 }
3751 }
3752 };
3753
3754 dlg.finished(true);
3755 return Ok(response);
3756 }
3757 }
3758 }
3759 }
3760
3761 ///
3762 /// Sets the *request* property to the given value.
3763 ///
3764 /// Even though the property as already been set when instantiating this call,
3765 /// we provide this method for API completeness.
3766 pub fn request(
3767 mut self,
3768 new_value: DiscoverConnectionProfileRequest,
3769 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
3770 self._request = new_value;
3771 self
3772 }
3773 /// Required. The parent resource of the connection profile type. Must be in the format `projects/*/locations/*`.
3774 ///
3775 /// Sets the *parent* path property to the given value.
3776 ///
3777 /// Even though the property as already been set when instantiating this call,
3778 /// we provide this method for API completeness.
3779 pub fn parent(
3780 mut self,
3781 new_value: &str,
3782 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
3783 self._parent = new_value.to_string();
3784 self
3785 }
3786 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3787 /// while executing the actual API request.
3788 ///
3789 /// ````text
3790 /// It should be used to handle progress information, and to implement a certain level of resilience.
3791 /// ````
3792 ///
3793 /// Sets the *delegate* property to the given value.
3794 pub fn delegate(
3795 mut self,
3796 new_value: &'a mut dyn common::Delegate,
3797 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
3798 self._delegate = Some(new_value);
3799 self
3800 }
3801
3802 /// Set any additional parameter of the query string used in the request.
3803 /// It should be used to set parameters which are not yet available through their own
3804 /// setters.
3805 ///
3806 /// Please note that this method must not be used to set any of the known parameters
3807 /// which have their own setter method. If done anyway, the request will fail.
3808 ///
3809 /// # Additional Parameters
3810 ///
3811 /// * *$.xgafv* (query-string) - V1 error format.
3812 /// * *access_token* (query-string) - OAuth access token.
3813 /// * *alt* (query-string) - Data format for response.
3814 /// * *callback* (query-string) - JSONP
3815 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3816 /// * *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.
3817 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3818 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3819 /// * *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.
3820 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3821 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3822 pub fn param<T>(
3823 mut self,
3824 name: T,
3825 value: T,
3826 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
3827 where
3828 T: AsRef<str>,
3829 {
3830 self._additional_params
3831 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3832 self
3833 }
3834
3835 /// Identifies the authorization scope for the method you are building.
3836 ///
3837 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3838 /// [`Scope::CloudPlatform`].
3839 ///
3840 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3841 /// tokens for more than one scope.
3842 ///
3843 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3844 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3845 /// sufficient, a read-write scope will do as well.
3846 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
3847 where
3848 St: AsRef<str>,
3849 {
3850 self._scopes.insert(String::from(scope.as_ref()));
3851 self
3852 }
3853 /// Identifies the authorization scope(s) for the method you are building.
3854 ///
3855 /// See [`Self::add_scope()`] for details.
3856 pub fn add_scopes<I, St>(
3857 mut self,
3858 scopes: I,
3859 ) -> ProjectLocationConnectionProfileDiscoverCall<'a, C>
3860 where
3861 I: IntoIterator<Item = St>,
3862 St: AsRef<str>,
3863 {
3864 self._scopes
3865 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3866 self
3867 }
3868
3869 /// Removes all scopes, and no default scope will be used either.
3870 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3871 /// for details).
3872 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDiscoverCall<'a, C> {
3873 self._scopes.clear();
3874 self
3875 }
3876}
3877
3878/// Use this method to get details about a connection profile.
3879///
3880/// A builder for the *locations.connectionProfiles.get* method supported by a *project* resource.
3881/// It is not used directly, but through a [`ProjectMethods`] instance.
3882///
3883/// # Example
3884///
3885/// Instantiate a resource method builder
3886///
3887/// ```test_harness,no_run
3888/// # extern crate hyper;
3889/// # extern crate hyper_rustls;
3890/// # extern crate google_datastream1 as datastream1;
3891/// # async fn dox() {
3892/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3893///
3894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3895/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3896/// # secret,
3897/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3898/// # ).build().await.unwrap();
3899///
3900/// # let client = hyper_util::client::legacy::Client::builder(
3901/// # hyper_util::rt::TokioExecutor::new()
3902/// # )
3903/// # .build(
3904/// # hyper_rustls::HttpsConnectorBuilder::new()
3905/// # .with_native_roots()
3906/// # .unwrap()
3907/// # .https_or_http()
3908/// # .enable_http1()
3909/// # .build()
3910/// # );
3911/// # let mut hub = Datastream::new(client, auth);
3912/// // You can configure optional parameters by calling the respective setters at will, and
3913/// // execute the final call using `doit()`.
3914/// // Values shown here are possibly random and not representative !
3915/// let result = hub.projects().locations_connection_profiles_get("name")
3916/// .doit().await;
3917/// # }
3918/// ```
3919pub struct ProjectLocationConnectionProfileGetCall<'a, C>
3920where
3921 C: 'a,
3922{
3923 hub: &'a Datastream<C>,
3924 _name: String,
3925 _delegate: Option<&'a mut dyn common::Delegate>,
3926 _additional_params: HashMap<String, String>,
3927 _scopes: BTreeSet<String>,
3928}
3929
3930impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetCall<'a, C> {}
3931
3932impl<'a, C> ProjectLocationConnectionProfileGetCall<'a, C>
3933where
3934 C: common::Connector,
3935{
3936 /// Perform the operation you have build so far.
3937 pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionProfile)> {
3938 use std::borrow::Cow;
3939 use std::io::{Read, Seek};
3940
3941 use common::{url::Params, ToParts};
3942 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3943
3944 let mut dd = common::DefaultDelegate;
3945 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3946 dlg.begin(common::MethodInfo {
3947 id: "datastream.projects.locations.connectionProfiles.get",
3948 http_method: hyper::Method::GET,
3949 });
3950
3951 for &field in ["alt", "name"].iter() {
3952 if self._additional_params.contains_key(field) {
3953 dlg.finished(false);
3954 return Err(common::Error::FieldClash(field));
3955 }
3956 }
3957
3958 let mut params = Params::with_capacity(3 + self._additional_params.len());
3959 params.push("name", self._name);
3960
3961 params.extend(self._additional_params.iter());
3962
3963 params.push("alt", "json");
3964 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3965 if self._scopes.is_empty() {
3966 self._scopes
3967 .insert(Scope::CloudPlatform.as_ref().to_string());
3968 }
3969
3970 #[allow(clippy::single_element_loop)]
3971 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3972 url = params.uri_replacement(url, param_name, find_this, true);
3973 }
3974 {
3975 let to_remove = ["name"];
3976 params.remove_params(&to_remove);
3977 }
3978
3979 let url = params.parse_with_url(&url);
3980
3981 loop {
3982 let token = match self
3983 .hub
3984 .auth
3985 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3986 .await
3987 {
3988 Ok(token) => token,
3989 Err(e) => match dlg.token(e) {
3990 Ok(token) => token,
3991 Err(e) => {
3992 dlg.finished(false);
3993 return Err(common::Error::MissingToken(e));
3994 }
3995 },
3996 };
3997 let mut req_result = {
3998 let client = &self.hub.client;
3999 dlg.pre_request();
4000 let mut req_builder = hyper::Request::builder()
4001 .method(hyper::Method::GET)
4002 .uri(url.as_str())
4003 .header(USER_AGENT, self.hub._user_agent.clone());
4004
4005 if let Some(token) = token.as_ref() {
4006 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4007 }
4008
4009 let request = req_builder
4010 .header(CONTENT_LENGTH, 0_u64)
4011 .body(common::to_body::<String>(None));
4012
4013 client.request(request.unwrap()).await
4014 };
4015
4016 match req_result {
4017 Err(err) => {
4018 if let common::Retry::After(d) = dlg.http_error(&err) {
4019 sleep(d).await;
4020 continue;
4021 }
4022 dlg.finished(false);
4023 return Err(common::Error::HttpError(err));
4024 }
4025 Ok(res) => {
4026 let (mut parts, body) = res.into_parts();
4027 let mut body = common::Body::new(body);
4028 if !parts.status.is_success() {
4029 let bytes = common::to_bytes(body).await.unwrap_or_default();
4030 let error = serde_json::from_str(&common::to_string(&bytes));
4031 let response = common::to_response(parts, bytes.into());
4032
4033 if let common::Retry::After(d) =
4034 dlg.http_failure(&response, error.as_ref().ok())
4035 {
4036 sleep(d).await;
4037 continue;
4038 }
4039
4040 dlg.finished(false);
4041
4042 return Err(match error {
4043 Ok(value) => common::Error::BadRequest(value),
4044 _ => common::Error::Failure(response),
4045 });
4046 }
4047 let response = {
4048 let bytes = common::to_bytes(body).await.unwrap_or_default();
4049 let encoded = common::to_string(&bytes);
4050 match serde_json::from_str(&encoded) {
4051 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4052 Err(error) => {
4053 dlg.response_json_decode_error(&encoded, &error);
4054 return Err(common::Error::JsonDecodeError(
4055 encoded.to_string(),
4056 error,
4057 ));
4058 }
4059 }
4060 };
4061
4062 dlg.finished(true);
4063 return Ok(response);
4064 }
4065 }
4066 }
4067 }
4068
4069 /// Required. The name of the connection profile resource to get.
4070 ///
4071 /// Sets the *name* path property to the given value.
4072 ///
4073 /// Even though the property as already been set when instantiating this call,
4074 /// we provide this method for API completeness.
4075 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileGetCall<'a, C> {
4076 self._name = new_value.to_string();
4077 self
4078 }
4079 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4080 /// while executing the actual API request.
4081 ///
4082 /// ````text
4083 /// It should be used to handle progress information, and to implement a certain level of resilience.
4084 /// ````
4085 ///
4086 /// Sets the *delegate* property to the given value.
4087 pub fn delegate(
4088 mut self,
4089 new_value: &'a mut dyn common::Delegate,
4090 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
4091 self._delegate = Some(new_value);
4092 self
4093 }
4094
4095 /// Set any additional parameter of the query string used in the request.
4096 /// It should be used to set parameters which are not yet available through their own
4097 /// setters.
4098 ///
4099 /// Please note that this method must not be used to set any of the known parameters
4100 /// which have their own setter method. If done anyway, the request will fail.
4101 ///
4102 /// # Additional Parameters
4103 ///
4104 /// * *$.xgafv* (query-string) - V1 error format.
4105 /// * *access_token* (query-string) - OAuth access token.
4106 /// * *alt* (query-string) - Data format for response.
4107 /// * *callback* (query-string) - JSONP
4108 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4109 /// * *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.
4110 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4111 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4112 /// * *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.
4113 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4114 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4115 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileGetCall<'a, C>
4116 where
4117 T: AsRef<str>,
4118 {
4119 self._additional_params
4120 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4121 self
4122 }
4123
4124 /// Identifies the authorization scope for the method you are building.
4125 ///
4126 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4127 /// [`Scope::CloudPlatform`].
4128 ///
4129 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4130 /// tokens for more than one scope.
4131 ///
4132 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4133 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4134 /// sufficient, a read-write scope will do as well.
4135 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileGetCall<'a, C>
4136 where
4137 St: AsRef<str>,
4138 {
4139 self._scopes.insert(String::from(scope.as_ref()));
4140 self
4141 }
4142 /// Identifies the authorization scope(s) for the method you are building.
4143 ///
4144 /// See [`Self::add_scope()`] for details.
4145 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileGetCall<'a, C>
4146 where
4147 I: IntoIterator<Item = St>,
4148 St: AsRef<str>,
4149 {
4150 self._scopes
4151 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4152 self
4153 }
4154
4155 /// Removes all scopes, and no default scope will be used either.
4156 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4157 /// for details).
4158 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetCall<'a, C> {
4159 self._scopes.clear();
4160 self
4161 }
4162}
4163
4164/// Use this method to list connection profiles created in a project and location.
4165///
4166/// A builder for the *locations.connectionProfiles.list* method supported by a *project* resource.
4167/// It is not used directly, but through a [`ProjectMethods`] instance.
4168///
4169/// # Example
4170///
4171/// Instantiate a resource method builder
4172///
4173/// ```test_harness,no_run
4174/// # extern crate hyper;
4175/// # extern crate hyper_rustls;
4176/// # extern crate google_datastream1 as datastream1;
4177/// # async fn dox() {
4178/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4179///
4180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4181/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4182/// # secret,
4183/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4184/// # ).build().await.unwrap();
4185///
4186/// # let client = hyper_util::client::legacy::Client::builder(
4187/// # hyper_util::rt::TokioExecutor::new()
4188/// # )
4189/// # .build(
4190/// # hyper_rustls::HttpsConnectorBuilder::new()
4191/// # .with_native_roots()
4192/// # .unwrap()
4193/// # .https_or_http()
4194/// # .enable_http1()
4195/// # .build()
4196/// # );
4197/// # let mut hub = Datastream::new(client, auth);
4198/// // You can configure optional parameters by calling the respective setters at will, and
4199/// // execute the final call using `doit()`.
4200/// // Values shown here are possibly random and not representative !
4201/// let result = hub.projects().locations_connection_profiles_list("parent")
4202/// .page_token("Lorem")
4203/// .page_size(-25)
4204/// .order_by("labore")
4205/// .filter("sed")
4206/// .doit().await;
4207/// # }
4208/// ```
4209pub struct ProjectLocationConnectionProfileListCall<'a, C>
4210where
4211 C: 'a,
4212{
4213 hub: &'a Datastream<C>,
4214 _parent: String,
4215 _page_token: Option<String>,
4216 _page_size: Option<i32>,
4217 _order_by: Option<String>,
4218 _filter: Option<String>,
4219 _delegate: Option<&'a mut dyn common::Delegate>,
4220 _additional_params: HashMap<String, String>,
4221 _scopes: BTreeSet<String>,
4222}
4223
4224impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileListCall<'a, C> {}
4225
4226impl<'a, C> ProjectLocationConnectionProfileListCall<'a, C>
4227where
4228 C: common::Connector,
4229{
4230 /// Perform the operation you have build so far.
4231 pub async fn doit(
4232 mut self,
4233 ) -> common::Result<(common::Response, ListConnectionProfilesResponse)> {
4234 use std::borrow::Cow;
4235 use std::io::{Read, Seek};
4236
4237 use common::{url::Params, ToParts};
4238 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4239
4240 let mut dd = common::DefaultDelegate;
4241 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4242 dlg.begin(common::MethodInfo {
4243 id: "datastream.projects.locations.connectionProfiles.list",
4244 http_method: hyper::Method::GET,
4245 });
4246
4247 for &field in [
4248 "alt",
4249 "parent",
4250 "pageToken",
4251 "pageSize",
4252 "orderBy",
4253 "filter",
4254 ]
4255 .iter()
4256 {
4257 if self._additional_params.contains_key(field) {
4258 dlg.finished(false);
4259 return Err(common::Error::FieldClash(field));
4260 }
4261 }
4262
4263 let mut params = Params::with_capacity(7 + self._additional_params.len());
4264 params.push("parent", self._parent);
4265 if let Some(value) = self._page_token.as_ref() {
4266 params.push("pageToken", value);
4267 }
4268 if let Some(value) = self._page_size.as_ref() {
4269 params.push("pageSize", value.to_string());
4270 }
4271 if let Some(value) = self._order_by.as_ref() {
4272 params.push("orderBy", value);
4273 }
4274 if let Some(value) = self._filter.as_ref() {
4275 params.push("filter", value);
4276 }
4277
4278 params.extend(self._additional_params.iter());
4279
4280 params.push("alt", "json");
4281 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
4282 if self._scopes.is_empty() {
4283 self._scopes
4284 .insert(Scope::CloudPlatform.as_ref().to_string());
4285 }
4286
4287 #[allow(clippy::single_element_loop)]
4288 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4289 url = params.uri_replacement(url, param_name, find_this, true);
4290 }
4291 {
4292 let to_remove = ["parent"];
4293 params.remove_params(&to_remove);
4294 }
4295
4296 let url = params.parse_with_url(&url);
4297
4298 loop {
4299 let token = match self
4300 .hub
4301 .auth
4302 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4303 .await
4304 {
4305 Ok(token) => token,
4306 Err(e) => match dlg.token(e) {
4307 Ok(token) => token,
4308 Err(e) => {
4309 dlg.finished(false);
4310 return Err(common::Error::MissingToken(e));
4311 }
4312 },
4313 };
4314 let mut req_result = {
4315 let client = &self.hub.client;
4316 dlg.pre_request();
4317 let mut req_builder = hyper::Request::builder()
4318 .method(hyper::Method::GET)
4319 .uri(url.as_str())
4320 .header(USER_AGENT, self.hub._user_agent.clone());
4321
4322 if let Some(token) = token.as_ref() {
4323 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4324 }
4325
4326 let request = req_builder
4327 .header(CONTENT_LENGTH, 0_u64)
4328 .body(common::to_body::<String>(None));
4329
4330 client.request(request.unwrap()).await
4331 };
4332
4333 match req_result {
4334 Err(err) => {
4335 if let common::Retry::After(d) = dlg.http_error(&err) {
4336 sleep(d).await;
4337 continue;
4338 }
4339 dlg.finished(false);
4340 return Err(common::Error::HttpError(err));
4341 }
4342 Ok(res) => {
4343 let (mut parts, body) = res.into_parts();
4344 let mut body = common::Body::new(body);
4345 if !parts.status.is_success() {
4346 let bytes = common::to_bytes(body).await.unwrap_or_default();
4347 let error = serde_json::from_str(&common::to_string(&bytes));
4348 let response = common::to_response(parts, bytes.into());
4349
4350 if let common::Retry::After(d) =
4351 dlg.http_failure(&response, error.as_ref().ok())
4352 {
4353 sleep(d).await;
4354 continue;
4355 }
4356
4357 dlg.finished(false);
4358
4359 return Err(match error {
4360 Ok(value) => common::Error::BadRequest(value),
4361 _ => common::Error::Failure(response),
4362 });
4363 }
4364 let response = {
4365 let bytes = common::to_bytes(body).await.unwrap_or_default();
4366 let encoded = common::to_string(&bytes);
4367 match serde_json::from_str(&encoded) {
4368 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4369 Err(error) => {
4370 dlg.response_json_decode_error(&encoded, &error);
4371 return Err(common::Error::JsonDecodeError(
4372 encoded.to_string(),
4373 error,
4374 ));
4375 }
4376 }
4377 };
4378
4379 dlg.finished(true);
4380 return Ok(response);
4381 }
4382 }
4383 }
4384 }
4385
4386 /// Required. The parent that owns the collection of connection profiles.
4387 ///
4388 /// Sets the *parent* path property to the given value.
4389 ///
4390 /// Even though the property as already been set when instantiating this call,
4391 /// we provide this method for API completeness.
4392 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
4393 self._parent = new_value.to_string();
4394 self
4395 }
4396 /// 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.
4397 ///
4398 /// Sets the *page token* query property to the given value.
4399 pub fn page_token(
4400 mut self,
4401 new_value: &str,
4402 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
4403 self._page_token = Some(new_value.to_string());
4404 self
4405 }
4406 /// 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.
4407 ///
4408 /// Sets the *page size* query property to the given value.
4409 pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionProfileListCall<'a, C> {
4410 self._page_size = Some(new_value);
4411 self
4412 }
4413 /// Order by fields for the result.
4414 ///
4415 /// Sets the *order by* query property to the given value.
4416 pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
4417 self._order_by = Some(new_value.to_string());
4418 self
4419 }
4420 /// Filter request.
4421 ///
4422 /// Sets the *filter* query property to the given value.
4423 pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
4424 self._filter = Some(new_value.to_string());
4425 self
4426 }
4427 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4428 /// while executing the actual API request.
4429 ///
4430 /// ````text
4431 /// It should be used to handle progress information, and to implement a certain level of resilience.
4432 /// ````
4433 ///
4434 /// Sets the *delegate* property to the given value.
4435 pub fn delegate(
4436 mut self,
4437 new_value: &'a mut dyn common::Delegate,
4438 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
4439 self._delegate = Some(new_value);
4440 self
4441 }
4442
4443 /// Set any additional parameter of the query string used in the request.
4444 /// It should be used to set parameters which are not yet available through their own
4445 /// setters.
4446 ///
4447 /// Please note that this method must not be used to set any of the known parameters
4448 /// which have their own setter method. If done anyway, the request will fail.
4449 ///
4450 /// # Additional Parameters
4451 ///
4452 /// * *$.xgafv* (query-string) - V1 error format.
4453 /// * *access_token* (query-string) - OAuth access token.
4454 /// * *alt* (query-string) - Data format for response.
4455 /// * *callback* (query-string) - JSONP
4456 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4457 /// * *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.
4458 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4459 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4460 /// * *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.
4461 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4462 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4463 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileListCall<'a, C>
4464 where
4465 T: AsRef<str>,
4466 {
4467 self._additional_params
4468 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4469 self
4470 }
4471
4472 /// Identifies the authorization scope for the method you are building.
4473 ///
4474 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4475 /// [`Scope::CloudPlatform`].
4476 ///
4477 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4478 /// tokens for more than one scope.
4479 ///
4480 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4481 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4482 /// sufficient, a read-write scope will do as well.
4483 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileListCall<'a, C>
4484 where
4485 St: AsRef<str>,
4486 {
4487 self._scopes.insert(String::from(scope.as_ref()));
4488 self
4489 }
4490 /// Identifies the authorization scope(s) for the method you are building.
4491 ///
4492 /// See [`Self::add_scope()`] for details.
4493 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileListCall<'a, C>
4494 where
4495 I: IntoIterator<Item = St>,
4496 St: AsRef<str>,
4497 {
4498 self._scopes
4499 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4500 self
4501 }
4502
4503 /// Removes all scopes, and no default scope will be used either.
4504 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4505 /// for details).
4506 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileListCall<'a, C> {
4507 self._scopes.clear();
4508 self
4509 }
4510}
4511
4512/// Use this method to update the parameters of a connection profile.
4513///
4514/// A builder for the *locations.connectionProfiles.patch* method supported by a *project* resource.
4515/// It is not used directly, but through a [`ProjectMethods`] instance.
4516///
4517/// # Example
4518///
4519/// Instantiate a resource method builder
4520///
4521/// ```test_harness,no_run
4522/// # extern crate hyper;
4523/// # extern crate hyper_rustls;
4524/// # extern crate google_datastream1 as datastream1;
4525/// use datastream1::api::ConnectionProfile;
4526/// # async fn dox() {
4527/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4528///
4529/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4530/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4531/// # secret,
4532/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4533/// # ).build().await.unwrap();
4534///
4535/// # let client = hyper_util::client::legacy::Client::builder(
4536/// # hyper_util::rt::TokioExecutor::new()
4537/// # )
4538/// # .build(
4539/// # hyper_rustls::HttpsConnectorBuilder::new()
4540/// # .with_native_roots()
4541/// # .unwrap()
4542/// # .https_or_http()
4543/// # .enable_http1()
4544/// # .build()
4545/// # );
4546/// # let mut hub = Datastream::new(client, auth);
4547/// // As the method needs a request, you would usually fill it with the desired information
4548/// // into the respective structure. Some of the parts shown here might not be applicable !
4549/// // Values shown here are possibly random and not representative !
4550/// let mut req = ConnectionProfile::default();
4551///
4552/// // You can configure optional parameters by calling the respective setters at will, and
4553/// // execute the final call using `doit()`.
4554/// // Values shown here are possibly random and not representative !
4555/// let result = hub.projects().locations_connection_profiles_patch(req, "name")
4556/// .validate_only(false)
4557/// .update_mask(FieldMask::new::<&str>(&[]))
4558/// .request_id("no")
4559/// .force(true)
4560/// .doit().await;
4561/// # }
4562/// ```
4563pub struct ProjectLocationConnectionProfilePatchCall<'a, C>
4564where
4565 C: 'a,
4566{
4567 hub: &'a Datastream<C>,
4568 _request: ConnectionProfile,
4569 _name: String,
4570 _validate_only: Option<bool>,
4571 _update_mask: Option<common::FieldMask>,
4572 _request_id: Option<String>,
4573 _force: Option<bool>,
4574 _delegate: Option<&'a mut dyn common::Delegate>,
4575 _additional_params: HashMap<String, String>,
4576 _scopes: BTreeSet<String>,
4577}
4578
4579impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfilePatchCall<'a, C> {}
4580
4581impl<'a, C> ProjectLocationConnectionProfilePatchCall<'a, C>
4582where
4583 C: common::Connector,
4584{
4585 /// Perform the operation you have build so far.
4586 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4587 use std::borrow::Cow;
4588 use std::io::{Read, Seek};
4589
4590 use common::{url::Params, ToParts};
4591 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4592
4593 let mut dd = common::DefaultDelegate;
4594 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4595 dlg.begin(common::MethodInfo {
4596 id: "datastream.projects.locations.connectionProfiles.patch",
4597 http_method: hyper::Method::PATCH,
4598 });
4599
4600 for &field in [
4601 "alt",
4602 "name",
4603 "validateOnly",
4604 "updateMask",
4605 "requestId",
4606 "force",
4607 ]
4608 .iter()
4609 {
4610 if self._additional_params.contains_key(field) {
4611 dlg.finished(false);
4612 return Err(common::Error::FieldClash(field));
4613 }
4614 }
4615
4616 let mut params = Params::with_capacity(8 + self._additional_params.len());
4617 params.push("name", self._name);
4618 if let Some(value) = self._validate_only.as_ref() {
4619 params.push("validateOnly", value.to_string());
4620 }
4621 if let Some(value) = self._update_mask.as_ref() {
4622 params.push("updateMask", value.to_string());
4623 }
4624 if let Some(value) = self._request_id.as_ref() {
4625 params.push("requestId", value);
4626 }
4627 if let Some(value) = self._force.as_ref() {
4628 params.push("force", value.to_string());
4629 }
4630
4631 params.extend(self._additional_params.iter());
4632
4633 params.push("alt", "json");
4634 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4635 if self._scopes.is_empty() {
4636 self._scopes
4637 .insert(Scope::CloudPlatform.as_ref().to_string());
4638 }
4639
4640 #[allow(clippy::single_element_loop)]
4641 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4642 url = params.uri_replacement(url, param_name, find_this, true);
4643 }
4644 {
4645 let to_remove = ["name"];
4646 params.remove_params(&to_remove);
4647 }
4648
4649 let url = params.parse_with_url(&url);
4650
4651 let mut json_mime_type = mime::APPLICATION_JSON;
4652 let mut request_value_reader = {
4653 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4654 common::remove_json_null_values(&mut value);
4655 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4656 serde_json::to_writer(&mut dst, &value).unwrap();
4657 dst
4658 };
4659 let request_size = request_value_reader
4660 .seek(std::io::SeekFrom::End(0))
4661 .unwrap();
4662 request_value_reader
4663 .seek(std::io::SeekFrom::Start(0))
4664 .unwrap();
4665
4666 loop {
4667 let token = match self
4668 .hub
4669 .auth
4670 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4671 .await
4672 {
4673 Ok(token) => token,
4674 Err(e) => match dlg.token(e) {
4675 Ok(token) => token,
4676 Err(e) => {
4677 dlg.finished(false);
4678 return Err(common::Error::MissingToken(e));
4679 }
4680 },
4681 };
4682 request_value_reader
4683 .seek(std::io::SeekFrom::Start(0))
4684 .unwrap();
4685 let mut req_result = {
4686 let client = &self.hub.client;
4687 dlg.pre_request();
4688 let mut req_builder = hyper::Request::builder()
4689 .method(hyper::Method::PATCH)
4690 .uri(url.as_str())
4691 .header(USER_AGENT, self.hub._user_agent.clone());
4692
4693 if let Some(token) = token.as_ref() {
4694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4695 }
4696
4697 let request = req_builder
4698 .header(CONTENT_TYPE, json_mime_type.to_string())
4699 .header(CONTENT_LENGTH, request_size as u64)
4700 .body(common::to_body(
4701 request_value_reader.get_ref().clone().into(),
4702 ));
4703
4704 client.request(request.unwrap()).await
4705 };
4706
4707 match req_result {
4708 Err(err) => {
4709 if let common::Retry::After(d) = dlg.http_error(&err) {
4710 sleep(d).await;
4711 continue;
4712 }
4713 dlg.finished(false);
4714 return Err(common::Error::HttpError(err));
4715 }
4716 Ok(res) => {
4717 let (mut parts, body) = res.into_parts();
4718 let mut body = common::Body::new(body);
4719 if !parts.status.is_success() {
4720 let bytes = common::to_bytes(body).await.unwrap_or_default();
4721 let error = serde_json::from_str(&common::to_string(&bytes));
4722 let response = common::to_response(parts, bytes.into());
4723
4724 if let common::Retry::After(d) =
4725 dlg.http_failure(&response, error.as_ref().ok())
4726 {
4727 sleep(d).await;
4728 continue;
4729 }
4730
4731 dlg.finished(false);
4732
4733 return Err(match error {
4734 Ok(value) => common::Error::BadRequest(value),
4735 _ => common::Error::Failure(response),
4736 });
4737 }
4738 let response = {
4739 let bytes = common::to_bytes(body).await.unwrap_or_default();
4740 let encoded = common::to_string(&bytes);
4741 match serde_json::from_str(&encoded) {
4742 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4743 Err(error) => {
4744 dlg.response_json_decode_error(&encoded, &error);
4745 return Err(common::Error::JsonDecodeError(
4746 encoded.to_string(),
4747 error,
4748 ));
4749 }
4750 }
4751 };
4752
4753 dlg.finished(true);
4754 return Ok(response);
4755 }
4756 }
4757 }
4758 }
4759
4760 ///
4761 /// Sets the *request* property to the given value.
4762 ///
4763 /// Even though the property as already been set when instantiating this call,
4764 /// we provide this method for API completeness.
4765 pub fn request(
4766 mut self,
4767 new_value: ConnectionProfile,
4768 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4769 self._request = new_value;
4770 self
4771 }
4772 /// Output only. The resource's name.
4773 ///
4774 /// Sets the *name* path property to the given value.
4775 ///
4776 /// Even though the property as already been set when instantiating this call,
4777 /// we provide this method for API completeness.
4778 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4779 self._name = new_value.to_string();
4780 self
4781 }
4782 /// Optional. Only validate the connection profile, but don't update any resources. The default is false.
4783 ///
4784 /// Sets the *validate only* query property to the given value.
4785 pub fn validate_only(
4786 mut self,
4787 new_value: bool,
4788 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4789 self._validate_only = Some(new_value);
4790 self
4791 }
4792 /// 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.
4793 ///
4794 /// Sets the *update mask* query property to the given value.
4795 pub fn update_mask(
4796 mut self,
4797 new_value: common::FieldMask,
4798 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4799 self._update_mask = Some(new_value);
4800 self
4801 }
4802 /// 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).
4803 ///
4804 /// Sets the *request id* query property to the given value.
4805 pub fn request_id(
4806 mut self,
4807 new_value: &str,
4808 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4809 self._request_id = Some(new_value.to_string());
4810 self
4811 }
4812 /// Optional. Update the connection profile without validating it.
4813 ///
4814 /// Sets the *force* query property to the given value.
4815 pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4816 self._force = Some(new_value);
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 ) -> ProjectLocationConnectionProfilePatchCall<'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>(mut self, name: T, value: T) -> ProjectLocationConnectionProfilePatchCall<'a, C>
4856 where
4857 T: AsRef<str>,
4858 {
4859 self._additional_params
4860 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4861 self
4862 }
4863
4864 /// Identifies the authorization scope for the method you are building.
4865 ///
4866 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4867 /// [`Scope::CloudPlatform`].
4868 ///
4869 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4870 /// tokens for more than one scope.
4871 ///
4872 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4873 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4874 /// sufficient, a read-write scope will do as well.
4875 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfilePatchCall<'a, C>
4876 where
4877 St: AsRef<str>,
4878 {
4879 self._scopes.insert(String::from(scope.as_ref()));
4880 self
4881 }
4882 /// Identifies the authorization scope(s) for the method you are building.
4883 ///
4884 /// See [`Self::add_scope()`] for details.
4885 pub fn add_scopes<I, St>(
4886 mut self,
4887 scopes: I,
4888 ) -> ProjectLocationConnectionProfilePatchCall<'a, C>
4889 where
4890 I: IntoIterator<Item = St>,
4891 St: AsRef<str>,
4892 {
4893 self._scopes
4894 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4895 self
4896 }
4897
4898 /// Removes all scopes, and no default scope will be used either.
4899 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4900 /// for details).
4901 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4902 self._scopes.clear();
4903 self
4904 }
4905}
4906
4907/// 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`.
4908///
4909/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
4910/// It is not used directly, but through a [`ProjectMethods`] instance.
4911///
4912/// # Example
4913///
4914/// Instantiate a resource method builder
4915///
4916/// ```test_harness,no_run
4917/// # extern crate hyper;
4918/// # extern crate hyper_rustls;
4919/// # extern crate google_datastream1 as datastream1;
4920/// use datastream1::api::CancelOperationRequest;
4921/// # async fn dox() {
4922/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4923///
4924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4926/// # secret,
4927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4928/// # ).build().await.unwrap();
4929///
4930/// # let client = hyper_util::client::legacy::Client::builder(
4931/// # hyper_util::rt::TokioExecutor::new()
4932/// # )
4933/// # .build(
4934/// # hyper_rustls::HttpsConnectorBuilder::new()
4935/// # .with_native_roots()
4936/// # .unwrap()
4937/// # .https_or_http()
4938/// # .enable_http1()
4939/// # .build()
4940/// # );
4941/// # let mut hub = Datastream::new(client, auth);
4942/// // As the method needs a request, you would usually fill it with the desired information
4943/// // into the respective structure. Some of the parts shown here might not be applicable !
4944/// // Values shown here are possibly random and not representative !
4945/// let mut req = CancelOperationRequest::default();
4946///
4947/// // You can configure optional parameters by calling the respective setters at will, and
4948/// // execute the final call using `doit()`.
4949/// // Values shown here are possibly random and not representative !
4950/// let result = hub.projects().locations_operations_cancel(req, "name")
4951/// .doit().await;
4952/// # }
4953/// ```
4954pub struct ProjectLocationOperationCancelCall<'a, C>
4955where
4956 C: 'a,
4957{
4958 hub: &'a Datastream<C>,
4959 _request: CancelOperationRequest,
4960 _name: String,
4961 _delegate: Option<&'a mut dyn common::Delegate>,
4962 _additional_params: HashMap<String, String>,
4963 _scopes: BTreeSet<String>,
4964}
4965
4966impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
4967
4968impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
4969where
4970 C: common::Connector,
4971{
4972 /// Perform the operation you have build so far.
4973 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4974 use std::borrow::Cow;
4975 use std::io::{Read, Seek};
4976
4977 use common::{url::Params, ToParts};
4978 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4979
4980 let mut dd = common::DefaultDelegate;
4981 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4982 dlg.begin(common::MethodInfo {
4983 id: "datastream.projects.locations.operations.cancel",
4984 http_method: hyper::Method::POST,
4985 });
4986
4987 for &field in ["alt", "name"].iter() {
4988 if self._additional_params.contains_key(field) {
4989 dlg.finished(false);
4990 return Err(common::Error::FieldClash(field));
4991 }
4992 }
4993
4994 let mut params = Params::with_capacity(4 + self._additional_params.len());
4995 params.push("name", self._name);
4996
4997 params.extend(self._additional_params.iter());
4998
4999 params.push("alt", "json");
5000 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
5001 if self._scopes.is_empty() {
5002 self._scopes
5003 .insert(Scope::CloudPlatform.as_ref().to_string());
5004 }
5005
5006 #[allow(clippy::single_element_loop)]
5007 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5008 url = params.uri_replacement(url, param_name, find_this, true);
5009 }
5010 {
5011 let to_remove = ["name"];
5012 params.remove_params(&to_remove);
5013 }
5014
5015 let url = params.parse_with_url(&url);
5016
5017 let mut json_mime_type = mime::APPLICATION_JSON;
5018 let mut request_value_reader = {
5019 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5020 common::remove_json_null_values(&mut value);
5021 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5022 serde_json::to_writer(&mut dst, &value).unwrap();
5023 dst
5024 };
5025 let request_size = request_value_reader
5026 .seek(std::io::SeekFrom::End(0))
5027 .unwrap();
5028 request_value_reader
5029 .seek(std::io::SeekFrom::Start(0))
5030 .unwrap();
5031
5032 loop {
5033 let token = match self
5034 .hub
5035 .auth
5036 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5037 .await
5038 {
5039 Ok(token) => token,
5040 Err(e) => match dlg.token(e) {
5041 Ok(token) => token,
5042 Err(e) => {
5043 dlg.finished(false);
5044 return Err(common::Error::MissingToken(e));
5045 }
5046 },
5047 };
5048 request_value_reader
5049 .seek(std::io::SeekFrom::Start(0))
5050 .unwrap();
5051 let mut req_result = {
5052 let client = &self.hub.client;
5053 dlg.pre_request();
5054 let mut req_builder = hyper::Request::builder()
5055 .method(hyper::Method::POST)
5056 .uri(url.as_str())
5057 .header(USER_AGENT, self.hub._user_agent.clone());
5058
5059 if let Some(token) = token.as_ref() {
5060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5061 }
5062
5063 let request = req_builder
5064 .header(CONTENT_TYPE, json_mime_type.to_string())
5065 .header(CONTENT_LENGTH, request_size as u64)
5066 .body(common::to_body(
5067 request_value_reader.get_ref().clone().into(),
5068 ));
5069
5070 client.request(request.unwrap()).await
5071 };
5072
5073 match req_result {
5074 Err(err) => {
5075 if let common::Retry::After(d) = dlg.http_error(&err) {
5076 sleep(d).await;
5077 continue;
5078 }
5079 dlg.finished(false);
5080 return Err(common::Error::HttpError(err));
5081 }
5082 Ok(res) => {
5083 let (mut parts, body) = res.into_parts();
5084 let mut body = common::Body::new(body);
5085 if !parts.status.is_success() {
5086 let bytes = common::to_bytes(body).await.unwrap_or_default();
5087 let error = serde_json::from_str(&common::to_string(&bytes));
5088 let response = common::to_response(parts, bytes.into());
5089
5090 if let common::Retry::After(d) =
5091 dlg.http_failure(&response, error.as_ref().ok())
5092 {
5093 sleep(d).await;
5094 continue;
5095 }
5096
5097 dlg.finished(false);
5098
5099 return Err(match error {
5100 Ok(value) => common::Error::BadRequest(value),
5101 _ => common::Error::Failure(response),
5102 });
5103 }
5104 let response = {
5105 let bytes = common::to_bytes(body).await.unwrap_or_default();
5106 let encoded = common::to_string(&bytes);
5107 match serde_json::from_str(&encoded) {
5108 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5109 Err(error) => {
5110 dlg.response_json_decode_error(&encoded, &error);
5111 return Err(common::Error::JsonDecodeError(
5112 encoded.to_string(),
5113 error,
5114 ));
5115 }
5116 }
5117 };
5118
5119 dlg.finished(true);
5120 return Ok(response);
5121 }
5122 }
5123 }
5124 }
5125
5126 ///
5127 /// Sets the *request* property to the given value.
5128 ///
5129 /// Even though the property as already been set when instantiating this call,
5130 /// we provide this method for API completeness.
5131 pub fn request(
5132 mut self,
5133 new_value: CancelOperationRequest,
5134 ) -> ProjectLocationOperationCancelCall<'a, C> {
5135 self._request = new_value;
5136 self
5137 }
5138 /// The name of the operation resource to be cancelled.
5139 ///
5140 /// Sets the *name* path property to the given value.
5141 ///
5142 /// Even though the property as already been set when instantiating this call,
5143 /// we provide this method for API completeness.
5144 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
5145 self._name = new_value.to_string();
5146 self
5147 }
5148 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5149 /// while executing the actual API request.
5150 ///
5151 /// ````text
5152 /// It should be used to handle progress information, and to implement a certain level of resilience.
5153 /// ````
5154 ///
5155 /// Sets the *delegate* property to the given value.
5156 pub fn delegate(
5157 mut self,
5158 new_value: &'a mut dyn common::Delegate,
5159 ) -> ProjectLocationOperationCancelCall<'a, C> {
5160 self._delegate = Some(new_value);
5161 self
5162 }
5163
5164 /// Set any additional parameter of the query string used in the request.
5165 /// It should be used to set parameters which are not yet available through their own
5166 /// setters.
5167 ///
5168 /// Please note that this method must not be used to set any of the known parameters
5169 /// which have their own setter method. If done anyway, the request will fail.
5170 ///
5171 /// # Additional Parameters
5172 ///
5173 /// * *$.xgafv* (query-string) - V1 error format.
5174 /// * *access_token* (query-string) - OAuth access token.
5175 /// * *alt* (query-string) - Data format for response.
5176 /// * *callback* (query-string) - JSONP
5177 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5178 /// * *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.
5179 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5180 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5181 /// * *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.
5182 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5183 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5184 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
5185 where
5186 T: AsRef<str>,
5187 {
5188 self._additional_params
5189 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5190 self
5191 }
5192
5193 /// Identifies the authorization scope for the method you are building.
5194 ///
5195 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5196 /// [`Scope::CloudPlatform`].
5197 ///
5198 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5199 /// tokens for more than one scope.
5200 ///
5201 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5202 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5203 /// sufficient, a read-write scope will do as well.
5204 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
5205 where
5206 St: AsRef<str>,
5207 {
5208 self._scopes.insert(String::from(scope.as_ref()));
5209 self
5210 }
5211 /// Identifies the authorization scope(s) for the method you are building.
5212 ///
5213 /// See [`Self::add_scope()`] for details.
5214 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
5215 where
5216 I: IntoIterator<Item = St>,
5217 St: AsRef<str>,
5218 {
5219 self._scopes
5220 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5221 self
5222 }
5223
5224 /// Removes all scopes, and no default scope will be used either.
5225 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5226 /// for details).
5227 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
5228 self._scopes.clear();
5229 self
5230 }
5231}
5232
5233/// 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`.
5234///
5235/// A builder for the *locations.operations.delete* method supported by a *project* resource.
5236/// It is not used directly, but through a [`ProjectMethods`] instance.
5237///
5238/// # Example
5239///
5240/// Instantiate a resource method builder
5241///
5242/// ```test_harness,no_run
5243/// # extern crate hyper;
5244/// # extern crate hyper_rustls;
5245/// # extern crate google_datastream1 as datastream1;
5246/// # async fn dox() {
5247/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5248///
5249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5251/// # secret,
5252/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5253/// # ).build().await.unwrap();
5254///
5255/// # let client = hyper_util::client::legacy::Client::builder(
5256/// # hyper_util::rt::TokioExecutor::new()
5257/// # )
5258/// # .build(
5259/// # hyper_rustls::HttpsConnectorBuilder::new()
5260/// # .with_native_roots()
5261/// # .unwrap()
5262/// # .https_or_http()
5263/// # .enable_http1()
5264/// # .build()
5265/// # );
5266/// # let mut hub = Datastream::new(client, auth);
5267/// // You can configure optional parameters by calling the respective setters at will, and
5268/// // execute the final call using `doit()`.
5269/// // Values shown here are possibly random and not representative !
5270/// let result = hub.projects().locations_operations_delete("name")
5271/// .doit().await;
5272/// # }
5273/// ```
5274pub struct ProjectLocationOperationDeleteCall<'a, C>
5275where
5276 C: 'a,
5277{
5278 hub: &'a Datastream<C>,
5279 _name: String,
5280 _delegate: Option<&'a mut dyn common::Delegate>,
5281 _additional_params: HashMap<String, String>,
5282 _scopes: BTreeSet<String>,
5283}
5284
5285impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
5286
5287impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
5288where
5289 C: common::Connector,
5290{
5291 /// Perform the operation you have build so far.
5292 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5293 use std::borrow::Cow;
5294 use std::io::{Read, Seek};
5295
5296 use common::{url::Params, ToParts};
5297 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5298
5299 let mut dd = common::DefaultDelegate;
5300 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5301 dlg.begin(common::MethodInfo {
5302 id: "datastream.projects.locations.operations.delete",
5303 http_method: hyper::Method::DELETE,
5304 });
5305
5306 for &field in ["alt", "name"].iter() {
5307 if self._additional_params.contains_key(field) {
5308 dlg.finished(false);
5309 return Err(common::Error::FieldClash(field));
5310 }
5311 }
5312
5313 let mut params = Params::with_capacity(3 + self._additional_params.len());
5314 params.push("name", self._name);
5315
5316 params.extend(self._additional_params.iter());
5317
5318 params.push("alt", "json");
5319 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5320 if self._scopes.is_empty() {
5321 self._scopes
5322 .insert(Scope::CloudPlatform.as_ref().to_string());
5323 }
5324
5325 #[allow(clippy::single_element_loop)]
5326 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5327 url = params.uri_replacement(url, param_name, find_this, true);
5328 }
5329 {
5330 let to_remove = ["name"];
5331 params.remove_params(&to_remove);
5332 }
5333
5334 let url = params.parse_with_url(&url);
5335
5336 loop {
5337 let token = match self
5338 .hub
5339 .auth
5340 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5341 .await
5342 {
5343 Ok(token) => token,
5344 Err(e) => match dlg.token(e) {
5345 Ok(token) => token,
5346 Err(e) => {
5347 dlg.finished(false);
5348 return Err(common::Error::MissingToken(e));
5349 }
5350 },
5351 };
5352 let mut req_result = {
5353 let client = &self.hub.client;
5354 dlg.pre_request();
5355 let mut req_builder = hyper::Request::builder()
5356 .method(hyper::Method::DELETE)
5357 .uri(url.as_str())
5358 .header(USER_AGENT, self.hub._user_agent.clone());
5359
5360 if let Some(token) = token.as_ref() {
5361 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5362 }
5363
5364 let request = req_builder
5365 .header(CONTENT_LENGTH, 0_u64)
5366 .body(common::to_body::<String>(None));
5367
5368 client.request(request.unwrap()).await
5369 };
5370
5371 match req_result {
5372 Err(err) => {
5373 if let common::Retry::After(d) = dlg.http_error(&err) {
5374 sleep(d).await;
5375 continue;
5376 }
5377 dlg.finished(false);
5378 return Err(common::Error::HttpError(err));
5379 }
5380 Ok(res) => {
5381 let (mut parts, body) = res.into_parts();
5382 let mut body = common::Body::new(body);
5383 if !parts.status.is_success() {
5384 let bytes = common::to_bytes(body).await.unwrap_or_default();
5385 let error = serde_json::from_str(&common::to_string(&bytes));
5386 let response = common::to_response(parts, bytes.into());
5387
5388 if let common::Retry::After(d) =
5389 dlg.http_failure(&response, error.as_ref().ok())
5390 {
5391 sleep(d).await;
5392 continue;
5393 }
5394
5395 dlg.finished(false);
5396
5397 return Err(match error {
5398 Ok(value) => common::Error::BadRequest(value),
5399 _ => common::Error::Failure(response),
5400 });
5401 }
5402 let response = {
5403 let bytes = common::to_bytes(body).await.unwrap_or_default();
5404 let encoded = common::to_string(&bytes);
5405 match serde_json::from_str(&encoded) {
5406 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5407 Err(error) => {
5408 dlg.response_json_decode_error(&encoded, &error);
5409 return Err(common::Error::JsonDecodeError(
5410 encoded.to_string(),
5411 error,
5412 ));
5413 }
5414 }
5415 };
5416
5417 dlg.finished(true);
5418 return Ok(response);
5419 }
5420 }
5421 }
5422 }
5423
5424 /// The name of the operation resource to be deleted.
5425 ///
5426 /// Sets the *name* path property to the given value.
5427 ///
5428 /// Even though the property as already been set when instantiating this call,
5429 /// we provide this method for API completeness.
5430 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
5431 self._name = new_value.to_string();
5432 self
5433 }
5434 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5435 /// while executing the actual API request.
5436 ///
5437 /// ````text
5438 /// It should be used to handle progress information, and to implement a certain level of resilience.
5439 /// ````
5440 ///
5441 /// Sets the *delegate* property to the given value.
5442 pub fn delegate(
5443 mut self,
5444 new_value: &'a mut dyn common::Delegate,
5445 ) -> ProjectLocationOperationDeleteCall<'a, C> {
5446 self._delegate = Some(new_value);
5447 self
5448 }
5449
5450 /// Set any additional parameter of the query string used in the request.
5451 /// It should be used to set parameters which are not yet available through their own
5452 /// setters.
5453 ///
5454 /// Please note that this method must not be used to set any of the known parameters
5455 /// which have their own setter method. If done anyway, the request will fail.
5456 ///
5457 /// # Additional Parameters
5458 ///
5459 /// * *$.xgafv* (query-string) - V1 error format.
5460 /// * *access_token* (query-string) - OAuth access token.
5461 /// * *alt* (query-string) - Data format for response.
5462 /// * *callback* (query-string) - JSONP
5463 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5464 /// * *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.
5465 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5466 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5467 /// * *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.
5468 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5469 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5470 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
5471 where
5472 T: AsRef<str>,
5473 {
5474 self._additional_params
5475 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5476 self
5477 }
5478
5479 /// Identifies the authorization scope for the method you are building.
5480 ///
5481 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5482 /// [`Scope::CloudPlatform`].
5483 ///
5484 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5485 /// tokens for more than one scope.
5486 ///
5487 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5488 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5489 /// sufficient, a read-write scope will do as well.
5490 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
5491 where
5492 St: AsRef<str>,
5493 {
5494 self._scopes.insert(String::from(scope.as_ref()));
5495 self
5496 }
5497 /// Identifies the authorization scope(s) for the method you are building.
5498 ///
5499 /// See [`Self::add_scope()`] for details.
5500 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
5501 where
5502 I: IntoIterator<Item = St>,
5503 St: AsRef<str>,
5504 {
5505 self._scopes
5506 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5507 self
5508 }
5509
5510 /// Removes all scopes, and no default scope will be used either.
5511 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5512 /// for details).
5513 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
5514 self._scopes.clear();
5515 self
5516 }
5517}
5518
5519/// 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.
5520///
5521/// A builder for the *locations.operations.get* method supported by a *project* resource.
5522/// It is not used directly, but through a [`ProjectMethods`] instance.
5523///
5524/// # Example
5525///
5526/// Instantiate a resource method builder
5527///
5528/// ```test_harness,no_run
5529/// # extern crate hyper;
5530/// # extern crate hyper_rustls;
5531/// # extern crate google_datastream1 as datastream1;
5532/// # async fn dox() {
5533/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5534///
5535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5537/// # secret,
5538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5539/// # ).build().await.unwrap();
5540///
5541/// # let client = hyper_util::client::legacy::Client::builder(
5542/// # hyper_util::rt::TokioExecutor::new()
5543/// # )
5544/// # .build(
5545/// # hyper_rustls::HttpsConnectorBuilder::new()
5546/// # .with_native_roots()
5547/// # .unwrap()
5548/// # .https_or_http()
5549/// # .enable_http1()
5550/// # .build()
5551/// # );
5552/// # let mut hub = Datastream::new(client, auth);
5553/// // You can configure optional parameters by calling the respective setters at will, and
5554/// // execute the final call using `doit()`.
5555/// // Values shown here are possibly random and not representative !
5556/// let result = hub.projects().locations_operations_get("name")
5557/// .doit().await;
5558/// # }
5559/// ```
5560pub struct ProjectLocationOperationGetCall<'a, C>
5561where
5562 C: 'a,
5563{
5564 hub: &'a Datastream<C>,
5565 _name: String,
5566 _delegate: Option<&'a mut dyn common::Delegate>,
5567 _additional_params: HashMap<String, String>,
5568 _scopes: BTreeSet<String>,
5569}
5570
5571impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
5572
5573impl<'a, C> ProjectLocationOperationGetCall<'a, C>
5574where
5575 C: common::Connector,
5576{
5577 /// Perform the operation you have build so far.
5578 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5579 use std::borrow::Cow;
5580 use std::io::{Read, Seek};
5581
5582 use common::{url::Params, ToParts};
5583 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5584
5585 let mut dd = common::DefaultDelegate;
5586 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5587 dlg.begin(common::MethodInfo {
5588 id: "datastream.projects.locations.operations.get",
5589 http_method: hyper::Method::GET,
5590 });
5591
5592 for &field in ["alt", "name"].iter() {
5593 if self._additional_params.contains_key(field) {
5594 dlg.finished(false);
5595 return Err(common::Error::FieldClash(field));
5596 }
5597 }
5598
5599 let mut params = Params::with_capacity(3 + self._additional_params.len());
5600 params.push("name", self._name);
5601
5602 params.extend(self._additional_params.iter());
5603
5604 params.push("alt", "json");
5605 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5606 if self._scopes.is_empty() {
5607 self._scopes
5608 .insert(Scope::CloudPlatform.as_ref().to_string());
5609 }
5610
5611 #[allow(clippy::single_element_loop)]
5612 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5613 url = params.uri_replacement(url, param_name, find_this, true);
5614 }
5615 {
5616 let to_remove = ["name"];
5617 params.remove_params(&to_remove);
5618 }
5619
5620 let url = params.parse_with_url(&url);
5621
5622 loop {
5623 let token = match self
5624 .hub
5625 .auth
5626 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5627 .await
5628 {
5629 Ok(token) => token,
5630 Err(e) => match dlg.token(e) {
5631 Ok(token) => token,
5632 Err(e) => {
5633 dlg.finished(false);
5634 return Err(common::Error::MissingToken(e));
5635 }
5636 },
5637 };
5638 let mut req_result = {
5639 let client = &self.hub.client;
5640 dlg.pre_request();
5641 let mut req_builder = hyper::Request::builder()
5642 .method(hyper::Method::GET)
5643 .uri(url.as_str())
5644 .header(USER_AGENT, self.hub._user_agent.clone());
5645
5646 if let Some(token) = token.as_ref() {
5647 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5648 }
5649
5650 let request = req_builder
5651 .header(CONTENT_LENGTH, 0_u64)
5652 .body(common::to_body::<String>(None));
5653
5654 client.request(request.unwrap()).await
5655 };
5656
5657 match req_result {
5658 Err(err) => {
5659 if let common::Retry::After(d) = dlg.http_error(&err) {
5660 sleep(d).await;
5661 continue;
5662 }
5663 dlg.finished(false);
5664 return Err(common::Error::HttpError(err));
5665 }
5666 Ok(res) => {
5667 let (mut parts, body) = res.into_parts();
5668 let mut body = common::Body::new(body);
5669 if !parts.status.is_success() {
5670 let bytes = common::to_bytes(body).await.unwrap_or_default();
5671 let error = serde_json::from_str(&common::to_string(&bytes));
5672 let response = common::to_response(parts, bytes.into());
5673
5674 if let common::Retry::After(d) =
5675 dlg.http_failure(&response, error.as_ref().ok())
5676 {
5677 sleep(d).await;
5678 continue;
5679 }
5680
5681 dlg.finished(false);
5682
5683 return Err(match error {
5684 Ok(value) => common::Error::BadRequest(value),
5685 _ => common::Error::Failure(response),
5686 });
5687 }
5688 let response = {
5689 let bytes = common::to_bytes(body).await.unwrap_or_default();
5690 let encoded = common::to_string(&bytes);
5691 match serde_json::from_str(&encoded) {
5692 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5693 Err(error) => {
5694 dlg.response_json_decode_error(&encoded, &error);
5695 return Err(common::Error::JsonDecodeError(
5696 encoded.to_string(),
5697 error,
5698 ));
5699 }
5700 }
5701 };
5702
5703 dlg.finished(true);
5704 return Ok(response);
5705 }
5706 }
5707 }
5708 }
5709
5710 /// The name of the operation resource.
5711 ///
5712 /// Sets the *name* path property to the given value.
5713 ///
5714 /// Even though the property as already been set when instantiating this call,
5715 /// we provide this method for API completeness.
5716 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
5717 self._name = new_value.to_string();
5718 self
5719 }
5720 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5721 /// while executing the actual API request.
5722 ///
5723 /// ````text
5724 /// It should be used to handle progress information, and to implement a certain level of resilience.
5725 /// ````
5726 ///
5727 /// Sets the *delegate* property to the given value.
5728 pub fn delegate(
5729 mut self,
5730 new_value: &'a mut dyn common::Delegate,
5731 ) -> ProjectLocationOperationGetCall<'a, C> {
5732 self._delegate = Some(new_value);
5733 self
5734 }
5735
5736 /// Set any additional parameter of the query string used in the request.
5737 /// It should be used to set parameters which are not yet available through their own
5738 /// setters.
5739 ///
5740 /// Please note that this method must not be used to set any of the known parameters
5741 /// which have their own setter method. If done anyway, the request will fail.
5742 ///
5743 /// # Additional Parameters
5744 ///
5745 /// * *$.xgafv* (query-string) - V1 error format.
5746 /// * *access_token* (query-string) - OAuth access token.
5747 /// * *alt* (query-string) - Data format for response.
5748 /// * *callback* (query-string) - JSONP
5749 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5750 /// * *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.
5751 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5752 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5753 /// * *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.
5754 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5755 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5756 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
5757 where
5758 T: AsRef<str>,
5759 {
5760 self._additional_params
5761 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5762 self
5763 }
5764
5765 /// Identifies the authorization scope for the method you are building.
5766 ///
5767 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5768 /// [`Scope::CloudPlatform`].
5769 ///
5770 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5771 /// tokens for more than one scope.
5772 ///
5773 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5774 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5775 /// sufficient, a read-write scope will do as well.
5776 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
5777 where
5778 St: AsRef<str>,
5779 {
5780 self._scopes.insert(String::from(scope.as_ref()));
5781 self
5782 }
5783 /// Identifies the authorization scope(s) for the method you are building.
5784 ///
5785 /// See [`Self::add_scope()`] for details.
5786 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
5787 where
5788 I: IntoIterator<Item = St>,
5789 St: AsRef<str>,
5790 {
5791 self._scopes
5792 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5793 self
5794 }
5795
5796 /// Removes all scopes, and no default scope will be used either.
5797 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5798 /// for details).
5799 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
5800 self._scopes.clear();
5801 self
5802 }
5803}
5804
5805/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
5806///
5807/// A builder for the *locations.operations.list* method supported by a *project* resource.
5808/// It is not used directly, but through a [`ProjectMethods`] instance.
5809///
5810/// # Example
5811///
5812/// Instantiate a resource method builder
5813///
5814/// ```test_harness,no_run
5815/// # extern crate hyper;
5816/// # extern crate hyper_rustls;
5817/// # extern crate google_datastream1 as datastream1;
5818/// # async fn dox() {
5819/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5820///
5821/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5822/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5823/// # secret,
5824/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5825/// # ).build().await.unwrap();
5826///
5827/// # let client = hyper_util::client::legacy::Client::builder(
5828/// # hyper_util::rt::TokioExecutor::new()
5829/// # )
5830/// # .build(
5831/// # hyper_rustls::HttpsConnectorBuilder::new()
5832/// # .with_native_roots()
5833/// # .unwrap()
5834/// # .https_or_http()
5835/// # .enable_http1()
5836/// # .build()
5837/// # );
5838/// # let mut hub = Datastream::new(client, auth);
5839/// // You can configure optional parameters by calling the respective setters at will, and
5840/// // execute the final call using `doit()`.
5841/// // Values shown here are possibly random and not representative !
5842/// let result = hub.projects().locations_operations_list("name")
5843/// .page_token("sed")
5844/// .page_size(-20)
5845/// .filter("dolore")
5846/// .doit().await;
5847/// # }
5848/// ```
5849pub struct ProjectLocationOperationListCall<'a, C>
5850where
5851 C: 'a,
5852{
5853 hub: &'a Datastream<C>,
5854 _name: String,
5855 _page_token: Option<String>,
5856 _page_size: Option<i32>,
5857 _filter: Option<String>,
5858 _delegate: Option<&'a mut dyn common::Delegate>,
5859 _additional_params: HashMap<String, String>,
5860 _scopes: BTreeSet<String>,
5861}
5862
5863impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
5864
5865impl<'a, C> ProjectLocationOperationListCall<'a, C>
5866where
5867 C: common::Connector,
5868{
5869 /// Perform the operation you have build so far.
5870 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
5871 use std::borrow::Cow;
5872 use std::io::{Read, Seek};
5873
5874 use common::{url::Params, ToParts};
5875 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5876
5877 let mut dd = common::DefaultDelegate;
5878 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5879 dlg.begin(common::MethodInfo {
5880 id: "datastream.projects.locations.operations.list",
5881 http_method: hyper::Method::GET,
5882 });
5883
5884 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
5885 if self._additional_params.contains_key(field) {
5886 dlg.finished(false);
5887 return Err(common::Error::FieldClash(field));
5888 }
5889 }
5890
5891 let mut params = Params::with_capacity(6 + self._additional_params.len());
5892 params.push("name", self._name);
5893 if let Some(value) = self._page_token.as_ref() {
5894 params.push("pageToken", value);
5895 }
5896 if let Some(value) = self._page_size.as_ref() {
5897 params.push("pageSize", value.to_string());
5898 }
5899 if let Some(value) = self._filter.as_ref() {
5900 params.push("filter", value);
5901 }
5902
5903 params.extend(self._additional_params.iter());
5904
5905 params.push("alt", "json");
5906 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
5907 if self._scopes.is_empty() {
5908 self._scopes
5909 .insert(Scope::CloudPlatform.as_ref().to_string());
5910 }
5911
5912 #[allow(clippy::single_element_loop)]
5913 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5914 url = params.uri_replacement(url, param_name, find_this, true);
5915 }
5916 {
5917 let to_remove = ["name"];
5918 params.remove_params(&to_remove);
5919 }
5920
5921 let url = params.parse_with_url(&url);
5922
5923 loop {
5924 let token = match self
5925 .hub
5926 .auth
5927 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5928 .await
5929 {
5930 Ok(token) => token,
5931 Err(e) => match dlg.token(e) {
5932 Ok(token) => token,
5933 Err(e) => {
5934 dlg.finished(false);
5935 return Err(common::Error::MissingToken(e));
5936 }
5937 },
5938 };
5939 let mut req_result = {
5940 let client = &self.hub.client;
5941 dlg.pre_request();
5942 let mut req_builder = hyper::Request::builder()
5943 .method(hyper::Method::GET)
5944 .uri(url.as_str())
5945 .header(USER_AGENT, self.hub._user_agent.clone());
5946
5947 if let Some(token) = token.as_ref() {
5948 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5949 }
5950
5951 let request = req_builder
5952 .header(CONTENT_LENGTH, 0_u64)
5953 .body(common::to_body::<String>(None));
5954
5955 client.request(request.unwrap()).await
5956 };
5957
5958 match req_result {
5959 Err(err) => {
5960 if let common::Retry::After(d) = dlg.http_error(&err) {
5961 sleep(d).await;
5962 continue;
5963 }
5964 dlg.finished(false);
5965 return Err(common::Error::HttpError(err));
5966 }
5967 Ok(res) => {
5968 let (mut parts, body) = res.into_parts();
5969 let mut body = common::Body::new(body);
5970 if !parts.status.is_success() {
5971 let bytes = common::to_bytes(body).await.unwrap_or_default();
5972 let error = serde_json::from_str(&common::to_string(&bytes));
5973 let response = common::to_response(parts, bytes.into());
5974
5975 if let common::Retry::After(d) =
5976 dlg.http_failure(&response, error.as_ref().ok())
5977 {
5978 sleep(d).await;
5979 continue;
5980 }
5981
5982 dlg.finished(false);
5983
5984 return Err(match error {
5985 Ok(value) => common::Error::BadRequest(value),
5986 _ => common::Error::Failure(response),
5987 });
5988 }
5989 let response = {
5990 let bytes = common::to_bytes(body).await.unwrap_or_default();
5991 let encoded = common::to_string(&bytes);
5992 match serde_json::from_str(&encoded) {
5993 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5994 Err(error) => {
5995 dlg.response_json_decode_error(&encoded, &error);
5996 return Err(common::Error::JsonDecodeError(
5997 encoded.to_string(),
5998 error,
5999 ));
6000 }
6001 }
6002 };
6003
6004 dlg.finished(true);
6005 return Ok(response);
6006 }
6007 }
6008 }
6009 }
6010
6011 /// The name of the operation's parent resource.
6012 ///
6013 /// Sets the *name* path property to the given value.
6014 ///
6015 /// Even though the property as already been set when instantiating this call,
6016 /// we provide this method for API completeness.
6017 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6018 self._name = new_value.to_string();
6019 self
6020 }
6021 /// The standard list page token.
6022 ///
6023 /// Sets the *page token* query property to the given value.
6024 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6025 self._page_token = Some(new_value.to_string());
6026 self
6027 }
6028 /// The standard list page size.
6029 ///
6030 /// Sets the *page size* query property to the given value.
6031 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
6032 self._page_size = Some(new_value);
6033 self
6034 }
6035 /// The standard list filter.
6036 ///
6037 /// Sets the *filter* query property to the given value.
6038 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6039 self._filter = Some(new_value.to_string());
6040 self
6041 }
6042 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6043 /// while executing the actual API request.
6044 ///
6045 /// ````text
6046 /// It should be used to handle progress information, and to implement a certain level of resilience.
6047 /// ````
6048 ///
6049 /// Sets the *delegate* property to the given value.
6050 pub fn delegate(
6051 mut self,
6052 new_value: &'a mut dyn common::Delegate,
6053 ) -> ProjectLocationOperationListCall<'a, C> {
6054 self._delegate = Some(new_value);
6055 self
6056 }
6057
6058 /// Set any additional parameter of the query string used in the request.
6059 /// It should be used to set parameters which are not yet available through their own
6060 /// setters.
6061 ///
6062 /// Please note that this method must not be used to set any of the known parameters
6063 /// which have their own setter method. If done anyway, the request will fail.
6064 ///
6065 /// # Additional Parameters
6066 ///
6067 /// * *$.xgafv* (query-string) - V1 error format.
6068 /// * *access_token* (query-string) - OAuth access token.
6069 /// * *alt* (query-string) - Data format for response.
6070 /// * *callback* (query-string) - JSONP
6071 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6072 /// * *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.
6073 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6074 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6075 /// * *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.
6076 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6077 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6078 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
6079 where
6080 T: AsRef<str>,
6081 {
6082 self._additional_params
6083 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6084 self
6085 }
6086
6087 /// Identifies the authorization scope for the method you are building.
6088 ///
6089 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6090 /// [`Scope::CloudPlatform`].
6091 ///
6092 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6093 /// tokens for more than one scope.
6094 ///
6095 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6096 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6097 /// sufficient, a read-write scope will do as well.
6098 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
6099 where
6100 St: AsRef<str>,
6101 {
6102 self._scopes.insert(String::from(scope.as_ref()));
6103 self
6104 }
6105 /// Identifies the authorization scope(s) for the method you are building.
6106 ///
6107 /// See [`Self::add_scope()`] for details.
6108 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
6109 where
6110 I: IntoIterator<Item = St>,
6111 St: AsRef<str>,
6112 {
6113 self._scopes
6114 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6115 self
6116 }
6117
6118 /// Removes all scopes, and no default scope will be used either.
6119 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6120 /// for details).
6121 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
6122 self._scopes.clear();
6123 self
6124 }
6125}
6126
6127/// Use this method to create a route for a private connectivity configuration in a project and location.
6128///
6129/// A builder for the *locations.privateConnections.routes.create* method supported by a *project* resource.
6130/// It is not used directly, but through a [`ProjectMethods`] instance.
6131///
6132/// # Example
6133///
6134/// Instantiate a resource method builder
6135///
6136/// ```test_harness,no_run
6137/// # extern crate hyper;
6138/// # extern crate hyper_rustls;
6139/// # extern crate google_datastream1 as datastream1;
6140/// use datastream1::api::Route;
6141/// # async fn dox() {
6142/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6143///
6144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6145/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6146/// # secret,
6147/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6148/// # ).build().await.unwrap();
6149///
6150/// # let client = hyper_util::client::legacy::Client::builder(
6151/// # hyper_util::rt::TokioExecutor::new()
6152/// # )
6153/// # .build(
6154/// # hyper_rustls::HttpsConnectorBuilder::new()
6155/// # .with_native_roots()
6156/// # .unwrap()
6157/// # .https_or_http()
6158/// # .enable_http1()
6159/// # .build()
6160/// # );
6161/// # let mut hub = Datastream::new(client, auth);
6162/// // As the method needs a request, you would usually fill it with the desired information
6163/// // into the respective structure. Some of the parts shown here might not be applicable !
6164/// // Values shown here are possibly random and not representative !
6165/// let mut req = Route::default();
6166///
6167/// // You can configure optional parameters by calling the respective setters at will, and
6168/// // execute the final call using `doit()`.
6169/// // Values shown here are possibly random and not representative !
6170/// let result = hub.projects().locations_private_connections_routes_create(req, "parent")
6171/// .route_id("voluptua.")
6172/// .request_id("amet.")
6173/// .doit().await;
6174/// # }
6175/// ```
6176pub struct ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
6177where
6178 C: 'a,
6179{
6180 hub: &'a Datastream<C>,
6181 _request: Route,
6182 _parent: String,
6183 _route_id: Option<String>,
6184 _request_id: Option<String>,
6185 _delegate: Option<&'a mut dyn common::Delegate>,
6186 _additional_params: HashMap<String, String>,
6187 _scopes: BTreeSet<String>,
6188}
6189
6190impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {}
6191
6192impl<'a, C> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
6193where
6194 C: common::Connector,
6195{
6196 /// Perform the operation you have build so far.
6197 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6198 use std::borrow::Cow;
6199 use std::io::{Read, Seek};
6200
6201 use common::{url::Params, ToParts};
6202 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6203
6204 let mut dd = common::DefaultDelegate;
6205 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6206 dlg.begin(common::MethodInfo {
6207 id: "datastream.projects.locations.privateConnections.routes.create",
6208 http_method: hyper::Method::POST,
6209 });
6210
6211 for &field in ["alt", "parent", "routeId", "requestId"].iter() {
6212 if self._additional_params.contains_key(field) {
6213 dlg.finished(false);
6214 return Err(common::Error::FieldClash(field));
6215 }
6216 }
6217
6218 let mut params = Params::with_capacity(6 + self._additional_params.len());
6219 params.push("parent", self._parent);
6220 if let Some(value) = self._route_id.as_ref() {
6221 params.push("routeId", value);
6222 }
6223 if let Some(value) = self._request_id.as_ref() {
6224 params.push("requestId", value);
6225 }
6226
6227 params.extend(self._additional_params.iter());
6228
6229 params.push("alt", "json");
6230 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
6231 if self._scopes.is_empty() {
6232 self._scopes
6233 .insert(Scope::CloudPlatform.as_ref().to_string());
6234 }
6235
6236 #[allow(clippy::single_element_loop)]
6237 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6238 url = params.uri_replacement(url, param_name, find_this, true);
6239 }
6240 {
6241 let to_remove = ["parent"];
6242 params.remove_params(&to_remove);
6243 }
6244
6245 let url = params.parse_with_url(&url);
6246
6247 let mut json_mime_type = mime::APPLICATION_JSON;
6248 let mut request_value_reader = {
6249 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6250 common::remove_json_null_values(&mut value);
6251 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6252 serde_json::to_writer(&mut dst, &value).unwrap();
6253 dst
6254 };
6255 let request_size = request_value_reader
6256 .seek(std::io::SeekFrom::End(0))
6257 .unwrap();
6258 request_value_reader
6259 .seek(std::io::SeekFrom::Start(0))
6260 .unwrap();
6261
6262 loop {
6263 let token = match self
6264 .hub
6265 .auth
6266 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6267 .await
6268 {
6269 Ok(token) => token,
6270 Err(e) => match dlg.token(e) {
6271 Ok(token) => token,
6272 Err(e) => {
6273 dlg.finished(false);
6274 return Err(common::Error::MissingToken(e));
6275 }
6276 },
6277 };
6278 request_value_reader
6279 .seek(std::io::SeekFrom::Start(0))
6280 .unwrap();
6281 let mut req_result = {
6282 let client = &self.hub.client;
6283 dlg.pre_request();
6284 let mut req_builder = hyper::Request::builder()
6285 .method(hyper::Method::POST)
6286 .uri(url.as_str())
6287 .header(USER_AGENT, self.hub._user_agent.clone());
6288
6289 if let Some(token) = token.as_ref() {
6290 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6291 }
6292
6293 let request = req_builder
6294 .header(CONTENT_TYPE, json_mime_type.to_string())
6295 .header(CONTENT_LENGTH, request_size as u64)
6296 .body(common::to_body(
6297 request_value_reader.get_ref().clone().into(),
6298 ));
6299
6300 client.request(request.unwrap()).await
6301 };
6302
6303 match req_result {
6304 Err(err) => {
6305 if let common::Retry::After(d) = dlg.http_error(&err) {
6306 sleep(d).await;
6307 continue;
6308 }
6309 dlg.finished(false);
6310 return Err(common::Error::HttpError(err));
6311 }
6312 Ok(res) => {
6313 let (mut parts, body) = res.into_parts();
6314 let mut body = common::Body::new(body);
6315 if !parts.status.is_success() {
6316 let bytes = common::to_bytes(body).await.unwrap_or_default();
6317 let error = serde_json::from_str(&common::to_string(&bytes));
6318 let response = common::to_response(parts, bytes.into());
6319
6320 if let common::Retry::After(d) =
6321 dlg.http_failure(&response, error.as_ref().ok())
6322 {
6323 sleep(d).await;
6324 continue;
6325 }
6326
6327 dlg.finished(false);
6328
6329 return Err(match error {
6330 Ok(value) => common::Error::BadRequest(value),
6331 _ => common::Error::Failure(response),
6332 });
6333 }
6334 let response = {
6335 let bytes = common::to_bytes(body).await.unwrap_or_default();
6336 let encoded = common::to_string(&bytes);
6337 match serde_json::from_str(&encoded) {
6338 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6339 Err(error) => {
6340 dlg.response_json_decode_error(&encoded, &error);
6341 return Err(common::Error::JsonDecodeError(
6342 encoded.to_string(),
6343 error,
6344 ));
6345 }
6346 }
6347 };
6348
6349 dlg.finished(true);
6350 return Ok(response);
6351 }
6352 }
6353 }
6354 }
6355
6356 ///
6357 /// Sets the *request* property to the given value.
6358 ///
6359 /// Even though the property as already been set when instantiating this call,
6360 /// we provide this method for API completeness.
6361 pub fn request(
6362 mut self,
6363 new_value: Route,
6364 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6365 self._request = new_value;
6366 self
6367 }
6368 /// Required. The parent that owns the collection of Routes.
6369 ///
6370 /// Sets the *parent* path property to the given value.
6371 ///
6372 /// Even though the property as already been set when instantiating this call,
6373 /// we provide this method for API completeness.
6374 pub fn parent(
6375 mut self,
6376 new_value: &str,
6377 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6378 self._parent = new_value.to_string();
6379 self
6380 }
6381 /// Required. The Route identifier.
6382 ///
6383 /// Sets the *route id* query property to the given value.
6384 pub fn route_id(
6385 mut self,
6386 new_value: &str,
6387 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6388 self._route_id = Some(new_value.to_string());
6389 self
6390 }
6391 /// 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).
6392 ///
6393 /// Sets the *request id* query property to the given value.
6394 pub fn request_id(
6395 mut self,
6396 new_value: &str,
6397 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6398 self._request_id = Some(new_value.to_string());
6399 self
6400 }
6401 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6402 /// while executing the actual API request.
6403 ///
6404 /// ````text
6405 /// It should be used to handle progress information, and to implement a certain level of resilience.
6406 /// ````
6407 ///
6408 /// Sets the *delegate* property to the given value.
6409 pub fn delegate(
6410 mut self,
6411 new_value: &'a mut dyn common::Delegate,
6412 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6413 self._delegate = Some(new_value);
6414 self
6415 }
6416
6417 /// Set any additional parameter of the query string used in the request.
6418 /// It should be used to set parameters which are not yet available through their own
6419 /// setters.
6420 ///
6421 /// Please note that this method must not be used to set any of the known parameters
6422 /// which have their own setter method. If done anyway, the request will fail.
6423 ///
6424 /// # Additional Parameters
6425 ///
6426 /// * *$.xgafv* (query-string) - V1 error format.
6427 /// * *access_token* (query-string) - OAuth access token.
6428 /// * *alt* (query-string) - Data format for response.
6429 /// * *callback* (query-string) - JSONP
6430 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6431 /// * *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.
6432 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6433 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6434 /// * *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.
6435 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6436 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6437 pub fn param<T>(
6438 mut self,
6439 name: T,
6440 value: T,
6441 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
6442 where
6443 T: AsRef<str>,
6444 {
6445 self._additional_params
6446 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6447 self
6448 }
6449
6450 /// Identifies the authorization scope for the method you are building.
6451 ///
6452 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6453 /// [`Scope::CloudPlatform`].
6454 ///
6455 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6456 /// tokens for more than one scope.
6457 ///
6458 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6459 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6460 /// sufficient, a read-write scope will do as well.
6461 pub fn add_scope<St>(
6462 mut self,
6463 scope: St,
6464 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
6465 where
6466 St: AsRef<str>,
6467 {
6468 self._scopes.insert(String::from(scope.as_ref()));
6469 self
6470 }
6471 /// Identifies the authorization scope(s) for the method you are building.
6472 ///
6473 /// See [`Self::add_scope()`] for details.
6474 pub fn add_scopes<I, St>(
6475 mut self,
6476 scopes: I,
6477 ) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C>
6478 where
6479 I: IntoIterator<Item = St>,
6480 St: AsRef<str>,
6481 {
6482 self._scopes
6483 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6484 self
6485 }
6486
6487 /// Removes all scopes, and no default scope will be used either.
6488 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6489 /// for details).
6490 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteCreateCall<'a, C> {
6491 self._scopes.clear();
6492 self
6493 }
6494}
6495
6496/// Use this method to delete a route.
6497///
6498/// A builder for the *locations.privateConnections.routes.delete* method supported by a *project* resource.
6499/// It is not used directly, but through a [`ProjectMethods`] instance.
6500///
6501/// # Example
6502///
6503/// Instantiate a resource method builder
6504///
6505/// ```test_harness,no_run
6506/// # extern crate hyper;
6507/// # extern crate hyper_rustls;
6508/// # extern crate google_datastream1 as datastream1;
6509/// # async fn dox() {
6510/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6511///
6512/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6513/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6514/// # secret,
6515/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6516/// # ).build().await.unwrap();
6517///
6518/// # let client = hyper_util::client::legacy::Client::builder(
6519/// # hyper_util::rt::TokioExecutor::new()
6520/// # )
6521/// # .build(
6522/// # hyper_rustls::HttpsConnectorBuilder::new()
6523/// # .with_native_roots()
6524/// # .unwrap()
6525/// # .https_or_http()
6526/// # .enable_http1()
6527/// # .build()
6528/// # );
6529/// # let mut hub = Datastream::new(client, auth);
6530/// // You can configure optional parameters by calling the respective setters at will, and
6531/// // execute the final call using `doit()`.
6532/// // Values shown here are possibly random and not representative !
6533/// let result = hub.projects().locations_private_connections_routes_delete("name")
6534/// .request_id("diam")
6535/// .doit().await;
6536/// # }
6537/// ```
6538pub struct ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
6539where
6540 C: 'a,
6541{
6542 hub: &'a Datastream<C>,
6543 _name: String,
6544 _request_id: Option<String>,
6545 _delegate: Option<&'a mut dyn common::Delegate>,
6546 _additional_params: HashMap<String, String>,
6547 _scopes: BTreeSet<String>,
6548}
6549
6550impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {}
6551
6552impl<'a, C> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
6553where
6554 C: common::Connector,
6555{
6556 /// Perform the operation you have build so far.
6557 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6558 use std::borrow::Cow;
6559 use std::io::{Read, Seek};
6560
6561 use common::{url::Params, ToParts};
6562 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6563
6564 let mut dd = common::DefaultDelegate;
6565 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6566 dlg.begin(common::MethodInfo {
6567 id: "datastream.projects.locations.privateConnections.routes.delete",
6568 http_method: hyper::Method::DELETE,
6569 });
6570
6571 for &field in ["alt", "name", "requestId"].iter() {
6572 if self._additional_params.contains_key(field) {
6573 dlg.finished(false);
6574 return Err(common::Error::FieldClash(field));
6575 }
6576 }
6577
6578 let mut params = Params::with_capacity(4 + self._additional_params.len());
6579 params.push("name", self._name);
6580 if let Some(value) = self._request_id.as_ref() {
6581 params.push("requestId", value);
6582 }
6583
6584 params.extend(self._additional_params.iter());
6585
6586 params.push("alt", "json");
6587 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6588 if self._scopes.is_empty() {
6589 self._scopes
6590 .insert(Scope::CloudPlatform.as_ref().to_string());
6591 }
6592
6593 #[allow(clippy::single_element_loop)]
6594 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6595 url = params.uri_replacement(url, param_name, find_this, true);
6596 }
6597 {
6598 let to_remove = ["name"];
6599 params.remove_params(&to_remove);
6600 }
6601
6602 let url = params.parse_with_url(&url);
6603
6604 loop {
6605 let token = match self
6606 .hub
6607 .auth
6608 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6609 .await
6610 {
6611 Ok(token) => token,
6612 Err(e) => match dlg.token(e) {
6613 Ok(token) => token,
6614 Err(e) => {
6615 dlg.finished(false);
6616 return Err(common::Error::MissingToken(e));
6617 }
6618 },
6619 };
6620 let mut req_result = {
6621 let client = &self.hub.client;
6622 dlg.pre_request();
6623 let mut req_builder = hyper::Request::builder()
6624 .method(hyper::Method::DELETE)
6625 .uri(url.as_str())
6626 .header(USER_AGENT, self.hub._user_agent.clone());
6627
6628 if let Some(token) = token.as_ref() {
6629 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6630 }
6631
6632 let request = req_builder
6633 .header(CONTENT_LENGTH, 0_u64)
6634 .body(common::to_body::<String>(None));
6635
6636 client.request(request.unwrap()).await
6637 };
6638
6639 match req_result {
6640 Err(err) => {
6641 if let common::Retry::After(d) = dlg.http_error(&err) {
6642 sleep(d).await;
6643 continue;
6644 }
6645 dlg.finished(false);
6646 return Err(common::Error::HttpError(err));
6647 }
6648 Ok(res) => {
6649 let (mut parts, body) = res.into_parts();
6650 let mut body = common::Body::new(body);
6651 if !parts.status.is_success() {
6652 let bytes = common::to_bytes(body).await.unwrap_or_default();
6653 let error = serde_json::from_str(&common::to_string(&bytes));
6654 let response = common::to_response(parts, bytes.into());
6655
6656 if let common::Retry::After(d) =
6657 dlg.http_failure(&response, error.as_ref().ok())
6658 {
6659 sleep(d).await;
6660 continue;
6661 }
6662
6663 dlg.finished(false);
6664
6665 return Err(match error {
6666 Ok(value) => common::Error::BadRequest(value),
6667 _ => common::Error::Failure(response),
6668 });
6669 }
6670 let response = {
6671 let bytes = common::to_bytes(body).await.unwrap_or_default();
6672 let encoded = common::to_string(&bytes);
6673 match serde_json::from_str(&encoded) {
6674 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6675 Err(error) => {
6676 dlg.response_json_decode_error(&encoded, &error);
6677 return Err(common::Error::JsonDecodeError(
6678 encoded.to_string(),
6679 error,
6680 ));
6681 }
6682 }
6683 };
6684
6685 dlg.finished(true);
6686 return Ok(response);
6687 }
6688 }
6689 }
6690 }
6691
6692 /// Required. The name of the Route resource to delete.
6693 ///
6694 /// Sets the *name* path property to the given value.
6695 ///
6696 /// Even though the property as already been set when instantiating this call,
6697 /// we provide this method for API completeness.
6698 pub fn name(
6699 mut self,
6700 new_value: &str,
6701 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
6702 self._name = new_value.to_string();
6703 self
6704 }
6705 /// 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).
6706 ///
6707 /// Sets the *request id* query property to the given value.
6708 pub fn request_id(
6709 mut self,
6710 new_value: &str,
6711 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
6712 self._request_id = Some(new_value.to_string());
6713 self
6714 }
6715 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6716 /// while executing the actual API request.
6717 ///
6718 /// ````text
6719 /// It should be used to handle progress information, and to implement a certain level of resilience.
6720 /// ````
6721 ///
6722 /// Sets the *delegate* property to the given value.
6723 pub fn delegate(
6724 mut self,
6725 new_value: &'a mut dyn common::Delegate,
6726 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
6727 self._delegate = Some(new_value);
6728 self
6729 }
6730
6731 /// Set any additional parameter of the query string used in the request.
6732 /// It should be used to set parameters which are not yet available through their own
6733 /// setters.
6734 ///
6735 /// Please note that this method must not be used to set any of the known parameters
6736 /// which have their own setter method. If done anyway, the request will fail.
6737 ///
6738 /// # Additional Parameters
6739 ///
6740 /// * *$.xgafv* (query-string) - V1 error format.
6741 /// * *access_token* (query-string) - OAuth access token.
6742 /// * *alt* (query-string) - Data format for response.
6743 /// * *callback* (query-string) - JSONP
6744 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6745 /// * *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.
6746 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6747 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6748 /// * *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.
6749 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6750 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6751 pub fn param<T>(
6752 mut self,
6753 name: T,
6754 value: T,
6755 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
6756 where
6757 T: AsRef<str>,
6758 {
6759 self._additional_params
6760 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6761 self
6762 }
6763
6764 /// Identifies the authorization scope for the method you are building.
6765 ///
6766 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6767 /// [`Scope::CloudPlatform`].
6768 ///
6769 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6770 /// tokens for more than one scope.
6771 ///
6772 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6773 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6774 /// sufficient, a read-write scope will do as well.
6775 pub fn add_scope<St>(
6776 mut self,
6777 scope: St,
6778 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
6779 where
6780 St: AsRef<str>,
6781 {
6782 self._scopes.insert(String::from(scope.as_ref()));
6783 self
6784 }
6785 /// Identifies the authorization scope(s) for the method you are building.
6786 ///
6787 /// See [`Self::add_scope()`] for details.
6788 pub fn add_scopes<I, St>(
6789 mut self,
6790 scopes: I,
6791 ) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C>
6792 where
6793 I: IntoIterator<Item = St>,
6794 St: AsRef<str>,
6795 {
6796 self._scopes
6797 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6798 self
6799 }
6800
6801 /// Removes all scopes, and no default scope will be used either.
6802 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6803 /// for details).
6804 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteDeleteCall<'a, C> {
6805 self._scopes.clear();
6806 self
6807 }
6808}
6809
6810/// Use this method to get details about a route.
6811///
6812/// A builder for the *locations.privateConnections.routes.get* method supported by a *project* resource.
6813/// It is not used directly, but through a [`ProjectMethods`] instance.
6814///
6815/// # Example
6816///
6817/// Instantiate a resource method builder
6818///
6819/// ```test_harness,no_run
6820/// # extern crate hyper;
6821/// # extern crate hyper_rustls;
6822/// # extern crate google_datastream1 as datastream1;
6823/// # async fn dox() {
6824/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6825///
6826/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6827/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6828/// # secret,
6829/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6830/// # ).build().await.unwrap();
6831///
6832/// # let client = hyper_util::client::legacy::Client::builder(
6833/// # hyper_util::rt::TokioExecutor::new()
6834/// # )
6835/// # .build(
6836/// # hyper_rustls::HttpsConnectorBuilder::new()
6837/// # .with_native_roots()
6838/// # .unwrap()
6839/// # .https_or_http()
6840/// # .enable_http1()
6841/// # .build()
6842/// # );
6843/// # let mut hub = Datastream::new(client, auth);
6844/// // You can configure optional parameters by calling the respective setters at will, and
6845/// // execute the final call using `doit()`.
6846/// // Values shown here are possibly random and not representative !
6847/// let result = hub.projects().locations_private_connections_routes_get("name")
6848/// .doit().await;
6849/// # }
6850/// ```
6851pub struct ProjectLocationPrivateConnectionRouteGetCall<'a, C>
6852where
6853 C: 'a,
6854{
6855 hub: &'a Datastream<C>,
6856 _name: String,
6857 _delegate: Option<&'a mut dyn common::Delegate>,
6858 _additional_params: HashMap<String, String>,
6859 _scopes: BTreeSet<String>,
6860}
6861
6862impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteGetCall<'a, C> {}
6863
6864impl<'a, C> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
6865where
6866 C: common::Connector,
6867{
6868 /// Perform the operation you have build so far.
6869 pub async fn doit(mut self) -> common::Result<(common::Response, Route)> {
6870 use std::borrow::Cow;
6871 use std::io::{Read, Seek};
6872
6873 use common::{url::Params, ToParts};
6874 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6875
6876 let mut dd = common::DefaultDelegate;
6877 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6878 dlg.begin(common::MethodInfo {
6879 id: "datastream.projects.locations.privateConnections.routes.get",
6880 http_method: hyper::Method::GET,
6881 });
6882
6883 for &field in ["alt", "name"].iter() {
6884 if self._additional_params.contains_key(field) {
6885 dlg.finished(false);
6886 return Err(common::Error::FieldClash(field));
6887 }
6888 }
6889
6890 let mut params = Params::with_capacity(3 + self._additional_params.len());
6891 params.push("name", self._name);
6892
6893 params.extend(self._additional_params.iter());
6894
6895 params.push("alt", "json");
6896 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6897 if self._scopes.is_empty() {
6898 self._scopes
6899 .insert(Scope::CloudPlatform.as_ref().to_string());
6900 }
6901
6902 #[allow(clippy::single_element_loop)]
6903 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6904 url = params.uri_replacement(url, param_name, find_this, true);
6905 }
6906 {
6907 let to_remove = ["name"];
6908 params.remove_params(&to_remove);
6909 }
6910
6911 let url = params.parse_with_url(&url);
6912
6913 loop {
6914 let token = match self
6915 .hub
6916 .auth
6917 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6918 .await
6919 {
6920 Ok(token) => token,
6921 Err(e) => match dlg.token(e) {
6922 Ok(token) => token,
6923 Err(e) => {
6924 dlg.finished(false);
6925 return Err(common::Error::MissingToken(e));
6926 }
6927 },
6928 };
6929 let mut req_result = {
6930 let client = &self.hub.client;
6931 dlg.pre_request();
6932 let mut req_builder = hyper::Request::builder()
6933 .method(hyper::Method::GET)
6934 .uri(url.as_str())
6935 .header(USER_AGENT, self.hub._user_agent.clone());
6936
6937 if let Some(token) = token.as_ref() {
6938 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6939 }
6940
6941 let request = req_builder
6942 .header(CONTENT_LENGTH, 0_u64)
6943 .body(common::to_body::<String>(None));
6944
6945 client.request(request.unwrap()).await
6946 };
6947
6948 match req_result {
6949 Err(err) => {
6950 if let common::Retry::After(d) = dlg.http_error(&err) {
6951 sleep(d).await;
6952 continue;
6953 }
6954 dlg.finished(false);
6955 return Err(common::Error::HttpError(err));
6956 }
6957 Ok(res) => {
6958 let (mut parts, body) = res.into_parts();
6959 let mut body = common::Body::new(body);
6960 if !parts.status.is_success() {
6961 let bytes = common::to_bytes(body).await.unwrap_or_default();
6962 let error = serde_json::from_str(&common::to_string(&bytes));
6963 let response = common::to_response(parts, bytes.into());
6964
6965 if let common::Retry::After(d) =
6966 dlg.http_failure(&response, error.as_ref().ok())
6967 {
6968 sleep(d).await;
6969 continue;
6970 }
6971
6972 dlg.finished(false);
6973
6974 return Err(match error {
6975 Ok(value) => common::Error::BadRequest(value),
6976 _ => common::Error::Failure(response),
6977 });
6978 }
6979 let response = {
6980 let bytes = common::to_bytes(body).await.unwrap_or_default();
6981 let encoded = common::to_string(&bytes);
6982 match serde_json::from_str(&encoded) {
6983 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6984 Err(error) => {
6985 dlg.response_json_decode_error(&encoded, &error);
6986 return Err(common::Error::JsonDecodeError(
6987 encoded.to_string(),
6988 error,
6989 ));
6990 }
6991 }
6992 };
6993
6994 dlg.finished(true);
6995 return Ok(response);
6996 }
6997 }
6998 }
6999 }
7000
7001 /// Required. The name of the Route resource to get.
7002 ///
7003 /// Sets the *name* path property to the given value.
7004 ///
7005 /// Even though the property as already been set when instantiating this call,
7006 /// we provide this method for API completeness.
7007 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
7008 self._name = new_value.to_string();
7009 self
7010 }
7011 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7012 /// while executing the actual API request.
7013 ///
7014 /// ````text
7015 /// It should be used to handle progress information, and to implement a certain level of resilience.
7016 /// ````
7017 ///
7018 /// Sets the *delegate* property to the given value.
7019 pub fn delegate(
7020 mut self,
7021 new_value: &'a mut dyn common::Delegate,
7022 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
7023 self._delegate = Some(new_value);
7024 self
7025 }
7026
7027 /// Set any additional parameter of the query string used in the request.
7028 /// It should be used to set parameters which are not yet available through their own
7029 /// setters.
7030 ///
7031 /// Please note that this method must not be used to set any of the known parameters
7032 /// which have their own setter method. If done anyway, the request will fail.
7033 ///
7034 /// # Additional Parameters
7035 ///
7036 /// * *$.xgafv* (query-string) - V1 error format.
7037 /// * *access_token* (query-string) - OAuth access token.
7038 /// * *alt* (query-string) - Data format for response.
7039 /// * *callback* (query-string) - JSONP
7040 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7041 /// * *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.
7042 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7043 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7044 /// * *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.
7045 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7046 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7047 pub fn param<T>(
7048 mut self,
7049 name: T,
7050 value: T,
7051 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
7052 where
7053 T: AsRef<str>,
7054 {
7055 self._additional_params
7056 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7057 self
7058 }
7059
7060 /// Identifies the authorization scope for the method you are building.
7061 ///
7062 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7063 /// [`Scope::CloudPlatform`].
7064 ///
7065 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7066 /// tokens for more than one scope.
7067 ///
7068 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7069 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7070 /// sufficient, a read-write scope will do as well.
7071 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
7072 where
7073 St: AsRef<str>,
7074 {
7075 self._scopes.insert(String::from(scope.as_ref()));
7076 self
7077 }
7078 /// Identifies the authorization scope(s) for the method you are building.
7079 ///
7080 /// See [`Self::add_scope()`] for details.
7081 pub fn add_scopes<I, St>(
7082 mut self,
7083 scopes: I,
7084 ) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C>
7085 where
7086 I: IntoIterator<Item = St>,
7087 St: AsRef<str>,
7088 {
7089 self._scopes
7090 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7091 self
7092 }
7093
7094 /// Removes all scopes, and no default scope will be used either.
7095 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7096 /// for details).
7097 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteGetCall<'a, C> {
7098 self._scopes.clear();
7099 self
7100 }
7101}
7102
7103/// Use this method to list routes created for a private connectivity configuration in a project and location.
7104///
7105/// A builder for the *locations.privateConnections.routes.list* method supported by a *project* resource.
7106/// It is not used directly, but through a [`ProjectMethods`] instance.
7107///
7108/// # Example
7109///
7110/// Instantiate a resource method builder
7111///
7112/// ```test_harness,no_run
7113/// # extern crate hyper;
7114/// # extern crate hyper_rustls;
7115/// # extern crate google_datastream1 as datastream1;
7116/// # async fn dox() {
7117/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7118///
7119/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7120/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7121/// # secret,
7122/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7123/// # ).build().await.unwrap();
7124///
7125/// # let client = hyper_util::client::legacy::Client::builder(
7126/// # hyper_util::rt::TokioExecutor::new()
7127/// # )
7128/// # .build(
7129/// # hyper_rustls::HttpsConnectorBuilder::new()
7130/// # .with_native_roots()
7131/// # .unwrap()
7132/// # .https_or_http()
7133/// # .enable_http1()
7134/// # .build()
7135/// # );
7136/// # let mut hub = Datastream::new(client, auth);
7137/// // You can configure optional parameters by calling the respective setters at will, and
7138/// // execute the final call using `doit()`.
7139/// // Values shown here are possibly random and not representative !
7140/// let result = hub.projects().locations_private_connections_routes_list("parent")
7141/// .page_token("et")
7142/// .page_size(-95)
7143/// .order_by("Stet")
7144/// .filter("dolor")
7145/// .doit().await;
7146/// # }
7147/// ```
7148pub struct ProjectLocationPrivateConnectionRouteListCall<'a, C>
7149where
7150 C: 'a,
7151{
7152 hub: &'a Datastream<C>,
7153 _parent: String,
7154 _page_token: Option<String>,
7155 _page_size: Option<i32>,
7156 _order_by: Option<String>,
7157 _filter: Option<String>,
7158 _delegate: Option<&'a mut dyn common::Delegate>,
7159 _additional_params: HashMap<String, String>,
7160 _scopes: BTreeSet<String>,
7161}
7162
7163impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionRouteListCall<'a, C> {}
7164
7165impl<'a, C> ProjectLocationPrivateConnectionRouteListCall<'a, C>
7166where
7167 C: common::Connector,
7168{
7169 /// Perform the operation you have build so far.
7170 pub async fn doit(mut self) -> common::Result<(common::Response, ListRoutesResponse)> {
7171 use std::borrow::Cow;
7172 use std::io::{Read, Seek};
7173
7174 use common::{url::Params, ToParts};
7175 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7176
7177 let mut dd = common::DefaultDelegate;
7178 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7179 dlg.begin(common::MethodInfo {
7180 id: "datastream.projects.locations.privateConnections.routes.list",
7181 http_method: hyper::Method::GET,
7182 });
7183
7184 for &field in [
7185 "alt",
7186 "parent",
7187 "pageToken",
7188 "pageSize",
7189 "orderBy",
7190 "filter",
7191 ]
7192 .iter()
7193 {
7194 if self._additional_params.contains_key(field) {
7195 dlg.finished(false);
7196 return Err(common::Error::FieldClash(field));
7197 }
7198 }
7199
7200 let mut params = Params::with_capacity(7 + self._additional_params.len());
7201 params.push("parent", self._parent);
7202 if let Some(value) = self._page_token.as_ref() {
7203 params.push("pageToken", value);
7204 }
7205 if let Some(value) = self._page_size.as_ref() {
7206 params.push("pageSize", value.to_string());
7207 }
7208 if let Some(value) = self._order_by.as_ref() {
7209 params.push("orderBy", value);
7210 }
7211 if let Some(value) = self._filter.as_ref() {
7212 params.push("filter", value);
7213 }
7214
7215 params.extend(self._additional_params.iter());
7216
7217 params.push("alt", "json");
7218 let mut url = self.hub._base_url.clone() + "v1/{+parent}/routes";
7219 if self._scopes.is_empty() {
7220 self._scopes
7221 .insert(Scope::CloudPlatform.as_ref().to_string());
7222 }
7223
7224 #[allow(clippy::single_element_loop)]
7225 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7226 url = params.uri_replacement(url, param_name, find_this, true);
7227 }
7228 {
7229 let to_remove = ["parent"];
7230 params.remove_params(&to_remove);
7231 }
7232
7233 let url = params.parse_with_url(&url);
7234
7235 loop {
7236 let token = match self
7237 .hub
7238 .auth
7239 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7240 .await
7241 {
7242 Ok(token) => token,
7243 Err(e) => match dlg.token(e) {
7244 Ok(token) => token,
7245 Err(e) => {
7246 dlg.finished(false);
7247 return Err(common::Error::MissingToken(e));
7248 }
7249 },
7250 };
7251 let mut req_result = {
7252 let client = &self.hub.client;
7253 dlg.pre_request();
7254 let mut req_builder = hyper::Request::builder()
7255 .method(hyper::Method::GET)
7256 .uri(url.as_str())
7257 .header(USER_AGENT, self.hub._user_agent.clone());
7258
7259 if let Some(token) = token.as_ref() {
7260 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7261 }
7262
7263 let request = req_builder
7264 .header(CONTENT_LENGTH, 0_u64)
7265 .body(common::to_body::<String>(None));
7266
7267 client.request(request.unwrap()).await
7268 };
7269
7270 match req_result {
7271 Err(err) => {
7272 if let common::Retry::After(d) = dlg.http_error(&err) {
7273 sleep(d).await;
7274 continue;
7275 }
7276 dlg.finished(false);
7277 return Err(common::Error::HttpError(err));
7278 }
7279 Ok(res) => {
7280 let (mut parts, body) = res.into_parts();
7281 let mut body = common::Body::new(body);
7282 if !parts.status.is_success() {
7283 let bytes = common::to_bytes(body).await.unwrap_or_default();
7284 let error = serde_json::from_str(&common::to_string(&bytes));
7285 let response = common::to_response(parts, bytes.into());
7286
7287 if let common::Retry::After(d) =
7288 dlg.http_failure(&response, error.as_ref().ok())
7289 {
7290 sleep(d).await;
7291 continue;
7292 }
7293
7294 dlg.finished(false);
7295
7296 return Err(match error {
7297 Ok(value) => common::Error::BadRequest(value),
7298 _ => common::Error::Failure(response),
7299 });
7300 }
7301 let response = {
7302 let bytes = common::to_bytes(body).await.unwrap_or_default();
7303 let encoded = common::to_string(&bytes);
7304 match serde_json::from_str(&encoded) {
7305 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7306 Err(error) => {
7307 dlg.response_json_decode_error(&encoded, &error);
7308 return Err(common::Error::JsonDecodeError(
7309 encoded.to_string(),
7310 error,
7311 ));
7312 }
7313 }
7314 };
7315
7316 dlg.finished(true);
7317 return Ok(response);
7318 }
7319 }
7320 }
7321 }
7322
7323 /// Required. The parent that owns the collection of Routess.
7324 ///
7325 /// Sets the *parent* path property to the given value.
7326 ///
7327 /// Even though the property as already been set when instantiating this call,
7328 /// we provide this method for API completeness.
7329 pub fn parent(
7330 mut self,
7331 new_value: &str,
7332 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7333 self._parent = new_value.to_string();
7334 self
7335 }
7336 /// 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.
7337 ///
7338 /// Sets the *page token* query property to the given value.
7339 pub fn page_token(
7340 mut self,
7341 new_value: &str,
7342 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7343 self._page_token = Some(new_value.to_string());
7344 self
7345 }
7346 /// 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.
7347 ///
7348 /// Sets the *page size* query property to the given value.
7349 pub fn page_size(
7350 mut self,
7351 new_value: i32,
7352 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7353 self._page_size = Some(new_value);
7354 self
7355 }
7356 /// Order by fields for the result.
7357 ///
7358 /// Sets the *order by* query property to the given value.
7359 pub fn order_by(
7360 mut self,
7361 new_value: &str,
7362 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7363 self._order_by = Some(new_value.to_string());
7364 self
7365 }
7366 /// Filter request.
7367 ///
7368 /// Sets the *filter* query property to the given value.
7369 pub fn filter(
7370 mut self,
7371 new_value: &str,
7372 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7373 self._filter = Some(new_value.to_string());
7374 self
7375 }
7376 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7377 /// while executing the actual API request.
7378 ///
7379 /// ````text
7380 /// It should be used to handle progress information, and to implement a certain level of resilience.
7381 /// ````
7382 ///
7383 /// Sets the *delegate* property to the given value.
7384 pub fn delegate(
7385 mut self,
7386 new_value: &'a mut dyn common::Delegate,
7387 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7388 self._delegate = Some(new_value);
7389 self
7390 }
7391
7392 /// Set any additional parameter of the query string used in the request.
7393 /// It should be used to set parameters which are not yet available through their own
7394 /// setters.
7395 ///
7396 /// Please note that this method must not be used to set any of the known parameters
7397 /// which have their own setter method. If done anyway, the request will fail.
7398 ///
7399 /// # Additional Parameters
7400 ///
7401 /// * *$.xgafv* (query-string) - V1 error format.
7402 /// * *access_token* (query-string) - OAuth access token.
7403 /// * *alt* (query-string) - Data format for response.
7404 /// * *callback* (query-string) - JSONP
7405 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7406 /// * *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.
7407 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7408 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7409 /// * *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.
7410 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7411 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7412 pub fn param<T>(
7413 mut self,
7414 name: T,
7415 value: T,
7416 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
7417 where
7418 T: AsRef<str>,
7419 {
7420 self._additional_params
7421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7422 self
7423 }
7424
7425 /// Identifies the authorization scope for the method you are building.
7426 ///
7427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7428 /// [`Scope::CloudPlatform`].
7429 ///
7430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7431 /// tokens for more than one scope.
7432 ///
7433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7435 /// sufficient, a read-write scope will do as well.
7436 pub fn add_scope<St>(
7437 mut self,
7438 scope: St,
7439 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
7440 where
7441 St: AsRef<str>,
7442 {
7443 self._scopes.insert(String::from(scope.as_ref()));
7444 self
7445 }
7446 /// Identifies the authorization scope(s) for the method you are building.
7447 ///
7448 /// See [`Self::add_scope()`] for details.
7449 pub fn add_scopes<I, St>(
7450 mut self,
7451 scopes: I,
7452 ) -> ProjectLocationPrivateConnectionRouteListCall<'a, C>
7453 where
7454 I: IntoIterator<Item = St>,
7455 St: AsRef<str>,
7456 {
7457 self._scopes
7458 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7459 self
7460 }
7461
7462 /// Removes all scopes, and no default scope will be used either.
7463 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7464 /// for details).
7465 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionRouteListCall<'a, C> {
7466 self._scopes.clear();
7467 self
7468 }
7469}
7470
7471/// Use this method to create a private connectivity configuration.
7472///
7473/// A builder for the *locations.privateConnections.create* method supported by a *project* resource.
7474/// It is not used directly, but through a [`ProjectMethods`] instance.
7475///
7476/// # Example
7477///
7478/// Instantiate a resource method builder
7479///
7480/// ```test_harness,no_run
7481/// # extern crate hyper;
7482/// # extern crate hyper_rustls;
7483/// # extern crate google_datastream1 as datastream1;
7484/// use datastream1::api::PrivateConnection;
7485/// # async fn dox() {
7486/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7487///
7488/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7489/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7490/// # secret,
7491/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7492/// # ).build().await.unwrap();
7493///
7494/// # let client = hyper_util::client::legacy::Client::builder(
7495/// # hyper_util::rt::TokioExecutor::new()
7496/// # )
7497/// # .build(
7498/// # hyper_rustls::HttpsConnectorBuilder::new()
7499/// # .with_native_roots()
7500/// # .unwrap()
7501/// # .https_or_http()
7502/// # .enable_http1()
7503/// # .build()
7504/// # );
7505/// # let mut hub = Datastream::new(client, auth);
7506/// // As the method needs a request, you would usually fill it with the desired information
7507/// // into the respective structure. Some of the parts shown here might not be applicable !
7508/// // Values shown here are possibly random and not representative !
7509/// let mut req = PrivateConnection::default();
7510///
7511/// // You can configure optional parameters by calling the respective setters at will, and
7512/// // execute the final call using `doit()`.
7513/// // Values shown here are possibly random and not representative !
7514/// let result = hub.projects().locations_private_connections_create(req, "parent")
7515/// .request_id("vero")
7516/// .private_connection_id("vero")
7517/// .force(false)
7518/// .doit().await;
7519/// # }
7520/// ```
7521pub struct ProjectLocationPrivateConnectionCreateCall<'a, C>
7522where
7523 C: 'a,
7524{
7525 hub: &'a Datastream<C>,
7526 _request: PrivateConnection,
7527 _parent: String,
7528 _request_id: Option<String>,
7529 _private_connection_id: Option<String>,
7530 _force: Option<bool>,
7531 _delegate: Option<&'a mut dyn common::Delegate>,
7532 _additional_params: HashMap<String, String>,
7533 _scopes: BTreeSet<String>,
7534}
7535
7536impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionCreateCall<'a, C> {}
7537
7538impl<'a, C> ProjectLocationPrivateConnectionCreateCall<'a, C>
7539where
7540 C: common::Connector,
7541{
7542 /// Perform the operation you have build so far.
7543 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7544 use std::borrow::Cow;
7545 use std::io::{Read, Seek};
7546
7547 use common::{url::Params, ToParts};
7548 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7549
7550 let mut dd = common::DefaultDelegate;
7551 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7552 dlg.begin(common::MethodInfo {
7553 id: "datastream.projects.locations.privateConnections.create",
7554 http_method: hyper::Method::POST,
7555 });
7556
7557 for &field in ["alt", "parent", "requestId", "privateConnectionId", "force"].iter() {
7558 if self._additional_params.contains_key(field) {
7559 dlg.finished(false);
7560 return Err(common::Error::FieldClash(field));
7561 }
7562 }
7563
7564 let mut params = Params::with_capacity(7 + self._additional_params.len());
7565 params.push("parent", self._parent);
7566 if let Some(value) = self._request_id.as_ref() {
7567 params.push("requestId", value);
7568 }
7569 if let Some(value) = self._private_connection_id.as_ref() {
7570 params.push("privateConnectionId", value);
7571 }
7572 if let Some(value) = self._force.as_ref() {
7573 params.push("force", value.to_string());
7574 }
7575
7576 params.extend(self._additional_params.iter());
7577
7578 params.push("alt", "json");
7579 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
7580 if self._scopes.is_empty() {
7581 self._scopes
7582 .insert(Scope::CloudPlatform.as_ref().to_string());
7583 }
7584
7585 #[allow(clippy::single_element_loop)]
7586 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7587 url = params.uri_replacement(url, param_name, find_this, true);
7588 }
7589 {
7590 let to_remove = ["parent"];
7591 params.remove_params(&to_remove);
7592 }
7593
7594 let url = params.parse_with_url(&url);
7595
7596 let mut json_mime_type = mime::APPLICATION_JSON;
7597 let mut request_value_reader = {
7598 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7599 common::remove_json_null_values(&mut value);
7600 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7601 serde_json::to_writer(&mut dst, &value).unwrap();
7602 dst
7603 };
7604 let request_size = request_value_reader
7605 .seek(std::io::SeekFrom::End(0))
7606 .unwrap();
7607 request_value_reader
7608 .seek(std::io::SeekFrom::Start(0))
7609 .unwrap();
7610
7611 loop {
7612 let token = match self
7613 .hub
7614 .auth
7615 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7616 .await
7617 {
7618 Ok(token) => token,
7619 Err(e) => match dlg.token(e) {
7620 Ok(token) => token,
7621 Err(e) => {
7622 dlg.finished(false);
7623 return Err(common::Error::MissingToken(e));
7624 }
7625 },
7626 };
7627 request_value_reader
7628 .seek(std::io::SeekFrom::Start(0))
7629 .unwrap();
7630 let mut req_result = {
7631 let client = &self.hub.client;
7632 dlg.pre_request();
7633 let mut req_builder = hyper::Request::builder()
7634 .method(hyper::Method::POST)
7635 .uri(url.as_str())
7636 .header(USER_AGENT, self.hub._user_agent.clone());
7637
7638 if let Some(token) = token.as_ref() {
7639 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7640 }
7641
7642 let request = req_builder
7643 .header(CONTENT_TYPE, json_mime_type.to_string())
7644 .header(CONTENT_LENGTH, request_size as u64)
7645 .body(common::to_body(
7646 request_value_reader.get_ref().clone().into(),
7647 ));
7648
7649 client.request(request.unwrap()).await
7650 };
7651
7652 match req_result {
7653 Err(err) => {
7654 if let common::Retry::After(d) = dlg.http_error(&err) {
7655 sleep(d).await;
7656 continue;
7657 }
7658 dlg.finished(false);
7659 return Err(common::Error::HttpError(err));
7660 }
7661 Ok(res) => {
7662 let (mut parts, body) = res.into_parts();
7663 let mut body = common::Body::new(body);
7664 if !parts.status.is_success() {
7665 let bytes = common::to_bytes(body).await.unwrap_or_default();
7666 let error = serde_json::from_str(&common::to_string(&bytes));
7667 let response = common::to_response(parts, bytes.into());
7668
7669 if let common::Retry::After(d) =
7670 dlg.http_failure(&response, error.as_ref().ok())
7671 {
7672 sleep(d).await;
7673 continue;
7674 }
7675
7676 dlg.finished(false);
7677
7678 return Err(match error {
7679 Ok(value) => common::Error::BadRequest(value),
7680 _ => common::Error::Failure(response),
7681 });
7682 }
7683 let response = {
7684 let bytes = common::to_bytes(body).await.unwrap_or_default();
7685 let encoded = common::to_string(&bytes);
7686 match serde_json::from_str(&encoded) {
7687 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7688 Err(error) => {
7689 dlg.response_json_decode_error(&encoded, &error);
7690 return Err(common::Error::JsonDecodeError(
7691 encoded.to_string(),
7692 error,
7693 ));
7694 }
7695 }
7696 };
7697
7698 dlg.finished(true);
7699 return Ok(response);
7700 }
7701 }
7702 }
7703 }
7704
7705 ///
7706 /// Sets the *request* property to the given value.
7707 ///
7708 /// Even though the property as already been set when instantiating this call,
7709 /// we provide this method for API completeness.
7710 pub fn request(
7711 mut self,
7712 new_value: PrivateConnection,
7713 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7714 self._request = new_value;
7715 self
7716 }
7717 /// Required. The parent that owns the collection of PrivateConnections.
7718 ///
7719 /// Sets the *parent* path property to the given value.
7720 ///
7721 /// Even though the property as already been set when instantiating this call,
7722 /// we provide this method for API completeness.
7723 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7724 self._parent = new_value.to_string();
7725 self
7726 }
7727 /// 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).
7728 ///
7729 /// Sets the *request id* query property to the given value.
7730 pub fn request_id(
7731 mut self,
7732 new_value: &str,
7733 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7734 self._request_id = Some(new_value.to_string());
7735 self
7736 }
7737 /// Required. The private connectivity identifier.
7738 ///
7739 /// Sets the *private connection id* query property to the given value.
7740 pub fn private_connection_id(
7741 mut self,
7742 new_value: &str,
7743 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7744 self._private_connection_id = Some(new_value.to_string());
7745 self
7746 }
7747 /// Optional. If set to true, will skip validations.
7748 ///
7749 /// Sets the *force* query property to the given value.
7750 pub fn force(mut self, new_value: bool) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7751 self._force = Some(new_value);
7752 self
7753 }
7754 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7755 /// while executing the actual API request.
7756 ///
7757 /// ````text
7758 /// It should be used to handle progress information, and to implement a certain level of resilience.
7759 /// ````
7760 ///
7761 /// Sets the *delegate* property to the given value.
7762 pub fn delegate(
7763 mut self,
7764 new_value: &'a mut dyn common::Delegate,
7765 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7766 self._delegate = Some(new_value);
7767 self
7768 }
7769
7770 /// Set any additional parameter of the query string used in the request.
7771 /// It should be used to set parameters which are not yet available through their own
7772 /// setters.
7773 ///
7774 /// Please note that this method must not be used to set any of the known parameters
7775 /// which have their own setter method. If done anyway, the request will fail.
7776 ///
7777 /// # Additional Parameters
7778 ///
7779 /// * *$.xgafv* (query-string) - V1 error format.
7780 /// * *access_token* (query-string) - OAuth access token.
7781 /// * *alt* (query-string) - Data format for response.
7782 /// * *callback* (query-string) - JSONP
7783 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7784 /// * *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.
7785 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7786 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7787 /// * *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.
7788 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7789 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7790 pub fn param<T>(
7791 mut self,
7792 name: T,
7793 value: T,
7794 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
7795 where
7796 T: AsRef<str>,
7797 {
7798 self._additional_params
7799 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7800 self
7801 }
7802
7803 /// Identifies the authorization scope for the method you are building.
7804 ///
7805 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7806 /// [`Scope::CloudPlatform`].
7807 ///
7808 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7809 /// tokens for more than one scope.
7810 ///
7811 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7812 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7813 /// sufficient, a read-write scope will do as well.
7814 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
7815 where
7816 St: AsRef<str>,
7817 {
7818 self._scopes.insert(String::from(scope.as_ref()));
7819 self
7820 }
7821 /// Identifies the authorization scope(s) for the method you are building.
7822 ///
7823 /// See [`Self::add_scope()`] for details.
7824 pub fn add_scopes<I, St>(
7825 mut self,
7826 scopes: I,
7827 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
7828 where
7829 I: IntoIterator<Item = St>,
7830 St: AsRef<str>,
7831 {
7832 self._scopes
7833 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7834 self
7835 }
7836
7837 /// Removes all scopes, and no default scope will be used either.
7838 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7839 /// for details).
7840 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
7841 self._scopes.clear();
7842 self
7843 }
7844}
7845
7846/// Use this method to delete a private connectivity configuration.
7847///
7848/// A builder for the *locations.privateConnections.delete* method supported by a *project* resource.
7849/// It is not used directly, but through a [`ProjectMethods`] instance.
7850///
7851/// # Example
7852///
7853/// Instantiate a resource method builder
7854///
7855/// ```test_harness,no_run
7856/// # extern crate hyper;
7857/// # extern crate hyper_rustls;
7858/// # extern crate google_datastream1 as datastream1;
7859/// # async fn dox() {
7860/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7861///
7862/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7863/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7864/// # secret,
7865/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7866/// # ).build().await.unwrap();
7867///
7868/// # let client = hyper_util::client::legacy::Client::builder(
7869/// # hyper_util::rt::TokioExecutor::new()
7870/// # )
7871/// # .build(
7872/// # hyper_rustls::HttpsConnectorBuilder::new()
7873/// # .with_native_roots()
7874/// # .unwrap()
7875/// # .https_or_http()
7876/// # .enable_http1()
7877/// # .build()
7878/// # );
7879/// # let mut hub = Datastream::new(client, auth);
7880/// // You can configure optional parameters by calling the respective setters at will, and
7881/// // execute the final call using `doit()`.
7882/// // Values shown here are possibly random and not representative !
7883/// let result = hub.projects().locations_private_connections_delete("name")
7884/// .request_id("vero")
7885/// .force(true)
7886/// .doit().await;
7887/// # }
7888/// ```
7889pub struct ProjectLocationPrivateConnectionDeleteCall<'a, C>
7890where
7891 C: 'a,
7892{
7893 hub: &'a Datastream<C>,
7894 _name: String,
7895 _request_id: Option<String>,
7896 _force: Option<bool>,
7897 _delegate: Option<&'a mut dyn common::Delegate>,
7898 _additional_params: HashMap<String, String>,
7899 _scopes: BTreeSet<String>,
7900}
7901
7902impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionDeleteCall<'a, C> {}
7903
7904impl<'a, C> ProjectLocationPrivateConnectionDeleteCall<'a, C>
7905where
7906 C: common::Connector,
7907{
7908 /// Perform the operation you have build so far.
7909 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7910 use std::borrow::Cow;
7911 use std::io::{Read, Seek};
7912
7913 use common::{url::Params, ToParts};
7914 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7915
7916 let mut dd = common::DefaultDelegate;
7917 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7918 dlg.begin(common::MethodInfo {
7919 id: "datastream.projects.locations.privateConnections.delete",
7920 http_method: hyper::Method::DELETE,
7921 });
7922
7923 for &field in ["alt", "name", "requestId", "force"].iter() {
7924 if self._additional_params.contains_key(field) {
7925 dlg.finished(false);
7926 return Err(common::Error::FieldClash(field));
7927 }
7928 }
7929
7930 let mut params = Params::with_capacity(5 + self._additional_params.len());
7931 params.push("name", self._name);
7932 if let Some(value) = self._request_id.as_ref() {
7933 params.push("requestId", value);
7934 }
7935 if let Some(value) = self._force.as_ref() {
7936 params.push("force", value.to_string());
7937 }
7938
7939 params.extend(self._additional_params.iter());
7940
7941 params.push("alt", "json");
7942 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7943 if self._scopes.is_empty() {
7944 self._scopes
7945 .insert(Scope::CloudPlatform.as_ref().to_string());
7946 }
7947
7948 #[allow(clippy::single_element_loop)]
7949 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7950 url = params.uri_replacement(url, param_name, find_this, true);
7951 }
7952 {
7953 let to_remove = ["name"];
7954 params.remove_params(&to_remove);
7955 }
7956
7957 let url = params.parse_with_url(&url);
7958
7959 loop {
7960 let token = match self
7961 .hub
7962 .auth
7963 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7964 .await
7965 {
7966 Ok(token) => token,
7967 Err(e) => match dlg.token(e) {
7968 Ok(token) => token,
7969 Err(e) => {
7970 dlg.finished(false);
7971 return Err(common::Error::MissingToken(e));
7972 }
7973 },
7974 };
7975 let mut req_result = {
7976 let client = &self.hub.client;
7977 dlg.pre_request();
7978 let mut req_builder = hyper::Request::builder()
7979 .method(hyper::Method::DELETE)
7980 .uri(url.as_str())
7981 .header(USER_AGENT, self.hub._user_agent.clone());
7982
7983 if let Some(token) = token.as_ref() {
7984 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7985 }
7986
7987 let request = req_builder
7988 .header(CONTENT_LENGTH, 0_u64)
7989 .body(common::to_body::<String>(None));
7990
7991 client.request(request.unwrap()).await
7992 };
7993
7994 match req_result {
7995 Err(err) => {
7996 if let common::Retry::After(d) = dlg.http_error(&err) {
7997 sleep(d).await;
7998 continue;
7999 }
8000 dlg.finished(false);
8001 return Err(common::Error::HttpError(err));
8002 }
8003 Ok(res) => {
8004 let (mut parts, body) = res.into_parts();
8005 let mut body = common::Body::new(body);
8006 if !parts.status.is_success() {
8007 let bytes = common::to_bytes(body).await.unwrap_or_default();
8008 let error = serde_json::from_str(&common::to_string(&bytes));
8009 let response = common::to_response(parts, bytes.into());
8010
8011 if let common::Retry::After(d) =
8012 dlg.http_failure(&response, error.as_ref().ok())
8013 {
8014 sleep(d).await;
8015 continue;
8016 }
8017
8018 dlg.finished(false);
8019
8020 return Err(match error {
8021 Ok(value) => common::Error::BadRequest(value),
8022 _ => common::Error::Failure(response),
8023 });
8024 }
8025 let response = {
8026 let bytes = common::to_bytes(body).await.unwrap_or_default();
8027 let encoded = common::to_string(&bytes);
8028 match serde_json::from_str(&encoded) {
8029 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8030 Err(error) => {
8031 dlg.response_json_decode_error(&encoded, &error);
8032 return Err(common::Error::JsonDecodeError(
8033 encoded.to_string(),
8034 error,
8035 ));
8036 }
8037 }
8038 };
8039
8040 dlg.finished(true);
8041 return Ok(response);
8042 }
8043 }
8044 }
8045 }
8046
8047 /// Required. The name of the private connectivity configuration to delete.
8048 ///
8049 /// Sets the *name* path property to the given value.
8050 ///
8051 /// Even though the property as already been set when instantiating this call,
8052 /// we provide this method for API completeness.
8053 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
8054 self._name = new_value.to_string();
8055 self
8056 }
8057 /// 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).
8058 ///
8059 /// Sets the *request id* query property to the given value.
8060 pub fn request_id(
8061 mut self,
8062 new_value: &str,
8063 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
8064 self._request_id = Some(new_value.to_string());
8065 self
8066 }
8067 /// Optional. If set to true, any child routes that belong to this PrivateConnection will also be deleted.
8068 ///
8069 /// Sets the *force* query property to the given value.
8070 pub fn force(mut self, new_value: bool) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
8071 self._force = Some(new_value);
8072 self
8073 }
8074 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8075 /// while executing the actual API request.
8076 ///
8077 /// ````text
8078 /// It should be used to handle progress information, and to implement a certain level of resilience.
8079 /// ````
8080 ///
8081 /// Sets the *delegate* property to the given value.
8082 pub fn delegate(
8083 mut self,
8084 new_value: &'a mut dyn common::Delegate,
8085 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
8086 self._delegate = Some(new_value);
8087 self
8088 }
8089
8090 /// Set any additional parameter of the query string used in the request.
8091 /// It should be used to set parameters which are not yet available through their own
8092 /// setters.
8093 ///
8094 /// Please note that this method must not be used to set any of the known parameters
8095 /// which have their own setter method. If done anyway, the request will fail.
8096 ///
8097 /// # Additional Parameters
8098 ///
8099 /// * *$.xgafv* (query-string) - V1 error format.
8100 /// * *access_token* (query-string) - OAuth access token.
8101 /// * *alt* (query-string) - Data format for response.
8102 /// * *callback* (query-string) - JSONP
8103 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8104 /// * *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.
8105 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8106 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8107 /// * *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.
8108 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8109 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8110 pub fn param<T>(
8111 mut self,
8112 name: T,
8113 value: T,
8114 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
8115 where
8116 T: AsRef<str>,
8117 {
8118 self._additional_params
8119 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8120 self
8121 }
8122
8123 /// Identifies the authorization scope for the method you are building.
8124 ///
8125 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8126 /// [`Scope::CloudPlatform`].
8127 ///
8128 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8129 /// tokens for more than one scope.
8130 ///
8131 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8132 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8133 /// sufficient, a read-write scope will do as well.
8134 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
8135 where
8136 St: AsRef<str>,
8137 {
8138 self._scopes.insert(String::from(scope.as_ref()));
8139 self
8140 }
8141 /// Identifies the authorization scope(s) for the method you are building.
8142 ///
8143 /// See [`Self::add_scope()`] for details.
8144 pub fn add_scopes<I, St>(
8145 mut self,
8146 scopes: I,
8147 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
8148 where
8149 I: IntoIterator<Item = St>,
8150 St: AsRef<str>,
8151 {
8152 self._scopes
8153 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8154 self
8155 }
8156
8157 /// Removes all scopes, and no default scope will be used either.
8158 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8159 /// for details).
8160 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
8161 self._scopes.clear();
8162 self
8163 }
8164}
8165
8166/// Use this method to get details about a private connectivity configuration.
8167///
8168/// A builder for the *locations.privateConnections.get* method supported by a *project* resource.
8169/// It is not used directly, but through a [`ProjectMethods`] instance.
8170///
8171/// # Example
8172///
8173/// Instantiate a resource method builder
8174///
8175/// ```test_harness,no_run
8176/// # extern crate hyper;
8177/// # extern crate hyper_rustls;
8178/// # extern crate google_datastream1 as datastream1;
8179/// # async fn dox() {
8180/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8181///
8182/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8184/// # secret,
8185/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8186/// # ).build().await.unwrap();
8187///
8188/// # let client = hyper_util::client::legacy::Client::builder(
8189/// # hyper_util::rt::TokioExecutor::new()
8190/// # )
8191/// # .build(
8192/// # hyper_rustls::HttpsConnectorBuilder::new()
8193/// # .with_native_roots()
8194/// # .unwrap()
8195/// # .https_or_http()
8196/// # .enable_http1()
8197/// # .build()
8198/// # );
8199/// # let mut hub = Datastream::new(client, auth);
8200/// // You can configure optional parameters by calling the respective setters at will, and
8201/// // execute the final call using `doit()`.
8202/// // Values shown here are possibly random and not representative !
8203/// let result = hub.projects().locations_private_connections_get("name")
8204/// .doit().await;
8205/// # }
8206/// ```
8207pub struct ProjectLocationPrivateConnectionGetCall<'a, C>
8208where
8209 C: 'a,
8210{
8211 hub: &'a Datastream<C>,
8212 _name: String,
8213 _delegate: Option<&'a mut dyn common::Delegate>,
8214 _additional_params: HashMap<String, String>,
8215 _scopes: BTreeSet<String>,
8216}
8217
8218impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetCall<'a, C> {}
8219
8220impl<'a, C> ProjectLocationPrivateConnectionGetCall<'a, C>
8221where
8222 C: common::Connector,
8223{
8224 /// Perform the operation you have build so far.
8225 pub async fn doit(mut self) -> common::Result<(common::Response, PrivateConnection)> {
8226 use std::borrow::Cow;
8227 use std::io::{Read, Seek};
8228
8229 use common::{url::Params, ToParts};
8230 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8231
8232 let mut dd = common::DefaultDelegate;
8233 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8234 dlg.begin(common::MethodInfo {
8235 id: "datastream.projects.locations.privateConnections.get",
8236 http_method: hyper::Method::GET,
8237 });
8238
8239 for &field in ["alt", "name"].iter() {
8240 if self._additional_params.contains_key(field) {
8241 dlg.finished(false);
8242 return Err(common::Error::FieldClash(field));
8243 }
8244 }
8245
8246 let mut params = Params::with_capacity(3 + self._additional_params.len());
8247 params.push("name", self._name);
8248
8249 params.extend(self._additional_params.iter());
8250
8251 params.push("alt", "json");
8252 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8253 if self._scopes.is_empty() {
8254 self._scopes
8255 .insert(Scope::CloudPlatform.as_ref().to_string());
8256 }
8257
8258 #[allow(clippy::single_element_loop)]
8259 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8260 url = params.uri_replacement(url, param_name, find_this, true);
8261 }
8262 {
8263 let to_remove = ["name"];
8264 params.remove_params(&to_remove);
8265 }
8266
8267 let url = params.parse_with_url(&url);
8268
8269 loop {
8270 let token = match self
8271 .hub
8272 .auth
8273 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8274 .await
8275 {
8276 Ok(token) => token,
8277 Err(e) => match dlg.token(e) {
8278 Ok(token) => token,
8279 Err(e) => {
8280 dlg.finished(false);
8281 return Err(common::Error::MissingToken(e));
8282 }
8283 },
8284 };
8285 let mut req_result = {
8286 let client = &self.hub.client;
8287 dlg.pre_request();
8288 let mut req_builder = hyper::Request::builder()
8289 .method(hyper::Method::GET)
8290 .uri(url.as_str())
8291 .header(USER_AGENT, self.hub._user_agent.clone());
8292
8293 if let Some(token) = token.as_ref() {
8294 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8295 }
8296
8297 let request = req_builder
8298 .header(CONTENT_LENGTH, 0_u64)
8299 .body(common::to_body::<String>(None));
8300
8301 client.request(request.unwrap()).await
8302 };
8303
8304 match req_result {
8305 Err(err) => {
8306 if let common::Retry::After(d) = dlg.http_error(&err) {
8307 sleep(d).await;
8308 continue;
8309 }
8310 dlg.finished(false);
8311 return Err(common::Error::HttpError(err));
8312 }
8313 Ok(res) => {
8314 let (mut parts, body) = res.into_parts();
8315 let mut body = common::Body::new(body);
8316 if !parts.status.is_success() {
8317 let bytes = common::to_bytes(body).await.unwrap_or_default();
8318 let error = serde_json::from_str(&common::to_string(&bytes));
8319 let response = common::to_response(parts, bytes.into());
8320
8321 if let common::Retry::After(d) =
8322 dlg.http_failure(&response, error.as_ref().ok())
8323 {
8324 sleep(d).await;
8325 continue;
8326 }
8327
8328 dlg.finished(false);
8329
8330 return Err(match error {
8331 Ok(value) => common::Error::BadRequest(value),
8332 _ => common::Error::Failure(response),
8333 });
8334 }
8335 let response = {
8336 let bytes = common::to_bytes(body).await.unwrap_or_default();
8337 let encoded = common::to_string(&bytes);
8338 match serde_json::from_str(&encoded) {
8339 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8340 Err(error) => {
8341 dlg.response_json_decode_error(&encoded, &error);
8342 return Err(common::Error::JsonDecodeError(
8343 encoded.to_string(),
8344 error,
8345 ));
8346 }
8347 }
8348 };
8349
8350 dlg.finished(true);
8351 return Ok(response);
8352 }
8353 }
8354 }
8355 }
8356
8357 /// Required. The name of the private connectivity configuration to get.
8358 ///
8359 /// Sets the *name* path property to the given value.
8360 ///
8361 /// Even though the property as already been set when instantiating this call,
8362 /// we provide this method for API completeness.
8363 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
8364 self._name = new_value.to_string();
8365 self
8366 }
8367 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8368 /// while executing the actual API request.
8369 ///
8370 /// ````text
8371 /// It should be used to handle progress information, and to implement a certain level of resilience.
8372 /// ````
8373 ///
8374 /// Sets the *delegate* property to the given value.
8375 pub fn delegate(
8376 mut self,
8377 new_value: &'a mut dyn common::Delegate,
8378 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
8379 self._delegate = Some(new_value);
8380 self
8381 }
8382
8383 /// Set any additional parameter of the query string used in the request.
8384 /// It should be used to set parameters which are not yet available through their own
8385 /// setters.
8386 ///
8387 /// Please note that this method must not be used to set any of the known parameters
8388 /// which have their own setter method. If done anyway, the request will fail.
8389 ///
8390 /// # Additional Parameters
8391 ///
8392 /// * *$.xgafv* (query-string) - V1 error format.
8393 /// * *access_token* (query-string) - OAuth access token.
8394 /// * *alt* (query-string) - Data format for response.
8395 /// * *callback* (query-string) - JSONP
8396 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8397 /// * *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.
8398 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8399 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8400 /// * *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.
8401 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8402 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8403 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionGetCall<'a, C>
8404 where
8405 T: AsRef<str>,
8406 {
8407 self._additional_params
8408 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8409 self
8410 }
8411
8412 /// Identifies the authorization scope for the method you are building.
8413 ///
8414 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8415 /// [`Scope::CloudPlatform`].
8416 ///
8417 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8418 /// tokens for more than one scope.
8419 ///
8420 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8421 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8422 /// sufficient, a read-write scope will do as well.
8423 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionGetCall<'a, C>
8424 where
8425 St: AsRef<str>,
8426 {
8427 self._scopes.insert(String::from(scope.as_ref()));
8428 self
8429 }
8430 /// Identifies the authorization scope(s) for the method you are building.
8431 ///
8432 /// See [`Self::add_scope()`] for details.
8433 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionGetCall<'a, C>
8434 where
8435 I: IntoIterator<Item = St>,
8436 St: AsRef<str>,
8437 {
8438 self._scopes
8439 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8440 self
8441 }
8442
8443 /// Removes all scopes, and no default scope will be used either.
8444 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8445 /// for details).
8446 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
8447 self._scopes.clear();
8448 self
8449 }
8450}
8451
8452/// Use this method to list private connectivity configurations in a project and location.
8453///
8454/// A builder for the *locations.privateConnections.list* method supported by a *project* resource.
8455/// It is not used directly, but through a [`ProjectMethods`] instance.
8456///
8457/// # Example
8458///
8459/// Instantiate a resource method builder
8460///
8461/// ```test_harness,no_run
8462/// # extern crate hyper;
8463/// # extern crate hyper_rustls;
8464/// # extern crate google_datastream1 as datastream1;
8465/// # async fn dox() {
8466/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8467///
8468/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8469/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8470/// # secret,
8471/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8472/// # ).build().await.unwrap();
8473///
8474/// # let client = hyper_util::client::legacy::Client::builder(
8475/// # hyper_util::rt::TokioExecutor::new()
8476/// # )
8477/// # .build(
8478/// # hyper_rustls::HttpsConnectorBuilder::new()
8479/// # .with_native_roots()
8480/// # .unwrap()
8481/// # .https_or_http()
8482/// # .enable_http1()
8483/// # .build()
8484/// # );
8485/// # let mut hub = Datastream::new(client, auth);
8486/// // You can configure optional parameters by calling the respective setters at will, and
8487/// // execute the final call using `doit()`.
8488/// // Values shown here are possibly random and not representative !
8489/// let result = hub.projects().locations_private_connections_list("parent")
8490/// .page_token("no")
8491/// .page_size(-100)
8492/// .order_by("accusam")
8493/// .filter("takimata")
8494/// .doit().await;
8495/// # }
8496/// ```
8497pub struct ProjectLocationPrivateConnectionListCall<'a, C>
8498where
8499 C: 'a,
8500{
8501 hub: &'a Datastream<C>,
8502 _parent: String,
8503 _page_token: Option<String>,
8504 _page_size: Option<i32>,
8505 _order_by: Option<String>,
8506 _filter: Option<String>,
8507 _delegate: Option<&'a mut dyn common::Delegate>,
8508 _additional_params: HashMap<String, String>,
8509 _scopes: BTreeSet<String>,
8510}
8511
8512impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionListCall<'a, C> {}
8513
8514impl<'a, C> ProjectLocationPrivateConnectionListCall<'a, C>
8515where
8516 C: common::Connector,
8517{
8518 /// Perform the operation you have build so far.
8519 pub async fn doit(
8520 mut self,
8521 ) -> common::Result<(common::Response, ListPrivateConnectionsResponse)> {
8522 use std::borrow::Cow;
8523 use std::io::{Read, Seek};
8524
8525 use common::{url::Params, ToParts};
8526 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8527
8528 let mut dd = common::DefaultDelegate;
8529 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8530 dlg.begin(common::MethodInfo {
8531 id: "datastream.projects.locations.privateConnections.list",
8532 http_method: hyper::Method::GET,
8533 });
8534
8535 for &field in [
8536 "alt",
8537 "parent",
8538 "pageToken",
8539 "pageSize",
8540 "orderBy",
8541 "filter",
8542 ]
8543 .iter()
8544 {
8545 if self._additional_params.contains_key(field) {
8546 dlg.finished(false);
8547 return Err(common::Error::FieldClash(field));
8548 }
8549 }
8550
8551 let mut params = Params::with_capacity(7 + self._additional_params.len());
8552 params.push("parent", self._parent);
8553 if let Some(value) = self._page_token.as_ref() {
8554 params.push("pageToken", value);
8555 }
8556 if let Some(value) = self._page_size.as_ref() {
8557 params.push("pageSize", value.to_string());
8558 }
8559 if let Some(value) = self._order_by.as_ref() {
8560 params.push("orderBy", value);
8561 }
8562 if let Some(value) = self._filter.as_ref() {
8563 params.push("filter", value);
8564 }
8565
8566 params.extend(self._additional_params.iter());
8567
8568 params.push("alt", "json");
8569 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
8570 if self._scopes.is_empty() {
8571 self._scopes
8572 .insert(Scope::CloudPlatform.as_ref().to_string());
8573 }
8574
8575 #[allow(clippy::single_element_loop)]
8576 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8577 url = params.uri_replacement(url, param_name, find_this, true);
8578 }
8579 {
8580 let to_remove = ["parent"];
8581 params.remove_params(&to_remove);
8582 }
8583
8584 let url = params.parse_with_url(&url);
8585
8586 loop {
8587 let token = match self
8588 .hub
8589 .auth
8590 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8591 .await
8592 {
8593 Ok(token) => token,
8594 Err(e) => match dlg.token(e) {
8595 Ok(token) => token,
8596 Err(e) => {
8597 dlg.finished(false);
8598 return Err(common::Error::MissingToken(e));
8599 }
8600 },
8601 };
8602 let mut req_result = {
8603 let client = &self.hub.client;
8604 dlg.pre_request();
8605 let mut req_builder = hyper::Request::builder()
8606 .method(hyper::Method::GET)
8607 .uri(url.as_str())
8608 .header(USER_AGENT, self.hub._user_agent.clone());
8609
8610 if let Some(token) = token.as_ref() {
8611 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8612 }
8613
8614 let request = req_builder
8615 .header(CONTENT_LENGTH, 0_u64)
8616 .body(common::to_body::<String>(None));
8617
8618 client.request(request.unwrap()).await
8619 };
8620
8621 match req_result {
8622 Err(err) => {
8623 if let common::Retry::After(d) = dlg.http_error(&err) {
8624 sleep(d).await;
8625 continue;
8626 }
8627 dlg.finished(false);
8628 return Err(common::Error::HttpError(err));
8629 }
8630 Ok(res) => {
8631 let (mut parts, body) = res.into_parts();
8632 let mut body = common::Body::new(body);
8633 if !parts.status.is_success() {
8634 let bytes = common::to_bytes(body).await.unwrap_or_default();
8635 let error = serde_json::from_str(&common::to_string(&bytes));
8636 let response = common::to_response(parts, bytes.into());
8637
8638 if let common::Retry::After(d) =
8639 dlg.http_failure(&response, error.as_ref().ok())
8640 {
8641 sleep(d).await;
8642 continue;
8643 }
8644
8645 dlg.finished(false);
8646
8647 return Err(match error {
8648 Ok(value) => common::Error::BadRequest(value),
8649 _ => common::Error::Failure(response),
8650 });
8651 }
8652 let response = {
8653 let bytes = common::to_bytes(body).await.unwrap_or_default();
8654 let encoded = common::to_string(&bytes);
8655 match serde_json::from_str(&encoded) {
8656 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8657 Err(error) => {
8658 dlg.response_json_decode_error(&encoded, &error);
8659 return Err(common::Error::JsonDecodeError(
8660 encoded.to_string(),
8661 error,
8662 ));
8663 }
8664 }
8665 };
8666
8667 dlg.finished(true);
8668 return Ok(response);
8669 }
8670 }
8671 }
8672 }
8673
8674 /// Required. The parent that owns the collection of private connectivity configurations.
8675 ///
8676 /// Sets the *parent* path property to the given value.
8677 ///
8678 /// Even though the property as already been set when instantiating this call,
8679 /// we provide this method for API completeness.
8680 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8681 self._parent = new_value.to_string();
8682 self
8683 }
8684 /// 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.
8685 ///
8686 /// Sets the *page token* query property to the given value.
8687 pub fn page_token(
8688 mut self,
8689 new_value: &str,
8690 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8691 self._page_token = Some(new_value.to_string());
8692 self
8693 }
8694 /// 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.
8695 ///
8696 /// Sets the *page size* query property to the given value.
8697 pub fn page_size(mut self, new_value: i32) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8698 self._page_size = Some(new_value);
8699 self
8700 }
8701 /// Order by fields for the result.
8702 ///
8703 /// Sets the *order by* query property to the given value.
8704 pub fn order_by(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8705 self._order_by = Some(new_value.to_string());
8706 self
8707 }
8708 /// Filter request.
8709 ///
8710 /// Sets the *filter* query property to the given value.
8711 pub fn filter(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8712 self._filter = Some(new_value.to_string());
8713 self
8714 }
8715 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8716 /// while executing the actual API request.
8717 ///
8718 /// ````text
8719 /// It should be used to handle progress information, and to implement a certain level of resilience.
8720 /// ````
8721 ///
8722 /// Sets the *delegate* property to the given value.
8723 pub fn delegate(
8724 mut self,
8725 new_value: &'a mut dyn common::Delegate,
8726 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8727 self._delegate = Some(new_value);
8728 self
8729 }
8730
8731 /// Set any additional parameter of the query string used in the request.
8732 /// It should be used to set parameters which are not yet available through their own
8733 /// setters.
8734 ///
8735 /// Please note that this method must not be used to set any of the known parameters
8736 /// which have their own setter method. If done anyway, the request will fail.
8737 ///
8738 /// # Additional Parameters
8739 ///
8740 /// * *$.xgafv* (query-string) - V1 error format.
8741 /// * *access_token* (query-string) - OAuth access token.
8742 /// * *alt* (query-string) - Data format for response.
8743 /// * *callback* (query-string) - JSONP
8744 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8745 /// * *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.
8746 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8747 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8748 /// * *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.
8749 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8750 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8751 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionListCall<'a, C>
8752 where
8753 T: AsRef<str>,
8754 {
8755 self._additional_params
8756 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8757 self
8758 }
8759
8760 /// Identifies the authorization scope for the method you are building.
8761 ///
8762 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8763 /// [`Scope::CloudPlatform`].
8764 ///
8765 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8766 /// tokens for more than one scope.
8767 ///
8768 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8769 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8770 /// sufficient, a read-write scope will do as well.
8771 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionListCall<'a, C>
8772 where
8773 St: AsRef<str>,
8774 {
8775 self._scopes.insert(String::from(scope.as_ref()));
8776 self
8777 }
8778 /// Identifies the authorization scope(s) for the method you are building.
8779 ///
8780 /// See [`Self::add_scope()`] for details.
8781 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionListCall<'a, C>
8782 where
8783 I: IntoIterator<Item = St>,
8784 St: AsRef<str>,
8785 {
8786 self._scopes
8787 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8788 self
8789 }
8790
8791 /// Removes all scopes, and no default scope will be used either.
8792 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8793 /// for details).
8794 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionListCall<'a, C> {
8795 self._scopes.clear();
8796 self
8797 }
8798}
8799
8800/// Use this method to get details about a stream object.
8801///
8802/// A builder for the *locations.streams.objects.get* method supported by a *project* resource.
8803/// It is not used directly, but through a [`ProjectMethods`] instance.
8804///
8805/// # Example
8806///
8807/// Instantiate a resource method builder
8808///
8809/// ```test_harness,no_run
8810/// # extern crate hyper;
8811/// # extern crate hyper_rustls;
8812/// # extern crate google_datastream1 as datastream1;
8813/// # async fn dox() {
8814/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8815///
8816/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8817/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8818/// # secret,
8819/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8820/// # ).build().await.unwrap();
8821///
8822/// # let client = hyper_util::client::legacy::Client::builder(
8823/// # hyper_util::rt::TokioExecutor::new()
8824/// # )
8825/// # .build(
8826/// # hyper_rustls::HttpsConnectorBuilder::new()
8827/// # .with_native_roots()
8828/// # .unwrap()
8829/// # .https_or_http()
8830/// # .enable_http1()
8831/// # .build()
8832/// # );
8833/// # let mut hub = Datastream::new(client, auth);
8834/// // You can configure optional parameters by calling the respective setters at will, and
8835/// // execute the final call using `doit()`.
8836/// // Values shown here are possibly random and not representative !
8837/// let result = hub.projects().locations_streams_objects_get("name")
8838/// .doit().await;
8839/// # }
8840/// ```
8841pub struct ProjectLocationStreamObjectGetCall<'a, C>
8842where
8843 C: 'a,
8844{
8845 hub: &'a Datastream<C>,
8846 _name: String,
8847 _delegate: Option<&'a mut dyn common::Delegate>,
8848 _additional_params: HashMap<String, String>,
8849 _scopes: BTreeSet<String>,
8850}
8851
8852impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectGetCall<'a, C> {}
8853
8854impl<'a, C> ProjectLocationStreamObjectGetCall<'a, C>
8855where
8856 C: common::Connector,
8857{
8858 /// Perform the operation you have build so far.
8859 pub async fn doit(mut self) -> common::Result<(common::Response, StreamObject)> {
8860 use std::borrow::Cow;
8861 use std::io::{Read, Seek};
8862
8863 use common::{url::Params, ToParts};
8864 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8865
8866 let mut dd = common::DefaultDelegate;
8867 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8868 dlg.begin(common::MethodInfo {
8869 id: "datastream.projects.locations.streams.objects.get",
8870 http_method: hyper::Method::GET,
8871 });
8872
8873 for &field in ["alt", "name"].iter() {
8874 if self._additional_params.contains_key(field) {
8875 dlg.finished(false);
8876 return Err(common::Error::FieldClash(field));
8877 }
8878 }
8879
8880 let mut params = Params::with_capacity(3 + self._additional_params.len());
8881 params.push("name", self._name);
8882
8883 params.extend(self._additional_params.iter());
8884
8885 params.push("alt", "json");
8886 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8887 if self._scopes.is_empty() {
8888 self._scopes
8889 .insert(Scope::CloudPlatform.as_ref().to_string());
8890 }
8891
8892 #[allow(clippy::single_element_loop)]
8893 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8894 url = params.uri_replacement(url, param_name, find_this, true);
8895 }
8896 {
8897 let to_remove = ["name"];
8898 params.remove_params(&to_remove);
8899 }
8900
8901 let url = params.parse_with_url(&url);
8902
8903 loop {
8904 let token = match self
8905 .hub
8906 .auth
8907 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8908 .await
8909 {
8910 Ok(token) => token,
8911 Err(e) => match dlg.token(e) {
8912 Ok(token) => token,
8913 Err(e) => {
8914 dlg.finished(false);
8915 return Err(common::Error::MissingToken(e));
8916 }
8917 },
8918 };
8919 let mut req_result = {
8920 let client = &self.hub.client;
8921 dlg.pre_request();
8922 let mut req_builder = hyper::Request::builder()
8923 .method(hyper::Method::GET)
8924 .uri(url.as_str())
8925 .header(USER_AGENT, self.hub._user_agent.clone());
8926
8927 if let Some(token) = token.as_ref() {
8928 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8929 }
8930
8931 let request = req_builder
8932 .header(CONTENT_LENGTH, 0_u64)
8933 .body(common::to_body::<String>(None));
8934
8935 client.request(request.unwrap()).await
8936 };
8937
8938 match req_result {
8939 Err(err) => {
8940 if let common::Retry::After(d) = dlg.http_error(&err) {
8941 sleep(d).await;
8942 continue;
8943 }
8944 dlg.finished(false);
8945 return Err(common::Error::HttpError(err));
8946 }
8947 Ok(res) => {
8948 let (mut parts, body) = res.into_parts();
8949 let mut body = common::Body::new(body);
8950 if !parts.status.is_success() {
8951 let bytes = common::to_bytes(body).await.unwrap_or_default();
8952 let error = serde_json::from_str(&common::to_string(&bytes));
8953 let response = common::to_response(parts, bytes.into());
8954
8955 if let common::Retry::After(d) =
8956 dlg.http_failure(&response, error.as_ref().ok())
8957 {
8958 sleep(d).await;
8959 continue;
8960 }
8961
8962 dlg.finished(false);
8963
8964 return Err(match error {
8965 Ok(value) => common::Error::BadRequest(value),
8966 _ => common::Error::Failure(response),
8967 });
8968 }
8969 let response = {
8970 let bytes = common::to_bytes(body).await.unwrap_or_default();
8971 let encoded = common::to_string(&bytes);
8972 match serde_json::from_str(&encoded) {
8973 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8974 Err(error) => {
8975 dlg.response_json_decode_error(&encoded, &error);
8976 return Err(common::Error::JsonDecodeError(
8977 encoded.to_string(),
8978 error,
8979 ));
8980 }
8981 }
8982 };
8983
8984 dlg.finished(true);
8985 return Ok(response);
8986 }
8987 }
8988 }
8989 }
8990
8991 /// Required. The name of the stream object resource to get.
8992 ///
8993 /// Sets the *name* path property to the given value.
8994 ///
8995 /// Even though the property as already been set when instantiating this call,
8996 /// we provide this method for API completeness.
8997 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamObjectGetCall<'a, C> {
8998 self._name = new_value.to_string();
8999 self
9000 }
9001 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9002 /// while executing the actual API request.
9003 ///
9004 /// ````text
9005 /// It should be used to handle progress information, and to implement a certain level of resilience.
9006 /// ````
9007 ///
9008 /// Sets the *delegate* property to the given value.
9009 pub fn delegate(
9010 mut self,
9011 new_value: &'a mut dyn common::Delegate,
9012 ) -> ProjectLocationStreamObjectGetCall<'a, C> {
9013 self._delegate = Some(new_value);
9014 self
9015 }
9016
9017 /// Set any additional parameter of the query string used in the request.
9018 /// It should be used to set parameters which are not yet available through their own
9019 /// setters.
9020 ///
9021 /// Please note that this method must not be used to set any of the known parameters
9022 /// which have their own setter method. If done anyway, the request will fail.
9023 ///
9024 /// # Additional Parameters
9025 ///
9026 /// * *$.xgafv* (query-string) - V1 error format.
9027 /// * *access_token* (query-string) - OAuth access token.
9028 /// * *alt* (query-string) - Data format for response.
9029 /// * *callback* (query-string) - JSONP
9030 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9031 /// * *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.
9032 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9033 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9034 /// * *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.
9035 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9036 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9037 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectGetCall<'a, C>
9038 where
9039 T: AsRef<str>,
9040 {
9041 self._additional_params
9042 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9043 self
9044 }
9045
9046 /// Identifies the authorization scope for the method you are building.
9047 ///
9048 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9049 /// [`Scope::CloudPlatform`].
9050 ///
9051 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9052 /// tokens for more than one scope.
9053 ///
9054 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9055 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9056 /// sufficient, a read-write scope will do as well.
9057 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectGetCall<'a, C>
9058 where
9059 St: AsRef<str>,
9060 {
9061 self._scopes.insert(String::from(scope.as_ref()));
9062 self
9063 }
9064 /// Identifies the authorization scope(s) for the method you are building.
9065 ///
9066 /// See [`Self::add_scope()`] for details.
9067 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectGetCall<'a, C>
9068 where
9069 I: IntoIterator<Item = St>,
9070 St: AsRef<str>,
9071 {
9072 self._scopes
9073 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9074 self
9075 }
9076
9077 /// Removes all scopes, and no default scope will be used either.
9078 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9079 /// for details).
9080 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectGetCall<'a, C> {
9081 self._scopes.clear();
9082 self
9083 }
9084}
9085
9086/// Use this method to list the objects of a specific stream.
9087///
9088/// A builder for the *locations.streams.objects.list* method supported by a *project* resource.
9089/// It is not used directly, but through a [`ProjectMethods`] instance.
9090///
9091/// # Example
9092///
9093/// Instantiate a resource method builder
9094///
9095/// ```test_harness,no_run
9096/// # extern crate hyper;
9097/// # extern crate hyper_rustls;
9098/// # extern crate google_datastream1 as datastream1;
9099/// # async fn dox() {
9100/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9101///
9102/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9103/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9104/// # secret,
9105/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9106/// # ).build().await.unwrap();
9107///
9108/// # let client = hyper_util::client::legacy::Client::builder(
9109/// # hyper_util::rt::TokioExecutor::new()
9110/// # )
9111/// # .build(
9112/// # hyper_rustls::HttpsConnectorBuilder::new()
9113/// # .with_native_roots()
9114/// # .unwrap()
9115/// # .https_or_http()
9116/// # .enable_http1()
9117/// # .build()
9118/// # );
9119/// # let mut hub = Datastream::new(client, auth);
9120/// // You can configure optional parameters by calling the respective setters at will, and
9121/// // execute the final call using `doit()`.
9122/// // Values shown here are possibly random and not representative !
9123/// let result = hub.projects().locations_streams_objects_list("parent")
9124/// .page_token("et")
9125/// .page_size(-31)
9126/// .doit().await;
9127/// # }
9128/// ```
9129pub struct ProjectLocationStreamObjectListCall<'a, C>
9130where
9131 C: 'a,
9132{
9133 hub: &'a Datastream<C>,
9134 _parent: String,
9135 _page_token: Option<String>,
9136 _page_size: Option<i32>,
9137 _delegate: Option<&'a mut dyn common::Delegate>,
9138 _additional_params: HashMap<String, String>,
9139 _scopes: BTreeSet<String>,
9140}
9141
9142impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectListCall<'a, C> {}
9143
9144impl<'a, C> ProjectLocationStreamObjectListCall<'a, C>
9145where
9146 C: common::Connector,
9147{
9148 /// Perform the operation you have build so far.
9149 pub async fn doit(mut self) -> common::Result<(common::Response, ListStreamObjectsResponse)> {
9150 use std::borrow::Cow;
9151 use std::io::{Read, Seek};
9152
9153 use common::{url::Params, ToParts};
9154 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9155
9156 let mut dd = common::DefaultDelegate;
9157 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9158 dlg.begin(common::MethodInfo {
9159 id: "datastream.projects.locations.streams.objects.list",
9160 http_method: hyper::Method::GET,
9161 });
9162
9163 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9164 if self._additional_params.contains_key(field) {
9165 dlg.finished(false);
9166 return Err(common::Error::FieldClash(field));
9167 }
9168 }
9169
9170 let mut params = Params::with_capacity(5 + self._additional_params.len());
9171 params.push("parent", self._parent);
9172 if let Some(value) = self._page_token.as_ref() {
9173 params.push("pageToken", value);
9174 }
9175 if let Some(value) = self._page_size.as_ref() {
9176 params.push("pageSize", value.to_string());
9177 }
9178
9179 params.extend(self._additional_params.iter());
9180
9181 params.push("alt", "json");
9182 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects";
9183 if self._scopes.is_empty() {
9184 self._scopes
9185 .insert(Scope::CloudPlatform.as_ref().to_string());
9186 }
9187
9188 #[allow(clippy::single_element_loop)]
9189 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9190 url = params.uri_replacement(url, param_name, find_this, true);
9191 }
9192 {
9193 let to_remove = ["parent"];
9194 params.remove_params(&to_remove);
9195 }
9196
9197 let url = params.parse_with_url(&url);
9198
9199 loop {
9200 let token = match self
9201 .hub
9202 .auth
9203 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9204 .await
9205 {
9206 Ok(token) => token,
9207 Err(e) => match dlg.token(e) {
9208 Ok(token) => token,
9209 Err(e) => {
9210 dlg.finished(false);
9211 return Err(common::Error::MissingToken(e));
9212 }
9213 },
9214 };
9215 let mut req_result = {
9216 let client = &self.hub.client;
9217 dlg.pre_request();
9218 let mut req_builder = hyper::Request::builder()
9219 .method(hyper::Method::GET)
9220 .uri(url.as_str())
9221 .header(USER_AGENT, self.hub._user_agent.clone());
9222
9223 if let Some(token) = token.as_ref() {
9224 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9225 }
9226
9227 let request = req_builder
9228 .header(CONTENT_LENGTH, 0_u64)
9229 .body(common::to_body::<String>(None));
9230
9231 client.request(request.unwrap()).await
9232 };
9233
9234 match req_result {
9235 Err(err) => {
9236 if let common::Retry::After(d) = dlg.http_error(&err) {
9237 sleep(d).await;
9238 continue;
9239 }
9240 dlg.finished(false);
9241 return Err(common::Error::HttpError(err));
9242 }
9243 Ok(res) => {
9244 let (mut parts, body) = res.into_parts();
9245 let mut body = common::Body::new(body);
9246 if !parts.status.is_success() {
9247 let bytes = common::to_bytes(body).await.unwrap_or_default();
9248 let error = serde_json::from_str(&common::to_string(&bytes));
9249 let response = common::to_response(parts, bytes.into());
9250
9251 if let common::Retry::After(d) =
9252 dlg.http_failure(&response, error.as_ref().ok())
9253 {
9254 sleep(d).await;
9255 continue;
9256 }
9257
9258 dlg.finished(false);
9259
9260 return Err(match error {
9261 Ok(value) => common::Error::BadRequest(value),
9262 _ => common::Error::Failure(response),
9263 });
9264 }
9265 let response = {
9266 let bytes = common::to_bytes(body).await.unwrap_or_default();
9267 let encoded = common::to_string(&bytes);
9268 match serde_json::from_str(&encoded) {
9269 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9270 Err(error) => {
9271 dlg.response_json_decode_error(&encoded, &error);
9272 return Err(common::Error::JsonDecodeError(
9273 encoded.to_string(),
9274 error,
9275 ));
9276 }
9277 }
9278 };
9279
9280 dlg.finished(true);
9281 return Ok(response);
9282 }
9283 }
9284 }
9285 }
9286
9287 /// Required. The parent stream that owns the collection of objects.
9288 ///
9289 /// Sets the *parent* path property to the given value.
9290 ///
9291 /// Even though the property as already been set when instantiating this call,
9292 /// we provide this method for API completeness.
9293 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamObjectListCall<'a, C> {
9294 self._parent = new_value.to_string();
9295 self
9296 }
9297 /// 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.
9298 ///
9299 /// Sets the *page token* query property to the given value.
9300 pub fn page_token(mut self, new_value: &str) -> ProjectLocationStreamObjectListCall<'a, C> {
9301 self._page_token = Some(new_value.to_string());
9302 self
9303 }
9304 /// Maximum number of objects to return. Default is 50. The maximum value is 1000; values above 1000 will be coerced to 1000.
9305 ///
9306 /// Sets the *page size* query property to the given value.
9307 pub fn page_size(mut self, new_value: i32) -> ProjectLocationStreamObjectListCall<'a, C> {
9308 self._page_size = Some(new_value);
9309 self
9310 }
9311 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9312 /// while executing the actual API request.
9313 ///
9314 /// ````text
9315 /// It should be used to handle progress information, and to implement a certain level of resilience.
9316 /// ````
9317 ///
9318 /// Sets the *delegate* property to the given value.
9319 pub fn delegate(
9320 mut self,
9321 new_value: &'a mut dyn common::Delegate,
9322 ) -> ProjectLocationStreamObjectListCall<'a, C> {
9323 self._delegate = Some(new_value);
9324 self
9325 }
9326
9327 /// Set any additional parameter of the query string used in the request.
9328 /// It should be used to set parameters which are not yet available through their own
9329 /// setters.
9330 ///
9331 /// Please note that this method must not be used to set any of the known parameters
9332 /// which have their own setter method. If done anyway, the request will fail.
9333 ///
9334 /// # Additional Parameters
9335 ///
9336 /// * *$.xgafv* (query-string) - V1 error format.
9337 /// * *access_token* (query-string) - OAuth access token.
9338 /// * *alt* (query-string) - Data format for response.
9339 /// * *callback* (query-string) - JSONP
9340 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9341 /// * *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.
9342 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9343 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9344 /// * *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.
9345 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9346 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9347 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectListCall<'a, C>
9348 where
9349 T: AsRef<str>,
9350 {
9351 self._additional_params
9352 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9353 self
9354 }
9355
9356 /// Identifies the authorization scope for the method you are building.
9357 ///
9358 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9359 /// [`Scope::CloudPlatform`].
9360 ///
9361 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9362 /// tokens for more than one scope.
9363 ///
9364 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9365 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9366 /// sufficient, a read-write scope will do as well.
9367 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectListCall<'a, C>
9368 where
9369 St: AsRef<str>,
9370 {
9371 self._scopes.insert(String::from(scope.as_ref()));
9372 self
9373 }
9374 /// Identifies the authorization scope(s) for the method you are building.
9375 ///
9376 /// See [`Self::add_scope()`] for details.
9377 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectListCall<'a, C>
9378 where
9379 I: IntoIterator<Item = St>,
9380 St: AsRef<str>,
9381 {
9382 self._scopes
9383 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9384 self
9385 }
9386
9387 /// Removes all scopes, and no default scope will be used either.
9388 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9389 /// for details).
9390 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectListCall<'a, C> {
9391 self._scopes.clear();
9392 self
9393 }
9394}
9395
9396/// Use this method to look up a stream object by its source object identifier.
9397///
9398/// A builder for the *locations.streams.objects.lookup* method supported by a *project* resource.
9399/// It is not used directly, but through a [`ProjectMethods`] instance.
9400///
9401/// # Example
9402///
9403/// Instantiate a resource method builder
9404///
9405/// ```test_harness,no_run
9406/// # extern crate hyper;
9407/// # extern crate hyper_rustls;
9408/// # extern crate google_datastream1 as datastream1;
9409/// use datastream1::api::LookupStreamObjectRequest;
9410/// # async fn dox() {
9411/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9412///
9413/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9414/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9415/// # secret,
9416/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9417/// # ).build().await.unwrap();
9418///
9419/// # let client = hyper_util::client::legacy::Client::builder(
9420/// # hyper_util::rt::TokioExecutor::new()
9421/// # )
9422/// # .build(
9423/// # hyper_rustls::HttpsConnectorBuilder::new()
9424/// # .with_native_roots()
9425/// # .unwrap()
9426/// # .https_or_http()
9427/// # .enable_http1()
9428/// # .build()
9429/// # );
9430/// # let mut hub = Datastream::new(client, auth);
9431/// // As the method needs a request, you would usually fill it with the desired information
9432/// // into the respective structure. Some of the parts shown here might not be applicable !
9433/// // Values shown here are possibly random and not representative !
9434/// let mut req = LookupStreamObjectRequest::default();
9435///
9436/// // You can configure optional parameters by calling the respective setters at will, and
9437/// // execute the final call using `doit()`.
9438/// // Values shown here are possibly random and not representative !
9439/// let result = hub.projects().locations_streams_objects_lookup(req, "parent")
9440/// .doit().await;
9441/// # }
9442/// ```
9443pub struct ProjectLocationStreamObjectLookupCall<'a, C>
9444where
9445 C: 'a,
9446{
9447 hub: &'a Datastream<C>,
9448 _request: LookupStreamObjectRequest,
9449 _parent: String,
9450 _delegate: Option<&'a mut dyn common::Delegate>,
9451 _additional_params: HashMap<String, String>,
9452 _scopes: BTreeSet<String>,
9453}
9454
9455impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectLookupCall<'a, C> {}
9456
9457impl<'a, C> ProjectLocationStreamObjectLookupCall<'a, C>
9458where
9459 C: common::Connector,
9460{
9461 /// Perform the operation you have build so far.
9462 pub async fn doit(mut self) -> common::Result<(common::Response, StreamObject)> {
9463 use std::borrow::Cow;
9464 use std::io::{Read, Seek};
9465
9466 use common::{url::Params, ToParts};
9467 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9468
9469 let mut dd = common::DefaultDelegate;
9470 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9471 dlg.begin(common::MethodInfo {
9472 id: "datastream.projects.locations.streams.objects.lookup",
9473 http_method: hyper::Method::POST,
9474 });
9475
9476 for &field in ["alt", "parent"].iter() {
9477 if self._additional_params.contains_key(field) {
9478 dlg.finished(false);
9479 return Err(common::Error::FieldClash(field));
9480 }
9481 }
9482
9483 let mut params = Params::with_capacity(4 + self._additional_params.len());
9484 params.push("parent", self._parent);
9485
9486 params.extend(self._additional_params.iter());
9487
9488 params.push("alt", "json");
9489 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects:lookup";
9490 if self._scopes.is_empty() {
9491 self._scopes
9492 .insert(Scope::CloudPlatform.as_ref().to_string());
9493 }
9494
9495 #[allow(clippy::single_element_loop)]
9496 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9497 url = params.uri_replacement(url, param_name, find_this, true);
9498 }
9499 {
9500 let to_remove = ["parent"];
9501 params.remove_params(&to_remove);
9502 }
9503
9504 let url = params.parse_with_url(&url);
9505
9506 let mut json_mime_type = mime::APPLICATION_JSON;
9507 let mut request_value_reader = {
9508 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9509 common::remove_json_null_values(&mut value);
9510 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9511 serde_json::to_writer(&mut dst, &value).unwrap();
9512 dst
9513 };
9514 let request_size = request_value_reader
9515 .seek(std::io::SeekFrom::End(0))
9516 .unwrap();
9517 request_value_reader
9518 .seek(std::io::SeekFrom::Start(0))
9519 .unwrap();
9520
9521 loop {
9522 let token = match self
9523 .hub
9524 .auth
9525 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9526 .await
9527 {
9528 Ok(token) => token,
9529 Err(e) => match dlg.token(e) {
9530 Ok(token) => token,
9531 Err(e) => {
9532 dlg.finished(false);
9533 return Err(common::Error::MissingToken(e));
9534 }
9535 },
9536 };
9537 request_value_reader
9538 .seek(std::io::SeekFrom::Start(0))
9539 .unwrap();
9540 let mut req_result = {
9541 let client = &self.hub.client;
9542 dlg.pre_request();
9543 let mut req_builder = hyper::Request::builder()
9544 .method(hyper::Method::POST)
9545 .uri(url.as_str())
9546 .header(USER_AGENT, self.hub._user_agent.clone());
9547
9548 if let Some(token) = token.as_ref() {
9549 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9550 }
9551
9552 let request = req_builder
9553 .header(CONTENT_TYPE, json_mime_type.to_string())
9554 .header(CONTENT_LENGTH, request_size as u64)
9555 .body(common::to_body(
9556 request_value_reader.get_ref().clone().into(),
9557 ));
9558
9559 client.request(request.unwrap()).await
9560 };
9561
9562 match req_result {
9563 Err(err) => {
9564 if let common::Retry::After(d) = dlg.http_error(&err) {
9565 sleep(d).await;
9566 continue;
9567 }
9568 dlg.finished(false);
9569 return Err(common::Error::HttpError(err));
9570 }
9571 Ok(res) => {
9572 let (mut parts, body) = res.into_parts();
9573 let mut body = common::Body::new(body);
9574 if !parts.status.is_success() {
9575 let bytes = common::to_bytes(body).await.unwrap_or_default();
9576 let error = serde_json::from_str(&common::to_string(&bytes));
9577 let response = common::to_response(parts, bytes.into());
9578
9579 if let common::Retry::After(d) =
9580 dlg.http_failure(&response, error.as_ref().ok())
9581 {
9582 sleep(d).await;
9583 continue;
9584 }
9585
9586 dlg.finished(false);
9587
9588 return Err(match error {
9589 Ok(value) => common::Error::BadRequest(value),
9590 _ => common::Error::Failure(response),
9591 });
9592 }
9593 let response = {
9594 let bytes = common::to_bytes(body).await.unwrap_or_default();
9595 let encoded = common::to_string(&bytes);
9596 match serde_json::from_str(&encoded) {
9597 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9598 Err(error) => {
9599 dlg.response_json_decode_error(&encoded, &error);
9600 return Err(common::Error::JsonDecodeError(
9601 encoded.to_string(),
9602 error,
9603 ));
9604 }
9605 }
9606 };
9607
9608 dlg.finished(true);
9609 return Ok(response);
9610 }
9611 }
9612 }
9613 }
9614
9615 ///
9616 /// Sets the *request* property to the given value.
9617 ///
9618 /// Even though the property as already been set when instantiating this call,
9619 /// we provide this method for API completeness.
9620 pub fn request(
9621 mut self,
9622 new_value: LookupStreamObjectRequest,
9623 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
9624 self._request = new_value;
9625 self
9626 }
9627 /// Required. The parent stream that owns the collection of objects.
9628 ///
9629 /// Sets the *parent* path property to the given value.
9630 ///
9631 /// Even though the property as already been set when instantiating this call,
9632 /// we provide this method for API completeness.
9633 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamObjectLookupCall<'a, C> {
9634 self._parent = new_value.to_string();
9635 self
9636 }
9637 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9638 /// while executing the actual API request.
9639 ///
9640 /// ````text
9641 /// It should be used to handle progress information, and to implement a certain level of resilience.
9642 /// ````
9643 ///
9644 /// Sets the *delegate* property to the given value.
9645 pub fn delegate(
9646 mut self,
9647 new_value: &'a mut dyn common::Delegate,
9648 ) -> ProjectLocationStreamObjectLookupCall<'a, C> {
9649 self._delegate = Some(new_value);
9650 self
9651 }
9652
9653 /// Set any additional parameter of the query string used in the request.
9654 /// It should be used to set parameters which are not yet available through their own
9655 /// setters.
9656 ///
9657 /// Please note that this method must not be used to set any of the known parameters
9658 /// which have their own setter method. If done anyway, the request will fail.
9659 ///
9660 /// # Additional Parameters
9661 ///
9662 /// * *$.xgafv* (query-string) - V1 error format.
9663 /// * *access_token* (query-string) - OAuth access token.
9664 /// * *alt* (query-string) - Data format for response.
9665 /// * *callback* (query-string) - JSONP
9666 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9667 /// * *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.
9668 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9669 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9670 /// * *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.
9671 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9672 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9673 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamObjectLookupCall<'a, C>
9674 where
9675 T: AsRef<str>,
9676 {
9677 self._additional_params
9678 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9679 self
9680 }
9681
9682 /// Identifies the authorization scope for the method you are building.
9683 ///
9684 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9685 /// [`Scope::CloudPlatform`].
9686 ///
9687 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9688 /// tokens for more than one scope.
9689 ///
9690 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9691 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9692 /// sufficient, a read-write scope will do as well.
9693 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamObjectLookupCall<'a, C>
9694 where
9695 St: AsRef<str>,
9696 {
9697 self._scopes.insert(String::from(scope.as_ref()));
9698 self
9699 }
9700 /// Identifies the authorization scope(s) for the method you are building.
9701 ///
9702 /// See [`Self::add_scope()`] for details.
9703 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamObjectLookupCall<'a, C>
9704 where
9705 I: IntoIterator<Item = St>,
9706 St: AsRef<str>,
9707 {
9708 self._scopes
9709 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9710 self
9711 }
9712
9713 /// Removes all scopes, and no default scope will be used either.
9714 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9715 /// for details).
9716 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectLookupCall<'a, C> {
9717 self._scopes.clear();
9718 self
9719 }
9720}
9721
9722/// Use this method to start a backfill job for the specified stream object.
9723///
9724/// A builder for the *locations.streams.objects.startBackfillJob* method supported by a *project* resource.
9725/// It is not used directly, but through a [`ProjectMethods`] instance.
9726///
9727/// # Example
9728///
9729/// Instantiate a resource method builder
9730///
9731/// ```test_harness,no_run
9732/// # extern crate hyper;
9733/// # extern crate hyper_rustls;
9734/// # extern crate google_datastream1 as datastream1;
9735/// use datastream1::api::StartBackfillJobRequest;
9736/// # async fn dox() {
9737/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9738///
9739/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9740/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9741/// # secret,
9742/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9743/// # ).build().await.unwrap();
9744///
9745/// # let client = hyper_util::client::legacy::Client::builder(
9746/// # hyper_util::rt::TokioExecutor::new()
9747/// # )
9748/// # .build(
9749/// # hyper_rustls::HttpsConnectorBuilder::new()
9750/// # .with_native_roots()
9751/// # .unwrap()
9752/// # .https_or_http()
9753/// # .enable_http1()
9754/// # .build()
9755/// # );
9756/// # let mut hub = Datastream::new(client, auth);
9757/// // As the method needs a request, you would usually fill it with the desired information
9758/// // into the respective structure. Some of the parts shown here might not be applicable !
9759/// // Values shown here are possibly random and not representative !
9760/// let mut req = StartBackfillJobRequest::default();
9761///
9762/// // You can configure optional parameters by calling the respective setters at will, and
9763/// // execute the final call using `doit()`.
9764/// // Values shown here are possibly random and not representative !
9765/// let result = hub.projects().locations_streams_objects_start_backfill_job(req, "object")
9766/// .doit().await;
9767/// # }
9768/// ```
9769pub struct ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
9770where
9771 C: 'a,
9772{
9773 hub: &'a Datastream<C>,
9774 _request: StartBackfillJobRequest,
9775 _object: String,
9776 _delegate: Option<&'a mut dyn common::Delegate>,
9777 _additional_params: HashMap<String, String>,
9778 _scopes: BTreeSet<String>,
9779}
9780
9781impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {}
9782
9783impl<'a, C> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
9784where
9785 C: common::Connector,
9786{
9787 /// Perform the operation you have build so far.
9788 pub async fn doit(mut self) -> common::Result<(common::Response, StartBackfillJobResponse)> {
9789 use std::borrow::Cow;
9790 use std::io::{Read, Seek};
9791
9792 use common::{url::Params, ToParts};
9793 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9794
9795 let mut dd = common::DefaultDelegate;
9796 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9797 dlg.begin(common::MethodInfo {
9798 id: "datastream.projects.locations.streams.objects.startBackfillJob",
9799 http_method: hyper::Method::POST,
9800 });
9801
9802 for &field in ["alt", "object"].iter() {
9803 if self._additional_params.contains_key(field) {
9804 dlg.finished(false);
9805 return Err(common::Error::FieldClash(field));
9806 }
9807 }
9808
9809 let mut params = Params::with_capacity(4 + self._additional_params.len());
9810 params.push("object", self._object);
9811
9812 params.extend(self._additional_params.iter());
9813
9814 params.push("alt", "json");
9815 let mut url = self.hub._base_url.clone() + "v1/{+object}:startBackfillJob";
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 [("{+object}", "object")].iter() {
9823 url = params.uri_replacement(url, param_name, find_this, true);
9824 }
9825 {
9826 let to_remove = ["object"];
9827 params.remove_params(&to_remove);
9828 }
9829
9830 let url = params.parse_with_url(&url);
9831
9832 let mut json_mime_type = mime::APPLICATION_JSON;
9833 let mut request_value_reader = {
9834 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9835 common::remove_json_null_values(&mut value);
9836 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9837 serde_json::to_writer(&mut dst, &value).unwrap();
9838 dst
9839 };
9840 let request_size = request_value_reader
9841 .seek(std::io::SeekFrom::End(0))
9842 .unwrap();
9843 request_value_reader
9844 .seek(std::io::SeekFrom::Start(0))
9845 .unwrap();
9846
9847 loop {
9848 let token = match self
9849 .hub
9850 .auth
9851 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9852 .await
9853 {
9854 Ok(token) => token,
9855 Err(e) => match dlg.token(e) {
9856 Ok(token) => token,
9857 Err(e) => {
9858 dlg.finished(false);
9859 return Err(common::Error::MissingToken(e));
9860 }
9861 },
9862 };
9863 request_value_reader
9864 .seek(std::io::SeekFrom::Start(0))
9865 .unwrap();
9866 let mut req_result = {
9867 let client = &self.hub.client;
9868 dlg.pre_request();
9869 let mut req_builder = hyper::Request::builder()
9870 .method(hyper::Method::POST)
9871 .uri(url.as_str())
9872 .header(USER_AGENT, self.hub._user_agent.clone());
9873
9874 if let Some(token) = token.as_ref() {
9875 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9876 }
9877
9878 let request = req_builder
9879 .header(CONTENT_TYPE, json_mime_type.to_string())
9880 .header(CONTENT_LENGTH, request_size as u64)
9881 .body(common::to_body(
9882 request_value_reader.get_ref().clone().into(),
9883 ));
9884
9885 client.request(request.unwrap()).await
9886 };
9887
9888 match req_result {
9889 Err(err) => {
9890 if let common::Retry::After(d) = dlg.http_error(&err) {
9891 sleep(d).await;
9892 continue;
9893 }
9894 dlg.finished(false);
9895 return Err(common::Error::HttpError(err));
9896 }
9897 Ok(res) => {
9898 let (mut parts, body) = res.into_parts();
9899 let mut body = common::Body::new(body);
9900 if !parts.status.is_success() {
9901 let bytes = common::to_bytes(body).await.unwrap_or_default();
9902 let error = serde_json::from_str(&common::to_string(&bytes));
9903 let response = common::to_response(parts, bytes.into());
9904
9905 if let common::Retry::After(d) =
9906 dlg.http_failure(&response, error.as_ref().ok())
9907 {
9908 sleep(d).await;
9909 continue;
9910 }
9911
9912 dlg.finished(false);
9913
9914 return Err(match error {
9915 Ok(value) => common::Error::BadRequest(value),
9916 _ => common::Error::Failure(response),
9917 });
9918 }
9919 let response = {
9920 let bytes = common::to_bytes(body).await.unwrap_or_default();
9921 let encoded = common::to_string(&bytes);
9922 match serde_json::from_str(&encoded) {
9923 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9924 Err(error) => {
9925 dlg.response_json_decode_error(&encoded, &error);
9926 return Err(common::Error::JsonDecodeError(
9927 encoded.to_string(),
9928 error,
9929 ));
9930 }
9931 }
9932 };
9933
9934 dlg.finished(true);
9935 return Ok(response);
9936 }
9937 }
9938 }
9939 }
9940
9941 ///
9942 /// Sets the *request* property to the given value.
9943 ///
9944 /// Even though the property as already been set when instantiating this call,
9945 /// we provide this method for API completeness.
9946 pub fn request(
9947 mut self,
9948 new_value: StartBackfillJobRequest,
9949 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
9950 self._request = new_value;
9951 self
9952 }
9953 /// Required. The name of the stream object resource to start a backfill job for.
9954 ///
9955 /// Sets the *object* path property to the given value.
9956 ///
9957 /// Even though the property as already been set when instantiating this call,
9958 /// we provide this method for API completeness.
9959 pub fn object(
9960 mut self,
9961 new_value: &str,
9962 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
9963 self._object = new_value.to_string();
9964 self
9965 }
9966 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9967 /// while executing the actual API request.
9968 ///
9969 /// ````text
9970 /// It should be used to handle progress information, and to implement a certain level of resilience.
9971 /// ````
9972 ///
9973 /// Sets the *delegate* property to the given value.
9974 pub fn delegate(
9975 mut self,
9976 new_value: &'a mut dyn common::Delegate,
9977 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
9978 self._delegate = Some(new_value);
9979 self
9980 }
9981
9982 /// Set any additional parameter of the query string used in the request.
9983 /// It should be used to set parameters which are not yet available through their own
9984 /// setters.
9985 ///
9986 /// Please note that this method must not be used to set any of the known parameters
9987 /// which have their own setter method. If done anyway, the request will fail.
9988 ///
9989 /// # Additional Parameters
9990 ///
9991 /// * *$.xgafv* (query-string) - V1 error format.
9992 /// * *access_token* (query-string) - OAuth access token.
9993 /// * *alt* (query-string) - Data format for response.
9994 /// * *callback* (query-string) - JSONP
9995 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9996 /// * *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.
9997 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9998 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9999 /// * *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.
10000 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10001 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10002 pub fn param<T>(
10003 mut self,
10004 name: T,
10005 value: T,
10006 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
10007 where
10008 T: AsRef<str>,
10009 {
10010 self._additional_params
10011 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10012 self
10013 }
10014
10015 /// Identifies the authorization scope for the method you are building.
10016 ///
10017 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10018 /// [`Scope::CloudPlatform`].
10019 ///
10020 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10021 /// tokens for more than one scope.
10022 ///
10023 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10024 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10025 /// sufficient, a read-write scope will do as well.
10026 pub fn add_scope<St>(
10027 mut self,
10028 scope: St,
10029 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
10030 where
10031 St: AsRef<str>,
10032 {
10033 self._scopes.insert(String::from(scope.as_ref()));
10034 self
10035 }
10036 /// Identifies the authorization scope(s) for the method you are building.
10037 ///
10038 /// See [`Self::add_scope()`] for details.
10039 pub fn add_scopes<I, St>(
10040 mut self,
10041 scopes: I,
10042 ) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C>
10043 where
10044 I: IntoIterator<Item = St>,
10045 St: AsRef<str>,
10046 {
10047 self._scopes
10048 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10049 self
10050 }
10051
10052 /// Removes all scopes, and no default scope will be used either.
10053 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10054 /// for details).
10055 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectStartBackfillJobCall<'a, C> {
10056 self._scopes.clear();
10057 self
10058 }
10059}
10060
10061/// Use this method to stop a backfill job for the specified stream object.
10062///
10063/// A builder for the *locations.streams.objects.stopBackfillJob* method supported by a *project* resource.
10064/// It is not used directly, but through a [`ProjectMethods`] instance.
10065///
10066/// # Example
10067///
10068/// Instantiate a resource method builder
10069///
10070/// ```test_harness,no_run
10071/// # extern crate hyper;
10072/// # extern crate hyper_rustls;
10073/// # extern crate google_datastream1 as datastream1;
10074/// use datastream1::api::StopBackfillJobRequest;
10075/// # async fn dox() {
10076/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10077///
10078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10080/// # secret,
10081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10082/// # ).build().await.unwrap();
10083///
10084/// # let client = hyper_util::client::legacy::Client::builder(
10085/// # hyper_util::rt::TokioExecutor::new()
10086/// # )
10087/// # .build(
10088/// # hyper_rustls::HttpsConnectorBuilder::new()
10089/// # .with_native_roots()
10090/// # .unwrap()
10091/// # .https_or_http()
10092/// # .enable_http1()
10093/// # .build()
10094/// # );
10095/// # let mut hub = Datastream::new(client, auth);
10096/// // As the method needs a request, you would usually fill it with the desired information
10097/// // into the respective structure. Some of the parts shown here might not be applicable !
10098/// // Values shown here are possibly random and not representative !
10099/// let mut req = StopBackfillJobRequest::default();
10100///
10101/// // You can configure optional parameters by calling the respective setters at will, and
10102/// // execute the final call using `doit()`.
10103/// // Values shown here are possibly random and not representative !
10104/// let result = hub.projects().locations_streams_objects_stop_backfill_job(req, "object")
10105/// .doit().await;
10106/// # }
10107/// ```
10108pub struct ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
10109where
10110 C: 'a,
10111{
10112 hub: &'a Datastream<C>,
10113 _request: StopBackfillJobRequest,
10114 _object: String,
10115 _delegate: Option<&'a mut dyn common::Delegate>,
10116 _additional_params: HashMap<String, String>,
10117 _scopes: BTreeSet<String>,
10118}
10119
10120impl<'a, C> common::CallBuilder for ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {}
10121
10122impl<'a, C> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
10123where
10124 C: common::Connector,
10125{
10126 /// Perform the operation you have build so far.
10127 pub async fn doit(mut self) -> common::Result<(common::Response, StopBackfillJobResponse)> {
10128 use std::borrow::Cow;
10129 use std::io::{Read, Seek};
10130
10131 use common::{url::Params, ToParts};
10132 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10133
10134 let mut dd = common::DefaultDelegate;
10135 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10136 dlg.begin(common::MethodInfo {
10137 id: "datastream.projects.locations.streams.objects.stopBackfillJob",
10138 http_method: hyper::Method::POST,
10139 });
10140
10141 for &field in ["alt", "object"].iter() {
10142 if self._additional_params.contains_key(field) {
10143 dlg.finished(false);
10144 return Err(common::Error::FieldClash(field));
10145 }
10146 }
10147
10148 let mut params = Params::with_capacity(4 + self._additional_params.len());
10149 params.push("object", self._object);
10150
10151 params.extend(self._additional_params.iter());
10152
10153 params.push("alt", "json");
10154 let mut url = self.hub._base_url.clone() + "v1/{+object}:stopBackfillJob";
10155 if self._scopes.is_empty() {
10156 self._scopes
10157 .insert(Scope::CloudPlatform.as_ref().to_string());
10158 }
10159
10160 #[allow(clippy::single_element_loop)]
10161 for &(find_this, param_name) in [("{+object}", "object")].iter() {
10162 url = params.uri_replacement(url, param_name, find_this, true);
10163 }
10164 {
10165 let to_remove = ["object"];
10166 params.remove_params(&to_remove);
10167 }
10168
10169 let url = params.parse_with_url(&url);
10170
10171 let mut json_mime_type = mime::APPLICATION_JSON;
10172 let mut request_value_reader = {
10173 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10174 common::remove_json_null_values(&mut value);
10175 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10176 serde_json::to_writer(&mut dst, &value).unwrap();
10177 dst
10178 };
10179 let request_size = request_value_reader
10180 .seek(std::io::SeekFrom::End(0))
10181 .unwrap();
10182 request_value_reader
10183 .seek(std::io::SeekFrom::Start(0))
10184 .unwrap();
10185
10186 loop {
10187 let token = match self
10188 .hub
10189 .auth
10190 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10191 .await
10192 {
10193 Ok(token) => token,
10194 Err(e) => match dlg.token(e) {
10195 Ok(token) => token,
10196 Err(e) => {
10197 dlg.finished(false);
10198 return Err(common::Error::MissingToken(e));
10199 }
10200 },
10201 };
10202 request_value_reader
10203 .seek(std::io::SeekFrom::Start(0))
10204 .unwrap();
10205 let mut req_result = {
10206 let client = &self.hub.client;
10207 dlg.pre_request();
10208 let mut req_builder = hyper::Request::builder()
10209 .method(hyper::Method::POST)
10210 .uri(url.as_str())
10211 .header(USER_AGENT, self.hub._user_agent.clone());
10212
10213 if let Some(token) = token.as_ref() {
10214 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10215 }
10216
10217 let request = req_builder
10218 .header(CONTENT_TYPE, json_mime_type.to_string())
10219 .header(CONTENT_LENGTH, request_size as u64)
10220 .body(common::to_body(
10221 request_value_reader.get_ref().clone().into(),
10222 ));
10223
10224 client.request(request.unwrap()).await
10225 };
10226
10227 match req_result {
10228 Err(err) => {
10229 if let common::Retry::After(d) = dlg.http_error(&err) {
10230 sleep(d).await;
10231 continue;
10232 }
10233 dlg.finished(false);
10234 return Err(common::Error::HttpError(err));
10235 }
10236 Ok(res) => {
10237 let (mut parts, body) = res.into_parts();
10238 let mut body = common::Body::new(body);
10239 if !parts.status.is_success() {
10240 let bytes = common::to_bytes(body).await.unwrap_or_default();
10241 let error = serde_json::from_str(&common::to_string(&bytes));
10242 let response = common::to_response(parts, bytes.into());
10243
10244 if let common::Retry::After(d) =
10245 dlg.http_failure(&response, error.as_ref().ok())
10246 {
10247 sleep(d).await;
10248 continue;
10249 }
10250
10251 dlg.finished(false);
10252
10253 return Err(match error {
10254 Ok(value) => common::Error::BadRequest(value),
10255 _ => common::Error::Failure(response),
10256 });
10257 }
10258 let response = {
10259 let bytes = common::to_bytes(body).await.unwrap_or_default();
10260 let encoded = common::to_string(&bytes);
10261 match serde_json::from_str(&encoded) {
10262 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10263 Err(error) => {
10264 dlg.response_json_decode_error(&encoded, &error);
10265 return Err(common::Error::JsonDecodeError(
10266 encoded.to_string(),
10267 error,
10268 ));
10269 }
10270 }
10271 };
10272
10273 dlg.finished(true);
10274 return Ok(response);
10275 }
10276 }
10277 }
10278 }
10279
10280 ///
10281 /// Sets the *request* property to the given value.
10282 ///
10283 /// Even though the property as already been set when instantiating this call,
10284 /// we provide this method for API completeness.
10285 pub fn request(
10286 mut self,
10287 new_value: StopBackfillJobRequest,
10288 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
10289 self._request = new_value;
10290 self
10291 }
10292 /// Required. The name of the stream object resource to stop the backfill job for.
10293 ///
10294 /// Sets the *object* path property to the given value.
10295 ///
10296 /// Even though the property as already been set when instantiating this call,
10297 /// we provide this method for API completeness.
10298 pub fn object(
10299 mut self,
10300 new_value: &str,
10301 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
10302 self._object = new_value.to_string();
10303 self
10304 }
10305 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10306 /// while executing the actual API request.
10307 ///
10308 /// ````text
10309 /// It should be used to handle progress information, and to implement a certain level of resilience.
10310 /// ````
10311 ///
10312 /// Sets the *delegate* property to the given value.
10313 pub fn delegate(
10314 mut self,
10315 new_value: &'a mut dyn common::Delegate,
10316 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
10317 self._delegate = Some(new_value);
10318 self
10319 }
10320
10321 /// Set any additional parameter of the query string used in the request.
10322 /// It should be used to set parameters which are not yet available through their own
10323 /// setters.
10324 ///
10325 /// Please note that this method must not be used to set any of the known parameters
10326 /// which have their own setter method. If done anyway, the request will fail.
10327 ///
10328 /// # Additional Parameters
10329 ///
10330 /// * *$.xgafv* (query-string) - V1 error format.
10331 /// * *access_token* (query-string) - OAuth access token.
10332 /// * *alt* (query-string) - Data format for response.
10333 /// * *callback* (query-string) - JSONP
10334 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10335 /// * *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.
10336 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10337 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10338 /// * *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.
10339 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10340 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10341 pub fn param<T>(
10342 mut self,
10343 name: T,
10344 value: T,
10345 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
10346 where
10347 T: AsRef<str>,
10348 {
10349 self._additional_params
10350 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10351 self
10352 }
10353
10354 /// Identifies the authorization scope for the method you are building.
10355 ///
10356 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10357 /// [`Scope::CloudPlatform`].
10358 ///
10359 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10360 /// tokens for more than one scope.
10361 ///
10362 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10363 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10364 /// sufficient, a read-write scope will do as well.
10365 pub fn add_scope<St>(
10366 mut self,
10367 scope: St,
10368 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
10369 where
10370 St: AsRef<str>,
10371 {
10372 self._scopes.insert(String::from(scope.as_ref()));
10373 self
10374 }
10375 /// Identifies the authorization scope(s) for the method you are building.
10376 ///
10377 /// See [`Self::add_scope()`] for details.
10378 pub fn add_scopes<I, St>(
10379 mut self,
10380 scopes: I,
10381 ) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C>
10382 where
10383 I: IntoIterator<Item = St>,
10384 St: AsRef<str>,
10385 {
10386 self._scopes
10387 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10388 self
10389 }
10390
10391 /// Removes all scopes, and no default scope will be used either.
10392 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10393 /// for details).
10394 pub fn clear_scopes(mut self) -> ProjectLocationStreamObjectStopBackfillJobCall<'a, C> {
10395 self._scopes.clear();
10396 self
10397 }
10398}
10399
10400/// Use this method to create a stream.
10401///
10402/// A builder for the *locations.streams.create* method supported by a *project* resource.
10403/// It is not used directly, but through a [`ProjectMethods`] instance.
10404///
10405/// # Example
10406///
10407/// Instantiate a resource method builder
10408///
10409/// ```test_harness,no_run
10410/// # extern crate hyper;
10411/// # extern crate hyper_rustls;
10412/// # extern crate google_datastream1 as datastream1;
10413/// use datastream1::api::Stream;
10414/// # async fn dox() {
10415/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10416///
10417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10418/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10419/// # secret,
10420/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10421/// # ).build().await.unwrap();
10422///
10423/// # let client = hyper_util::client::legacy::Client::builder(
10424/// # hyper_util::rt::TokioExecutor::new()
10425/// # )
10426/// # .build(
10427/// # hyper_rustls::HttpsConnectorBuilder::new()
10428/// # .with_native_roots()
10429/// # .unwrap()
10430/// # .https_or_http()
10431/// # .enable_http1()
10432/// # .build()
10433/// # );
10434/// # let mut hub = Datastream::new(client, auth);
10435/// // As the method needs a request, you would usually fill it with the desired information
10436/// // into the respective structure. Some of the parts shown here might not be applicable !
10437/// // Values shown here are possibly random and not representative !
10438/// let mut req = Stream::default();
10439///
10440/// // You can configure optional parameters by calling the respective setters at will, and
10441/// // execute the final call using `doit()`.
10442/// // Values shown here are possibly random and not representative !
10443/// let result = hub.projects().locations_streams_create(req, "parent")
10444/// .validate_only(true)
10445/// .stream_id("et")
10446/// .request_id("accusam")
10447/// .force(false)
10448/// .doit().await;
10449/// # }
10450/// ```
10451pub struct ProjectLocationStreamCreateCall<'a, C>
10452where
10453 C: 'a,
10454{
10455 hub: &'a Datastream<C>,
10456 _request: Stream,
10457 _parent: String,
10458 _validate_only: Option<bool>,
10459 _stream_id: Option<String>,
10460 _request_id: Option<String>,
10461 _force: Option<bool>,
10462 _delegate: Option<&'a mut dyn common::Delegate>,
10463 _additional_params: HashMap<String, String>,
10464 _scopes: BTreeSet<String>,
10465}
10466
10467impl<'a, C> common::CallBuilder for ProjectLocationStreamCreateCall<'a, C> {}
10468
10469impl<'a, C> ProjectLocationStreamCreateCall<'a, C>
10470where
10471 C: common::Connector,
10472{
10473 /// Perform the operation you have build so far.
10474 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10475 use std::borrow::Cow;
10476 use std::io::{Read, Seek};
10477
10478 use common::{url::Params, ToParts};
10479 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10480
10481 let mut dd = common::DefaultDelegate;
10482 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10483 dlg.begin(common::MethodInfo {
10484 id: "datastream.projects.locations.streams.create",
10485 http_method: hyper::Method::POST,
10486 });
10487
10488 for &field in [
10489 "alt",
10490 "parent",
10491 "validateOnly",
10492 "streamId",
10493 "requestId",
10494 "force",
10495 ]
10496 .iter()
10497 {
10498 if self._additional_params.contains_key(field) {
10499 dlg.finished(false);
10500 return Err(common::Error::FieldClash(field));
10501 }
10502 }
10503
10504 let mut params = Params::with_capacity(8 + self._additional_params.len());
10505 params.push("parent", self._parent);
10506 if let Some(value) = self._validate_only.as_ref() {
10507 params.push("validateOnly", value.to_string());
10508 }
10509 if let Some(value) = self._stream_id.as_ref() {
10510 params.push("streamId", value);
10511 }
10512 if let Some(value) = self._request_id.as_ref() {
10513 params.push("requestId", value);
10514 }
10515 if let Some(value) = self._force.as_ref() {
10516 params.push("force", value.to_string());
10517 }
10518
10519 params.extend(self._additional_params.iter());
10520
10521 params.push("alt", "json");
10522 let mut url = self.hub._base_url.clone() + "v1/{+parent}/streams";
10523 if self._scopes.is_empty() {
10524 self._scopes
10525 .insert(Scope::CloudPlatform.as_ref().to_string());
10526 }
10527
10528 #[allow(clippy::single_element_loop)]
10529 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10530 url = params.uri_replacement(url, param_name, find_this, true);
10531 }
10532 {
10533 let to_remove = ["parent"];
10534 params.remove_params(&to_remove);
10535 }
10536
10537 let url = params.parse_with_url(&url);
10538
10539 let mut json_mime_type = mime::APPLICATION_JSON;
10540 let mut request_value_reader = {
10541 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10542 common::remove_json_null_values(&mut value);
10543 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10544 serde_json::to_writer(&mut dst, &value).unwrap();
10545 dst
10546 };
10547 let request_size = request_value_reader
10548 .seek(std::io::SeekFrom::End(0))
10549 .unwrap();
10550 request_value_reader
10551 .seek(std::io::SeekFrom::Start(0))
10552 .unwrap();
10553
10554 loop {
10555 let token = match self
10556 .hub
10557 .auth
10558 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10559 .await
10560 {
10561 Ok(token) => token,
10562 Err(e) => match dlg.token(e) {
10563 Ok(token) => token,
10564 Err(e) => {
10565 dlg.finished(false);
10566 return Err(common::Error::MissingToken(e));
10567 }
10568 },
10569 };
10570 request_value_reader
10571 .seek(std::io::SeekFrom::Start(0))
10572 .unwrap();
10573 let mut req_result = {
10574 let client = &self.hub.client;
10575 dlg.pre_request();
10576 let mut req_builder = hyper::Request::builder()
10577 .method(hyper::Method::POST)
10578 .uri(url.as_str())
10579 .header(USER_AGENT, self.hub._user_agent.clone());
10580
10581 if let Some(token) = token.as_ref() {
10582 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10583 }
10584
10585 let request = req_builder
10586 .header(CONTENT_TYPE, json_mime_type.to_string())
10587 .header(CONTENT_LENGTH, request_size as u64)
10588 .body(common::to_body(
10589 request_value_reader.get_ref().clone().into(),
10590 ));
10591
10592 client.request(request.unwrap()).await
10593 };
10594
10595 match req_result {
10596 Err(err) => {
10597 if let common::Retry::After(d) = dlg.http_error(&err) {
10598 sleep(d).await;
10599 continue;
10600 }
10601 dlg.finished(false);
10602 return Err(common::Error::HttpError(err));
10603 }
10604 Ok(res) => {
10605 let (mut parts, body) = res.into_parts();
10606 let mut body = common::Body::new(body);
10607 if !parts.status.is_success() {
10608 let bytes = common::to_bytes(body).await.unwrap_or_default();
10609 let error = serde_json::from_str(&common::to_string(&bytes));
10610 let response = common::to_response(parts, bytes.into());
10611
10612 if let common::Retry::After(d) =
10613 dlg.http_failure(&response, error.as_ref().ok())
10614 {
10615 sleep(d).await;
10616 continue;
10617 }
10618
10619 dlg.finished(false);
10620
10621 return Err(match error {
10622 Ok(value) => common::Error::BadRequest(value),
10623 _ => common::Error::Failure(response),
10624 });
10625 }
10626 let response = {
10627 let bytes = common::to_bytes(body).await.unwrap_or_default();
10628 let encoded = common::to_string(&bytes);
10629 match serde_json::from_str(&encoded) {
10630 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10631 Err(error) => {
10632 dlg.response_json_decode_error(&encoded, &error);
10633 return Err(common::Error::JsonDecodeError(
10634 encoded.to_string(),
10635 error,
10636 ));
10637 }
10638 }
10639 };
10640
10641 dlg.finished(true);
10642 return Ok(response);
10643 }
10644 }
10645 }
10646 }
10647
10648 ///
10649 /// Sets the *request* property to the given value.
10650 ///
10651 /// Even though the property as already been set when instantiating this call,
10652 /// we provide this method for API completeness.
10653 pub fn request(mut self, new_value: Stream) -> ProjectLocationStreamCreateCall<'a, C> {
10654 self._request = new_value;
10655 self
10656 }
10657 /// Required. The parent that owns the collection of streams.
10658 ///
10659 /// Sets the *parent* path property to the given value.
10660 ///
10661 /// Even though the property as already been set when instantiating this call,
10662 /// we provide this method for API completeness.
10663 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
10664 self._parent = new_value.to_string();
10665 self
10666 }
10667 /// Optional. Only validate the stream, but don't create any resources. The default is false.
10668 ///
10669 /// Sets the *validate only* query property to the given value.
10670 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationStreamCreateCall<'a, C> {
10671 self._validate_only = Some(new_value);
10672 self
10673 }
10674 /// Required. The stream identifier.
10675 ///
10676 /// Sets the *stream id* query property to the given value.
10677 pub fn stream_id(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
10678 self._stream_id = Some(new_value.to_string());
10679 self
10680 }
10681 /// 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).
10682 ///
10683 /// Sets the *request id* query property to the given value.
10684 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamCreateCall<'a, C> {
10685 self._request_id = Some(new_value.to_string());
10686 self
10687 }
10688 /// Optional. Create the stream without validating it.
10689 ///
10690 /// Sets the *force* query property to the given value.
10691 pub fn force(mut self, new_value: bool) -> ProjectLocationStreamCreateCall<'a, C> {
10692 self._force = Some(new_value);
10693 self
10694 }
10695 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10696 /// while executing the actual API request.
10697 ///
10698 /// ````text
10699 /// It should be used to handle progress information, and to implement a certain level of resilience.
10700 /// ````
10701 ///
10702 /// Sets the *delegate* property to the given value.
10703 pub fn delegate(
10704 mut self,
10705 new_value: &'a mut dyn common::Delegate,
10706 ) -> ProjectLocationStreamCreateCall<'a, C> {
10707 self._delegate = Some(new_value);
10708 self
10709 }
10710
10711 /// Set any additional parameter of the query string used in the request.
10712 /// It should be used to set parameters which are not yet available through their own
10713 /// setters.
10714 ///
10715 /// Please note that this method must not be used to set any of the known parameters
10716 /// which have their own setter method. If done anyway, the request will fail.
10717 ///
10718 /// # Additional Parameters
10719 ///
10720 /// * *$.xgafv* (query-string) - V1 error format.
10721 /// * *access_token* (query-string) - OAuth access token.
10722 /// * *alt* (query-string) - Data format for response.
10723 /// * *callback* (query-string) - JSONP
10724 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10725 /// * *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.
10726 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10727 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10728 /// * *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.
10729 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10730 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10731 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamCreateCall<'a, C>
10732 where
10733 T: AsRef<str>,
10734 {
10735 self._additional_params
10736 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10737 self
10738 }
10739
10740 /// Identifies the authorization scope for the method you are building.
10741 ///
10742 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10743 /// [`Scope::CloudPlatform`].
10744 ///
10745 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10746 /// tokens for more than one scope.
10747 ///
10748 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10749 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10750 /// sufficient, a read-write scope will do as well.
10751 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamCreateCall<'a, C>
10752 where
10753 St: AsRef<str>,
10754 {
10755 self._scopes.insert(String::from(scope.as_ref()));
10756 self
10757 }
10758 /// Identifies the authorization scope(s) for the method you are building.
10759 ///
10760 /// See [`Self::add_scope()`] for details.
10761 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamCreateCall<'a, C>
10762 where
10763 I: IntoIterator<Item = St>,
10764 St: AsRef<str>,
10765 {
10766 self._scopes
10767 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10768 self
10769 }
10770
10771 /// Removes all scopes, and no default scope will be used either.
10772 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10773 /// for details).
10774 pub fn clear_scopes(mut self) -> ProjectLocationStreamCreateCall<'a, C> {
10775 self._scopes.clear();
10776 self
10777 }
10778}
10779
10780/// Use this method to delete a stream.
10781///
10782/// A builder for the *locations.streams.delete* method supported by a *project* resource.
10783/// It is not used directly, but through a [`ProjectMethods`] instance.
10784///
10785/// # Example
10786///
10787/// Instantiate a resource method builder
10788///
10789/// ```test_harness,no_run
10790/// # extern crate hyper;
10791/// # extern crate hyper_rustls;
10792/// # extern crate google_datastream1 as datastream1;
10793/// # async fn dox() {
10794/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10795///
10796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10798/// # secret,
10799/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10800/// # ).build().await.unwrap();
10801///
10802/// # let client = hyper_util::client::legacy::Client::builder(
10803/// # hyper_util::rt::TokioExecutor::new()
10804/// # )
10805/// # .build(
10806/// # hyper_rustls::HttpsConnectorBuilder::new()
10807/// # .with_native_roots()
10808/// # .unwrap()
10809/// # .https_or_http()
10810/// # .enable_http1()
10811/// # .build()
10812/// # );
10813/// # let mut hub = Datastream::new(client, auth);
10814/// // You can configure optional parameters by calling the respective setters at will, and
10815/// // execute the final call using `doit()`.
10816/// // Values shown here are possibly random and not representative !
10817/// let result = hub.projects().locations_streams_delete("name")
10818/// .request_id("dolore")
10819/// .doit().await;
10820/// # }
10821/// ```
10822pub struct ProjectLocationStreamDeleteCall<'a, C>
10823where
10824 C: 'a,
10825{
10826 hub: &'a Datastream<C>,
10827 _name: String,
10828 _request_id: Option<String>,
10829 _delegate: Option<&'a mut dyn common::Delegate>,
10830 _additional_params: HashMap<String, String>,
10831 _scopes: BTreeSet<String>,
10832}
10833
10834impl<'a, C> common::CallBuilder for ProjectLocationStreamDeleteCall<'a, C> {}
10835
10836impl<'a, C> ProjectLocationStreamDeleteCall<'a, C>
10837where
10838 C: common::Connector,
10839{
10840 /// Perform the operation you have build so far.
10841 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10842 use std::borrow::Cow;
10843 use std::io::{Read, Seek};
10844
10845 use common::{url::Params, ToParts};
10846 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10847
10848 let mut dd = common::DefaultDelegate;
10849 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10850 dlg.begin(common::MethodInfo {
10851 id: "datastream.projects.locations.streams.delete",
10852 http_method: hyper::Method::DELETE,
10853 });
10854
10855 for &field in ["alt", "name", "requestId"].iter() {
10856 if self._additional_params.contains_key(field) {
10857 dlg.finished(false);
10858 return Err(common::Error::FieldClash(field));
10859 }
10860 }
10861
10862 let mut params = Params::with_capacity(4 + self._additional_params.len());
10863 params.push("name", self._name);
10864 if let Some(value) = self._request_id.as_ref() {
10865 params.push("requestId", value);
10866 }
10867
10868 params.extend(self._additional_params.iter());
10869
10870 params.push("alt", "json");
10871 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10872 if self._scopes.is_empty() {
10873 self._scopes
10874 .insert(Scope::CloudPlatform.as_ref().to_string());
10875 }
10876
10877 #[allow(clippy::single_element_loop)]
10878 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10879 url = params.uri_replacement(url, param_name, find_this, true);
10880 }
10881 {
10882 let to_remove = ["name"];
10883 params.remove_params(&to_remove);
10884 }
10885
10886 let url = params.parse_with_url(&url);
10887
10888 loop {
10889 let token = match self
10890 .hub
10891 .auth
10892 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10893 .await
10894 {
10895 Ok(token) => token,
10896 Err(e) => match dlg.token(e) {
10897 Ok(token) => token,
10898 Err(e) => {
10899 dlg.finished(false);
10900 return Err(common::Error::MissingToken(e));
10901 }
10902 },
10903 };
10904 let mut req_result = {
10905 let client = &self.hub.client;
10906 dlg.pre_request();
10907 let mut req_builder = hyper::Request::builder()
10908 .method(hyper::Method::DELETE)
10909 .uri(url.as_str())
10910 .header(USER_AGENT, self.hub._user_agent.clone());
10911
10912 if let Some(token) = token.as_ref() {
10913 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10914 }
10915
10916 let request = req_builder
10917 .header(CONTENT_LENGTH, 0_u64)
10918 .body(common::to_body::<String>(None));
10919
10920 client.request(request.unwrap()).await
10921 };
10922
10923 match req_result {
10924 Err(err) => {
10925 if let common::Retry::After(d) = dlg.http_error(&err) {
10926 sleep(d).await;
10927 continue;
10928 }
10929 dlg.finished(false);
10930 return Err(common::Error::HttpError(err));
10931 }
10932 Ok(res) => {
10933 let (mut parts, body) = res.into_parts();
10934 let mut body = common::Body::new(body);
10935 if !parts.status.is_success() {
10936 let bytes = common::to_bytes(body).await.unwrap_or_default();
10937 let error = serde_json::from_str(&common::to_string(&bytes));
10938 let response = common::to_response(parts, bytes.into());
10939
10940 if let common::Retry::After(d) =
10941 dlg.http_failure(&response, error.as_ref().ok())
10942 {
10943 sleep(d).await;
10944 continue;
10945 }
10946
10947 dlg.finished(false);
10948
10949 return Err(match error {
10950 Ok(value) => common::Error::BadRequest(value),
10951 _ => common::Error::Failure(response),
10952 });
10953 }
10954 let response = {
10955 let bytes = common::to_bytes(body).await.unwrap_or_default();
10956 let encoded = common::to_string(&bytes);
10957 match serde_json::from_str(&encoded) {
10958 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10959 Err(error) => {
10960 dlg.response_json_decode_error(&encoded, &error);
10961 return Err(common::Error::JsonDecodeError(
10962 encoded.to_string(),
10963 error,
10964 ));
10965 }
10966 }
10967 };
10968
10969 dlg.finished(true);
10970 return Ok(response);
10971 }
10972 }
10973 }
10974 }
10975
10976 /// Required. The name of the stream resource to delete.
10977 ///
10978 /// Sets the *name* path property to the given value.
10979 ///
10980 /// Even though the property as already been set when instantiating this call,
10981 /// we provide this method for API completeness.
10982 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
10983 self._name = new_value.to_string();
10984 self
10985 }
10986 /// 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).
10987 ///
10988 /// Sets the *request id* query property to the given value.
10989 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamDeleteCall<'a, C> {
10990 self._request_id = Some(new_value.to_string());
10991 self
10992 }
10993 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10994 /// while executing the actual API request.
10995 ///
10996 /// ````text
10997 /// It should be used to handle progress information, and to implement a certain level of resilience.
10998 /// ````
10999 ///
11000 /// Sets the *delegate* property to the given value.
11001 pub fn delegate(
11002 mut self,
11003 new_value: &'a mut dyn common::Delegate,
11004 ) -> ProjectLocationStreamDeleteCall<'a, C> {
11005 self._delegate = Some(new_value);
11006 self
11007 }
11008
11009 /// Set any additional parameter of the query string used in the request.
11010 /// It should be used to set parameters which are not yet available through their own
11011 /// setters.
11012 ///
11013 /// Please note that this method must not be used to set any of the known parameters
11014 /// which have their own setter method. If done anyway, the request will fail.
11015 ///
11016 /// # Additional Parameters
11017 ///
11018 /// * *$.xgafv* (query-string) - V1 error format.
11019 /// * *access_token* (query-string) - OAuth access token.
11020 /// * *alt* (query-string) - Data format for response.
11021 /// * *callback* (query-string) - JSONP
11022 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11023 /// * *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.
11024 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11025 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11026 /// * *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.
11027 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11028 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11029 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamDeleteCall<'a, C>
11030 where
11031 T: AsRef<str>,
11032 {
11033 self._additional_params
11034 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11035 self
11036 }
11037
11038 /// Identifies the authorization scope for the method you are building.
11039 ///
11040 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11041 /// [`Scope::CloudPlatform`].
11042 ///
11043 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11044 /// tokens for more than one scope.
11045 ///
11046 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11047 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11048 /// sufficient, a read-write scope will do as well.
11049 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamDeleteCall<'a, C>
11050 where
11051 St: AsRef<str>,
11052 {
11053 self._scopes.insert(String::from(scope.as_ref()));
11054 self
11055 }
11056 /// Identifies the authorization scope(s) for the method you are building.
11057 ///
11058 /// See [`Self::add_scope()`] for details.
11059 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamDeleteCall<'a, C>
11060 where
11061 I: IntoIterator<Item = St>,
11062 St: AsRef<str>,
11063 {
11064 self._scopes
11065 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11066 self
11067 }
11068
11069 /// Removes all scopes, and no default scope will be used either.
11070 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11071 /// for details).
11072 pub fn clear_scopes(mut self) -> ProjectLocationStreamDeleteCall<'a, C> {
11073 self._scopes.clear();
11074 self
11075 }
11076}
11077
11078/// Use this method to get details about a stream.
11079///
11080/// A builder for the *locations.streams.get* method supported by a *project* resource.
11081/// It is not used directly, but through a [`ProjectMethods`] instance.
11082///
11083/// # Example
11084///
11085/// Instantiate a resource method builder
11086///
11087/// ```test_harness,no_run
11088/// # extern crate hyper;
11089/// # extern crate hyper_rustls;
11090/// # extern crate google_datastream1 as datastream1;
11091/// # async fn dox() {
11092/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11093///
11094/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11096/// # secret,
11097/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11098/// # ).build().await.unwrap();
11099///
11100/// # let client = hyper_util::client::legacy::Client::builder(
11101/// # hyper_util::rt::TokioExecutor::new()
11102/// # )
11103/// # .build(
11104/// # hyper_rustls::HttpsConnectorBuilder::new()
11105/// # .with_native_roots()
11106/// # .unwrap()
11107/// # .https_or_http()
11108/// # .enable_http1()
11109/// # .build()
11110/// # );
11111/// # let mut hub = Datastream::new(client, auth);
11112/// // You can configure optional parameters by calling the respective setters at will, and
11113/// // execute the final call using `doit()`.
11114/// // Values shown here are possibly random and not representative !
11115/// let result = hub.projects().locations_streams_get("name")
11116/// .doit().await;
11117/// # }
11118/// ```
11119pub struct ProjectLocationStreamGetCall<'a, C>
11120where
11121 C: 'a,
11122{
11123 hub: &'a Datastream<C>,
11124 _name: String,
11125 _delegate: Option<&'a mut dyn common::Delegate>,
11126 _additional_params: HashMap<String, String>,
11127 _scopes: BTreeSet<String>,
11128}
11129
11130impl<'a, C> common::CallBuilder for ProjectLocationStreamGetCall<'a, C> {}
11131
11132impl<'a, C> ProjectLocationStreamGetCall<'a, C>
11133where
11134 C: common::Connector,
11135{
11136 /// Perform the operation you have build so far.
11137 pub async fn doit(mut self) -> common::Result<(common::Response, Stream)> {
11138 use std::borrow::Cow;
11139 use std::io::{Read, Seek};
11140
11141 use common::{url::Params, ToParts};
11142 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11143
11144 let mut dd = common::DefaultDelegate;
11145 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11146 dlg.begin(common::MethodInfo {
11147 id: "datastream.projects.locations.streams.get",
11148 http_method: hyper::Method::GET,
11149 });
11150
11151 for &field in ["alt", "name"].iter() {
11152 if self._additional_params.contains_key(field) {
11153 dlg.finished(false);
11154 return Err(common::Error::FieldClash(field));
11155 }
11156 }
11157
11158 let mut params = Params::with_capacity(3 + self._additional_params.len());
11159 params.push("name", self._name);
11160
11161 params.extend(self._additional_params.iter());
11162
11163 params.push("alt", "json");
11164 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11165 if self._scopes.is_empty() {
11166 self._scopes
11167 .insert(Scope::CloudPlatform.as_ref().to_string());
11168 }
11169
11170 #[allow(clippy::single_element_loop)]
11171 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11172 url = params.uri_replacement(url, param_name, find_this, true);
11173 }
11174 {
11175 let to_remove = ["name"];
11176 params.remove_params(&to_remove);
11177 }
11178
11179 let url = params.parse_with_url(&url);
11180
11181 loop {
11182 let token = match self
11183 .hub
11184 .auth
11185 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11186 .await
11187 {
11188 Ok(token) => token,
11189 Err(e) => match dlg.token(e) {
11190 Ok(token) => token,
11191 Err(e) => {
11192 dlg.finished(false);
11193 return Err(common::Error::MissingToken(e));
11194 }
11195 },
11196 };
11197 let mut req_result = {
11198 let client = &self.hub.client;
11199 dlg.pre_request();
11200 let mut req_builder = hyper::Request::builder()
11201 .method(hyper::Method::GET)
11202 .uri(url.as_str())
11203 .header(USER_AGENT, self.hub._user_agent.clone());
11204
11205 if let Some(token) = token.as_ref() {
11206 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11207 }
11208
11209 let request = req_builder
11210 .header(CONTENT_LENGTH, 0_u64)
11211 .body(common::to_body::<String>(None));
11212
11213 client.request(request.unwrap()).await
11214 };
11215
11216 match req_result {
11217 Err(err) => {
11218 if let common::Retry::After(d) = dlg.http_error(&err) {
11219 sleep(d).await;
11220 continue;
11221 }
11222 dlg.finished(false);
11223 return Err(common::Error::HttpError(err));
11224 }
11225 Ok(res) => {
11226 let (mut parts, body) = res.into_parts();
11227 let mut body = common::Body::new(body);
11228 if !parts.status.is_success() {
11229 let bytes = common::to_bytes(body).await.unwrap_or_default();
11230 let error = serde_json::from_str(&common::to_string(&bytes));
11231 let response = common::to_response(parts, bytes.into());
11232
11233 if let common::Retry::After(d) =
11234 dlg.http_failure(&response, error.as_ref().ok())
11235 {
11236 sleep(d).await;
11237 continue;
11238 }
11239
11240 dlg.finished(false);
11241
11242 return Err(match error {
11243 Ok(value) => common::Error::BadRequest(value),
11244 _ => common::Error::Failure(response),
11245 });
11246 }
11247 let response = {
11248 let bytes = common::to_bytes(body).await.unwrap_or_default();
11249 let encoded = common::to_string(&bytes);
11250 match serde_json::from_str(&encoded) {
11251 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11252 Err(error) => {
11253 dlg.response_json_decode_error(&encoded, &error);
11254 return Err(common::Error::JsonDecodeError(
11255 encoded.to_string(),
11256 error,
11257 ));
11258 }
11259 }
11260 };
11261
11262 dlg.finished(true);
11263 return Ok(response);
11264 }
11265 }
11266 }
11267 }
11268
11269 /// Required. The name of the stream resource to get.
11270 ///
11271 /// Sets the *name* path property to the given value.
11272 ///
11273 /// Even though the property as already been set when instantiating this call,
11274 /// we provide this method for API completeness.
11275 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamGetCall<'a, C> {
11276 self._name = new_value.to_string();
11277 self
11278 }
11279 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11280 /// while executing the actual API request.
11281 ///
11282 /// ````text
11283 /// It should be used to handle progress information, and to implement a certain level of resilience.
11284 /// ````
11285 ///
11286 /// Sets the *delegate* property to the given value.
11287 pub fn delegate(
11288 mut self,
11289 new_value: &'a mut dyn common::Delegate,
11290 ) -> ProjectLocationStreamGetCall<'a, C> {
11291 self._delegate = Some(new_value);
11292 self
11293 }
11294
11295 /// Set any additional parameter of the query string used in the request.
11296 /// It should be used to set parameters which are not yet available through their own
11297 /// setters.
11298 ///
11299 /// Please note that this method must not be used to set any of the known parameters
11300 /// which have their own setter method. If done anyway, the request will fail.
11301 ///
11302 /// # Additional Parameters
11303 ///
11304 /// * *$.xgafv* (query-string) - V1 error format.
11305 /// * *access_token* (query-string) - OAuth access token.
11306 /// * *alt* (query-string) - Data format for response.
11307 /// * *callback* (query-string) - JSONP
11308 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11309 /// * *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.
11310 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11311 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11312 /// * *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.
11313 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11314 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11315 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamGetCall<'a, C>
11316 where
11317 T: AsRef<str>,
11318 {
11319 self._additional_params
11320 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11321 self
11322 }
11323
11324 /// Identifies the authorization scope for the method you are building.
11325 ///
11326 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11327 /// [`Scope::CloudPlatform`].
11328 ///
11329 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11330 /// tokens for more than one scope.
11331 ///
11332 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11333 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11334 /// sufficient, a read-write scope will do as well.
11335 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamGetCall<'a, C>
11336 where
11337 St: AsRef<str>,
11338 {
11339 self._scopes.insert(String::from(scope.as_ref()));
11340 self
11341 }
11342 /// Identifies the authorization scope(s) for the method you are building.
11343 ///
11344 /// See [`Self::add_scope()`] for details.
11345 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamGetCall<'a, C>
11346 where
11347 I: IntoIterator<Item = St>,
11348 St: AsRef<str>,
11349 {
11350 self._scopes
11351 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11352 self
11353 }
11354
11355 /// Removes all scopes, and no default scope will be used either.
11356 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11357 /// for details).
11358 pub fn clear_scopes(mut self) -> ProjectLocationStreamGetCall<'a, C> {
11359 self._scopes.clear();
11360 self
11361 }
11362}
11363
11364/// Use this method to list streams in a project and location.
11365///
11366/// A builder for the *locations.streams.list* method supported by a *project* resource.
11367/// It is not used directly, but through a [`ProjectMethods`] instance.
11368///
11369/// # Example
11370///
11371/// Instantiate a resource method builder
11372///
11373/// ```test_harness,no_run
11374/// # extern crate hyper;
11375/// # extern crate hyper_rustls;
11376/// # extern crate google_datastream1 as datastream1;
11377/// # async fn dox() {
11378/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11379///
11380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11381/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11382/// # secret,
11383/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11384/// # ).build().await.unwrap();
11385///
11386/// # let client = hyper_util::client::legacy::Client::builder(
11387/// # hyper_util::rt::TokioExecutor::new()
11388/// # )
11389/// # .build(
11390/// # hyper_rustls::HttpsConnectorBuilder::new()
11391/// # .with_native_roots()
11392/// # .unwrap()
11393/// # .https_or_http()
11394/// # .enable_http1()
11395/// # .build()
11396/// # );
11397/// # let mut hub = Datastream::new(client, auth);
11398/// // You can configure optional parameters by calling the respective setters at will, and
11399/// // execute the final call using `doit()`.
11400/// // Values shown here are possibly random and not representative !
11401/// let result = hub.projects().locations_streams_list("parent")
11402/// .page_token("amet.")
11403/// .page_size(-17)
11404/// .order_by("sadipscing")
11405/// .filter("Lorem")
11406/// .doit().await;
11407/// # }
11408/// ```
11409pub struct ProjectLocationStreamListCall<'a, C>
11410where
11411 C: 'a,
11412{
11413 hub: &'a Datastream<C>,
11414 _parent: String,
11415 _page_token: Option<String>,
11416 _page_size: Option<i32>,
11417 _order_by: Option<String>,
11418 _filter: Option<String>,
11419 _delegate: Option<&'a mut dyn common::Delegate>,
11420 _additional_params: HashMap<String, String>,
11421 _scopes: BTreeSet<String>,
11422}
11423
11424impl<'a, C> common::CallBuilder for ProjectLocationStreamListCall<'a, C> {}
11425
11426impl<'a, C> ProjectLocationStreamListCall<'a, C>
11427where
11428 C: common::Connector,
11429{
11430 /// Perform the operation you have build so far.
11431 pub async fn doit(mut self) -> common::Result<(common::Response, ListStreamsResponse)> {
11432 use std::borrow::Cow;
11433 use std::io::{Read, Seek};
11434
11435 use common::{url::Params, ToParts};
11436 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11437
11438 let mut dd = common::DefaultDelegate;
11439 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11440 dlg.begin(common::MethodInfo {
11441 id: "datastream.projects.locations.streams.list",
11442 http_method: hyper::Method::GET,
11443 });
11444
11445 for &field in [
11446 "alt",
11447 "parent",
11448 "pageToken",
11449 "pageSize",
11450 "orderBy",
11451 "filter",
11452 ]
11453 .iter()
11454 {
11455 if self._additional_params.contains_key(field) {
11456 dlg.finished(false);
11457 return Err(common::Error::FieldClash(field));
11458 }
11459 }
11460
11461 let mut params = Params::with_capacity(7 + self._additional_params.len());
11462 params.push("parent", self._parent);
11463 if let Some(value) = self._page_token.as_ref() {
11464 params.push("pageToken", value);
11465 }
11466 if let Some(value) = self._page_size.as_ref() {
11467 params.push("pageSize", value.to_string());
11468 }
11469 if let Some(value) = self._order_by.as_ref() {
11470 params.push("orderBy", value);
11471 }
11472 if let Some(value) = self._filter.as_ref() {
11473 params.push("filter", value);
11474 }
11475
11476 params.extend(self._additional_params.iter());
11477
11478 params.push("alt", "json");
11479 let mut url = self.hub._base_url.clone() + "v1/{+parent}/streams";
11480 if self._scopes.is_empty() {
11481 self._scopes
11482 .insert(Scope::CloudPlatform.as_ref().to_string());
11483 }
11484
11485 #[allow(clippy::single_element_loop)]
11486 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11487 url = params.uri_replacement(url, param_name, find_this, true);
11488 }
11489 {
11490 let to_remove = ["parent"];
11491 params.remove_params(&to_remove);
11492 }
11493
11494 let url = params.parse_with_url(&url);
11495
11496 loop {
11497 let token = match self
11498 .hub
11499 .auth
11500 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11501 .await
11502 {
11503 Ok(token) => token,
11504 Err(e) => match dlg.token(e) {
11505 Ok(token) => token,
11506 Err(e) => {
11507 dlg.finished(false);
11508 return Err(common::Error::MissingToken(e));
11509 }
11510 },
11511 };
11512 let mut req_result = {
11513 let client = &self.hub.client;
11514 dlg.pre_request();
11515 let mut req_builder = hyper::Request::builder()
11516 .method(hyper::Method::GET)
11517 .uri(url.as_str())
11518 .header(USER_AGENT, self.hub._user_agent.clone());
11519
11520 if let Some(token) = token.as_ref() {
11521 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11522 }
11523
11524 let request = req_builder
11525 .header(CONTENT_LENGTH, 0_u64)
11526 .body(common::to_body::<String>(None));
11527
11528 client.request(request.unwrap()).await
11529 };
11530
11531 match req_result {
11532 Err(err) => {
11533 if let common::Retry::After(d) = dlg.http_error(&err) {
11534 sleep(d).await;
11535 continue;
11536 }
11537 dlg.finished(false);
11538 return Err(common::Error::HttpError(err));
11539 }
11540 Ok(res) => {
11541 let (mut parts, body) = res.into_parts();
11542 let mut body = common::Body::new(body);
11543 if !parts.status.is_success() {
11544 let bytes = common::to_bytes(body).await.unwrap_or_default();
11545 let error = serde_json::from_str(&common::to_string(&bytes));
11546 let response = common::to_response(parts, bytes.into());
11547
11548 if let common::Retry::After(d) =
11549 dlg.http_failure(&response, error.as_ref().ok())
11550 {
11551 sleep(d).await;
11552 continue;
11553 }
11554
11555 dlg.finished(false);
11556
11557 return Err(match error {
11558 Ok(value) => common::Error::BadRequest(value),
11559 _ => common::Error::Failure(response),
11560 });
11561 }
11562 let response = {
11563 let bytes = common::to_bytes(body).await.unwrap_or_default();
11564 let encoded = common::to_string(&bytes);
11565 match serde_json::from_str(&encoded) {
11566 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11567 Err(error) => {
11568 dlg.response_json_decode_error(&encoded, &error);
11569 return Err(common::Error::JsonDecodeError(
11570 encoded.to_string(),
11571 error,
11572 ));
11573 }
11574 }
11575 };
11576
11577 dlg.finished(true);
11578 return Ok(response);
11579 }
11580 }
11581 }
11582 }
11583
11584 /// Required. The parent that owns the collection of streams.
11585 ///
11586 /// Sets the *parent* path property to the given value.
11587 ///
11588 /// Even though the property as already been set when instantiating this call,
11589 /// we provide this method for API completeness.
11590 pub fn parent(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
11591 self._parent = new_value.to_string();
11592 self
11593 }
11594 /// 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.
11595 ///
11596 /// Sets the *page token* query property to the given value.
11597 pub fn page_token(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
11598 self._page_token = Some(new_value.to_string());
11599 self
11600 }
11601 /// 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.
11602 ///
11603 /// Sets the *page size* query property to the given value.
11604 pub fn page_size(mut self, new_value: i32) -> ProjectLocationStreamListCall<'a, C> {
11605 self._page_size = Some(new_value);
11606 self
11607 }
11608 /// Order by fields for the result.
11609 ///
11610 /// Sets the *order by* query property to the given value.
11611 pub fn order_by(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
11612 self._order_by = Some(new_value.to_string());
11613 self
11614 }
11615 /// Filter request.
11616 ///
11617 /// Sets the *filter* query property to the given value.
11618 pub fn filter(mut self, new_value: &str) -> ProjectLocationStreamListCall<'a, C> {
11619 self._filter = Some(new_value.to_string());
11620 self
11621 }
11622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11623 /// while executing the actual API request.
11624 ///
11625 /// ````text
11626 /// It should be used to handle progress information, and to implement a certain level of resilience.
11627 /// ````
11628 ///
11629 /// Sets the *delegate* property to the given value.
11630 pub fn delegate(
11631 mut self,
11632 new_value: &'a mut dyn common::Delegate,
11633 ) -> ProjectLocationStreamListCall<'a, C> {
11634 self._delegate = Some(new_value);
11635 self
11636 }
11637
11638 /// Set any additional parameter of the query string used in the request.
11639 /// It should be used to set parameters which are not yet available through their own
11640 /// setters.
11641 ///
11642 /// Please note that this method must not be used to set any of the known parameters
11643 /// which have their own setter method. If done anyway, the request will fail.
11644 ///
11645 /// # Additional Parameters
11646 ///
11647 /// * *$.xgafv* (query-string) - V1 error format.
11648 /// * *access_token* (query-string) - OAuth access token.
11649 /// * *alt* (query-string) - Data format for response.
11650 /// * *callback* (query-string) - JSONP
11651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11652 /// * *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.
11653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11655 /// * *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.
11656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11658 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamListCall<'a, C>
11659 where
11660 T: AsRef<str>,
11661 {
11662 self._additional_params
11663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11664 self
11665 }
11666
11667 /// Identifies the authorization scope for the method you are building.
11668 ///
11669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11670 /// [`Scope::CloudPlatform`].
11671 ///
11672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11673 /// tokens for more than one scope.
11674 ///
11675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11677 /// sufficient, a read-write scope will do as well.
11678 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamListCall<'a, C>
11679 where
11680 St: AsRef<str>,
11681 {
11682 self._scopes.insert(String::from(scope.as_ref()));
11683 self
11684 }
11685 /// Identifies the authorization scope(s) for the method you are building.
11686 ///
11687 /// See [`Self::add_scope()`] for details.
11688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamListCall<'a, C>
11689 where
11690 I: IntoIterator<Item = St>,
11691 St: AsRef<str>,
11692 {
11693 self._scopes
11694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11695 self
11696 }
11697
11698 /// Removes all scopes, and no default scope will be used either.
11699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11700 /// for details).
11701 pub fn clear_scopes(mut self) -> ProjectLocationStreamListCall<'a, C> {
11702 self._scopes.clear();
11703 self
11704 }
11705}
11706
11707/// Use this method to update the configuration of a stream.
11708///
11709/// A builder for the *locations.streams.patch* method supported by a *project* resource.
11710/// It is not used directly, but through a [`ProjectMethods`] instance.
11711///
11712/// # Example
11713///
11714/// Instantiate a resource method builder
11715///
11716/// ```test_harness,no_run
11717/// # extern crate hyper;
11718/// # extern crate hyper_rustls;
11719/// # extern crate google_datastream1 as datastream1;
11720/// use datastream1::api::Stream;
11721/// # async fn dox() {
11722/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11723///
11724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11726/// # secret,
11727/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11728/// # ).build().await.unwrap();
11729///
11730/// # let client = hyper_util::client::legacy::Client::builder(
11731/// # hyper_util::rt::TokioExecutor::new()
11732/// # )
11733/// # .build(
11734/// # hyper_rustls::HttpsConnectorBuilder::new()
11735/// # .with_native_roots()
11736/// # .unwrap()
11737/// # .https_or_http()
11738/// # .enable_http1()
11739/// # .build()
11740/// # );
11741/// # let mut hub = Datastream::new(client, auth);
11742/// // As the method needs a request, you would usually fill it with the desired information
11743/// // into the respective structure. Some of the parts shown here might not be applicable !
11744/// // Values shown here are possibly random and not representative !
11745/// let mut req = Stream::default();
11746///
11747/// // You can configure optional parameters by calling the respective setters at will, and
11748/// // execute the final call using `doit()`.
11749/// // Values shown here are possibly random and not representative !
11750/// let result = hub.projects().locations_streams_patch(req, "name")
11751/// .validate_only(true)
11752/// .update_mask(FieldMask::new::<&str>(&[]))
11753/// .request_id("sit")
11754/// .force(true)
11755/// .doit().await;
11756/// # }
11757/// ```
11758pub struct ProjectLocationStreamPatchCall<'a, C>
11759where
11760 C: 'a,
11761{
11762 hub: &'a Datastream<C>,
11763 _request: Stream,
11764 _name: String,
11765 _validate_only: Option<bool>,
11766 _update_mask: Option<common::FieldMask>,
11767 _request_id: Option<String>,
11768 _force: Option<bool>,
11769 _delegate: Option<&'a mut dyn common::Delegate>,
11770 _additional_params: HashMap<String, String>,
11771 _scopes: BTreeSet<String>,
11772}
11773
11774impl<'a, C> common::CallBuilder for ProjectLocationStreamPatchCall<'a, C> {}
11775
11776impl<'a, C> ProjectLocationStreamPatchCall<'a, C>
11777where
11778 C: common::Connector,
11779{
11780 /// Perform the operation you have build so far.
11781 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11782 use std::borrow::Cow;
11783 use std::io::{Read, Seek};
11784
11785 use common::{url::Params, ToParts};
11786 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11787
11788 let mut dd = common::DefaultDelegate;
11789 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11790 dlg.begin(common::MethodInfo {
11791 id: "datastream.projects.locations.streams.patch",
11792 http_method: hyper::Method::PATCH,
11793 });
11794
11795 for &field in [
11796 "alt",
11797 "name",
11798 "validateOnly",
11799 "updateMask",
11800 "requestId",
11801 "force",
11802 ]
11803 .iter()
11804 {
11805 if self._additional_params.contains_key(field) {
11806 dlg.finished(false);
11807 return Err(common::Error::FieldClash(field));
11808 }
11809 }
11810
11811 let mut params = Params::with_capacity(8 + self._additional_params.len());
11812 params.push("name", self._name);
11813 if let Some(value) = self._validate_only.as_ref() {
11814 params.push("validateOnly", value.to_string());
11815 }
11816 if let Some(value) = self._update_mask.as_ref() {
11817 params.push("updateMask", value.to_string());
11818 }
11819 if let Some(value) = self._request_id.as_ref() {
11820 params.push("requestId", value);
11821 }
11822 if let Some(value) = self._force.as_ref() {
11823 params.push("force", value.to_string());
11824 }
11825
11826 params.extend(self._additional_params.iter());
11827
11828 params.push("alt", "json");
11829 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11830 if self._scopes.is_empty() {
11831 self._scopes
11832 .insert(Scope::CloudPlatform.as_ref().to_string());
11833 }
11834
11835 #[allow(clippy::single_element_loop)]
11836 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11837 url = params.uri_replacement(url, param_name, find_this, true);
11838 }
11839 {
11840 let to_remove = ["name"];
11841 params.remove_params(&to_remove);
11842 }
11843
11844 let url = params.parse_with_url(&url);
11845
11846 let mut json_mime_type = mime::APPLICATION_JSON;
11847 let mut request_value_reader = {
11848 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11849 common::remove_json_null_values(&mut value);
11850 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11851 serde_json::to_writer(&mut dst, &value).unwrap();
11852 dst
11853 };
11854 let request_size = request_value_reader
11855 .seek(std::io::SeekFrom::End(0))
11856 .unwrap();
11857 request_value_reader
11858 .seek(std::io::SeekFrom::Start(0))
11859 .unwrap();
11860
11861 loop {
11862 let token = match self
11863 .hub
11864 .auth
11865 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11866 .await
11867 {
11868 Ok(token) => token,
11869 Err(e) => match dlg.token(e) {
11870 Ok(token) => token,
11871 Err(e) => {
11872 dlg.finished(false);
11873 return Err(common::Error::MissingToken(e));
11874 }
11875 },
11876 };
11877 request_value_reader
11878 .seek(std::io::SeekFrom::Start(0))
11879 .unwrap();
11880 let mut req_result = {
11881 let client = &self.hub.client;
11882 dlg.pre_request();
11883 let mut req_builder = hyper::Request::builder()
11884 .method(hyper::Method::PATCH)
11885 .uri(url.as_str())
11886 .header(USER_AGENT, self.hub._user_agent.clone());
11887
11888 if let Some(token) = token.as_ref() {
11889 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11890 }
11891
11892 let request = req_builder
11893 .header(CONTENT_TYPE, json_mime_type.to_string())
11894 .header(CONTENT_LENGTH, request_size as u64)
11895 .body(common::to_body(
11896 request_value_reader.get_ref().clone().into(),
11897 ));
11898
11899 client.request(request.unwrap()).await
11900 };
11901
11902 match req_result {
11903 Err(err) => {
11904 if let common::Retry::After(d) = dlg.http_error(&err) {
11905 sleep(d).await;
11906 continue;
11907 }
11908 dlg.finished(false);
11909 return Err(common::Error::HttpError(err));
11910 }
11911 Ok(res) => {
11912 let (mut parts, body) = res.into_parts();
11913 let mut body = common::Body::new(body);
11914 if !parts.status.is_success() {
11915 let bytes = common::to_bytes(body).await.unwrap_or_default();
11916 let error = serde_json::from_str(&common::to_string(&bytes));
11917 let response = common::to_response(parts, bytes.into());
11918
11919 if let common::Retry::After(d) =
11920 dlg.http_failure(&response, error.as_ref().ok())
11921 {
11922 sleep(d).await;
11923 continue;
11924 }
11925
11926 dlg.finished(false);
11927
11928 return Err(match error {
11929 Ok(value) => common::Error::BadRequest(value),
11930 _ => common::Error::Failure(response),
11931 });
11932 }
11933 let response = {
11934 let bytes = common::to_bytes(body).await.unwrap_or_default();
11935 let encoded = common::to_string(&bytes);
11936 match serde_json::from_str(&encoded) {
11937 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11938 Err(error) => {
11939 dlg.response_json_decode_error(&encoded, &error);
11940 return Err(common::Error::JsonDecodeError(
11941 encoded.to_string(),
11942 error,
11943 ));
11944 }
11945 }
11946 };
11947
11948 dlg.finished(true);
11949 return Ok(response);
11950 }
11951 }
11952 }
11953 }
11954
11955 ///
11956 /// Sets the *request* property to the given value.
11957 ///
11958 /// Even though the property as already been set when instantiating this call,
11959 /// we provide this method for API completeness.
11960 pub fn request(mut self, new_value: Stream) -> ProjectLocationStreamPatchCall<'a, C> {
11961 self._request = new_value;
11962 self
11963 }
11964 /// Output only. The stream's name.
11965 ///
11966 /// Sets the *name* path property to the given value.
11967 ///
11968 /// Even though the property as already been set when instantiating this call,
11969 /// we provide this method for API completeness.
11970 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamPatchCall<'a, C> {
11971 self._name = new_value.to_string();
11972 self
11973 }
11974 /// Optional. Only validate the stream with the changes, without actually updating it. The default is false.
11975 ///
11976 /// Sets the *validate only* query property to the given value.
11977 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationStreamPatchCall<'a, C> {
11978 self._validate_only = Some(new_value);
11979 self
11980 }
11981 /// 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.
11982 ///
11983 /// Sets the *update mask* query property to the given value.
11984 pub fn update_mask(
11985 mut self,
11986 new_value: common::FieldMask,
11987 ) -> ProjectLocationStreamPatchCall<'a, C> {
11988 self._update_mask = Some(new_value);
11989 self
11990 }
11991 /// 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).
11992 ///
11993 /// Sets the *request id* query property to the given value.
11994 pub fn request_id(mut self, new_value: &str) -> ProjectLocationStreamPatchCall<'a, C> {
11995 self._request_id = Some(new_value.to_string());
11996 self
11997 }
11998 /// Optional. Update the stream without validating it.
11999 ///
12000 /// Sets the *force* query property to the given value.
12001 pub fn force(mut self, new_value: bool) -> ProjectLocationStreamPatchCall<'a, C> {
12002 self._force = Some(new_value);
12003 self
12004 }
12005 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12006 /// while executing the actual API request.
12007 ///
12008 /// ````text
12009 /// It should be used to handle progress information, and to implement a certain level of resilience.
12010 /// ````
12011 ///
12012 /// Sets the *delegate* property to the given value.
12013 pub fn delegate(
12014 mut self,
12015 new_value: &'a mut dyn common::Delegate,
12016 ) -> ProjectLocationStreamPatchCall<'a, C> {
12017 self._delegate = Some(new_value);
12018 self
12019 }
12020
12021 /// Set any additional parameter of the query string used in the request.
12022 /// It should be used to set parameters which are not yet available through their own
12023 /// setters.
12024 ///
12025 /// Please note that this method must not be used to set any of the known parameters
12026 /// which have their own setter method. If done anyway, the request will fail.
12027 ///
12028 /// # Additional Parameters
12029 ///
12030 /// * *$.xgafv* (query-string) - V1 error format.
12031 /// * *access_token* (query-string) - OAuth access token.
12032 /// * *alt* (query-string) - Data format for response.
12033 /// * *callback* (query-string) - JSONP
12034 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12035 /// * *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.
12036 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12037 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12038 /// * *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.
12039 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12040 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12041 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamPatchCall<'a, C>
12042 where
12043 T: AsRef<str>,
12044 {
12045 self._additional_params
12046 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12047 self
12048 }
12049
12050 /// Identifies the authorization scope for the method you are building.
12051 ///
12052 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12053 /// [`Scope::CloudPlatform`].
12054 ///
12055 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12056 /// tokens for more than one scope.
12057 ///
12058 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12059 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12060 /// sufficient, a read-write scope will do as well.
12061 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamPatchCall<'a, C>
12062 where
12063 St: AsRef<str>,
12064 {
12065 self._scopes.insert(String::from(scope.as_ref()));
12066 self
12067 }
12068 /// Identifies the authorization scope(s) for the method you are building.
12069 ///
12070 /// See [`Self::add_scope()`] for details.
12071 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamPatchCall<'a, C>
12072 where
12073 I: IntoIterator<Item = St>,
12074 St: AsRef<str>,
12075 {
12076 self._scopes
12077 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12078 self
12079 }
12080
12081 /// Removes all scopes, and no default scope will be used either.
12082 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12083 /// for details).
12084 pub fn clear_scopes(mut self) -> ProjectLocationStreamPatchCall<'a, C> {
12085 self._scopes.clear();
12086 self
12087 }
12088}
12089
12090/// Use this method to start, resume or recover a stream with a non default CDC strategy. NOTE: This feature is currently experimental.
12091///
12092/// A builder for the *locations.streams.run* method supported by a *project* resource.
12093/// It is not used directly, but through a [`ProjectMethods`] instance.
12094///
12095/// # Example
12096///
12097/// Instantiate a resource method builder
12098///
12099/// ```test_harness,no_run
12100/// # extern crate hyper;
12101/// # extern crate hyper_rustls;
12102/// # extern crate google_datastream1 as datastream1;
12103/// use datastream1::api::RunStreamRequest;
12104/// # async fn dox() {
12105/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12106///
12107/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12108/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12109/// # secret,
12110/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12111/// # ).build().await.unwrap();
12112///
12113/// # let client = hyper_util::client::legacy::Client::builder(
12114/// # hyper_util::rt::TokioExecutor::new()
12115/// # )
12116/// # .build(
12117/// # hyper_rustls::HttpsConnectorBuilder::new()
12118/// # .with_native_roots()
12119/// # .unwrap()
12120/// # .https_or_http()
12121/// # .enable_http1()
12122/// # .build()
12123/// # );
12124/// # let mut hub = Datastream::new(client, auth);
12125/// // As the method needs a request, you would usually fill it with the desired information
12126/// // into the respective structure. Some of the parts shown here might not be applicable !
12127/// // Values shown here are possibly random and not representative !
12128/// let mut req = RunStreamRequest::default();
12129///
12130/// // You can configure optional parameters by calling the respective setters at will, and
12131/// // execute the final call using `doit()`.
12132/// // Values shown here are possibly random and not representative !
12133/// let result = hub.projects().locations_streams_run(req, "name")
12134/// .doit().await;
12135/// # }
12136/// ```
12137pub struct ProjectLocationStreamRunCall<'a, C>
12138where
12139 C: 'a,
12140{
12141 hub: &'a Datastream<C>,
12142 _request: RunStreamRequest,
12143 _name: String,
12144 _delegate: Option<&'a mut dyn common::Delegate>,
12145 _additional_params: HashMap<String, String>,
12146 _scopes: BTreeSet<String>,
12147}
12148
12149impl<'a, C> common::CallBuilder for ProjectLocationStreamRunCall<'a, C> {}
12150
12151impl<'a, C> ProjectLocationStreamRunCall<'a, C>
12152where
12153 C: common::Connector,
12154{
12155 /// Perform the operation you have build so far.
12156 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12157 use std::borrow::Cow;
12158 use std::io::{Read, Seek};
12159
12160 use common::{url::Params, ToParts};
12161 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12162
12163 let mut dd = common::DefaultDelegate;
12164 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12165 dlg.begin(common::MethodInfo {
12166 id: "datastream.projects.locations.streams.run",
12167 http_method: hyper::Method::POST,
12168 });
12169
12170 for &field in ["alt", "name"].iter() {
12171 if self._additional_params.contains_key(field) {
12172 dlg.finished(false);
12173 return Err(common::Error::FieldClash(field));
12174 }
12175 }
12176
12177 let mut params = Params::with_capacity(4 + self._additional_params.len());
12178 params.push("name", self._name);
12179
12180 params.extend(self._additional_params.iter());
12181
12182 params.push("alt", "json");
12183 let mut url = self.hub._base_url.clone() + "v1/{+name}:run";
12184 if self._scopes.is_empty() {
12185 self._scopes
12186 .insert(Scope::CloudPlatform.as_ref().to_string());
12187 }
12188
12189 #[allow(clippy::single_element_loop)]
12190 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12191 url = params.uri_replacement(url, param_name, find_this, true);
12192 }
12193 {
12194 let to_remove = ["name"];
12195 params.remove_params(&to_remove);
12196 }
12197
12198 let url = params.parse_with_url(&url);
12199
12200 let mut json_mime_type = mime::APPLICATION_JSON;
12201 let mut request_value_reader = {
12202 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12203 common::remove_json_null_values(&mut value);
12204 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12205 serde_json::to_writer(&mut dst, &value).unwrap();
12206 dst
12207 };
12208 let request_size = request_value_reader
12209 .seek(std::io::SeekFrom::End(0))
12210 .unwrap();
12211 request_value_reader
12212 .seek(std::io::SeekFrom::Start(0))
12213 .unwrap();
12214
12215 loop {
12216 let token = match self
12217 .hub
12218 .auth
12219 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12220 .await
12221 {
12222 Ok(token) => token,
12223 Err(e) => match dlg.token(e) {
12224 Ok(token) => token,
12225 Err(e) => {
12226 dlg.finished(false);
12227 return Err(common::Error::MissingToken(e));
12228 }
12229 },
12230 };
12231 request_value_reader
12232 .seek(std::io::SeekFrom::Start(0))
12233 .unwrap();
12234 let mut req_result = {
12235 let client = &self.hub.client;
12236 dlg.pre_request();
12237 let mut req_builder = hyper::Request::builder()
12238 .method(hyper::Method::POST)
12239 .uri(url.as_str())
12240 .header(USER_AGENT, self.hub._user_agent.clone());
12241
12242 if let Some(token) = token.as_ref() {
12243 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12244 }
12245
12246 let request = req_builder
12247 .header(CONTENT_TYPE, json_mime_type.to_string())
12248 .header(CONTENT_LENGTH, request_size as u64)
12249 .body(common::to_body(
12250 request_value_reader.get_ref().clone().into(),
12251 ));
12252
12253 client.request(request.unwrap()).await
12254 };
12255
12256 match req_result {
12257 Err(err) => {
12258 if let common::Retry::After(d) = dlg.http_error(&err) {
12259 sleep(d).await;
12260 continue;
12261 }
12262 dlg.finished(false);
12263 return Err(common::Error::HttpError(err));
12264 }
12265 Ok(res) => {
12266 let (mut parts, body) = res.into_parts();
12267 let mut body = common::Body::new(body);
12268 if !parts.status.is_success() {
12269 let bytes = common::to_bytes(body).await.unwrap_or_default();
12270 let error = serde_json::from_str(&common::to_string(&bytes));
12271 let response = common::to_response(parts, bytes.into());
12272
12273 if let common::Retry::After(d) =
12274 dlg.http_failure(&response, error.as_ref().ok())
12275 {
12276 sleep(d).await;
12277 continue;
12278 }
12279
12280 dlg.finished(false);
12281
12282 return Err(match error {
12283 Ok(value) => common::Error::BadRequest(value),
12284 _ => common::Error::Failure(response),
12285 });
12286 }
12287 let response = {
12288 let bytes = common::to_bytes(body).await.unwrap_or_default();
12289 let encoded = common::to_string(&bytes);
12290 match serde_json::from_str(&encoded) {
12291 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12292 Err(error) => {
12293 dlg.response_json_decode_error(&encoded, &error);
12294 return Err(common::Error::JsonDecodeError(
12295 encoded.to_string(),
12296 error,
12297 ));
12298 }
12299 }
12300 };
12301
12302 dlg.finished(true);
12303 return Ok(response);
12304 }
12305 }
12306 }
12307 }
12308
12309 ///
12310 /// Sets the *request* property to the given value.
12311 ///
12312 /// Even though the property as already been set when instantiating this call,
12313 /// we provide this method for API completeness.
12314 pub fn request(mut self, new_value: RunStreamRequest) -> ProjectLocationStreamRunCall<'a, C> {
12315 self._request = new_value;
12316 self
12317 }
12318 /// Required. Name of the stream resource to start, in the format: projects/{project_id}/locations/{location}/streams/{stream_name}
12319 ///
12320 /// Sets the *name* path property to the given value.
12321 ///
12322 /// Even though the property as already been set when instantiating this call,
12323 /// we provide this method for API completeness.
12324 pub fn name(mut self, new_value: &str) -> ProjectLocationStreamRunCall<'a, C> {
12325 self._name = new_value.to_string();
12326 self
12327 }
12328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12329 /// while executing the actual API request.
12330 ///
12331 /// ````text
12332 /// It should be used to handle progress information, and to implement a certain level of resilience.
12333 /// ````
12334 ///
12335 /// Sets the *delegate* property to the given value.
12336 pub fn delegate(
12337 mut self,
12338 new_value: &'a mut dyn common::Delegate,
12339 ) -> ProjectLocationStreamRunCall<'a, C> {
12340 self._delegate = Some(new_value);
12341 self
12342 }
12343
12344 /// Set any additional parameter of the query string used in the request.
12345 /// It should be used to set parameters which are not yet available through their own
12346 /// setters.
12347 ///
12348 /// Please note that this method must not be used to set any of the known parameters
12349 /// which have their own setter method. If done anyway, the request will fail.
12350 ///
12351 /// # Additional Parameters
12352 ///
12353 /// * *$.xgafv* (query-string) - V1 error format.
12354 /// * *access_token* (query-string) - OAuth access token.
12355 /// * *alt* (query-string) - Data format for response.
12356 /// * *callback* (query-string) - JSONP
12357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12358 /// * *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.
12359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12361 /// * *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.
12362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12364 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationStreamRunCall<'a, C>
12365 where
12366 T: AsRef<str>,
12367 {
12368 self._additional_params
12369 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12370 self
12371 }
12372
12373 /// Identifies the authorization scope for the method you are building.
12374 ///
12375 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12376 /// [`Scope::CloudPlatform`].
12377 ///
12378 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12379 /// tokens for more than one scope.
12380 ///
12381 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12382 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12383 /// sufficient, a read-write scope will do as well.
12384 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationStreamRunCall<'a, C>
12385 where
12386 St: AsRef<str>,
12387 {
12388 self._scopes.insert(String::from(scope.as_ref()));
12389 self
12390 }
12391 /// Identifies the authorization scope(s) for the method you are building.
12392 ///
12393 /// See [`Self::add_scope()`] for details.
12394 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationStreamRunCall<'a, C>
12395 where
12396 I: IntoIterator<Item = St>,
12397 St: AsRef<str>,
12398 {
12399 self._scopes
12400 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12401 self
12402 }
12403
12404 /// Removes all scopes, and no default scope will be used either.
12405 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12406 /// for details).
12407 pub fn clear_scopes(mut self) -> ProjectLocationStreamRunCall<'a, C> {
12408 self._scopes.clear();
12409 self
12410 }
12411}
12412
12413/// The FetchStaticIps API call exposes the static IP addresses used by Datastream.
12414///
12415/// A builder for the *locations.fetchStaticIps* method supported by a *project* resource.
12416/// It is not used directly, but through a [`ProjectMethods`] instance.
12417///
12418/// # Example
12419///
12420/// Instantiate a resource method builder
12421///
12422/// ```test_harness,no_run
12423/// # extern crate hyper;
12424/// # extern crate hyper_rustls;
12425/// # extern crate google_datastream1 as datastream1;
12426/// # async fn dox() {
12427/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12428///
12429/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12431/// # secret,
12432/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12433/// # ).build().await.unwrap();
12434///
12435/// # let client = hyper_util::client::legacy::Client::builder(
12436/// # hyper_util::rt::TokioExecutor::new()
12437/// # )
12438/// # .build(
12439/// # hyper_rustls::HttpsConnectorBuilder::new()
12440/// # .with_native_roots()
12441/// # .unwrap()
12442/// # .https_or_http()
12443/// # .enable_http1()
12444/// # .build()
12445/// # );
12446/// # let mut hub = Datastream::new(client, auth);
12447/// // You can configure optional parameters by calling the respective setters at will, and
12448/// // execute the final call using `doit()`.
12449/// // Values shown here are possibly random and not representative !
12450/// let result = hub.projects().locations_fetch_static_ips("name")
12451/// .page_token("et")
12452/// .page_size(-8)
12453/// .doit().await;
12454/// # }
12455/// ```
12456pub struct ProjectLocationFetchStaticIpCall<'a, C>
12457where
12458 C: 'a,
12459{
12460 hub: &'a Datastream<C>,
12461 _name: String,
12462 _page_token: Option<String>,
12463 _page_size: Option<i32>,
12464 _delegate: Option<&'a mut dyn common::Delegate>,
12465 _additional_params: HashMap<String, String>,
12466 _scopes: BTreeSet<String>,
12467}
12468
12469impl<'a, C> common::CallBuilder for ProjectLocationFetchStaticIpCall<'a, C> {}
12470
12471impl<'a, C> ProjectLocationFetchStaticIpCall<'a, C>
12472where
12473 C: common::Connector,
12474{
12475 /// Perform the operation you have build so far.
12476 pub async fn doit(mut self) -> common::Result<(common::Response, FetchStaticIpsResponse)> {
12477 use std::borrow::Cow;
12478 use std::io::{Read, Seek};
12479
12480 use common::{url::Params, ToParts};
12481 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12482
12483 let mut dd = common::DefaultDelegate;
12484 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12485 dlg.begin(common::MethodInfo {
12486 id: "datastream.projects.locations.fetchStaticIps",
12487 http_method: hyper::Method::GET,
12488 });
12489
12490 for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
12491 if self._additional_params.contains_key(field) {
12492 dlg.finished(false);
12493 return Err(common::Error::FieldClash(field));
12494 }
12495 }
12496
12497 let mut params = Params::with_capacity(5 + self._additional_params.len());
12498 params.push("name", self._name);
12499 if let Some(value) = self._page_token.as_ref() {
12500 params.push("pageToken", value);
12501 }
12502 if let Some(value) = self._page_size.as_ref() {
12503 params.push("pageSize", value.to_string());
12504 }
12505
12506 params.extend(self._additional_params.iter());
12507
12508 params.push("alt", "json");
12509 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchStaticIps";
12510 if self._scopes.is_empty() {
12511 self._scopes
12512 .insert(Scope::CloudPlatform.as_ref().to_string());
12513 }
12514
12515 #[allow(clippy::single_element_loop)]
12516 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12517 url = params.uri_replacement(url, param_name, find_this, true);
12518 }
12519 {
12520 let to_remove = ["name"];
12521 params.remove_params(&to_remove);
12522 }
12523
12524 let url = params.parse_with_url(&url);
12525
12526 loop {
12527 let token = match self
12528 .hub
12529 .auth
12530 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12531 .await
12532 {
12533 Ok(token) => token,
12534 Err(e) => match dlg.token(e) {
12535 Ok(token) => token,
12536 Err(e) => {
12537 dlg.finished(false);
12538 return Err(common::Error::MissingToken(e));
12539 }
12540 },
12541 };
12542 let mut req_result = {
12543 let client = &self.hub.client;
12544 dlg.pre_request();
12545 let mut req_builder = hyper::Request::builder()
12546 .method(hyper::Method::GET)
12547 .uri(url.as_str())
12548 .header(USER_AGENT, self.hub._user_agent.clone());
12549
12550 if let Some(token) = token.as_ref() {
12551 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12552 }
12553
12554 let request = req_builder
12555 .header(CONTENT_LENGTH, 0_u64)
12556 .body(common::to_body::<String>(None));
12557
12558 client.request(request.unwrap()).await
12559 };
12560
12561 match req_result {
12562 Err(err) => {
12563 if let common::Retry::After(d) = dlg.http_error(&err) {
12564 sleep(d).await;
12565 continue;
12566 }
12567 dlg.finished(false);
12568 return Err(common::Error::HttpError(err));
12569 }
12570 Ok(res) => {
12571 let (mut parts, body) = res.into_parts();
12572 let mut body = common::Body::new(body);
12573 if !parts.status.is_success() {
12574 let bytes = common::to_bytes(body).await.unwrap_or_default();
12575 let error = serde_json::from_str(&common::to_string(&bytes));
12576 let response = common::to_response(parts, bytes.into());
12577
12578 if let common::Retry::After(d) =
12579 dlg.http_failure(&response, error.as_ref().ok())
12580 {
12581 sleep(d).await;
12582 continue;
12583 }
12584
12585 dlg.finished(false);
12586
12587 return Err(match error {
12588 Ok(value) => common::Error::BadRequest(value),
12589 _ => common::Error::Failure(response),
12590 });
12591 }
12592 let response = {
12593 let bytes = common::to_bytes(body).await.unwrap_or_default();
12594 let encoded = common::to_string(&bytes);
12595 match serde_json::from_str(&encoded) {
12596 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12597 Err(error) => {
12598 dlg.response_json_decode_error(&encoded, &error);
12599 return Err(common::Error::JsonDecodeError(
12600 encoded.to_string(),
12601 error,
12602 ));
12603 }
12604 }
12605 };
12606
12607 dlg.finished(true);
12608 return Ok(response);
12609 }
12610 }
12611 }
12612 }
12613
12614 /// Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
12615 ///
12616 /// Sets the *name* path property to the given value.
12617 ///
12618 /// Even though the property as already been set when instantiating this call,
12619 /// we provide this method for API completeness.
12620 pub fn name(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
12621 self._name = new_value.to_string();
12622 self
12623 }
12624 /// A page token, received from a previous `ListStaticIps` call. will likely not be specified.
12625 ///
12626 /// Sets the *page token* query property to the given value.
12627 pub fn page_token(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
12628 self._page_token = Some(new_value.to_string());
12629 self
12630 }
12631 /// Maximum number of Ips to return, will likely not be specified.
12632 ///
12633 /// Sets the *page size* query property to the given value.
12634 pub fn page_size(mut self, new_value: i32) -> ProjectLocationFetchStaticIpCall<'a, C> {
12635 self._page_size = Some(new_value);
12636 self
12637 }
12638 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12639 /// while executing the actual API request.
12640 ///
12641 /// ````text
12642 /// It should be used to handle progress information, and to implement a certain level of resilience.
12643 /// ````
12644 ///
12645 /// Sets the *delegate* property to the given value.
12646 pub fn delegate(
12647 mut self,
12648 new_value: &'a mut dyn common::Delegate,
12649 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
12650 self._delegate = Some(new_value);
12651 self
12652 }
12653
12654 /// Set any additional parameter of the query string used in the request.
12655 /// It should be used to set parameters which are not yet available through their own
12656 /// setters.
12657 ///
12658 /// Please note that this method must not be used to set any of the known parameters
12659 /// which have their own setter method. If done anyway, the request will fail.
12660 ///
12661 /// # Additional Parameters
12662 ///
12663 /// * *$.xgafv* (query-string) - V1 error format.
12664 /// * *access_token* (query-string) - OAuth access token.
12665 /// * *alt* (query-string) - Data format for response.
12666 /// * *callback* (query-string) - JSONP
12667 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12668 /// * *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.
12669 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12670 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12671 /// * *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.
12672 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12673 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12674 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFetchStaticIpCall<'a, C>
12675 where
12676 T: AsRef<str>,
12677 {
12678 self._additional_params
12679 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12680 self
12681 }
12682
12683 /// Identifies the authorization scope for the method you are building.
12684 ///
12685 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12686 /// [`Scope::CloudPlatform`].
12687 ///
12688 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12689 /// tokens for more than one scope.
12690 ///
12691 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12692 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12693 /// sufficient, a read-write scope will do as well.
12694 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFetchStaticIpCall<'a, C>
12695 where
12696 St: AsRef<str>,
12697 {
12698 self._scopes.insert(String::from(scope.as_ref()));
12699 self
12700 }
12701 /// Identifies the authorization scope(s) for the method you are building.
12702 ///
12703 /// See [`Self::add_scope()`] for details.
12704 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFetchStaticIpCall<'a, C>
12705 where
12706 I: IntoIterator<Item = St>,
12707 St: AsRef<str>,
12708 {
12709 self._scopes
12710 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12711 self
12712 }
12713
12714 /// Removes all scopes, and no default scope will be used either.
12715 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12716 /// for details).
12717 pub fn clear_scopes(mut self) -> ProjectLocationFetchStaticIpCall<'a, C> {
12718 self._scopes.clear();
12719 self
12720 }
12721}
12722
12723/// Gets information about a location.
12724///
12725/// A builder for the *locations.get* method supported by a *project* resource.
12726/// It is not used directly, but through a [`ProjectMethods`] instance.
12727///
12728/// # Example
12729///
12730/// Instantiate a resource method builder
12731///
12732/// ```test_harness,no_run
12733/// # extern crate hyper;
12734/// # extern crate hyper_rustls;
12735/// # extern crate google_datastream1 as datastream1;
12736/// # async fn dox() {
12737/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12738///
12739/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12740/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12741/// # secret,
12742/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12743/// # ).build().await.unwrap();
12744///
12745/// # let client = hyper_util::client::legacy::Client::builder(
12746/// # hyper_util::rt::TokioExecutor::new()
12747/// # )
12748/// # .build(
12749/// # hyper_rustls::HttpsConnectorBuilder::new()
12750/// # .with_native_roots()
12751/// # .unwrap()
12752/// # .https_or_http()
12753/// # .enable_http1()
12754/// # .build()
12755/// # );
12756/// # let mut hub = Datastream::new(client, auth);
12757/// // You can configure optional parameters by calling the respective setters at will, and
12758/// // execute the final call using `doit()`.
12759/// // Values shown here are possibly random and not representative !
12760/// let result = hub.projects().locations_get("name")
12761/// .doit().await;
12762/// # }
12763/// ```
12764pub struct ProjectLocationGetCall<'a, C>
12765where
12766 C: 'a,
12767{
12768 hub: &'a Datastream<C>,
12769 _name: String,
12770 _delegate: Option<&'a mut dyn common::Delegate>,
12771 _additional_params: HashMap<String, String>,
12772 _scopes: BTreeSet<String>,
12773}
12774
12775impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
12776
12777impl<'a, C> ProjectLocationGetCall<'a, C>
12778where
12779 C: common::Connector,
12780{
12781 /// Perform the operation you have build so far.
12782 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
12783 use std::borrow::Cow;
12784 use std::io::{Read, Seek};
12785
12786 use common::{url::Params, ToParts};
12787 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12788
12789 let mut dd = common::DefaultDelegate;
12790 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12791 dlg.begin(common::MethodInfo {
12792 id: "datastream.projects.locations.get",
12793 http_method: hyper::Method::GET,
12794 });
12795
12796 for &field in ["alt", "name"].iter() {
12797 if self._additional_params.contains_key(field) {
12798 dlg.finished(false);
12799 return Err(common::Error::FieldClash(field));
12800 }
12801 }
12802
12803 let mut params = Params::with_capacity(3 + self._additional_params.len());
12804 params.push("name", self._name);
12805
12806 params.extend(self._additional_params.iter());
12807
12808 params.push("alt", "json");
12809 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12810 if self._scopes.is_empty() {
12811 self._scopes
12812 .insert(Scope::CloudPlatform.as_ref().to_string());
12813 }
12814
12815 #[allow(clippy::single_element_loop)]
12816 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12817 url = params.uri_replacement(url, param_name, find_this, true);
12818 }
12819 {
12820 let to_remove = ["name"];
12821 params.remove_params(&to_remove);
12822 }
12823
12824 let url = params.parse_with_url(&url);
12825
12826 loop {
12827 let token = match self
12828 .hub
12829 .auth
12830 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12831 .await
12832 {
12833 Ok(token) => token,
12834 Err(e) => match dlg.token(e) {
12835 Ok(token) => token,
12836 Err(e) => {
12837 dlg.finished(false);
12838 return Err(common::Error::MissingToken(e));
12839 }
12840 },
12841 };
12842 let mut req_result = {
12843 let client = &self.hub.client;
12844 dlg.pre_request();
12845 let mut req_builder = hyper::Request::builder()
12846 .method(hyper::Method::GET)
12847 .uri(url.as_str())
12848 .header(USER_AGENT, self.hub._user_agent.clone());
12849
12850 if let Some(token) = token.as_ref() {
12851 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12852 }
12853
12854 let request = req_builder
12855 .header(CONTENT_LENGTH, 0_u64)
12856 .body(common::to_body::<String>(None));
12857
12858 client.request(request.unwrap()).await
12859 };
12860
12861 match req_result {
12862 Err(err) => {
12863 if let common::Retry::After(d) = dlg.http_error(&err) {
12864 sleep(d).await;
12865 continue;
12866 }
12867 dlg.finished(false);
12868 return Err(common::Error::HttpError(err));
12869 }
12870 Ok(res) => {
12871 let (mut parts, body) = res.into_parts();
12872 let mut body = common::Body::new(body);
12873 if !parts.status.is_success() {
12874 let bytes = common::to_bytes(body).await.unwrap_or_default();
12875 let error = serde_json::from_str(&common::to_string(&bytes));
12876 let response = common::to_response(parts, bytes.into());
12877
12878 if let common::Retry::After(d) =
12879 dlg.http_failure(&response, error.as_ref().ok())
12880 {
12881 sleep(d).await;
12882 continue;
12883 }
12884
12885 dlg.finished(false);
12886
12887 return Err(match error {
12888 Ok(value) => common::Error::BadRequest(value),
12889 _ => common::Error::Failure(response),
12890 });
12891 }
12892 let response = {
12893 let bytes = common::to_bytes(body).await.unwrap_or_default();
12894 let encoded = common::to_string(&bytes);
12895 match serde_json::from_str(&encoded) {
12896 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12897 Err(error) => {
12898 dlg.response_json_decode_error(&encoded, &error);
12899 return Err(common::Error::JsonDecodeError(
12900 encoded.to_string(),
12901 error,
12902 ));
12903 }
12904 }
12905 };
12906
12907 dlg.finished(true);
12908 return Ok(response);
12909 }
12910 }
12911 }
12912 }
12913
12914 /// Resource name for the location.
12915 ///
12916 /// Sets the *name* path property to the given value.
12917 ///
12918 /// Even though the property as already been set when instantiating this call,
12919 /// we provide this method for API completeness.
12920 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
12921 self._name = new_value.to_string();
12922 self
12923 }
12924 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12925 /// while executing the actual API request.
12926 ///
12927 /// ````text
12928 /// It should be used to handle progress information, and to implement a certain level of resilience.
12929 /// ````
12930 ///
12931 /// Sets the *delegate* property to the given value.
12932 pub fn delegate(
12933 mut self,
12934 new_value: &'a mut dyn common::Delegate,
12935 ) -> ProjectLocationGetCall<'a, C> {
12936 self._delegate = Some(new_value);
12937 self
12938 }
12939
12940 /// Set any additional parameter of the query string used in the request.
12941 /// It should be used to set parameters which are not yet available through their own
12942 /// setters.
12943 ///
12944 /// Please note that this method must not be used to set any of the known parameters
12945 /// which have their own setter method. If done anyway, the request will fail.
12946 ///
12947 /// # Additional Parameters
12948 ///
12949 /// * *$.xgafv* (query-string) - V1 error format.
12950 /// * *access_token* (query-string) - OAuth access token.
12951 /// * *alt* (query-string) - Data format for response.
12952 /// * *callback* (query-string) - JSONP
12953 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12954 /// * *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.
12955 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12956 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12957 /// * *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.
12958 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12959 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12960 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
12961 where
12962 T: AsRef<str>,
12963 {
12964 self._additional_params
12965 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12966 self
12967 }
12968
12969 /// Identifies the authorization scope for the method you are building.
12970 ///
12971 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12972 /// [`Scope::CloudPlatform`].
12973 ///
12974 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12975 /// tokens for more than one scope.
12976 ///
12977 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12978 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12979 /// sufficient, a read-write scope will do as well.
12980 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
12981 where
12982 St: AsRef<str>,
12983 {
12984 self._scopes.insert(String::from(scope.as_ref()));
12985 self
12986 }
12987 /// Identifies the authorization scope(s) for the method you are building.
12988 ///
12989 /// See [`Self::add_scope()`] for details.
12990 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
12991 where
12992 I: IntoIterator<Item = St>,
12993 St: AsRef<str>,
12994 {
12995 self._scopes
12996 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12997 self
12998 }
12999
13000 /// Removes all scopes, and no default scope will be used either.
13001 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13002 /// for details).
13003 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
13004 self._scopes.clear();
13005 self
13006 }
13007}
13008
13009/// Lists information about the supported locations for this service.
13010///
13011/// A builder for the *locations.list* method supported by a *project* resource.
13012/// It is not used directly, but through a [`ProjectMethods`] instance.
13013///
13014/// # Example
13015///
13016/// Instantiate a resource method builder
13017///
13018/// ```test_harness,no_run
13019/// # extern crate hyper;
13020/// # extern crate hyper_rustls;
13021/// # extern crate google_datastream1 as datastream1;
13022/// # async fn dox() {
13023/// # use datastream1::{Datastream, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13024///
13025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13027/// # secret,
13028/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13029/// # ).build().await.unwrap();
13030///
13031/// # let client = hyper_util::client::legacy::Client::builder(
13032/// # hyper_util::rt::TokioExecutor::new()
13033/// # )
13034/// # .build(
13035/// # hyper_rustls::HttpsConnectorBuilder::new()
13036/// # .with_native_roots()
13037/// # .unwrap()
13038/// # .https_or_http()
13039/// # .enable_http1()
13040/// # .build()
13041/// # );
13042/// # let mut hub = Datastream::new(client, auth);
13043/// // You can configure optional parameters by calling the respective setters at will, and
13044/// // execute the final call using `doit()`.
13045/// // Values shown here are possibly random and not representative !
13046/// let result = hub.projects().locations_list("name")
13047/// .page_token("sed")
13048/// .page_size(-29)
13049/// .filter("dolores")
13050/// .doit().await;
13051/// # }
13052/// ```
13053pub struct ProjectLocationListCall<'a, C>
13054where
13055 C: 'a,
13056{
13057 hub: &'a Datastream<C>,
13058 _name: String,
13059 _page_token: Option<String>,
13060 _page_size: Option<i32>,
13061 _filter: Option<String>,
13062 _delegate: Option<&'a mut dyn common::Delegate>,
13063 _additional_params: HashMap<String, String>,
13064 _scopes: BTreeSet<String>,
13065}
13066
13067impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
13068
13069impl<'a, C> ProjectLocationListCall<'a, C>
13070where
13071 C: common::Connector,
13072{
13073 /// Perform the operation you have build so far.
13074 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
13075 use std::borrow::Cow;
13076 use std::io::{Read, Seek};
13077
13078 use common::{url::Params, ToParts};
13079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13080
13081 let mut dd = common::DefaultDelegate;
13082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13083 dlg.begin(common::MethodInfo {
13084 id: "datastream.projects.locations.list",
13085 http_method: hyper::Method::GET,
13086 });
13087
13088 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
13089 if self._additional_params.contains_key(field) {
13090 dlg.finished(false);
13091 return Err(common::Error::FieldClash(field));
13092 }
13093 }
13094
13095 let mut params = Params::with_capacity(6 + self._additional_params.len());
13096 params.push("name", self._name);
13097 if let Some(value) = self._page_token.as_ref() {
13098 params.push("pageToken", value);
13099 }
13100 if let Some(value) = self._page_size.as_ref() {
13101 params.push("pageSize", value.to_string());
13102 }
13103 if let Some(value) = self._filter.as_ref() {
13104 params.push("filter", value);
13105 }
13106
13107 params.extend(self._additional_params.iter());
13108
13109 params.push("alt", "json");
13110 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
13111 if self._scopes.is_empty() {
13112 self._scopes
13113 .insert(Scope::CloudPlatform.as_ref().to_string());
13114 }
13115
13116 #[allow(clippy::single_element_loop)]
13117 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13118 url = params.uri_replacement(url, param_name, find_this, true);
13119 }
13120 {
13121 let to_remove = ["name"];
13122 params.remove_params(&to_remove);
13123 }
13124
13125 let url = params.parse_with_url(&url);
13126
13127 loop {
13128 let token = match self
13129 .hub
13130 .auth
13131 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13132 .await
13133 {
13134 Ok(token) => token,
13135 Err(e) => match dlg.token(e) {
13136 Ok(token) => token,
13137 Err(e) => {
13138 dlg.finished(false);
13139 return Err(common::Error::MissingToken(e));
13140 }
13141 },
13142 };
13143 let mut req_result = {
13144 let client = &self.hub.client;
13145 dlg.pre_request();
13146 let mut req_builder = hyper::Request::builder()
13147 .method(hyper::Method::GET)
13148 .uri(url.as_str())
13149 .header(USER_AGENT, self.hub._user_agent.clone());
13150
13151 if let Some(token) = token.as_ref() {
13152 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13153 }
13154
13155 let request = req_builder
13156 .header(CONTENT_LENGTH, 0_u64)
13157 .body(common::to_body::<String>(None));
13158
13159 client.request(request.unwrap()).await
13160 };
13161
13162 match req_result {
13163 Err(err) => {
13164 if let common::Retry::After(d) = dlg.http_error(&err) {
13165 sleep(d).await;
13166 continue;
13167 }
13168 dlg.finished(false);
13169 return Err(common::Error::HttpError(err));
13170 }
13171 Ok(res) => {
13172 let (mut parts, body) = res.into_parts();
13173 let mut body = common::Body::new(body);
13174 if !parts.status.is_success() {
13175 let bytes = common::to_bytes(body).await.unwrap_or_default();
13176 let error = serde_json::from_str(&common::to_string(&bytes));
13177 let response = common::to_response(parts, bytes.into());
13178
13179 if let common::Retry::After(d) =
13180 dlg.http_failure(&response, error.as_ref().ok())
13181 {
13182 sleep(d).await;
13183 continue;
13184 }
13185
13186 dlg.finished(false);
13187
13188 return Err(match error {
13189 Ok(value) => common::Error::BadRequest(value),
13190 _ => common::Error::Failure(response),
13191 });
13192 }
13193 let response = {
13194 let bytes = common::to_bytes(body).await.unwrap_or_default();
13195 let encoded = common::to_string(&bytes);
13196 match serde_json::from_str(&encoded) {
13197 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13198 Err(error) => {
13199 dlg.response_json_decode_error(&encoded, &error);
13200 return Err(common::Error::JsonDecodeError(
13201 encoded.to_string(),
13202 error,
13203 ));
13204 }
13205 }
13206 };
13207
13208 dlg.finished(true);
13209 return Ok(response);
13210 }
13211 }
13212 }
13213 }
13214
13215 /// The resource that owns the locations collection, if applicable.
13216 ///
13217 /// Sets the *name* path property to the given value.
13218 ///
13219 /// Even though the property as already been set when instantiating this call,
13220 /// we provide this method for API completeness.
13221 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
13222 self._name = new_value.to_string();
13223 self
13224 }
13225 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
13226 ///
13227 /// Sets the *page token* query property to the given value.
13228 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
13229 self._page_token = Some(new_value.to_string());
13230 self
13231 }
13232 /// The maximum number of results to return. If not set, the service selects a default.
13233 ///
13234 /// Sets the *page size* query property to the given value.
13235 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
13236 self._page_size = Some(new_value);
13237 self
13238 }
13239 /// 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).
13240 ///
13241 /// Sets the *filter* query property to the given value.
13242 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
13243 self._filter = Some(new_value.to_string());
13244 self
13245 }
13246 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13247 /// while executing the actual API request.
13248 ///
13249 /// ````text
13250 /// It should be used to handle progress information, and to implement a certain level of resilience.
13251 /// ````
13252 ///
13253 /// Sets the *delegate* property to the given value.
13254 pub fn delegate(
13255 mut self,
13256 new_value: &'a mut dyn common::Delegate,
13257 ) -> ProjectLocationListCall<'a, C> {
13258 self._delegate = Some(new_value);
13259 self
13260 }
13261
13262 /// Set any additional parameter of the query string used in the request.
13263 /// It should be used to set parameters which are not yet available through their own
13264 /// setters.
13265 ///
13266 /// Please note that this method must not be used to set any of the known parameters
13267 /// which have their own setter method. If done anyway, the request will fail.
13268 ///
13269 /// # Additional Parameters
13270 ///
13271 /// * *$.xgafv* (query-string) - V1 error format.
13272 /// * *access_token* (query-string) - OAuth access token.
13273 /// * *alt* (query-string) - Data format for response.
13274 /// * *callback* (query-string) - JSONP
13275 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13276 /// * *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.
13277 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13278 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13279 /// * *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.
13280 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13281 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13282 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
13283 where
13284 T: AsRef<str>,
13285 {
13286 self._additional_params
13287 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13288 self
13289 }
13290
13291 /// Identifies the authorization scope for the method you are building.
13292 ///
13293 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13294 /// [`Scope::CloudPlatform`].
13295 ///
13296 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13297 /// tokens for more than one scope.
13298 ///
13299 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13300 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13301 /// sufficient, a read-write scope will do as well.
13302 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
13303 where
13304 St: AsRef<str>,
13305 {
13306 self._scopes.insert(String::from(scope.as_ref()));
13307 self
13308 }
13309 /// Identifies the authorization scope(s) for the method you are building.
13310 ///
13311 /// See [`Self::add_scope()`] for details.
13312 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
13313 where
13314 I: IntoIterator<Item = St>,
13315 St: AsRef<str>,
13316 {
13317 self._scopes
13318 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13319 self
13320 }
13321
13322 /// Removes all scopes, and no default scope will be used either.
13323 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13324 /// for details).
13325 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
13326 self._scopes.clear();
13327 self
13328 }
13329}