google_dlp2_beta1/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 /// View and manage your data across Google Cloud Platform services
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 DLP 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_dlp2_beta1 as dlp2_beta1;
49/// use dlp2_beta1::{Result, Error};
50/// # async fn dox() {
51/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = DLP::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.risk_analysis().operations_get("name")
93/// .doit().await;
94///
95/// match result {
96/// Err(e) => match e {
97/// // The Error enum provides details about what exactly happened.
98/// // You can also just use its `Debug`, `Display` or `Error` traits
99/// Error::HttpError(_)
100/// |Error::Io(_)
101/// |Error::MissingAPIKey
102/// |Error::MissingToken(_)
103/// |Error::Cancelled
104/// |Error::UploadSizeLimitExceeded(_, _)
105/// |Error::Failure(_)
106/// |Error::BadRequest(_)
107/// |Error::FieldClash(_)
108/// |Error::JsonDecodeError(_, _) => println!("{}", e),
109/// },
110/// Ok(res) => println!("Success: {:?}", res),
111/// }
112/// # }
113/// ```
114#[derive(Clone)]
115pub struct DLP<C> {
116 pub client: common::Client<C>,
117 pub auth: Box<dyn common::GetToken>,
118 _user_agent: String,
119 _base_url: String,
120 _root_url: String,
121}
122
123impl<C> common::Hub for DLP<C> {}
124
125impl<'a, C> DLP<C> {
126 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> DLP<C> {
127 DLP {
128 client,
129 auth: Box::new(auth),
130 _user_agent: "google-api-rust-client/7.0.0".to_string(),
131 _base_url: "https://dlp.googleapis.com/".to_string(),
132 _root_url: "https://dlp.googleapis.com/".to_string(),
133 }
134 }
135
136 pub fn content(&'a self) -> ContentMethods<'a, C> {
137 ContentMethods { hub: self }
138 }
139 pub fn data_source(&'a self) -> DataSourceMethods<'a, C> {
140 DataSourceMethods { hub: self }
141 }
142 pub fn inspect(&'a self) -> InspectMethods<'a, C> {
143 InspectMethods { hub: self }
144 }
145 pub fn risk_analysis(&'a self) -> RiskAnalysiMethods<'a, C> {
146 RiskAnalysiMethods { hub: self }
147 }
148 pub fn root_categories(&'a self) -> RootCategoryMethods<'a, C> {
149 RootCategoryMethods { hub: self }
150 }
151
152 /// Set the user-agent header field to use in all requests to the server.
153 /// It defaults to `google-api-rust-client/7.0.0`.
154 ///
155 /// Returns the previously set user-agent.
156 pub fn user_agent(&mut self, agent_name: String) -> String {
157 std::mem::replace(&mut self._user_agent, agent_name)
158 }
159
160 /// Set the base url to use in all requests to the server.
161 /// It defaults to `https://dlp.googleapis.com/`.
162 ///
163 /// Returns the previously set base url.
164 pub fn base_url(&mut self, new_base_url: String) -> String {
165 std::mem::replace(&mut self._base_url, new_base_url)
166 }
167
168 /// Set the root url to use in all requests to the server.
169 /// It defaults to `https://dlp.googleapis.com/`.
170 ///
171 /// Returns the previously set root url.
172 pub fn root_url(&mut self, new_root_url: String) -> String {
173 std::mem::replace(&mut self._root_url, new_root_url)
174 }
175}
176
177// ############
178// SCHEMAS ###
179// ##########
180/// The transformation to apply to the field.
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 GooglePrivacyDlpV2beta1FieldTransformation {
188 /// Only apply the transformation if the condition evaluates to true for the
189 /// given `RecordCondition`. The conditions are allowed to reference fields
190 /// that are not used in the actual transformation. [optional]
191 ///
192 /// Example Use Cases:
193 ///
194 /// - Apply a different bucket transformation to an age column if the zip code
195 /// column for the same record is within a specific range.
196 /// - Redact a field if the date of birth field is greater than 85.
197 pub condition: Option<GooglePrivacyDlpV2beta1RecordCondition>,
198 /// Treat the contents of the field as free text, and selectively
199 /// transform content that matches an `InfoType`.
200 #[serde(rename = "infoTypeTransformations")]
201 pub info_type_transformations: Option<GooglePrivacyDlpV2beta1InfoTypeTransformations>,
202 /// Input field(s) to apply the transformation to. [required]
203 pub fields: Option<Vec<GooglePrivacyDlpV2beta1FieldId>>,
204 /// Apply the transformation to the entire field.
205 #[serde(rename = "primitiveTransformation")]
206 pub primitive_transformation: Option<GooglePrivacyDlpV2beta1PrimitiveTransformation>,
207}
208
209impl common::Part for GooglePrivacyDlpV2beta1FieldTransformation {}
210
211/// Cloud repository for storing output.
212///
213/// This type is not used in any activity, and only used as *part* of another schema.
214///
215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
216#[serde_with::serde_as]
217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
218pub struct GooglePrivacyDlpV2beta1OutputStorageConfig {
219 /// The path to a Google Cloud Storage location to store output.
220 /// The bucket must already exist and
221 /// the Google APIs service account for DLP must have write permission to
222 /// write to the given bucket.
223 /// Results are split over multiple csv files with each file name matching
224 /// the pattern "[operation_id]_[count].csv", for example
225 /// `3094877188788974909_1.csv`. The `operation_id` matches the
226 /// identifier for the Operation, and the `count` is a counter used for
227 /// tracking the number of files written.
228 ///
229 /// The CSV file(s) contain the following columns regardless of storage type
230 /// scanned:
231 /// - id
232 /// - info_type
233 /// - likelihood
234 /// - byte size of finding
235 /// - quote
236 /// - timestamp
237 ///
238 /// For Cloud Storage the next columns are:
239 ///
240 /// - file_path
241 /// - start_offset
242 ///
243 /// For Cloud Datastore the next columns are:
244 ///
245 /// - project_id
246 /// - namespace_id
247 /// - path
248 /// - column_name
249 /// - offset
250 ///
251 /// For BigQuery the next columns are:
252 ///
253 /// - row_number
254 /// - project_id
255 /// - dataset_id
256 /// - table_id
257 #[serde(rename = "storagePath")]
258 pub storage_path: Option<GooglePrivacyDlpV2beta1CloudStoragePath>,
259 /// Store findings in a new table in the dataset.
260 pub table: Option<GooglePrivacyDlpV2beta1BigQueryTable>,
261}
262
263impl common::Part for GooglePrivacyDlpV2beta1OutputStorageConfig {}
264
265/// Generalization function that buckets values based on ranges. The ranges and
266/// replacement values are dynamically provided by the user for custom behavior,
267/// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH
268/// This can be used on
269/// data of type: number, long, string, timestamp.
270/// If the bound `Value` type differs from the type of data being transformed, we
271/// will first attempt converting the type of the data to be transformed to match
272/// the type of the bound before comparing.
273///
274/// This type is not used in any activity, and only used as *part* of another schema.
275///
276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
277#[serde_with::serde_as]
278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
279pub struct GooglePrivacyDlpV2beta1BucketingConfig {
280 /// no description provided
281 pub buckets: Option<Vec<GooglePrivacyDlpV2beta1Bucket>>,
282}
283
284impl common::Part for GooglePrivacyDlpV2beta1BucketingConfig {}
285
286/// Results of de-identifying a list of items.
287///
288/// # Activities
289///
290/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
291/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
292///
293/// * [deidentify content](ContentDeidentifyCall) (response)
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct GooglePrivacyDlpV2beta1DeidentifyContentResponse {
298 /// no description provided
299 pub items: Option<Vec<GooglePrivacyDlpV2beta1ContentItem>>,
300 /// A review of the transformations that took place for each item.
301 pub summaries: Option<Vec<GooglePrivacyDlpV2beta1DeidentificationSummary>>,
302}
303
304impl common::ResponseResult for GooglePrivacyDlpV2beta1DeidentifyContentResponse {}
305
306/// This resource represents a long-running operation that is the result of a
307/// network API call.
308///
309/// # Activities
310///
311/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
312/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
313///
314/// * [operations get risk analysis](RiskAnalysiOperationGetCall) (response)
315/// * [analyze data source](DataSourceAnalyzeCall) (response)
316/// * [operations create inspect](InspectOperationCreateCall) (response)
317/// * [operations get inspect](InspectOperationGetCall) (response)
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct GoogleLongrunningOperation {
322 /// If the value is `false`, it means the operation is still in progress.
323 /// If `true`, the operation is completed, and either `error` or `response` is
324 /// available.
325 pub done: Option<bool>,
326 /// This field will contain an InspectOperationResult object for `inspect.operations.create` or a RiskAnalysisOperationResult object for `dataSource.analyze`.
327 pub response: Option<HashMap<String, serde_json::Value>>,
328 /// The server-assigned name. The `name` should have the format of `inspect/operations/<identifier>`.
329 pub name: Option<String>,
330 /// The error result of the operation in case of failure or cancellation.
331 pub error: Option<GoogleRpcStatus>,
332 /// This field will contain an InspectOperationMetadata object for `inspect.operations.create` or a RiskAnalysisOperationMetadata object for `dataSource.analyze`. This will always be returned with the Operation.
333 pub metadata: Option<HashMap<String, serde_json::Value>>,
334}
335
336impl common::ResponseResult for GoogleLongrunningOperation {}
337
338/// Include to use an existing data crypto key wrapped by KMS.
339/// Authorization requires the following IAM permissions when sending a request
340/// to perform a crypto transformation using a kms-wrapped crypto key:
341/// dlp.kms.encrypt
342///
343/// This type is not used in any activity, and only used as *part* of another schema.
344///
345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
346#[serde_with::serde_as]
347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
348pub struct GooglePrivacyDlpV2beta1KmsWrappedCryptoKey {
349 /// The wrapped data crypto key. [required]
350 #[serde(rename = "wrappedKey")]
351 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
352 pub wrapped_key: Option<Vec<u8>>,
353 /// The resource name of the KMS CryptoKey to use for unwrapping. [required]
354 #[serde(rename = "cryptoKeyName")]
355 pub crypto_key_name: Option<String>,
356}
357
358impl common::Part for GooglePrivacyDlpV2beta1KmsWrappedCryptoKey {}
359
360/// Type of information detected by the API.
361///
362/// This type is not used in any activity, and only used as *part* of another schema.
363///
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct GooglePrivacyDlpV2beta1InfoType {
368 /// Name of the information type.
369 pub name: Option<String>,
370}
371
372impl common::Part for GooglePrivacyDlpV2beta1InfoType {}
373
374/// Characters to skip when doing deidentification of a value. These will be left
375/// alone and skipped.
376///
377/// This type is not used in any activity, and only used as *part* of another schema.
378///
379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
380#[serde_with::serde_as]
381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
382pub struct GooglePrivacyDlpV2beta1CharsToIgnore {
383 /// no description provided
384 #[serde(rename = "charactersToSkip")]
385 pub characters_to_skip: Option<String>,
386 /// no description provided
387 #[serde(rename = "commonCharactersToIgnore")]
388 pub common_characters_to_ignore: Option<String>,
389}
390
391impl common::Part for GooglePrivacyDlpV2beta1CharsToIgnore {}
392
393/// Buckets values based on fixed size ranges. The
394/// Bucketing transformation can provide all of this functionality,
395/// but requires more configuration. This message is provided as a convenience to
396/// the user for simple bucketing strategies.
397/// The resulting value will be a hyphenated string of
398/// lower_bound-upper_bound.
399/// This can be used on data of type: double, long.
400/// If the bound Value type differs from the type of data
401/// being transformed, we will first attempt converting the type of the data to
402/// be transformed to match the type of the bound before comparing.
403///
404/// This type is not used in any activity, and only used as *part* of another schema.
405///
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct GooglePrivacyDlpV2beta1FixedSizeBucketingConfig {
410 /// Upper bound value of buckets. All values greater than upper_bound are
411 /// grouped together into a single bucket; for example if `upper_bound` = 89,
412 /// then all values greater than 89 are replaced with the value “89+”.
413 /// [Required].
414 #[serde(rename = "upperBound")]
415 pub upper_bound: Option<GooglePrivacyDlpV2beta1Value>,
416 /// Lower bound value of buckets. All values less than `lower_bound` are
417 /// grouped together into a single bucket; for example if `lower_bound` = 10,
418 /// then all values less than 10 are replaced with the value “-10”. [Required].
419 #[serde(rename = "lowerBound")]
420 pub lower_bound: Option<GooglePrivacyDlpV2beta1Value>,
421 /// Size of each bucket (except for minimum and maximum buckets). So if
422 /// `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the
423 /// following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60,
424 /// 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. [Required].
425 #[serde(rename = "bucketSize")]
426 pub bucket_size: Option<f64>,
427}
428
429impl common::Part for GooglePrivacyDlpV2beta1FixedSizeBucketingConfig {}
430
431/// Info Type Category description.
432///
433/// This type is not used in any activity, and only used as *part* of another schema.
434///
435#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
436#[serde_with::serde_as]
437#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
438pub struct GooglePrivacyDlpV2beta1CategoryDescription {
439 /// Internal name of the category.
440 pub name: Option<String>,
441 /// Human readable form of the category name.
442 #[serde(rename = "displayName")]
443 pub display_name: Option<String>,
444}
445
446impl common::Part for GooglePrivacyDlpV2beta1CategoryDescription {}
447
448/// There is no detailed description.
449///
450/// This type is not used in any activity, and only used as *part* of another schema.
451///
452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
453#[serde_with::serde_as]
454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
455pub struct GooglePrivacyDlpV2beta1Conditions {
456 /// no description provided
457 pub conditions: Option<Vec<GooglePrivacyDlpV2beta1Condition>>,
458}
459
460impl common::Part for GooglePrivacyDlpV2beta1Conditions {}
461
462/// A rule for transforming a value.
463///
464/// This type is not used in any activity, and only used as *part* of another schema.
465///
466#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
467#[serde_with::serde_as]
468#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
469pub struct GooglePrivacyDlpV2beta1PrimitiveTransformation {
470 /// no description provided
471 #[serde(rename = "replaceWithInfoTypeConfig")]
472 pub replace_with_info_type_config: Option<GooglePrivacyDlpV2beta1ReplaceWithInfoTypeConfig>,
473 /// no description provided
474 #[serde(rename = "cryptoHashConfig")]
475 pub crypto_hash_config: Option<GooglePrivacyDlpV2beta1CryptoHashConfig>,
476 /// no description provided
477 #[serde(rename = "cryptoReplaceFfxFpeConfig")]
478 pub crypto_replace_ffx_fpe_config: Option<GooglePrivacyDlpV2beta1CryptoReplaceFfxFpeConfig>,
479 /// no description provided
480 #[serde(rename = "replaceConfig")]
481 pub replace_config: Option<GooglePrivacyDlpV2beta1ReplaceValueConfig>,
482 /// no description provided
483 #[serde(rename = "timePartConfig")]
484 pub time_part_config: Option<GooglePrivacyDlpV2beta1TimePartConfig>,
485 /// no description provided
486 #[serde(rename = "fixedSizeBucketingConfig")]
487 pub fixed_size_bucketing_config: Option<GooglePrivacyDlpV2beta1FixedSizeBucketingConfig>,
488 /// no description provided
489 #[serde(rename = "characterMaskConfig")]
490 pub character_mask_config: Option<GooglePrivacyDlpV2beta1CharacterMaskConfig>,
491 /// no description provided
492 #[serde(rename = "bucketingConfig")]
493 pub bucketing_config: Option<GooglePrivacyDlpV2beta1BucketingConfig>,
494 /// no description provided
495 #[serde(rename = "redactConfig")]
496 pub redact_config: Option<GooglePrivacyDlpV2beta1RedactConfig>,
497}
498
499impl common::Part for GooglePrivacyDlpV2beta1PrimitiveTransformation {}
500
501/// Compute numerical stats over an individual column, including
502/// number of distinct values and value count distribution.
503///
504/// This type is not used in any activity, and only used as *part* of another schema.
505///
506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
507#[serde_with::serde_as]
508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
509pub struct GooglePrivacyDlpV2beta1CategoricalStatsConfig {
510 /// Field to compute categorical stats on. All column types are
511 /// supported except for arrays and structs. However, it may be more
512 /// informative to use NumericalStats when the field type is supported,
513 /// depending on the data.
514 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
515}
516
517impl common::Part for GooglePrivacyDlpV2beta1CategoricalStatsConfig {}
518
519/// Container structure describing a single finding within a string or image.
520///
521/// This type is not used in any activity, and only used as *part* of another schema.
522///
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct GooglePrivacyDlpV2beta1Finding {
527 /// The specific string that may be potentially sensitive info.
528 pub quote: Option<String>,
529 /// Location of the info found.
530 pub location: Option<GooglePrivacyDlpV2beta1Location>,
531 /// Estimate of how likely it is that the info_type is correct.
532 pub likelihood: Option<String>,
533 /// The specific type of info the string might be.
534 #[serde(rename = "infoType")]
535 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
536 /// Timestamp when finding was detected.
537 #[serde(rename = "createTime")]
538 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
539}
540
541impl common::Part for GooglePrivacyDlpV2beta1Finding {}
542
543/// Reidentifiability metric. This corresponds to a risk model similar to what
544/// is called "journalist risk" in the literature, except the attack dataset is
545/// statistically modeled instead of being perfectly known. This can be done
546/// using publicly available data (like the US Census), or using a custom
547/// statistical model (indicated as one or several BigQuery tables), or by
548/// extrapolating from the distribution of values in the input dataset.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct GooglePrivacyDlpV2beta1KMapEstimationConfig {
556 /// Several auxiliary tables can be used in the analysis. Each custom_tag
557 /// used to tag a quasi-identifiers column must appear in exactly one column
558 /// of one auxiliary table.
559 #[serde(rename = "auxiliaryTables")]
560 pub auxiliary_tables: Option<Vec<GooglePrivacyDlpV2beta1AuxiliaryTable>>,
561 /// Fields considered to be quasi-identifiers. No two columns can have the
562 /// same tag. [required]
563 #[serde(rename = "quasiIds")]
564 pub quasi_ids: Option<Vec<GooglePrivacyDlpV2beta1TaggedField>>,
565 /// ISO 3166-1 alpha-2 region code to use in the statistical modeling.
566 /// Required if no column is tagged with a region-specific InfoType (like
567 /// US_ZIP_5) or a region code.
568 #[serde(rename = "regionCode")]
569 pub region_code: Option<String>,
570}
571
572impl common::Part for GooglePrivacyDlpV2beta1KMapEstimationConfig {}
573
574/// The response message for Operations.ListOperations.
575///
576/// # Activities
577///
578/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
579/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
580///
581/// * [operations list risk analysis](RiskAnalysiOperationListCall) (response)
582/// * [operations list inspect](InspectOperationListCall) (response)
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct GoogleLongrunningListOperationsResponse {
587 /// A list of operations that matches the specified filter in the request.
588 pub operations: Option<Vec<GoogleLongrunningOperation>>,
589 /// The standard List next-page token.
590 #[serde(rename = "nextPageToken")]
591 pub next_page_token: Option<String>,
592}
593
594impl common::ResponseResult for GoogleLongrunningListOperationsResponse {}
595
596/// There is no detailed description.
597///
598/// This type is not used in any activity, and only used as *part* of another schema.
599///
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct GooglePrivacyDlpV2beta1Row {
604 /// no description provided
605 pub values: Option<Vec<GooglePrivacyDlpV2beta1Value>>,
606}
607
608impl common::Part for GooglePrivacyDlpV2beta1Row {}
609
610/// A generic empty message that you can re-use to avoid defining duplicated
611/// empty messages in your APIs. A typical example is to use it as the request
612/// or the response type of an API method. For instance:
613///
614/// ````text
615/// service Foo {
616/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
617/// }
618/// ````
619///
620/// The JSON representation for `Empty` is empty JSON object `{}`.
621///
622/// # Activities
623///
624/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
625/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
626///
627/// * [operations cancel risk analysis](RiskAnalysiOperationCancelCall) (response)
628/// * [operations delete risk analysis](RiskAnalysiOperationDeleteCall) (response)
629/// * [operations cancel inspect](InspectOperationCancelCall) (response)
630/// * [operations delete inspect](InspectOperationDeleteCall) (response)
631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
632#[serde_with::serde_as]
633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
634pub struct GoogleProtobufEmpty {
635 _never_set: Option<bool>,
636}
637
638impl common::ResponseResult for GoogleProtobufEmpty {}
639
640/// Response to the ListInspectFindings request.
641///
642/// # Activities
643///
644/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
645/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
646///
647/// * [results findings list inspect](InspectResultFindingListCall) (response)
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct GooglePrivacyDlpV2beta1ListInspectFindingsResponse {
652 /// The results.
653 pub result: Option<GooglePrivacyDlpV2beta1InspectResult>,
654 /// If not empty, indicates that there may be more results that match the
655 /// request; this value should be passed in a new `ListInspectFindingsRequest`.
656 #[serde(rename = "nextPageToken")]
657 pub next_page_token: Option<String>,
658}
659
660impl common::ResponseResult for GooglePrivacyDlpV2beta1ListInspectFindingsResponse {}
661
662/// A collection of expressions
663///
664/// This type is not used in any activity, and only used as *part* of another schema.
665///
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct GooglePrivacyDlpV2beta1Expressions {
670 /// The operator to apply to the result of conditions. Default and currently
671 /// only supported value is `AND`.
672 #[serde(rename = "logicalOperator")]
673 pub logical_operator: Option<String>,
674 /// no description provided
675 pub conditions: Option<GooglePrivacyDlpV2beta1Conditions>,
676}
677
678impl common::Part for GooglePrivacyDlpV2beta1Expressions {}
679
680/// Options defining a file or a set of files (path ending with *) within
681/// a Google Cloud Storage bucket.
682///
683/// This type is not used in any activity, and only used as *part* of another schema.
684///
685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
686#[serde_with::serde_as]
687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
688pub struct GooglePrivacyDlpV2beta1CloudStorageOptions {
689 /// no description provided
690 #[serde(rename = "fileSet")]
691 pub file_set: Option<GooglePrivacyDlpV2beta1FileSet>,
692}
693
694impl common::Part for GooglePrivacyDlpV2beta1CloudStorageOptions {}
695
696/// A location in Cloud Storage.
697///
698/// This type is not used in any activity, and only used as *part* of another schema.
699///
700#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
701#[serde_with::serde_as]
702#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
703pub struct GooglePrivacyDlpV2beta1CloudStoragePath {
704 /// The url, in the format of `gs://bucket/<path>`.
705 pub path: Option<String>,
706}
707
708impl common::Part for GooglePrivacyDlpV2beta1CloudStoragePath {}
709
710/// Generic half-open interval [start, end)
711///
712/// This type is not used in any activity, and only used as *part* of another schema.
713///
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct GooglePrivacyDlpV2beta1Range {
718 /// Index of the first character of the range (inclusive).
719 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
720 pub start: Option<i64>,
721 /// Index of the last character of the range (exclusive).
722 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
723 pub end: Option<i64>,
724}
725
726impl common::Part for GooglePrivacyDlpV2beta1Range {}
727
728/// Represents a time of day. The date and time zone are either not significant
729/// or are specified elsewhere. An API may choose to allow leap seconds. Related
730/// types are google.type.Date and `google.protobuf.Timestamp`.
731///
732/// This type is not used in any activity, and only used as *part* of another schema.
733///
734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
735#[serde_with::serde_as]
736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
737pub struct GoogleTypeTimeOfDay {
738 /// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
739 pub nanos: Option<i32>,
740 /// Seconds of minutes of the time. Must normally be from 0 to 59. An API may
741 /// allow the value 60 if it allows leap-seconds.
742 pub seconds: Option<i32>,
743 /// Minutes of hour of day. Must be from 0 to 59.
744 pub minutes: Option<i32>,
745 /// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
746 /// to allow the value "24:00:00" for scenarios like business closing time.
747 pub hours: Option<i32>,
748}
749
750impl common::Part for GoogleTypeTimeOfDay {}
751
752/// The configuration that controls how the data will change.
753///
754/// This type is not used in any activity, and only used as *part* of another schema.
755///
756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
757#[serde_with::serde_as]
758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
759pub struct GooglePrivacyDlpV2beta1DeidentifyConfig {
760 /// Treat the dataset as structured. Transformations can be applied to
761 /// specific locations within structured datasets, such as transforming
762 /// a column within a table.
763 #[serde(rename = "recordTransformations")]
764 pub record_transformations: Option<GooglePrivacyDlpV2beta1RecordTransformations>,
765 /// Treat the dataset as free-form text and apply the same free text
766 /// transformation everywhere.
767 #[serde(rename = "infoTypeTransformations")]
768 pub info_type_transformations: Option<GooglePrivacyDlpV2beta1InfoTypeTransformations>,
769}
770
771impl common::Part for GooglePrivacyDlpV2beta1DeidentifyConfig {}
772
773/// l-diversity metric, used for analysis of reidentification risk.
774///
775/// This type is not used in any activity, and only used as *part* of another schema.
776///
777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
778#[serde_with::serde_as]
779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
780pub struct GooglePrivacyDlpV2beta1LDiversityConfig {
781 /// Sensitive field for computing the l-value.
782 #[serde(rename = "sensitiveAttribute")]
783 pub sensitive_attribute: Option<GooglePrivacyDlpV2beta1FieldId>,
784 /// Set of quasi-identifiers indicating how equivalence classes are
785 /// defined for the l-diversity computation. When multiple fields are
786 /// specified, they are considered a single composite key.
787 #[serde(rename = "quasiIds")]
788 pub quasi_ids: Option<Vec<GooglePrivacyDlpV2beta1FieldId>>,
789}
790
791impl common::Part for GooglePrivacyDlpV2beta1LDiversityConfig {}
792
793/// Shared message indicating Cloud storage type.
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct GooglePrivacyDlpV2beta1StorageConfig {
801 /// BigQuery options specification.
802 #[serde(rename = "bigQueryOptions")]
803 pub big_query_options: Option<GooglePrivacyDlpV2beta1BigQueryOptions>,
804 /// Google Cloud Storage options specification.
805 #[serde(rename = "cloudStorageOptions")]
806 pub cloud_storage_options: Option<GooglePrivacyDlpV2beta1CloudStorageOptions>,
807 /// Google Cloud Datastore options specification.
808 #[serde(rename = "datastoreOptions")]
809 pub datastore_options: Option<GooglePrivacyDlpV2beta1DatastoreOptions>,
810}
811
812impl common::Part for GooglePrivacyDlpV2beta1StorageConfig {}
813
814/// Additional configuration for inspect long running operations.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct GooglePrivacyDlpV2beta1OperationConfig {
822 /// Max number of findings per file, Datastore entity, or database row.
823 #[serde(rename = "maxItemFindings")]
824 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
825 pub max_item_findings: Option<i64>,
826}
827
828impl common::Part for GooglePrivacyDlpV2beta1OperationConfig {}
829
830/// Options defining BigQuery table and row identifiers.
831///
832/// This type is not used in any activity, and only used as *part* of another schema.
833///
834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
835#[serde_with::serde_as]
836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
837pub struct GooglePrivacyDlpV2beta1BigQueryOptions {
838 /// References to fields uniquely identifying rows within the table.
839 /// Nested fields in the format, like `person.birthdate.year`, are allowed.
840 #[serde(rename = "identifyingFields")]
841 pub identifying_fields: Option<Vec<GooglePrivacyDlpV2beta1FieldId>>,
842 /// Complete BigQuery table reference.
843 #[serde(rename = "tableReference")]
844 pub table_reference: Option<GooglePrivacyDlpV2beta1BigQueryTable>,
845}
846
847impl common::Part for GooglePrivacyDlpV2beta1BigQueryOptions {}
848
849/// Privacy metric to compute for reidentification risk analysis.
850///
851/// This type is not used in any activity, and only used as *part* of another schema.
852///
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct GooglePrivacyDlpV2beta1PrivacyMetric {
857 /// no description provided
858 #[serde(rename = "kMapEstimationConfig")]
859 pub k_map_estimation_config: Option<GooglePrivacyDlpV2beta1KMapEstimationConfig>,
860 /// no description provided
861 #[serde(rename = "lDiversityConfig")]
862 pub l_diversity_config: Option<GooglePrivacyDlpV2beta1LDiversityConfig>,
863 /// no description provided
864 #[serde(rename = "numericalStatsConfig")]
865 pub numerical_stats_config: Option<GooglePrivacyDlpV2beta1NumericalStatsConfig>,
866 /// no description provided
867 #[serde(rename = "kAnonymityConfig")]
868 pub k_anonymity_config: Option<GooglePrivacyDlpV2beta1KAnonymityConfig>,
869 /// no description provided
870 #[serde(rename = "categoricalStatsConfig")]
871 pub categorical_stats_config: Option<GooglePrivacyDlpV2beta1CategoricalStatsConfig>,
872}
873
874impl common::Part for GooglePrivacyDlpV2beta1PrivacyMetric {}
875
876/// There is no detailed description.
877///
878/// This type is not used in any activity, and only used as *part* of another schema.
879///
880#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
881#[serde_with::serde_as]
882#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
883pub struct GooglePrivacyDlpV2beta1ReplaceConfig {
884 /// Content replacing sensitive information of given type. Max 256 chars.
885 #[serde(rename = "replaceWith")]
886 pub replace_with: Option<String>,
887 /// Type of information to replace. Only one ReplaceConfig per info_type
888 /// should be provided. If ReplaceConfig does not have an info_type, the DLP
889 /// API matches it against all info_types that are found but not specified in
890 /// another ReplaceConfig.
891 #[serde(rename = "infoType")]
892 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
893}
894
895impl common::Part for GooglePrivacyDlpV2beta1ReplaceConfig {}
896
897/// Compute numerical stats over an individual column, including
898/// min, max, and quantiles.
899///
900/// This type is not used in any activity, and only used as *part* of another schema.
901///
902#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
903#[serde_with::serde_as]
904#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
905pub struct GooglePrivacyDlpV2beta1NumericalStatsConfig {
906 /// Field to compute numerical stats on. Supported types are
907 /// integer, float, date, datetime, timestamp, time.
908 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
909}
910
911impl common::Part for GooglePrivacyDlpV2beta1NumericalStatsConfig {}
912
913/// High level summary of deidentification.
914///
915/// This type is not used in any activity, and only used as *part* of another schema.
916///
917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
918#[serde_with::serde_as]
919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
920pub struct GooglePrivacyDlpV2beta1DeidentificationSummary {
921 /// Total size in bytes that were transformed in some way.
922 #[serde(rename = "transformedBytes")]
923 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
924 pub transformed_bytes: Option<i64>,
925 /// Transformations applied to the dataset.
926 #[serde(rename = "transformationSummaries")]
927 pub transformation_summaries: Option<Vec<GooglePrivacyDlpV2beta1TransformationSummary>>,
928}
929
930impl common::Part for GooglePrivacyDlpV2beta1DeidentificationSummary {}
931
932/// A condition for determining whether a transformation should be applied to
933/// a field.
934///
935/// This type is not used in any activity, and only used as *part* of another schema.
936///
937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
938#[serde_with::serde_as]
939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
940pub struct GooglePrivacyDlpV2beta1RecordCondition {
941 /// no description provided
942 pub expressions: Option<GooglePrivacyDlpV2beta1Expressions>,
943}
944
945impl common::Part for GooglePrivacyDlpV2beta1RecordCondition {}
946
947/// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a
948/// portion of the value.
949///
950/// This type is not used in any activity, and only used as *part* of another schema.
951///
952#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
953#[serde_with::serde_as]
954#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
955pub struct GooglePrivacyDlpV2beta1TimePartConfig {
956 /// no description provided
957 #[serde(rename = "partToExtract")]
958 pub part_to_extract: Option<String>,
959}
960
961impl common::Part for GooglePrivacyDlpV2beta1TimePartConfig {}
962
963/// Response to the ListInfoTypes request.
964///
965/// # Activities
966///
967/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
968/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
969///
970/// * [info types list root categories](RootCategoryInfoTypeListCall) (response)
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct GooglePrivacyDlpV2beta1ListInfoTypesResponse {
975 /// Set of sensitive info types belonging to a category.
976 #[serde(rename = "infoTypes")]
977 pub info_types: Option<Vec<GooglePrivacyDlpV2beta1InfoTypeDescription>>,
978}
979
980impl common::ResponseResult for GooglePrivacyDlpV2beta1ListInfoTypesResponse {}
981
982/// Record key for a finding in a Cloud Storage file.
983///
984/// This type is not used in any activity, and only used as *part* of another schema.
985///
986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
987#[serde_with::serde_as]
988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
989pub struct GooglePrivacyDlpV2beta1CloudStorageKey {
990 /// Path to the file.
991 #[serde(rename = "filePath")]
992 pub file_path: Option<String>,
993 /// Byte offset of the referenced data in the file.
994 #[serde(rename = "startOffset")]
995 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
996 pub start_offset: Option<i64>,
997}
998
999impl common::Part for GooglePrivacyDlpV2beta1CloudStorageKey {}
1000
1001/// Custom information type based on a dictionary of words or phrases. This can
1002/// be used to match sensitive information specific to the data, such as a list
1003/// of employee IDs or job titles.
1004///
1005/// Dictionary words are case-insensitive and all characters other than letters
1006/// and digits in the unicode [Basic Multilingual
1007/// Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane)
1008/// will be replaced with whitespace when scanning for matches, so the
1009/// dictionary phrase "Sam Johnson" will match all three phrases "sam johnson",
1010/// "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters
1011/// surrounding any match must be of a different type than the adjacent
1012/// characters within the word, so letters must be next to non-letters and
1013/// digits next to non-digits. For example, the dictionary word "jen" will
1014/// match the first three letters of the text "jen123" but will return no
1015/// matches for "jennifer".
1016///
1017/// Dictionary words containing a large number of characters that are not
1018/// letters or digits may result in unexpected findings because such characters
1019/// are treated as whitespace.
1020///
1021/// This type is not used in any activity, and only used as *part* of another schema.
1022///
1023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1024#[serde_with::serde_as]
1025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1026pub struct GooglePrivacyDlpV2beta1Dictionary {
1027 /// List of words or phrases to search for.
1028 #[serde(rename = "wordList")]
1029 pub word_list: Option<GooglePrivacyDlpV2beta1WordList>,
1030}
1031
1032impl common::Part for GooglePrivacyDlpV2beta1Dictionary {}
1033
1034/// Options defining a data set within Google Cloud Datastore.
1035///
1036/// This type is not used in any activity, and only used as *part* of another schema.
1037///
1038#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1039#[serde_with::serde_as]
1040#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1041pub struct GooglePrivacyDlpV2beta1DatastoreOptions {
1042 /// A partition ID identifies a grouping of entities. The grouping is always
1043 /// by project and namespace, however the namespace ID may be empty.
1044 #[serde(rename = "partitionId")]
1045 pub partition_id: Option<GooglePrivacyDlpV2beta1PartitionId>,
1046 /// The kind to process.
1047 pub kind: Option<GooglePrivacyDlpV2beta1KindExpression>,
1048 /// Properties to scan. If none are specified, all properties will be scanned
1049 /// by default.
1050 pub projection: Option<Vec<GooglePrivacyDlpV2beta1Projection>>,
1051}
1052
1053impl common::Part for GooglePrivacyDlpV2beta1DatastoreOptions {}
1054
1055/// A type of transformation that is applied over structured data such as a
1056/// table.
1057///
1058/// This type is not used in any activity, and only used as *part* of another schema.
1059///
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct GooglePrivacyDlpV2beta1RecordTransformations {
1064 /// Transform the record by applying various field transformations.
1065 #[serde(rename = "fieldTransformations")]
1066 pub field_transformations: Option<Vec<GooglePrivacyDlpV2beta1FieldTransformation>>,
1067 /// Configuration defining which records get suppressed entirely. Records that
1068 /// match any suppression rule are omitted from the output [optional].
1069 #[serde(rename = "recordSuppressions")]
1070 pub record_suppressions: Option<Vec<GooglePrivacyDlpV2beta1RecordSuppression>>,
1071}
1072
1073impl common::Part for GooglePrivacyDlpV2beta1RecordTransformations {}
1074
1075/// Configuration description of the scanning process.
1076/// When used with redactContent only info_types and min_likelihood are currently
1077/// used.
1078///
1079/// This type is not used in any activity, and only used as *part* of another schema.
1080///
1081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1082#[serde_with::serde_as]
1083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1084pub struct GooglePrivacyDlpV2beta1InspectConfig {
1085 /// Configuration of findings limit given for specified info types.
1086 #[serde(rename = "infoTypeLimits")]
1087 pub info_type_limits: Option<Vec<GooglePrivacyDlpV2beta1InfoTypeLimit>>,
1088 /// Limits the number of findings per content item or long running operation.
1089 #[serde(rename = "maxFindings")]
1090 pub max_findings: Option<i32>,
1091 /// Restricts what info_types to look for. The values must correspond to
1092 /// InfoType values returned by ListInfoTypes or found in documentation.
1093 /// Empty info_types runs all enabled detectors.
1094 #[serde(rename = "infoTypes")]
1095 pub info_types: Option<Vec<GooglePrivacyDlpV2beta1InfoType>>,
1096 /// When true, a contextual quote from the data that triggered a finding is
1097 /// included in the response; see Finding.quote.
1098 #[serde(rename = "includeQuote")]
1099 pub include_quote: Option<bool>,
1100 /// Custom info types provided by the user.
1101 #[serde(rename = "customInfoTypes")]
1102 pub custom_info_types: Option<Vec<GooglePrivacyDlpV2beta1CustomInfoType>>,
1103 /// When true, excludes type information of the findings.
1104 #[serde(rename = "excludeTypes")]
1105 pub exclude_types: Option<bool>,
1106 /// Only returns findings equal or above this threshold.
1107 #[serde(rename = "minLikelihood")]
1108 pub min_likelihood: Option<String>,
1109}
1110
1111impl common::Part for GooglePrivacyDlpV2beta1InspectConfig {}
1112
1113/// A representation of a Datastore property in a projection.
1114///
1115/// This type is not used in any activity, and only used as *part* of another schema.
1116///
1117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1118#[serde_with::serde_as]
1119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1120pub struct GooglePrivacyDlpV2beta1Projection {
1121 /// The property to project.
1122 pub property: Option<GooglePrivacyDlpV2beta1PropertyReference>,
1123}
1124
1125impl common::Part for GooglePrivacyDlpV2beta1Projection {}
1126
1127/// Redact a given value. For example, if used with an `InfoTypeTransformation`
1128/// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the
1129/// output would be 'My phone number is '.
1130///
1131/// This type is not used in any activity, and only used as *part* of another schema.
1132///
1133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1134#[serde_with::serde_as]
1135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1136pub struct GooglePrivacyDlpV2beta1RedactConfig {
1137 _never_set: Option<bool>,
1138}
1139
1140impl common::Part for GooglePrivacyDlpV2beta1RedactConfig {}
1141
1142/// Pseudonymization method that generates surrogates via cryptographic hashing.
1143/// Uses SHA-256.
1144/// Outputs a 32 byte digest as an uppercase hex string
1145/// (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE).
1146/// Currently, only string and integer values can be hashed.
1147///
1148/// This type is not used in any activity, and only used as *part* of another schema.
1149///
1150#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1151#[serde_with::serde_as]
1152#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1153pub struct GooglePrivacyDlpV2beta1CryptoHashConfig {
1154 /// The key used by the hash function.
1155 #[serde(rename = "cryptoKey")]
1156 pub crypto_key: Option<GooglePrivacyDlpV2beta1CryptoKey>,
1157}
1158
1159impl common::Part for GooglePrivacyDlpV2beta1CryptoHashConfig {}
1160
1161/// A unique identifier for a Datastore entity.
1162/// If a key's partition ID or any of its path kinds or names are
1163/// reserved/read-only, the key is reserved/read-only.
1164/// A reserved/read-only key is forbidden in certain documented contexts.
1165///
1166/// This type is not used in any activity, and only used as *part* of another schema.
1167///
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct GooglePrivacyDlpV2beta1Key {
1172 /// The entity path.
1173 /// An entity path consists of one or more elements composed of a kind and a
1174 /// string or numerical identifier, which identify entities. The first
1175 /// element identifies a _root entity_, the second element identifies
1176 /// a _child_ of the root entity, the third element identifies a child of the
1177 /// second entity, and so forth. The entities identified by all prefixes of
1178 /// the path are called the element's _ancestors_.
1179 ///
1180 /// A path can never be empty, and a path can have at most 100 elements.
1181 pub path: Option<Vec<GooglePrivacyDlpV2beta1PathElement>>,
1182 /// Entities are partitioned into subsets, currently identified by a project
1183 /// ID and namespace ID.
1184 /// Queries are scoped to a single partition.
1185 #[serde(rename = "partitionId")]
1186 pub partition_id: Option<GooglePrivacyDlpV2beta1PartitionId>,
1187}
1188
1189impl common::Part for GooglePrivacyDlpV2beta1Key {}
1190
1191/// Request to search for potentially sensitive info in a list of items.
1192///
1193/// # Activities
1194///
1195/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1196/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1197///
1198/// * [inspect content](ContentInspectCall) (request)
1199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1200#[serde_with::serde_as]
1201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1202pub struct GooglePrivacyDlpV2beta1InspectContentRequest {
1203 /// The list of items to inspect. Items in a single request are
1204 /// considered "related" unless inspect_config.independent_inputs is true.
1205 /// Up to 100 are allowed per request.
1206 pub items: Option<Vec<GooglePrivacyDlpV2beta1ContentItem>>,
1207 /// Configuration for the inspector.
1208 #[serde(rename = "inspectConfig")]
1209 pub inspect_config: Option<GooglePrivacyDlpV2beta1InspectConfig>,
1210}
1211
1212impl common::RequestValue for GooglePrivacyDlpV2beta1InspectContentRequest {}
1213
1214/// Represents a whole calendar date, e.g. date of birth. The time of day and
1215/// time zone are either specified elsewhere or are not significant. The date
1216/// is relative to the Proleptic Gregorian Calendar. The day may be 0 to
1217/// represent a year and month where the day is not significant, e.g. credit card
1218/// expiration date. The year may be 0 to represent a month and day independent
1219/// of year, e.g. anniversary date. Related types are google.type.TimeOfDay
1220/// and `google.protobuf.Timestamp`.
1221///
1222/// This type is not used in any activity, and only used as *part* of another schema.
1223///
1224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1225#[serde_with::serde_as]
1226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1227pub struct GoogleTypeDate {
1228 /// Month of year. Must be from 1 to 12.
1229 pub month: Option<i32>,
1230 /// Year of date. Must be from 1 to 9999, or 0 if specifying a date without
1231 /// a year.
1232 pub year: Option<i32>,
1233 /// Day of month. Must be from 1 to 31 and valid for the year and month, or 0
1234 /// if specifying a year/month where the day is not significant.
1235 pub day: Option<i32>,
1236}
1237
1238impl common::Part for GoogleTypeDate {}
1239
1240/// Configuration for determining how redaction of images should occur.
1241///
1242/// This type is not used in any activity, and only used as *part* of another schema.
1243///
1244#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1245#[serde_with::serde_as]
1246#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1247pub struct GooglePrivacyDlpV2beta1ImageRedactionConfig {
1248 /// The color to use when redacting content from an image. If not specified,
1249 /// the default is black.
1250 #[serde(rename = "redactionColor")]
1251 pub redaction_color: Option<GooglePrivacyDlpV2beta1Color>,
1252 /// If true, all text found in the image, regardless whether it matches an
1253 /// info_type, is redacted.
1254 #[serde(rename = "redactAllText")]
1255 pub redact_all_text: Option<bool>,
1256 /// Only one per info_type should be provided per request. If not
1257 /// specified, and redact_all_text is false, the DLP API will redact all
1258 /// text that it matches against all info_types that are found, but not
1259 /// specified in another ImageRedactionConfig.
1260 #[serde(rename = "infoType")]
1261 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
1262}
1263
1264impl common::Part for GooglePrivacyDlpV2beta1ImageRedactionConfig {}
1265
1266/// Replace each matching finding with the name of the info_type.
1267///
1268/// This type is not used in any activity, and only used as *part* of another schema.
1269///
1270#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1271#[serde_with::serde_as]
1272#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1273pub struct GooglePrivacyDlpV2beta1ReplaceWithInfoTypeConfig {
1274 _never_set: Option<bool>,
1275}
1276
1277impl common::Part for GooglePrivacyDlpV2beta1ReplaceWithInfoTypeConfig {}
1278
1279/// Specifies the location of a finding within its source item.
1280///
1281/// This type is not used in any activity, and only used as *part* of another schema.
1282///
1283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1284#[serde_with::serde_as]
1285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1286pub struct GooglePrivacyDlpV2beta1Location {
1287 /// Key of the finding.
1288 #[serde(rename = "recordKey")]
1289 pub record_key: Option<GooglePrivacyDlpV2beta1RecordKey>,
1290 /// Location within a `ContentItem.Table`.
1291 #[serde(rename = "tableLocation")]
1292 pub table_location: Option<GooglePrivacyDlpV2beta1TableLocation>,
1293 /// Character offsets within a content item, included when content type
1294 /// is a text. Default charset assumed to be UTF-8.
1295 #[serde(rename = "codepointRange")]
1296 pub codepoint_range: Option<GooglePrivacyDlpV2beta1Range>,
1297 /// Field id of the field containing the finding.
1298 #[serde(rename = "fieldId")]
1299 pub field_id: Option<GooglePrivacyDlpV2beta1FieldId>,
1300 /// Location within an image's pixels.
1301 #[serde(rename = "imageBoxes")]
1302 pub image_boxes: Option<Vec<GooglePrivacyDlpV2beta1ImageLocation>>,
1303 /// Zero-based byte offsets within a content item.
1304 #[serde(rename = "byteRange")]
1305 pub byte_range: Option<GooglePrivacyDlpV2beta1Range>,
1306}
1307
1308impl common::Part for GooglePrivacyDlpV2beta1Location {}
1309
1310/// Configuration to suppress records whose suppression conditions evaluate to
1311/// true.
1312///
1313/// This type is not used in any activity, and only used as *part* of another schema.
1314///
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct GooglePrivacyDlpV2beta1RecordSuppression {
1319 /// no description provided
1320 pub condition: Option<GooglePrivacyDlpV2beta1RecordCondition>,
1321}
1322
1323impl common::Part for GooglePrivacyDlpV2beta1RecordSuppression {}
1324
1325/// An entity in a dataset is a field or set of fields that correspond to a
1326/// single person. For example, in medical records the `EntityId` might be
1327/// a patient identifier, or for financial records it might be an account
1328/// identifier. This message is used when generalizations or analysis must be
1329/// consistent across multiple rows pertaining to the same entity.
1330///
1331/// This type is not used in any activity, and only used as *part* of another schema.
1332///
1333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1334#[serde_with::serde_as]
1335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1336pub struct GooglePrivacyDlpV2beta1EntityId {
1337 /// Composite key indicating which field contains the entity identifier.
1338 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
1339}
1340
1341impl common::Part for GooglePrivacyDlpV2beta1EntityId {}
1342
1343/// Using raw keys is prone to security risks due to accidentally
1344/// leaking the key. Choose another type of key if possible.
1345///
1346/// This type is not used in any activity, and only used as *part* of another schema.
1347///
1348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1349#[serde_with::serde_as]
1350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1351pub struct GooglePrivacyDlpV2beta1UnwrappedCryptoKey {
1352 /// The AES 128/192/256 bit key. [required]
1353 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1354 pub key: Option<Vec<u8>>,
1355}
1356
1357impl common::Part for GooglePrivacyDlpV2beta1UnwrappedCryptoKey {}
1358
1359/// Custom information type provided by the user. Used to find domain-specific
1360/// sensitive information configurable to the data in question.
1361///
1362/// This type is not used in any activity, and only used as *part* of another schema.
1363///
1364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1365#[serde_with::serde_as]
1366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1367pub struct GooglePrivacyDlpV2beta1CustomInfoType {
1368 /// Info type configuration. All custom info types must have configurations
1369 /// that do not conflict with built-in info types or other custom info types.
1370 #[serde(rename = "infoType")]
1371 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
1372 /// Dictionary-based custom info type.
1373 pub dictionary: Option<GooglePrivacyDlpV2beta1Dictionary>,
1374 /// Surrogate info type.
1375 #[serde(rename = "surrogateType")]
1376 pub surrogate_type: Option<GooglePrivacyDlpV2beta1SurrogateType>,
1377}
1378
1379impl common::Part for GooglePrivacyDlpV2beta1CustomInfoType {}
1380
1381/// Description of the information type (infoType).
1382///
1383/// This type is not used in any activity, and only used as *part* of another schema.
1384///
1385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1386#[serde_with::serde_as]
1387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1388pub struct GooglePrivacyDlpV2beta1InfoTypeDescription {
1389 /// Human readable form of the infoType name.
1390 #[serde(rename = "displayName")]
1391 pub display_name: Option<String>,
1392 /// List of categories this infoType belongs to.
1393 pub categories: Option<Vec<GooglePrivacyDlpV2beta1CategoryDescription>>,
1394 /// Internal name of the infoType.
1395 pub name: Option<String>,
1396}
1397
1398impl common::Part for GooglePrivacyDlpV2beta1InfoTypeDescription {}
1399
1400/// An auxiliary table contains statistical information on the relative
1401/// frequency of different quasi-identifiers values. It has one or several
1402/// quasi-identifiers columns, and one column that indicates the relative
1403/// frequency of each quasi-identifier tuple.
1404/// If a tuple is present in the data but not in the auxiliary table, the
1405/// corresponding relative frequency is assumed to be zero (and thus, the
1406/// tuple is highly reidentifiable).
1407///
1408/// This type is not used in any activity, and only used as *part* of another schema.
1409///
1410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1411#[serde_with::serde_as]
1412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1413pub struct GooglePrivacyDlpV2beta1AuxiliaryTable {
1414 /// Auxiliary table location. [required]
1415 pub table: Option<GooglePrivacyDlpV2beta1BigQueryTable>,
1416 /// Quasi-identifier columns. [required]
1417 #[serde(rename = "quasiIds")]
1418 pub quasi_ids: Option<Vec<GooglePrivacyDlpV2beta1QuasiIdField>>,
1419 /// The relative frequency column must contain a floating-point number
1420 /// between 0 and 1 (inclusive). Null values are assumed to be zero.
1421 /// [required]
1422 #[serde(rename = "relativeFrequency")]
1423 pub relative_frequency: Option<GooglePrivacyDlpV2beta1FieldId>,
1424}
1425
1426impl common::Part for GooglePrivacyDlpV2beta1AuxiliaryTable {}
1427
1428/// The `Status` type defines a logical error model that is suitable for different
1429/// programming environments, including REST APIs and RPC APIs. It is used by
1430/// [gRPC](https://github.com/grpc). The error model is designed to be:
1431///
1432/// * Simple to use and understand for most users
1433/// * Flexible enough to meet unexpected needs
1434///
1435/// # Overview
1436///
1437/// The `Status` message contains three pieces of data: error code, error message,
1438/// and error details. The error code should be an enum value of
1439/// google.rpc.Code, but it may accept additional error codes if needed. The
1440/// error message should be a developer-facing English message that helps
1441/// developers *understand* and *resolve* the error. If a localized user-facing
1442/// error message is needed, put the localized message in the error details or
1443/// localize it in the client. The optional error details may contain arbitrary
1444/// information about the error. There is a predefined set of error detail types
1445/// in the package `google.rpc` that can be used for common error conditions.
1446///
1447/// # Language mapping
1448///
1449/// The `Status` message is the logical representation of the error model, but it
1450/// is not necessarily the actual wire format. When the `Status` message is
1451/// exposed in different client libraries and different wire protocols, it can be
1452/// mapped differently. For example, it will likely be mapped to some exceptions
1453/// in Java, but more likely mapped to some error codes in C.
1454///
1455/// # Other uses
1456///
1457/// The error model and the `Status` message can be used in a variety of
1458/// environments, either with or without APIs, to provide a
1459/// consistent developer experience across different environments.
1460///
1461/// Example uses of this error model include:
1462///
1463/// * Partial errors. If a service needs to return partial errors to the client,
1464/// it may embed the `Status` in the normal response to indicate the partial
1465/// errors.
1466///
1467/// * Workflow errors. A typical workflow has multiple steps. Each step may
1468/// have a `Status` message for error reporting.
1469///
1470/// * Batch operations. If a client uses batch request and batch response, the
1471/// `Status` message should be used directly inside batch response, one for
1472/// each error sub-response.
1473///
1474/// * Asynchronous operations. If an API call embeds asynchronous operation
1475/// results in its response, the status of those operations should be
1476/// represented directly using the `Status` message.
1477///
1478/// * Logging. If some API errors are stored in logs, the message `Status` could
1479/// be used directly after any stripping needed for security/privacy reasons.
1480///
1481/// This type is not used in any activity, and only used as *part* of another schema.
1482#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1483#[serde_with::serde_as]
1484#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1485pub struct GoogleRpcStatus {
1486 /// The status code, which should be an enum value of google.rpc.Code.
1487 pub code: Option<i32>,
1488 /// A developer-facing error message, which should be in English. Any
1489 /// user-facing error message should be localized and sent in the
1490 /// google.rpc.Status.details field, or localized by the client.
1491 pub message: Option<String>,
1492 /// A list of messages that carry the error details. There is a common set of
1493 /// message types for APIs to use.
1494 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1495}
1496
1497impl common::Part for GoogleRpcStatus {}
1498
1499/// A (kind, ID/name) pair used to construct a key path.
1500///
1501/// If either name or ID is set, the element is complete.
1502/// If neither is set, the element is incomplete.
1503///
1504/// This type is not used in any activity, and only used as *part* of another schema.
1505///
1506#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1507#[serde_with::serde_as]
1508#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1509pub struct GooglePrivacyDlpV2beta1PathElement {
1510 /// The auto-allocated ID of the entity.
1511 /// Never equal to zero. Values less than zero are discouraged and may not
1512 /// be supported in the future.
1513 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1514 pub id: Option<i64>,
1515 /// The name of the entity.
1516 /// A name matching regex `__.*__` is reserved/read-only.
1517 /// A name must not be more than 1500 bytes when UTF-8 encoded.
1518 /// Cannot be `""`.
1519 pub name: Option<String>,
1520 /// The kind of the entity.
1521 /// A kind matching regex `__.*__` is reserved/read-only.
1522 /// A kind must not contain more than 1500 bytes when UTF-8 encoded.
1523 /// Cannot be `""`.
1524 pub kind: Option<String>,
1525}
1526
1527impl common::Part for GooglePrivacyDlpV2beta1PathElement {}
1528
1529/// A collection that informs the user the number of times a particular
1530/// `TransformationResultCode` and error details occurred.
1531///
1532/// This type is not used in any activity, and only used as *part* of another schema.
1533///
1534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1535#[serde_with::serde_as]
1536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1537pub struct GooglePrivacyDlpV2beta1SummaryResult {
1538 /// A place for warnings or errors to show up if a transformation didn't
1539 /// work as expected.
1540 pub details: Option<String>,
1541 /// no description provided
1542 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1543 pub count: Option<i64>,
1544 /// no description provided
1545 pub code: Option<String>,
1546}
1547
1548impl common::Part for GooglePrivacyDlpV2beta1SummaryResult {}
1549
1550/// Message defining the location of a BigQuery table. A table is uniquely
1551/// identified by its project_id, dataset_id, and table_name. Within a query
1552/// a table is often referenced with a string in the format of:
1553/// `<project_id>:<dataset_id>.<table_id>` or
1554/// `<project_id>.<dataset_id>.<table_id>`.
1555///
1556/// This type is not used in any activity, and only used as *part* of another schema.
1557///
1558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1559#[serde_with::serde_as]
1560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1561pub struct GooglePrivacyDlpV2beta1BigQueryTable {
1562 /// Name of the table.
1563 #[serde(rename = "tableId")]
1564 pub table_id: Option<String>,
1565 /// The Google Cloud Platform project ID of the project containing the table.
1566 /// If omitted, project ID is inferred from the API call.
1567 #[serde(rename = "projectId")]
1568 pub project_id: Option<String>,
1569 /// Dataset ID of the table.
1570 #[serde(rename = "datasetId")]
1571 pub dataset_id: Option<String>,
1572}
1573
1574impl common::Part for GooglePrivacyDlpV2beta1BigQueryTable {}
1575
1576/// Response for ListRootCategories request.
1577///
1578/// # Activities
1579///
1580/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1581/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1582///
1583/// * [list root categories](RootCategoryListCall) (response)
1584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1585#[serde_with::serde_as]
1586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1587pub struct GooglePrivacyDlpV2beta1ListRootCategoriesResponse {
1588 /// List of all into type categories supported by the API.
1589 pub categories: Option<Vec<GooglePrivacyDlpV2beta1CategoryDescription>>,
1590}
1591
1592impl common::ResponseResult for GooglePrivacyDlpV2beta1ListRootCategoriesResponse {}
1593
1594/// A type of transformation that will scan unstructured text and
1595/// apply various `PrimitiveTransformation`s to each finding, where the
1596/// transformation is applied to only values that were identified as a specific
1597/// info_type.
1598///
1599/// This type is not used in any activity, and only used as *part* of another schema.
1600///
1601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1602#[serde_with::serde_as]
1603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1604pub struct GooglePrivacyDlpV2beta1InfoTypeTransformations {
1605 /// Transformation for each info type. Cannot specify more than one
1606 /// for a given info type. [required]
1607 pub transformations: Option<Vec<GooglePrivacyDlpV2beta1InfoTypeTransformation>>,
1608}
1609
1610impl common::Part for GooglePrivacyDlpV2beta1InfoTypeTransformations {}
1611
1612/// A representation of a Datastore kind.
1613///
1614/// This type is not used in any activity, and only used as *part* of another schema.
1615///
1616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1617#[serde_with::serde_as]
1618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1619pub struct GooglePrivacyDlpV2beta1KindExpression {
1620 /// The name of the kind.
1621 pub name: Option<String>,
1622}
1623
1624impl common::Part for GooglePrivacyDlpV2beta1KindExpression {}
1625
1626/// Set of files to scan.
1627///
1628/// This type is not used in any activity, and only used as *part* of another schema.
1629///
1630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1631#[serde_with::serde_as]
1632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1633pub struct GooglePrivacyDlpV2beta1FileSet {
1634 /// The url, in the format `gs://<bucket>/<path>`. Trailing wildcard in the
1635 /// path is allowed.
1636 pub url: Option<String>,
1637}
1638
1639impl common::Part for GooglePrivacyDlpV2beta1FileSet {}
1640
1641/// A transformation to apply to text that is identified as a specific
1642/// info_type.
1643///
1644/// This type is not used in any activity, and only used as *part* of another schema.
1645///
1646#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1647#[serde_with::serde_as]
1648#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1649pub struct GooglePrivacyDlpV2beta1InfoTypeTransformation {
1650 /// Primitive transformation to apply to the info type. [required]
1651 #[serde(rename = "primitiveTransformation")]
1652 pub primitive_transformation: Option<GooglePrivacyDlpV2beta1PrimitiveTransformation>,
1653 /// Info types to apply the transformation to. Empty list will match all
1654 /// available info types for this transformation.
1655 #[serde(rename = "infoTypes")]
1656 pub info_types: Option<Vec<GooglePrivacyDlpV2beta1InfoType>>,
1657}
1658
1659impl common::Part for GooglePrivacyDlpV2beta1InfoTypeTransformation {}
1660
1661/// Request for creating a risk analysis operation.
1662///
1663/// # Activities
1664///
1665/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1666/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1667///
1668/// * [analyze data source](DataSourceAnalyzeCall) (request)
1669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1670#[serde_with::serde_as]
1671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1672pub struct GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest {
1673 /// Input dataset to compute metrics over.
1674 #[serde(rename = "sourceTable")]
1675 pub source_table: Option<GooglePrivacyDlpV2beta1BigQueryTable>,
1676 /// Privacy metric to compute.
1677 #[serde(rename = "privacyMetric")]
1678 pub privacy_metric: Option<GooglePrivacyDlpV2beta1PrivacyMetric>,
1679}
1680
1681impl common::RequestValue for GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest {}
1682
1683/// Buckets represented as ranges, along with replacement values. Ranges must
1684/// be non-overlapping.
1685///
1686/// This type is not used in any activity, and only used as *part* of another schema.
1687///
1688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1689#[serde_with::serde_as]
1690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1691pub struct GooglePrivacyDlpV2beta1Bucket {
1692 /// Upper bound of the range, exclusive; type must match min.
1693 pub max: Option<GooglePrivacyDlpV2beta1Value>,
1694 /// Replacement value for this bucket. If not provided
1695 /// the default behavior will be to hyphenate the min-max range.
1696 #[serde(rename = "replacementValue")]
1697 pub replacement_value: Option<GooglePrivacyDlpV2beta1Value>,
1698 /// Lower bound of the range, inclusive. Type should be the same as max if
1699 /// used.
1700 pub min: Option<GooglePrivacyDlpV2beta1Value>,
1701}
1702
1703impl common::Part for GooglePrivacyDlpV2beta1Bucket {}
1704
1705/// Location of a finding within a `ContentItem.Table`.
1706///
1707/// This type is not used in any activity, and only used as *part* of another schema.
1708///
1709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1710#[serde_with::serde_as]
1711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1712pub struct GooglePrivacyDlpV2beta1TableLocation {
1713 /// The zero-based index of the row where the finding is located.
1714 #[serde(rename = "rowIndex")]
1715 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1716 pub row_index: Option<i64>,
1717}
1718
1719impl common::Part for GooglePrivacyDlpV2beta1TableLocation {}
1720
1721/// k-anonymity metric, used for analysis of reidentification risk.
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 GooglePrivacyDlpV2beta1KAnonymityConfig {
1729 /// Optional message indicating that each distinct entity_id should not
1730 /// contribute to the k-anonymity count more than once per equivalence class.
1731 /// If an entity_id appears on several rows with different quasi-identifier
1732 /// tuples, it will contribute to each count exactly once.
1733 ///
1734 /// This can lead to unexpected results. Consider a table where ID 1 is
1735 /// associated to quasi-identifier "foo", ID 2 to "bar", and ID 3 to *both*
1736 /// quasi-identifiers "foo" and "bar" (on separate rows), and where this ID
1737 /// is used as entity_id. Then, the anonymity value associated to ID 3 will
1738 /// be 2, even if it is the only ID to be associated to both values "foo" and
1739 /// "bar".
1740 #[serde(rename = "entityId")]
1741 pub entity_id: Option<GooglePrivacyDlpV2beta1EntityId>,
1742 /// Set of fields to compute k-anonymity over. When multiple fields are
1743 /// specified, they are considered a single composite key. Structs and
1744 /// repeated data types are not supported; however, nested fields are
1745 /// supported so long as they are not structs themselves or nested within
1746 /// a repeated field.
1747 #[serde(rename = "quasiIds")]
1748 pub quasi_ids: Option<Vec<GooglePrivacyDlpV2beta1FieldId>>,
1749}
1750
1751impl common::Part for GooglePrivacyDlpV2beta1KAnonymityConfig {}
1752
1753/// Record key for a finding in Cloud Datastore.
1754///
1755/// This type is not used in any activity, and only used as *part* of another schema.
1756///
1757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1758#[serde_with::serde_as]
1759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1760pub struct GooglePrivacyDlpV2beta1DatastoreKey {
1761 /// Datastore entity key.
1762 #[serde(rename = "entityKey")]
1763 pub entity_key: Option<GooglePrivacyDlpV2beta1Key>,
1764}
1765
1766impl common::Part for GooglePrivacyDlpV2beta1DatastoreKey {}
1767
1768/// Message for a unique key indicating a record that contains a finding.
1769///
1770/// This type is not used in any activity, and only used as *part* of another schema.
1771///
1772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1773#[serde_with::serde_as]
1774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1775pub struct GooglePrivacyDlpV2beta1RecordKey {
1776 /// no description provided
1777 #[serde(rename = "cloudStorageKey")]
1778 pub cloud_storage_key: Option<GooglePrivacyDlpV2beta1CloudStorageKey>,
1779 /// no description provided
1780 #[serde(rename = "datastoreKey")]
1781 pub datastore_key: Option<GooglePrivacyDlpV2beta1DatastoreKey>,
1782}
1783
1784impl common::Part for GooglePrivacyDlpV2beta1RecordKey {}
1785
1786/// Request to de-identify a list of items.
1787///
1788/// # Activities
1789///
1790/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1791/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1792///
1793/// * [deidentify content](ContentDeidentifyCall) (request)
1794#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1795#[serde_with::serde_as]
1796#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1797pub struct GooglePrivacyDlpV2beta1DeidentifyContentRequest {
1798 /// Configuration for the inspector.
1799 #[serde(rename = "inspectConfig")]
1800 pub inspect_config: Option<GooglePrivacyDlpV2beta1InspectConfig>,
1801 /// The list of items to inspect. Up to 100 are allowed per request.
1802 /// All items will be treated as text/*.
1803 pub items: Option<Vec<GooglePrivacyDlpV2beta1ContentItem>>,
1804 /// Configuration for the de-identification of the list of content items.
1805 #[serde(rename = "deidentifyConfig")]
1806 pub deidentify_config: Option<GooglePrivacyDlpV2beta1DeidentifyConfig>,
1807}
1808
1809impl common::RequestValue for GooglePrivacyDlpV2beta1DeidentifyContentRequest {}
1810
1811/// All the findings for a single scanned item.
1812///
1813/// This type is not used in any activity, and only used as *part* of another schema.
1814///
1815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1816#[serde_with::serde_as]
1817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1818pub struct GooglePrivacyDlpV2beta1InspectResult {
1819 /// If true, then this item might have more findings than were returned,
1820 /// and the findings returned are an arbitrary subset of all findings.
1821 /// The findings list might be truncated because the input items were too
1822 /// large, or because the server reached the maximum amount of resources
1823 /// allowed for a single API call. For best results, divide the input into
1824 /// smaller batches.
1825 #[serde(rename = "findingsTruncated")]
1826 pub findings_truncated: Option<bool>,
1827 /// List of findings for an item.
1828 pub findings: Option<Vec<GooglePrivacyDlpV2beta1Finding>>,
1829}
1830
1831impl common::Part for GooglePrivacyDlpV2beta1InspectResult {}
1832
1833/// A quasi-identifier column has a custom_tag, used to know which column
1834/// in the data corresponds to which column in the statistical model.
1835///
1836/// This type is not used in any activity, and only used as *part* of another schema.
1837///
1838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1839#[serde_with::serde_as]
1840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1841pub struct GooglePrivacyDlpV2beta1QuasiIdField {
1842 /// no description provided
1843 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
1844 /// no description provided
1845 #[serde(rename = "customTag")]
1846 pub custom_tag: Option<String>,
1847}
1848
1849impl common::Part for GooglePrivacyDlpV2beta1QuasiIdField {}
1850
1851/// Bounding box encompassing detected text within an image.
1852///
1853/// This type is not used in any activity, and only used as *part* of another schema.
1854///
1855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1856#[serde_with::serde_as]
1857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1858pub struct GooglePrivacyDlpV2beta1ImageLocation {
1859 /// Height of the bounding box in pixels.
1860 pub height: Option<i32>,
1861 /// Top coordinate of the bounding box. (0,0) is upper left.
1862 pub top: Option<i32>,
1863 /// Left coordinate of the bounding box. (0,0) is upper left.
1864 pub left: Option<i32>,
1865 /// Width of the bounding box in pixels.
1866 pub width: Option<i32>,
1867}
1868
1869impl common::Part for GooglePrivacyDlpV2beta1ImageLocation {}
1870
1871/// Replace each input value with a given `Value`.
1872///
1873/// This type is not used in any activity, and only used as *part* of another schema.
1874///
1875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1876#[serde_with::serde_as]
1877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1878pub struct GooglePrivacyDlpV2beta1ReplaceValueConfig {
1879 /// Value to replace it with.
1880 #[serde(rename = "newValue")]
1881 pub new_value: Option<GooglePrivacyDlpV2beta1Value>,
1882}
1883
1884impl common::Part for GooglePrivacyDlpV2beta1ReplaceValueConfig {}
1885
1886/// Container structure for the content to inspect.
1887///
1888/// This type is not used in any activity, and only used as *part* of another schema.
1889///
1890#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1891#[serde_with::serde_as]
1892#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1893pub struct GooglePrivacyDlpV2beta1ContentItem {
1894 /// Structured content for inspection.
1895 pub table: Option<GooglePrivacyDlpV2beta1Table>,
1896 /// Content data to inspect or redact.
1897 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1898 pub data: Option<Vec<u8>>,
1899 /// Type of the content, as defined in Content-Type HTTP header.
1900 /// Supported types are: all "text" types, octet streams, PNG images,
1901 /// JPEG images.
1902 #[serde(rename = "type")]
1903 pub type_: Option<String>,
1904 /// String data to inspect or redact.
1905 pub value: Option<String>,
1906}
1907
1908impl common::Part for GooglePrivacyDlpV2beta1ContentItem {}
1909
1910/// Replaces an identifier with a surrogate using FPE with the FFX
1911/// mode of operation.
1912/// The identifier must be representable by the US-ASCII character set.
1913/// For a given crypto key and context, the same identifier will be
1914/// replaced with the same surrogate.
1915/// Identifiers must be at least two characters long.
1916/// In the case that the identifier is the empty string, it will be skipped.
1917///
1918/// This type is not used in any activity, and only used as *part* of another schema.
1919///
1920#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1921#[serde_with::serde_as]
1922#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1923pub struct GooglePrivacyDlpV2beta1CryptoReplaceFfxFpeConfig {
1924 /// The key used by the encryption algorithm. [required]
1925 #[serde(rename = "cryptoKey")]
1926 pub crypto_key: Option<GooglePrivacyDlpV2beta1CryptoKey>,
1927 /// A context may be used for higher security since the same
1928 /// identifier in two different contexts likely will be given a distinct
1929 /// surrogate. The principle is that the likeliness is inversely related
1930 /// to the ratio of the number of distinct identifiers per context over the
1931 /// number of possible surrogates: As long as this ratio is small, the
1932 /// likehood is large.
1933 ///
1934 /// If the context is not set, a default tweak will be used.
1935 /// If the context is set but:
1936 ///
1937 /// 1. there is no record present when transforming a given value or
1938 /// 1. the field is not present when transforming a given value,
1939 ///
1940 /// a default tweak will be used.
1941 ///
1942 /// Note that case (1) is expected when an `InfoTypeTransformation` is
1943 /// applied to both structured and non-structured `ContentItem`s.
1944 /// Currently, the referenced field may be of value type integer or string.
1945 ///
1946 /// The tweak is constructed as a sequence of bytes in big endian byte order
1947 /// such that:
1948 ///
1949 /// - a 64 bit integer is encoded followed by a single byte of value 1
1950 /// - a string is encoded in UTF-8 format followed by a single byte of value 2
1951 ///
1952 /// This is also known as the 'tweak', as in tweakable encryption.
1953 pub context: Option<GooglePrivacyDlpV2beta1FieldId>,
1954 /// The custom info type to annotate the surrogate with.
1955 /// This annotation will be applied to the surrogate by prefixing it with
1956 /// the name of the custom info type followed by the number of
1957 /// characters comprising the surrogate. The following scheme defines the
1958 /// format: info_type_name(surrogate_character_count):surrogate
1959 ///
1960 /// For example, if the name of custom info type is ‘MY_TOKEN_INFO_TYPE’ and
1961 /// the surrogate is ‘abc’, the full replacement value
1962 /// will be: ‘MY_TOKEN_INFO_TYPE(3):abc’
1963 ///
1964 /// This annotation identifies the surrogate when inspecting content using the
1965 /// custom info type
1966 /// [`SurrogateType`](https://cloud.google.com/dlp/docs/reference/rest/v2beta1/InspectConfig#surrogatetype).
1967 /// This facilitates reversal of the surrogate when it occurs in free text.
1968 ///
1969 /// In order for inspection to work properly, the name of this info type must
1970 /// not occur naturally anywhere in your data; otherwise, inspection may
1971 /// find a surrogate that does not correspond to an actual identifier.
1972 /// Therefore, choose your custom info type name carefully after considering
1973 /// what your data looks like. One way to select a name that has a high chance
1974 /// of yielding reliable detection is to include one or more unicode characters
1975 /// that are highly improbable to exist in your data.
1976 /// For example, assuming your data is entered from a regular ASCII keyboard,
1977 /// the symbol with the hex code point 29DD might be used like so:
1978 /// ⧝MY_TOKEN_TYPE
1979 #[serde(rename = "surrogateInfoType")]
1980 pub surrogate_info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
1981 /// no description provided
1982 #[serde(rename = "commonAlphabet")]
1983 pub common_alphabet: Option<String>,
1984 /// The native way to select the alphabet. Must be in the range [2, 62].
1985 pub radix: Option<i32>,
1986 /// This is supported by mapping these to the alphanumeric characters
1987 /// that the FFX mode natively supports. This happens before/after
1988 /// encryption/decryption.
1989 /// Each character listed must appear only once.
1990 /// Number of characters must be in the range [2, 62].
1991 /// This must be encoded as ASCII.
1992 /// The order of characters does not matter.
1993 #[serde(rename = "customAlphabet")]
1994 pub custom_alphabet: Option<String>,
1995}
1996
1997impl common::Part for GooglePrivacyDlpV2beta1CryptoReplaceFfxFpeConfig {}
1998
1999/// Represents a color in the RGB color space.
2000///
2001/// This type is not used in any activity, and only used as *part* of another schema.
2002///
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct GooglePrivacyDlpV2beta1Color {
2007 /// The amount of red in the color as a value in the interval [0, 1].
2008 pub red: Option<f32>,
2009 /// The amount of green in the color as a value in the interval [0, 1].
2010 pub green: Option<f32>,
2011 /// The amount of blue in the color as a value in the interval [0, 1].
2012 pub blue: Option<f32>,
2013}
2014
2015impl common::Part for GooglePrivacyDlpV2beta1Color {}
2016
2017/// Structured content to inspect. Up to 50,000 `Value`s per request allowed.
2018///
2019/// This type is not used in any activity, and only used as *part* of another schema.
2020///
2021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2022#[serde_with::serde_as]
2023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2024pub struct GooglePrivacyDlpV2beta1Table {
2025 /// no description provided
2026 pub rows: Option<Vec<GooglePrivacyDlpV2beta1Row>>,
2027 /// no description provided
2028 pub headers: Option<Vec<GooglePrivacyDlpV2beta1FieldId>>,
2029}
2030
2031impl common::Part for GooglePrivacyDlpV2beta1Table {}
2032
2033/// Message for detecting output from deidentification transformations
2034/// such as
2035/// [`CryptoReplaceFfxFpeConfig`](https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/deidentify#CryptoReplaceFfxFpeConfig).
2036/// These types of transformations are
2037/// those that perform pseudonymization, thereby producing a “surrogate” as
2038/// output. This should be used in conjunction with a field on the
2039/// transformation such as `surrogate_info_type`.
2040///
2041/// This type is not used in any activity, and only used as *part* of another schema.
2042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2043#[serde_with::serde_as]
2044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2045pub struct GooglePrivacyDlpV2beta1SurrogateType {
2046 _never_set: Option<bool>,
2047}
2048
2049impl common::Part for GooglePrivacyDlpV2beta1SurrogateType {}
2050
2051/// This is a data encryption key (DEK) (as opposed to
2052/// a key encryption key (KEK) stored by KMS).
2053/// When using KMS to wrap/unwrap DEKs, be sure to set an appropriate
2054/// IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot
2055/// unwrap the data crypto key.
2056///
2057/// This type is not used in any activity, and only used as *part* of another schema.
2058///
2059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2060#[serde_with::serde_as]
2061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2062pub struct GooglePrivacyDlpV2beta1CryptoKey {
2063 /// no description provided
2064 #[serde(rename = "kmsWrapped")]
2065 pub kms_wrapped: Option<GooglePrivacyDlpV2beta1KmsWrappedCryptoKey>,
2066 /// no description provided
2067 pub unwrapped: Option<GooglePrivacyDlpV2beta1UnwrappedCryptoKey>,
2068 /// no description provided
2069 pub transient: Option<GooglePrivacyDlpV2beta1TransientCryptoKey>,
2070}
2071
2072impl common::Part for GooglePrivacyDlpV2beta1CryptoKey {}
2073
2074/// Max findings configuration per info type, per content item or long running
2075/// operation.
2076///
2077/// This type is not used in any activity, and only used as *part* of another schema.
2078///
2079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2080#[serde_with::serde_as]
2081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2082pub struct GooglePrivacyDlpV2beta1InfoTypeLimit {
2083 /// Type of information the findings limit applies to. Only one limit per
2084 /// info_type should be provided. If InfoTypeLimit does not have an
2085 /// info_type, the DLP API applies the limit against all info_types that are
2086 /// found but not specified in another InfoTypeLimit.
2087 #[serde(rename = "infoType")]
2088 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
2089 /// Max findings limit for the given infoType.
2090 #[serde(rename = "maxFindings")]
2091 pub max_findings: Option<i32>,
2092}
2093
2094impl common::Part for GooglePrivacyDlpV2beta1InfoTypeLimit {}
2095
2096/// Set of primitive values supported by the system.
2097///
2098/// This type is not used in any activity, and only used as *part* of another schema.
2099///
2100#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2101#[serde_with::serde_as]
2102#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2103pub struct GooglePrivacyDlpV2beta1Value {
2104 /// no description provided
2105 #[serde(rename = "floatValue")]
2106 pub float_value: Option<f64>,
2107 /// no description provided
2108 #[serde(rename = "timeValue")]
2109 pub time_value: Option<GoogleTypeTimeOfDay>,
2110 /// no description provided
2111 #[serde(rename = "integerValue")]
2112 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2113 pub integer_value: Option<i64>,
2114 /// no description provided
2115 #[serde(rename = "stringValue")]
2116 pub string_value: Option<String>,
2117 /// no description provided
2118 #[serde(rename = "dateValue")]
2119 pub date_value: Option<GoogleTypeDate>,
2120 /// no description provided
2121 #[serde(rename = "timestampValue")]
2122 pub timestamp_value: Option<chrono::DateTime<chrono::offset::Utc>>,
2123 /// no description provided
2124 #[serde(rename = "booleanValue")]
2125 pub boolean_value: Option<bool>,
2126}
2127
2128impl common::Part for GooglePrivacyDlpV2beta1Value {}
2129
2130/// The field type of `value` and `field` do not need to match to be
2131/// considered equal, but not all comparisons are possible.
2132///
2133/// A `value` of type:
2134///
2135/// - `string` can be compared against all other types
2136/// - `boolean` can only be compared against other booleans
2137/// - `integer` can be compared against doubles or a string if the string value
2138/// can be parsed as an integer.
2139/// - `double` can be compared against integers or a string if the string can
2140/// be parsed as a double.
2141/// - `Timestamp` can be compared against strings in RFC 3339 date string
2142/// format.
2143/// - `TimeOfDay` can be compared against timestamps and strings in the format
2144/// of 'HH:mm:ss'.
2145///
2146/// If we fail to compare do to type mismatch, a warning will be given and
2147/// the condition will evaluate to false.
2148///
2149/// This type is not used in any activity, and only used as *part* of another schema.
2150///
2151#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2152#[serde_with::serde_as]
2153#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2154pub struct GooglePrivacyDlpV2beta1Condition {
2155 /// Field within the record this condition is evaluated against. [required]
2156 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
2157 /// Operator used to compare the field or info type to the value. [required]
2158 pub operator: Option<String>,
2159 /// Value to compare against. [Required, except for `EXISTS` tests.]
2160 pub value: Option<GooglePrivacyDlpV2beta1Value>,
2161}
2162
2163impl common::Part for GooglePrivacyDlpV2beta1Condition {}
2164
2165/// Datastore partition ID.
2166/// A partition ID identifies a grouping of entities. The grouping is always
2167/// by project and namespace, however the namespace ID may be empty.
2168///
2169/// A partition ID contains several dimensions:
2170/// project ID and namespace ID.
2171///
2172/// This type is not used in any activity, and only used as *part* of another schema.
2173///
2174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2175#[serde_with::serde_as]
2176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2177pub struct GooglePrivacyDlpV2beta1PartitionId {
2178 /// If not empty, the ID of the namespace to which the entities belong.
2179 #[serde(rename = "namespaceId")]
2180 pub namespace_id: Option<String>,
2181 /// The ID of the project to which the entities belong.
2182 #[serde(rename = "projectId")]
2183 pub project_id: Option<String>,
2184}
2185
2186impl common::Part for GooglePrivacyDlpV2beta1PartitionId {}
2187
2188/// Results of inspecting a list of items.
2189///
2190/// # Activities
2191///
2192/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2193/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2194///
2195/// * [inspect content](ContentInspectCall) (response)
2196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2197#[serde_with::serde_as]
2198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2199pub struct GooglePrivacyDlpV2beta1InspectContentResponse {
2200 /// Each content_item from the request has a result in this list, in the
2201 /// same order as the request.
2202 pub results: Option<Vec<GooglePrivacyDlpV2beta1InspectResult>>,
2203}
2204
2205impl common::ResponseResult for GooglePrivacyDlpV2beta1InspectContentResponse {}
2206
2207/// Request to search for potentially sensitive info in a list of items
2208/// and replace it with a default or provided content.
2209///
2210/// # Activities
2211///
2212/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2213/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2214///
2215/// * [redact content](ContentRedactCall) (request)
2216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2217#[serde_with::serde_as]
2218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2219pub struct GooglePrivacyDlpV2beta1RedactContentRequest {
2220 /// The list of items to inspect. Up to 100 are allowed per request.
2221 pub items: Option<Vec<GooglePrivacyDlpV2beta1ContentItem>>,
2222 /// The strings to replace findings text findings with. Must specify at least
2223 /// one of these or one ImageRedactionConfig if redacting images.
2224 #[serde(rename = "replaceConfigs")]
2225 pub replace_configs: Option<Vec<GooglePrivacyDlpV2beta1ReplaceConfig>>,
2226 /// The configuration for specifying what content to redact from images.
2227 #[serde(rename = "imageRedactionConfigs")]
2228 pub image_redaction_configs: Option<Vec<GooglePrivacyDlpV2beta1ImageRedactionConfig>>,
2229 /// Configuration for the inspector.
2230 #[serde(rename = "inspectConfig")]
2231 pub inspect_config: Option<GooglePrivacyDlpV2beta1InspectConfig>,
2232}
2233
2234impl common::RequestValue for GooglePrivacyDlpV2beta1RedactContentRequest {}
2235
2236/// Message defining a list of words or phrases to search for in the data.
2237///
2238/// This type is not used in any activity, and only used as *part* of another schema.
2239///
2240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2241#[serde_with::serde_as]
2242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2243pub struct GooglePrivacyDlpV2beta1WordList {
2244 /// Words or phrases defining the dictionary. The dictionary must contain
2245 /// at least one phrase and every phrase must contain at least 2 characters
2246 /// that are letters or digits. [required]
2247 pub words: Option<Vec<String>>,
2248}
2249
2250impl common::Part for GooglePrivacyDlpV2beta1WordList {}
2251
2252/// General identifier of a data field in a storage service.
2253///
2254/// This type is not used in any activity, and only used as *part* of another schema.
2255///
2256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2257#[serde_with::serde_as]
2258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2259pub struct GooglePrivacyDlpV2beta1FieldId {
2260 /// Name describing the field.
2261 #[serde(rename = "columnName")]
2262 pub column_name: Option<String>,
2263}
2264
2265impl common::Part for GooglePrivacyDlpV2beta1FieldId {}
2266
2267/// Summary of a single tranformation.
2268///
2269/// This type is not used in any activity, and only used as *part* of another schema.
2270///
2271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2272#[serde_with::serde_as]
2273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2274pub struct GooglePrivacyDlpV2beta1TransformationSummary {
2275 /// The field transformation that was applied. This list will contain
2276 /// multiple only in the case of errors.
2277 #[serde(rename = "fieldTransformations")]
2278 pub field_transformations: Option<Vec<GooglePrivacyDlpV2beta1FieldTransformation>>,
2279 /// The specific suppression option these stats apply to.
2280 #[serde(rename = "recordSuppress")]
2281 pub record_suppress: Option<GooglePrivacyDlpV2beta1RecordSuppression>,
2282 /// Set if the transformation was limited to a specific info_type.
2283 #[serde(rename = "infoType")]
2284 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
2285 /// The specific transformation these stats apply to.
2286 pub transformation: Option<GooglePrivacyDlpV2beta1PrimitiveTransformation>,
2287 /// no description provided
2288 pub results: Option<Vec<GooglePrivacyDlpV2beta1SummaryResult>>,
2289 /// Set if the transformation was limited to a specific FieldId.
2290 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
2291}
2292
2293impl common::Part for GooglePrivacyDlpV2beta1TransformationSummary {}
2294
2295/// The request message for Operations.CancelOperation.
2296///
2297/// # Activities
2298///
2299/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2300/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2301///
2302/// * [operations cancel risk analysis](RiskAnalysiOperationCancelCall) (request)
2303/// * [operations cancel inspect](InspectOperationCancelCall) (request)
2304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2305#[serde_with::serde_as]
2306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2307pub struct GoogleLongrunningCancelOperationRequest {
2308 _never_set: Option<bool>,
2309}
2310
2311impl common::RequestValue for GoogleLongrunningCancelOperationRequest {}
2312
2313/// Partially mask a string by replacing a given number of characters with a
2314/// fixed character. Masking can start from the beginning or end of the string.
2315/// This can be used on data of any type (numbers, longs, and so on) and when
2316/// de-identifying structured data we'll attempt to preserve the original data's
2317/// type. (This allows you to take a long like 123 and modify it to a string like
2318/// **3.
2319///
2320/// This type is not used in any activity, and only used as *part* of another schema.
2321///
2322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2323#[serde_with::serde_as]
2324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2325pub struct GooglePrivacyDlpV2beta1CharacterMaskConfig {
2326 /// When masking a string, items in this list will be skipped when replacing.
2327 /// For example, if your string is 555-555-5555 and you ask us to skip `-` and
2328 /// mask 5 chars with * we would produce ***-*55-5555.
2329 #[serde(rename = "charactersToIgnore")]
2330 pub characters_to_ignore: Option<Vec<GooglePrivacyDlpV2beta1CharsToIgnore>>,
2331 /// Character to mask the sensitive values—for example, "*" for an
2332 /// alphabetic string such as name, or "0" for a numeric string such as ZIP
2333 /// code or credit card number. String must have length 1. If not supplied, we
2334 /// will default to "*" for strings, 0 for digits.
2335 #[serde(rename = "maskingCharacter")]
2336 pub masking_character: Option<String>,
2337 /// Mask characters in reverse order. For example, if `masking_character` is
2338 /// '0', number_to_mask is 14, and `reverse_order` is false, then
2339 /// 1234-5678-9012-3456 -> 00000000000000-3456
2340 /// If `masking_character` is '*', `number_to_mask` is 3, and `reverse_order`
2341 /// is true, then 12345 -> 12***
2342 #[serde(rename = "reverseOrder")]
2343 pub reverse_order: Option<bool>,
2344 /// Number of characters to mask. If not set, all matching chars will be
2345 /// masked. Skipped characters do not count towards this tally.
2346 #[serde(rename = "numberToMask")]
2347 pub number_to_mask: Option<i32>,
2348}
2349
2350impl common::Part for GooglePrivacyDlpV2beta1CharacterMaskConfig {}
2351
2352/// Use this to have a random data crypto key generated.
2353/// It will be discarded after the operation/request finishes.
2354///
2355/// This type is not used in any activity, and only used as *part* of another schema.
2356///
2357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2358#[serde_with::serde_as]
2359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2360pub struct GooglePrivacyDlpV2beta1TransientCryptoKey {
2361 /// Name of the key. [required]
2362 /// This is an arbitrary string used to differentiate different keys.
2363 /// A unique key is generated per name: two separate `TransientCryptoKey`
2364 /// protos share the same generated key if their names are the same.
2365 /// When the data crypto key is generated, this name is not used in any way
2366 /// (repeating the api call will result in a different key being generated).
2367 pub name: Option<String>,
2368}
2369
2370impl common::Part for GooglePrivacyDlpV2beta1TransientCryptoKey {}
2371
2372/// Request for scheduling a scan of a data subset from a Google Platform data
2373/// repository.
2374///
2375/// # Activities
2376///
2377/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2378/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2379///
2380/// * [operations create inspect](InspectOperationCreateCall) (request)
2381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2382#[serde_with::serde_as]
2383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2384pub struct GooglePrivacyDlpV2beta1CreateInspectOperationRequest {
2385 /// Specification of the data set to process.
2386 #[serde(rename = "storageConfig")]
2387 pub storage_config: Option<GooglePrivacyDlpV2beta1StorageConfig>,
2388 /// Optional location to store findings.
2389 #[serde(rename = "outputConfig")]
2390 pub output_config: Option<GooglePrivacyDlpV2beta1OutputStorageConfig>,
2391 /// Additional configuration settings for long running operations.
2392 #[serde(rename = "operationConfig")]
2393 pub operation_config: Option<GooglePrivacyDlpV2beta1OperationConfig>,
2394 /// Configuration for the inspector.
2395 #[serde(rename = "inspectConfig")]
2396 pub inspect_config: Option<GooglePrivacyDlpV2beta1InspectConfig>,
2397}
2398
2399impl common::RequestValue for GooglePrivacyDlpV2beta1CreateInspectOperationRequest {}
2400
2401/// A column with a semantic tag attached.
2402///
2403/// This type is not used in any activity, and only used as *part* of another schema.
2404///
2405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2406#[serde_with::serde_as]
2407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2408pub struct GooglePrivacyDlpV2beta1TaggedField {
2409 /// A column can be tagged with a custom tag. In this case, the user must
2410 /// indicate an auxiliary table that contains statistical information on
2411 /// the possible values of this column (below).
2412 #[serde(rename = "customTag")]
2413 pub custom_tag: Option<String>,
2414 /// A column can be tagged with a InfoType to use the relevant public
2415 /// dataset as a statistical model of population, if available. We
2416 /// currently support US ZIP codes, region codes, ages and genders.
2417 #[serde(rename = "infoType")]
2418 pub info_type: Option<GooglePrivacyDlpV2beta1InfoType>,
2419 /// If no semantic tag is indicated, we infer the statistical model from
2420 /// the distribution of values in the input data
2421 pub inferred: Option<GoogleProtobufEmpty>,
2422 /// Identifies the column. [required]
2423 pub field: Option<GooglePrivacyDlpV2beta1FieldId>,
2424}
2425
2426impl common::Part for GooglePrivacyDlpV2beta1TaggedField {}
2427
2428/// Results of redacting a list of items.
2429///
2430/// # Activities
2431///
2432/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2433/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2434///
2435/// * [redact content](ContentRedactCall) (response)
2436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2437#[serde_with::serde_as]
2438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2439pub struct GooglePrivacyDlpV2beta1RedactContentResponse {
2440 /// The redacted content.
2441 pub items: Option<Vec<GooglePrivacyDlpV2beta1ContentItem>>,
2442}
2443
2444impl common::ResponseResult for GooglePrivacyDlpV2beta1RedactContentResponse {}
2445
2446/// A reference to a property relative to the Datastore kind expressions.
2447///
2448/// This type is not used in any activity, and only used as *part* of another schema.
2449///
2450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2451#[serde_with::serde_as]
2452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2453pub struct GooglePrivacyDlpV2beta1PropertyReference {
2454 /// The name of the property.
2455 /// If name includes "."s, it may be interpreted as a property name path.
2456 pub name: Option<String>,
2457}
2458
2459impl common::Part for GooglePrivacyDlpV2beta1PropertyReference {}
2460
2461// ###################
2462// MethodBuilders ###
2463// #################
2464
2465/// A builder providing access to all methods supported on *content* resources.
2466/// It is not used directly, but through the [`DLP`] hub.
2467///
2468/// # Example
2469///
2470/// Instantiate a resource builder
2471///
2472/// ```test_harness,no_run
2473/// extern crate hyper;
2474/// extern crate hyper_rustls;
2475/// extern crate google_dlp2_beta1 as dlp2_beta1;
2476///
2477/// # async fn dox() {
2478/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2479///
2480/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2481/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2482/// .with_native_roots()
2483/// .unwrap()
2484/// .https_only()
2485/// .enable_http2()
2486/// .build();
2487///
2488/// let executor = hyper_util::rt::TokioExecutor::new();
2489/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2490/// secret,
2491/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2492/// yup_oauth2::client::CustomHyperClientBuilder::from(
2493/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2494/// ),
2495/// ).build().await.unwrap();
2496///
2497/// let client = hyper_util::client::legacy::Client::builder(
2498/// hyper_util::rt::TokioExecutor::new()
2499/// )
2500/// .build(
2501/// hyper_rustls::HttpsConnectorBuilder::new()
2502/// .with_native_roots()
2503/// .unwrap()
2504/// .https_or_http()
2505/// .enable_http2()
2506/// .build()
2507/// );
2508/// let mut hub = DLP::new(client, auth);
2509/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2510/// // like `deidentify(...)`, `inspect(...)` and `redact(...)`
2511/// // to build up your call.
2512/// let rb = hub.content();
2513/// # }
2514/// ```
2515pub struct ContentMethods<'a, C>
2516where
2517 C: 'a,
2518{
2519 hub: &'a DLP<C>,
2520}
2521
2522impl<'a, C> common::MethodsBuilder for ContentMethods<'a, C> {}
2523
2524impl<'a, C> ContentMethods<'a, C> {
2525 /// Create a builder to help you perform the following task:
2526 ///
2527 /// De-identifies potentially sensitive info from a list of strings.
2528 /// This method has limits on input size and output size.
2529 ///
2530 /// # Arguments
2531 ///
2532 /// * `request` - No description provided.
2533 pub fn deidentify(
2534 &self,
2535 request: GooglePrivacyDlpV2beta1DeidentifyContentRequest,
2536 ) -> ContentDeidentifyCall<'a, C> {
2537 ContentDeidentifyCall {
2538 hub: self.hub,
2539 _request: request,
2540 _delegate: Default::default(),
2541 _additional_params: Default::default(),
2542 _scopes: Default::default(),
2543 }
2544 }
2545
2546 /// Create a builder to help you perform the following task:
2547 ///
2548 /// Finds potentially sensitive info in a list of strings.
2549 /// This method has limits on input size, processing time, and output size.
2550 ///
2551 /// # Arguments
2552 ///
2553 /// * `request` - No description provided.
2554 pub fn inspect(
2555 &self,
2556 request: GooglePrivacyDlpV2beta1InspectContentRequest,
2557 ) -> ContentInspectCall<'a, C> {
2558 ContentInspectCall {
2559 hub: self.hub,
2560 _request: request,
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 /// Redacts potentially sensitive info from a list of strings.
2570 /// This method has limits on input size, processing time, and output size.
2571 ///
2572 /// # Arguments
2573 ///
2574 /// * `request` - No description provided.
2575 pub fn redact(
2576 &self,
2577 request: GooglePrivacyDlpV2beta1RedactContentRequest,
2578 ) -> ContentRedactCall<'a, C> {
2579 ContentRedactCall {
2580 hub: self.hub,
2581 _request: request,
2582 _delegate: Default::default(),
2583 _additional_params: Default::default(),
2584 _scopes: Default::default(),
2585 }
2586 }
2587}
2588
2589/// A builder providing access to all methods supported on *rootCategory* resources.
2590/// It is not used directly, but through the [`DLP`] hub.
2591///
2592/// # Example
2593///
2594/// Instantiate a resource builder
2595///
2596/// ```test_harness,no_run
2597/// extern crate hyper;
2598/// extern crate hyper_rustls;
2599/// extern crate google_dlp2_beta1 as dlp2_beta1;
2600///
2601/// # async fn dox() {
2602/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2603///
2604/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2605/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2606/// .with_native_roots()
2607/// .unwrap()
2608/// .https_only()
2609/// .enable_http2()
2610/// .build();
2611///
2612/// let executor = hyper_util::rt::TokioExecutor::new();
2613/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2614/// secret,
2615/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2616/// yup_oauth2::client::CustomHyperClientBuilder::from(
2617/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2618/// ),
2619/// ).build().await.unwrap();
2620///
2621/// let client = hyper_util::client::legacy::Client::builder(
2622/// hyper_util::rt::TokioExecutor::new()
2623/// )
2624/// .build(
2625/// hyper_rustls::HttpsConnectorBuilder::new()
2626/// .with_native_roots()
2627/// .unwrap()
2628/// .https_or_http()
2629/// .enable_http2()
2630/// .build()
2631/// );
2632/// let mut hub = DLP::new(client, auth);
2633/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2634/// // like `info_types_list(...)` and `list(...)`
2635/// // to build up your call.
2636/// let rb = hub.root_categories();
2637/// # }
2638/// ```
2639pub struct RootCategoryMethods<'a, C>
2640where
2641 C: 'a,
2642{
2643 hub: &'a DLP<C>,
2644}
2645
2646impl<'a, C> common::MethodsBuilder for RootCategoryMethods<'a, C> {}
2647
2648impl<'a, C> RootCategoryMethods<'a, C> {
2649 /// Create a builder to help you perform the following task:
2650 ///
2651 /// Returns sensitive information types for given category.
2652 ///
2653 /// # Arguments
2654 ///
2655 /// * `category` - Category name as returned by ListRootCategories.
2656 pub fn info_types_list(&self, category: &str) -> RootCategoryInfoTypeListCall<'a, C> {
2657 RootCategoryInfoTypeListCall {
2658 hub: self.hub,
2659 _category: category.to_string(),
2660 _language_code: Default::default(),
2661 _delegate: Default::default(),
2662 _additional_params: Default::default(),
2663 _scopes: Default::default(),
2664 }
2665 }
2666
2667 /// Create a builder to help you perform the following task:
2668 ///
2669 /// Returns the list of root categories of sensitive information.
2670 pub fn list(&self) -> RootCategoryListCall<'a, C> {
2671 RootCategoryListCall {
2672 hub: self.hub,
2673 _language_code: Default::default(),
2674 _delegate: Default::default(),
2675 _additional_params: Default::default(),
2676 _scopes: Default::default(),
2677 }
2678 }
2679}
2680
2681/// A builder providing access to all methods supported on *riskAnalysi* resources.
2682/// It is not used directly, but through the [`DLP`] hub.
2683///
2684/// # Example
2685///
2686/// Instantiate a resource builder
2687///
2688/// ```test_harness,no_run
2689/// extern crate hyper;
2690/// extern crate hyper_rustls;
2691/// extern crate google_dlp2_beta1 as dlp2_beta1;
2692///
2693/// # async fn dox() {
2694/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2695///
2696/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2697/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2698/// .with_native_roots()
2699/// .unwrap()
2700/// .https_only()
2701/// .enable_http2()
2702/// .build();
2703///
2704/// let executor = hyper_util::rt::TokioExecutor::new();
2705/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2706/// secret,
2707/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2708/// yup_oauth2::client::CustomHyperClientBuilder::from(
2709/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2710/// ),
2711/// ).build().await.unwrap();
2712///
2713/// let client = hyper_util::client::legacy::Client::builder(
2714/// hyper_util::rt::TokioExecutor::new()
2715/// )
2716/// .build(
2717/// hyper_rustls::HttpsConnectorBuilder::new()
2718/// .with_native_roots()
2719/// .unwrap()
2720/// .https_or_http()
2721/// .enable_http2()
2722/// .build()
2723/// );
2724/// let mut hub = DLP::new(client, auth);
2725/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2726/// // like `operations_cancel(...)`, `operations_delete(...)`, `operations_get(...)` and `operations_list(...)`
2727/// // to build up your call.
2728/// let rb = hub.risk_analysis();
2729/// # }
2730/// ```
2731pub struct RiskAnalysiMethods<'a, C>
2732where
2733 C: 'a,
2734{
2735 hub: &'a DLP<C>,
2736}
2737
2738impl<'a, C> common::MethodsBuilder for RiskAnalysiMethods<'a, C> {}
2739
2740impl<'a, C> RiskAnalysiMethods<'a, C> {
2741 /// Create a builder to help you perform the following task:
2742 ///
2743 /// Cancels an operation. Use the `inspect.operations.get` to check whether the cancellation succeeded or the operation completed despite cancellation.
2744 ///
2745 /// # Arguments
2746 ///
2747 /// * `request` - No description provided.
2748 /// * `name` - The name of the operation resource to be cancelled.
2749 pub fn operations_cancel(
2750 &self,
2751 request: GoogleLongrunningCancelOperationRequest,
2752 name: &str,
2753 ) -> RiskAnalysiOperationCancelCall<'a, C> {
2754 RiskAnalysiOperationCancelCall {
2755 hub: self.hub,
2756 _request: request,
2757 _name: name.to_string(),
2758 _delegate: Default::default(),
2759 _additional_params: Default::default(),
2760 _scopes: Default::default(),
2761 }
2762 }
2763
2764 /// Create a builder to help you perform the following task:
2765 ///
2766 /// This method is not supported and the server returns `UNIMPLEMENTED`.
2767 ///
2768 /// # Arguments
2769 ///
2770 /// * `name` - The name of the operation resource to be deleted.
2771 pub fn operations_delete(&self, name: &str) -> RiskAnalysiOperationDeleteCall<'a, C> {
2772 RiskAnalysiOperationDeleteCall {
2773 hub: self.hub,
2774 _name: name.to_string(),
2775 _delegate: Default::default(),
2776 _additional_params: Default::default(),
2777 _scopes: Default::default(),
2778 }
2779 }
2780
2781 /// Create a builder to help you perform the following task:
2782 ///
2783 /// Fetches the list of long running operations.
2784 ///
2785 /// # Arguments
2786 ///
2787 /// * `name` - The name of the operation's parent resource.
2788 pub fn operations_list(&self, name: &str) -> RiskAnalysiOperationListCall<'a, C> {
2789 RiskAnalysiOperationListCall {
2790 hub: self.hub,
2791 _name: name.to_string(),
2792 _page_token: Default::default(),
2793 _page_size: Default::default(),
2794 _filter: Default::default(),
2795 _delegate: Default::default(),
2796 _additional_params: Default::default(),
2797 _scopes: Default::default(),
2798 }
2799 }
2800
2801 /// Create a builder to help you perform the following task:
2802 ///
2803 /// Gets the latest state of a long-running operation. Clients can use this
2804 /// method to poll the operation result at intervals as recommended by the API
2805 /// service.
2806 ///
2807 /// # Arguments
2808 ///
2809 /// * `name` - The name of the operation resource.
2810 pub fn operations_get(&self, name: &str) -> RiskAnalysiOperationGetCall<'a, C> {
2811 RiskAnalysiOperationGetCall {
2812 hub: self.hub,
2813 _name: name.to_string(),
2814 _delegate: Default::default(),
2815 _additional_params: Default::default(),
2816 _scopes: Default::default(),
2817 }
2818 }
2819}
2820
2821/// A builder providing access to all methods supported on *dataSource* resources.
2822/// It is not used directly, but through the [`DLP`] hub.
2823///
2824/// # Example
2825///
2826/// Instantiate a resource builder
2827///
2828/// ```test_harness,no_run
2829/// extern crate hyper;
2830/// extern crate hyper_rustls;
2831/// extern crate google_dlp2_beta1 as dlp2_beta1;
2832///
2833/// # async fn dox() {
2834/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2835///
2836/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2837/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2838/// .with_native_roots()
2839/// .unwrap()
2840/// .https_only()
2841/// .enable_http2()
2842/// .build();
2843///
2844/// let executor = hyper_util::rt::TokioExecutor::new();
2845/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2846/// secret,
2847/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2848/// yup_oauth2::client::CustomHyperClientBuilder::from(
2849/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2850/// ),
2851/// ).build().await.unwrap();
2852///
2853/// let client = hyper_util::client::legacy::Client::builder(
2854/// hyper_util::rt::TokioExecutor::new()
2855/// )
2856/// .build(
2857/// hyper_rustls::HttpsConnectorBuilder::new()
2858/// .with_native_roots()
2859/// .unwrap()
2860/// .https_or_http()
2861/// .enable_http2()
2862/// .build()
2863/// );
2864/// let mut hub = DLP::new(client, auth);
2865/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2866/// // like `analyze(...)`
2867/// // to build up your call.
2868/// let rb = hub.data_source();
2869/// # }
2870/// ```
2871pub struct DataSourceMethods<'a, C>
2872where
2873 C: 'a,
2874{
2875 hub: &'a DLP<C>,
2876}
2877
2878impl<'a, C> common::MethodsBuilder for DataSourceMethods<'a, C> {}
2879
2880impl<'a, C> DataSourceMethods<'a, C> {
2881 /// Create a builder to help you perform the following task:
2882 ///
2883 /// Schedules a job to compute risk analysis metrics over content in a Google
2884 /// Cloud Platform repository.
2885 ///
2886 /// # Arguments
2887 ///
2888 /// * `request` - No description provided.
2889 pub fn analyze(
2890 &self,
2891 request: GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest,
2892 ) -> DataSourceAnalyzeCall<'a, C> {
2893 DataSourceAnalyzeCall {
2894 hub: self.hub,
2895 _request: request,
2896 _delegate: Default::default(),
2897 _additional_params: Default::default(),
2898 _scopes: Default::default(),
2899 }
2900 }
2901}
2902
2903/// A builder providing access to all methods supported on *inspect* resources.
2904/// It is not used directly, but through the [`DLP`] hub.
2905///
2906/// # Example
2907///
2908/// Instantiate a resource builder
2909///
2910/// ```test_harness,no_run
2911/// extern crate hyper;
2912/// extern crate hyper_rustls;
2913/// extern crate google_dlp2_beta1 as dlp2_beta1;
2914///
2915/// # async fn dox() {
2916/// use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2917///
2918/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2919/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2920/// .with_native_roots()
2921/// .unwrap()
2922/// .https_only()
2923/// .enable_http2()
2924/// .build();
2925///
2926/// let executor = hyper_util::rt::TokioExecutor::new();
2927/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2928/// secret,
2929/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2930/// yup_oauth2::client::CustomHyperClientBuilder::from(
2931/// hyper_util::client::legacy::Client::builder(executor).build(connector),
2932/// ),
2933/// ).build().await.unwrap();
2934///
2935/// let client = hyper_util::client::legacy::Client::builder(
2936/// hyper_util::rt::TokioExecutor::new()
2937/// )
2938/// .build(
2939/// hyper_rustls::HttpsConnectorBuilder::new()
2940/// .with_native_roots()
2941/// .unwrap()
2942/// .https_or_http()
2943/// .enable_http2()
2944/// .build()
2945/// );
2946/// let mut hub = DLP::new(client, auth);
2947/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2948/// // like `operations_cancel(...)`, `operations_create(...)`, `operations_delete(...)`, `operations_get(...)`, `operations_list(...)` and `results_findings_list(...)`
2949/// // to build up your call.
2950/// let rb = hub.inspect();
2951/// # }
2952/// ```
2953pub struct InspectMethods<'a, C>
2954where
2955 C: 'a,
2956{
2957 hub: &'a DLP<C>,
2958}
2959
2960impl<'a, C> common::MethodsBuilder for InspectMethods<'a, C> {}
2961
2962impl<'a, C> InspectMethods<'a, C> {
2963 /// Create a builder to help you perform the following task:
2964 ///
2965 /// Schedules a job scanning content in a Google Cloud Platform data
2966 /// repository.
2967 ///
2968 /// # Arguments
2969 ///
2970 /// * `request` - No description provided.
2971 pub fn operations_create(
2972 &self,
2973 request: GooglePrivacyDlpV2beta1CreateInspectOperationRequest,
2974 ) -> InspectOperationCreateCall<'a, C> {
2975 InspectOperationCreateCall {
2976 hub: self.hub,
2977 _request: request,
2978 _delegate: Default::default(),
2979 _additional_params: Default::default(),
2980 _scopes: Default::default(),
2981 }
2982 }
2983
2984 /// Create a builder to help you perform the following task:
2985 ///
2986 /// Cancels an operation. Use the `inspect.operations.get` to check whether the cancellation succeeded or the operation completed despite cancellation.
2987 ///
2988 /// # Arguments
2989 ///
2990 /// * `request` - No description provided.
2991 /// * `name` - The name of the operation resource to be cancelled.
2992 pub fn operations_cancel(
2993 &self,
2994 request: GoogleLongrunningCancelOperationRequest,
2995 name: &str,
2996 ) -> InspectOperationCancelCall<'a, C> {
2997 InspectOperationCancelCall {
2998 hub: self.hub,
2999 _request: request,
3000 _name: name.to_string(),
3001 _delegate: Default::default(),
3002 _additional_params: Default::default(),
3003 _scopes: Default::default(),
3004 }
3005 }
3006
3007 /// Create a builder to help you perform the following task:
3008 ///
3009 /// This method is not supported and the server returns `UNIMPLEMENTED`.
3010 ///
3011 /// # Arguments
3012 ///
3013 /// * `name` - The name of the operation resource to be deleted.
3014 pub fn operations_delete(&self, name: &str) -> InspectOperationDeleteCall<'a, C> {
3015 InspectOperationDeleteCall {
3016 hub: self.hub,
3017 _name: name.to_string(),
3018 _delegate: Default::default(),
3019 _additional_params: Default::default(),
3020 _scopes: Default::default(),
3021 }
3022 }
3023
3024 /// Create a builder to help you perform the following task:
3025 ///
3026 /// Fetches the list of long running operations.
3027 ///
3028 /// # Arguments
3029 ///
3030 /// * `name` - The name of the operation's parent resource.
3031 pub fn operations_list(&self, name: &str) -> InspectOperationListCall<'a, C> {
3032 InspectOperationListCall {
3033 hub: self.hub,
3034 _name: name.to_string(),
3035 _page_token: Default::default(),
3036 _page_size: Default::default(),
3037 _filter: Default::default(),
3038 _delegate: Default::default(),
3039 _additional_params: Default::default(),
3040 _scopes: Default::default(),
3041 }
3042 }
3043
3044 /// Create a builder to help you perform the following task:
3045 ///
3046 /// Gets the latest state of a long-running operation. Clients can use this
3047 /// method to poll the operation result at intervals as recommended by the API
3048 /// service.
3049 ///
3050 /// # Arguments
3051 ///
3052 /// * `name` - The name of the operation resource.
3053 pub fn operations_get(&self, name: &str) -> InspectOperationGetCall<'a, C> {
3054 InspectOperationGetCall {
3055 hub: self.hub,
3056 _name: name.to_string(),
3057 _delegate: Default::default(),
3058 _additional_params: Default::default(),
3059 _scopes: Default::default(),
3060 }
3061 }
3062
3063 /// Create a builder to help you perform the following task:
3064 ///
3065 /// Returns list of results for given inspect operation result set id.
3066 ///
3067 /// # Arguments
3068 ///
3069 /// * `name` - Identifier of the results set returned as metadata of
3070 /// the longrunning operation created by a call to InspectDataSource.
3071 /// Should be in the format of `inspect/results/{id}`.
3072 pub fn results_findings_list(&self, name: &str) -> InspectResultFindingListCall<'a, C> {
3073 InspectResultFindingListCall {
3074 hub: self.hub,
3075 _name: name.to_string(),
3076 _page_token: Default::default(),
3077 _page_size: Default::default(),
3078 _filter: Default::default(),
3079 _delegate: Default::default(),
3080 _additional_params: Default::default(),
3081 _scopes: Default::default(),
3082 }
3083 }
3084}
3085
3086// ###################
3087// CallBuilders ###
3088// #################
3089
3090/// De-identifies potentially sensitive info from a list of strings.
3091/// This method has limits on input size and output size.
3092///
3093/// A builder for the *deidentify* method supported by a *content* resource.
3094/// It is not used directly, but through a [`ContentMethods`] instance.
3095///
3096/// # Example
3097///
3098/// Instantiate a resource method builder
3099///
3100/// ```test_harness,no_run
3101/// # extern crate hyper;
3102/// # extern crate hyper_rustls;
3103/// # extern crate google_dlp2_beta1 as dlp2_beta1;
3104/// use dlp2_beta1::api::GooglePrivacyDlpV2beta1DeidentifyContentRequest;
3105/// # async fn dox() {
3106/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3107///
3108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3109/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3110/// # .with_native_roots()
3111/// # .unwrap()
3112/// # .https_only()
3113/// # .enable_http2()
3114/// # .build();
3115///
3116/// # let executor = hyper_util::rt::TokioExecutor::new();
3117/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3118/// # secret,
3119/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3120/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3121/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3122/// # ),
3123/// # ).build().await.unwrap();
3124///
3125/// # let client = hyper_util::client::legacy::Client::builder(
3126/// # hyper_util::rt::TokioExecutor::new()
3127/// # )
3128/// # .build(
3129/// # hyper_rustls::HttpsConnectorBuilder::new()
3130/// # .with_native_roots()
3131/// # .unwrap()
3132/// # .https_or_http()
3133/// # .enable_http2()
3134/// # .build()
3135/// # );
3136/// # let mut hub = DLP::new(client, auth);
3137/// // As the method needs a request, you would usually fill it with the desired information
3138/// // into the respective structure. Some of the parts shown here might not be applicable !
3139/// // Values shown here are possibly random and not representative !
3140/// let mut req = GooglePrivacyDlpV2beta1DeidentifyContentRequest::default();
3141///
3142/// // You can configure optional parameters by calling the respective setters at will, and
3143/// // execute the final call using `doit()`.
3144/// // Values shown here are possibly random and not representative !
3145/// let result = hub.content().deidentify(req)
3146/// .doit().await;
3147/// # }
3148/// ```
3149pub struct ContentDeidentifyCall<'a, C>
3150where
3151 C: 'a,
3152{
3153 hub: &'a DLP<C>,
3154 _request: GooglePrivacyDlpV2beta1DeidentifyContentRequest,
3155 _delegate: Option<&'a mut dyn common::Delegate>,
3156 _additional_params: HashMap<String, String>,
3157 _scopes: BTreeSet<String>,
3158}
3159
3160impl<'a, C> common::CallBuilder for ContentDeidentifyCall<'a, C> {}
3161
3162impl<'a, C> ContentDeidentifyCall<'a, C>
3163where
3164 C: common::Connector,
3165{
3166 /// Perform the operation you have build so far.
3167 pub async fn doit(
3168 mut self,
3169 ) -> common::Result<(
3170 common::Response,
3171 GooglePrivacyDlpV2beta1DeidentifyContentResponse,
3172 )> {
3173 use std::borrow::Cow;
3174 use std::io::{Read, Seek};
3175
3176 use common::{url::Params, ToParts};
3177 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3178
3179 let mut dd = common::DefaultDelegate;
3180 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3181 dlg.begin(common::MethodInfo {
3182 id: "dlp.content.deidentify",
3183 http_method: hyper::Method::POST,
3184 });
3185
3186 for &field in ["alt"].iter() {
3187 if self._additional_params.contains_key(field) {
3188 dlg.finished(false);
3189 return Err(common::Error::FieldClash(field));
3190 }
3191 }
3192
3193 let mut params = Params::with_capacity(3 + self._additional_params.len());
3194
3195 params.extend(self._additional_params.iter());
3196
3197 params.push("alt", "json");
3198 let mut url = self.hub._base_url.clone() + "v2beta1/content:deidentify";
3199 if self._scopes.is_empty() {
3200 self._scopes
3201 .insert(Scope::CloudPlatform.as_ref().to_string());
3202 }
3203
3204 let url = params.parse_with_url(&url);
3205
3206 let mut json_mime_type = mime::APPLICATION_JSON;
3207 let mut request_value_reader = {
3208 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3209 common::remove_json_null_values(&mut value);
3210 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3211 serde_json::to_writer(&mut dst, &value).unwrap();
3212 dst
3213 };
3214 let request_size = request_value_reader
3215 .seek(std::io::SeekFrom::End(0))
3216 .unwrap();
3217 request_value_reader
3218 .seek(std::io::SeekFrom::Start(0))
3219 .unwrap();
3220
3221 loop {
3222 let token = match self
3223 .hub
3224 .auth
3225 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3226 .await
3227 {
3228 Ok(token) => token,
3229 Err(e) => match dlg.token(e) {
3230 Ok(token) => token,
3231 Err(e) => {
3232 dlg.finished(false);
3233 return Err(common::Error::MissingToken(e));
3234 }
3235 },
3236 };
3237 request_value_reader
3238 .seek(std::io::SeekFrom::Start(0))
3239 .unwrap();
3240 let mut req_result = {
3241 let client = &self.hub.client;
3242 dlg.pre_request();
3243 let mut req_builder = hyper::Request::builder()
3244 .method(hyper::Method::POST)
3245 .uri(url.as_str())
3246 .header(USER_AGENT, self.hub._user_agent.clone());
3247
3248 if let Some(token) = token.as_ref() {
3249 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3250 }
3251
3252 let request = req_builder
3253 .header(CONTENT_TYPE, json_mime_type.to_string())
3254 .header(CONTENT_LENGTH, request_size as u64)
3255 .body(common::to_body(
3256 request_value_reader.get_ref().clone().into(),
3257 ));
3258
3259 client.request(request.unwrap()).await
3260 };
3261
3262 match req_result {
3263 Err(err) => {
3264 if let common::Retry::After(d) = dlg.http_error(&err) {
3265 sleep(d).await;
3266 continue;
3267 }
3268 dlg.finished(false);
3269 return Err(common::Error::HttpError(err));
3270 }
3271 Ok(res) => {
3272 let (mut parts, body) = res.into_parts();
3273 let mut body = common::Body::new(body);
3274 if !parts.status.is_success() {
3275 let bytes = common::to_bytes(body).await.unwrap_or_default();
3276 let error = serde_json::from_str(&common::to_string(&bytes));
3277 let response = common::to_response(parts, bytes.into());
3278
3279 if let common::Retry::After(d) =
3280 dlg.http_failure(&response, error.as_ref().ok())
3281 {
3282 sleep(d).await;
3283 continue;
3284 }
3285
3286 dlg.finished(false);
3287
3288 return Err(match error {
3289 Ok(value) => common::Error::BadRequest(value),
3290 _ => common::Error::Failure(response),
3291 });
3292 }
3293 let response = {
3294 let bytes = common::to_bytes(body).await.unwrap_or_default();
3295 let encoded = common::to_string(&bytes);
3296 match serde_json::from_str(&encoded) {
3297 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3298 Err(error) => {
3299 dlg.response_json_decode_error(&encoded, &error);
3300 return Err(common::Error::JsonDecodeError(
3301 encoded.to_string(),
3302 error,
3303 ));
3304 }
3305 }
3306 };
3307
3308 dlg.finished(true);
3309 return Ok(response);
3310 }
3311 }
3312 }
3313 }
3314
3315 ///
3316 /// Sets the *request* property to the given value.
3317 ///
3318 /// Even though the property as already been set when instantiating this call,
3319 /// we provide this method for API completeness.
3320 pub fn request(
3321 mut self,
3322 new_value: GooglePrivacyDlpV2beta1DeidentifyContentRequest,
3323 ) -> ContentDeidentifyCall<'a, C> {
3324 self._request = new_value;
3325 self
3326 }
3327 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3328 /// while executing the actual API request.
3329 ///
3330 /// ````text
3331 /// It should be used to handle progress information, and to implement a certain level of resilience.
3332 /// ````
3333 ///
3334 /// Sets the *delegate* property to the given value.
3335 pub fn delegate(
3336 mut self,
3337 new_value: &'a mut dyn common::Delegate,
3338 ) -> ContentDeidentifyCall<'a, C> {
3339 self._delegate = Some(new_value);
3340 self
3341 }
3342
3343 /// Set any additional parameter of the query string used in the request.
3344 /// It should be used to set parameters which are not yet available through their own
3345 /// setters.
3346 ///
3347 /// Please note that this method must not be used to set any of the known parameters
3348 /// which have their own setter method. If done anyway, the request will fail.
3349 ///
3350 /// # Additional Parameters
3351 ///
3352 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3353 /// * *bearer_token* (query-string) - OAuth bearer token.
3354 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3355 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3356 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3358 /// * *$.xgafv* (query-string) - V1 error format.
3359 /// * *callback* (query-string) - JSONP
3360 /// * *alt* (query-string) - Data format for response.
3361 /// * *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.
3362 /// * *access_token* (query-string) - OAuth access token.
3363 /// * *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.
3364 /// * *pp* (query-boolean) - Pretty-print response.
3365 pub fn param<T>(mut self, name: T, value: T) -> ContentDeidentifyCall<'a, C>
3366 where
3367 T: AsRef<str>,
3368 {
3369 self._additional_params
3370 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3371 self
3372 }
3373
3374 /// Identifies the authorization scope for the method you are building.
3375 ///
3376 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3377 /// [`Scope::CloudPlatform`].
3378 ///
3379 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3380 /// tokens for more than one scope.
3381 ///
3382 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3383 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3384 /// sufficient, a read-write scope will do as well.
3385 pub fn add_scope<St>(mut self, scope: St) -> ContentDeidentifyCall<'a, C>
3386 where
3387 St: AsRef<str>,
3388 {
3389 self._scopes.insert(String::from(scope.as_ref()));
3390 self
3391 }
3392 /// Identifies the authorization scope(s) for the method you are building.
3393 ///
3394 /// See [`Self::add_scope()`] for details.
3395 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentDeidentifyCall<'a, C>
3396 where
3397 I: IntoIterator<Item = St>,
3398 St: AsRef<str>,
3399 {
3400 self._scopes
3401 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3402 self
3403 }
3404
3405 /// Removes all scopes, and no default scope will be used either.
3406 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3407 /// for details).
3408 pub fn clear_scopes(mut self) -> ContentDeidentifyCall<'a, C> {
3409 self._scopes.clear();
3410 self
3411 }
3412}
3413
3414/// Finds potentially sensitive info in a list of strings.
3415/// This method has limits on input size, processing time, and output size.
3416///
3417/// A builder for the *inspect* method supported by a *content* resource.
3418/// It is not used directly, but through a [`ContentMethods`] instance.
3419///
3420/// # Example
3421///
3422/// Instantiate a resource method builder
3423///
3424/// ```test_harness,no_run
3425/// # extern crate hyper;
3426/// # extern crate hyper_rustls;
3427/// # extern crate google_dlp2_beta1 as dlp2_beta1;
3428/// use dlp2_beta1::api::GooglePrivacyDlpV2beta1InspectContentRequest;
3429/// # async fn dox() {
3430/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3431///
3432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3433/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3434/// # .with_native_roots()
3435/// # .unwrap()
3436/// # .https_only()
3437/// # .enable_http2()
3438/// # .build();
3439///
3440/// # let executor = hyper_util::rt::TokioExecutor::new();
3441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3442/// # secret,
3443/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3444/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3445/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3446/// # ),
3447/// # ).build().await.unwrap();
3448///
3449/// # let client = hyper_util::client::legacy::Client::builder(
3450/// # hyper_util::rt::TokioExecutor::new()
3451/// # )
3452/// # .build(
3453/// # hyper_rustls::HttpsConnectorBuilder::new()
3454/// # .with_native_roots()
3455/// # .unwrap()
3456/// # .https_or_http()
3457/// # .enable_http2()
3458/// # .build()
3459/// # );
3460/// # let mut hub = DLP::new(client, auth);
3461/// // As the method needs a request, you would usually fill it with the desired information
3462/// // into the respective structure. Some of the parts shown here might not be applicable !
3463/// // Values shown here are possibly random and not representative !
3464/// let mut req = GooglePrivacyDlpV2beta1InspectContentRequest::default();
3465///
3466/// // You can configure optional parameters by calling the respective setters at will, and
3467/// // execute the final call using `doit()`.
3468/// // Values shown here are possibly random and not representative !
3469/// let result = hub.content().inspect(req)
3470/// .doit().await;
3471/// # }
3472/// ```
3473pub struct ContentInspectCall<'a, C>
3474where
3475 C: 'a,
3476{
3477 hub: &'a DLP<C>,
3478 _request: GooglePrivacyDlpV2beta1InspectContentRequest,
3479 _delegate: Option<&'a mut dyn common::Delegate>,
3480 _additional_params: HashMap<String, String>,
3481 _scopes: BTreeSet<String>,
3482}
3483
3484impl<'a, C> common::CallBuilder for ContentInspectCall<'a, C> {}
3485
3486impl<'a, C> ContentInspectCall<'a, C>
3487where
3488 C: common::Connector,
3489{
3490 /// Perform the operation you have build so far.
3491 pub async fn doit(
3492 mut self,
3493 ) -> common::Result<(
3494 common::Response,
3495 GooglePrivacyDlpV2beta1InspectContentResponse,
3496 )> {
3497 use std::borrow::Cow;
3498 use std::io::{Read, Seek};
3499
3500 use common::{url::Params, ToParts};
3501 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3502
3503 let mut dd = common::DefaultDelegate;
3504 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3505 dlg.begin(common::MethodInfo {
3506 id: "dlp.content.inspect",
3507 http_method: hyper::Method::POST,
3508 });
3509
3510 for &field in ["alt"].iter() {
3511 if self._additional_params.contains_key(field) {
3512 dlg.finished(false);
3513 return Err(common::Error::FieldClash(field));
3514 }
3515 }
3516
3517 let mut params = Params::with_capacity(3 + self._additional_params.len());
3518
3519 params.extend(self._additional_params.iter());
3520
3521 params.push("alt", "json");
3522 let mut url = self.hub._base_url.clone() + "v2beta1/content:inspect";
3523 if self._scopes.is_empty() {
3524 self._scopes
3525 .insert(Scope::CloudPlatform.as_ref().to_string());
3526 }
3527
3528 let url = params.parse_with_url(&url);
3529
3530 let mut json_mime_type = mime::APPLICATION_JSON;
3531 let mut request_value_reader = {
3532 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3533 common::remove_json_null_values(&mut value);
3534 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3535 serde_json::to_writer(&mut dst, &value).unwrap();
3536 dst
3537 };
3538 let request_size = request_value_reader
3539 .seek(std::io::SeekFrom::End(0))
3540 .unwrap();
3541 request_value_reader
3542 .seek(std::io::SeekFrom::Start(0))
3543 .unwrap();
3544
3545 loop {
3546 let token = match self
3547 .hub
3548 .auth
3549 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3550 .await
3551 {
3552 Ok(token) => token,
3553 Err(e) => match dlg.token(e) {
3554 Ok(token) => token,
3555 Err(e) => {
3556 dlg.finished(false);
3557 return Err(common::Error::MissingToken(e));
3558 }
3559 },
3560 };
3561 request_value_reader
3562 .seek(std::io::SeekFrom::Start(0))
3563 .unwrap();
3564 let mut req_result = {
3565 let client = &self.hub.client;
3566 dlg.pre_request();
3567 let mut req_builder = hyper::Request::builder()
3568 .method(hyper::Method::POST)
3569 .uri(url.as_str())
3570 .header(USER_AGENT, self.hub._user_agent.clone());
3571
3572 if let Some(token) = token.as_ref() {
3573 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3574 }
3575
3576 let request = req_builder
3577 .header(CONTENT_TYPE, json_mime_type.to_string())
3578 .header(CONTENT_LENGTH, request_size as u64)
3579 .body(common::to_body(
3580 request_value_reader.get_ref().clone().into(),
3581 ));
3582
3583 client.request(request.unwrap()).await
3584 };
3585
3586 match req_result {
3587 Err(err) => {
3588 if let common::Retry::After(d) = dlg.http_error(&err) {
3589 sleep(d).await;
3590 continue;
3591 }
3592 dlg.finished(false);
3593 return Err(common::Error::HttpError(err));
3594 }
3595 Ok(res) => {
3596 let (mut parts, body) = res.into_parts();
3597 let mut body = common::Body::new(body);
3598 if !parts.status.is_success() {
3599 let bytes = common::to_bytes(body).await.unwrap_or_default();
3600 let error = serde_json::from_str(&common::to_string(&bytes));
3601 let response = common::to_response(parts, bytes.into());
3602
3603 if let common::Retry::After(d) =
3604 dlg.http_failure(&response, error.as_ref().ok())
3605 {
3606 sleep(d).await;
3607 continue;
3608 }
3609
3610 dlg.finished(false);
3611
3612 return Err(match error {
3613 Ok(value) => common::Error::BadRequest(value),
3614 _ => common::Error::Failure(response),
3615 });
3616 }
3617 let response = {
3618 let bytes = common::to_bytes(body).await.unwrap_or_default();
3619 let encoded = common::to_string(&bytes);
3620 match serde_json::from_str(&encoded) {
3621 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3622 Err(error) => {
3623 dlg.response_json_decode_error(&encoded, &error);
3624 return Err(common::Error::JsonDecodeError(
3625 encoded.to_string(),
3626 error,
3627 ));
3628 }
3629 }
3630 };
3631
3632 dlg.finished(true);
3633 return Ok(response);
3634 }
3635 }
3636 }
3637 }
3638
3639 ///
3640 /// Sets the *request* property to the given value.
3641 ///
3642 /// Even though the property as already been set when instantiating this call,
3643 /// we provide this method for API completeness.
3644 pub fn request(
3645 mut self,
3646 new_value: GooglePrivacyDlpV2beta1InspectContentRequest,
3647 ) -> ContentInspectCall<'a, C> {
3648 self._request = new_value;
3649 self
3650 }
3651 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3652 /// while executing the actual API request.
3653 ///
3654 /// ````text
3655 /// It should be used to handle progress information, and to implement a certain level of resilience.
3656 /// ````
3657 ///
3658 /// Sets the *delegate* property to the given value.
3659 pub fn delegate(
3660 mut self,
3661 new_value: &'a mut dyn common::Delegate,
3662 ) -> ContentInspectCall<'a, C> {
3663 self._delegate = Some(new_value);
3664 self
3665 }
3666
3667 /// Set any additional parameter of the query string used in the request.
3668 /// It should be used to set parameters which are not yet available through their own
3669 /// setters.
3670 ///
3671 /// Please note that this method must not be used to set any of the known parameters
3672 /// which have their own setter method. If done anyway, the request will fail.
3673 ///
3674 /// # Additional Parameters
3675 ///
3676 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3677 /// * *bearer_token* (query-string) - OAuth bearer token.
3678 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3679 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3680 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3681 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3682 /// * *$.xgafv* (query-string) - V1 error format.
3683 /// * *callback* (query-string) - JSONP
3684 /// * *alt* (query-string) - Data format for response.
3685 /// * *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.
3686 /// * *access_token* (query-string) - OAuth access token.
3687 /// * *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.
3688 /// * *pp* (query-boolean) - Pretty-print response.
3689 pub fn param<T>(mut self, name: T, value: T) -> ContentInspectCall<'a, C>
3690 where
3691 T: AsRef<str>,
3692 {
3693 self._additional_params
3694 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3695 self
3696 }
3697
3698 /// Identifies the authorization scope for the method you are building.
3699 ///
3700 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3701 /// [`Scope::CloudPlatform`].
3702 ///
3703 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3704 /// tokens for more than one scope.
3705 ///
3706 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3707 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3708 /// sufficient, a read-write scope will do as well.
3709 pub fn add_scope<St>(mut self, scope: St) -> ContentInspectCall<'a, C>
3710 where
3711 St: AsRef<str>,
3712 {
3713 self._scopes.insert(String::from(scope.as_ref()));
3714 self
3715 }
3716 /// Identifies the authorization scope(s) for the method you are building.
3717 ///
3718 /// See [`Self::add_scope()`] for details.
3719 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentInspectCall<'a, C>
3720 where
3721 I: IntoIterator<Item = St>,
3722 St: AsRef<str>,
3723 {
3724 self._scopes
3725 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3726 self
3727 }
3728
3729 /// Removes all scopes, and no default scope will be used either.
3730 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3731 /// for details).
3732 pub fn clear_scopes(mut self) -> ContentInspectCall<'a, C> {
3733 self._scopes.clear();
3734 self
3735 }
3736}
3737
3738/// Redacts potentially sensitive info from a list of strings.
3739/// This method has limits on input size, processing time, and output size.
3740///
3741/// A builder for the *redact* method supported by a *content* resource.
3742/// It is not used directly, but through a [`ContentMethods`] instance.
3743///
3744/// # Example
3745///
3746/// Instantiate a resource method builder
3747///
3748/// ```test_harness,no_run
3749/// # extern crate hyper;
3750/// # extern crate hyper_rustls;
3751/// # extern crate google_dlp2_beta1 as dlp2_beta1;
3752/// use dlp2_beta1::api::GooglePrivacyDlpV2beta1RedactContentRequest;
3753/// # async fn dox() {
3754/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3755///
3756/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3757/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3758/// # .with_native_roots()
3759/// # .unwrap()
3760/// # .https_only()
3761/// # .enable_http2()
3762/// # .build();
3763///
3764/// # let executor = hyper_util::rt::TokioExecutor::new();
3765/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3766/// # secret,
3767/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3768/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3769/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3770/// # ),
3771/// # ).build().await.unwrap();
3772///
3773/// # let client = hyper_util::client::legacy::Client::builder(
3774/// # hyper_util::rt::TokioExecutor::new()
3775/// # )
3776/// # .build(
3777/// # hyper_rustls::HttpsConnectorBuilder::new()
3778/// # .with_native_roots()
3779/// # .unwrap()
3780/// # .https_or_http()
3781/// # .enable_http2()
3782/// # .build()
3783/// # );
3784/// # let mut hub = DLP::new(client, auth);
3785/// // As the method needs a request, you would usually fill it with the desired information
3786/// // into the respective structure. Some of the parts shown here might not be applicable !
3787/// // Values shown here are possibly random and not representative !
3788/// let mut req = GooglePrivacyDlpV2beta1RedactContentRequest::default();
3789///
3790/// // You can configure optional parameters by calling the respective setters at will, and
3791/// // execute the final call using `doit()`.
3792/// // Values shown here are possibly random and not representative !
3793/// let result = hub.content().redact(req)
3794/// .doit().await;
3795/// # }
3796/// ```
3797pub struct ContentRedactCall<'a, C>
3798where
3799 C: 'a,
3800{
3801 hub: &'a DLP<C>,
3802 _request: GooglePrivacyDlpV2beta1RedactContentRequest,
3803 _delegate: Option<&'a mut dyn common::Delegate>,
3804 _additional_params: HashMap<String, String>,
3805 _scopes: BTreeSet<String>,
3806}
3807
3808impl<'a, C> common::CallBuilder for ContentRedactCall<'a, C> {}
3809
3810impl<'a, C> ContentRedactCall<'a, C>
3811where
3812 C: common::Connector,
3813{
3814 /// Perform the operation you have build so far.
3815 pub async fn doit(
3816 mut self,
3817 ) -> common::Result<(
3818 common::Response,
3819 GooglePrivacyDlpV2beta1RedactContentResponse,
3820 )> {
3821 use std::borrow::Cow;
3822 use std::io::{Read, Seek};
3823
3824 use common::{url::Params, ToParts};
3825 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3826
3827 let mut dd = common::DefaultDelegate;
3828 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3829 dlg.begin(common::MethodInfo {
3830 id: "dlp.content.redact",
3831 http_method: hyper::Method::POST,
3832 });
3833
3834 for &field in ["alt"].iter() {
3835 if self._additional_params.contains_key(field) {
3836 dlg.finished(false);
3837 return Err(common::Error::FieldClash(field));
3838 }
3839 }
3840
3841 let mut params = Params::with_capacity(3 + self._additional_params.len());
3842
3843 params.extend(self._additional_params.iter());
3844
3845 params.push("alt", "json");
3846 let mut url = self.hub._base_url.clone() + "v2beta1/content:redact";
3847 if self._scopes.is_empty() {
3848 self._scopes
3849 .insert(Scope::CloudPlatform.as_ref().to_string());
3850 }
3851
3852 let url = params.parse_with_url(&url);
3853
3854 let mut json_mime_type = mime::APPLICATION_JSON;
3855 let mut request_value_reader = {
3856 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3857 common::remove_json_null_values(&mut value);
3858 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3859 serde_json::to_writer(&mut dst, &value).unwrap();
3860 dst
3861 };
3862 let request_size = request_value_reader
3863 .seek(std::io::SeekFrom::End(0))
3864 .unwrap();
3865 request_value_reader
3866 .seek(std::io::SeekFrom::Start(0))
3867 .unwrap();
3868
3869 loop {
3870 let token = match self
3871 .hub
3872 .auth
3873 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3874 .await
3875 {
3876 Ok(token) => token,
3877 Err(e) => match dlg.token(e) {
3878 Ok(token) => token,
3879 Err(e) => {
3880 dlg.finished(false);
3881 return Err(common::Error::MissingToken(e));
3882 }
3883 },
3884 };
3885 request_value_reader
3886 .seek(std::io::SeekFrom::Start(0))
3887 .unwrap();
3888 let mut req_result = {
3889 let client = &self.hub.client;
3890 dlg.pre_request();
3891 let mut req_builder = hyper::Request::builder()
3892 .method(hyper::Method::POST)
3893 .uri(url.as_str())
3894 .header(USER_AGENT, self.hub._user_agent.clone());
3895
3896 if let Some(token) = token.as_ref() {
3897 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3898 }
3899
3900 let request = req_builder
3901 .header(CONTENT_TYPE, json_mime_type.to_string())
3902 .header(CONTENT_LENGTH, request_size as u64)
3903 .body(common::to_body(
3904 request_value_reader.get_ref().clone().into(),
3905 ));
3906
3907 client.request(request.unwrap()).await
3908 };
3909
3910 match req_result {
3911 Err(err) => {
3912 if let common::Retry::After(d) = dlg.http_error(&err) {
3913 sleep(d).await;
3914 continue;
3915 }
3916 dlg.finished(false);
3917 return Err(common::Error::HttpError(err));
3918 }
3919 Ok(res) => {
3920 let (mut parts, body) = res.into_parts();
3921 let mut body = common::Body::new(body);
3922 if !parts.status.is_success() {
3923 let bytes = common::to_bytes(body).await.unwrap_or_default();
3924 let error = serde_json::from_str(&common::to_string(&bytes));
3925 let response = common::to_response(parts, bytes.into());
3926
3927 if let common::Retry::After(d) =
3928 dlg.http_failure(&response, error.as_ref().ok())
3929 {
3930 sleep(d).await;
3931 continue;
3932 }
3933
3934 dlg.finished(false);
3935
3936 return Err(match error {
3937 Ok(value) => common::Error::BadRequest(value),
3938 _ => common::Error::Failure(response),
3939 });
3940 }
3941 let response = {
3942 let bytes = common::to_bytes(body).await.unwrap_or_default();
3943 let encoded = common::to_string(&bytes);
3944 match serde_json::from_str(&encoded) {
3945 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3946 Err(error) => {
3947 dlg.response_json_decode_error(&encoded, &error);
3948 return Err(common::Error::JsonDecodeError(
3949 encoded.to_string(),
3950 error,
3951 ));
3952 }
3953 }
3954 };
3955
3956 dlg.finished(true);
3957 return Ok(response);
3958 }
3959 }
3960 }
3961 }
3962
3963 ///
3964 /// Sets the *request* property to the given value.
3965 ///
3966 /// Even though the property as already been set when instantiating this call,
3967 /// we provide this method for API completeness.
3968 pub fn request(
3969 mut self,
3970 new_value: GooglePrivacyDlpV2beta1RedactContentRequest,
3971 ) -> ContentRedactCall<'a, C> {
3972 self._request = new_value;
3973 self
3974 }
3975 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3976 /// while executing the actual API request.
3977 ///
3978 /// ````text
3979 /// It should be used to handle progress information, and to implement a certain level of resilience.
3980 /// ````
3981 ///
3982 /// Sets the *delegate* property to the given value.
3983 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ContentRedactCall<'a, C> {
3984 self._delegate = Some(new_value);
3985 self
3986 }
3987
3988 /// Set any additional parameter of the query string used in the request.
3989 /// It should be used to set parameters which are not yet available through their own
3990 /// setters.
3991 ///
3992 /// Please note that this method must not be used to set any of the known parameters
3993 /// which have their own setter method. If done anyway, the request will fail.
3994 ///
3995 /// # Additional Parameters
3996 ///
3997 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3998 /// * *bearer_token* (query-string) - OAuth bearer token.
3999 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4000 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4001 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4002 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4003 /// * *$.xgafv* (query-string) - V1 error format.
4004 /// * *callback* (query-string) - JSONP
4005 /// * *alt* (query-string) - Data format for response.
4006 /// * *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.
4007 /// * *access_token* (query-string) - OAuth access token.
4008 /// * *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.
4009 /// * *pp* (query-boolean) - Pretty-print response.
4010 pub fn param<T>(mut self, name: T, value: T) -> ContentRedactCall<'a, C>
4011 where
4012 T: AsRef<str>,
4013 {
4014 self._additional_params
4015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4016 self
4017 }
4018
4019 /// Identifies the authorization scope for the method you are building.
4020 ///
4021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4022 /// [`Scope::CloudPlatform`].
4023 ///
4024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4025 /// tokens for more than one scope.
4026 ///
4027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4029 /// sufficient, a read-write scope will do as well.
4030 pub fn add_scope<St>(mut self, scope: St) -> ContentRedactCall<'a, C>
4031 where
4032 St: AsRef<str>,
4033 {
4034 self._scopes.insert(String::from(scope.as_ref()));
4035 self
4036 }
4037 /// Identifies the authorization scope(s) for the method you are building.
4038 ///
4039 /// See [`Self::add_scope()`] for details.
4040 pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentRedactCall<'a, C>
4041 where
4042 I: IntoIterator<Item = St>,
4043 St: AsRef<str>,
4044 {
4045 self._scopes
4046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4047 self
4048 }
4049
4050 /// Removes all scopes, and no default scope will be used either.
4051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4052 /// for details).
4053 pub fn clear_scopes(mut self) -> ContentRedactCall<'a, C> {
4054 self._scopes.clear();
4055 self
4056 }
4057}
4058
4059/// Returns sensitive information types for given category.
4060///
4061/// A builder for the *infoTypes.list* method supported by a *rootCategory* resource.
4062/// It is not used directly, but through a [`RootCategoryMethods`] instance.
4063///
4064/// # Example
4065///
4066/// Instantiate a resource method builder
4067///
4068/// ```test_harness,no_run
4069/// # extern crate hyper;
4070/// # extern crate hyper_rustls;
4071/// # extern crate google_dlp2_beta1 as dlp2_beta1;
4072/// # async fn dox() {
4073/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4074///
4075/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4076/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4077/// # .with_native_roots()
4078/// # .unwrap()
4079/// # .https_only()
4080/// # .enable_http2()
4081/// # .build();
4082///
4083/// # let executor = hyper_util::rt::TokioExecutor::new();
4084/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4085/// # secret,
4086/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4087/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4088/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4089/// # ),
4090/// # ).build().await.unwrap();
4091///
4092/// # let client = hyper_util::client::legacy::Client::builder(
4093/// # hyper_util::rt::TokioExecutor::new()
4094/// # )
4095/// # .build(
4096/// # hyper_rustls::HttpsConnectorBuilder::new()
4097/// # .with_native_roots()
4098/// # .unwrap()
4099/// # .https_or_http()
4100/// # .enable_http2()
4101/// # .build()
4102/// # );
4103/// # let mut hub = DLP::new(client, auth);
4104/// // You can configure optional parameters by calling the respective setters at will, and
4105/// // execute the final call using `doit()`.
4106/// // Values shown here are possibly random and not representative !
4107/// let result = hub.root_categories().info_types_list("category")
4108/// .language_code("voluptua.")
4109/// .doit().await;
4110/// # }
4111/// ```
4112pub struct RootCategoryInfoTypeListCall<'a, C>
4113where
4114 C: 'a,
4115{
4116 hub: &'a DLP<C>,
4117 _category: String,
4118 _language_code: Option<String>,
4119 _delegate: Option<&'a mut dyn common::Delegate>,
4120 _additional_params: HashMap<String, String>,
4121 _scopes: BTreeSet<String>,
4122}
4123
4124impl<'a, C> common::CallBuilder for RootCategoryInfoTypeListCall<'a, C> {}
4125
4126impl<'a, C> RootCategoryInfoTypeListCall<'a, C>
4127where
4128 C: common::Connector,
4129{
4130 /// Perform the operation you have build so far.
4131 pub async fn doit(
4132 mut self,
4133 ) -> common::Result<(
4134 common::Response,
4135 GooglePrivacyDlpV2beta1ListInfoTypesResponse,
4136 )> {
4137 use std::borrow::Cow;
4138 use std::io::{Read, Seek};
4139
4140 use common::{url::Params, ToParts};
4141 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4142
4143 let mut dd = common::DefaultDelegate;
4144 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4145 dlg.begin(common::MethodInfo {
4146 id: "dlp.rootCategories.infoTypes.list",
4147 http_method: hyper::Method::GET,
4148 });
4149
4150 for &field in ["alt", "category", "languageCode"].iter() {
4151 if self._additional_params.contains_key(field) {
4152 dlg.finished(false);
4153 return Err(common::Error::FieldClash(field));
4154 }
4155 }
4156
4157 let mut params = Params::with_capacity(4 + self._additional_params.len());
4158 params.push("category", self._category);
4159 if let Some(value) = self._language_code.as_ref() {
4160 params.push("languageCode", value);
4161 }
4162
4163 params.extend(self._additional_params.iter());
4164
4165 params.push("alt", "json");
4166 let mut url = self.hub._base_url.clone() + "v2beta1/rootCategories/{+category}/infoTypes";
4167 if self._scopes.is_empty() {
4168 self._scopes
4169 .insert(Scope::CloudPlatform.as_ref().to_string());
4170 }
4171
4172 #[allow(clippy::single_element_loop)]
4173 for &(find_this, param_name) in [("{+category}", "category")].iter() {
4174 url = params.uri_replacement(url, param_name, find_this, true);
4175 }
4176 {
4177 let to_remove = ["category"];
4178 params.remove_params(&to_remove);
4179 }
4180
4181 let url = params.parse_with_url(&url);
4182
4183 loop {
4184 let token = match self
4185 .hub
4186 .auth
4187 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4188 .await
4189 {
4190 Ok(token) => token,
4191 Err(e) => match dlg.token(e) {
4192 Ok(token) => token,
4193 Err(e) => {
4194 dlg.finished(false);
4195 return Err(common::Error::MissingToken(e));
4196 }
4197 },
4198 };
4199 let mut req_result = {
4200 let client = &self.hub.client;
4201 dlg.pre_request();
4202 let mut req_builder = hyper::Request::builder()
4203 .method(hyper::Method::GET)
4204 .uri(url.as_str())
4205 .header(USER_AGENT, self.hub._user_agent.clone());
4206
4207 if let Some(token) = token.as_ref() {
4208 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4209 }
4210
4211 let request = req_builder
4212 .header(CONTENT_LENGTH, 0_u64)
4213 .body(common::to_body::<String>(None));
4214
4215 client.request(request.unwrap()).await
4216 };
4217
4218 match req_result {
4219 Err(err) => {
4220 if let common::Retry::After(d) = dlg.http_error(&err) {
4221 sleep(d).await;
4222 continue;
4223 }
4224 dlg.finished(false);
4225 return Err(common::Error::HttpError(err));
4226 }
4227 Ok(res) => {
4228 let (mut parts, body) = res.into_parts();
4229 let mut body = common::Body::new(body);
4230 if !parts.status.is_success() {
4231 let bytes = common::to_bytes(body).await.unwrap_or_default();
4232 let error = serde_json::from_str(&common::to_string(&bytes));
4233 let response = common::to_response(parts, bytes.into());
4234
4235 if let common::Retry::After(d) =
4236 dlg.http_failure(&response, error.as_ref().ok())
4237 {
4238 sleep(d).await;
4239 continue;
4240 }
4241
4242 dlg.finished(false);
4243
4244 return Err(match error {
4245 Ok(value) => common::Error::BadRequest(value),
4246 _ => common::Error::Failure(response),
4247 });
4248 }
4249 let response = {
4250 let bytes = common::to_bytes(body).await.unwrap_or_default();
4251 let encoded = common::to_string(&bytes);
4252 match serde_json::from_str(&encoded) {
4253 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4254 Err(error) => {
4255 dlg.response_json_decode_error(&encoded, &error);
4256 return Err(common::Error::JsonDecodeError(
4257 encoded.to_string(),
4258 error,
4259 ));
4260 }
4261 }
4262 };
4263
4264 dlg.finished(true);
4265 return Ok(response);
4266 }
4267 }
4268 }
4269 }
4270
4271 /// Category name as returned by ListRootCategories.
4272 ///
4273 /// Sets the *category* path property to the given value.
4274 ///
4275 /// Even though the property as already been set when instantiating this call,
4276 /// we provide this method for API completeness.
4277 pub fn category(mut self, new_value: &str) -> RootCategoryInfoTypeListCall<'a, C> {
4278 self._category = new_value.to_string();
4279 self
4280 }
4281 /// Optional BCP-47 language code for localized info type friendly
4282 /// names. If omitted, or if localized strings are not available,
4283 /// en-US strings will be returned.
4284 ///
4285 /// Sets the *language code* query property to the given value.
4286 pub fn language_code(mut self, new_value: &str) -> RootCategoryInfoTypeListCall<'a, C> {
4287 self._language_code = Some(new_value.to_string());
4288 self
4289 }
4290 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4291 /// while executing the actual API request.
4292 ///
4293 /// ````text
4294 /// It should be used to handle progress information, and to implement a certain level of resilience.
4295 /// ````
4296 ///
4297 /// Sets the *delegate* property to the given value.
4298 pub fn delegate(
4299 mut self,
4300 new_value: &'a mut dyn common::Delegate,
4301 ) -> RootCategoryInfoTypeListCall<'a, C> {
4302 self._delegate = Some(new_value);
4303 self
4304 }
4305
4306 /// Set any additional parameter of the query string used in the request.
4307 /// It should be used to set parameters which are not yet available through their own
4308 /// setters.
4309 ///
4310 /// Please note that this method must not be used to set any of the known parameters
4311 /// which have their own setter method. If done anyway, the request will fail.
4312 ///
4313 /// # Additional Parameters
4314 ///
4315 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4316 /// * *bearer_token* (query-string) - OAuth bearer token.
4317 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4318 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4319 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4320 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4321 /// * *$.xgafv* (query-string) - V1 error format.
4322 /// * *callback* (query-string) - JSONP
4323 /// * *alt* (query-string) - Data format for response.
4324 /// * *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.
4325 /// * *access_token* (query-string) - OAuth access token.
4326 /// * *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.
4327 /// * *pp* (query-boolean) - Pretty-print response.
4328 pub fn param<T>(mut self, name: T, value: T) -> RootCategoryInfoTypeListCall<'a, C>
4329 where
4330 T: AsRef<str>,
4331 {
4332 self._additional_params
4333 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4334 self
4335 }
4336
4337 /// Identifies the authorization scope for the method you are building.
4338 ///
4339 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4340 /// [`Scope::CloudPlatform`].
4341 ///
4342 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4343 /// tokens for more than one scope.
4344 ///
4345 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4346 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4347 /// sufficient, a read-write scope will do as well.
4348 pub fn add_scope<St>(mut self, scope: St) -> RootCategoryInfoTypeListCall<'a, C>
4349 where
4350 St: AsRef<str>,
4351 {
4352 self._scopes.insert(String::from(scope.as_ref()));
4353 self
4354 }
4355 /// Identifies the authorization scope(s) for the method you are building.
4356 ///
4357 /// See [`Self::add_scope()`] for details.
4358 pub fn add_scopes<I, St>(mut self, scopes: I) -> RootCategoryInfoTypeListCall<'a, C>
4359 where
4360 I: IntoIterator<Item = St>,
4361 St: AsRef<str>,
4362 {
4363 self._scopes
4364 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4365 self
4366 }
4367
4368 /// Removes all scopes, and no default scope will be used either.
4369 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4370 /// for details).
4371 pub fn clear_scopes(mut self) -> RootCategoryInfoTypeListCall<'a, C> {
4372 self._scopes.clear();
4373 self
4374 }
4375}
4376
4377/// Returns the list of root categories of sensitive information.
4378///
4379/// A builder for the *list* method supported by a *rootCategory* resource.
4380/// It is not used directly, but through a [`RootCategoryMethods`] instance.
4381///
4382/// # Example
4383///
4384/// Instantiate a resource method builder
4385///
4386/// ```test_harness,no_run
4387/// # extern crate hyper;
4388/// # extern crate hyper_rustls;
4389/// # extern crate google_dlp2_beta1 as dlp2_beta1;
4390/// # async fn dox() {
4391/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4392///
4393/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4394/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4395/// # .with_native_roots()
4396/// # .unwrap()
4397/// # .https_only()
4398/// # .enable_http2()
4399/// # .build();
4400///
4401/// # let executor = hyper_util::rt::TokioExecutor::new();
4402/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4403/// # secret,
4404/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4405/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4406/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4407/// # ),
4408/// # ).build().await.unwrap();
4409///
4410/// # let client = hyper_util::client::legacy::Client::builder(
4411/// # hyper_util::rt::TokioExecutor::new()
4412/// # )
4413/// # .build(
4414/// # hyper_rustls::HttpsConnectorBuilder::new()
4415/// # .with_native_roots()
4416/// # .unwrap()
4417/// # .https_or_http()
4418/// # .enable_http2()
4419/// # .build()
4420/// # );
4421/// # let mut hub = DLP::new(client, auth);
4422/// // You can configure optional parameters by calling the respective setters at will, and
4423/// // execute the final call using `doit()`.
4424/// // Values shown here are possibly random and not representative !
4425/// let result = hub.root_categories().list()
4426/// .language_code("At")
4427/// .doit().await;
4428/// # }
4429/// ```
4430pub struct RootCategoryListCall<'a, C>
4431where
4432 C: 'a,
4433{
4434 hub: &'a DLP<C>,
4435 _language_code: Option<String>,
4436 _delegate: Option<&'a mut dyn common::Delegate>,
4437 _additional_params: HashMap<String, String>,
4438 _scopes: BTreeSet<String>,
4439}
4440
4441impl<'a, C> common::CallBuilder for RootCategoryListCall<'a, C> {}
4442
4443impl<'a, C> RootCategoryListCall<'a, C>
4444where
4445 C: common::Connector,
4446{
4447 /// Perform the operation you have build so far.
4448 pub async fn doit(
4449 mut self,
4450 ) -> common::Result<(
4451 common::Response,
4452 GooglePrivacyDlpV2beta1ListRootCategoriesResponse,
4453 )> {
4454 use std::borrow::Cow;
4455 use std::io::{Read, Seek};
4456
4457 use common::{url::Params, ToParts};
4458 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4459
4460 let mut dd = common::DefaultDelegate;
4461 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4462 dlg.begin(common::MethodInfo {
4463 id: "dlp.rootCategories.list",
4464 http_method: hyper::Method::GET,
4465 });
4466
4467 for &field in ["alt", "languageCode"].iter() {
4468 if self._additional_params.contains_key(field) {
4469 dlg.finished(false);
4470 return Err(common::Error::FieldClash(field));
4471 }
4472 }
4473
4474 let mut params = Params::with_capacity(3 + self._additional_params.len());
4475 if let Some(value) = self._language_code.as_ref() {
4476 params.push("languageCode", value);
4477 }
4478
4479 params.extend(self._additional_params.iter());
4480
4481 params.push("alt", "json");
4482 let mut url = self.hub._base_url.clone() + "v2beta1/rootCategories";
4483 if self._scopes.is_empty() {
4484 self._scopes
4485 .insert(Scope::CloudPlatform.as_ref().to_string());
4486 }
4487
4488 let url = params.parse_with_url(&url);
4489
4490 loop {
4491 let token = match self
4492 .hub
4493 .auth
4494 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4495 .await
4496 {
4497 Ok(token) => token,
4498 Err(e) => match dlg.token(e) {
4499 Ok(token) => token,
4500 Err(e) => {
4501 dlg.finished(false);
4502 return Err(common::Error::MissingToken(e));
4503 }
4504 },
4505 };
4506 let mut req_result = {
4507 let client = &self.hub.client;
4508 dlg.pre_request();
4509 let mut req_builder = hyper::Request::builder()
4510 .method(hyper::Method::GET)
4511 .uri(url.as_str())
4512 .header(USER_AGENT, self.hub._user_agent.clone());
4513
4514 if let Some(token) = token.as_ref() {
4515 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4516 }
4517
4518 let request = req_builder
4519 .header(CONTENT_LENGTH, 0_u64)
4520 .body(common::to_body::<String>(None));
4521
4522 client.request(request.unwrap()).await
4523 };
4524
4525 match req_result {
4526 Err(err) => {
4527 if let common::Retry::After(d) = dlg.http_error(&err) {
4528 sleep(d).await;
4529 continue;
4530 }
4531 dlg.finished(false);
4532 return Err(common::Error::HttpError(err));
4533 }
4534 Ok(res) => {
4535 let (mut parts, body) = res.into_parts();
4536 let mut body = common::Body::new(body);
4537 if !parts.status.is_success() {
4538 let bytes = common::to_bytes(body).await.unwrap_or_default();
4539 let error = serde_json::from_str(&common::to_string(&bytes));
4540 let response = common::to_response(parts, bytes.into());
4541
4542 if let common::Retry::After(d) =
4543 dlg.http_failure(&response, error.as_ref().ok())
4544 {
4545 sleep(d).await;
4546 continue;
4547 }
4548
4549 dlg.finished(false);
4550
4551 return Err(match error {
4552 Ok(value) => common::Error::BadRequest(value),
4553 _ => common::Error::Failure(response),
4554 });
4555 }
4556 let response = {
4557 let bytes = common::to_bytes(body).await.unwrap_or_default();
4558 let encoded = common::to_string(&bytes);
4559 match serde_json::from_str(&encoded) {
4560 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4561 Err(error) => {
4562 dlg.response_json_decode_error(&encoded, &error);
4563 return Err(common::Error::JsonDecodeError(
4564 encoded.to_string(),
4565 error,
4566 ));
4567 }
4568 }
4569 };
4570
4571 dlg.finished(true);
4572 return Ok(response);
4573 }
4574 }
4575 }
4576 }
4577
4578 /// Optional language code for localized friendly category names.
4579 /// If omitted or if localized strings are not available,
4580 /// en-US strings will be returned.
4581 ///
4582 /// Sets the *language code* query property to the given value.
4583 pub fn language_code(mut self, new_value: &str) -> RootCategoryListCall<'a, C> {
4584 self._language_code = Some(new_value.to_string());
4585 self
4586 }
4587 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4588 /// while executing the actual API request.
4589 ///
4590 /// ````text
4591 /// It should be used to handle progress information, and to implement a certain level of resilience.
4592 /// ````
4593 ///
4594 /// Sets the *delegate* property to the given value.
4595 pub fn delegate(
4596 mut self,
4597 new_value: &'a mut dyn common::Delegate,
4598 ) -> RootCategoryListCall<'a, C> {
4599 self._delegate = Some(new_value);
4600 self
4601 }
4602
4603 /// Set any additional parameter of the query string used in the request.
4604 /// It should be used to set parameters which are not yet available through their own
4605 /// setters.
4606 ///
4607 /// Please note that this method must not be used to set any of the known parameters
4608 /// which have their own setter method. If done anyway, the request will fail.
4609 ///
4610 /// # Additional Parameters
4611 ///
4612 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4613 /// * *bearer_token* (query-string) - OAuth bearer token.
4614 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4615 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4616 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4617 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4618 /// * *$.xgafv* (query-string) - V1 error format.
4619 /// * *callback* (query-string) - JSONP
4620 /// * *alt* (query-string) - Data format for response.
4621 /// * *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.
4622 /// * *access_token* (query-string) - OAuth access token.
4623 /// * *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.
4624 /// * *pp* (query-boolean) - Pretty-print response.
4625 pub fn param<T>(mut self, name: T, value: T) -> RootCategoryListCall<'a, C>
4626 where
4627 T: AsRef<str>,
4628 {
4629 self._additional_params
4630 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4631 self
4632 }
4633
4634 /// Identifies the authorization scope for the method you are building.
4635 ///
4636 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4637 /// [`Scope::CloudPlatform`].
4638 ///
4639 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4640 /// tokens for more than one scope.
4641 ///
4642 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4643 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4644 /// sufficient, a read-write scope will do as well.
4645 pub fn add_scope<St>(mut self, scope: St) -> RootCategoryListCall<'a, C>
4646 where
4647 St: AsRef<str>,
4648 {
4649 self._scopes.insert(String::from(scope.as_ref()));
4650 self
4651 }
4652 /// Identifies the authorization scope(s) for the method you are building.
4653 ///
4654 /// See [`Self::add_scope()`] for details.
4655 pub fn add_scopes<I, St>(mut self, scopes: I) -> RootCategoryListCall<'a, C>
4656 where
4657 I: IntoIterator<Item = St>,
4658 St: AsRef<str>,
4659 {
4660 self._scopes
4661 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4662 self
4663 }
4664
4665 /// Removes all scopes, and no default scope will be used either.
4666 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4667 /// for details).
4668 pub fn clear_scopes(mut self) -> RootCategoryListCall<'a, C> {
4669 self._scopes.clear();
4670 self
4671 }
4672}
4673
4674/// Cancels an operation. Use the `inspect.operations.get` to check whether the cancellation succeeded or the operation completed despite cancellation.
4675///
4676/// A builder for the *operations.cancel* method supported by a *riskAnalysi* resource.
4677/// It is not used directly, but through a [`RiskAnalysiMethods`] instance.
4678///
4679/// # Example
4680///
4681/// Instantiate a resource method builder
4682///
4683/// ```test_harness,no_run
4684/// # extern crate hyper;
4685/// # extern crate hyper_rustls;
4686/// # extern crate google_dlp2_beta1 as dlp2_beta1;
4687/// use dlp2_beta1::api::GoogleLongrunningCancelOperationRequest;
4688/// # async fn dox() {
4689/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4690///
4691/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4692/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4693/// # .with_native_roots()
4694/// # .unwrap()
4695/// # .https_only()
4696/// # .enable_http2()
4697/// # .build();
4698///
4699/// # let executor = hyper_util::rt::TokioExecutor::new();
4700/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4701/// # secret,
4702/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4703/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4704/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4705/// # ),
4706/// # ).build().await.unwrap();
4707///
4708/// # let client = hyper_util::client::legacy::Client::builder(
4709/// # hyper_util::rt::TokioExecutor::new()
4710/// # )
4711/// # .build(
4712/// # hyper_rustls::HttpsConnectorBuilder::new()
4713/// # .with_native_roots()
4714/// # .unwrap()
4715/// # .https_or_http()
4716/// # .enable_http2()
4717/// # .build()
4718/// # );
4719/// # let mut hub = DLP::new(client, auth);
4720/// // As the method needs a request, you would usually fill it with the desired information
4721/// // into the respective structure. Some of the parts shown here might not be applicable !
4722/// // Values shown here are possibly random and not representative !
4723/// let mut req = GoogleLongrunningCancelOperationRequest::default();
4724///
4725/// // You can configure optional parameters by calling the respective setters at will, and
4726/// // execute the final call using `doit()`.
4727/// // Values shown here are possibly random and not representative !
4728/// let result = hub.risk_analysis().operations_cancel(req, "name")
4729/// .doit().await;
4730/// # }
4731/// ```
4732pub struct RiskAnalysiOperationCancelCall<'a, C>
4733where
4734 C: 'a,
4735{
4736 hub: &'a DLP<C>,
4737 _request: GoogleLongrunningCancelOperationRequest,
4738 _name: String,
4739 _delegate: Option<&'a mut dyn common::Delegate>,
4740 _additional_params: HashMap<String, String>,
4741 _scopes: BTreeSet<String>,
4742}
4743
4744impl<'a, C> common::CallBuilder for RiskAnalysiOperationCancelCall<'a, C> {}
4745
4746impl<'a, C> RiskAnalysiOperationCancelCall<'a, C>
4747where
4748 C: common::Connector,
4749{
4750 /// Perform the operation you have build so far.
4751 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
4752 use std::borrow::Cow;
4753 use std::io::{Read, Seek};
4754
4755 use common::{url::Params, ToParts};
4756 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4757
4758 let mut dd = common::DefaultDelegate;
4759 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4760 dlg.begin(common::MethodInfo {
4761 id: "dlp.riskAnalysis.operations.cancel",
4762 http_method: hyper::Method::POST,
4763 });
4764
4765 for &field in ["alt", "name"].iter() {
4766 if self._additional_params.contains_key(field) {
4767 dlg.finished(false);
4768 return Err(common::Error::FieldClash(field));
4769 }
4770 }
4771
4772 let mut params = Params::with_capacity(4 + self._additional_params.len());
4773 params.push("name", self._name);
4774
4775 params.extend(self._additional_params.iter());
4776
4777 params.push("alt", "json");
4778 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:cancel";
4779 if self._scopes.is_empty() {
4780 self._scopes
4781 .insert(Scope::CloudPlatform.as_ref().to_string());
4782 }
4783
4784 #[allow(clippy::single_element_loop)]
4785 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4786 url = params.uri_replacement(url, param_name, find_this, true);
4787 }
4788 {
4789 let to_remove = ["name"];
4790 params.remove_params(&to_remove);
4791 }
4792
4793 let url = params.parse_with_url(&url);
4794
4795 let mut json_mime_type = mime::APPLICATION_JSON;
4796 let mut request_value_reader = {
4797 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4798 common::remove_json_null_values(&mut value);
4799 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4800 serde_json::to_writer(&mut dst, &value).unwrap();
4801 dst
4802 };
4803 let request_size = request_value_reader
4804 .seek(std::io::SeekFrom::End(0))
4805 .unwrap();
4806 request_value_reader
4807 .seek(std::io::SeekFrom::Start(0))
4808 .unwrap();
4809
4810 loop {
4811 let token = match self
4812 .hub
4813 .auth
4814 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4815 .await
4816 {
4817 Ok(token) => token,
4818 Err(e) => match dlg.token(e) {
4819 Ok(token) => token,
4820 Err(e) => {
4821 dlg.finished(false);
4822 return Err(common::Error::MissingToken(e));
4823 }
4824 },
4825 };
4826 request_value_reader
4827 .seek(std::io::SeekFrom::Start(0))
4828 .unwrap();
4829 let mut req_result = {
4830 let client = &self.hub.client;
4831 dlg.pre_request();
4832 let mut req_builder = hyper::Request::builder()
4833 .method(hyper::Method::POST)
4834 .uri(url.as_str())
4835 .header(USER_AGENT, self.hub._user_agent.clone());
4836
4837 if let Some(token) = token.as_ref() {
4838 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4839 }
4840
4841 let request = req_builder
4842 .header(CONTENT_TYPE, json_mime_type.to_string())
4843 .header(CONTENT_LENGTH, request_size as u64)
4844 .body(common::to_body(
4845 request_value_reader.get_ref().clone().into(),
4846 ));
4847
4848 client.request(request.unwrap()).await
4849 };
4850
4851 match req_result {
4852 Err(err) => {
4853 if let common::Retry::After(d) = dlg.http_error(&err) {
4854 sleep(d).await;
4855 continue;
4856 }
4857 dlg.finished(false);
4858 return Err(common::Error::HttpError(err));
4859 }
4860 Ok(res) => {
4861 let (mut parts, body) = res.into_parts();
4862 let mut body = common::Body::new(body);
4863 if !parts.status.is_success() {
4864 let bytes = common::to_bytes(body).await.unwrap_or_default();
4865 let error = serde_json::from_str(&common::to_string(&bytes));
4866 let response = common::to_response(parts, bytes.into());
4867
4868 if let common::Retry::After(d) =
4869 dlg.http_failure(&response, error.as_ref().ok())
4870 {
4871 sleep(d).await;
4872 continue;
4873 }
4874
4875 dlg.finished(false);
4876
4877 return Err(match error {
4878 Ok(value) => common::Error::BadRequest(value),
4879 _ => common::Error::Failure(response),
4880 });
4881 }
4882 let response = {
4883 let bytes = common::to_bytes(body).await.unwrap_or_default();
4884 let encoded = common::to_string(&bytes);
4885 match serde_json::from_str(&encoded) {
4886 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4887 Err(error) => {
4888 dlg.response_json_decode_error(&encoded, &error);
4889 return Err(common::Error::JsonDecodeError(
4890 encoded.to_string(),
4891 error,
4892 ));
4893 }
4894 }
4895 };
4896
4897 dlg.finished(true);
4898 return Ok(response);
4899 }
4900 }
4901 }
4902 }
4903
4904 ///
4905 /// Sets the *request* property to the given value.
4906 ///
4907 /// Even though the property as already been set when instantiating this call,
4908 /// we provide this method for API completeness.
4909 pub fn request(
4910 mut self,
4911 new_value: GoogleLongrunningCancelOperationRequest,
4912 ) -> RiskAnalysiOperationCancelCall<'a, C> {
4913 self._request = new_value;
4914 self
4915 }
4916 /// The name of the operation resource to be cancelled.
4917 ///
4918 /// Sets the *name* path property to the given value.
4919 ///
4920 /// Even though the property as already been set when instantiating this call,
4921 /// we provide this method for API completeness.
4922 pub fn name(mut self, new_value: &str) -> RiskAnalysiOperationCancelCall<'a, C> {
4923 self._name = new_value.to_string();
4924 self
4925 }
4926 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4927 /// while executing the actual API request.
4928 ///
4929 /// ````text
4930 /// It should be used to handle progress information, and to implement a certain level of resilience.
4931 /// ````
4932 ///
4933 /// Sets the *delegate* property to the given value.
4934 pub fn delegate(
4935 mut self,
4936 new_value: &'a mut dyn common::Delegate,
4937 ) -> RiskAnalysiOperationCancelCall<'a, C> {
4938 self._delegate = Some(new_value);
4939 self
4940 }
4941
4942 /// Set any additional parameter of the query string used in the request.
4943 /// It should be used to set parameters which are not yet available through their own
4944 /// setters.
4945 ///
4946 /// Please note that this method must not be used to set any of the known parameters
4947 /// which have their own setter method. If done anyway, the request will fail.
4948 ///
4949 /// # Additional Parameters
4950 ///
4951 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4952 /// * *bearer_token* (query-string) - OAuth bearer token.
4953 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4954 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4955 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4956 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4957 /// * *$.xgafv* (query-string) - V1 error format.
4958 /// * *callback* (query-string) - JSONP
4959 /// * *alt* (query-string) - Data format for response.
4960 /// * *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.
4961 /// * *access_token* (query-string) - OAuth access token.
4962 /// * *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.
4963 /// * *pp* (query-boolean) - Pretty-print response.
4964 pub fn param<T>(mut self, name: T, value: T) -> RiskAnalysiOperationCancelCall<'a, C>
4965 where
4966 T: AsRef<str>,
4967 {
4968 self._additional_params
4969 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4970 self
4971 }
4972
4973 /// Identifies the authorization scope for the method you are building.
4974 ///
4975 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4976 /// [`Scope::CloudPlatform`].
4977 ///
4978 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4979 /// tokens for more than one scope.
4980 ///
4981 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4982 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4983 /// sufficient, a read-write scope will do as well.
4984 pub fn add_scope<St>(mut self, scope: St) -> RiskAnalysiOperationCancelCall<'a, C>
4985 where
4986 St: AsRef<str>,
4987 {
4988 self._scopes.insert(String::from(scope.as_ref()));
4989 self
4990 }
4991 /// Identifies the authorization scope(s) for the method you are building.
4992 ///
4993 /// See [`Self::add_scope()`] for details.
4994 pub fn add_scopes<I, St>(mut self, scopes: I) -> RiskAnalysiOperationCancelCall<'a, C>
4995 where
4996 I: IntoIterator<Item = St>,
4997 St: AsRef<str>,
4998 {
4999 self._scopes
5000 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5001 self
5002 }
5003
5004 /// Removes all scopes, and no default scope will be used either.
5005 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5006 /// for details).
5007 pub fn clear_scopes(mut self) -> RiskAnalysiOperationCancelCall<'a, C> {
5008 self._scopes.clear();
5009 self
5010 }
5011}
5012
5013/// This method is not supported and the server returns `UNIMPLEMENTED`.
5014///
5015/// A builder for the *operations.delete* method supported by a *riskAnalysi* resource.
5016/// It is not used directly, but through a [`RiskAnalysiMethods`] instance.
5017///
5018/// # Example
5019///
5020/// Instantiate a resource method builder
5021///
5022/// ```test_harness,no_run
5023/// # extern crate hyper;
5024/// # extern crate hyper_rustls;
5025/// # extern crate google_dlp2_beta1 as dlp2_beta1;
5026/// # async fn dox() {
5027/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5028///
5029/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5030/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5031/// # .with_native_roots()
5032/// # .unwrap()
5033/// # .https_only()
5034/// # .enable_http2()
5035/// # .build();
5036///
5037/// # let executor = hyper_util::rt::TokioExecutor::new();
5038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5039/// # secret,
5040/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5041/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5042/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5043/// # ),
5044/// # ).build().await.unwrap();
5045///
5046/// # let client = hyper_util::client::legacy::Client::builder(
5047/// # hyper_util::rt::TokioExecutor::new()
5048/// # )
5049/// # .build(
5050/// # hyper_rustls::HttpsConnectorBuilder::new()
5051/// # .with_native_roots()
5052/// # .unwrap()
5053/// # .https_or_http()
5054/// # .enable_http2()
5055/// # .build()
5056/// # );
5057/// # let mut hub = DLP::new(client, auth);
5058/// // You can configure optional parameters by calling the respective setters at will, and
5059/// // execute the final call using `doit()`.
5060/// // Values shown here are possibly random and not representative !
5061/// let result = hub.risk_analysis().operations_delete("name")
5062/// .doit().await;
5063/// # }
5064/// ```
5065pub struct RiskAnalysiOperationDeleteCall<'a, C>
5066where
5067 C: 'a,
5068{
5069 hub: &'a DLP<C>,
5070 _name: String,
5071 _delegate: Option<&'a mut dyn common::Delegate>,
5072 _additional_params: HashMap<String, String>,
5073 _scopes: BTreeSet<String>,
5074}
5075
5076impl<'a, C> common::CallBuilder for RiskAnalysiOperationDeleteCall<'a, C> {}
5077
5078impl<'a, C> RiskAnalysiOperationDeleteCall<'a, C>
5079where
5080 C: common::Connector,
5081{
5082 /// Perform the operation you have build so far.
5083 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
5084 use std::borrow::Cow;
5085 use std::io::{Read, Seek};
5086
5087 use common::{url::Params, ToParts};
5088 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5089
5090 let mut dd = common::DefaultDelegate;
5091 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5092 dlg.begin(common::MethodInfo {
5093 id: "dlp.riskAnalysis.operations.delete",
5094 http_method: hyper::Method::DELETE,
5095 });
5096
5097 for &field in ["alt", "name"].iter() {
5098 if self._additional_params.contains_key(field) {
5099 dlg.finished(false);
5100 return Err(common::Error::FieldClash(field));
5101 }
5102 }
5103
5104 let mut params = Params::with_capacity(3 + self._additional_params.len());
5105 params.push("name", self._name);
5106
5107 params.extend(self._additional_params.iter());
5108
5109 params.push("alt", "json");
5110 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
5111 if self._scopes.is_empty() {
5112 self._scopes
5113 .insert(Scope::CloudPlatform.as_ref().to_string());
5114 }
5115
5116 #[allow(clippy::single_element_loop)]
5117 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5118 url = params.uri_replacement(url, param_name, find_this, true);
5119 }
5120 {
5121 let to_remove = ["name"];
5122 params.remove_params(&to_remove);
5123 }
5124
5125 let url = params.parse_with_url(&url);
5126
5127 loop {
5128 let token = match self
5129 .hub
5130 .auth
5131 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5132 .await
5133 {
5134 Ok(token) => token,
5135 Err(e) => match dlg.token(e) {
5136 Ok(token) => token,
5137 Err(e) => {
5138 dlg.finished(false);
5139 return Err(common::Error::MissingToken(e));
5140 }
5141 },
5142 };
5143 let mut req_result = {
5144 let client = &self.hub.client;
5145 dlg.pre_request();
5146 let mut req_builder = hyper::Request::builder()
5147 .method(hyper::Method::DELETE)
5148 .uri(url.as_str())
5149 .header(USER_AGENT, self.hub._user_agent.clone());
5150
5151 if let Some(token) = token.as_ref() {
5152 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5153 }
5154
5155 let request = req_builder
5156 .header(CONTENT_LENGTH, 0_u64)
5157 .body(common::to_body::<String>(None));
5158
5159 client.request(request.unwrap()).await
5160 };
5161
5162 match req_result {
5163 Err(err) => {
5164 if let common::Retry::After(d) = dlg.http_error(&err) {
5165 sleep(d).await;
5166 continue;
5167 }
5168 dlg.finished(false);
5169 return Err(common::Error::HttpError(err));
5170 }
5171 Ok(res) => {
5172 let (mut parts, body) = res.into_parts();
5173 let mut body = common::Body::new(body);
5174 if !parts.status.is_success() {
5175 let bytes = common::to_bytes(body).await.unwrap_or_default();
5176 let error = serde_json::from_str(&common::to_string(&bytes));
5177 let response = common::to_response(parts, bytes.into());
5178
5179 if let common::Retry::After(d) =
5180 dlg.http_failure(&response, error.as_ref().ok())
5181 {
5182 sleep(d).await;
5183 continue;
5184 }
5185
5186 dlg.finished(false);
5187
5188 return Err(match error {
5189 Ok(value) => common::Error::BadRequest(value),
5190 _ => common::Error::Failure(response),
5191 });
5192 }
5193 let response = {
5194 let bytes = common::to_bytes(body).await.unwrap_or_default();
5195 let encoded = common::to_string(&bytes);
5196 match serde_json::from_str(&encoded) {
5197 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5198 Err(error) => {
5199 dlg.response_json_decode_error(&encoded, &error);
5200 return Err(common::Error::JsonDecodeError(
5201 encoded.to_string(),
5202 error,
5203 ));
5204 }
5205 }
5206 };
5207
5208 dlg.finished(true);
5209 return Ok(response);
5210 }
5211 }
5212 }
5213 }
5214
5215 /// The name of the operation resource to be deleted.
5216 ///
5217 /// Sets the *name* path property to the given value.
5218 ///
5219 /// Even though the property as already been set when instantiating this call,
5220 /// we provide this method for API completeness.
5221 pub fn name(mut self, new_value: &str) -> RiskAnalysiOperationDeleteCall<'a, C> {
5222 self._name = new_value.to_string();
5223 self
5224 }
5225 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5226 /// while executing the actual API request.
5227 ///
5228 /// ````text
5229 /// It should be used to handle progress information, and to implement a certain level of resilience.
5230 /// ````
5231 ///
5232 /// Sets the *delegate* property to the given value.
5233 pub fn delegate(
5234 mut self,
5235 new_value: &'a mut dyn common::Delegate,
5236 ) -> RiskAnalysiOperationDeleteCall<'a, C> {
5237 self._delegate = Some(new_value);
5238 self
5239 }
5240
5241 /// Set any additional parameter of the query string used in the request.
5242 /// It should be used to set parameters which are not yet available through their own
5243 /// setters.
5244 ///
5245 /// Please note that this method must not be used to set any of the known parameters
5246 /// which have their own setter method. If done anyway, the request will fail.
5247 ///
5248 /// # Additional Parameters
5249 ///
5250 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5251 /// * *bearer_token* (query-string) - OAuth bearer token.
5252 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5253 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5254 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5255 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5256 /// * *$.xgafv* (query-string) - V1 error format.
5257 /// * *callback* (query-string) - JSONP
5258 /// * *alt* (query-string) - Data format for response.
5259 /// * *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.
5260 /// * *access_token* (query-string) - OAuth access token.
5261 /// * *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.
5262 /// * *pp* (query-boolean) - Pretty-print response.
5263 pub fn param<T>(mut self, name: T, value: T) -> RiskAnalysiOperationDeleteCall<'a, C>
5264 where
5265 T: AsRef<str>,
5266 {
5267 self._additional_params
5268 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5269 self
5270 }
5271
5272 /// Identifies the authorization scope for the method you are building.
5273 ///
5274 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5275 /// [`Scope::CloudPlatform`].
5276 ///
5277 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5278 /// tokens for more than one scope.
5279 ///
5280 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5281 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5282 /// sufficient, a read-write scope will do as well.
5283 pub fn add_scope<St>(mut self, scope: St) -> RiskAnalysiOperationDeleteCall<'a, C>
5284 where
5285 St: AsRef<str>,
5286 {
5287 self._scopes.insert(String::from(scope.as_ref()));
5288 self
5289 }
5290 /// Identifies the authorization scope(s) for the method you are building.
5291 ///
5292 /// See [`Self::add_scope()`] for details.
5293 pub fn add_scopes<I, St>(mut self, scopes: I) -> RiskAnalysiOperationDeleteCall<'a, C>
5294 where
5295 I: IntoIterator<Item = St>,
5296 St: AsRef<str>,
5297 {
5298 self._scopes
5299 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5300 self
5301 }
5302
5303 /// Removes all scopes, and no default scope will be used either.
5304 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5305 /// for details).
5306 pub fn clear_scopes(mut self) -> RiskAnalysiOperationDeleteCall<'a, C> {
5307 self._scopes.clear();
5308 self
5309 }
5310}
5311
5312/// Fetches the list of long running operations.
5313///
5314/// A builder for the *operations.list* method supported by a *riskAnalysi* resource.
5315/// It is not used directly, but through a [`RiskAnalysiMethods`] instance.
5316///
5317/// # Example
5318///
5319/// Instantiate a resource method builder
5320///
5321/// ```test_harness,no_run
5322/// # extern crate hyper;
5323/// # extern crate hyper_rustls;
5324/// # extern crate google_dlp2_beta1 as dlp2_beta1;
5325/// # async fn dox() {
5326/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5327///
5328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5329/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5330/// # .with_native_roots()
5331/// # .unwrap()
5332/// # .https_only()
5333/// # .enable_http2()
5334/// # .build();
5335///
5336/// # let executor = hyper_util::rt::TokioExecutor::new();
5337/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5338/// # secret,
5339/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5340/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5341/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5342/// # ),
5343/// # ).build().await.unwrap();
5344///
5345/// # let client = hyper_util::client::legacy::Client::builder(
5346/// # hyper_util::rt::TokioExecutor::new()
5347/// # )
5348/// # .build(
5349/// # hyper_rustls::HttpsConnectorBuilder::new()
5350/// # .with_native_roots()
5351/// # .unwrap()
5352/// # .https_or_http()
5353/// # .enable_http2()
5354/// # .build()
5355/// # );
5356/// # let mut hub = DLP::new(client, auth);
5357/// // You can configure optional parameters by calling the respective setters at will, and
5358/// // execute the final call using `doit()`.
5359/// // Values shown here are possibly random and not representative !
5360/// let result = hub.risk_analysis().operations_list("name")
5361/// .page_token("takimata")
5362/// .page_size(-52)
5363/// .filter("duo")
5364/// .doit().await;
5365/// # }
5366/// ```
5367pub struct RiskAnalysiOperationListCall<'a, C>
5368where
5369 C: 'a,
5370{
5371 hub: &'a DLP<C>,
5372 _name: String,
5373 _page_token: Option<String>,
5374 _page_size: Option<i32>,
5375 _filter: Option<String>,
5376 _delegate: Option<&'a mut dyn common::Delegate>,
5377 _additional_params: HashMap<String, String>,
5378 _scopes: BTreeSet<String>,
5379}
5380
5381impl<'a, C> common::CallBuilder for RiskAnalysiOperationListCall<'a, C> {}
5382
5383impl<'a, C> RiskAnalysiOperationListCall<'a, C>
5384where
5385 C: common::Connector,
5386{
5387 /// Perform the operation you have build so far.
5388 pub async fn doit(
5389 mut self,
5390 ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
5391 use std::borrow::Cow;
5392 use std::io::{Read, Seek};
5393
5394 use common::{url::Params, ToParts};
5395 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5396
5397 let mut dd = common::DefaultDelegate;
5398 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5399 dlg.begin(common::MethodInfo {
5400 id: "dlp.riskAnalysis.operations.list",
5401 http_method: hyper::Method::GET,
5402 });
5403
5404 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
5405 if self._additional_params.contains_key(field) {
5406 dlg.finished(false);
5407 return Err(common::Error::FieldClash(field));
5408 }
5409 }
5410
5411 let mut params = Params::with_capacity(6 + self._additional_params.len());
5412 params.push("name", self._name);
5413 if let Some(value) = self._page_token.as_ref() {
5414 params.push("pageToken", value);
5415 }
5416 if let Some(value) = self._page_size.as_ref() {
5417 params.push("pageSize", value.to_string());
5418 }
5419 if let Some(value) = self._filter.as_ref() {
5420 params.push("filter", value);
5421 }
5422
5423 params.extend(self._additional_params.iter());
5424
5425 params.push("alt", "json");
5426 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
5427 if self._scopes.is_empty() {
5428 self._scopes
5429 .insert(Scope::CloudPlatform.as_ref().to_string());
5430 }
5431
5432 #[allow(clippy::single_element_loop)]
5433 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5434 url = params.uri_replacement(url, param_name, find_this, true);
5435 }
5436 {
5437 let to_remove = ["name"];
5438 params.remove_params(&to_remove);
5439 }
5440
5441 let url = params.parse_with_url(&url);
5442
5443 loop {
5444 let token = match self
5445 .hub
5446 .auth
5447 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5448 .await
5449 {
5450 Ok(token) => token,
5451 Err(e) => match dlg.token(e) {
5452 Ok(token) => token,
5453 Err(e) => {
5454 dlg.finished(false);
5455 return Err(common::Error::MissingToken(e));
5456 }
5457 },
5458 };
5459 let mut req_result = {
5460 let client = &self.hub.client;
5461 dlg.pre_request();
5462 let mut req_builder = hyper::Request::builder()
5463 .method(hyper::Method::GET)
5464 .uri(url.as_str())
5465 .header(USER_AGENT, self.hub._user_agent.clone());
5466
5467 if let Some(token) = token.as_ref() {
5468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5469 }
5470
5471 let request = req_builder
5472 .header(CONTENT_LENGTH, 0_u64)
5473 .body(common::to_body::<String>(None));
5474
5475 client.request(request.unwrap()).await
5476 };
5477
5478 match req_result {
5479 Err(err) => {
5480 if let common::Retry::After(d) = dlg.http_error(&err) {
5481 sleep(d).await;
5482 continue;
5483 }
5484 dlg.finished(false);
5485 return Err(common::Error::HttpError(err));
5486 }
5487 Ok(res) => {
5488 let (mut parts, body) = res.into_parts();
5489 let mut body = common::Body::new(body);
5490 if !parts.status.is_success() {
5491 let bytes = common::to_bytes(body).await.unwrap_or_default();
5492 let error = serde_json::from_str(&common::to_string(&bytes));
5493 let response = common::to_response(parts, bytes.into());
5494
5495 if let common::Retry::After(d) =
5496 dlg.http_failure(&response, error.as_ref().ok())
5497 {
5498 sleep(d).await;
5499 continue;
5500 }
5501
5502 dlg.finished(false);
5503
5504 return Err(match error {
5505 Ok(value) => common::Error::BadRequest(value),
5506 _ => common::Error::Failure(response),
5507 });
5508 }
5509 let response = {
5510 let bytes = common::to_bytes(body).await.unwrap_or_default();
5511 let encoded = common::to_string(&bytes);
5512 match serde_json::from_str(&encoded) {
5513 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5514 Err(error) => {
5515 dlg.response_json_decode_error(&encoded, &error);
5516 return Err(common::Error::JsonDecodeError(
5517 encoded.to_string(),
5518 error,
5519 ));
5520 }
5521 }
5522 };
5523
5524 dlg.finished(true);
5525 return Ok(response);
5526 }
5527 }
5528 }
5529 }
5530
5531 /// The name of the operation's parent resource.
5532 ///
5533 /// Sets the *name* path property to the given value.
5534 ///
5535 /// Even though the property as already been set when instantiating this call,
5536 /// we provide this method for API completeness.
5537 pub fn name(mut self, new_value: &str) -> RiskAnalysiOperationListCall<'a, C> {
5538 self._name = new_value.to_string();
5539 self
5540 }
5541 /// The standard list page token.
5542 ///
5543 /// Sets the *page token* query property to the given value.
5544 pub fn page_token(mut self, new_value: &str) -> RiskAnalysiOperationListCall<'a, C> {
5545 self._page_token = Some(new_value.to_string());
5546 self
5547 }
5548 /// The list page size. The maximum allowed value is 256 and the default is 100.
5549 ///
5550 /// Sets the *page size* query property to the given value.
5551 pub fn page_size(mut self, new_value: i32) -> RiskAnalysiOperationListCall<'a, C> {
5552 self._page_size = Some(new_value);
5553 self
5554 }
5555 /// Filters by `done`. That is, `done=true` or `done=false`.
5556 ///
5557 /// Sets the *filter* query property to the given value.
5558 pub fn filter(mut self, new_value: &str) -> RiskAnalysiOperationListCall<'a, C> {
5559 self._filter = Some(new_value.to_string());
5560 self
5561 }
5562 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5563 /// while executing the actual API request.
5564 ///
5565 /// ````text
5566 /// It should be used to handle progress information, and to implement a certain level of resilience.
5567 /// ````
5568 ///
5569 /// Sets the *delegate* property to the given value.
5570 pub fn delegate(
5571 mut self,
5572 new_value: &'a mut dyn common::Delegate,
5573 ) -> RiskAnalysiOperationListCall<'a, C> {
5574 self._delegate = Some(new_value);
5575 self
5576 }
5577
5578 /// Set any additional parameter of the query string used in the request.
5579 /// It should be used to set parameters which are not yet available through their own
5580 /// setters.
5581 ///
5582 /// Please note that this method must not be used to set any of the known parameters
5583 /// which have their own setter method. If done anyway, the request will fail.
5584 ///
5585 /// # Additional Parameters
5586 ///
5587 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5588 /// * *bearer_token* (query-string) - OAuth bearer token.
5589 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5590 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5591 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5593 /// * *$.xgafv* (query-string) - V1 error format.
5594 /// * *callback* (query-string) - JSONP
5595 /// * *alt* (query-string) - Data format for response.
5596 /// * *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.
5597 /// * *access_token* (query-string) - OAuth access token.
5598 /// * *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.
5599 /// * *pp* (query-boolean) - Pretty-print response.
5600 pub fn param<T>(mut self, name: T, value: T) -> RiskAnalysiOperationListCall<'a, C>
5601 where
5602 T: AsRef<str>,
5603 {
5604 self._additional_params
5605 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5606 self
5607 }
5608
5609 /// Identifies the authorization scope for the method you are building.
5610 ///
5611 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5612 /// [`Scope::CloudPlatform`].
5613 ///
5614 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5615 /// tokens for more than one scope.
5616 ///
5617 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5618 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5619 /// sufficient, a read-write scope will do as well.
5620 pub fn add_scope<St>(mut self, scope: St) -> RiskAnalysiOperationListCall<'a, C>
5621 where
5622 St: AsRef<str>,
5623 {
5624 self._scopes.insert(String::from(scope.as_ref()));
5625 self
5626 }
5627 /// Identifies the authorization scope(s) for the method you are building.
5628 ///
5629 /// See [`Self::add_scope()`] for details.
5630 pub fn add_scopes<I, St>(mut self, scopes: I) -> RiskAnalysiOperationListCall<'a, C>
5631 where
5632 I: IntoIterator<Item = St>,
5633 St: AsRef<str>,
5634 {
5635 self._scopes
5636 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5637 self
5638 }
5639
5640 /// Removes all scopes, and no default scope will be used either.
5641 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5642 /// for details).
5643 pub fn clear_scopes(mut self) -> RiskAnalysiOperationListCall<'a, C> {
5644 self._scopes.clear();
5645 self
5646 }
5647}
5648
5649/// Gets the latest state of a long-running operation. Clients can use this
5650/// method to poll the operation result at intervals as recommended by the API
5651/// service.
5652///
5653/// A builder for the *operations.get* method supported by a *riskAnalysi* resource.
5654/// It is not used directly, but through a [`RiskAnalysiMethods`] instance.
5655///
5656/// # Example
5657///
5658/// Instantiate a resource method builder
5659///
5660/// ```test_harness,no_run
5661/// # extern crate hyper;
5662/// # extern crate hyper_rustls;
5663/// # extern crate google_dlp2_beta1 as dlp2_beta1;
5664/// # async fn dox() {
5665/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5666///
5667/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5668/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5669/// # .with_native_roots()
5670/// # .unwrap()
5671/// # .https_only()
5672/// # .enable_http2()
5673/// # .build();
5674///
5675/// # let executor = hyper_util::rt::TokioExecutor::new();
5676/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5677/// # secret,
5678/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5679/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5680/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5681/// # ),
5682/// # ).build().await.unwrap();
5683///
5684/// # let client = hyper_util::client::legacy::Client::builder(
5685/// # hyper_util::rt::TokioExecutor::new()
5686/// # )
5687/// # .build(
5688/// # hyper_rustls::HttpsConnectorBuilder::new()
5689/// # .with_native_roots()
5690/// # .unwrap()
5691/// # .https_or_http()
5692/// # .enable_http2()
5693/// # .build()
5694/// # );
5695/// # let mut hub = DLP::new(client, auth);
5696/// // You can configure optional parameters by calling the respective setters at will, and
5697/// // execute the final call using `doit()`.
5698/// // Values shown here are possibly random and not representative !
5699/// let result = hub.risk_analysis().operations_get("name")
5700/// .doit().await;
5701/// # }
5702/// ```
5703pub struct RiskAnalysiOperationGetCall<'a, C>
5704where
5705 C: 'a,
5706{
5707 hub: &'a DLP<C>,
5708 _name: String,
5709 _delegate: Option<&'a mut dyn common::Delegate>,
5710 _additional_params: HashMap<String, String>,
5711 _scopes: BTreeSet<String>,
5712}
5713
5714impl<'a, C> common::CallBuilder for RiskAnalysiOperationGetCall<'a, C> {}
5715
5716impl<'a, C> RiskAnalysiOperationGetCall<'a, C>
5717where
5718 C: common::Connector,
5719{
5720 /// Perform the operation you have build so far.
5721 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
5722 use std::borrow::Cow;
5723 use std::io::{Read, Seek};
5724
5725 use common::{url::Params, ToParts};
5726 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5727
5728 let mut dd = common::DefaultDelegate;
5729 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5730 dlg.begin(common::MethodInfo {
5731 id: "dlp.riskAnalysis.operations.get",
5732 http_method: hyper::Method::GET,
5733 });
5734
5735 for &field in ["alt", "name"].iter() {
5736 if self._additional_params.contains_key(field) {
5737 dlg.finished(false);
5738 return Err(common::Error::FieldClash(field));
5739 }
5740 }
5741
5742 let mut params = Params::with_capacity(3 + self._additional_params.len());
5743 params.push("name", self._name);
5744
5745 params.extend(self._additional_params.iter());
5746
5747 params.push("alt", "json");
5748 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
5749 if self._scopes.is_empty() {
5750 self._scopes
5751 .insert(Scope::CloudPlatform.as_ref().to_string());
5752 }
5753
5754 #[allow(clippy::single_element_loop)]
5755 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5756 url = params.uri_replacement(url, param_name, find_this, true);
5757 }
5758 {
5759 let to_remove = ["name"];
5760 params.remove_params(&to_remove);
5761 }
5762
5763 let url = params.parse_with_url(&url);
5764
5765 loop {
5766 let token = match self
5767 .hub
5768 .auth
5769 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5770 .await
5771 {
5772 Ok(token) => token,
5773 Err(e) => match dlg.token(e) {
5774 Ok(token) => token,
5775 Err(e) => {
5776 dlg.finished(false);
5777 return Err(common::Error::MissingToken(e));
5778 }
5779 },
5780 };
5781 let mut req_result = {
5782 let client = &self.hub.client;
5783 dlg.pre_request();
5784 let mut req_builder = hyper::Request::builder()
5785 .method(hyper::Method::GET)
5786 .uri(url.as_str())
5787 .header(USER_AGENT, self.hub._user_agent.clone());
5788
5789 if let Some(token) = token.as_ref() {
5790 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5791 }
5792
5793 let request = req_builder
5794 .header(CONTENT_LENGTH, 0_u64)
5795 .body(common::to_body::<String>(None));
5796
5797 client.request(request.unwrap()).await
5798 };
5799
5800 match req_result {
5801 Err(err) => {
5802 if let common::Retry::After(d) = dlg.http_error(&err) {
5803 sleep(d).await;
5804 continue;
5805 }
5806 dlg.finished(false);
5807 return Err(common::Error::HttpError(err));
5808 }
5809 Ok(res) => {
5810 let (mut parts, body) = res.into_parts();
5811 let mut body = common::Body::new(body);
5812 if !parts.status.is_success() {
5813 let bytes = common::to_bytes(body).await.unwrap_or_default();
5814 let error = serde_json::from_str(&common::to_string(&bytes));
5815 let response = common::to_response(parts, bytes.into());
5816
5817 if let common::Retry::After(d) =
5818 dlg.http_failure(&response, error.as_ref().ok())
5819 {
5820 sleep(d).await;
5821 continue;
5822 }
5823
5824 dlg.finished(false);
5825
5826 return Err(match error {
5827 Ok(value) => common::Error::BadRequest(value),
5828 _ => common::Error::Failure(response),
5829 });
5830 }
5831 let response = {
5832 let bytes = common::to_bytes(body).await.unwrap_or_default();
5833 let encoded = common::to_string(&bytes);
5834 match serde_json::from_str(&encoded) {
5835 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5836 Err(error) => {
5837 dlg.response_json_decode_error(&encoded, &error);
5838 return Err(common::Error::JsonDecodeError(
5839 encoded.to_string(),
5840 error,
5841 ));
5842 }
5843 }
5844 };
5845
5846 dlg.finished(true);
5847 return Ok(response);
5848 }
5849 }
5850 }
5851 }
5852
5853 /// The name of the operation resource.
5854 ///
5855 /// Sets the *name* path property to the given value.
5856 ///
5857 /// Even though the property as already been set when instantiating this call,
5858 /// we provide this method for API completeness.
5859 pub fn name(mut self, new_value: &str) -> RiskAnalysiOperationGetCall<'a, C> {
5860 self._name = new_value.to_string();
5861 self
5862 }
5863 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5864 /// while executing the actual API request.
5865 ///
5866 /// ````text
5867 /// It should be used to handle progress information, and to implement a certain level of resilience.
5868 /// ````
5869 ///
5870 /// Sets the *delegate* property to the given value.
5871 pub fn delegate(
5872 mut self,
5873 new_value: &'a mut dyn common::Delegate,
5874 ) -> RiskAnalysiOperationGetCall<'a, C> {
5875 self._delegate = Some(new_value);
5876 self
5877 }
5878
5879 /// Set any additional parameter of the query string used in the request.
5880 /// It should be used to set parameters which are not yet available through their own
5881 /// setters.
5882 ///
5883 /// Please note that this method must not be used to set any of the known parameters
5884 /// which have their own setter method. If done anyway, the request will fail.
5885 ///
5886 /// # Additional Parameters
5887 ///
5888 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5889 /// * *bearer_token* (query-string) - OAuth bearer token.
5890 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5891 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5892 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5893 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5894 /// * *$.xgafv* (query-string) - V1 error format.
5895 /// * *callback* (query-string) - JSONP
5896 /// * *alt* (query-string) - Data format for response.
5897 /// * *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.
5898 /// * *access_token* (query-string) - OAuth access token.
5899 /// * *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.
5900 /// * *pp* (query-boolean) - Pretty-print response.
5901 pub fn param<T>(mut self, name: T, value: T) -> RiskAnalysiOperationGetCall<'a, C>
5902 where
5903 T: AsRef<str>,
5904 {
5905 self._additional_params
5906 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5907 self
5908 }
5909
5910 /// Identifies the authorization scope for the method you are building.
5911 ///
5912 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5913 /// [`Scope::CloudPlatform`].
5914 ///
5915 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5916 /// tokens for more than one scope.
5917 ///
5918 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5919 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5920 /// sufficient, a read-write scope will do as well.
5921 pub fn add_scope<St>(mut self, scope: St) -> RiskAnalysiOperationGetCall<'a, C>
5922 where
5923 St: AsRef<str>,
5924 {
5925 self._scopes.insert(String::from(scope.as_ref()));
5926 self
5927 }
5928 /// Identifies the authorization scope(s) for the method you are building.
5929 ///
5930 /// See [`Self::add_scope()`] for details.
5931 pub fn add_scopes<I, St>(mut self, scopes: I) -> RiskAnalysiOperationGetCall<'a, C>
5932 where
5933 I: IntoIterator<Item = St>,
5934 St: AsRef<str>,
5935 {
5936 self._scopes
5937 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5938 self
5939 }
5940
5941 /// Removes all scopes, and no default scope will be used either.
5942 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5943 /// for details).
5944 pub fn clear_scopes(mut self) -> RiskAnalysiOperationGetCall<'a, C> {
5945 self._scopes.clear();
5946 self
5947 }
5948}
5949
5950/// Schedules a job to compute risk analysis metrics over content in a Google
5951/// Cloud Platform repository.
5952///
5953/// A builder for the *analyze* method supported by a *dataSource* resource.
5954/// It is not used directly, but through a [`DataSourceMethods`] instance.
5955///
5956/// # Example
5957///
5958/// Instantiate a resource method builder
5959///
5960/// ```test_harness,no_run
5961/// # extern crate hyper;
5962/// # extern crate hyper_rustls;
5963/// # extern crate google_dlp2_beta1 as dlp2_beta1;
5964/// use dlp2_beta1::api::GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest;
5965/// # async fn dox() {
5966/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5967///
5968/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5969/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5970/// # .with_native_roots()
5971/// # .unwrap()
5972/// # .https_only()
5973/// # .enable_http2()
5974/// # .build();
5975///
5976/// # let executor = hyper_util::rt::TokioExecutor::new();
5977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5978/// # secret,
5979/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5980/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5981/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5982/// # ),
5983/// # ).build().await.unwrap();
5984///
5985/// # let client = hyper_util::client::legacy::Client::builder(
5986/// # hyper_util::rt::TokioExecutor::new()
5987/// # )
5988/// # .build(
5989/// # hyper_rustls::HttpsConnectorBuilder::new()
5990/// # .with_native_roots()
5991/// # .unwrap()
5992/// # .https_or_http()
5993/// # .enable_http2()
5994/// # .build()
5995/// # );
5996/// # let mut hub = DLP::new(client, auth);
5997/// // As the method needs a request, you would usually fill it with the desired information
5998/// // into the respective structure. Some of the parts shown here might not be applicable !
5999/// // Values shown here are possibly random and not representative !
6000/// let mut req = GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest::default();
6001///
6002/// // You can configure optional parameters by calling the respective setters at will, and
6003/// // execute the final call using `doit()`.
6004/// // Values shown here are possibly random and not representative !
6005/// let result = hub.data_source().analyze(req)
6006/// .doit().await;
6007/// # }
6008/// ```
6009pub struct DataSourceAnalyzeCall<'a, C>
6010where
6011 C: 'a,
6012{
6013 hub: &'a DLP<C>,
6014 _request: GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest,
6015 _delegate: Option<&'a mut dyn common::Delegate>,
6016 _additional_params: HashMap<String, String>,
6017 _scopes: BTreeSet<String>,
6018}
6019
6020impl<'a, C> common::CallBuilder for DataSourceAnalyzeCall<'a, C> {}
6021
6022impl<'a, C> DataSourceAnalyzeCall<'a, C>
6023where
6024 C: common::Connector,
6025{
6026 /// Perform the operation you have build so far.
6027 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
6028 use std::borrow::Cow;
6029 use std::io::{Read, Seek};
6030
6031 use common::{url::Params, ToParts};
6032 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6033
6034 let mut dd = common::DefaultDelegate;
6035 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6036 dlg.begin(common::MethodInfo {
6037 id: "dlp.dataSource.analyze",
6038 http_method: hyper::Method::POST,
6039 });
6040
6041 for &field in ["alt"].iter() {
6042 if self._additional_params.contains_key(field) {
6043 dlg.finished(false);
6044 return Err(common::Error::FieldClash(field));
6045 }
6046 }
6047
6048 let mut params = Params::with_capacity(3 + self._additional_params.len());
6049
6050 params.extend(self._additional_params.iter());
6051
6052 params.push("alt", "json");
6053 let mut url = self.hub._base_url.clone() + "v2beta1/dataSource:analyze";
6054 if self._scopes.is_empty() {
6055 self._scopes
6056 .insert(Scope::CloudPlatform.as_ref().to_string());
6057 }
6058
6059 let url = params.parse_with_url(&url);
6060
6061 let mut json_mime_type = mime::APPLICATION_JSON;
6062 let mut request_value_reader = {
6063 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6064 common::remove_json_null_values(&mut value);
6065 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6066 serde_json::to_writer(&mut dst, &value).unwrap();
6067 dst
6068 };
6069 let request_size = request_value_reader
6070 .seek(std::io::SeekFrom::End(0))
6071 .unwrap();
6072 request_value_reader
6073 .seek(std::io::SeekFrom::Start(0))
6074 .unwrap();
6075
6076 loop {
6077 let token = match self
6078 .hub
6079 .auth
6080 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6081 .await
6082 {
6083 Ok(token) => token,
6084 Err(e) => match dlg.token(e) {
6085 Ok(token) => token,
6086 Err(e) => {
6087 dlg.finished(false);
6088 return Err(common::Error::MissingToken(e));
6089 }
6090 },
6091 };
6092 request_value_reader
6093 .seek(std::io::SeekFrom::Start(0))
6094 .unwrap();
6095 let mut req_result = {
6096 let client = &self.hub.client;
6097 dlg.pre_request();
6098 let mut req_builder = hyper::Request::builder()
6099 .method(hyper::Method::POST)
6100 .uri(url.as_str())
6101 .header(USER_AGENT, self.hub._user_agent.clone());
6102
6103 if let Some(token) = token.as_ref() {
6104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6105 }
6106
6107 let request = req_builder
6108 .header(CONTENT_TYPE, json_mime_type.to_string())
6109 .header(CONTENT_LENGTH, request_size as u64)
6110 .body(common::to_body(
6111 request_value_reader.get_ref().clone().into(),
6112 ));
6113
6114 client.request(request.unwrap()).await
6115 };
6116
6117 match req_result {
6118 Err(err) => {
6119 if let common::Retry::After(d) = dlg.http_error(&err) {
6120 sleep(d).await;
6121 continue;
6122 }
6123 dlg.finished(false);
6124 return Err(common::Error::HttpError(err));
6125 }
6126 Ok(res) => {
6127 let (mut parts, body) = res.into_parts();
6128 let mut body = common::Body::new(body);
6129 if !parts.status.is_success() {
6130 let bytes = common::to_bytes(body).await.unwrap_or_default();
6131 let error = serde_json::from_str(&common::to_string(&bytes));
6132 let response = common::to_response(parts, bytes.into());
6133
6134 if let common::Retry::After(d) =
6135 dlg.http_failure(&response, error.as_ref().ok())
6136 {
6137 sleep(d).await;
6138 continue;
6139 }
6140
6141 dlg.finished(false);
6142
6143 return Err(match error {
6144 Ok(value) => common::Error::BadRequest(value),
6145 _ => common::Error::Failure(response),
6146 });
6147 }
6148 let response = {
6149 let bytes = common::to_bytes(body).await.unwrap_or_default();
6150 let encoded = common::to_string(&bytes);
6151 match serde_json::from_str(&encoded) {
6152 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6153 Err(error) => {
6154 dlg.response_json_decode_error(&encoded, &error);
6155 return Err(common::Error::JsonDecodeError(
6156 encoded.to_string(),
6157 error,
6158 ));
6159 }
6160 }
6161 };
6162
6163 dlg.finished(true);
6164 return Ok(response);
6165 }
6166 }
6167 }
6168 }
6169
6170 ///
6171 /// Sets the *request* property to the given value.
6172 ///
6173 /// Even though the property as already been set when instantiating this call,
6174 /// we provide this method for API completeness.
6175 pub fn request(
6176 mut self,
6177 new_value: GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest,
6178 ) -> DataSourceAnalyzeCall<'a, C> {
6179 self._request = new_value;
6180 self
6181 }
6182 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6183 /// while executing the actual API request.
6184 ///
6185 /// ````text
6186 /// It should be used to handle progress information, and to implement a certain level of resilience.
6187 /// ````
6188 ///
6189 /// Sets the *delegate* property to the given value.
6190 pub fn delegate(
6191 mut self,
6192 new_value: &'a mut dyn common::Delegate,
6193 ) -> DataSourceAnalyzeCall<'a, C> {
6194 self._delegate = Some(new_value);
6195 self
6196 }
6197
6198 /// Set any additional parameter of the query string used in the request.
6199 /// It should be used to set parameters which are not yet available through their own
6200 /// setters.
6201 ///
6202 /// Please note that this method must not be used to set any of the known parameters
6203 /// which have their own setter method. If done anyway, the request will fail.
6204 ///
6205 /// # Additional Parameters
6206 ///
6207 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6208 /// * *bearer_token* (query-string) - OAuth bearer token.
6209 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6211 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6212 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6213 /// * *$.xgafv* (query-string) - V1 error format.
6214 /// * *callback* (query-string) - JSONP
6215 /// * *alt* (query-string) - Data format for response.
6216 /// * *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.
6217 /// * *access_token* (query-string) - OAuth access token.
6218 /// * *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.
6219 /// * *pp* (query-boolean) - Pretty-print response.
6220 pub fn param<T>(mut self, name: T, value: T) -> DataSourceAnalyzeCall<'a, C>
6221 where
6222 T: AsRef<str>,
6223 {
6224 self._additional_params
6225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6226 self
6227 }
6228
6229 /// Identifies the authorization scope for the method you are building.
6230 ///
6231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6232 /// [`Scope::CloudPlatform`].
6233 ///
6234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6235 /// tokens for more than one scope.
6236 ///
6237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6239 /// sufficient, a read-write scope will do as well.
6240 pub fn add_scope<St>(mut self, scope: St) -> DataSourceAnalyzeCall<'a, C>
6241 where
6242 St: AsRef<str>,
6243 {
6244 self._scopes.insert(String::from(scope.as_ref()));
6245 self
6246 }
6247 /// Identifies the authorization scope(s) for the method you are building.
6248 ///
6249 /// See [`Self::add_scope()`] for details.
6250 pub fn add_scopes<I, St>(mut self, scopes: I) -> DataSourceAnalyzeCall<'a, C>
6251 where
6252 I: IntoIterator<Item = St>,
6253 St: AsRef<str>,
6254 {
6255 self._scopes
6256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6257 self
6258 }
6259
6260 /// Removes all scopes, and no default scope will be used either.
6261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6262 /// for details).
6263 pub fn clear_scopes(mut self) -> DataSourceAnalyzeCall<'a, C> {
6264 self._scopes.clear();
6265 self
6266 }
6267}
6268
6269/// Schedules a job scanning content in a Google Cloud Platform data
6270/// repository.
6271///
6272/// A builder for the *operations.create* method supported by a *inspect* resource.
6273/// It is not used directly, but through a [`InspectMethods`] instance.
6274///
6275/// # Example
6276///
6277/// Instantiate a resource method builder
6278///
6279/// ```test_harness,no_run
6280/// # extern crate hyper;
6281/// # extern crate hyper_rustls;
6282/// # extern crate google_dlp2_beta1 as dlp2_beta1;
6283/// use dlp2_beta1::api::GooglePrivacyDlpV2beta1CreateInspectOperationRequest;
6284/// # async fn dox() {
6285/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6286///
6287/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6288/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6289/// # .with_native_roots()
6290/// # .unwrap()
6291/// # .https_only()
6292/// # .enable_http2()
6293/// # .build();
6294///
6295/// # let executor = hyper_util::rt::TokioExecutor::new();
6296/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6297/// # secret,
6298/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6299/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6300/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6301/// # ),
6302/// # ).build().await.unwrap();
6303///
6304/// # let client = hyper_util::client::legacy::Client::builder(
6305/// # hyper_util::rt::TokioExecutor::new()
6306/// # )
6307/// # .build(
6308/// # hyper_rustls::HttpsConnectorBuilder::new()
6309/// # .with_native_roots()
6310/// # .unwrap()
6311/// # .https_or_http()
6312/// # .enable_http2()
6313/// # .build()
6314/// # );
6315/// # let mut hub = DLP::new(client, auth);
6316/// // As the method needs a request, you would usually fill it with the desired information
6317/// // into the respective structure. Some of the parts shown here might not be applicable !
6318/// // Values shown here are possibly random and not representative !
6319/// let mut req = GooglePrivacyDlpV2beta1CreateInspectOperationRequest::default();
6320///
6321/// // You can configure optional parameters by calling the respective setters at will, and
6322/// // execute the final call using `doit()`.
6323/// // Values shown here are possibly random and not representative !
6324/// let result = hub.inspect().operations_create(req)
6325/// .doit().await;
6326/// # }
6327/// ```
6328pub struct InspectOperationCreateCall<'a, C>
6329where
6330 C: 'a,
6331{
6332 hub: &'a DLP<C>,
6333 _request: GooglePrivacyDlpV2beta1CreateInspectOperationRequest,
6334 _delegate: Option<&'a mut dyn common::Delegate>,
6335 _additional_params: HashMap<String, String>,
6336 _scopes: BTreeSet<String>,
6337}
6338
6339impl<'a, C> common::CallBuilder for InspectOperationCreateCall<'a, C> {}
6340
6341impl<'a, C> InspectOperationCreateCall<'a, C>
6342where
6343 C: common::Connector,
6344{
6345 /// Perform the operation you have build so far.
6346 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
6347 use std::borrow::Cow;
6348 use std::io::{Read, Seek};
6349
6350 use common::{url::Params, ToParts};
6351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6352
6353 let mut dd = common::DefaultDelegate;
6354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6355 dlg.begin(common::MethodInfo {
6356 id: "dlp.inspect.operations.create",
6357 http_method: hyper::Method::POST,
6358 });
6359
6360 for &field in ["alt"].iter() {
6361 if self._additional_params.contains_key(field) {
6362 dlg.finished(false);
6363 return Err(common::Error::FieldClash(field));
6364 }
6365 }
6366
6367 let mut params = Params::with_capacity(3 + self._additional_params.len());
6368
6369 params.extend(self._additional_params.iter());
6370
6371 params.push("alt", "json");
6372 let mut url = self.hub._base_url.clone() + "v2beta1/inspect/operations";
6373 if self._scopes.is_empty() {
6374 self._scopes
6375 .insert(Scope::CloudPlatform.as_ref().to_string());
6376 }
6377
6378 let url = params.parse_with_url(&url);
6379
6380 let mut json_mime_type = mime::APPLICATION_JSON;
6381 let mut request_value_reader = {
6382 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6383 common::remove_json_null_values(&mut value);
6384 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6385 serde_json::to_writer(&mut dst, &value).unwrap();
6386 dst
6387 };
6388 let request_size = request_value_reader
6389 .seek(std::io::SeekFrom::End(0))
6390 .unwrap();
6391 request_value_reader
6392 .seek(std::io::SeekFrom::Start(0))
6393 .unwrap();
6394
6395 loop {
6396 let token = match self
6397 .hub
6398 .auth
6399 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6400 .await
6401 {
6402 Ok(token) => token,
6403 Err(e) => match dlg.token(e) {
6404 Ok(token) => token,
6405 Err(e) => {
6406 dlg.finished(false);
6407 return Err(common::Error::MissingToken(e));
6408 }
6409 },
6410 };
6411 request_value_reader
6412 .seek(std::io::SeekFrom::Start(0))
6413 .unwrap();
6414 let mut req_result = {
6415 let client = &self.hub.client;
6416 dlg.pre_request();
6417 let mut req_builder = hyper::Request::builder()
6418 .method(hyper::Method::POST)
6419 .uri(url.as_str())
6420 .header(USER_AGENT, self.hub._user_agent.clone());
6421
6422 if let Some(token) = token.as_ref() {
6423 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6424 }
6425
6426 let request = req_builder
6427 .header(CONTENT_TYPE, json_mime_type.to_string())
6428 .header(CONTENT_LENGTH, request_size as u64)
6429 .body(common::to_body(
6430 request_value_reader.get_ref().clone().into(),
6431 ));
6432
6433 client.request(request.unwrap()).await
6434 };
6435
6436 match req_result {
6437 Err(err) => {
6438 if let common::Retry::After(d) = dlg.http_error(&err) {
6439 sleep(d).await;
6440 continue;
6441 }
6442 dlg.finished(false);
6443 return Err(common::Error::HttpError(err));
6444 }
6445 Ok(res) => {
6446 let (mut parts, body) = res.into_parts();
6447 let mut body = common::Body::new(body);
6448 if !parts.status.is_success() {
6449 let bytes = common::to_bytes(body).await.unwrap_or_default();
6450 let error = serde_json::from_str(&common::to_string(&bytes));
6451 let response = common::to_response(parts, bytes.into());
6452
6453 if let common::Retry::After(d) =
6454 dlg.http_failure(&response, error.as_ref().ok())
6455 {
6456 sleep(d).await;
6457 continue;
6458 }
6459
6460 dlg.finished(false);
6461
6462 return Err(match error {
6463 Ok(value) => common::Error::BadRequest(value),
6464 _ => common::Error::Failure(response),
6465 });
6466 }
6467 let response = {
6468 let bytes = common::to_bytes(body).await.unwrap_or_default();
6469 let encoded = common::to_string(&bytes);
6470 match serde_json::from_str(&encoded) {
6471 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6472 Err(error) => {
6473 dlg.response_json_decode_error(&encoded, &error);
6474 return Err(common::Error::JsonDecodeError(
6475 encoded.to_string(),
6476 error,
6477 ));
6478 }
6479 }
6480 };
6481
6482 dlg.finished(true);
6483 return Ok(response);
6484 }
6485 }
6486 }
6487 }
6488
6489 ///
6490 /// Sets the *request* property to the given value.
6491 ///
6492 /// Even though the property as already been set when instantiating this call,
6493 /// we provide this method for API completeness.
6494 pub fn request(
6495 mut self,
6496 new_value: GooglePrivacyDlpV2beta1CreateInspectOperationRequest,
6497 ) -> InspectOperationCreateCall<'a, C> {
6498 self._request = new_value;
6499 self
6500 }
6501 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6502 /// while executing the actual API request.
6503 ///
6504 /// ````text
6505 /// It should be used to handle progress information, and to implement a certain level of resilience.
6506 /// ````
6507 ///
6508 /// Sets the *delegate* property to the given value.
6509 pub fn delegate(
6510 mut self,
6511 new_value: &'a mut dyn common::Delegate,
6512 ) -> InspectOperationCreateCall<'a, C> {
6513 self._delegate = Some(new_value);
6514 self
6515 }
6516
6517 /// Set any additional parameter of the query string used in the request.
6518 /// It should be used to set parameters which are not yet available through their own
6519 /// setters.
6520 ///
6521 /// Please note that this method must not be used to set any of the known parameters
6522 /// which have their own setter method. If done anyway, the request will fail.
6523 ///
6524 /// # Additional Parameters
6525 ///
6526 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6527 /// * *bearer_token* (query-string) - OAuth bearer token.
6528 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6529 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6530 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6531 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6532 /// * *$.xgafv* (query-string) - V1 error format.
6533 /// * *callback* (query-string) - JSONP
6534 /// * *alt* (query-string) - Data format for response.
6535 /// * *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.
6536 /// * *access_token* (query-string) - OAuth access token.
6537 /// * *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.
6538 /// * *pp* (query-boolean) - Pretty-print response.
6539 pub fn param<T>(mut self, name: T, value: T) -> InspectOperationCreateCall<'a, C>
6540 where
6541 T: AsRef<str>,
6542 {
6543 self._additional_params
6544 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6545 self
6546 }
6547
6548 /// Identifies the authorization scope for the method you are building.
6549 ///
6550 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6551 /// [`Scope::CloudPlatform`].
6552 ///
6553 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6554 /// tokens for more than one scope.
6555 ///
6556 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6557 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6558 /// sufficient, a read-write scope will do as well.
6559 pub fn add_scope<St>(mut self, scope: St) -> InspectOperationCreateCall<'a, C>
6560 where
6561 St: AsRef<str>,
6562 {
6563 self._scopes.insert(String::from(scope.as_ref()));
6564 self
6565 }
6566 /// Identifies the authorization scope(s) for the method you are building.
6567 ///
6568 /// See [`Self::add_scope()`] for details.
6569 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectOperationCreateCall<'a, C>
6570 where
6571 I: IntoIterator<Item = St>,
6572 St: AsRef<str>,
6573 {
6574 self._scopes
6575 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6576 self
6577 }
6578
6579 /// Removes all scopes, and no default scope will be used either.
6580 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6581 /// for details).
6582 pub fn clear_scopes(mut self) -> InspectOperationCreateCall<'a, C> {
6583 self._scopes.clear();
6584 self
6585 }
6586}
6587
6588/// Cancels an operation. Use the `inspect.operations.get` to check whether the cancellation succeeded or the operation completed despite cancellation.
6589///
6590/// A builder for the *operations.cancel* method supported by a *inspect* resource.
6591/// It is not used directly, but through a [`InspectMethods`] instance.
6592///
6593/// # Example
6594///
6595/// Instantiate a resource method builder
6596///
6597/// ```test_harness,no_run
6598/// # extern crate hyper;
6599/// # extern crate hyper_rustls;
6600/// # extern crate google_dlp2_beta1 as dlp2_beta1;
6601/// use dlp2_beta1::api::GoogleLongrunningCancelOperationRequest;
6602/// # async fn dox() {
6603/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6604///
6605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6606/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6607/// # .with_native_roots()
6608/// # .unwrap()
6609/// # .https_only()
6610/// # .enable_http2()
6611/// # .build();
6612///
6613/// # let executor = hyper_util::rt::TokioExecutor::new();
6614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6615/// # secret,
6616/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6617/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6618/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6619/// # ),
6620/// # ).build().await.unwrap();
6621///
6622/// # let client = hyper_util::client::legacy::Client::builder(
6623/// # hyper_util::rt::TokioExecutor::new()
6624/// # )
6625/// # .build(
6626/// # hyper_rustls::HttpsConnectorBuilder::new()
6627/// # .with_native_roots()
6628/// # .unwrap()
6629/// # .https_or_http()
6630/// # .enable_http2()
6631/// # .build()
6632/// # );
6633/// # let mut hub = DLP::new(client, auth);
6634/// // As the method needs a request, you would usually fill it with the desired information
6635/// // into the respective structure. Some of the parts shown here might not be applicable !
6636/// // Values shown here are possibly random and not representative !
6637/// let mut req = GoogleLongrunningCancelOperationRequest::default();
6638///
6639/// // You can configure optional parameters by calling the respective setters at will, and
6640/// // execute the final call using `doit()`.
6641/// // Values shown here are possibly random and not representative !
6642/// let result = hub.inspect().operations_cancel(req, "name")
6643/// .doit().await;
6644/// # }
6645/// ```
6646pub struct InspectOperationCancelCall<'a, C>
6647where
6648 C: 'a,
6649{
6650 hub: &'a DLP<C>,
6651 _request: GoogleLongrunningCancelOperationRequest,
6652 _name: String,
6653 _delegate: Option<&'a mut dyn common::Delegate>,
6654 _additional_params: HashMap<String, String>,
6655 _scopes: BTreeSet<String>,
6656}
6657
6658impl<'a, C> common::CallBuilder for InspectOperationCancelCall<'a, C> {}
6659
6660impl<'a, C> InspectOperationCancelCall<'a, C>
6661where
6662 C: common::Connector,
6663{
6664 /// Perform the operation you have build so far.
6665 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
6666 use std::borrow::Cow;
6667 use std::io::{Read, Seek};
6668
6669 use common::{url::Params, ToParts};
6670 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6671
6672 let mut dd = common::DefaultDelegate;
6673 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6674 dlg.begin(common::MethodInfo {
6675 id: "dlp.inspect.operations.cancel",
6676 http_method: hyper::Method::POST,
6677 });
6678
6679 for &field in ["alt", "name"].iter() {
6680 if self._additional_params.contains_key(field) {
6681 dlg.finished(false);
6682 return Err(common::Error::FieldClash(field));
6683 }
6684 }
6685
6686 let mut params = Params::with_capacity(4 + self._additional_params.len());
6687 params.push("name", self._name);
6688
6689 params.extend(self._additional_params.iter());
6690
6691 params.push("alt", "json");
6692 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}:cancel";
6693 if self._scopes.is_empty() {
6694 self._scopes
6695 .insert(Scope::CloudPlatform.as_ref().to_string());
6696 }
6697
6698 #[allow(clippy::single_element_loop)]
6699 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6700 url = params.uri_replacement(url, param_name, find_this, true);
6701 }
6702 {
6703 let to_remove = ["name"];
6704 params.remove_params(&to_remove);
6705 }
6706
6707 let url = params.parse_with_url(&url);
6708
6709 let mut json_mime_type = mime::APPLICATION_JSON;
6710 let mut request_value_reader = {
6711 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6712 common::remove_json_null_values(&mut value);
6713 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6714 serde_json::to_writer(&mut dst, &value).unwrap();
6715 dst
6716 };
6717 let request_size = request_value_reader
6718 .seek(std::io::SeekFrom::End(0))
6719 .unwrap();
6720 request_value_reader
6721 .seek(std::io::SeekFrom::Start(0))
6722 .unwrap();
6723
6724 loop {
6725 let token = match self
6726 .hub
6727 .auth
6728 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6729 .await
6730 {
6731 Ok(token) => token,
6732 Err(e) => match dlg.token(e) {
6733 Ok(token) => token,
6734 Err(e) => {
6735 dlg.finished(false);
6736 return Err(common::Error::MissingToken(e));
6737 }
6738 },
6739 };
6740 request_value_reader
6741 .seek(std::io::SeekFrom::Start(0))
6742 .unwrap();
6743 let mut req_result = {
6744 let client = &self.hub.client;
6745 dlg.pre_request();
6746 let mut req_builder = hyper::Request::builder()
6747 .method(hyper::Method::POST)
6748 .uri(url.as_str())
6749 .header(USER_AGENT, self.hub._user_agent.clone());
6750
6751 if let Some(token) = token.as_ref() {
6752 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6753 }
6754
6755 let request = req_builder
6756 .header(CONTENT_TYPE, json_mime_type.to_string())
6757 .header(CONTENT_LENGTH, request_size as u64)
6758 .body(common::to_body(
6759 request_value_reader.get_ref().clone().into(),
6760 ));
6761
6762 client.request(request.unwrap()).await
6763 };
6764
6765 match req_result {
6766 Err(err) => {
6767 if let common::Retry::After(d) = dlg.http_error(&err) {
6768 sleep(d).await;
6769 continue;
6770 }
6771 dlg.finished(false);
6772 return Err(common::Error::HttpError(err));
6773 }
6774 Ok(res) => {
6775 let (mut parts, body) = res.into_parts();
6776 let mut body = common::Body::new(body);
6777 if !parts.status.is_success() {
6778 let bytes = common::to_bytes(body).await.unwrap_or_default();
6779 let error = serde_json::from_str(&common::to_string(&bytes));
6780 let response = common::to_response(parts, bytes.into());
6781
6782 if let common::Retry::After(d) =
6783 dlg.http_failure(&response, error.as_ref().ok())
6784 {
6785 sleep(d).await;
6786 continue;
6787 }
6788
6789 dlg.finished(false);
6790
6791 return Err(match error {
6792 Ok(value) => common::Error::BadRequest(value),
6793 _ => common::Error::Failure(response),
6794 });
6795 }
6796 let response = {
6797 let bytes = common::to_bytes(body).await.unwrap_or_default();
6798 let encoded = common::to_string(&bytes);
6799 match serde_json::from_str(&encoded) {
6800 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6801 Err(error) => {
6802 dlg.response_json_decode_error(&encoded, &error);
6803 return Err(common::Error::JsonDecodeError(
6804 encoded.to_string(),
6805 error,
6806 ));
6807 }
6808 }
6809 };
6810
6811 dlg.finished(true);
6812 return Ok(response);
6813 }
6814 }
6815 }
6816 }
6817
6818 ///
6819 /// Sets the *request* property to the given value.
6820 ///
6821 /// Even though the property as already been set when instantiating this call,
6822 /// we provide this method for API completeness.
6823 pub fn request(
6824 mut self,
6825 new_value: GoogleLongrunningCancelOperationRequest,
6826 ) -> InspectOperationCancelCall<'a, C> {
6827 self._request = new_value;
6828 self
6829 }
6830 /// The name of the operation resource to be cancelled.
6831 ///
6832 /// Sets the *name* path property to the given value.
6833 ///
6834 /// Even though the property as already been set when instantiating this call,
6835 /// we provide this method for API completeness.
6836 pub fn name(mut self, new_value: &str) -> InspectOperationCancelCall<'a, C> {
6837 self._name = new_value.to_string();
6838 self
6839 }
6840 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6841 /// while executing the actual API request.
6842 ///
6843 /// ````text
6844 /// It should be used to handle progress information, and to implement a certain level of resilience.
6845 /// ````
6846 ///
6847 /// Sets the *delegate* property to the given value.
6848 pub fn delegate(
6849 mut self,
6850 new_value: &'a mut dyn common::Delegate,
6851 ) -> InspectOperationCancelCall<'a, C> {
6852 self._delegate = Some(new_value);
6853 self
6854 }
6855
6856 /// Set any additional parameter of the query string used in the request.
6857 /// It should be used to set parameters which are not yet available through their own
6858 /// setters.
6859 ///
6860 /// Please note that this method must not be used to set any of the known parameters
6861 /// which have their own setter method. If done anyway, the request will fail.
6862 ///
6863 /// # Additional Parameters
6864 ///
6865 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6866 /// * *bearer_token* (query-string) - OAuth bearer token.
6867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6868 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6869 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6870 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6871 /// * *$.xgafv* (query-string) - V1 error format.
6872 /// * *callback* (query-string) - JSONP
6873 /// * *alt* (query-string) - Data format for response.
6874 /// * *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.
6875 /// * *access_token* (query-string) - OAuth access token.
6876 /// * *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.
6877 /// * *pp* (query-boolean) - Pretty-print response.
6878 pub fn param<T>(mut self, name: T, value: T) -> InspectOperationCancelCall<'a, C>
6879 where
6880 T: AsRef<str>,
6881 {
6882 self._additional_params
6883 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6884 self
6885 }
6886
6887 /// Identifies the authorization scope for the method you are building.
6888 ///
6889 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6890 /// [`Scope::CloudPlatform`].
6891 ///
6892 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6893 /// tokens for more than one scope.
6894 ///
6895 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6896 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6897 /// sufficient, a read-write scope will do as well.
6898 pub fn add_scope<St>(mut self, scope: St) -> InspectOperationCancelCall<'a, C>
6899 where
6900 St: AsRef<str>,
6901 {
6902 self._scopes.insert(String::from(scope.as_ref()));
6903 self
6904 }
6905 /// Identifies the authorization scope(s) for the method you are building.
6906 ///
6907 /// See [`Self::add_scope()`] for details.
6908 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectOperationCancelCall<'a, C>
6909 where
6910 I: IntoIterator<Item = St>,
6911 St: AsRef<str>,
6912 {
6913 self._scopes
6914 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6915 self
6916 }
6917
6918 /// Removes all scopes, and no default scope will be used either.
6919 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6920 /// for details).
6921 pub fn clear_scopes(mut self) -> InspectOperationCancelCall<'a, C> {
6922 self._scopes.clear();
6923 self
6924 }
6925}
6926
6927/// This method is not supported and the server returns `UNIMPLEMENTED`.
6928///
6929/// A builder for the *operations.delete* method supported by a *inspect* resource.
6930/// It is not used directly, but through a [`InspectMethods`] instance.
6931///
6932/// # Example
6933///
6934/// Instantiate a resource method builder
6935///
6936/// ```test_harness,no_run
6937/// # extern crate hyper;
6938/// # extern crate hyper_rustls;
6939/// # extern crate google_dlp2_beta1 as dlp2_beta1;
6940/// # async fn dox() {
6941/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6942///
6943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6944/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6945/// # .with_native_roots()
6946/// # .unwrap()
6947/// # .https_only()
6948/// # .enable_http2()
6949/// # .build();
6950///
6951/// # let executor = hyper_util::rt::TokioExecutor::new();
6952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6953/// # secret,
6954/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6955/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6956/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6957/// # ),
6958/// # ).build().await.unwrap();
6959///
6960/// # let client = hyper_util::client::legacy::Client::builder(
6961/// # hyper_util::rt::TokioExecutor::new()
6962/// # )
6963/// # .build(
6964/// # hyper_rustls::HttpsConnectorBuilder::new()
6965/// # .with_native_roots()
6966/// # .unwrap()
6967/// # .https_or_http()
6968/// # .enable_http2()
6969/// # .build()
6970/// # );
6971/// # let mut hub = DLP::new(client, auth);
6972/// // You can configure optional parameters by calling the respective setters at will, and
6973/// // execute the final call using `doit()`.
6974/// // Values shown here are possibly random and not representative !
6975/// let result = hub.inspect().operations_delete("name")
6976/// .doit().await;
6977/// # }
6978/// ```
6979pub struct InspectOperationDeleteCall<'a, C>
6980where
6981 C: 'a,
6982{
6983 hub: &'a DLP<C>,
6984 _name: String,
6985 _delegate: Option<&'a mut dyn common::Delegate>,
6986 _additional_params: HashMap<String, String>,
6987 _scopes: BTreeSet<String>,
6988}
6989
6990impl<'a, C> common::CallBuilder for InspectOperationDeleteCall<'a, C> {}
6991
6992impl<'a, C> InspectOperationDeleteCall<'a, C>
6993where
6994 C: common::Connector,
6995{
6996 /// Perform the operation you have build so far.
6997 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleProtobufEmpty)> {
6998 use std::borrow::Cow;
6999 use std::io::{Read, Seek};
7000
7001 use common::{url::Params, ToParts};
7002 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7003
7004 let mut dd = common::DefaultDelegate;
7005 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7006 dlg.begin(common::MethodInfo {
7007 id: "dlp.inspect.operations.delete",
7008 http_method: hyper::Method::DELETE,
7009 });
7010
7011 for &field in ["alt", "name"].iter() {
7012 if self._additional_params.contains_key(field) {
7013 dlg.finished(false);
7014 return Err(common::Error::FieldClash(field));
7015 }
7016 }
7017
7018 let mut params = Params::with_capacity(3 + self._additional_params.len());
7019 params.push("name", self._name);
7020
7021 params.extend(self._additional_params.iter());
7022
7023 params.push("alt", "json");
7024 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
7025 if self._scopes.is_empty() {
7026 self._scopes
7027 .insert(Scope::CloudPlatform.as_ref().to_string());
7028 }
7029
7030 #[allow(clippy::single_element_loop)]
7031 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7032 url = params.uri_replacement(url, param_name, find_this, true);
7033 }
7034 {
7035 let to_remove = ["name"];
7036 params.remove_params(&to_remove);
7037 }
7038
7039 let url = params.parse_with_url(&url);
7040
7041 loop {
7042 let token = match self
7043 .hub
7044 .auth
7045 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7046 .await
7047 {
7048 Ok(token) => token,
7049 Err(e) => match dlg.token(e) {
7050 Ok(token) => token,
7051 Err(e) => {
7052 dlg.finished(false);
7053 return Err(common::Error::MissingToken(e));
7054 }
7055 },
7056 };
7057 let mut req_result = {
7058 let client = &self.hub.client;
7059 dlg.pre_request();
7060 let mut req_builder = hyper::Request::builder()
7061 .method(hyper::Method::DELETE)
7062 .uri(url.as_str())
7063 .header(USER_AGENT, self.hub._user_agent.clone());
7064
7065 if let Some(token) = token.as_ref() {
7066 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7067 }
7068
7069 let request = req_builder
7070 .header(CONTENT_LENGTH, 0_u64)
7071 .body(common::to_body::<String>(None));
7072
7073 client.request(request.unwrap()).await
7074 };
7075
7076 match req_result {
7077 Err(err) => {
7078 if let common::Retry::After(d) = dlg.http_error(&err) {
7079 sleep(d).await;
7080 continue;
7081 }
7082 dlg.finished(false);
7083 return Err(common::Error::HttpError(err));
7084 }
7085 Ok(res) => {
7086 let (mut parts, body) = res.into_parts();
7087 let mut body = common::Body::new(body);
7088 if !parts.status.is_success() {
7089 let bytes = common::to_bytes(body).await.unwrap_or_default();
7090 let error = serde_json::from_str(&common::to_string(&bytes));
7091 let response = common::to_response(parts, bytes.into());
7092
7093 if let common::Retry::After(d) =
7094 dlg.http_failure(&response, error.as_ref().ok())
7095 {
7096 sleep(d).await;
7097 continue;
7098 }
7099
7100 dlg.finished(false);
7101
7102 return Err(match error {
7103 Ok(value) => common::Error::BadRequest(value),
7104 _ => common::Error::Failure(response),
7105 });
7106 }
7107 let response = {
7108 let bytes = common::to_bytes(body).await.unwrap_or_default();
7109 let encoded = common::to_string(&bytes);
7110 match serde_json::from_str(&encoded) {
7111 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7112 Err(error) => {
7113 dlg.response_json_decode_error(&encoded, &error);
7114 return Err(common::Error::JsonDecodeError(
7115 encoded.to_string(),
7116 error,
7117 ));
7118 }
7119 }
7120 };
7121
7122 dlg.finished(true);
7123 return Ok(response);
7124 }
7125 }
7126 }
7127 }
7128
7129 /// The name of the operation resource to be deleted.
7130 ///
7131 /// Sets the *name* path property to the given value.
7132 ///
7133 /// Even though the property as already been set when instantiating this call,
7134 /// we provide this method for API completeness.
7135 pub fn name(mut self, new_value: &str) -> InspectOperationDeleteCall<'a, C> {
7136 self._name = new_value.to_string();
7137 self
7138 }
7139 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7140 /// while executing the actual API request.
7141 ///
7142 /// ````text
7143 /// It should be used to handle progress information, and to implement a certain level of resilience.
7144 /// ````
7145 ///
7146 /// Sets the *delegate* property to the given value.
7147 pub fn delegate(
7148 mut self,
7149 new_value: &'a mut dyn common::Delegate,
7150 ) -> InspectOperationDeleteCall<'a, C> {
7151 self._delegate = Some(new_value);
7152 self
7153 }
7154
7155 /// Set any additional parameter of the query string used in the request.
7156 /// It should be used to set parameters which are not yet available through their own
7157 /// setters.
7158 ///
7159 /// Please note that this method must not be used to set any of the known parameters
7160 /// which have their own setter method. If done anyway, the request will fail.
7161 ///
7162 /// # Additional Parameters
7163 ///
7164 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7165 /// * *bearer_token* (query-string) - OAuth bearer token.
7166 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7167 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7168 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7169 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7170 /// * *$.xgafv* (query-string) - V1 error format.
7171 /// * *callback* (query-string) - JSONP
7172 /// * *alt* (query-string) - Data format for response.
7173 /// * *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.
7174 /// * *access_token* (query-string) - OAuth access token.
7175 /// * *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.
7176 /// * *pp* (query-boolean) - Pretty-print response.
7177 pub fn param<T>(mut self, name: T, value: T) -> InspectOperationDeleteCall<'a, C>
7178 where
7179 T: AsRef<str>,
7180 {
7181 self._additional_params
7182 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7183 self
7184 }
7185
7186 /// Identifies the authorization scope for the method you are building.
7187 ///
7188 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7189 /// [`Scope::CloudPlatform`].
7190 ///
7191 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7192 /// tokens for more than one scope.
7193 ///
7194 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7195 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7196 /// sufficient, a read-write scope will do as well.
7197 pub fn add_scope<St>(mut self, scope: St) -> InspectOperationDeleteCall<'a, C>
7198 where
7199 St: AsRef<str>,
7200 {
7201 self._scopes.insert(String::from(scope.as_ref()));
7202 self
7203 }
7204 /// Identifies the authorization scope(s) for the method you are building.
7205 ///
7206 /// See [`Self::add_scope()`] for details.
7207 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectOperationDeleteCall<'a, C>
7208 where
7209 I: IntoIterator<Item = St>,
7210 St: AsRef<str>,
7211 {
7212 self._scopes
7213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7214 self
7215 }
7216
7217 /// Removes all scopes, and no default scope will be used either.
7218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7219 /// for details).
7220 pub fn clear_scopes(mut self) -> InspectOperationDeleteCall<'a, C> {
7221 self._scopes.clear();
7222 self
7223 }
7224}
7225
7226/// Fetches the list of long running operations.
7227///
7228/// A builder for the *operations.list* method supported by a *inspect* resource.
7229/// It is not used directly, but through a [`InspectMethods`] instance.
7230///
7231/// # Example
7232///
7233/// Instantiate a resource method builder
7234///
7235/// ```test_harness,no_run
7236/// # extern crate hyper;
7237/// # extern crate hyper_rustls;
7238/// # extern crate google_dlp2_beta1 as dlp2_beta1;
7239/// # async fn dox() {
7240/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7241///
7242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7243/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7244/// # .with_native_roots()
7245/// # .unwrap()
7246/// # .https_only()
7247/// # .enable_http2()
7248/// # .build();
7249///
7250/// # let executor = hyper_util::rt::TokioExecutor::new();
7251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7252/// # secret,
7253/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7254/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7255/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7256/// # ),
7257/// # ).build().await.unwrap();
7258///
7259/// # let client = hyper_util::client::legacy::Client::builder(
7260/// # hyper_util::rt::TokioExecutor::new()
7261/// # )
7262/// # .build(
7263/// # hyper_rustls::HttpsConnectorBuilder::new()
7264/// # .with_native_roots()
7265/// # .unwrap()
7266/// # .https_or_http()
7267/// # .enable_http2()
7268/// # .build()
7269/// # );
7270/// # let mut hub = DLP::new(client, auth);
7271/// // You can configure optional parameters by calling the respective setters at will, and
7272/// // execute the final call using `doit()`.
7273/// // Values shown here are possibly random and not representative !
7274/// let result = hub.inspect().operations_list("name")
7275/// .page_token("eos")
7276/// .page_size(-4)
7277/// .filter("ea")
7278/// .doit().await;
7279/// # }
7280/// ```
7281pub struct InspectOperationListCall<'a, C>
7282where
7283 C: 'a,
7284{
7285 hub: &'a DLP<C>,
7286 _name: String,
7287 _page_token: Option<String>,
7288 _page_size: Option<i32>,
7289 _filter: Option<String>,
7290 _delegate: Option<&'a mut dyn common::Delegate>,
7291 _additional_params: HashMap<String, String>,
7292 _scopes: BTreeSet<String>,
7293}
7294
7295impl<'a, C> common::CallBuilder for InspectOperationListCall<'a, C> {}
7296
7297impl<'a, C> InspectOperationListCall<'a, C>
7298where
7299 C: common::Connector,
7300{
7301 /// Perform the operation you have build so far.
7302 pub async fn doit(
7303 mut self,
7304 ) -> common::Result<(common::Response, GoogleLongrunningListOperationsResponse)> {
7305 use std::borrow::Cow;
7306 use std::io::{Read, Seek};
7307
7308 use common::{url::Params, ToParts};
7309 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7310
7311 let mut dd = common::DefaultDelegate;
7312 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7313 dlg.begin(common::MethodInfo {
7314 id: "dlp.inspect.operations.list",
7315 http_method: hyper::Method::GET,
7316 });
7317
7318 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
7319 if self._additional_params.contains_key(field) {
7320 dlg.finished(false);
7321 return Err(common::Error::FieldClash(field));
7322 }
7323 }
7324
7325 let mut params = Params::with_capacity(6 + self._additional_params.len());
7326 params.push("name", self._name);
7327 if let Some(value) = self._page_token.as_ref() {
7328 params.push("pageToken", value);
7329 }
7330 if let Some(value) = self._page_size.as_ref() {
7331 params.push("pageSize", value.to_string());
7332 }
7333 if let Some(value) = self._filter.as_ref() {
7334 params.push("filter", value);
7335 }
7336
7337 params.extend(self._additional_params.iter());
7338
7339 params.push("alt", "json");
7340 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
7341 if self._scopes.is_empty() {
7342 self._scopes
7343 .insert(Scope::CloudPlatform.as_ref().to_string());
7344 }
7345
7346 #[allow(clippy::single_element_loop)]
7347 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7348 url = params.uri_replacement(url, param_name, find_this, true);
7349 }
7350 {
7351 let to_remove = ["name"];
7352 params.remove_params(&to_remove);
7353 }
7354
7355 let url = params.parse_with_url(&url);
7356
7357 loop {
7358 let token = match self
7359 .hub
7360 .auth
7361 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7362 .await
7363 {
7364 Ok(token) => token,
7365 Err(e) => match dlg.token(e) {
7366 Ok(token) => token,
7367 Err(e) => {
7368 dlg.finished(false);
7369 return Err(common::Error::MissingToken(e));
7370 }
7371 },
7372 };
7373 let mut req_result = {
7374 let client = &self.hub.client;
7375 dlg.pre_request();
7376 let mut req_builder = hyper::Request::builder()
7377 .method(hyper::Method::GET)
7378 .uri(url.as_str())
7379 .header(USER_AGENT, self.hub._user_agent.clone());
7380
7381 if let Some(token) = token.as_ref() {
7382 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7383 }
7384
7385 let request = req_builder
7386 .header(CONTENT_LENGTH, 0_u64)
7387 .body(common::to_body::<String>(None));
7388
7389 client.request(request.unwrap()).await
7390 };
7391
7392 match req_result {
7393 Err(err) => {
7394 if let common::Retry::After(d) = dlg.http_error(&err) {
7395 sleep(d).await;
7396 continue;
7397 }
7398 dlg.finished(false);
7399 return Err(common::Error::HttpError(err));
7400 }
7401 Ok(res) => {
7402 let (mut parts, body) = res.into_parts();
7403 let mut body = common::Body::new(body);
7404 if !parts.status.is_success() {
7405 let bytes = common::to_bytes(body).await.unwrap_or_default();
7406 let error = serde_json::from_str(&common::to_string(&bytes));
7407 let response = common::to_response(parts, bytes.into());
7408
7409 if let common::Retry::After(d) =
7410 dlg.http_failure(&response, error.as_ref().ok())
7411 {
7412 sleep(d).await;
7413 continue;
7414 }
7415
7416 dlg.finished(false);
7417
7418 return Err(match error {
7419 Ok(value) => common::Error::BadRequest(value),
7420 _ => common::Error::Failure(response),
7421 });
7422 }
7423 let response = {
7424 let bytes = common::to_bytes(body).await.unwrap_or_default();
7425 let encoded = common::to_string(&bytes);
7426 match serde_json::from_str(&encoded) {
7427 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7428 Err(error) => {
7429 dlg.response_json_decode_error(&encoded, &error);
7430 return Err(common::Error::JsonDecodeError(
7431 encoded.to_string(),
7432 error,
7433 ));
7434 }
7435 }
7436 };
7437
7438 dlg.finished(true);
7439 return Ok(response);
7440 }
7441 }
7442 }
7443 }
7444
7445 /// The name of the operation's parent resource.
7446 ///
7447 /// Sets the *name* path property to the given value.
7448 ///
7449 /// Even though the property as already been set when instantiating this call,
7450 /// we provide this method for API completeness.
7451 pub fn name(mut self, new_value: &str) -> InspectOperationListCall<'a, C> {
7452 self._name = new_value.to_string();
7453 self
7454 }
7455 /// The standard list page token.
7456 ///
7457 /// Sets the *page token* query property to the given value.
7458 pub fn page_token(mut self, new_value: &str) -> InspectOperationListCall<'a, C> {
7459 self._page_token = Some(new_value.to_string());
7460 self
7461 }
7462 /// The list page size. The maximum allowed value is 256 and the default is 100.
7463 ///
7464 /// Sets the *page size* query property to the given value.
7465 pub fn page_size(mut self, new_value: i32) -> InspectOperationListCall<'a, C> {
7466 self._page_size = Some(new_value);
7467 self
7468 }
7469 /// Filters by `done`. That is, `done=true` or `done=false`.
7470 ///
7471 /// Sets the *filter* query property to the given value.
7472 pub fn filter(mut self, new_value: &str) -> InspectOperationListCall<'a, C> {
7473 self._filter = Some(new_value.to_string());
7474 self
7475 }
7476 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7477 /// while executing the actual API request.
7478 ///
7479 /// ````text
7480 /// It should be used to handle progress information, and to implement a certain level of resilience.
7481 /// ````
7482 ///
7483 /// Sets the *delegate* property to the given value.
7484 pub fn delegate(
7485 mut self,
7486 new_value: &'a mut dyn common::Delegate,
7487 ) -> InspectOperationListCall<'a, C> {
7488 self._delegate = Some(new_value);
7489 self
7490 }
7491
7492 /// Set any additional parameter of the query string used in the request.
7493 /// It should be used to set parameters which are not yet available through their own
7494 /// setters.
7495 ///
7496 /// Please note that this method must not be used to set any of the known parameters
7497 /// which have their own setter method. If done anyway, the request will fail.
7498 ///
7499 /// # Additional Parameters
7500 ///
7501 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7502 /// * *bearer_token* (query-string) - OAuth bearer token.
7503 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7504 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7505 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7506 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7507 /// * *$.xgafv* (query-string) - V1 error format.
7508 /// * *callback* (query-string) - JSONP
7509 /// * *alt* (query-string) - Data format for response.
7510 /// * *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.
7511 /// * *access_token* (query-string) - OAuth access token.
7512 /// * *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.
7513 /// * *pp* (query-boolean) - Pretty-print response.
7514 pub fn param<T>(mut self, name: T, value: T) -> InspectOperationListCall<'a, C>
7515 where
7516 T: AsRef<str>,
7517 {
7518 self._additional_params
7519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7520 self
7521 }
7522
7523 /// Identifies the authorization scope for the method you are building.
7524 ///
7525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7526 /// [`Scope::CloudPlatform`].
7527 ///
7528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7529 /// tokens for more than one scope.
7530 ///
7531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7533 /// sufficient, a read-write scope will do as well.
7534 pub fn add_scope<St>(mut self, scope: St) -> InspectOperationListCall<'a, C>
7535 where
7536 St: AsRef<str>,
7537 {
7538 self._scopes.insert(String::from(scope.as_ref()));
7539 self
7540 }
7541 /// Identifies the authorization scope(s) for the method you are building.
7542 ///
7543 /// See [`Self::add_scope()`] for details.
7544 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectOperationListCall<'a, C>
7545 where
7546 I: IntoIterator<Item = St>,
7547 St: AsRef<str>,
7548 {
7549 self._scopes
7550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7551 self
7552 }
7553
7554 /// Removes all scopes, and no default scope will be used either.
7555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7556 /// for details).
7557 pub fn clear_scopes(mut self) -> InspectOperationListCall<'a, C> {
7558 self._scopes.clear();
7559 self
7560 }
7561}
7562
7563/// Gets the latest state of a long-running operation. Clients can use this
7564/// method to poll the operation result at intervals as recommended by the API
7565/// service.
7566///
7567/// A builder for the *operations.get* method supported by a *inspect* resource.
7568/// It is not used directly, but through a [`InspectMethods`] instance.
7569///
7570/// # Example
7571///
7572/// Instantiate a resource method builder
7573///
7574/// ```test_harness,no_run
7575/// # extern crate hyper;
7576/// # extern crate hyper_rustls;
7577/// # extern crate google_dlp2_beta1 as dlp2_beta1;
7578/// # async fn dox() {
7579/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7580///
7581/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7582/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7583/// # .with_native_roots()
7584/// # .unwrap()
7585/// # .https_only()
7586/// # .enable_http2()
7587/// # .build();
7588///
7589/// # let executor = hyper_util::rt::TokioExecutor::new();
7590/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7591/// # secret,
7592/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7593/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7594/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7595/// # ),
7596/// # ).build().await.unwrap();
7597///
7598/// # let client = hyper_util::client::legacy::Client::builder(
7599/// # hyper_util::rt::TokioExecutor::new()
7600/// # )
7601/// # .build(
7602/// # hyper_rustls::HttpsConnectorBuilder::new()
7603/// # .with_native_roots()
7604/// # .unwrap()
7605/// # .https_or_http()
7606/// # .enable_http2()
7607/// # .build()
7608/// # );
7609/// # let mut hub = DLP::new(client, auth);
7610/// // You can configure optional parameters by calling the respective setters at will, and
7611/// // execute the final call using `doit()`.
7612/// // Values shown here are possibly random and not representative !
7613/// let result = hub.inspect().operations_get("name")
7614/// .doit().await;
7615/// # }
7616/// ```
7617pub struct InspectOperationGetCall<'a, C>
7618where
7619 C: 'a,
7620{
7621 hub: &'a DLP<C>,
7622 _name: String,
7623 _delegate: Option<&'a mut dyn common::Delegate>,
7624 _additional_params: HashMap<String, String>,
7625 _scopes: BTreeSet<String>,
7626}
7627
7628impl<'a, C> common::CallBuilder for InspectOperationGetCall<'a, C> {}
7629
7630impl<'a, C> InspectOperationGetCall<'a, C>
7631where
7632 C: common::Connector,
7633{
7634 /// Perform the operation you have build so far.
7635 pub async fn doit(mut self) -> common::Result<(common::Response, GoogleLongrunningOperation)> {
7636 use std::borrow::Cow;
7637 use std::io::{Read, Seek};
7638
7639 use common::{url::Params, ToParts};
7640 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7641
7642 let mut dd = common::DefaultDelegate;
7643 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7644 dlg.begin(common::MethodInfo {
7645 id: "dlp.inspect.operations.get",
7646 http_method: hyper::Method::GET,
7647 });
7648
7649 for &field in ["alt", "name"].iter() {
7650 if self._additional_params.contains_key(field) {
7651 dlg.finished(false);
7652 return Err(common::Error::FieldClash(field));
7653 }
7654 }
7655
7656 let mut params = Params::with_capacity(3 + self._additional_params.len());
7657 params.push("name", self._name);
7658
7659 params.extend(self._additional_params.iter());
7660
7661 params.push("alt", "json");
7662 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}";
7663 if self._scopes.is_empty() {
7664 self._scopes
7665 .insert(Scope::CloudPlatform.as_ref().to_string());
7666 }
7667
7668 #[allow(clippy::single_element_loop)]
7669 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7670 url = params.uri_replacement(url, param_name, find_this, true);
7671 }
7672 {
7673 let to_remove = ["name"];
7674 params.remove_params(&to_remove);
7675 }
7676
7677 let url = params.parse_with_url(&url);
7678
7679 loop {
7680 let token = match self
7681 .hub
7682 .auth
7683 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7684 .await
7685 {
7686 Ok(token) => token,
7687 Err(e) => match dlg.token(e) {
7688 Ok(token) => token,
7689 Err(e) => {
7690 dlg.finished(false);
7691 return Err(common::Error::MissingToken(e));
7692 }
7693 },
7694 };
7695 let mut req_result = {
7696 let client = &self.hub.client;
7697 dlg.pre_request();
7698 let mut req_builder = hyper::Request::builder()
7699 .method(hyper::Method::GET)
7700 .uri(url.as_str())
7701 .header(USER_AGENT, self.hub._user_agent.clone());
7702
7703 if let Some(token) = token.as_ref() {
7704 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7705 }
7706
7707 let request = req_builder
7708 .header(CONTENT_LENGTH, 0_u64)
7709 .body(common::to_body::<String>(None));
7710
7711 client.request(request.unwrap()).await
7712 };
7713
7714 match req_result {
7715 Err(err) => {
7716 if let common::Retry::After(d) = dlg.http_error(&err) {
7717 sleep(d).await;
7718 continue;
7719 }
7720 dlg.finished(false);
7721 return Err(common::Error::HttpError(err));
7722 }
7723 Ok(res) => {
7724 let (mut parts, body) = res.into_parts();
7725 let mut body = common::Body::new(body);
7726 if !parts.status.is_success() {
7727 let bytes = common::to_bytes(body).await.unwrap_or_default();
7728 let error = serde_json::from_str(&common::to_string(&bytes));
7729 let response = common::to_response(parts, bytes.into());
7730
7731 if let common::Retry::After(d) =
7732 dlg.http_failure(&response, error.as_ref().ok())
7733 {
7734 sleep(d).await;
7735 continue;
7736 }
7737
7738 dlg.finished(false);
7739
7740 return Err(match error {
7741 Ok(value) => common::Error::BadRequest(value),
7742 _ => common::Error::Failure(response),
7743 });
7744 }
7745 let response = {
7746 let bytes = common::to_bytes(body).await.unwrap_or_default();
7747 let encoded = common::to_string(&bytes);
7748 match serde_json::from_str(&encoded) {
7749 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7750 Err(error) => {
7751 dlg.response_json_decode_error(&encoded, &error);
7752 return Err(common::Error::JsonDecodeError(
7753 encoded.to_string(),
7754 error,
7755 ));
7756 }
7757 }
7758 };
7759
7760 dlg.finished(true);
7761 return Ok(response);
7762 }
7763 }
7764 }
7765 }
7766
7767 /// The name of the operation resource.
7768 ///
7769 /// Sets the *name* path property to the given value.
7770 ///
7771 /// Even though the property as already been set when instantiating this call,
7772 /// we provide this method for API completeness.
7773 pub fn name(mut self, new_value: &str) -> InspectOperationGetCall<'a, C> {
7774 self._name = new_value.to_string();
7775 self
7776 }
7777 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7778 /// while executing the actual API request.
7779 ///
7780 /// ````text
7781 /// It should be used to handle progress information, and to implement a certain level of resilience.
7782 /// ````
7783 ///
7784 /// Sets the *delegate* property to the given value.
7785 pub fn delegate(
7786 mut self,
7787 new_value: &'a mut dyn common::Delegate,
7788 ) -> InspectOperationGetCall<'a, C> {
7789 self._delegate = Some(new_value);
7790 self
7791 }
7792
7793 /// Set any additional parameter of the query string used in the request.
7794 /// It should be used to set parameters which are not yet available through their own
7795 /// setters.
7796 ///
7797 /// Please note that this method must not be used to set any of the known parameters
7798 /// which have their own setter method. If done anyway, the request will fail.
7799 ///
7800 /// # Additional Parameters
7801 ///
7802 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7803 /// * *bearer_token* (query-string) - OAuth bearer token.
7804 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7805 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7806 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7807 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7808 /// * *$.xgafv* (query-string) - V1 error format.
7809 /// * *callback* (query-string) - JSONP
7810 /// * *alt* (query-string) - Data format for response.
7811 /// * *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.
7812 /// * *access_token* (query-string) - OAuth access token.
7813 /// * *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.
7814 /// * *pp* (query-boolean) - Pretty-print response.
7815 pub fn param<T>(mut self, name: T, value: T) -> InspectOperationGetCall<'a, C>
7816 where
7817 T: AsRef<str>,
7818 {
7819 self._additional_params
7820 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7821 self
7822 }
7823
7824 /// Identifies the authorization scope for the method you are building.
7825 ///
7826 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7827 /// [`Scope::CloudPlatform`].
7828 ///
7829 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7830 /// tokens for more than one scope.
7831 ///
7832 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7833 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7834 /// sufficient, a read-write scope will do as well.
7835 pub fn add_scope<St>(mut self, scope: St) -> InspectOperationGetCall<'a, C>
7836 where
7837 St: AsRef<str>,
7838 {
7839 self._scopes.insert(String::from(scope.as_ref()));
7840 self
7841 }
7842 /// Identifies the authorization scope(s) for the method you are building.
7843 ///
7844 /// See [`Self::add_scope()`] for details.
7845 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectOperationGetCall<'a, C>
7846 where
7847 I: IntoIterator<Item = St>,
7848 St: AsRef<str>,
7849 {
7850 self._scopes
7851 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7852 self
7853 }
7854
7855 /// Removes all scopes, and no default scope will be used either.
7856 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7857 /// for details).
7858 pub fn clear_scopes(mut self) -> InspectOperationGetCall<'a, C> {
7859 self._scopes.clear();
7860 self
7861 }
7862}
7863
7864/// Returns list of results for given inspect operation result set id.
7865///
7866/// A builder for the *results.findings.list* method supported by a *inspect* resource.
7867/// It is not used directly, but through a [`InspectMethods`] instance.
7868///
7869/// # Example
7870///
7871/// Instantiate a resource method builder
7872///
7873/// ```test_harness,no_run
7874/// # extern crate hyper;
7875/// # extern crate hyper_rustls;
7876/// # extern crate google_dlp2_beta1 as dlp2_beta1;
7877/// # async fn dox() {
7878/// # use dlp2_beta1::{DLP, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7879///
7880/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7881/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7882/// # .with_native_roots()
7883/// # .unwrap()
7884/// # .https_only()
7885/// # .enable_http2()
7886/// # .build();
7887///
7888/// # let executor = hyper_util::rt::TokioExecutor::new();
7889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7890/// # secret,
7891/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7892/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7893/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7894/// # ),
7895/// # ).build().await.unwrap();
7896///
7897/// # let client = hyper_util::client::legacy::Client::builder(
7898/// # hyper_util::rt::TokioExecutor::new()
7899/// # )
7900/// # .build(
7901/// # hyper_rustls::HttpsConnectorBuilder::new()
7902/// # .with_native_roots()
7903/// # .unwrap()
7904/// # .https_or_http()
7905/// # .enable_http2()
7906/// # .build()
7907/// # );
7908/// # let mut hub = DLP::new(client, auth);
7909/// // You can configure optional parameters by calling the respective setters at will, and
7910/// // execute the final call using `doit()`.
7911/// // Values shown here are possibly random and not representative !
7912/// let result = hub.inspect().results_findings_list("name")
7913/// .page_token("amet")
7914/// .page_size(-20)
7915/// .filter("ipsum")
7916/// .doit().await;
7917/// # }
7918/// ```
7919pub struct InspectResultFindingListCall<'a, C>
7920where
7921 C: 'a,
7922{
7923 hub: &'a DLP<C>,
7924 _name: String,
7925 _page_token: Option<String>,
7926 _page_size: Option<i32>,
7927 _filter: Option<String>,
7928 _delegate: Option<&'a mut dyn common::Delegate>,
7929 _additional_params: HashMap<String, String>,
7930 _scopes: BTreeSet<String>,
7931}
7932
7933impl<'a, C> common::CallBuilder for InspectResultFindingListCall<'a, C> {}
7934
7935impl<'a, C> InspectResultFindingListCall<'a, C>
7936where
7937 C: common::Connector,
7938{
7939 /// Perform the operation you have build so far.
7940 pub async fn doit(
7941 mut self,
7942 ) -> common::Result<(
7943 common::Response,
7944 GooglePrivacyDlpV2beta1ListInspectFindingsResponse,
7945 )> {
7946 use std::borrow::Cow;
7947 use std::io::{Read, Seek};
7948
7949 use common::{url::Params, ToParts};
7950 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7951
7952 let mut dd = common::DefaultDelegate;
7953 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7954 dlg.begin(common::MethodInfo {
7955 id: "dlp.inspect.results.findings.list",
7956 http_method: hyper::Method::GET,
7957 });
7958
7959 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
7960 if self._additional_params.contains_key(field) {
7961 dlg.finished(false);
7962 return Err(common::Error::FieldClash(field));
7963 }
7964 }
7965
7966 let mut params = Params::with_capacity(6 + self._additional_params.len());
7967 params.push("name", self._name);
7968 if let Some(value) = self._page_token.as_ref() {
7969 params.push("pageToken", value);
7970 }
7971 if let Some(value) = self._page_size.as_ref() {
7972 params.push("pageSize", value.to_string());
7973 }
7974 if let Some(value) = self._filter.as_ref() {
7975 params.push("filter", value);
7976 }
7977
7978 params.extend(self._additional_params.iter());
7979
7980 params.push("alt", "json");
7981 let mut url = self.hub._base_url.clone() + "v2beta1/{+name}/findings";
7982 if self._scopes.is_empty() {
7983 self._scopes
7984 .insert(Scope::CloudPlatform.as_ref().to_string());
7985 }
7986
7987 #[allow(clippy::single_element_loop)]
7988 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7989 url = params.uri_replacement(url, param_name, find_this, true);
7990 }
7991 {
7992 let to_remove = ["name"];
7993 params.remove_params(&to_remove);
7994 }
7995
7996 let url = params.parse_with_url(&url);
7997
7998 loop {
7999 let token = match self
8000 .hub
8001 .auth
8002 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8003 .await
8004 {
8005 Ok(token) => token,
8006 Err(e) => match dlg.token(e) {
8007 Ok(token) => token,
8008 Err(e) => {
8009 dlg.finished(false);
8010 return Err(common::Error::MissingToken(e));
8011 }
8012 },
8013 };
8014 let mut req_result = {
8015 let client = &self.hub.client;
8016 dlg.pre_request();
8017 let mut req_builder = hyper::Request::builder()
8018 .method(hyper::Method::GET)
8019 .uri(url.as_str())
8020 .header(USER_AGENT, self.hub._user_agent.clone());
8021
8022 if let Some(token) = token.as_ref() {
8023 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8024 }
8025
8026 let request = req_builder
8027 .header(CONTENT_LENGTH, 0_u64)
8028 .body(common::to_body::<String>(None));
8029
8030 client.request(request.unwrap()).await
8031 };
8032
8033 match req_result {
8034 Err(err) => {
8035 if let common::Retry::After(d) = dlg.http_error(&err) {
8036 sleep(d).await;
8037 continue;
8038 }
8039 dlg.finished(false);
8040 return Err(common::Error::HttpError(err));
8041 }
8042 Ok(res) => {
8043 let (mut parts, body) = res.into_parts();
8044 let mut body = common::Body::new(body);
8045 if !parts.status.is_success() {
8046 let bytes = common::to_bytes(body).await.unwrap_or_default();
8047 let error = serde_json::from_str(&common::to_string(&bytes));
8048 let response = common::to_response(parts, bytes.into());
8049
8050 if let common::Retry::After(d) =
8051 dlg.http_failure(&response, error.as_ref().ok())
8052 {
8053 sleep(d).await;
8054 continue;
8055 }
8056
8057 dlg.finished(false);
8058
8059 return Err(match error {
8060 Ok(value) => common::Error::BadRequest(value),
8061 _ => common::Error::Failure(response),
8062 });
8063 }
8064 let response = {
8065 let bytes = common::to_bytes(body).await.unwrap_or_default();
8066 let encoded = common::to_string(&bytes);
8067 match serde_json::from_str(&encoded) {
8068 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8069 Err(error) => {
8070 dlg.response_json_decode_error(&encoded, &error);
8071 return Err(common::Error::JsonDecodeError(
8072 encoded.to_string(),
8073 error,
8074 ));
8075 }
8076 }
8077 };
8078
8079 dlg.finished(true);
8080 return Ok(response);
8081 }
8082 }
8083 }
8084 }
8085
8086 /// Identifier of the results set returned as metadata of
8087 /// the longrunning operation created by a call to InspectDataSource.
8088 /// Should be in the format of `inspect/results/{id}`.
8089 ///
8090 /// Sets the *name* path property to the given value.
8091 ///
8092 /// Even though the property as already been set when instantiating this call,
8093 /// we provide this method for API completeness.
8094 pub fn name(mut self, new_value: &str) -> InspectResultFindingListCall<'a, C> {
8095 self._name = new_value.to_string();
8096 self
8097 }
8098 /// The value returned by the last `ListInspectFindingsResponse`; indicates
8099 /// that this is a continuation of a prior `ListInspectFindings` call, and that
8100 /// the system should return the next page of data.
8101 ///
8102 /// Sets the *page token* query property to the given value.
8103 pub fn page_token(mut self, new_value: &str) -> InspectResultFindingListCall<'a, C> {
8104 self._page_token = Some(new_value.to_string());
8105 self
8106 }
8107 /// Maximum number of results to return.
8108 /// If 0, the implementation selects a reasonable value.
8109 ///
8110 /// Sets the *page size* query property to the given value.
8111 pub fn page_size(mut self, new_value: i32) -> InspectResultFindingListCall<'a, C> {
8112 self._page_size = Some(new_value);
8113 self
8114 }
8115 /// Restricts findings to items that match. Supports info_type and likelihood.
8116 ///
8117 /// Examples:
8118 ///
8119 /// - info_type=EMAIL_ADDRESS
8120 /// - info_type=PHONE_NUMBER,EMAIL_ADDRESS
8121 /// - likelihood=VERY_LIKELY
8122 /// - likelihood=VERY_LIKELY,LIKELY
8123 /// - info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY
8124 ///
8125 /// Sets the *filter* query property to the given value.
8126 pub fn filter(mut self, new_value: &str) -> InspectResultFindingListCall<'a, C> {
8127 self._filter = Some(new_value.to_string());
8128 self
8129 }
8130 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8131 /// while executing the actual API request.
8132 ///
8133 /// ````text
8134 /// It should be used to handle progress information, and to implement a certain level of resilience.
8135 /// ````
8136 ///
8137 /// Sets the *delegate* property to the given value.
8138 pub fn delegate(
8139 mut self,
8140 new_value: &'a mut dyn common::Delegate,
8141 ) -> InspectResultFindingListCall<'a, C> {
8142 self._delegate = Some(new_value);
8143 self
8144 }
8145
8146 /// Set any additional parameter of the query string used in the request.
8147 /// It should be used to set parameters which are not yet available through their own
8148 /// setters.
8149 ///
8150 /// Please note that this method must not be used to set any of the known parameters
8151 /// which have their own setter method. If done anyway, the request will fail.
8152 ///
8153 /// # Additional Parameters
8154 ///
8155 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8156 /// * *bearer_token* (query-string) - OAuth bearer token.
8157 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8158 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8159 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8160 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8161 /// * *$.xgafv* (query-string) - V1 error format.
8162 /// * *callback* (query-string) - JSONP
8163 /// * *alt* (query-string) - Data format for response.
8164 /// * *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.
8165 /// * *access_token* (query-string) - OAuth access token.
8166 /// * *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.
8167 /// * *pp* (query-boolean) - Pretty-print response.
8168 pub fn param<T>(mut self, name: T, value: T) -> InspectResultFindingListCall<'a, C>
8169 where
8170 T: AsRef<str>,
8171 {
8172 self._additional_params
8173 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8174 self
8175 }
8176
8177 /// Identifies the authorization scope for the method you are building.
8178 ///
8179 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8180 /// [`Scope::CloudPlatform`].
8181 ///
8182 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8183 /// tokens for more than one scope.
8184 ///
8185 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8186 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8187 /// sufficient, a read-write scope will do as well.
8188 pub fn add_scope<St>(mut self, scope: St) -> InspectResultFindingListCall<'a, C>
8189 where
8190 St: AsRef<str>,
8191 {
8192 self._scopes.insert(String::from(scope.as_ref()));
8193 self
8194 }
8195 /// Identifies the authorization scope(s) for the method you are building.
8196 ///
8197 /// See [`Self::add_scope()`] for details.
8198 pub fn add_scopes<I, St>(mut self, scopes: I) -> InspectResultFindingListCall<'a, C>
8199 where
8200 I: IntoIterator<Item = St>,
8201 St: AsRef<str>,
8202 {
8203 self._scopes
8204 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8205 self
8206 }
8207
8208 /// Removes all scopes, and no default scope will be used either.
8209 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8210 /// for details).
8211 pub fn clear_scopes(mut self) -> InspectResultFindingListCall<'a, C> {
8212 self._scopes.clear();
8213 self
8214 }
8215}