google_ondemandscanning1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all OnDemandScanning 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_ondemandscanning1 as ondemandscanning1;
49/// use ondemandscanning1::{Result, Error};
50/// # async fn dox() {
51/// use ondemandscanning1::{OnDemandScanning, 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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62/// secret,
63/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64/// ).build().await.unwrap();
65///
66/// let client = hyper_util::client::legacy::Client::builder(
67/// hyper_util::rt::TokioExecutor::new()
68/// )
69/// .build(
70/// hyper_rustls::HttpsConnectorBuilder::new()
71/// .with_native_roots()
72/// .unwrap()
73/// .https_or_http()
74/// .enable_http1()
75/// .build()
76/// );
77/// let mut hub = OnDemandScanning::new(client, auth);
78/// // You can configure optional parameters by calling the respective setters at will, and
79/// // execute the final call using `doit()`.
80/// // Values shown here are possibly random and not representative !
81/// let result = hub.projects().locations_operations_wait("name")
82/// .timeout(chrono::Duration::seconds(9827880))
83/// .doit().await;
84///
85/// match result {
86/// Err(e) => match e {
87/// // The Error enum provides details about what exactly happened.
88/// // You can also just use its `Debug`, `Display` or `Error` traits
89/// Error::HttpError(_)
90/// |Error::Io(_)
91/// |Error::MissingAPIKey
92/// |Error::MissingToken(_)
93/// |Error::Cancelled
94/// |Error::UploadSizeLimitExceeded(_, _)
95/// |Error::Failure(_)
96/// |Error::BadRequest(_)
97/// |Error::FieldClash(_)
98/// |Error::JsonDecodeError(_, _) => println!("{}", e),
99/// },
100/// Ok(res) => println!("Success: {:?}", res),
101/// }
102/// # }
103/// ```
104#[derive(Clone)]
105pub struct OnDemandScanning<C> {
106 pub client: common::Client<C>,
107 pub auth: Box<dyn common::GetToken>,
108 _user_agent: String,
109 _base_url: String,
110 _root_url: String,
111}
112
113impl<C> common::Hub for OnDemandScanning<C> {}
114
115impl<'a, C> OnDemandScanning<C> {
116 pub fn new<A: 'static + common::GetToken>(
117 client: common::Client<C>,
118 auth: A,
119 ) -> OnDemandScanning<C> {
120 OnDemandScanning {
121 client,
122 auth: Box::new(auth),
123 _user_agent: "google-api-rust-client/6.0.0".to_string(),
124 _base_url: "https://ondemandscanning.googleapis.com/".to_string(),
125 _root_url: "https://ondemandscanning.googleapis.com/".to_string(),
126 }
127 }
128
129 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
130 ProjectMethods { hub: self }
131 }
132
133 /// Set the user-agent header field to use in all requests to the server.
134 /// It defaults to `google-api-rust-client/6.0.0`.
135 ///
136 /// Returns the previously set user-agent.
137 pub fn user_agent(&mut self, agent_name: String) -> String {
138 std::mem::replace(&mut self._user_agent, agent_name)
139 }
140
141 /// Set the base url to use in all requests to the server.
142 /// It defaults to `https://ondemandscanning.googleapis.com/`.
143 ///
144 /// Returns the previously set base url.
145 pub fn base_url(&mut self, new_base_url: String) -> String {
146 std::mem::replace(&mut self._base_url, new_base_url)
147 }
148
149 /// Set the root url to use in all requests to the server.
150 /// It defaults to `https://ondemandscanning.googleapis.com/`.
151 ///
152 /// Returns the previously set root url.
153 pub fn root_url(&mut self, new_root_url: String) -> String {
154 std::mem::replace(&mut self._root_url, new_root_url)
155 }
156}
157
158// ############
159// SCHEMAS ###
160// ##########
161/// An alias to a repo revision.
162///
163/// This type is not used in any activity, and only used as *part* of another schema.
164///
165#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
166#[serde_with::serde_as]
167#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
168pub struct AliasContext {
169 /// The alias kind.
170 pub kind: Option<String>,
171 /// The alias name.
172 pub name: Option<String>,
173}
174
175impl common::Part for AliasContext {}
176
177/// Indicates which analysis completed successfully. Multiple types of analysis can be performed on a single resource.
178///
179/// This type is not used in any activity, and only used as *part* of another schema.
180///
181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
182#[serde_with::serde_as]
183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
184pub struct AnalysisCompleted {
185 /// no description provided
186 #[serde(rename = "analysisType")]
187 pub analysis_type: Option<Vec<String>>,
188}
189
190impl common::Part for AnalysisCompleted {}
191
192/// AnalyzePackagesRequest is the request to analyze a list of packages and create Vulnerability Occurrences for it.
193///
194/// # Activities
195///
196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
198///
199/// * [locations scans analyze packages projects](ProjectLocationScanAnalyzePackageCall) (request)
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct AnalyzePackagesRequestV1 {
204 /// [DEPRECATED] Whether to include OSV data in the scan. For backwards compatibility reasons, this field can be neither removed nor renamed.
205 #[serde(rename = "includeOsvData")]
206 pub include_osv_data: Option<bool>,
207 /// The packages to analyze.
208 pub packages: Option<Vec<PackageData>>,
209 /// Required. The resource URI of the container image being scanned.
210 #[serde(rename = "resourceUri")]
211 pub resource_uri: Option<String>,
212}
213
214impl common::RequestValue for AnalyzePackagesRequestV1 {}
215
216/// Artifact describes a build product.
217///
218/// This type is not used in any activity, and only used as *part* of another schema.
219///
220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
221#[serde_with::serde_as]
222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
223pub struct Artifact {
224 /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a container.
225 pub checksum: Option<String>,
226 /// Artifact ID, if any; for container images, this will be a URL by digest like `gcr.io/projectID/imagename@sha256:123456`.
227 pub id: Option<String>,
228 /// Related artifact names. This may be the path to a binary or jar file, or in the case of a container build, the name used to push the container image to Google Container Registry, as presented to `docker push`. Note that a single Artifact ID can have multiple names, for example if two tags are applied to one image.
229 pub names: Option<Vec<String>>,
230}
231
232impl common::Part for Artifact {}
233
234/// Occurrence that represents a single "attestation". The authenticity of an attestation can be verified using the attached signature. If the verifier trusts the public key of the signer, then verifying the signature is sufficient to establish trust. In this circumstance, the authority to which this attestation is attached is primarily useful for lookup (how to find this attestation if you already know the authority and artifact to be verified) and intent (for which authority this attestation was intended to sign.
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct AttestationOccurrence {
242 /// One or more JWTs encoding a self-contained attestation. Each JWT encodes the payload that it verifies within the JWT itself. Verifier implementation SHOULD ignore the `serialized_payload` field when verifying these JWTs. If only JWTs are present on this AttestationOccurrence, then the `serialized_payload` SHOULD be left empty. Each JWT SHOULD encode a claim specific to the `resource_uri` of this Occurrence, but this is not validated by Grafeas metadata API implementations. The JWT itself is opaque to Grafeas.
243 pub jwts: Option<Vec<Jwt>>,
244 /// Required. The serialized payload that is verified by one or more `signatures`.
245 #[serde(rename = "serializedPayload")]
246 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
247 pub serialized_payload: Option<Vec<u8>>,
248 /// One or more signatures over `serialized_payload`. Verifier implementations should consider this attestation message verified if at least one `signature` verifies `serialized_payload`. See `Signature` in common.proto for more details on signature structure and verification.
249 pub signatures: Option<Vec<Signature>>,
250}
251
252impl common::Part for AttestationOccurrence {}
253
254/// There is no detailed description.
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct BinarySourceInfo {
262 /// The binary package. This is significant when the source is different than the binary itself. Historically if they've differed, we've stored the name of the source and its version in the package/version fields, but we should also store the binary package info, as that's what's actually installed. See b/175908657#comment15.
263 #[serde(rename = "binaryVersion")]
264 pub binary_version: Option<PackageVersion>,
265 /// The source package. Similar to the above, this is significant when the source is different than the binary itself. Since the top-level package/version fields are based on an if/else, we need a separate field for both binary and source if we want to know definitively where the data is coming from.
266 #[serde(rename = "sourceVersion")]
267 pub source_version: Option<PackageVersion>,
268}
269
270impl common::Part for BinarySourceInfo {}
271
272/// There is no detailed description.
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 BuildDefinition {
280 /// no description provided
281 #[serde(rename = "buildType")]
282 pub build_type: Option<String>,
283 /// no description provided
284 #[serde(rename = "externalParameters")]
285 pub external_parameters: Option<HashMap<String, serde_json::Value>>,
286 /// no description provided
287 #[serde(rename = "internalParameters")]
288 pub internal_parameters: Option<HashMap<String, serde_json::Value>>,
289 /// no description provided
290 #[serde(rename = "resolvedDependencies")]
291 pub resolved_dependencies: Option<Vec<ResourceDescriptor>>,
292}
293
294impl common::Part for BuildDefinition {}
295
296/// There is no detailed description.
297///
298/// This type is not used in any activity, and only used as *part* of another schema.
299///
300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
301#[serde_with::serde_as]
302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
303pub struct BuildMetadata {
304 /// no description provided
305 #[serde(rename = "finishedOn")]
306 pub finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
307 /// no description provided
308 #[serde(rename = "invocationId")]
309 pub invocation_id: Option<String>,
310 /// no description provided
311 #[serde(rename = "startedOn")]
312 pub started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
313}
314
315impl common::Part for BuildMetadata {}
316
317/// Details of a build occurrence.
318///
319/// This type is not used in any activity, and only used as *part* of another schema.
320///
321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
322#[serde_with::serde_as]
323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
324pub struct BuildOccurrence {
325 /// In-Toto Slsa Provenance V1 represents a slsa provenance meeting the slsa spec, wrapped in an in-toto statement. This allows for direct jsonification of a to-spec in-toto slsa statement with a to-spec slsa provenance.
326 #[serde(rename = "inTotoSlsaProvenanceV1")]
327 pub in_toto_slsa_provenance_v1: Option<InTotoSlsaProvenanceV1>,
328 /// Deprecated. See InTotoStatement for the replacement. In-toto Provenance representation as defined in spec.
329 #[serde(rename = "intotoProvenance")]
330 pub intoto_provenance: Option<InTotoProvenance>,
331 /// In-toto Statement representation as defined in spec. The intoto_statement can contain any type of provenance. The serialized payload of the statement can be stored and signed in the Occurrence's envelope.
332 #[serde(rename = "intotoStatement")]
333 pub intoto_statement: Option<InTotoStatement>,
334 /// The actual provenance for the build.
335 pub provenance: Option<BuildProvenance>,
336 /// Serialized JSON representation of the provenance, used in generating the build signature in the corresponding build note. After verifying the signature, `provenance_bytes` can be unmarshalled and compared to the provenance to confirm that it is unchanged. A base64-encoded string representation of the provenance bytes is used for the signature in order to interoperate with openssl which expects this format for signature verification. The serialized form is captured both to avoid ambiguity in how the provenance is marshalled to json as well to prevent incompatibilities with future changes.
337 #[serde(rename = "provenanceBytes")]
338 pub provenance_bytes: Option<String>,
339}
340
341impl common::Part for BuildOccurrence {}
342
343/// Provenance of a build. Contains all information needed to verify the full details about the build from source to completion.
344///
345/// This type is not used in any activity, and only used as *part* of another schema.
346///
347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
348#[serde_with::serde_as]
349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
350pub struct BuildProvenance {
351 /// Special options applied to this build. This is a catch-all field where build providers can enter any desired additional details.
352 #[serde(rename = "buildOptions")]
353 pub build_options: Option<HashMap<String, String>>,
354 /// Version string of the builder at the time this build was executed.
355 #[serde(rename = "builderVersion")]
356 pub builder_version: Option<String>,
357 /// Output of the build.
358 #[serde(rename = "builtArtifacts")]
359 pub built_artifacts: Option<Vec<Artifact>>,
360 /// Commands requested by the build.
361 pub commands: Option<Vec<Command>>,
362 /// Time at which the build was created.
363 #[serde(rename = "createTime")]
364 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
365 /// E-mail address of the user who initiated this build. Note that this was the user's e-mail address at the time the build was initiated; this address may not represent the same end-user for all time.
366 pub creator: Option<String>,
367 /// Time at which execution of the build was finished.
368 #[serde(rename = "endTime")]
369 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
370 /// Required. Unique identifier of the build.
371 pub id: Option<String>,
372 /// URI where any logs for this provenance were written.
373 #[serde(rename = "logsUri")]
374 pub logs_uri: Option<String>,
375 /// ID of the project.
376 #[serde(rename = "projectId")]
377 pub project_id: Option<String>,
378 /// Details of the Source input to the build.
379 #[serde(rename = "sourceProvenance")]
380 pub source_provenance: Option<Source>,
381 /// Time at which execution of the build was started.
382 #[serde(rename = "startTime")]
383 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
384 /// Trigger identifier if the build was triggered automatically; empty if not.
385 #[serde(rename = "triggerId")]
386 pub trigger_id: Option<String>,
387}
388
389impl common::Part for BuildProvenance {}
390
391/// There is no detailed description.
392///
393/// This type is not used in any activity, and only used as *part* of another schema.
394///
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct BuilderConfig {
399 /// no description provided
400 pub id: Option<String>,
401}
402
403impl common::Part for BuilderConfig {}
404
405/// Common Vulnerability Scoring System. For details, see https://www.first.org/cvss/specification-document This is a message we will try to use for storing various versions of CVSS rather than making a separate proto for storing a specific version.
406///
407/// This type is not used in any activity, and only used as *part* of another schema.
408///
409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
410#[serde_with::serde_as]
411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
412pub struct CVSS {
413 /// no description provided
414 #[serde(rename = "attackComplexity")]
415 pub attack_complexity: Option<String>,
416 /// Base Metrics Represents the intrinsic characteristics of a vulnerability that are constant over time and across user environments.
417 #[serde(rename = "attackVector")]
418 pub attack_vector: Option<String>,
419 /// no description provided
420 pub authentication: Option<String>,
421 /// no description provided
422 #[serde(rename = "availabilityImpact")]
423 pub availability_impact: Option<String>,
424 /// The base score is a function of the base metric scores.
425 #[serde(rename = "baseScore")]
426 pub base_score: Option<f32>,
427 /// no description provided
428 #[serde(rename = "confidentialityImpact")]
429 pub confidentiality_impact: Option<String>,
430 /// no description provided
431 #[serde(rename = "exploitabilityScore")]
432 pub exploitability_score: Option<f32>,
433 /// no description provided
434 #[serde(rename = "impactScore")]
435 pub impact_score: Option<f32>,
436 /// no description provided
437 #[serde(rename = "integrityImpact")]
438 pub integrity_impact: Option<String>,
439 /// no description provided
440 #[serde(rename = "privilegesRequired")]
441 pub privileges_required: Option<String>,
442 /// no description provided
443 pub scope: Option<String>,
444 /// no description provided
445 #[serde(rename = "userInteraction")]
446 pub user_interaction: Option<String>,
447}
448
449impl common::Part for CVSS {}
450
451/// The category to which the update belongs.
452///
453/// This type is not used in any activity, and only used as *part* of another schema.
454///
455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
456#[serde_with::serde_as]
457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
458pub struct Category {
459 /// The identifier of the category.
460 #[serde(rename = "categoryId")]
461 pub category_id: Option<String>,
462 /// The localized name of the category.
463 pub name: Option<String>,
464}
465
466impl common::Part for Category {}
467
468/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud Source Repo.
469///
470/// This type is not used in any activity, and only used as *part* of another schema.
471///
472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
473#[serde_with::serde_as]
474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
475pub struct CloudRepoSourceContext {
476 /// An alias, which may be a branch or tag.
477 #[serde(rename = "aliasContext")]
478 pub alias_context: Option<AliasContext>,
479 /// The ID of the repo.
480 #[serde(rename = "repoId")]
481 pub repo_id: Option<RepoId>,
482 /// A revision ID.
483 #[serde(rename = "revisionId")]
484 pub revision_id: Option<String>,
485}
486
487impl common::Part for CloudRepoSourceContext {}
488
489/// Command describes a step performed as part of the build pipeline.
490///
491/// This type is not used in any activity, and only used as *part* of another schema.
492///
493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
494#[serde_with::serde_as]
495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
496pub struct Command {
497 /// Command-line arguments used when executing this command.
498 pub args: Option<Vec<String>>,
499 /// Working directory (relative to project source root) used when running this command.
500 pub dir: Option<String>,
501 /// Environment variables set before running this command.
502 pub env: Option<Vec<String>>,
503 /// Optional unique identifier for this command, used in wait_for to reference this command as a dependency.
504 pub id: Option<String>,
505 /// Required. Name of the command, as presented on the command line, or if the command is packaged as a Docker container, as presented to `docker pull`.
506 pub name: Option<String>,
507 /// The ID(s) of the command(s) that this command depends on.
508 #[serde(rename = "waitFor")]
509 pub wait_for: Option<Vec<String>>,
510}
511
512impl common::Part for Command {}
513
514/// Indicates that the builder claims certain fields in this message to be complete.
515///
516/// This type is not used in any activity, and only used as *part* of another schema.
517///
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct Completeness {
522 /// If true, the builder claims that recipe.arguments is complete, meaning that all external inputs are properly captured in the recipe.
523 pub arguments: Option<bool>,
524 /// If true, the builder claims that recipe.environment is claimed to be complete.
525 pub environment: Option<bool>,
526 /// If true, the builder claims that materials are complete, usually through some controls to prevent network access. Sometimes called "hermetic".
527 pub materials: Option<bool>,
528}
529
530impl common::Part for Completeness {}
531
532/// An indication that the compliance checks in the associated ComplianceNote were not satisfied for particular resources or a specified reason.
533///
534/// This type is not used in any activity, and only used as *part* of another schema.
535///
536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
537#[serde_with::serde_as]
538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
539pub struct ComplianceOccurrence {
540 /// no description provided
541 #[serde(rename = "nonComplianceReason")]
542 pub non_compliance_reason: Option<String>,
543 /// no description provided
544 #[serde(rename = "nonCompliantFiles")]
545 pub non_compliant_files: Option<Vec<NonCompliantFile>>,
546 /// The OS and config version the benchmark was run on.
547 pub version: Option<ComplianceVersion>,
548}
549
550impl common::Part for ComplianceOccurrence {}
551
552/// Describes the CIS benchmark version that is applicable to a given OS and os version.
553///
554/// This type is not used in any activity, and only used as *part* of another schema.
555///
556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
557#[serde_with::serde_as]
558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
559pub struct ComplianceVersion {
560 /// The name of the document that defines this benchmark, e.g. "CIS Container-Optimized OS".
561 #[serde(rename = "benchmarkDocument")]
562 pub benchmark_document: Option<String>,
563 /// The CPE URI (https://cpe.mitre.org/specification/) this benchmark is applicable to.
564 #[serde(rename = "cpeUri")]
565 pub cpe_uri: Option<String>,
566 /// The version of the benchmark. This is set to the version of the OS-specific CIS document the benchmark is defined in.
567 pub version: Option<String>,
568}
569
570impl common::Part for ComplianceVersion {}
571
572/// Deprecated. Prefer to use a regular Occurrence, and populate the Envelope at the top level of the Occurrence.
573///
574/// This type is not used in any activity, and only used as *part* of another schema.
575///
576#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
577#[serde_with::serde_as]
578#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
579pub struct DSSEAttestationOccurrence {
580 /// If doing something security critical, make sure to verify the signatures in this metadata.
581 pub envelope: Option<Envelope>,
582 /// no description provided
583 pub statement: Option<InTotoStatement>,
584}
585
586impl common::Part for DSSEAttestationOccurrence {}
587
588/// The period during which some deployable was active in a runtime.
589///
590/// This type is not used in any activity, and only used as *part* of another schema.
591///
592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
593#[serde_with::serde_as]
594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
595pub struct DeploymentOccurrence {
596 /// Address of the runtime element hosting this deployment.
597 pub address: Option<String>,
598 /// Configuration used to create this deployment.
599 pub config: Option<String>,
600 /// Required. Beginning of the lifetime of this deployment.
601 #[serde(rename = "deployTime")]
602 pub deploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
603 /// Platform hosting this deployment.
604 pub platform: Option<String>,
605 /// Output only. Resource URI for the artifact being deployed taken from the deployable field with the same name.
606 #[serde(rename = "resourceUri")]
607 pub resource_uri: Option<Vec<String>>,
608 /// End of the lifetime of this deployment.
609 #[serde(rename = "undeployTime")]
610 pub undeploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
611 /// Identity of the user that triggered this deployment.
612 #[serde(rename = "userEmail")]
613 pub user_email: Option<String>,
614}
615
616impl common::Part for DeploymentOccurrence {}
617
618/// Provides information about the analysis status of a discovered resource.
619///
620/// This type is not used in any activity, and only used as *part* of another schema.
621///
622#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
623#[serde_with::serde_as]
624#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
625pub struct DiscoveryOccurrence {
626 /// no description provided
627 #[serde(rename = "analysisCompleted")]
628 pub analysis_completed: Option<AnalysisCompleted>,
629 /// Indicates any errors encountered during analysis of a resource. There could be 0 or more of these errors.
630 #[serde(rename = "analysisError")]
631 pub analysis_error: Option<Vec<Status>>,
632 /// The status of discovery for the resource.
633 #[serde(rename = "analysisStatus")]
634 pub analysis_status: Option<String>,
635 /// When an error is encountered this will contain a LocalizedMessage under details to show to the user. The LocalizedMessage is output only and populated by the API.
636 #[serde(rename = "analysisStatusError")]
637 pub analysis_status_error: Option<Status>,
638 /// Output only. The time occurrences related to this discovery occurrence were archived.
639 #[serde(rename = "archiveTime")]
640 pub archive_time: Option<chrono::DateTime<chrono::offset::Utc>>,
641 /// Whether the resource is continuously analyzed.
642 #[serde(rename = "continuousAnalysis")]
643 pub continuous_analysis: Option<String>,
644 /// The CPE of the resource being scanned.
645 pub cpe: Option<String>,
646 /// The last time this resource was scanned.
647 #[serde(rename = "lastScanTime")]
648 pub last_scan_time: Option<chrono::DateTime<chrono::offset::Utc>>,
649 /// The status of an SBOM generation.
650 #[serde(rename = "sbomStatus")]
651 pub sbom_status: Option<SBOMStatus>,
652 /// The status of an vulnerability attestation generation.
653 #[serde(rename = "vulnerabilityAttestation")]
654 pub vulnerability_attestation: Option<VulnerabilityAttestation>,
655}
656
657impl common::Part for DiscoveryOccurrence {}
658
659/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
660///
661/// # Activities
662///
663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
665///
666/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
667/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
669#[serde_with::serde_as]
670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
671pub struct Empty {
672 _never_set: Option<bool>,
673}
674
675impl common::ResponseResult for Empty {}
676
677/// MUST match https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An authenticated message of arbitrary type.
678///
679/// This type is not used in any activity, and only used as *part* of another schema.
680///
681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
682#[serde_with::serde_as]
683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
684pub struct Envelope {
685 /// no description provided
686 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
687 pub payload: Option<Vec<u8>>,
688 /// no description provided
689 #[serde(rename = "payloadType")]
690 pub payload_type: Option<String>,
691 /// no description provided
692 pub signatures: Option<Vec<EnvelopeSignature>>,
693}
694
695impl common::Part for Envelope {}
696
697/// There is no detailed description.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct EnvelopeSignature {
705 /// no description provided
706 pub keyid: Option<String>,
707 /// no description provided
708 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
709 pub sig: Option<Vec<u8>>,
710}
711
712impl common::Part for EnvelopeSignature {}
713
714/// Container message for hashes of byte content of files, used in source messages to verify integrity of source input to the build.
715///
716/// This type is not used in any activity, and only used as *part* of another schema.
717///
718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
719#[serde_with::serde_as]
720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
721pub struct FileHashes {
722 /// Required. Collection of file hashes.
723 #[serde(rename = "fileHash")]
724 pub file_hash: Option<Vec<Hash>>,
725}
726
727impl common::Part for FileHashes {}
728
729/// Indicates the location at which a package was found.
730///
731/// This type is not used in any activity, and only used as *part* of another schema.
732///
733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
734#[serde_with::serde_as]
735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
736pub struct FileLocation {
737 /// For jars that are contained inside .war files, this filepath can indicate the path to war file combined with the path to jar file.
738 #[serde(rename = "filePath")]
739 pub file_path: Option<String>,
740}
741
742impl common::Part for FileLocation {}
743
744/// A set of properties that uniquely identify a given Docker image.
745///
746/// This type is not used in any activity, and only used as *part* of another schema.
747///
748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
749#[serde_with::serde_as]
750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
751pub struct Fingerprint {
752 /// Required. The layer ID of the final layer in the Docker image's v1 representation.
753 #[serde(rename = "v1Name")]
754 pub v1_name: Option<String>,
755 /// Required. The ordered list of v2 blobs that represent a given image.
756 #[serde(rename = "v2Blob")]
757 pub v2_blob: Option<Vec<String>>,
758 /// Output only. The name of the image's v2 blobs computed via: [bottom] := v2_blobbottom := sha256(v2_blob[N] + " " + v2_name[N+1]) Only the name of the final blob is kept.
759 #[serde(rename = "v2Name")]
760 pub v2_name: Option<String>,
761}
762
763impl common::Part for Fingerprint {}
764
765/// A SourceContext referring to a Gerrit project.
766///
767/// This type is not used in any activity, and only used as *part* of another schema.
768///
769#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
770#[serde_with::serde_as]
771#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
772pub struct GerritSourceContext {
773 /// An alias, which may be a branch or tag.
774 #[serde(rename = "aliasContext")]
775 pub alias_context: Option<AliasContext>,
776 /// The full project name within the host. Projects may be nested, so "project/subproject" is a valid project name. The "repo name" is the hostURI/project.
777 #[serde(rename = "gerritProject")]
778 pub gerrit_project: Option<String>,
779 /// The URI of a running Gerrit instance.
780 #[serde(rename = "hostUri")]
781 pub host_uri: Option<String>,
782 /// A revision (commit) ID.
783 #[serde(rename = "revisionId")]
784 pub revision_id: Option<String>,
785}
786
787impl common::Part for GerritSourceContext {}
788
789/// A GitSourceContext denotes a particular revision in a third party Git repository (e.g., GitHub).
790///
791/// This type is not used in any activity, and only used as *part* of another schema.
792///
793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
794#[serde_with::serde_as]
795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
796pub struct GitSourceContext {
797 /// Git commit hash.
798 #[serde(rename = "revisionId")]
799 pub revision_id: Option<String>,
800 /// Git repository URL.
801 pub url: Option<String>,
802}
803
804impl common::Part for GitSourceContext {}
805
806/// Indicates the location at which a package was found.
807///
808/// This type is not used in any activity, and only used as *part* of another schema.
809///
810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
811#[serde_with::serde_as]
812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
813pub struct GrafeasV1FileLocation {
814 /// For jars that are contained inside .war files, this filepath can indicate the path to war file combined with the path to jar file.
815 #[serde(rename = "filePath")]
816 pub file_path: Option<String>,
817}
818
819impl common::Part for GrafeasV1FileLocation {}
820
821/// Identifies the entity that executed the recipe, which is trusted to have correctly performed the operation and populated this provenance.
822///
823/// This type is not used in any activity, and only used as *part* of another schema.
824///
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaBuilder {
829 /// no description provided
830 pub id: Option<String>,
831}
832
833impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaBuilder {}
834
835/// Indicates that the builder claims certain fields in this message to be complete.
836///
837/// This type is not used in any activity, and only used as *part* of another schema.
838///
839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
840#[serde_with::serde_as]
841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
842pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaCompleteness {
843 /// no description provided
844 pub environment: Option<bool>,
845 /// no description provided
846 pub materials: Option<bool>,
847 /// no description provided
848 pub parameters: Option<bool>,
849}
850
851impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaCompleteness {}
852
853/// Describes where the config file that kicked off the build came from. This is effectively a pointer to the source where buildConfig came from.
854///
855/// This type is not used in any activity, and only used as *part* of another schema.
856///
857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
858#[serde_with::serde_as]
859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
860pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaConfigSource {
861 /// no description provided
862 pub digest: Option<HashMap<String, String>>,
863 /// no description provided
864 #[serde(rename = "entryPoint")]
865 pub entry_point: Option<String>,
866 /// no description provided
867 pub uri: Option<String>,
868}
869
870impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaConfigSource {}
871
872/// Identifies the event that kicked off the build.
873///
874/// This type is not used in any activity, and only used as *part* of another schema.
875///
876#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
877#[serde_with::serde_as]
878#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
879pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaInvocation {
880 /// no description provided
881 #[serde(rename = "configSource")]
882 pub config_source: Option<GrafeasV1SlsaProvenanceZeroTwoSlsaConfigSource>,
883 /// no description provided
884 pub environment: Option<HashMap<String, serde_json::Value>>,
885 /// no description provided
886 pub parameters: Option<HashMap<String, serde_json::Value>>,
887}
888
889impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaInvocation {}
890
891/// The collection of artifacts that influenced the build including sources, dependencies, build tools, base images, and so on.
892///
893/// This type is not used in any activity, and only used as *part* of another schema.
894///
895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
896#[serde_with::serde_as]
897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
898pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaMaterial {
899 /// no description provided
900 pub digest: Option<HashMap<String, String>>,
901 /// no description provided
902 pub uri: Option<String>,
903}
904
905impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaMaterial {}
906
907/// Other properties of the build.
908///
909/// This type is not used in any activity, and only used as *part* of another schema.
910///
911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
912#[serde_with::serde_as]
913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
914pub struct GrafeasV1SlsaProvenanceZeroTwoSlsaMetadata {
915 /// no description provided
916 #[serde(rename = "buildFinishedOn")]
917 pub build_finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
918 /// no description provided
919 #[serde(rename = "buildInvocationId")]
920 pub build_invocation_id: Option<String>,
921 /// no description provided
922 #[serde(rename = "buildStartedOn")]
923 pub build_started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
924 /// no description provided
925 pub completeness: Option<GrafeasV1SlsaProvenanceZeroTwoSlsaCompleteness>,
926 /// no description provided
927 pub reproducible: Option<bool>,
928}
929
930impl common::Part for GrafeasV1SlsaProvenanceZeroTwoSlsaMetadata {}
931
932/// Container message for hash values.
933///
934/// This type is not used in any activity, and only used as *part* of another schema.
935///
936#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
937#[serde_with::serde_as]
938#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
939pub struct Hash {
940 /// Required. The type of hash that was performed, e.g. "SHA-256".
941 #[serde(rename = "type")]
942 pub type_: Option<String>,
943 /// Required. The hash value.
944 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
945 pub value: Option<Vec<u8>>,
946}
947
948impl common::Part for Hash {}
949
950/// The unique identifier of the update.
951///
952/// This type is not used in any activity, and only used as *part* of another schema.
953///
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct Identity {
958 /// The revision number of the update.
959 pub revision: Option<i32>,
960 /// The revision independent identifier of the update.
961 #[serde(rename = "updateId")]
962 pub update_id: Option<String>,
963}
964
965impl common::Part for Identity {}
966
967/// Details of the derived image portion of the DockerImage relationship. This image would be produced from a Dockerfile with FROM .
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct ImageOccurrence {
975 /// Output only. This contains the base image URL for the derived image occurrence.
976 #[serde(rename = "baseResourceUrl")]
977 pub base_resource_url: Option<String>,
978 /// Output only. The number of layers by which this image differs from the associated image basis.
979 pub distance: Option<i32>,
980 /// Required. The fingerprint of the derived image.
981 pub fingerprint: Option<Fingerprint>,
982 /// This contains layer-specific metadata, if populated it has length "distance" and is ordered with [distance] being the layer immediately following the base image and [1] being the final layer.
983 #[serde(rename = "layerInfo")]
984 pub layer_info: Option<Vec<Layer>>,
985}
986
987impl common::Part for ImageOccurrence {}
988
989/// There is no detailed description.
990///
991/// This type is not used in any activity, and only used as *part* of another schema.
992///
993#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
994#[serde_with::serde_as]
995#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
996pub struct InTotoProvenance {
997 /// required
998 #[serde(rename = "builderConfig")]
999 pub builder_config: Option<BuilderConfig>,
1000 /// The collection of artifacts that influenced the build including sources, dependencies, build tools, base images, and so on. This is considered to be incomplete unless metadata.completeness.materials is true. Unset or null is equivalent to empty.
1001 pub materials: Option<Vec<String>>,
1002 /// no description provided
1003 pub metadata: Option<Metadata>,
1004 /// Identifies the configuration used for the build. When combined with materials, this SHOULD fully describe the build, such that re-running this recipe results in bit-for-bit identical output (if the build is reproducible). required
1005 pub recipe: Option<Recipe>,
1006}
1007
1008impl common::Part for InTotoProvenance {}
1009
1010/// There is no detailed description.
1011///
1012/// This type is not used in any activity, and only used as *part* of another schema.
1013///
1014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1015#[serde_with::serde_as]
1016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1017pub struct InTotoSlsaProvenanceV1 {
1018 /// InToto spec defined at https://github.com/in-toto/attestation/tree/main/spec#statement
1019 pub _type: Option<String>,
1020 /// no description provided
1021 pub predicate: Option<SlsaProvenanceV1>,
1022 /// no description provided
1023 #[serde(rename = "predicateType")]
1024 pub predicate_type: Option<String>,
1025 /// no description provided
1026 pub subject: Option<Vec<Subject>>,
1027}
1028
1029impl common::Part for InTotoSlsaProvenanceV1 {}
1030
1031/// Spec defined at https://github.com/in-toto/attestation/tree/main/spec#statement The serialized InTotoStatement will be stored as Envelope.payload. Envelope.payloadType is always "application/vnd.in-toto+json".
1032///
1033/// This type is not used in any activity, and only used as *part* of another schema.
1034///
1035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1036#[serde_with::serde_as]
1037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1038pub struct InTotoStatement {
1039 /// Always `https://in-toto.io/Statement/v0.1`.
1040 pub _type: Option<String>,
1041 /// `https://slsa.dev/provenance/v0.1` for SlsaProvenance.
1042 #[serde(rename = "predicateType")]
1043 pub predicate_type: Option<String>,
1044 /// no description provided
1045 pub provenance: Option<InTotoProvenance>,
1046 /// no description provided
1047 #[serde(rename = "slsaProvenance")]
1048 pub slsa_provenance: Option<SlsaProvenance>,
1049 /// no description provided
1050 #[serde(rename = "slsaProvenanceZeroTwo")]
1051 pub slsa_provenance_zero_two: Option<SlsaProvenanceZeroTwo>,
1052 /// no description provided
1053 pub subject: Option<Vec<Subject>>,
1054}
1055
1056impl common::Part for InTotoStatement {}
1057
1058/// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
1059///
1060/// This type is not used in any activity, and only used as *part* of another schema.
1061///
1062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1063#[serde_with::serde_as]
1064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1065pub struct Justification {
1066 /// Additional details on why this justification was chosen.
1067 pub details: Option<String>,
1068 /// The justification type for this vulnerability.
1069 #[serde(rename = "justificationType")]
1070 pub justification_type: Option<String>,
1071}
1072
1073impl common::Part for Justification {}
1074
1075/// There is no detailed description.
1076///
1077/// This type is not used in any activity, and only used as *part* of another schema.
1078///
1079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1080#[serde_with::serde_as]
1081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1082pub struct Jwt {
1083 /// The compact encoding of a JWS, which is always three base64 encoded strings joined by periods. For details, see: https://tools.ietf.org/html/rfc7515.html#section-3.1
1084 #[serde(rename = "compactJwt")]
1085 pub compact_jwt: Option<String>,
1086}
1087
1088impl common::Part for Jwt {}
1089
1090/// Indicates a language package available between this package and the customer's resource artifact.
1091///
1092/// This type is not used in any activity, and only used as *part* of another schema.
1093///
1094#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1095#[serde_with::serde_as]
1096#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1097pub struct LanguagePackageDependency {
1098 /// no description provided
1099 pub package: Option<String>,
1100 /// no description provided
1101 pub version: Option<String>,
1102}
1103
1104impl common::Part for LanguagePackageDependency {}
1105
1106/// Layer holds metadata specific to a layer of a Docker image.
1107///
1108/// This type is not used in any activity, and only used as *part* of another schema.
1109///
1110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1111#[serde_with::serde_as]
1112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1113pub struct Layer {
1114 /// The recovered arguments to the Dockerfile directive.
1115 pub arguments: Option<String>,
1116 /// Required. The recovered Dockerfile directive used to construct this layer. See https://docs.docker.com/engine/reference/builder/ for more information.
1117 pub directive: Option<String>,
1118}
1119
1120impl common::Part for Layer {}
1121
1122/// License information.
1123///
1124/// This type is not used in any activity, and only used as *part* of another schema.
1125///
1126#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1127#[serde_with::serde_as]
1128#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1129pub struct License {
1130 /// Comments
1131 pub comments: Option<String>,
1132 /// Often a single license can be used to represent the licensing terms. Sometimes it is necessary to include a choice of one or more licenses or some combination of license identifiers. Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT", "GPL-2.0-or-later WITH Bison-exception-2.2".
1133 pub expression: Option<String>,
1134}
1135
1136impl common::Part for License {}
1137
1138/// The response message for Operations.ListOperations.
1139///
1140/// # Activities
1141///
1142/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1143/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1144///
1145/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1146#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1147#[serde_with::serde_as]
1148#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1149pub struct ListOperationsResponse {
1150 /// The standard List next-page token.
1151 #[serde(rename = "nextPageToken")]
1152 pub next_page_token: Option<String>,
1153 /// A list of operations that matches the specified filter in the request.
1154 pub operations: Option<Vec<Operation>>,
1155}
1156
1157impl common::ResponseResult for ListOperationsResponse {}
1158
1159/// ListVulnerabilitiesResponse contains a single page of vulnerabilities resulting from a scan.
1160///
1161/// # Activities
1162///
1163/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1164/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1165///
1166/// * [locations scans vulnerabilities list projects](ProjectLocationScanVulnerabilityListCall) (response)
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct ListVulnerabilitiesResponseV1 {
1171 /// A page token that can be used in a subsequent call to ListVulnerabilities to continue retrieving results.
1172 #[serde(rename = "nextPageToken")]
1173 pub next_page_token: Option<String>,
1174 /// The list of Vulnerability Occurrences resulting from a scan.
1175 pub occurrences: Option<Vec<Occurrence>>,
1176}
1177
1178impl common::ResponseResult for ListVulnerabilitiesResponseV1 {}
1179
1180/// An occurrence of a particular package installation found within a system's filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
1181///
1182/// This type is not used in any activity, and only used as *part* of another schema.
1183///
1184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1185#[serde_with::serde_as]
1186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1187pub struct Location {
1188 /// Deprecated. The CPE URI in [CPE format](https://cpe.mitre.org/specification/)
1189 #[serde(rename = "cpeUri")]
1190 pub cpe_uri: Option<String>,
1191 /// The path from which we gathered that this package/version is installed.
1192 pub path: Option<String>,
1193 /// Deprecated. The version installed at this location.
1194 pub version: Option<Version>,
1195}
1196
1197impl common::Part for Location {}
1198
1199/// There is no detailed description.
1200///
1201/// This type is not used in any activity, and only used as *part* of another schema.
1202///
1203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1204#[serde_with::serde_as]
1205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1206pub struct Maintainer {
1207 /// no description provided
1208 pub email: Option<String>,
1209 /// no description provided
1210 pub kind: Option<String>,
1211 /// no description provided
1212 pub name: Option<String>,
1213 /// no description provided
1214 pub url: Option<String>,
1215}
1216
1217impl common::Part for Maintainer {}
1218
1219/// There is no detailed description.
1220///
1221/// This type is not used in any activity, and only used as *part* of another schema.
1222///
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct Material {
1227 /// no description provided
1228 pub digest: Option<HashMap<String, String>>,
1229 /// no description provided
1230 pub uri: Option<String>,
1231}
1232
1233impl common::Part for Material {}
1234
1235/// Other properties of the build.
1236///
1237/// This type is not used in any activity, and only used as *part* of another schema.
1238///
1239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1240#[serde_with::serde_as]
1241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1242pub struct Metadata {
1243 /// The timestamp of when the build completed.
1244 #[serde(rename = "buildFinishedOn")]
1245 pub build_finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
1246 /// Identifies the particular build invocation, which can be useful for finding associated logs or other ad-hoc analysis. The value SHOULD be globally unique, per in-toto Provenance spec.
1247 #[serde(rename = "buildInvocationId")]
1248 pub build_invocation_id: Option<String>,
1249 /// The timestamp of when the build started.
1250 #[serde(rename = "buildStartedOn")]
1251 pub build_started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
1252 /// Indicates that the builder claims certain fields in this message to be complete.
1253 pub completeness: Option<Completeness>,
1254 /// If true, the builder claims that running the recipe on materials will produce bit-for-bit identical output.
1255 pub reproducible: Option<bool>,
1256}
1257
1258impl common::Part for Metadata {}
1259
1260/// Details about files that caused a compliance check to fail. display_command is a single command that can be used to display a list of non compliant files. When there is no such command, we can also iterate a list of non compliant file using 'path'.
1261///
1262/// This type is not used in any activity, and only used as *part* of another schema.
1263///
1264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1265#[serde_with::serde_as]
1266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1267pub struct NonCompliantFile {
1268 /// Command to display the non-compliant files.
1269 #[serde(rename = "displayCommand")]
1270 pub display_command: Option<String>,
1271 /// Empty if `display_command` is set.
1272 pub path: Option<String>,
1273 /// Explains why a file is non compliant for a CIS check.
1274 pub reason: Option<String>,
1275}
1276
1277impl common::Part for NonCompliantFile {}
1278
1279/// An instance of an analysis type that has been found on a resource.
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 Occurrence {
1287 /// Describes an attestation of an artifact.
1288 pub attestation: Option<AttestationOccurrence>,
1289 /// Describes a verifiable build.
1290 pub build: Option<BuildOccurrence>,
1291 /// Describes a compliance violation on a linked resource.
1292 pub compliance: Option<ComplianceOccurrence>,
1293 /// Output only. The time this occurrence was created.
1294 #[serde(rename = "createTime")]
1295 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1296 /// Describes the deployment of an artifact on a runtime.
1297 pub deployment: Option<DeploymentOccurrence>,
1298 /// Describes when a resource was discovered.
1299 pub discovery: Option<DiscoveryOccurrence>,
1300 /// Describes an attestation of an artifact using dsse.
1301 #[serde(rename = "dsseAttestation")]
1302 pub dsse_attestation: Option<DSSEAttestationOccurrence>,
1303 /// https://github.com/secure-systems-lab/dsse
1304 pub envelope: Option<Envelope>,
1305 /// Describes how this resource derives from the basis in the associated note.
1306 pub image: Option<ImageOccurrence>,
1307 /// Output only. This explicitly denotes which of the occurrence details are specified. This field can be used as a filter in list requests.
1308 pub kind: Option<String>,
1309 /// Output only. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
1310 pub name: Option<String>,
1311 /// Required. Immutable. The analysis note associated with this occurrence, in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be used as a filter in list requests.
1312 #[serde(rename = "noteName")]
1313 pub note_name: Option<String>,
1314 /// Describes the installation of a package on the linked resource.
1315 pub package: Option<PackageOccurrence>,
1316 /// A description of actions that can be taken to remedy the note.
1317 pub remediation: Option<String>,
1318 /// Required. Immutable. A URI that represents the resource for which the occurrence applies. For example, `https://gcr.io/project/image@sha256:123abc` for a Docker image.
1319 #[serde(rename = "resourceUri")]
1320 pub resource_uri: Option<String>,
1321 /// Describes a specific SBOM reference occurrences.
1322 #[serde(rename = "sbomReference")]
1323 pub sbom_reference: Option<SBOMReferenceOccurrence>,
1324 /// Output only. The time this occurrence was last updated.
1325 #[serde(rename = "updateTime")]
1326 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1327 /// Describes an available package upgrade on the linked resource.
1328 pub upgrade: Option<UpgradeOccurrence>,
1329 /// Describes a security vulnerability.
1330 pub vulnerability: Option<VulnerabilityOccurrence>,
1331}
1332
1333impl common::Part for Occurrence {}
1334
1335/// This resource represents a long-running operation that is the result of a network API call.
1336///
1337/// # Activities
1338///
1339/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1341///
1342/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1343/// * [locations operations wait projects](ProjectLocationOperationWaitCall) (response)
1344/// * [locations scans analyze packages projects](ProjectLocationScanAnalyzePackageCall) (response)
1345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1346#[serde_with::serde_as]
1347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1348pub struct Operation {
1349 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1350 pub done: Option<bool>,
1351 /// The error result of the operation in case of failure or cancellation.
1352 pub error: Option<Status>,
1353 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1354 pub metadata: Option<HashMap<String, serde_json::Value>>,
1355 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1356 pub name: Option<String>,
1357 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1358 pub response: Option<HashMap<String, serde_json::Value>>,
1359}
1360
1361impl common::ResponseResult for Operation {}
1362
1363/// There is no detailed description.
1364///
1365/// This type is not used in any activity, and only used as *part* of another schema.
1366///
1367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1368#[serde_with::serde_as]
1369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1370pub struct PackageData {
1371 /// The architecture of the package.
1372 pub architecture: Option<String>,
1373 /// A bundle containing the binary and source information.
1374 #[serde(rename = "binarySourceInfo")]
1375 pub binary_source_info: Option<Vec<BinarySourceInfo>>,
1376 /// DEPRECATED
1377 #[serde(rename = "binaryVersion")]
1378 pub binary_version: Option<PackageVersion>,
1379 /// The cpe_uri in [cpe format] (https://cpe.mitre.org/specification/) in which the vulnerability may manifest. Examples include distro or storage location for vulnerable jar.
1380 #[serde(rename = "cpeUri")]
1381 pub cpe_uri: Option<String>,
1382 /// The dependency chain between this package and the user's artifact. List in order from the customer's package under review first, to the current package last. Inclusive of the original package and the current package.
1383 #[serde(rename = "dependencyChain")]
1384 pub dependency_chain: Option<Vec<LanguagePackageDependency>>,
1385 /// The path to the jar file / go binary file.
1386 #[serde(rename = "fileLocation")]
1387 pub file_location: Option<Vec<FileLocation>>,
1388 /// HashDigest stores the SHA512 hash digest of the jar file if the package is of type Maven. This field will be unset for non Maven packages.
1389 #[serde(rename = "hashDigest")]
1390 pub hash_digest: Option<String>,
1391 /// The list of licenses found that are related to a given package. Note that licenses may also be stored on the BinarySourceInfo. If there is no BinarySourceInfo (because there's no concept of source vs binary), then it will be stored here, while if there are BinarySourceInfos, it will be stored there, as one source can have multiple binaries with different licenses.
1392 pub licenses: Option<Vec<String>>,
1393 /// The maintainer of the package.
1394 pub maintainer: Option<Maintainer>,
1395 /// The OS affected by a vulnerability Used to generate the cpe_uri for OS packages
1396 pub os: Option<String>,
1397 /// The version of the OS Used to generate the cpe_uri for OS packages
1398 #[serde(rename = "osVersion")]
1399 pub os_version: Option<String>,
1400 /// The package being analysed for vulnerabilities
1401 pub package: Option<String>,
1402 /// The type of package: os, maven, go, etc.
1403 #[serde(rename = "packageType")]
1404 pub package_type: Option<String>,
1405 /// CVEs that this package is no longer vulnerable to go/drydock-dd-custom-binary-scanning
1406 #[serde(rename = "patchedCve")]
1407 pub patched_cve: Option<Vec<String>>,
1408 /// DEPRECATED
1409 #[serde(rename = "sourceVersion")]
1410 pub source_version: Option<PackageVersion>,
1411 /// no description provided
1412 pub unused: Option<String>,
1413 /// The version of the package being analysed
1414 pub version: Option<String>,
1415}
1416
1417impl common::Part for PackageData {}
1418
1419/// A detail for a distro and package this vulnerability occurrence was found in and its associated fix (if one is available).
1420///
1421/// This type is not used in any activity, and only used as *part* of another schema.
1422///
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct PackageIssue {
1427 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability was found in.
1428 #[serde(rename = "affectedCpeUri")]
1429 pub affected_cpe_uri: Option<String>,
1430 /// Required. The package this vulnerability was found in.
1431 #[serde(rename = "affectedPackage")]
1432 pub affected_package: Option<String>,
1433 /// Required. The version of the package that is installed on the resource affected by this vulnerability.
1434 #[serde(rename = "affectedVersion")]
1435 pub affected_version: Option<Version>,
1436 /// Output only. The distro or language system assigned severity for this vulnerability when that is available and note provider assigned severity when it is not available.
1437 #[serde(rename = "effectiveSeverity")]
1438 pub effective_severity: Option<String>,
1439 /// The location at which this package was found.
1440 #[serde(rename = "fileLocation")]
1441 pub file_location: Option<Vec<GrafeasV1FileLocation>>,
1442 /// Output only. Whether a fix is available for this package.
1443 #[serde(rename = "fixAvailable")]
1444 pub fix_available: Option<bool>,
1445 /// The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability was fixed in. It is possible for this to be different from the affected_cpe_uri.
1446 #[serde(rename = "fixedCpeUri")]
1447 pub fixed_cpe_uri: Option<String>,
1448 /// The package this vulnerability was fixed in. It is possible for this to be different from the affected_package.
1449 #[serde(rename = "fixedPackage")]
1450 pub fixed_package: Option<String>,
1451 /// Required. The version of the package this vulnerability was fixed in. Setting this to VersionKind.MAXIMUM means no fix is yet available.
1452 #[serde(rename = "fixedVersion")]
1453 pub fixed_version: Option<Version>,
1454 /// The type of package (e.g. OS, MAVEN, GO).
1455 #[serde(rename = "packageType")]
1456 pub package_type: Option<String>,
1457}
1458
1459impl common::Part for PackageIssue {}
1460
1461/// Details on how a particular software package was installed on a system.
1462///
1463/// This type is not used in any activity, and only used as *part* of another schema.
1464///
1465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1466#[serde_with::serde_as]
1467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1468pub struct PackageOccurrence {
1469 /// Output only. The CPU architecture for which packages in this distribution channel were built. Architecture will be blank for language packages.
1470 pub architecture: Option<String>,
1471 /// Output only. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) denoting the package manager version distributing a package. The cpe_uri will be blank for language packages.
1472 #[serde(rename = "cpeUri")]
1473 pub cpe_uri: Option<String>,
1474 /// Licenses that have been declared by the authors of the package.
1475 pub license: Option<License>,
1476 /// All of the places within the filesystem versions of this package have been found.
1477 pub location: Option<Vec<Location>>,
1478 /// Required. Output only. The name of the installed package.
1479 pub name: Option<String>,
1480 /// Output only. The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
1481 #[serde(rename = "packageType")]
1482 pub package_type: Option<String>,
1483 /// Output only. The version of the package.
1484 pub version: Option<Version>,
1485}
1486
1487impl common::Part for PackageOccurrence {}
1488
1489/// There is no detailed description.
1490///
1491/// This type is not used in any activity, and only used as *part* of another schema.
1492///
1493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1494#[serde_with::serde_as]
1495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1496pub struct PackageVersion {
1497 /// The licenses associated with this package. Note that this has to go on the PackageVersion level, because we can have cases with images with the same source having different licences. E.g. in Alpine, musl and musl-utils both have the same origin musl, but have different sets of licenses.
1498 pub licenses: Option<Vec<String>>,
1499 /// no description provided
1500 pub name: Option<String>,
1501 /// no description provided
1502 pub version: Option<String>,
1503}
1504
1505impl common::Part for PackageVersion {}
1506
1507/// Selects a repo using a Google Cloud Platform project ID (e.g., winged-cargo-31) and a repo name within that project.
1508///
1509/// This type is not used in any activity, and only used as *part* of another schema.
1510///
1511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1512#[serde_with::serde_as]
1513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1514pub struct ProjectRepoId {
1515 /// The ID of the project.
1516 #[serde(rename = "projectId")]
1517 pub project_id: Option<String>,
1518 /// The name of the repo. Leave empty for the default repo.
1519 #[serde(rename = "repoName")]
1520 pub repo_name: Option<String>,
1521}
1522
1523impl common::Part for ProjectRepoId {}
1524
1525/// There is no detailed description.
1526///
1527/// This type is not used in any activity, and only used as *part* of another schema.
1528///
1529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1530#[serde_with::serde_as]
1531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1532pub struct ProvenanceBuilder {
1533 /// no description provided
1534 #[serde(rename = "builderDependencies")]
1535 pub builder_dependencies: Option<Vec<ResourceDescriptor>>,
1536 /// no description provided
1537 pub id: Option<String>,
1538 /// no description provided
1539 pub version: Option<HashMap<String, String>>,
1540}
1541
1542impl common::Part for ProvenanceBuilder {}
1543
1544/// Steps taken to build the artifact. For a TaskRun, typically each container corresponds to one step in the recipe.
1545///
1546/// This type is not used in any activity, and only used as *part* of another schema.
1547///
1548#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1549#[serde_with::serde_as]
1550#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1551pub struct Recipe {
1552 /// Collection of all external inputs that influenced the build on top of recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe type were "make", then this might be the flags passed to make aside from the target, which is captured in recipe.entryPoint. Since the arguments field can greatly vary in structure, depending on the builder and recipe type, this is of form "Any".
1553 pub arguments: Option<Vec<HashMap<String, serde_json::Value>>>,
1554 /// Index in materials containing the recipe steps that are not implied by recipe.type. For example, if the recipe type were "make", then this would point to the source containing the Makefile, not the make program itself. Set to -1 if the recipe doesn't come from a material, as zero is default unset value for int64.
1555 #[serde(rename = "definedInMaterial")]
1556 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1557 pub defined_in_material: Option<i64>,
1558 /// String identifying the entry point into the build. This is often a path to a configuration file and/or a target label within that file. The syntax and meaning are defined by recipe.type. For example, if the recipe type were "make", then this would reference the directory in which to run make as well as which target to use.
1559 #[serde(rename = "entryPoint")]
1560 pub entry_point: Option<String>,
1561 /// Any other builder-controlled inputs necessary for correctly evaluating the recipe. Usually only needed for reproducing the build but not evaluated as part of policy. Since the environment field can greatly vary in structure, depending on the builder and recipe type, this is of form "Any".
1562 pub environment: Option<Vec<HashMap<String, serde_json::Value>>>,
1563 /// URI indicating what type of recipe was performed. It determines the meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and materials.
1564 #[serde(rename = "type")]
1565 pub type_: Option<String>,
1566}
1567
1568impl common::Part for Recipe {}
1569
1570/// Metadata for any related URL information.
1571///
1572/// This type is not used in any activity, and only used as *part* of another schema.
1573///
1574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1575#[serde_with::serde_as]
1576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1577pub struct RelatedUrl {
1578 /// Label to describe usage of the URL.
1579 pub label: Option<String>,
1580 /// Specific URL associated with the resource.
1581 pub url: Option<String>,
1582}
1583
1584impl common::Part for RelatedUrl {}
1585
1586/// Specifies details on how to handle (and presumably, fix) a vulnerability.
1587///
1588/// This type is not used in any activity, and only used as *part* of another schema.
1589///
1590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1591#[serde_with::serde_as]
1592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1593pub struct Remediation {
1594 /// Contains a comprehensive human-readable discussion of the remediation.
1595 pub details: Option<String>,
1596 /// The type of remediation that can be applied.
1597 #[serde(rename = "remediationType")]
1598 pub remediation_type: Option<String>,
1599 /// Contains the URL where to obtain the remediation.
1600 #[serde(rename = "remediationUri")]
1601 pub remediation_uri: Option<RelatedUrl>,
1602}
1603
1604impl common::Part for Remediation {}
1605
1606/// A unique identifier for a Cloud Repo.
1607///
1608/// This type is not used in any activity, and only used as *part* of another schema.
1609///
1610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1611#[serde_with::serde_as]
1612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1613pub struct RepoId {
1614 /// A combination of a project ID and a repo name.
1615 #[serde(rename = "projectRepoId")]
1616 pub project_repo_id: Option<ProjectRepoId>,
1617 /// A server-assigned, globally unique identifier.
1618 pub uid: Option<String>,
1619}
1620
1621impl common::Part for RepoId {}
1622
1623/// There is no detailed description.
1624///
1625/// This type is not used in any activity, and only used as *part* of another schema.
1626///
1627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1628#[serde_with::serde_as]
1629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1630pub struct ResourceDescriptor {
1631 /// no description provided
1632 pub annotations: Option<HashMap<String, serde_json::Value>>,
1633 /// no description provided
1634 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1635 pub content: Option<Vec<u8>>,
1636 /// no description provided
1637 pub digest: Option<HashMap<String, String>>,
1638 /// no description provided
1639 #[serde(rename = "downloadLocation")]
1640 pub download_location: Option<String>,
1641 /// no description provided
1642 #[serde(rename = "mediaType")]
1643 pub media_type: Option<String>,
1644 /// no description provided
1645 pub name: Option<String>,
1646 /// no description provided
1647 pub uri: Option<String>,
1648}
1649
1650impl common::Part for ResourceDescriptor {}
1651
1652/// There is no detailed description.
1653///
1654/// This type is not used in any activity, and only used as *part* of another schema.
1655///
1656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1657#[serde_with::serde_as]
1658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1659pub struct RunDetails {
1660 /// no description provided
1661 pub builder: Option<ProvenanceBuilder>,
1662 /// no description provided
1663 pub byproducts: Option<Vec<ResourceDescriptor>>,
1664 /// no description provided
1665 pub metadata: Option<BuildMetadata>,
1666}
1667
1668impl common::Part for RunDetails {}
1669
1670/// The occurrence representing an SBOM reference as applied to a specific resource. The occurrence follows the DSSE specification. See https://github.com/secure-systems-lab/dsse/blob/master/envelope.md for more details.
1671///
1672/// This type is not used in any activity, and only used as *part* of another schema.
1673///
1674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1675#[serde_with::serde_as]
1676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1677pub struct SBOMReferenceOccurrence {
1678 /// The actual payload that contains the SBOM reference data.
1679 pub payload: Option<SbomReferenceIntotoPayload>,
1680 /// The kind of payload that SbomReferenceIntotoPayload takes. Since it's in the intoto format, this value is expected to be 'application/vnd.in-toto+json'.
1681 #[serde(rename = "payloadType")]
1682 pub payload_type: Option<String>,
1683 /// The signatures over the payload.
1684 pub signatures: Option<Vec<EnvelopeSignature>>,
1685}
1686
1687impl common::Part for SBOMReferenceOccurrence {}
1688
1689/// The status of an SBOM generation.
1690///
1691/// This type is not used in any activity, and only used as *part* of another schema.
1692///
1693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1694#[serde_with::serde_as]
1695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1696pub struct SBOMStatus {
1697 /// If there was an error generating an SBOM, this will indicate what that error was.
1698 pub error: Option<String>,
1699 /// The progress of the SBOM generation.
1700 #[serde(rename = "sbomState")]
1701 pub sbom_state: Option<String>,
1702}
1703
1704impl common::Part for SBOMStatus {}
1705
1706/// The actual payload that contains the SBOM Reference data. The payload follows the intoto statement specification. See https://github.com/in-toto/attestation/blob/main/spec/v1.0/statement.md for more details.
1707///
1708/// This type is not used in any activity, and only used as *part* of another schema.
1709///
1710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1711#[serde_with::serde_as]
1712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1713pub struct SbomReferenceIntotoPayload {
1714 /// Identifier for the schema of the Statement.
1715 pub _type: Option<String>,
1716 /// Additional parameters of the Predicate. Includes the actual data about the SBOM.
1717 pub predicate: Option<SbomReferenceIntotoPredicate>,
1718 /// URI identifying the type of the Predicate.
1719 #[serde(rename = "predicateType")]
1720 pub predicate_type: Option<String>,
1721 /// Set of software artifacts that the attestation applies to. Each element represents a single software artifact.
1722 pub subject: Option<Vec<Subject>>,
1723}
1724
1725impl common::Part for SbomReferenceIntotoPayload {}
1726
1727/// A predicate which describes the SBOM being referenced.
1728///
1729/// This type is not used in any activity, and only used as *part* of another schema.
1730///
1731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1732#[serde_with::serde_as]
1733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1734pub struct SbomReferenceIntotoPredicate {
1735 /// A map of algorithm to digest of the contents of the SBOM.
1736 pub digest: Option<HashMap<String, String>>,
1737 /// The location of the SBOM.
1738 pub location: Option<String>,
1739 /// The mime type of the SBOM.
1740 #[serde(rename = "mimeType")]
1741 pub mime_type: Option<String>,
1742 /// The person or system referring this predicate to the consumer.
1743 #[serde(rename = "referrerId")]
1744 pub referrer_id: Option<String>,
1745}
1746
1747impl common::Part for SbomReferenceIntotoPredicate {}
1748
1749/// Verifiers (e.g. Kritis implementations) MUST verify signatures with respect to the trust anchors defined in policy (e.g. a Kritis policy). Typically this means that the verifier has been configured with a map from `public_key_id` to public key material (and any required parameters, e.g. signing algorithm). In particular, verification implementations MUST NOT treat the signature `public_key_id` as anything more than a key lookup hint. The `public_key_id` DOES NOT validate or authenticate a public key; it only provides a mechanism for quickly selecting a public key ALREADY CONFIGURED on the verifier through a trusted channel. Verification implementations MUST reject signatures in any of the following circumstances: * The `public_key_id` is not recognized by the verifier. * The public key that `public_key_id` refers to does not verify the signature with respect to the payload. The `signature` contents SHOULD NOT be "attached" (where the payload is included with the serialized `signature` bytes). Verifiers MUST ignore any "attached" payload and only verify signatures with respect to explicitly provided payload (e.g. a `payload` field on the proto message that holds this Signature, or the canonical serialization of the proto message that holds this signature).
1750///
1751/// This type is not used in any activity, and only used as *part* of another schema.
1752///
1753#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1754#[serde_with::serde_as]
1755#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1756pub struct Signature {
1757 /// The identifier for the public key that verifies this signature. * The `public_key_id` is required. * The `public_key_id` SHOULD be an RFC3986 conformant URI. * When possible, the `public_key_id` SHOULD be an immutable reference, such as a cryptographic digest. Examples of valid `public_key_id`s: OpenPGP V4 public key fingerprint: * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more details on this scheme. RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER serialization): * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5"
1758 #[serde(rename = "publicKeyId")]
1759 pub public_key_id: Option<String>,
1760 /// The content of the signature, an opaque bytestring. The payload that this signature verifies MUST be unambiguously provided with the Signature during verification. A wrapper message might provide the payload explicitly. Alternatively, a message might have a canonical serialization that can always be unambiguously computed to derive the payload.
1761 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1762 pub signature: Option<Vec<u8>>,
1763}
1764
1765impl common::Part for Signature {}
1766
1767/// There is no detailed description.
1768///
1769/// This type is not used in any activity, and only used as *part* of another schema.
1770///
1771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1772#[serde_with::serde_as]
1773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1774pub struct SlsaBuilder {
1775 /// no description provided
1776 pub id: Option<String>,
1777}
1778
1779impl common::Part for SlsaBuilder {}
1780
1781/// Indicates that the builder claims certain fields in this message to be complete.
1782///
1783/// This type is not used in any activity, and only used as *part* of another schema.
1784///
1785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1786#[serde_with::serde_as]
1787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1788pub struct SlsaCompleteness {
1789 /// If true, the builder claims that recipe.arguments is complete, meaning that all external inputs are properly captured in the recipe.
1790 pub arguments: Option<bool>,
1791 /// If true, the builder claims that recipe.environment is claimed to be complete.
1792 pub environment: Option<bool>,
1793 /// If true, the builder claims that materials are complete, usually through some controls to prevent network access. Sometimes called "hermetic".
1794 pub materials: Option<bool>,
1795}
1796
1797impl common::Part for SlsaCompleteness {}
1798
1799/// Other properties of the build.
1800///
1801/// This type is not used in any activity, and only used as *part* of another schema.
1802///
1803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1804#[serde_with::serde_as]
1805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1806pub struct SlsaMetadata {
1807 /// The timestamp of when the build completed.
1808 #[serde(rename = "buildFinishedOn")]
1809 pub build_finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
1810 /// Identifies the particular build invocation, which can be useful for finding associated logs or other ad-hoc analysis. The value SHOULD be globally unique, per in-toto Provenance spec.
1811 #[serde(rename = "buildInvocationId")]
1812 pub build_invocation_id: Option<String>,
1813 /// The timestamp of when the build started.
1814 #[serde(rename = "buildStartedOn")]
1815 pub build_started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
1816 /// Indicates that the builder claims certain fields in this message to be complete.
1817 pub completeness: Option<SlsaCompleteness>,
1818 /// If true, the builder claims that running the recipe on materials will produce bit-for-bit identical output.
1819 pub reproducible: Option<bool>,
1820}
1821
1822impl common::Part for SlsaMetadata {}
1823
1824/// There is no detailed description.
1825///
1826/// This type is not used in any activity, and only used as *part* of another schema.
1827///
1828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1829#[serde_with::serde_as]
1830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1831pub struct SlsaProvenance {
1832 /// required
1833 pub builder: Option<SlsaBuilder>,
1834 /// The collection of artifacts that influenced the build including sources, dependencies, build tools, base images, and so on. This is considered to be incomplete unless metadata.completeness.materials is true. Unset or null is equivalent to empty.
1835 pub materials: Option<Vec<Material>>,
1836 /// no description provided
1837 pub metadata: Option<SlsaMetadata>,
1838 /// Identifies the configuration used for the build. When combined with materials, this SHOULD fully describe the build, such that re-running this recipe results in bit-for-bit identical output (if the build is reproducible). required
1839 pub recipe: Option<SlsaRecipe>,
1840}
1841
1842impl common::Part for SlsaProvenance {}
1843
1844/// Keep in sync with schema at https://github.com/slsa-framework/slsa/blob/main/docs/provenance/schema/v1/provenance.proto Builder renamed to ProvenanceBuilder because of Java conflicts.
1845///
1846/// This type is not used in any activity, and only used as *part* of another schema.
1847///
1848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1849#[serde_with::serde_as]
1850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1851pub struct SlsaProvenanceV1 {
1852 /// no description provided
1853 #[serde(rename = "buildDefinition")]
1854 pub build_definition: Option<BuildDefinition>,
1855 /// no description provided
1856 #[serde(rename = "runDetails")]
1857 pub run_details: Option<RunDetails>,
1858}
1859
1860impl common::Part for SlsaProvenanceV1 {}
1861
1862/// See full explanation of fields at slsa.dev/provenance/v0.2.
1863///
1864/// This type is not used in any activity, and only used as *part* of another schema.
1865///
1866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1867#[serde_with::serde_as]
1868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1869pub struct SlsaProvenanceZeroTwo {
1870 /// no description provided
1871 #[serde(rename = "buildConfig")]
1872 pub build_config: Option<HashMap<String, serde_json::Value>>,
1873 /// no description provided
1874 #[serde(rename = "buildType")]
1875 pub build_type: Option<String>,
1876 /// no description provided
1877 pub builder: Option<GrafeasV1SlsaProvenanceZeroTwoSlsaBuilder>,
1878 /// no description provided
1879 pub invocation: Option<GrafeasV1SlsaProvenanceZeroTwoSlsaInvocation>,
1880 /// no description provided
1881 pub materials: Option<Vec<GrafeasV1SlsaProvenanceZeroTwoSlsaMaterial>>,
1882 /// no description provided
1883 pub metadata: Option<GrafeasV1SlsaProvenanceZeroTwoSlsaMetadata>,
1884}
1885
1886impl common::Part for SlsaProvenanceZeroTwo {}
1887
1888/// Steps taken to build the artifact. For a TaskRun, typically each container corresponds to one step in the recipe.
1889///
1890/// This type is not used in any activity, and only used as *part* of another schema.
1891///
1892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1893#[serde_with::serde_as]
1894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1895pub struct SlsaRecipe {
1896 /// Collection of all external inputs that influenced the build on top of recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe type were "make", then this might be the flags passed to make aside from the target, which is captured in recipe.entryPoint. Depending on the recipe Type, the structure may be different.
1897 pub arguments: Option<HashMap<String, serde_json::Value>>,
1898 /// Index in materials containing the recipe steps that are not implied by recipe.type. For example, if the recipe type were "make", then this would point to the source containing the Makefile, not the make program itself. Set to -1 if the recipe doesn't come from a material, as zero is default unset value for int64.
1899 #[serde(rename = "definedInMaterial")]
1900 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1901 pub defined_in_material: Option<i64>,
1902 /// String identifying the entry point into the build. This is often a path to a configuration file and/or a target label within that file. The syntax and meaning are defined by recipe.type. For example, if the recipe type were "make", then this would reference the directory in which to run make as well as which target to use.
1903 #[serde(rename = "entryPoint")]
1904 pub entry_point: Option<String>,
1905 /// Any other builder-controlled inputs necessary for correctly evaluating the recipe. Usually only needed for reproducing the build but not evaluated as part of policy. Depending on the recipe Type, the structure may be different.
1906 pub environment: Option<HashMap<String, serde_json::Value>>,
1907 /// URI indicating what type of recipe was performed. It determines the meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and materials.
1908 #[serde(rename = "type")]
1909 pub type_: Option<String>,
1910}
1911
1912impl common::Part for SlsaRecipe {}
1913
1914/// Source describes the location of the source used for the build.
1915///
1916/// This type is not used in any activity, and only used as *part* of another schema.
1917///
1918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1919#[serde_with::serde_as]
1920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1921pub struct Source {
1922 /// If provided, some of the source code used for the build may be found in these locations, in the case where the source repository had multiple remotes or submodules. This list will not include the context specified in the context field.
1923 #[serde(rename = "additionalContexts")]
1924 pub additional_contexts: Option<Vec<SourceContext>>,
1925 /// If provided, the input binary artifacts for the build came from this location.
1926 #[serde(rename = "artifactStorageSourceUri")]
1927 pub artifact_storage_source_uri: Option<String>,
1928 /// If provided, the source code used for the build came from this location.
1929 pub context: Option<SourceContext>,
1930 /// Hash(es) of the build source, which can be used to verify that the original source integrity was maintained in the build. The keys to this map are file paths used as build source and the values contain the hash values for those files. If the build source came in a single package such as a gzipped tarfile (.tar.gz), the FileHash will be for the single path to that file.
1931 #[serde(rename = "fileHashes")]
1932 pub file_hashes: Option<HashMap<String, FileHashes>>,
1933}
1934
1935impl common::Part for Source {}
1936
1937/// A SourceContext is a reference to a tree of files. A SourceContext together with a path point to a unique revision of a single file or directory.
1938///
1939/// This type is not used in any activity, and only used as *part* of another schema.
1940///
1941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1942#[serde_with::serde_as]
1943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1944pub struct SourceContext {
1945 /// A SourceContext referring to a revision in a Google Cloud Source Repo.
1946 #[serde(rename = "cloudRepo")]
1947 pub cloud_repo: Option<CloudRepoSourceContext>,
1948 /// A SourceContext referring to a Gerrit project.
1949 pub gerrit: Option<GerritSourceContext>,
1950 /// A SourceContext referring to any third party Git repo (e.g., GitHub).
1951 pub git: Option<GitSourceContext>,
1952 /// Labels with user defined metadata.
1953 pub labels: Option<HashMap<String, String>>,
1954}
1955
1956impl common::Part for SourceContext {}
1957
1958/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1959///
1960/// This type is not used in any activity, and only used as *part* of another schema.
1961///
1962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1963#[serde_with::serde_as]
1964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1965pub struct Status {
1966 /// The status code, which should be an enum value of google.rpc.Code.
1967 pub code: Option<i32>,
1968 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1969 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1970 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1971 pub message: Option<String>,
1972}
1973
1974impl common::Part for Status {}
1975
1976/// There is no detailed description.
1977///
1978/// This type is not used in any activity, and only used as *part* of another schema.
1979///
1980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1981#[serde_with::serde_as]
1982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1983pub struct Subject {
1984 /// `"": ""` Algorithms can be e.g. sha256, sha512 See https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet
1985 pub digest: Option<HashMap<String, String>>,
1986 /// no description provided
1987 pub name: Option<String>,
1988}
1989
1990impl common::Part for Subject {}
1991
1992/// The Upgrade Distribution represents metadata about the Upgrade for each operating system (CPE). Some distributions have additional metadata around updates, classifying them into various categories and severities.
1993///
1994/// This type is not used in any activity, and only used as *part* of another schema.
1995///
1996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1997#[serde_with::serde_as]
1998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1999pub struct UpgradeDistribution {
2000 /// The operating system classification of this Upgrade, as specified by the upstream operating system upgrade feed. For Windows the classification is one of the category_ids listed at https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803(v=vs.85)
2001 pub classification: Option<String>,
2002 /// Required - The specific operating system this metadata applies to. See https://cpe.mitre.org/specification/.
2003 #[serde(rename = "cpeUri")]
2004 pub cpe_uri: Option<String>,
2005 /// The cve tied to this Upgrade.
2006 pub cve: Option<Vec<String>>,
2007 /// The severity as specified by the upstream operating system.
2008 pub severity: Option<String>,
2009}
2010
2011impl common::Part for UpgradeDistribution {}
2012
2013/// An Upgrade Occurrence represents that a specific resource_url could install a specific upgrade. This presence is supplied via local sources (i.e. it is present in the mirror and the running system has noticed its availability). For Windows, both distribution and windows_update contain information for the Windows update.
2014///
2015/// This type is not used in any activity, and only used as *part* of another schema.
2016///
2017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2018#[serde_with::serde_as]
2019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2020pub struct UpgradeOccurrence {
2021 /// Metadata about the upgrade for available for the specific operating system for the resource_url. This allows efficient filtering, as well as making it easier to use the occurrence.
2022 pub distribution: Option<UpgradeDistribution>,
2023 /// Required for non-Windows OS. The package this Upgrade is for.
2024 pub package: Option<String>,
2025 /// Required for non-Windows OS. The version of the package in a machine + human readable form.
2026 #[serde(rename = "parsedVersion")]
2027 pub parsed_version: Option<Version>,
2028 /// Required for Windows OS. Represents the metadata about the Windows update.
2029 #[serde(rename = "windowsUpdate")]
2030 pub windows_update: Option<WindowsUpdate>,
2031}
2032
2033impl common::Part for UpgradeOccurrence {}
2034
2035/// Version contains structured information about the version of a package.
2036///
2037/// This type is not used in any activity, and only used as *part* of another schema.
2038///
2039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2040#[serde_with::serde_as]
2041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2042pub struct Version {
2043 /// Used to correct mistakes in the version numbering scheme.
2044 pub epoch: Option<i32>,
2045 /// Human readable version string. This string is of the form :- and is only set when kind is NORMAL.
2046 #[serde(rename = "fullName")]
2047 pub full_name: Option<String>,
2048 /// Whether this version is specifying part of an inclusive range. Grafeas does not have the capability to specify version ranges; instead we have fields that specify start version and end versions. At times this is insufficient - we also need to specify whether the version is included in the range or is excluded from the range. This boolean is expected to be set to true when the version is included in a range.
2049 pub inclusive: Option<bool>,
2050 /// Required. Distinguishes between sentinel MIN/MAX versions and normal versions.
2051 pub kind: Option<String>,
2052 /// Required only when version kind is NORMAL. The main part of the version name.
2053 pub name: Option<String>,
2054 /// The iteration of the package build from the above version.
2055 pub revision: Option<String>,
2056}
2057
2058impl common::Part for Version {}
2059
2060/// VexAssessment provides all publisher provided Vex information that is related to this vulnerability.
2061///
2062/// This type is not used in any activity, and only used as *part* of another schema.
2063///
2064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2065#[serde_with::serde_as]
2066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2067pub struct VexAssessment {
2068 /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability. Deprecated: Use vulnerability_id instead to denote CVEs.
2069 pub cve: Option<String>,
2070 /// Contains information about the impact of this vulnerability, this will change with time.
2071 pub impacts: Option<Vec<String>>,
2072 /// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
2073 pub justification: Option<Justification>,
2074 /// The VulnerabilityAssessment note from which this VexAssessment was generated. This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`.
2075 #[serde(rename = "noteName")]
2076 pub note_name: Option<String>,
2077 /// Holds a list of references associated with this vulnerability item and assessment.
2078 #[serde(rename = "relatedUris")]
2079 pub related_uris: Option<Vec<RelatedUrl>>,
2080 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
2081 pub remediations: Option<Vec<Remediation>>,
2082 /// Provides the state of this Vulnerability assessment.
2083 pub state: Option<String>,
2084 /// The vulnerability identifier for this Assessment. Will hold one of common identifiers e.g. CVE, GHSA etc.
2085 #[serde(rename = "vulnerabilityId")]
2086 pub vulnerability_id: Option<String>,
2087}
2088
2089impl common::Part for VexAssessment {}
2090
2091/// The status of an vulnerability attestation generation.
2092///
2093/// This type is not used in any activity, and only used as *part* of another schema.
2094///
2095#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2096#[serde_with::serde_as]
2097#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2098pub struct VulnerabilityAttestation {
2099 /// If failure, the error reason for why the attestation generation failed.
2100 pub error: Option<String>,
2101 /// The last time we attempted to generate an attestation.
2102 #[serde(rename = "lastAttemptTime")]
2103 pub last_attempt_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2104 /// The success/failure state of the latest attestation attempt.
2105 pub state: Option<String>,
2106}
2107
2108impl common::Part for VulnerabilityAttestation {}
2109
2110/// An occurrence of a severity vulnerability on a resource.
2111///
2112/// This type is not used in any activity, and only used as *part* of another schema.
2113///
2114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2115#[serde_with::serde_as]
2116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2117pub struct VulnerabilityOccurrence {
2118 /// Output only. The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 where 0 indicates low severity and 10 indicates high severity.
2119 #[serde(rename = "cvssScore")]
2120 pub cvss_score: Option<f32>,
2121 /// The cvss v2 score for the vulnerability.
2122 #[serde(rename = "cvssV2")]
2123 pub cvss_v2: Option<CVSS>,
2124 /// Output only. CVSS version used to populate cvss_score and severity.
2125 #[serde(rename = "cvssVersion")]
2126 pub cvss_version: Option<String>,
2127 /// The cvss v3 score for the vulnerability.
2128 pub cvssv3: Option<CVSS>,
2129 /// The distro assigned severity for this vulnerability when it is available, otherwise this is the note provider assigned severity. When there are multiple PackageIssues for this vulnerability, they can have different effective severities because some might be provided by the distro while others are provided by the language ecosystem for a language pack. For this reason, it is advised to use the effective severity on the PackageIssue level. In the case where multiple PackageIssues have differing effective severities, this field should be the highest severity for any of the PackageIssues.
2130 #[serde(rename = "effectiveSeverity")]
2131 pub effective_severity: Option<String>,
2132 /// Occurrence-specific extra details about the vulnerability.
2133 #[serde(rename = "extraDetails")]
2134 pub extra_details: Option<String>,
2135 /// Output only. Whether at least one of the affected packages has a fix available.
2136 #[serde(rename = "fixAvailable")]
2137 pub fix_available: Option<bool>,
2138 /// Output only. A detailed description of this vulnerability.
2139 #[serde(rename = "longDescription")]
2140 pub long_description: Option<String>,
2141 /// Required. The set of affected locations and their fixes (if available) within the associated resource.
2142 #[serde(rename = "packageIssue")]
2143 pub package_issue: Option<Vec<PackageIssue>>,
2144 /// Output only. URLs related to this vulnerability.
2145 #[serde(rename = "relatedUrls")]
2146 pub related_urls: Option<Vec<RelatedUrl>>,
2147 /// Output only. The note provider assigned severity of this vulnerability.
2148 pub severity: Option<String>,
2149 /// Output only. A one sentence description of this vulnerability.
2150 #[serde(rename = "shortDescription")]
2151 pub short_description: Option<String>,
2152 /// The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
2153 #[serde(rename = "type")]
2154 pub type_: Option<String>,
2155 /// no description provided
2156 #[serde(rename = "vexAssessment")]
2157 pub vex_assessment: Option<VexAssessment>,
2158}
2159
2160impl common::Part for VulnerabilityOccurrence {}
2161
2162/// Windows Update represents the metadata about the update for the Windows operating system. The fields in this message come from the Windows Update API documented at https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdate.
2163///
2164/// This type is not used in any activity, and only used as *part* of another schema.
2165///
2166#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2167#[serde_with::serde_as]
2168#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2169pub struct WindowsUpdate {
2170 /// The list of categories to which the update belongs.
2171 pub categories: Option<Vec<Category>>,
2172 /// The localized description of the update.
2173 pub description: Option<String>,
2174 /// Required - The unique identifier for the update.
2175 pub identity: Option<Identity>,
2176 /// The Microsoft Knowledge Base article IDs that are associated with the update.
2177 #[serde(rename = "kbArticleIds")]
2178 pub kb_article_ids: Option<Vec<String>>,
2179 /// The last published timestamp of the update.
2180 #[serde(rename = "lastPublishedTimestamp")]
2181 pub last_published_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
2182 /// The hyperlink to the support information for the update.
2183 #[serde(rename = "supportUrl")]
2184 pub support_url: Option<String>,
2185 /// The localized title of the update.
2186 pub title: Option<String>,
2187}
2188
2189impl common::Part for WindowsUpdate {}
2190
2191// ###################
2192// MethodBuilders ###
2193// #################
2194
2195/// A builder providing access to all methods supported on *project* resources.
2196/// It is not used directly, but through the [`OnDemandScanning`] hub.
2197///
2198/// # Example
2199///
2200/// Instantiate a resource builder
2201///
2202/// ```test_harness,no_run
2203/// extern crate hyper;
2204/// extern crate hyper_rustls;
2205/// extern crate google_ondemandscanning1 as ondemandscanning1;
2206///
2207/// # async fn dox() {
2208/// use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2209///
2210/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2211/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2212/// secret,
2213/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2214/// ).build().await.unwrap();
2215///
2216/// let client = hyper_util::client::legacy::Client::builder(
2217/// hyper_util::rt::TokioExecutor::new()
2218/// )
2219/// .build(
2220/// hyper_rustls::HttpsConnectorBuilder::new()
2221/// .with_native_roots()
2222/// .unwrap()
2223/// .https_or_http()
2224/// .enable_http1()
2225/// .build()
2226/// );
2227/// let mut hub = OnDemandScanning::new(client, auth);
2228/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2229/// // like `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_operations_wait(...)`, `locations_scans_analyze_packages(...)` and `locations_scans_vulnerabilities_list(...)`
2230/// // to build up your call.
2231/// let rb = hub.projects();
2232/// # }
2233/// ```
2234pub struct ProjectMethods<'a, C>
2235where
2236 C: 'a,
2237{
2238 hub: &'a OnDemandScanning<C>,
2239}
2240
2241impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2242
2243impl<'a, C> ProjectMethods<'a, C> {
2244 /// Create a builder to help you perform the following task:
2245 ///
2246 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
2247 ///
2248 /// # Arguments
2249 ///
2250 /// * `name` - The name of the operation resource to be cancelled.
2251 pub fn locations_operations_cancel(
2252 &self,
2253 name: &str,
2254 ) -> ProjectLocationOperationCancelCall<'a, C> {
2255 ProjectLocationOperationCancelCall {
2256 hub: self.hub,
2257 _name: name.to_string(),
2258 _delegate: Default::default(),
2259 _additional_params: Default::default(),
2260 _scopes: Default::default(),
2261 }
2262 }
2263
2264 /// Create a builder to help you perform the following task:
2265 ///
2266 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2267 ///
2268 /// # Arguments
2269 ///
2270 /// * `name` - The name of the operation resource to be deleted.
2271 pub fn locations_operations_delete(
2272 &self,
2273 name: &str,
2274 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2275 ProjectLocationOperationDeleteCall {
2276 hub: self.hub,
2277 _name: name.to_string(),
2278 _delegate: Default::default(),
2279 _additional_params: Default::default(),
2280 _scopes: Default::default(),
2281 }
2282 }
2283
2284 /// Create a builder to help you perform the following task:
2285 ///
2286 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2287 ///
2288 /// # Arguments
2289 ///
2290 /// * `name` - The name of the operation resource.
2291 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2292 ProjectLocationOperationGetCall {
2293 hub: self.hub,
2294 _name: name.to_string(),
2295 _delegate: Default::default(),
2296 _additional_params: Default::default(),
2297 _scopes: Default::default(),
2298 }
2299 }
2300
2301 /// Create a builder to help you perform the following task:
2302 ///
2303 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2304 ///
2305 /// # Arguments
2306 ///
2307 /// * `name` - The name of the operation's parent resource.
2308 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2309 ProjectLocationOperationListCall {
2310 hub: self.hub,
2311 _name: name.to_string(),
2312 _page_token: Default::default(),
2313 _page_size: Default::default(),
2314 _filter: Default::default(),
2315 _delegate: Default::default(),
2316 _additional_params: Default::default(),
2317 _scopes: Default::default(),
2318 }
2319 }
2320
2321 /// Create a builder to help you perform the following task:
2322 ///
2323 /// Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
2324 ///
2325 /// # Arguments
2326 ///
2327 /// * `name` - The name of the operation resource to wait on.
2328 pub fn locations_operations_wait(&self, name: &str) -> ProjectLocationOperationWaitCall<'a, C> {
2329 ProjectLocationOperationWaitCall {
2330 hub: self.hub,
2331 _name: name.to_string(),
2332 _timeout: Default::default(),
2333 _delegate: Default::default(),
2334 _additional_params: Default::default(),
2335 _scopes: Default::default(),
2336 }
2337 }
2338
2339 /// Create a builder to help you perform the following task:
2340 ///
2341 /// Lists vulnerabilities resulting from a successfully completed scan.
2342 ///
2343 /// # Arguments
2344 ///
2345 /// * `parent` - Required. The parent of the collection of Vulnerabilities being requested. Format: projects/[project_name]/locations/[location]/scans/[scan_id]
2346 pub fn locations_scans_vulnerabilities_list(
2347 &self,
2348 parent: &str,
2349 ) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
2350 ProjectLocationScanVulnerabilityListCall {
2351 hub: self.hub,
2352 _parent: parent.to_string(),
2353 _page_token: Default::default(),
2354 _page_size: Default::default(),
2355 _delegate: Default::default(),
2356 _additional_params: Default::default(),
2357 _scopes: Default::default(),
2358 }
2359 }
2360
2361 /// Create a builder to help you perform the following task:
2362 ///
2363 /// Initiates an analysis of the provided packages.
2364 ///
2365 /// # Arguments
2366 ///
2367 /// * `request` - No description provided.
2368 /// * `parent` - Required. The parent of the resource for which analysis is requested. Format: projects/[project_name]/locations/[location]
2369 pub fn locations_scans_analyze_packages(
2370 &self,
2371 request: AnalyzePackagesRequestV1,
2372 parent: &str,
2373 ) -> ProjectLocationScanAnalyzePackageCall<'a, C> {
2374 ProjectLocationScanAnalyzePackageCall {
2375 hub: self.hub,
2376 _request: request,
2377 _parent: parent.to_string(),
2378 _delegate: Default::default(),
2379 _additional_params: Default::default(),
2380 _scopes: Default::default(),
2381 }
2382 }
2383}
2384
2385// ###################
2386// CallBuilders ###
2387// #################
2388
2389/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
2390///
2391/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
2392/// It is not used directly, but through a [`ProjectMethods`] instance.
2393///
2394/// # Example
2395///
2396/// Instantiate a resource method builder
2397///
2398/// ```test_harness,no_run
2399/// # extern crate hyper;
2400/// # extern crate hyper_rustls;
2401/// # extern crate google_ondemandscanning1 as ondemandscanning1;
2402/// # async fn dox() {
2403/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2404///
2405/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2406/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2407/// # secret,
2408/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2409/// # ).build().await.unwrap();
2410///
2411/// # let client = hyper_util::client::legacy::Client::builder(
2412/// # hyper_util::rt::TokioExecutor::new()
2413/// # )
2414/// # .build(
2415/// # hyper_rustls::HttpsConnectorBuilder::new()
2416/// # .with_native_roots()
2417/// # .unwrap()
2418/// # .https_or_http()
2419/// # .enable_http1()
2420/// # .build()
2421/// # );
2422/// # let mut hub = OnDemandScanning::new(client, auth);
2423/// // You can configure optional parameters by calling the respective setters at will, and
2424/// // execute the final call using `doit()`.
2425/// // Values shown here are possibly random and not representative !
2426/// let result = hub.projects().locations_operations_cancel("name")
2427/// .doit().await;
2428/// # }
2429/// ```
2430pub struct ProjectLocationOperationCancelCall<'a, C>
2431where
2432 C: 'a,
2433{
2434 hub: &'a OnDemandScanning<C>,
2435 _name: String,
2436 _delegate: Option<&'a mut dyn common::Delegate>,
2437 _additional_params: HashMap<String, String>,
2438 _scopes: BTreeSet<String>,
2439}
2440
2441impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
2442
2443impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
2444where
2445 C: common::Connector,
2446{
2447 /// Perform the operation you have build so far.
2448 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2449 use std::borrow::Cow;
2450 use std::io::{Read, Seek};
2451
2452 use common::{url::Params, ToParts};
2453 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2454
2455 let mut dd = common::DefaultDelegate;
2456 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2457 dlg.begin(common::MethodInfo {
2458 id: "ondemandscanning.projects.locations.operations.cancel",
2459 http_method: hyper::Method::POST,
2460 });
2461
2462 for &field in ["alt", "name"].iter() {
2463 if self._additional_params.contains_key(field) {
2464 dlg.finished(false);
2465 return Err(common::Error::FieldClash(field));
2466 }
2467 }
2468
2469 let mut params = Params::with_capacity(3 + self._additional_params.len());
2470 params.push("name", self._name);
2471
2472 params.extend(self._additional_params.iter());
2473
2474 params.push("alt", "json");
2475 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
2476 if self._scopes.is_empty() {
2477 self._scopes
2478 .insert(Scope::CloudPlatform.as_ref().to_string());
2479 }
2480
2481 #[allow(clippy::single_element_loop)]
2482 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2483 url = params.uri_replacement(url, param_name, find_this, true);
2484 }
2485 {
2486 let to_remove = ["name"];
2487 params.remove_params(&to_remove);
2488 }
2489
2490 let url = params.parse_with_url(&url);
2491
2492 loop {
2493 let token = match self
2494 .hub
2495 .auth
2496 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2497 .await
2498 {
2499 Ok(token) => token,
2500 Err(e) => match dlg.token(e) {
2501 Ok(token) => token,
2502 Err(e) => {
2503 dlg.finished(false);
2504 return Err(common::Error::MissingToken(e));
2505 }
2506 },
2507 };
2508 let mut req_result = {
2509 let client = &self.hub.client;
2510 dlg.pre_request();
2511 let mut req_builder = hyper::Request::builder()
2512 .method(hyper::Method::POST)
2513 .uri(url.as_str())
2514 .header(USER_AGENT, self.hub._user_agent.clone());
2515
2516 if let Some(token) = token.as_ref() {
2517 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2518 }
2519
2520 let request = req_builder
2521 .header(CONTENT_LENGTH, 0_u64)
2522 .body(common::to_body::<String>(None));
2523
2524 client.request(request.unwrap()).await
2525 };
2526
2527 match req_result {
2528 Err(err) => {
2529 if let common::Retry::After(d) = dlg.http_error(&err) {
2530 sleep(d).await;
2531 continue;
2532 }
2533 dlg.finished(false);
2534 return Err(common::Error::HttpError(err));
2535 }
2536 Ok(res) => {
2537 let (mut parts, body) = res.into_parts();
2538 let mut body = common::Body::new(body);
2539 if !parts.status.is_success() {
2540 let bytes = common::to_bytes(body).await.unwrap_or_default();
2541 let error = serde_json::from_str(&common::to_string(&bytes));
2542 let response = common::to_response(parts, bytes.into());
2543
2544 if let common::Retry::After(d) =
2545 dlg.http_failure(&response, error.as_ref().ok())
2546 {
2547 sleep(d).await;
2548 continue;
2549 }
2550
2551 dlg.finished(false);
2552
2553 return Err(match error {
2554 Ok(value) => common::Error::BadRequest(value),
2555 _ => common::Error::Failure(response),
2556 });
2557 }
2558 let response = {
2559 let bytes = common::to_bytes(body).await.unwrap_or_default();
2560 let encoded = common::to_string(&bytes);
2561 match serde_json::from_str(&encoded) {
2562 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2563 Err(error) => {
2564 dlg.response_json_decode_error(&encoded, &error);
2565 return Err(common::Error::JsonDecodeError(
2566 encoded.to_string(),
2567 error,
2568 ));
2569 }
2570 }
2571 };
2572
2573 dlg.finished(true);
2574 return Ok(response);
2575 }
2576 }
2577 }
2578 }
2579
2580 /// The name of the operation resource to be cancelled.
2581 ///
2582 /// Sets the *name* path property to the given value.
2583 ///
2584 /// Even though the property as already been set when instantiating this call,
2585 /// we provide this method for API completeness.
2586 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
2587 self._name = new_value.to_string();
2588 self
2589 }
2590 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2591 /// while executing the actual API request.
2592 ///
2593 /// ````text
2594 /// It should be used to handle progress information, and to implement a certain level of resilience.
2595 /// ````
2596 ///
2597 /// Sets the *delegate* property to the given value.
2598 pub fn delegate(
2599 mut self,
2600 new_value: &'a mut dyn common::Delegate,
2601 ) -> ProjectLocationOperationCancelCall<'a, C> {
2602 self._delegate = Some(new_value);
2603 self
2604 }
2605
2606 /// Set any additional parameter of the query string used in the request.
2607 /// It should be used to set parameters which are not yet available through their own
2608 /// setters.
2609 ///
2610 /// Please note that this method must not be used to set any of the known parameters
2611 /// which have their own setter method. If done anyway, the request will fail.
2612 ///
2613 /// # Additional Parameters
2614 ///
2615 /// * *$.xgafv* (query-string) - V1 error format.
2616 /// * *access_token* (query-string) - OAuth access token.
2617 /// * *alt* (query-string) - Data format for response.
2618 /// * *callback* (query-string) - JSONP
2619 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2620 /// * *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.
2621 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2622 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2623 /// * *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.
2624 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2625 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2626 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
2627 where
2628 T: AsRef<str>,
2629 {
2630 self._additional_params
2631 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2632 self
2633 }
2634
2635 /// Identifies the authorization scope for the method you are building.
2636 ///
2637 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2638 /// [`Scope::CloudPlatform`].
2639 ///
2640 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2641 /// tokens for more than one scope.
2642 ///
2643 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2644 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2645 /// sufficient, a read-write scope will do as well.
2646 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
2647 where
2648 St: AsRef<str>,
2649 {
2650 self._scopes.insert(String::from(scope.as_ref()));
2651 self
2652 }
2653 /// Identifies the authorization scope(s) for the method you are building.
2654 ///
2655 /// See [`Self::add_scope()`] for details.
2656 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
2657 where
2658 I: IntoIterator<Item = St>,
2659 St: AsRef<str>,
2660 {
2661 self._scopes
2662 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2663 self
2664 }
2665
2666 /// Removes all scopes, and no default scope will be used either.
2667 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2668 /// for details).
2669 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
2670 self._scopes.clear();
2671 self
2672 }
2673}
2674
2675/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2676///
2677/// A builder for the *locations.operations.delete* method supported by a *project* resource.
2678/// It is not used directly, but through a [`ProjectMethods`] instance.
2679///
2680/// # Example
2681///
2682/// Instantiate a resource method builder
2683///
2684/// ```test_harness,no_run
2685/// # extern crate hyper;
2686/// # extern crate hyper_rustls;
2687/// # extern crate google_ondemandscanning1 as ondemandscanning1;
2688/// # async fn dox() {
2689/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2690///
2691/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2693/// # secret,
2694/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2695/// # ).build().await.unwrap();
2696///
2697/// # let client = hyper_util::client::legacy::Client::builder(
2698/// # hyper_util::rt::TokioExecutor::new()
2699/// # )
2700/// # .build(
2701/// # hyper_rustls::HttpsConnectorBuilder::new()
2702/// # .with_native_roots()
2703/// # .unwrap()
2704/// # .https_or_http()
2705/// # .enable_http1()
2706/// # .build()
2707/// # );
2708/// # let mut hub = OnDemandScanning::new(client, auth);
2709/// // You can configure optional parameters by calling the respective setters at will, and
2710/// // execute the final call using `doit()`.
2711/// // Values shown here are possibly random and not representative !
2712/// let result = hub.projects().locations_operations_delete("name")
2713/// .doit().await;
2714/// # }
2715/// ```
2716pub struct ProjectLocationOperationDeleteCall<'a, C>
2717where
2718 C: 'a,
2719{
2720 hub: &'a OnDemandScanning<C>,
2721 _name: String,
2722 _delegate: Option<&'a mut dyn common::Delegate>,
2723 _additional_params: HashMap<String, String>,
2724 _scopes: BTreeSet<String>,
2725}
2726
2727impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
2728
2729impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
2730where
2731 C: common::Connector,
2732{
2733 /// Perform the operation you have build so far.
2734 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2735 use std::borrow::Cow;
2736 use std::io::{Read, Seek};
2737
2738 use common::{url::Params, ToParts};
2739 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2740
2741 let mut dd = common::DefaultDelegate;
2742 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2743 dlg.begin(common::MethodInfo {
2744 id: "ondemandscanning.projects.locations.operations.delete",
2745 http_method: hyper::Method::DELETE,
2746 });
2747
2748 for &field in ["alt", "name"].iter() {
2749 if self._additional_params.contains_key(field) {
2750 dlg.finished(false);
2751 return Err(common::Error::FieldClash(field));
2752 }
2753 }
2754
2755 let mut params = Params::with_capacity(3 + self._additional_params.len());
2756 params.push("name", self._name);
2757
2758 params.extend(self._additional_params.iter());
2759
2760 params.push("alt", "json");
2761 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2762 if self._scopes.is_empty() {
2763 self._scopes
2764 .insert(Scope::CloudPlatform.as_ref().to_string());
2765 }
2766
2767 #[allow(clippy::single_element_loop)]
2768 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2769 url = params.uri_replacement(url, param_name, find_this, true);
2770 }
2771 {
2772 let to_remove = ["name"];
2773 params.remove_params(&to_remove);
2774 }
2775
2776 let url = params.parse_with_url(&url);
2777
2778 loop {
2779 let token = match self
2780 .hub
2781 .auth
2782 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2783 .await
2784 {
2785 Ok(token) => token,
2786 Err(e) => match dlg.token(e) {
2787 Ok(token) => token,
2788 Err(e) => {
2789 dlg.finished(false);
2790 return Err(common::Error::MissingToken(e));
2791 }
2792 },
2793 };
2794 let mut req_result = {
2795 let client = &self.hub.client;
2796 dlg.pre_request();
2797 let mut req_builder = hyper::Request::builder()
2798 .method(hyper::Method::DELETE)
2799 .uri(url.as_str())
2800 .header(USER_AGENT, self.hub._user_agent.clone());
2801
2802 if let Some(token) = token.as_ref() {
2803 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2804 }
2805
2806 let request = req_builder
2807 .header(CONTENT_LENGTH, 0_u64)
2808 .body(common::to_body::<String>(None));
2809
2810 client.request(request.unwrap()).await
2811 };
2812
2813 match req_result {
2814 Err(err) => {
2815 if let common::Retry::After(d) = dlg.http_error(&err) {
2816 sleep(d).await;
2817 continue;
2818 }
2819 dlg.finished(false);
2820 return Err(common::Error::HttpError(err));
2821 }
2822 Ok(res) => {
2823 let (mut parts, body) = res.into_parts();
2824 let mut body = common::Body::new(body);
2825 if !parts.status.is_success() {
2826 let bytes = common::to_bytes(body).await.unwrap_or_default();
2827 let error = serde_json::from_str(&common::to_string(&bytes));
2828 let response = common::to_response(parts, bytes.into());
2829
2830 if let common::Retry::After(d) =
2831 dlg.http_failure(&response, error.as_ref().ok())
2832 {
2833 sleep(d).await;
2834 continue;
2835 }
2836
2837 dlg.finished(false);
2838
2839 return Err(match error {
2840 Ok(value) => common::Error::BadRequest(value),
2841 _ => common::Error::Failure(response),
2842 });
2843 }
2844 let response = {
2845 let bytes = common::to_bytes(body).await.unwrap_or_default();
2846 let encoded = common::to_string(&bytes);
2847 match serde_json::from_str(&encoded) {
2848 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2849 Err(error) => {
2850 dlg.response_json_decode_error(&encoded, &error);
2851 return Err(common::Error::JsonDecodeError(
2852 encoded.to_string(),
2853 error,
2854 ));
2855 }
2856 }
2857 };
2858
2859 dlg.finished(true);
2860 return Ok(response);
2861 }
2862 }
2863 }
2864 }
2865
2866 /// The name of the operation resource to be deleted.
2867 ///
2868 /// Sets the *name* path property to the given value.
2869 ///
2870 /// Even though the property as already been set when instantiating this call,
2871 /// we provide this method for API completeness.
2872 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
2873 self._name = new_value.to_string();
2874 self
2875 }
2876 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2877 /// while executing the actual API request.
2878 ///
2879 /// ````text
2880 /// It should be used to handle progress information, and to implement a certain level of resilience.
2881 /// ````
2882 ///
2883 /// Sets the *delegate* property to the given value.
2884 pub fn delegate(
2885 mut self,
2886 new_value: &'a mut dyn common::Delegate,
2887 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2888 self._delegate = Some(new_value);
2889 self
2890 }
2891
2892 /// Set any additional parameter of the query string used in the request.
2893 /// It should be used to set parameters which are not yet available through their own
2894 /// setters.
2895 ///
2896 /// Please note that this method must not be used to set any of the known parameters
2897 /// which have their own setter method. If done anyway, the request will fail.
2898 ///
2899 /// # Additional Parameters
2900 ///
2901 /// * *$.xgafv* (query-string) - V1 error format.
2902 /// * *access_token* (query-string) - OAuth access token.
2903 /// * *alt* (query-string) - Data format for response.
2904 /// * *callback* (query-string) - JSONP
2905 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2906 /// * *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.
2907 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2908 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2909 /// * *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.
2910 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2911 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2912 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
2913 where
2914 T: AsRef<str>,
2915 {
2916 self._additional_params
2917 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2918 self
2919 }
2920
2921 /// Identifies the authorization scope for the method you are building.
2922 ///
2923 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2924 /// [`Scope::CloudPlatform`].
2925 ///
2926 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2927 /// tokens for more than one scope.
2928 ///
2929 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2930 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2931 /// sufficient, a read-write scope will do as well.
2932 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
2933 where
2934 St: AsRef<str>,
2935 {
2936 self._scopes.insert(String::from(scope.as_ref()));
2937 self
2938 }
2939 /// Identifies the authorization scope(s) for the method you are building.
2940 ///
2941 /// See [`Self::add_scope()`] for details.
2942 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
2943 where
2944 I: IntoIterator<Item = St>,
2945 St: AsRef<str>,
2946 {
2947 self._scopes
2948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2949 self
2950 }
2951
2952 /// Removes all scopes, and no default scope will be used either.
2953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2954 /// for details).
2955 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
2956 self._scopes.clear();
2957 self
2958 }
2959}
2960
2961/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2962///
2963/// A builder for the *locations.operations.get* method supported by a *project* resource.
2964/// It is not used directly, but through a [`ProjectMethods`] instance.
2965///
2966/// # Example
2967///
2968/// Instantiate a resource method builder
2969///
2970/// ```test_harness,no_run
2971/// # extern crate hyper;
2972/// # extern crate hyper_rustls;
2973/// # extern crate google_ondemandscanning1 as ondemandscanning1;
2974/// # async fn dox() {
2975/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2976///
2977/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2979/// # secret,
2980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2981/// # ).build().await.unwrap();
2982///
2983/// # let client = hyper_util::client::legacy::Client::builder(
2984/// # hyper_util::rt::TokioExecutor::new()
2985/// # )
2986/// # .build(
2987/// # hyper_rustls::HttpsConnectorBuilder::new()
2988/// # .with_native_roots()
2989/// # .unwrap()
2990/// # .https_or_http()
2991/// # .enable_http1()
2992/// # .build()
2993/// # );
2994/// # let mut hub = OnDemandScanning::new(client, auth);
2995/// // You can configure optional parameters by calling the respective setters at will, and
2996/// // execute the final call using `doit()`.
2997/// // Values shown here are possibly random and not representative !
2998/// let result = hub.projects().locations_operations_get("name")
2999/// .doit().await;
3000/// # }
3001/// ```
3002pub struct ProjectLocationOperationGetCall<'a, C>
3003where
3004 C: 'a,
3005{
3006 hub: &'a OnDemandScanning<C>,
3007 _name: String,
3008 _delegate: Option<&'a mut dyn common::Delegate>,
3009 _additional_params: HashMap<String, String>,
3010 _scopes: BTreeSet<String>,
3011}
3012
3013impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
3014
3015impl<'a, C> ProjectLocationOperationGetCall<'a, C>
3016where
3017 C: common::Connector,
3018{
3019 /// Perform the operation you have build so far.
3020 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3021 use std::borrow::Cow;
3022 use std::io::{Read, Seek};
3023
3024 use common::{url::Params, ToParts};
3025 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3026
3027 let mut dd = common::DefaultDelegate;
3028 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3029 dlg.begin(common::MethodInfo {
3030 id: "ondemandscanning.projects.locations.operations.get",
3031 http_method: hyper::Method::GET,
3032 });
3033
3034 for &field in ["alt", "name"].iter() {
3035 if self._additional_params.contains_key(field) {
3036 dlg.finished(false);
3037 return Err(common::Error::FieldClash(field));
3038 }
3039 }
3040
3041 let mut params = Params::with_capacity(3 + self._additional_params.len());
3042 params.push("name", self._name);
3043
3044 params.extend(self._additional_params.iter());
3045
3046 params.push("alt", "json");
3047 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3048 if self._scopes.is_empty() {
3049 self._scopes
3050 .insert(Scope::CloudPlatform.as_ref().to_string());
3051 }
3052
3053 #[allow(clippy::single_element_loop)]
3054 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3055 url = params.uri_replacement(url, param_name, find_this, true);
3056 }
3057 {
3058 let to_remove = ["name"];
3059 params.remove_params(&to_remove);
3060 }
3061
3062 let url = params.parse_with_url(&url);
3063
3064 loop {
3065 let token = match self
3066 .hub
3067 .auth
3068 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3069 .await
3070 {
3071 Ok(token) => token,
3072 Err(e) => match dlg.token(e) {
3073 Ok(token) => token,
3074 Err(e) => {
3075 dlg.finished(false);
3076 return Err(common::Error::MissingToken(e));
3077 }
3078 },
3079 };
3080 let mut req_result = {
3081 let client = &self.hub.client;
3082 dlg.pre_request();
3083 let mut req_builder = hyper::Request::builder()
3084 .method(hyper::Method::GET)
3085 .uri(url.as_str())
3086 .header(USER_AGENT, self.hub._user_agent.clone());
3087
3088 if let Some(token) = token.as_ref() {
3089 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3090 }
3091
3092 let request = req_builder
3093 .header(CONTENT_LENGTH, 0_u64)
3094 .body(common::to_body::<String>(None));
3095
3096 client.request(request.unwrap()).await
3097 };
3098
3099 match req_result {
3100 Err(err) => {
3101 if let common::Retry::After(d) = dlg.http_error(&err) {
3102 sleep(d).await;
3103 continue;
3104 }
3105 dlg.finished(false);
3106 return Err(common::Error::HttpError(err));
3107 }
3108 Ok(res) => {
3109 let (mut parts, body) = res.into_parts();
3110 let mut body = common::Body::new(body);
3111 if !parts.status.is_success() {
3112 let bytes = common::to_bytes(body).await.unwrap_or_default();
3113 let error = serde_json::from_str(&common::to_string(&bytes));
3114 let response = common::to_response(parts, bytes.into());
3115
3116 if let common::Retry::After(d) =
3117 dlg.http_failure(&response, error.as_ref().ok())
3118 {
3119 sleep(d).await;
3120 continue;
3121 }
3122
3123 dlg.finished(false);
3124
3125 return Err(match error {
3126 Ok(value) => common::Error::BadRequest(value),
3127 _ => common::Error::Failure(response),
3128 });
3129 }
3130 let response = {
3131 let bytes = common::to_bytes(body).await.unwrap_or_default();
3132 let encoded = common::to_string(&bytes);
3133 match serde_json::from_str(&encoded) {
3134 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3135 Err(error) => {
3136 dlg.response_json_decode_error(&encoded, &error);
3137 return Err(common::Error::JsonDecodeError(
3138 encoded.to_string(),
3139 error,
3140 ));
3141 }
3142 }
3143 };
3144
3145 dlg.finished(true);
3146 return Ok(response);
3147 }
3148 }
3149 }
3150 }
3151
3152 /// The name of the operation resource.
3153 ///
3154 /// Sets the *name* path property to the given value.
3155 ///
3156 /// Even though the property as already been set when instantiating this call,
3157 /// we provide this method for API completeness.
3158 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
3159 self._name = new_value.to_string();
3160 self
3161 }
3162 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3163 /// while executing the actual API request.
3164 ///
3165 /// ````text
3166 /// It should be used to handle progress information, and to implement a certain level of resilience.
3167 /// ````
3168 ///
3169 /// Sets the *delegate* property to the given value.
3170 pub fn delegate(
3171 mut self,
3172 new_value: &'a mut dyn common::Delegate,
3173 ) -> ProjectLocationOperationGetCall<'a, C> {
3174 self._delegate = Some(new_value);
3175 self
3176 }
3177
3178 /// Set any additional parameter of the query string used in the request.
3179 /// It should be used to set parameters which are not yet available through their own
3180 /// setters.
3181 ///
3182 /// Please note that this method must not be used to set any of the known parameters
3183 /// which have their own setter method. If done anyway, the request will fail.
3184 ///
3185 /// # Additional Parameters
3186 ///
3187 /// * *$.xgafv* (query-string) - V1 error format.
3188 /// * *access_token* (query-string) - OAuth access token.
3189 /// * *alt* (query-string) - Data format for response.
3190 /// * *callback* (query-string) - JSONP
3191 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3192 /// * *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.
3193 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3194 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3195 /// * *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.
3196 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3197 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3198 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
3199 where
3200 T: AsRef<str>,
3201 {
3202 self._additional_params
3203 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3204 self
3205 }
3206
3207 /// Identifies the authorization scope for the method you are building.
3208 ///
3209 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3210 /// [`Scope::CloudPlatform`].
3211 ///
3212 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3213 /// tokens for more than one scope.
3214 ///
3215 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3216 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3217 /// sufficient, a read-write scope will do as well.
3218 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
3219 where
3220 St: AsRef<str>,
3221 {
3222 self._scopes.insert(String::from(scope.as_ref()));
3223 self
3224 }
3225 /// Identifies the authorization scope(s) for the method you are building.
3226 ///
3227 /// See [`Self::add_scope()`] for details.
3228 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
3229 where
3230 I: IntoIterator<Item = St>,
3231 St: AsRef<str>,
3232 {
3233 self._scopes
3234 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3235 self
3236 }
3237
3238 /// Removes all scopes, and no default scope will be used either.
3239 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3240 /// for details).
3241 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
3242 self._scopes.clear();
3243 self
3244 }
3245}
3246
3247/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3248///
3249/// A builder for the *locations.operations.list* method supported by a *project* resource.
3250/// It is not used directly, but through a [`ProjectMethods`] instance.
3251///
3252/// # Example
3253///
3254/// Instantiate a resource method builder
3255///
3256/// ```test_harness,no_run
3257/// # extern crate hyper;
3258/// # extern crate hyper_rustls;
3259/// # extern crate google_ondemandscanning1 as ondemandscanning1;
3260/// # async fn dox() {
3261/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3262///
3263/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3264/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3265/// # secret,
3266/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3267/// # ).build().await.unwrap();
3268///
3269/// # let client = hyper_util::client::legacy::Client::builder(
3270/// # hyper_util::rt::TokioExecutor::new()
3271/// # )
3272/// # .build(
3273/// # hyper_rustls::HttpsConnectorBuilder::new()
3274/// # .with_native_roots()
3275/// # .unwrap()
3276/// # .https_or_http()
3277/// # .enable_http1()
3278/// # .build()
3279/// # );
3280/// # let mut hub = OnDemandScanning::new(client, auth);
3281/// // You can configure optional parameters by calling the respective setters at will, and
3282/// // execute the final call using `doit()`.
3283/// // Values shown here are possibly random and not representative !
3284/// let result = hub.projects().locations_operations_list("name")
3285/// .page_token("amet.")
3286/// .page_size(-20)
3287/// .filter("ipsum")
3288/// .doit().await;
3289/// # }
3290/// ```
3291pub struct ProjectLocationOperationListCall<'a, C>
3292where
3293 C: 'a,
3294{
3295 hub: &'a OnDemandScanning<C>,
3296 _name: String,
3297 _page_token: Option<String>,
3298 _page_size: Option<i32>,
3299 _filter: Option<String>,
3300 _delegate: Option<&'a mut dyn common::Delegate>,
3301 _additional_params: HashMap<String, String>,
3302 _scopes: BTreeSet<String>,
3303}
3304
3305impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
3306
3307impl<'a, C> ProjectLocationOperationListCall<'a, C>
3308where
3309 C: common::Connector,
3310{
3311 /// Perform the operation you have build so far.
3312 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
3313 use std::borrow::Cow;
3314 use std::io::{Read, Seek};
3315
3316 use common::{url::Params, ToParts};
3317 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3318
3319 let mut dd = common::DefaultDelegate;
3320 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3321 dlg.begin(common::MethodInfo {
3322 id: "ondemandscanning.projects.locations.operations.list",
3323 http_method: hyper::Method::GET,
3324 });
3325
3326 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
3327 if self._additional_params.contains_key(field) {
3328 dlg.finished(false);
3329 return Err(common::Error::FieldClash(field));
3330 }
3331 }
3332
3333 let mut params = Params::with_capacity(6 + self._additional_params.len());
3334 params.push("name", self._name);
3335 if let Some(value) = self._page_token.as_ref() {
3336 params.push("pageToken", value);
3337 }
3338 if let Some(value) = self._page_size.as_ref() {
3339 params.push("pageSize", value.to_string());
3340 }
3341 if let Some(value) = self._filter.as_ref() {
3342 params.push("filter", value);
3343 }
3344
3345 params.extend(self._additional_params.iter());
3346
3347 params.push("alt", "json");
3348 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
3349 if self._scopes.is_empty() {
3350 self._scopes
3351 .insert(Scope::CloudPlatform.as_ref().to_string());
3352 }
3353
3354 #[allow(clippy::single_element_loop)]
3355 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3356 url = params.uri_replacement(url, param_name, find_this, true);
3357 }
3358 {
3359 let to_remove = ["name"];
3360 params.remove_params(&to_remove);
3361 }
3362
3363 let url = params.parse_with_url(&url);
3364
3365 loop {
3366 let token = match self
3367 .hub
3368 .auth
3369 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3370 .await
3371 {
3372 Ok(token) => token,
3373 Err(e) => match dlg.token(e) {
3374 Ok(token) => token,
3375 Err(e) => {
3376 dlg.finished(false);
3377 return Err(common::Error::MissingToken(e));
3378 }
3379 },
3380 };
3381 let mut req_result = {
3382 let client = &self.hub.client;
3383 dlg.pre_request();
3384 let mut req_builder = hyper::Request::builder()
3385 .method(hyper::Method::GET)
3386 .uri(url.as_str())
3387 .header(USER_AGENT, self.hub._user_agent.clone());
3388
3389 if let Some(token) = token.as_ref() {
3390 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3391 }
3392
3393 let request = req_builder
3394 .header(CONTENT_LENGTH, 0_u64)
3395 .body(common::to_body::<String>(None));
3396
3397 client.request(request.unwrap()).await
3398 };
3399
3400 match req_result {
3401 Err(err) => {
3402 if let common::Retry::After(d) = dlg.http_error(&err) {
3403 sleep(d).await;
3404 continue;
3405 }
3406 dlg.finished(false);
3407 return Err(common::Error::HttpError(err));
3408 }
3409 Ok(res) => {
3410 let (mut parts, body) = res.into_parts();
3411 let mut body = common::Body::new(body);
3412 if !parts.status.is_success() {
3413 let bytes = common::to_bytes(body).await.unwrap_or_default();
3414 let error = serde_json::from_str(&common::to_string(&bytes));
3415 let response = common::to_response(parts, bytes.into());
3416
3417 if let common::Retry::After(d) =
3418 dlg.http_failure(&response, error.as_ref().ok())
3419 {
3420 sleep(d).await;
3421 continue;
3422 }
3423
3424 dlg.finished(false);
3425
3426 return Err(match error {
3427 Ok(value) => common::Error::BadRequest(value),
3428 _ => common::Error::Failure(response),
3429 });
3430 }
3431 let response = {
3432 let bytes = common::to_bytes(body).await.unwrap_or_default();
3433 let encoded = common::to_string(&bytes);
3434 match serde_json::from_str(&encoded) {
3435 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3436 Err(error) => {
3437 dlg.response_json_decode_error(&encoded, &error);
3438 return Err(common::Error::JsonDecodeError(
3439 encoded.to_string(),
3440 error,
3441 ));
3442 }
3443 }
3444 };
3445
3446 dlg.finished(true);
3447 return Ok(response);
3448 }
3449 }
3450 }
3451 }
3452
3453 /// The name of the operation's parent resource.
3454 ///
3455 /// Sets the *name* path property to the given value.
3456 ///
3457 /// Even though the property as already been set when instantiating this call,
3458 /// we provide this method for API completeness.
3459 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3460 self._name = new_value.to_string();
3461 self
3462 }
3463 /// The standard list page token.
3464 ///
3465 /// Sets the *page token* query property to the given value.
3466 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3467 self._page_token = Some(new_value.to_string());
3468 self
3469 }
3470 /// The standard list page size.
3471 ///
3472 /// Sets the *page size* query property to the given value.
3473 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
3474 self._page_size = Some(new_value);
3475 self
3476 }
3477 /// The standard list filter.
3478 ///
3479 /// Sets the *filter* query property to the given value.
3480 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
3481 self._filter = Some(new_value.to_string());
3482 self
3483 }
3484 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3485 /// while executing the actual API request.
3486 ///
3487 /// ````text
3488 /// It should be used to handle progress information, and to implement a certain level of resilience.
3489 /// ````
3490 ///
3491 /// Sets the *delegate* property to the given value.
3492 pub fn delegate(
3493 mut self,
3494 new_value: &'a mut dyn common::Delegate,
3495 ) -> ProjectLocationOperationListCall<'a, C> {
3496 self._delegate = Some(new_value);
3497 self
3498 }
3499
3500 /// Set any additional parameter of the query string used in the request.
3501 /// It should be used to set parameters which are not yet available through their own
3502 /// setters.
3503 ///
3504 /// Please note that this method must not be used to set any of the known parameters
3505 /// which have their own setter method. If done anyway, the request will fail.
3506 ///
3507 /// # Additional Parameters
3508 ///
3509 /// * *$.xgafv* (query-string) - V1 error format.
3510 /// * *access_token* (query-string) - OAuth access token.
3511 /// * *alt* (query-string) - Data format for response.
3512 /// * *callback* (query-string) - JSONP
3513 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3514 /// * *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.
3515 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3516 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3517 /// * *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.
3518 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3519 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3520 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
3521 where
3522 T: AsRef<str>,
3523 {
3524 self._additional_params
3525 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3526 self
3527 }
3528
3529 /// Identifies the authorization scope for the method you are building.
3530 ///
3531 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3532 /// [`Scope::CloudPlatform`].
3533 ///
3534 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3535 /// tokens for more than one scope.
3536 ///
3537 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3538 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3539 /// sufficient, a read-write scope will do as well.
3540 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
3541 where
3542 St: AsRef<str>,
3543 {
3544 self._scopes.insert(String::from(scope.as_ref()));
3545 self
3546 }
3547 /// Identifies the authorization scope(s) for the method you are building.
3548 ///
3549 /// See [`Self::add_scope()`] for details.
3550 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
3551 where
3552 I: IntoIterator<Item = St>,
3553 St: AsRef<str>,
3554 {
3555 self._scopes
3556 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3557 self
3558 }
3559
3560 /// Removes all scopes, and no default scope will be used either.
3561 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3562 /// for details).
3563 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
3564 self._scopes.clear();
3565 self
3566 }
3567}
3568
3569/// Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
3570///
3571/// A builder for the *locations.operations.wait* method supported by a *project* resource.
3572/// It is not used directly, but through a [`ProjectMethods`] instance.
3573///
3574/// # Example
3575///
3576/// Instantiate a resource method builder
3577///
3578/// ```test_harness,no_run
3579/// # extern crate hyper;
3580/// # extern crate hyper_rustls;
3581/// # extern crate google_ondemandscanning1 as ondemandscanning1;
3582/// # async fn dox() {
3583/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3584///
3585/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3586/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3587/// # secret,
3588/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3589/// # ).build().await.unwrap();
3590///
3591/// # let client = hyper_util::client::legacy::Client::builder(
3592/// # hyper_util::rt::TokioExecutor::new()
3593/// # )
3594/// # .build(
3595/// # hyper_rustls::HttpsConnectorBuilder::new()
3596/// # .with_native_roots()
3597/// # .unwrap()
3598/// # .https_or_http()
3599/// # .enable_http1()
3600/// # .build()
3601/// # );
3602/// # let mut hub = OnDemandScanning::new(client, auth);
3603/// // You can configure optional parameters by calling the respective setters at will, and
3604/// // execute the final call using `doit()`.
3605/// // Values shown here are possibly random and not representative !
3606/// let result = hub.projects().locations_operations_wait("name")
3607/// .timeout(chrono::Duration::seconds(6569141))
3608/// .doit().await;
3609/// # }
3610/// ```
3611pub struct ProjectLocationOperationWaitCall<'a, C>
3612where
3613 C: 'a,
3614{
3615 hub: &'a OnDemandScanning<C>,
3616 _name: String,
3617 _timeout: Option<chrono::Duration>,
3618 _delegate: Option<&'a mut dyn common::Delegate>,
3619 _additional_params: HashMap<String, String>,
3620 _scopes: BTreeSet<String>,
3621}
3622
3623impl<'a, C> common::CallBuilder for ProjectLocationOperationWaitCall<'a, C> {}
3624
3625impl<'a, C> ProjectLocationOperationWaitCall<'a, C>
3626where
3627 C: common::Connector,
3628{
3629 /// Perform the operation you have build so far.
3630 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3631 use std::borrow::Cow;
3632 use std::io::{Read, Seek};
3633
3634 use common::{url::Params, ToParts};
3635 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3636
3637 let mut dd = common::DefaultDelegate;
3638 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3639 dlg.begin(common::MethodInfo {
3640 id: "ondemandscanning.projects.locations.operations.wait",
3641 http_method: hyper::Method::POST,
3642 });
3643
3644 for &field in ["alt", "name", "timeout"].iter() {
3645 if self._additional_params.contains_key(field) {
3646 dlg.finished(false);
3647 return Err(common::Error::FieldClash(field));
3648 }
3649 }
3650
3651 let mut params = Params::with_capacity(4 + self._additional_params.len());
3652 params.push("name", self._name);
3653 if let Some(value) = self._timeout.as_ref() {
3654 params.push("timeout", common::serde::duration::to_string(&value));
3655 }
3656
3657 params.extend(self._additional_params.iter());
3658
3659 params.push("alt", "json");
3660 let mut url = self.hub._base_url.clone() + "v1/{+name}:wait";
3661 if self._scopes.is_empty() {
3662 self._scopes
3663 .insert(Scope::CloudPlatform.as_ref().to_string());
3664 }
3665
3666 #[allow(clippy::single_element_loop)]
3667 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3668 url = params.uri_replacement(url, param_name, find_this, true);
3669 }
3670 {
3671 let to_remove = ["name"];
3672 params.remove_params(&to_remove);
3673 }
3674
3675 let url = params.parse_with_url(&url);
3676
3677 loop {
3678 let token = match self
3679 .hub
3680 .auth
3681 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3682 .await
3683 {
3684 Ok(token) => token,
3685 Err(e) => match dlg.token(e) {
3686 Ok(token) => token,
3687 Err(e) => {
3688 dlg.finished(false);
3689 return Err(common::Error::MissingToken(e));
3690 }
3691 },
3692 };
3693 let mut req_result = {
3694 let client = &self.hub.client;
3695 dlg.pre_request();
3696 let mut req_builder = hyper::Request::builder()
3697 .method(hyper::Method::POST)
3698 .uri(url.as_str())
3699 .header(USER_AGENT, self.hub._user_agent.clone());
3700
3701 if let Some(token) = token.as_ref() {
3702 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3703 }
3704
3705 let request = req_builder
3706 .header(CONTENT_LENGTH, 0_u64)
3707 .body(common::to_body::<String>(None));
3708
3709 client.request(request.unwrap()).await
3710 };
3711
3712 match req_result {
3713 Err(err) => {
3714 if let common::Retry::After(d) = dlg.http_error(&err) {
3715 sleep(d).await;
3716 continue;
3717 }
3718 dlg.finished(false);
3719 return Err(common::Error::HttpError(err));
3720 }
3721 Ok(res) => {
3722 let (mut parts, body) = res.into_parts();
3723 let mut body = common::Body::new(body);
3724 if !parts.status.is_success() {
3725 let bytes = common::to_bytes(body).await.unwrap_or_default();
3726 let error = serde_json::from_str(&common::to_string(&bytes));
3727 let response = common::to_response(parts, bytes.into());
3728
3729 if let common::Retry::After(d) =
3730 dlg.http_failure(&response, error.as_ref().ok())
3731 {
3732 sleep(d).await;
3733 continue;
3734 }
3735
3736 dlg.finished(false);
3737
3738 return Err(match error {
3739 Ok(value) => common::Error::BadRequest(value),
3740 _ => common::Error::Failure(response),
3741 });
3742 }
3743 let response = {
3744 let bytes = common::to_bytes(body).await.unwrap_or_default();
3745 let encoded = common::to_string(&bytes);
3746 match serde_json::from_str(&encoded) {
3747 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3748 Err(error) => {
3749 dlg.response_json_decode_error(&encoded, &error);
3750 return Err(common::Error::JsonDecodeError(
3751 encoded.to_string(),
3752 error,
3753 ));
3754 }
3755 }
3756 };
3757
3758 dlg.finished(true);
3759 return Ok(response);
3760 }
3761 }
3762 }
3763 }
3764
3765 /// The name of the operation resource to wait on.
3766 ///
3767 /// Sets the *name* path property to the given value.
3768 ///
3769 /// Even though the property as already been set when instantiating this call,
3770 /// we provide this method for API completeness.
3771 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationWaitCall<'a, C> {
3772 self._name = new_value.to_string();
3773 self
3774 }
3775 /// The maximum duration to wait before timing out. If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol. If RPC context deadline is also specified, the shorter one will be used.
3776 ///
3777 /// Sets the *timeout* query property to the given value.
3778 pub fn timeout(
3779 mut self,
3780 new_value: chrono::Duration,
3781 ) -> ProjectLocationOperationWaitCall<'a, C> {
3782 self._timeout = Some(new_value);
3783 self
3784 }
3785 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3786 /// while executing the actual API request.
3787 ///
3788 /// ````text
3789 /// It should be used to handle progress information, and to implement a certain level of resilience.
3790 /// ````
3791 ///
3792 /// Sets the *delegate* property to the given value.
3793 pub fn delegate(
3794 mut self,
3795 new_value: &'a mut dyn common::Delegate,
3796 ) -> ProjectLocationOperationWaitCall<'a, C> {
3797 self._delegate = Some(new_value);
3798 self
3799 }
3800
3801 /// Set any additional parameter of the query string used in the request.
3802 /// It should be used to set parameters which are not yet available through their own
3803 /// setters.
3804 ///
3805 /// Please note that this method must not be used to set any of the known parameters
3806 /// which have their own setter method. If done anyway, the request will fail.
3807 ///
3808 /// # Additional Parameters
3809 ///
3810 /// * *$.xgafv* (query-string) - V1 error format.
3811 /// * *access_token* (query-string) - OAuth access token.
3812 /// * *alt* (query-string) - Data format for response.
3813 /// * *callback* (query-string) - JSONP
3814 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3815 /// * *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.
3816 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3817 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3818 /// * *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.
3819 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3820 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3821 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationWaitCall<'a, C>
3822 where
3823 T: AsRef<str>,
3824 {
3825 self._additional_params
3826 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3827 self
3828 }
3829
3830 /// Identifies the authorization scope for the method you are building.
3831 ///
3832 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3833 /// [`Scope::CloudPlatform`].
3834 ///
3835 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3836 /// tokens for more than one scope.
3837 ///
3838 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3839 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3840 /// sufficient, a read-write scope will do as well.
3841 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationWaitCall<'a, C>
3842 where
3843 St: AsRef<str>,
3844 {
3845 self._scopes.insert(String::from(scope.as_ref()));
3846 self
3847 }
3848 /// Identifies the authorization scope(s) for the method you are building.
3849 ///
3850 /// See [`Self::add_scope()`] for details.
3851 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationWaitCall<'a, C>
3852 where
3853 I: IntoIterator<Item = St>,
3854 St: AsRef<str>,
3855 {
3856 self._scopes
3857 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3858 self
3859 }
3860
3861 /// Removes all scopes, and no default scope will be used either.
3862 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3863 /// for details).
3864 pub fn clear_scopes(mut self) -> ProjectLocationOperationWaitCall<'a, C> {
3865 self._scopes.clear();
3866 self
3867 }
3868}
3869
3870/// Lists vulnerabilities resulting from a successfully completed scan.
3871///
3872/// A builder for the *locations.scans.vulnerabilities.list* method supported by a *project* resource.
3873/// It is not used directly, but through a [`ProjectMethods`] instance.
3874///
3875/// # Example
3876///
3877/// Instantiate a resource method builder
3878///
3879/// ```test_harness,no_run
3880/// # extern crate hyper;
3881/// # extern crate hyper_rustls;
3882/// # extern crate google_ondemandscanning1 as ondemandscanning1;
3883/// # async fn dox() {
3884/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3885///
3886/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3888/// # secret,
3889/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3890/// # ).build().await.unwrap();
3891///
3892/// # let client = hyper_util::client::legacy::Client::builder(
3893/// # hyper_util::rt::TokioExecutor::new()
3894/// # )
3895/// # .build(
3896/// # hyper_rustls::HttpsConnectorBuilder::new()
3897/// # .with_native_roots()
3898/// # .unwrap()
3899/// # .https_or_http()
3900/// # .enable_http1()
3901/// # .build()
3902/// # );
3903/// # let mut hub = OnDemandScanning::new(client, auth);
3904/// // You can configure optional parameters by calling the respective setters at will, and
3905/// // execute the final call using `doit()`.
3906/// // Values shown here are possibly random and not representative !
3907/// let result = hub.projects().locations_scans_vulnerabilities_list("parent")
3908/// .page_token("eos")
3909/// .page_size(-4)
3910/// .doit().await;
3911/// # }
3912/// ```
3913pub struct ProjectLocationScanVulnerabilityListCall<'a, C>
3914where
3915 C: 'a,
3916{
3917 hub: &'a OnDemandScanning<C>,
3918 _parent: String,
3919 _page_token: Option<String>,
3920 _page_size: Option<i32>,
3921 _delegate: Option<&'a mut dyn common::Delegate>,
3922 _additional_params: HashMap<String, String>,
3923 _scopes: BTreeSet<String>,
3924}
3925
3926impl<'a, C> common::CallBuilder for ProjectLocationScanVulnerabilityListCall<'a, C> {}
3927
3928impl<'a, C> ProjectLocationScanVulnerabilityListCall<'a, C>
3929where
3930 C: common::Connector,
3931{
3932 /// Perform the operation you have build so far.
3933 pub async fn doit(
3934 mut self,
3935 ) -> common::Result<(common::Response, ListVulnerabilitiesResponseV1)> {
3936 use std::borrow::Cow;
3937 use std::io::{Read, Seek};
3938
3939 use common::{url::Params, ToParts};
3940 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3941
3942 let mut dd = common::DefaultDelegate;
3943 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3944 dlg.begin(common::MethodInfo {
3945 id: "ondemandscanning.projects.locations.scans.vulnerabilities.list",
3946 http_method: hyper::Method::GET,
3947 });
3948
3949 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3950 if self._additional_params.contains_key(field) {
3951 dlg.finished(false);
3952 return Err(common::Error::FieldClash(field));
3953 }
3954 }
3955
3956 let mut params = Params::with_capacity(5 + self._additional_params.len());
3957 params.push("parent", self._parent);
3958 if let Some(value) = self._page_token.as_ref() {
3959 params.push("pageToken", value);
3960 }
3961 if let Some(value) = self._page_size.as_ref() {
3962 params.push("pageSize", value.to_string());
3963 }
3964
3965 params.extend(self._additional_params.iter());
3966
3967 params.push("alt", "json");
3968 let mut url = self.hub._base_url.clone() + "v1/{+parent}/vulnerabilities";
3969 if self._scopes.is_empty() {
3970 self._scopes
3971 .insert(Scope::CloudPlatform.as_ref().to_string());
3972 }
3973
3974 #[allow(clippy::single_element_loop)]
3975 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3976 url = params.uri_replacement(url, param_name, find_this, true);
3977 }
3978 {
3979 let to_remove = ["parent"];
3980 params.remove_params(&to_remove);
3981 }
3982
3983 let url = params.parse_with_url(&url);
3984
3985 loop {
3986 let token = match self
3987 .hub
3988 .auth
3989 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3990 .await
3991 {
3992 Ok(token) => token,
3993 Err(e) => match dlg.token(e) {
3994 Ok(token) => token,
3995 Err(e) => {
3996 dlg.finished(false);
3997 return Err(common::Error::MissingToken(e));
3998 }
3999 },
4000 };
4001 let mut req_result = {
4002 let client = &self.hub.client;
4003 dlg.pre_request();
4004 let mut req_builder = hyper::Request::builder()
4005 .method(hyper::Method::GET)
4006 .uri(url.as_str())
4007 .header(USER_AGENT, self.hub._user_agent.clone());
4008
4009 if let Some(token) = token.as_ref() {
4010 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4011 }
4012
4013 let request = req_builder
4014 .header(CONTENT_LENGTH, 0_u64)
4015 .body(common::to_body::<String>(None));
4016
4017 client.request(request.unwrap()).await
4018 };
4019
4020 match req_result {
4021 Err(err) => {
4022 if let common::Retry::After(d) = dlg.http_error(&err) {
4023 sleep(d).await;
4024 continue;
4025 }
4026 dlg.finished(false);
4027 return Err(common::Error::HttpError(err));
4028 }
4029 Ok(res) => {
4030 let (mut parts, body) = res.into_parts();
4031 let mut body = common::Body::new(body);
4032 if !parts.status.is_success() {
4033 let bytes = common::to_bytes(body).await.unwrap_or_default();
4034 let error = serde_json::from_str(&common::to_string(&bytes));
4035 let response = common::to_response(parts, bytes.into());
4036
4037 if let common::Retry::After(d) =
4038 dlg.http_failure(&response, error.as_ref().ok())
4039 {
4040 sleep(d).await;
4041 continue;
4042 }
4043
4044 dlg.finished(false);
4045
4046 return Err(match error {
4047 Ok(value) => common::Error::BadRequest(value),
4048 _ => common::Error::Failure(response),
4049 });
4050 }
4051 let response = {
4052 let bytes = common::to_bytes(body).await.unwrap_or_default();
4053 let encoded = common::to_string(&bytes);
4054 match serde_json::from_str(&encoded) {
4055 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4056 Err(error) => {
4057 dlg.response_json_decode_error(&encoded, &error);
4058 return Err(common::Error::JsonDecodeError(
4059 encoded.to_string(),
4060 error,
4061 ));
4062 }
4063 }
4064 };
4065
4066 dlg.finished(true);
4067 return Ok(response);
4068 }
4069 }
4070 }
4071 }
4072
4073 /// Required. The parent of the collection of Vulnerabilities being requested. Format: projects/[project_name]/locations/[location]/scans/[scan_id]
4074 ///
4075 /// Sets the *parent* path property to the given value.
4076 ///
4077 /// Even though the property as already been set when instantiating this call,
4078 /// we provide this method for API completeness.
4079 pub fn parent(mut self, new_value: &str) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
4080 self._parent = new_value.to_string();
4081 self
4082 }
4083 /// The page token, resulting from a previous call to ListVulnerabilities.
4084 ///
4085 /// Sets the *page token* query property to the given value.
4086 pub fn page_token(
4087 mut self,
4088 new_value: &str,
4089 ) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
4090 self._page_token = Some(new_value.to_string());
4091 self
4092 }
4093 /// The number of vulnerabilities to retrieve.
4094 ///
4095 /// Sets the *page size* query property to the given value.
4096 pub fn page_size(mut self, new_value: i32) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
4097 self._page_size = Some(new_value);
4098 self
4099 }
4100 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4101 /// while executing the actual API request.
4102 ///
4103 /// ````text
4104 /// It should be used to handle progress information, and to implement a certain level of resilience.
4105 /// ````
4106 ///
4107 /// Sets the *delegate* property to the given value.
4108 pub fn delegate(
4109 mut self,
4110 new_value: &'a mut dyn common::Delegate,
4111 ) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
4112 self._delegate = Some(new_value);
4113 self
4114 }
4115
4116 /// Set any additional parameter of the query string used in the request.
4117 /// It should be used to set parameters which are not yet available through their own
4118 /// setters.
4119 ///
4120 /// Please note that this method must not be used to set any of the known parameters
4121 /// which have their own setter method. If done anyway, the request will fail.
4122 ///
4123 /// # Additional Parameters
4124 ///
4125 /// * *$.xgafv* (query-string) - V1 error format.
4126 /// * *access_token* (query-string) - OAuth access token.
4127 /// * *alt* (query-string) - Data format for response.
4128 /// * *callback* (query-string) - JSONP
4129 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4130 /// * *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.
4131 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4132 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4133 /// * *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.
4134 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4135 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4136 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationScanVulnerabilityListCall<'a, C>
4137 where
4138 T: AsRef<str>,
4139 {
4140 self._additional_params
4141 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4142 self
4143 }
4144
4145 /// Identifies the authorization scope for the method you are building.
4146 ///
4147 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4148 /// [`Scope::CloudPlatform`].
4149 ///
4150 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4151 /// tokens for more than one scope.
4152 ///
4153 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4154 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4155 /// sufficient, a read-write scope will do as well.
4156 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationScanVulnerabilityListCall<'a, C>
4157 where
4158 St: AsRef<str>,
4159 {
4160 self._scopes.insert(String::from(scope.as_ref()));
4161 self
4162 }
4163 /// Identifies the authorization scope(s) for the method you are building.
4164 ///
4165 /// See [`Self::add_scope()`] for details.
4166 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationScanVulnerabilityListCall<'a, C>
4167 where
4168 I: IntoIterator<Item = St>,
4169 St: AsRef<str>,
4170 {
4171 self._scopes
4172 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4173 self
4174 }
4175
4176 /// Removes all scopes, and no default scope will be used either.
4177 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4178 /// for details).
4179 pub fn clear_scopes(mut self) -> ProjectLocationScanVulnerabilityListCall<'a, C> {
4180 self._scopes.clear();
4181 self
4182 }
4183}
4184
4185/// Initiates an analysis of the provided packages.
4186///
4187/// A builder for the *locations.scans.analyzePackages* method supported by a *project* resource.
4188/// It is not used directly, but through a [`ProjectMethods`] instance.
4189///
4190/// # Example
4191///
4192/// Instantiate a resource method builder
4193///
4194/// ```test_harness,no_run
4195/// # extern crate hyper;
4196/// # extern crate hyper_rustls;
4197/// # extern crate google_ondemandscanning1 as ondemandscanning1;
4198/// use ondemandscanning1::api::AnalyzePackagesRequestV1;
4199/// # async fn dox() {
4200/// # use ondemandscanning1::{OnDemandScanning, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4201///
4202/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4203/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4204/// # secret,
4205/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4206/// # ).build().await.unwrap();
4207///
4208/// # let client = hyper_util::client::legacy::Client::builder(
4209/// # hyper_util::rt::TokioExecutor::new()
4210/// # )
4211/// # .build(
4212/// # hyper_rustls::HttpsConnectorBuilder::new()
4213/// # .with_native_roots()
4214/// # .unwrap()
4215/// # .https_or_http()
4216/// # .enable_http1()
4217/// # .build()
4218/// # );
4219/// # let mut hub = OnDemandScanning::new(client, auth);
4220/// // As the method needs a request, you would usually fill it with the desired information
4221/// // into the respective structure. Some of the parts shown here might not be applicable !
4222/// // Values shown here are possibly random and not representative !
4223/// let mut req = AnalyzePackagesRequestV1::default();
4224///
4225/// // You can configure optional parameters by calling the respective setters at will, and
4226/// // execute the final call using `doit()`.
4227/// // Values shown here are possibly random and not representative !
4228/// let result = hub.projects().locations_scans_analyze_packages(req, "parent")
4229/// .doit().await;
4230/// # }
4231/// ```
4232pub struct ProjectLocationScanAnalyzePackageCall<'a, C>
4233where
4234 C: 'a,
4235{
4236 hub: &'a OnDemandScanning<C>,
4237 _request: AnalyzePackagesRequestV1,
4238 _parent: String,
4239 _delegate: Option<&'a mut dyn common::Delegate>,
4240 _additional_params: HashMap<String, String>,
4241 _scopes: BTreeSet<String>,
4242}
4243
4244impl<'a, C> common::CallBuilder for ProjectLocationScanAnalyzePackageCall<'a, C> {}
4245
4246impl<'a, C> ProjectLocationScanAnalyzePackageCall<'a, C>
4247where
4248 C: common::Connector,
4249{
4250 /// Perform the operation you have build so far.
4251 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4252 use std::borrow::Cow;
4253 use std::io::{Read, Seek};
4254
4255 use common::{url::Params, ToParts};
4256 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4257
4258 let mut dd = common::DefaultDelegate;
4259 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4260 dlg.begin(common::MethodInfo {
4261 id: "ondemandscanning.projects.locations.scans.analyzePackages",
4262 http_method: hyper::Method::POST,
4263 });
4264
4265 for &field in ["alt", "parent"].iter() {
4266 if self._additional_params.contains_key(field) {
4267 dlg.finished(false);
4268 return Err(common::Error::FieldClash(field));
4269 }
4270 }
4271
4272 let mut params = Params::with_capacity(4 + self._additional_params.len());
4273 params.push("parent", self._parent);
4274
4275 params.extend(self._additional_params.iter());
4276
4277 params.push("alt", "json");
4278 let mut url = self.hub._base_url.clone() + "v1/{+parent}/scans:analyzePackages";
4279 if self._scopes.is_empty() {
4280 self._scopes
4281 .insert(Scope::CloudPlatform.as_ref().to_string());
4282 }
4283
4284 #[allow(clippy::single_element_loop)]
4285 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4286 url = params.uri_replacement(url, param_name, find_this, true);
4287 }
4288 {
4289 let to_remove = ["parent"];
4290 params.remove_params(&to_remove);
4291 }
4292
4293 let url = params.parse_with_url(&url);
4294
4295 let mut json_mime_type = mime::APPLICATION_JSON;
4296 let mut request_value_reader = {
4297 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4298 common::remove_json_null_values(&mut value);
4299 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4300 serde_json::to_writer(&mut dst, &value).unwrap();
4301 dst
4302 };
4303 let request_size = request_value_reader
4304 .seek(std::io::SeekFrom::End(0))
4305 .unwrap();
4306 request_value_reader
4307 .seek(std::io::SeekFrom::Start(0))
4308 .unwrap();
4309
4310 loop {
4311 let token = match self
4312 .hub
4313 .auth
4314 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4315 .await
4316 {
4317 Ok(token) => token,
4318 Err(e) => match dlg.token(e) {
4319 Ok(token) => token,
4320 Err(e) => {
4321 dlg.finished(false);
4322 return Err(common::Error::MissingToken(e));
4323 }
4324 },
4325 };
4326 request_value_reader
4327 .seek(std::io::SeekFrom::Start(0))
4328 .unwrap();
4329 let mut req_result = {
4330 let client = &self.hub.client;
4331 dlg.pre_request();
4332 let mut req_builder = hyper::Request::builder()
4333 .method(hyper::Method::POST)
4334 .uri(url.as_str())
4335 .header(USER_AGENT, self.hub._user_agent.clone());
4336
4337 if let Some(token) = token.as_ref() {
4338 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4339 }
4340
4341 let request = req_builder
4342 .header(CONTENT_TYPE, json_mime_type.to_string())
4343 .header(CONTENT_LENGTH, request_size as u64)
4344 .body(common::to_body(
4345 request_value_reader.get_ref().clone().into(),
4346 ));
4347
4348 client.request(request.unwrap()).await
4349 };
4350
4351 match req_result {
4352 Err(err) => {
4353 if let common::Retry::After(d) = dlg.http_error(&err) {
4354 sleep(d).await;
4355 continue;
4356 }
4357 dlg.finished(false);
4358 return Err(common::Error::HttpError(err));
4359 }
4360 Ok(res) => {
4361 let (mut parts, body) = res.into_parts();
4362 let mut body = common::Body::new(body);
4363 if !parts.status.is_success() {
4364 let bytes = common::to_bytes(body).await.unwrap_or_default();
4365 let error = serde_json::from_str(&common::to_string(&bytes));
4366 let response = common::to_response(parts, bytes.into());
4367
4368 if let common::Retry::After(d) =
4369 dlg.http_failure(&response, error.as_ref().ok())
4370 {
4371 sleep(d).await;
4372 continue;
4373 }
4374
4375 dlg.finished(false);
4376
4377 return Err(match error {
4378 Ok(value) => common::Error::BadRequest(value),
4379 _ => common::Error::Failure(response),
4380 });
4381 }
4382 let response = {
4383 let bytes = common::to_bytes(body).await.unwrap_or_default();
4384 let encoded = common::to_string(&bytes);
4385 match serde_json::from_str(&encoded) {
4386 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4387 Err(error) => {
4388 dlg.response_json_decode_error(&encoded, &error);
4389 return Err(common::Error::JsonDecodeError(
4390 encoded.to_string(),
4391 error,
4392 ));
4393 }
4394 }
4395 };
4396
4397 dlg.finished(true);
4398 return Ok(response);
4399 }
4400 }
4401 }
4402 }
4403
4404 ///
4405 /// Sets the *request* property to the given value.
4406 ///
4407 /// Even though the property as already been set when instantiating this call,
4408 /// we provide this method for API completeness.
4409 pub fn request(
4410 mut self,
4411 new_value: AnalyzePackagesRequestV1,
4412 ) -> ProjectLocationScanAnalyzePackageCall<'a, C> {
4413 self._request = new_value;
4414 self
4415 }
4416 /// Required. The parent of the resource for which analysis is requested. Format: projects/[project_name]/locations/[location]
4417 ///
4418 /// Sets the *parent* path property to the given value.
4419 ///
4420 /// Even though the property as already been set when instantiating this call,
4421 /// we provide this method for API completeness.
4422 pub fn parent(mut self, new_value: &str) -> ProjectLocationScanAnalyzePackageCall<'a, C> {
4423 self._parent = new_value.to_string();
4424 self
4425 }
4426 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4427 /// while executing the actual API request.
4428 ///
4429 /// ````text
4430 /// It should be used to handle progress information, and to implement a certain level of resilience.
4431 /// ````
4432 ///
4433 /// Sets the *delegate* property to the given value.
4434 pub fn delegate(
4435 mut self,
4436 new_value: &'a mut dyn common::Delegate,
4437 ) -> ProjectLocationScanAnalyzePackageCall<'a, C> {
4438 self._delegate = Some(new_value);
4439 self
4440 }
4441
4442 /// Set any additional parameter of the query string used in the request.
4443 /// It should be used to set parameters which are not yet available through their own
4444 /// setters.
4445 ///
4446 /// Please note that this method must not be used to set any of the known parameters
4447 /// which have their own setter method. If done anyway, the request will fail.
4448 ///
4449 /// # Additional Parameters
4450 ///
4451 /// * *$.xgafv* (query-string) - V1 error format.
4452 /// * *access_token* (query-string) - OAuth access token.
4453 /// * *alt* (query-string) - Data format for response.
4454 /// * *callback* (query-string) - JSONP
4455 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4456 /// * *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.
4457 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4458 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4459 /// * *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.
4460 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4461 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4462 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationScanAnalyzePackageCall<'a, C>
4463 where
4464 T: AsRef<str>,
4465 {
4466 self._additional_params
4467 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4468 self
4469 }
4470
4471 /// Identifies the authorization scope for the method you are building.
4472 ///
4473 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4474 /// [`Scope::CloudPlatform`].
4475 ///
4476 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4477 /// tokens for more than one scope.
4478 ///
4479 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4480 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4481 /// sufficient, a read-write scope will do as well.
4482 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationScanAnalyzePackageCall<'a, C>
4483 where
4484 St: AsRef<str>,
4485 {
4486 self._scopes.insert(String::from(scope.as_ref()));
4487 self
4488 }
4489 /// Identifies the authorization scope(s) for the method you are building.
4490 ///
4491 /// See [`Self::add_scope()`] for details.
4492 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationScanAnalyzePackageCall<'a, C>
4493 where
4494 I: IntoIterator<Item = St>,
4495 St: AsRef<str>,
4496 {
4497 self._scopes
4498 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4499 self
4500 }
4501
4502 /// Removes all scopes, and no default scope will be used either.
4503 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4504 /// for details).
4505 pub fn clear_scopes(mut self) -> ProjectLocationScanAnalyzePackageCall<'a, C> {
4506 self._scopes.clear();
4507 self
4508 }
4509}