google_containeranalysis1_beta1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// 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 ContainerAnalysis 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_containeranalysis1_beta1 as containeranalysis1_beta1;
49/// use containeranalysis1_beta1::api::Note;
50/// use containeranalysis1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = ContainerAnalysis::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Note::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().notes_create(req, "parent")
88///              .note_id("At")
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct ContainerAnalysis<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for ContainerAnalysis<C> {}
120
121impl<'a, C> ContainerAnalysis<C> {
122    pub fn new<A: 'static + common::GetToken>(
123        client: common::Client<C>,
124        auth: A,
125    ) -> ContainerAnalysis<C> {
126        ContainerAnalysis {
127            client,
128            auth: Box::new(auth),
129            _user_agent: "google-api-rust-client/6.0.0".to_string(),
130            _base_url: "https://containeranalysis.googleapis.com/".to_string(),
131            _root_url: "https://containeranalysis.googleapis.com/".to_string(),
132        }
133    }
134
135    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136        ProjectMethods { hub: self }
137    }
138
139    /// Set the user-agent header field to use in all requests to the server.
140    /// It defaults to `google-api-rust-client/6.0.0`.
141    ///
142    /// Returns the previously set user-agent.
143    pub fn user_agent(&mut self, agent_name: String) -> String {
144        std::mem::replace(&mut self._user_agent, agent_name)
145    }
146
147    /// Set the base url to use in all requests to the server.
148    /// It defaults to `https://containeranalysis.googleapis.com/`.
149    ///
150    /// Returns the previously set base url.
151    pub fn base_url(&mut self, new_base_url: String) -> String {
152        std::mem::replace(&mut self._base_url, new_base_url)
153    }
154
155    /// Set the root url to use in all requests to the server.
156    /// It defaults to `https://containeranalysis.googleapis.com/`.
157    ///
158    /// Returns the previously set root url.
159    pub fn root_url(&mut self, new_root_url: String) -> String {
160        std::mem::replace(&mut self._root_url, new_root_url)
161    }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// An alias to a repo revision.
168///
169/// This type is not used in any activity, and only used as *part* of another schema.
170///
171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
172#[serde_with::serde_as]
173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
174pub struct AliasContext {
175    /// The alias kind.
176    pub kind: Option<String>,
177    /// The alias name.
178    pub name: Option<String>,
179}
180
181impl common::Part for AliasContext {}
182
183/// Indicates which analysis completed successfully. Multiple types of analysis can be performed on a single resource.
184///
185/// This type is not used in any activity, and only used as *part* of another schema.
186///
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct AnalysisCompleted {
191    /// no description provided
192    #[serde(rename = "analysisType")]
193    pub analysis_type: Option<Vec<String>>,
194}
195
196impl common::Part for AnalysisCompleted {}
197
198/// Artifact describes a build product.
199///
200/// This type is not used in any activity, and only used as *part* of another schema.
201///
202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
203#[serde_with::serde_as]
204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
205pub struct Artifact {
206    /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a container.
207    pub checksum: Option<String>,
208    /// Artifact ID, if any; for container images, this will be a URL by digest like `gcr.io/projectID/imagename@sha256:123456`.
209    pub id: Option<String>,
210    /// 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.
211    pub names: Option<Vec<String>>,
212}
213
214impl common::Part for Artifact {}
215
216/// Defines a hash object for use in Materials and Products.
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 ArtifactHashes {
224    /// no description provided
225    pub sha256: Option<String>,
226}
227
228impl common::Part for ArtifactHashes {}
229
230/// Defines an object to declare an in-toto artifact rule
231///
232/// This type is not used in any activity, and only used as *part* of another schema.
233///
234#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
235#[serde_with::serde_as]
236#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
237pub struct ArtifactRule {
238    /// no description provided
239    #[serde(rename = "artifactRule")]
240    pub artifact_rule: Option<Vec<String>>,
241}
242
243impl common::Part for ArtifactRule {}
244
245/// Assessment provides all information that is related to a single vulnerability for this product.
246///
247/// This type is not used in any activity, and only used as *part* of another schema.
248///
249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
250#[serde_with::serde_as]
251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
252pub struct Assessment {
253    /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability. Deprecated: Use vulnerability_id instead to denote CVEs.
254    pub cve: Option<String>,
255    /// Contains information about the impact of this vulnerability, this will change with time.
256    pub impacts: Option<Vec<String>>,
257    /// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
258    pub justification: Option<Justification>,
259    /// A detailed description of this Vex.
260    #[serde(rename = "longDescription")]
261    pub long_description: Option<String>,
262    /// Holds a list of references associated with this vulnerability item and assessment. These uris have additional information about the vulnerability and the assessment itself. E.g. Link to a document which details how this assessment concluded the state of this vulnerability.
263    #[serde(rename = "relatedUris")]
264    pub related_uris: Option<Vec<RelatedUrl>>,
265    /// Specifies details on how to handle (and presumably, fix) a vulnerability.
266    pub remediations: Option<Vec<Remediation>>,
267    /// A one sentence description of this Vex.
268    #[serde(rename = "shortDescription")]
269    pub short_description: Option<String>,
270    /// Provides the state of this Vulnerability assessment.
271    pub state: Option<String>,
272    /// The vulnerability identifier for this Assessment. Will hold one of common identifiers e.g. CVE, GHSA etc.
273    #[serde(rename = "vulnerabilityId")]
274    pub vulnerability_id: Option<String>,
275}
276
277impl common::Part for Assessment {}
278
279/// 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 look-up (how to find this attestation if you already know the authority and artifact to be verified) and intent (which authority was this attestation intended to sign for).
280///
281/// This type is not used in any activity, and only used as *part* of another schema.
282///
283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
284#[serde_with::serde_as]
285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
286pub struct Attestation {
287    /// no description provided
288    #[serde(rename = "genericSignedAttestation")]
289    pub generic_signed_attestation: Option<GenericSignedAttestation>,
290    /// A PGP signed attestation.
291    #[serde(rename = "pgpSignedAttestation")]
292    pub pgp_signed_attestation: Option<PgpSignedAttestation>,
293}
294
295impl common::Part for Attestation {}
296
297/// Note kind that represents a logical attestation "role" or "authority". For example, an organization might have one `Authority` for "QA" and one for "build". This note is intended to act strictly as a grouping mechanism for the attached occurrences (Attestations). This grouping mechanism also provides a security boundary, since IAM ACLs gate the ability for a principle to attach an occurrence to a given note. It also provides a single point of lookup to find all attached attestation occurrences, even if they don't all live in the same project.
298///
299/// This type is not used in any activity, and only used as *part* of another schema.
300///
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct Authority {
305    /// Hint hints at the purpose of the attestation authority.
306    pub hint: Option<Hint>,
307}
308
309impl common::Part for Authority {}
310
311/// Basis describes the base image portion (Note) of the DockerImage relationship. Linked occurrences are derived from this or an equivalent image via: FROM Or an equivalent reference, e.g. a tag of the resource_url.
312///
313/// This type is not used in any activity, and only used as *part* of another schema.
314///
315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
316#[serde_with::serde_as]
317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
318pub struct Basis {
319    /// Required. Immutable. The fingerprint of the base image.
320    pub fingerprint: Option<Fingerprint>,
321    /// Required. Immutable. The resource_url for the resource representing the basis of associated occurrence images.
322    #[serde(rename = "resourceUrl")]
323    pub resource_url: Option<String>,
324}
325
326impl common::Part for Basis {}
327
328/// Request to create notes in batch.
329///
330/// # Activities
331///
332/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
333/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
334///
335/// * [notes batch create projects](ProjectNoteBatchCreateCall) (request)
336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
337#[serde_with::serde_as]
338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
339pub struct BatchCreateNotesRequest {
340    /// Required. The notes to create, the key is expected to be the note ID. Max allowed length is 1000.
341    pub notes: Option<HashMap<String, Note>>,
342}
343
344impl common::RequestValue for BatchCreateNotesRequest {}
345
346/// Response for creating notes in batch.
347///
348/// # Activities
349///
350/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
351/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
352///
353/// * [notes batch create projects](ProjectNoteBatchCreateCall) (response)
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct BatchCreateNotesResponse {
358    /// The notes that were created.
359    pub notes: Option<Vec<Note>>,
360}
361
362impl common::ResponseResult for BatchCreateNotesResponse {}
363
364/// Request to create occurrences in batch.
365///
366/// # Activities
367///
368/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
369/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
370///
371/// * [occurrences batch create projects](ProjectOccurrenceBatchCreateCall) (request)
372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
373#[serde_with::serde_as]
374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
375pub struct BatchCreateOccurrencesRequest {
376    /// Required. The occurrences to create. Max allowed length is 1000.
377    pub occurrences: Option<Vec<Occurrence>>,
378}
379
380impl common::RequestValue for BatchCreateOccurrencesRequest {}
381
382/// Response for creating occurrences in batch.
383///
384/// # Activities
385///
386/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
387/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
388///
389/// * [occurrences batch create projects](ProjectOccurrenceBatchCreateCall) (response)
390#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
391#[serde_with::serde_as]
392#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
393pub struct BatchCreateOccurrencesResponse {
394    /// The occurrences that were created.
395    pub occurrences: Option<Vec<Occurrence>>,
396}
397
398impl common::ResponseResult for BatchCreateOccurrencesResponse {}
399
400/// Associates `members`, or principals, with a `role`.
401///
402/// This type is not used in any activity, and only used as *part* of another schema.
403///
404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
405#[serde_with::serde_as]
406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
407pub struct Binding {
408    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
409    pub condition: Option<Expr>,
410    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
411    pub members: Option<Vec<String>>,
412    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
413    pub role: Option<String>,
414}
415
416impl common::Part for Binding {}
417
418/// Note holding the version of the provider's builder and the signature of the provenance message in the build details occurrence.
419///
420/// This type is not used in any activity, and only used as *part* of another schema.
421///
422#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
423#[serde_with::serde_as]
424#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
425pub struct Build {
426    /// Required. Immutable. Version of the builder which produced this build.
427    #[serde(rename = "builderVersion")]
428    pub builder_version: Option<String>,
429    /// Signature of the build in occurrences pointing to this build note containing build details.
430    pub signature: Option<BuildSignature>,
431}
432
433impl common::Part for Build {}
434
435/// There is no detailed description.
436///
437/// This type is not used in any activity, and only used as *part* of another schema.
438///
439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
440#[serde_with::serde_as]
441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
442pub struct BuildDefinition {
443    /// no description provided
444    #[serde(rename = "buildType")]
445    pub build_type: Option<String>,
446    /// no description provided
447    #[serde(rename = "externalParameters")]
448    pub external_parameters: Option<HashMap<String, serde_json::Value>>,
449    /// no description provided
450    #[serde(rename = "internalParameters")]
451    pub internal_parameters: Option<HashMap<String, serde_json::Value>>,
452    /// no description provided
453    #[serde(rename = "resolvedDependencies")]
454    pub resolved_dependencies: Option<Vec<ResourceDescriptor>>,
455}
456
457impl common::Part for BuildDefinition {}
458
459/// There is no detailed description.
460///
461/// This type is not used in any activity, and only used as *part* of another schema.
462///
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct BuildMetadata {
467    /// no description provided
468    #[serde(rename = "finishedOn")]
469    pub finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
470    /// no description provided
471    #[serde(rename = "invocationId")]
472    pub invocation_id: Option<String>,
473    /// no description provided
474    #[serde(rename = "startedOn")]
475    pub started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
476}
477
478impl common::Part for BuildMetadata {}
479
480/// Provenance of a build. Contains all information needed to verify the full details about the build from source to completion.
481///
482/// This type is not used in any activity, and only used as *part* of another schema.
483///
484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
485#[serde_with::serde_as]
486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
487pub struct BuildProvenance {
488    /// Special options applied to this build. This is a catch-all field where build providers can enter any desired additional details.
489    #[serde(rename = "buildOptions")]
490    pub build_options: Option<HashMap<String, String>>,
491    /// Version string of the builder at the time this build was executed.
492    #[serde(rename = "builderVersion")]
493    pub builder_version: Option<String>,
494    /// Output of the build.
495    #[serde(rename = "builtArtifacts")]
496    pub built_artifacts: Option<Vec<Artifact>>,
497    /// Commands requested by the build.
498    pub commands: Option<Vec<Command>>,
499    /// Time at which the build was created.
500    #[serde(rename = "createTime")]
501    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
502    /// 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.
503    pub creator: Option<String>,
504    /// Time at which execution of the build was finished.
505    #[serde(rename = "endTime")]
506    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
507    /// Required. Unique identifier of the build.
508    pub id: Option<String>,
509    /// URI where any logs for this provenance were written.
510    #[serde(rename = "logsUri")]
511    pub logs_uri: Option<String>,
512    /// ID of the project.
513    #[serde(rename = "projectId")]
514    pub project_id: Option<String>,
515    /// Details of the Source input to the build.
516    #[serde(rename = "sourceProvenance")]
517    pub source_provenance: Option<Source>,
518    /// Time at which execution of the build was started.
519    #[serde(rename = "startTime")]
520    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
521    /// Trigger identifier if the build was triggered automatically; empty if not.
522    #[serde(rename = "triggerId")]
523    pub trigger_id: Option<String>,
524}
525
526impl common::Part for BuildProvenance {}
527
528/// Message encapsulating the signature of the verified build.
529///
530/// This type is not used in any activity, and only used as *part* of another schema.
531///
532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
533#[serde_with::serde_as]
534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
535pub struct BuildSignature {
536    /// An ID for the key used to sign. This could be either an ID for the key stored in `public_key` (such as the ID or fingerprint for a PGP key, or the CN for a cert), or a reference to an external key (such as a reference to a key in Cloud Key Management Service).
537    #[serde(rename = "keyId")]
538    pub key_id: Option<String>,
539    /// The type of the key, either stored in `public_key` or referenced in `key_id`.
540    #[serde(rename = "keyType")]
541    pub key_type: Option<String>,
542    /// Public key of the builder which can be used to verify that the related findings are valid and unchanged. If `key_type` is empty, this defaults to PEM encoded public keys. This field may be empty if `key_id` references an external key. For Cloud Build based signatures, this is a PEM encoded public key. To verify the Cloud Build signature, place the contents of this field into a file (public.pem). The signature field is base64-decoded into its binary representation in signature.bin, and the provenance bytes from `BuildDetails` are base64-decoded into a binary representation in signed.bin. OpenSSL can then verify the signature: `openssl sha256 -verify public.pem -signature signature.bin signed.bin`
543    #[serde(rename = "publicKey")]
544    pub public_key: Option<String>,
545    /// Required. Signature of the related `BuildProvenance`. In JSON, this is base-64 encoded.
546    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
547    pub signature: Option<Vec<u8>>,
548}
549
550impl common::Part for BuildSignature {}
551
552/// Defines an object for the byproducts field in in-toto links. The suggested fields are "stderr", "stdout", and "return-value".
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 ByProducts {
560    /// no description provided
561    #[serde(rename = "customValues")]
562    pub custom_values: Option<HashMap<String, String>>,
563}
564
565impl common::Part for ByProducts {}
566
567/// Common Vulnerability Scoring System. This message is compatible with CVSS v2 and v3. For CVSS v2 details, see https://www.first.org/cvss/v2/guide CVSS v2 calculator: https://nvd.nist.gov/vuln-metrics/cvss/v2-calculator For CVSS v3 details, see https://www.first.org/cvss/specification-document CVSS v3 calculator: https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator
568///
569/// This type is not used in any activity, and only used as *part* of another schema.
570///
571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
572#[serde_with::serde_as]
573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
574pub struct CVSS {
575    /// Defined in CVSS v3, CVSS v2
576    #[serde(rename = "attackComplexity")]
577    pub attack_complexity: Option<String>,
578    /// Base Metrics Represents the intrinsic characteristics of a vulnerability that are constant over time and across user environments. Defined in CVSS v3, CVSS v2
579    #[serde(rename = "attackVector")]
580    pub attack_vector: Option<String>,
581    /// Defined in CVSS v2
582    pub authentication: Option<String>,
583    /// Defined in CVSS v3, CVSS v2
584    #[serde(rename = "availabilityImpact")]
585    pub availability_impact: Option<String>,
586    /// The base score is a function of the base metric scores.
587    #[serde(rename = "baseScore")]
588    pub base_score: Option<f32>,
589    /// Defined in CVSS v3, CVSS v2
590    #[serde(rename = "confidentialityImpact")]
591    pub confidentiality_impact: Option<String>,
592    /// no description provided
593    #[serde(rename = "exploitabilityScore")]
594    pub exploitability_score: Option<f32>,
595    /// no description provided
596    #[serde(rename = "impactScore")]
597    pub impact_score: Option<f32>,
598    /// Defined in CVSS v3, CVSS v2
599    #[serde(rename = "integrityImpact")]
600    pub integrity_impact: Option<String>,
601    /// Defined in CVSS v3
602    #[serde(rename = "privilegesRequired")]
603    pub privileges_required: Option<String>,
604    /// Defined in CVSS v3
605    pub scope: Option<String>,
606    /// Defined in CVSS v3
607    #[serde(rename = "userInteraction")]
608    pub user_interaction: Option<String>,
609}
610
611impl common::Part for CVSS {}
612
613/// Deprecated. Common Vulnerability Scoring System version 3. For details, see https://www.first.org/cvss/specification-document
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct CVSSv3 {
621    /// no description provided
622    #[serde(rename = "attackComplexity")]
623    pub attack_complexity: Option<String>,
624    /// Base Metrics Represents the intrinsic characteristics of a vulnerability that are constant over time and across user environments.
625    #[serde(rename = "attackVector")]
626    pub attack_vector: Option<String>,
627    /// no description provided
628    #[serde(rename = "availabilityImpact")]
629    pub availability_impact: Option<String>,
630    /// The base score is a function of the base metric scores.
631    #[serde(rename = "baseScore")]
632    pub base_score: Option<f32>,
633    /// no description provided
634    #[serde(rename = "confidentialityImpact")]
635    pub confidentiality_impact: Option<String>,
636    /// no description provided
637    #[serde(rename = "exploitabilityScore")]
638    pub exploitability_score: Option<f32>,
639    /// no description provided
640    #[serde(rename = "impactScore")]
641    pub impact_score: Option<f32>,
642    /// no description provided
643    #[serde(rename = "integrityImpact")]
644    pub integrity_impact: Option<String>,
645    /// no description provided
646    #[serde(rename = "privilegesRequired")]
647    pub privileges_required: Option<String>,
648    /// no description provided
649    pub scope: Option<String>,
650    /// no description provided
651    #[serde(rename = "userInteraction")]
652    pub user_interaction: Option<String>,
653}
654
655impl common::Part for CVSSv3 {}
656
657/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud Source Repo.
658///
659/// This type is not used in any activity, and only used as *part* of another schema.
660///
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct CloudRepoSourceContext {
665    /// An alias, which may be a branch or tag.
666    #[serde(rename = "aliasContext")]
667    pub alias_context: Option<AliasContext>,
668    /// The ID of the repo.
669    #[serde(rename = "repoId")]
670    pub repo_id: Option<RepoId>,
671    /// A revision ID.
672    #[serde(rename = "revisionId")]
673    pub revision_id: Option<String>,
674}
675
676impl common::Part for CloudRepoSourceContext {}
677
678/// Command describes a step performed as part of the build pipeline.
679///
680/// This type is not used in any activity, and only used as *part* of another schema.
681///
682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
683#[serde_with::serde_as]
684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
685pub struct Command {
686    /// Command-line arguments used when executing this command.
687    pub args: Option<Vec<String>>,
688    /// Working directory (relative to project source root) used when running this command.
689    pub dir: Option<String>,
690    /// Environment variables set before running this command.
691    pub env: Option<Vec<String>>,
692    /// Optional unique identifier for this command, used in wait_for to reference this command as a dependency.
693    pub id: Option<String>,
694    /// 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`.
695    pub name: Option<String>,
696    /// The ID(s) of the command(s) that this command depends on.
697    #[serde(rename = "waitFor")]
698    pub wait_for: Option<Vec<String>>,
699}
700
701impl common::Part for Command {}
702
703/// An artifact that can be deployed in some runtime.
704///
705/// This type is not used in any activity, and only used as *part* of another schema.
706///
707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
708#[serde_with::serde_as]
709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
710pub struct Deployable {
711    /// Required. Resource URI for the artifact being deployed.
712    #[serde(rename = "resourceUri")]
713    pub resource_uri: Option<Vec<String>>,
714}
715
716impl common::Part for Deployable {}
717
718/// The period during which some deployable was active in a runtime.
719///
720/// This type is not used in any activity, and only used as *part* of another schema.
721///
722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
723#[serde_with::serde_as]
724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct Deployment {
726    /// Address of the runtime element hosting this deployment.
727    pub address: Option<String>,
728    /// Configuration used to create this deployment.
729    pub config: Option<String>,
730    /// Required. Beginning of the lifetime of this deployment.
731    #[serde(rename = "deployTime")]
732    pub deploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
733    /// Platform hosting this deployment.
734    pub platform: Option<String>,
735    /// Output only. Resource URI for the artifact being deployed taken from the deployable field with the same name.
736    #[serde(rename = "resourceUri")]
737    pub resource_uri: Option<Vec<String>>,
738    /// End of the lifetime of this deployment.
739    #[serde(rename = "undeployTime")]
740    pub undeploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
741    /// Identity of the user that triggered this deployment.
742    #[serde(rename = "userEmail")]
743    pub user_email: Option<String>,
744}
745
746impl common::Part for Deployment {}
747
748/// Derived describes the derived image portion (Occurrence) of the DockerImage relationship. This image would be produced from a Dockerfile with FROM .
749///
750/// This type is not used in any activity, and only used as *part* of another schema.
751///
752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
753#[serde_with::serde_as]
754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
755pub struct Derived {
756    /// Output only. This contains the base image URL for the derived image occurrence.
757    #[serde(rename = "baseResourceUrl")]
758    pub base_resource_url: Option<String>,
759    /// Output only. The number of layers by which this image differs from the associated image basis.
760    pub distance: Option<i32>,
761    /// Required. The fingerprint of the derived image.
762    pub fingerprint: Option<Fingerprint>,
763    /// 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.
764    #[serde(rename = "layerInfo")]
765    pub layer_info: Option<Vec<Layer>>,
766}
767
768impl common::Part for Derived {}
769
770/// Identifies all appearances of this vulnerability in the package for a specific distro/location. For example: glibc in cpe:/o:debian:debian_linux:8 for versions 2.1 - 2.2
771///
772/// This type is not used in any activity, and only used as *part* of another schema.
773///
774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
775#[serde_with::serde_as]
776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
777pub struct Detail {
778    /// Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) in which the vulnerability manifests. Examples include distro or storage location for vulnerable jar.
779    #[serde(rename = "cpeUri")]
780    pub cpe_uri: Option<String>,
781    /// A vendor-specific description of this note.
782    pub description: Option<String>,
783    /// The fix for this specific package version.
784    #[serde(rename = "fixedLocation")]
785    pub fixed_location: Option<VulnerabilityLocation>,
786    /// Whether this detail is obsolete. Occurrences are expected not to point to obsolete details.
787    #[serde(rename = "isObsolete")]
788    pub is_obsolete: Option<bool>,
789    /// The max version of the package in which the vulnerability exists.
790    #[serde(rename = "maxAffectedVersion")]
791    pub max_affected_version: Option<Version>,
792    /// The min version of the package in which the vulnerability exists.
793    #[serde(rename = "minAffectedVersion")]
794    pub min_affected_version: Option<Version>,
795    /// Required. The name of the package where the vulnerability was found.
796    pub package: Option<String>,
797    /// The type of package; whether native or non native(ruby gems, node.js packages etc).
798    #[serde(rename = "packageType")]
799    pub package_type: Option<String>,
800    /// The severity (eg: distro assigned severity) for this vulnerability.
801    #[serde(rename = "severityName")]
802    pub severity_name: Option<String>,
803    /// The source from which the information in this Detail was obtained.
804    pub source: Option<String>,
805    /// The time this information was last changed at the source. This is an upstream timestamp from the underlying information source - e.g. Ubuntu security tracker.
806    #[serde(rename = "sourceUpdateTime")]
807    pub source_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
808    /// The name of the vendor of the product.
809    pub vendor: Option<String>,
810}
811
812impl common::Part for Detail {}
813
814/// Details of an attestation occurrence.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct Details {
822    /// Required. Attestation for the resource.
823    pub attestation: Option<Attestation>,
824}
825
826impl common::Part for Details {}
827
828/// Digest information.
829///
830/// This type is not used in any activity, and only used as *part* of another schema.
831///
832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
833#[serde_with::serde_as]
834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
835pub struct Digest {
836    /// `SHA1`, `SHA512` etc.
837    pub algo: Option<String>,
838    /// Value of the digest.
839    #[serde(rename = "digestBytes")]
840    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
841    pub digest_bytes: Option<Vec<u8>>,
842}
843
844impl common::Part for Digest {}
845
846/// Provides information about the analysis status of a discovered resource.
847///
848/// This type is not used in any activity, and only used as *part* of another schema.
849///
850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
851#[serde_with::serde_as]
852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
853pub struct Discovered {
854    /// no description provided
855    #[serde(rename = "analysisCompleted")]
856    pub analysis_completed: Option<AnalysisCompleted>,
857    /// Indicates any errors encountered during analysis of a resource. There could be 0 or more of these errors.
858    #[serde(rename = "analysisError")]
859    pub analysis_error: Option<Vec<Status>>,
860    /// The status of discovery for the resource.
861    #[serde(rename = "analysisStatus")]
862    pub analysis_status: Option<String>,
863    /// 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.
864    #[serde(rename = "analysisStatusError")]
865    pub analysis_status_error: Option<Status>,
866    /// Whether the resource is continuously analyzed.
867    #[serde(rename = "continuousAnalysis")]
868    pub continuous_analysis: Option<String>,
869    /// The last time continuous analysis was done for this resource. Deprecated, do not use.
870    #[serde(rename = "lastAnalysisTime")]
871    pub last_analysis_time: Option<chrono::DateTime<chrono::offset::Utc>>,
872    /// The last time this resource was scanned.
873    #[serde(rename = "lastScanTime")]
874    pub last_scan_time: Option<chrono::DateTime<chrono::offset::Utc>>,
875    /// The status of an SBOM generation.
876    #[serde(rename = "sbomStatus")]
877    pub sbom_status: Option<SBOMStatus>,
878}
879
880impl common::Part for Discovered {}
881
882/// A note that indicates a type of analysis a provider would perform. This note exists in a provider's project. A `Discovery` occurrence is created in a consumer's project at the start of analysis.
883///
884/// This type is not used in any activity, and only used as *part* of another schema.
885///
886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
887#[serde_with::serde_as]
888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
889pub struct Discovery {
890    /// Required. Immutable. The kind of analysis that is handled by this discovery.
891    #[serde(rename = "analysisKind")]
892    pub analysis_kind: Option<String>,
893}
894
895impl common::Part for Discovery {}
896
897/// This represents a particular channel of distribution for a given package. E.g., Debian's jessie-backports dpkg mirror.
898///
899/// This type is not used in any activity, and only used as *part* of another schema.
900///
901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
902#[serde_with::serde_as]
903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
904pub struct Distribution {
905    /// The CPU architecture for which packages in this distribution channel were built.
906    pub architecture: Option<String>,
907    /// Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) denoting the package manager version distributing a package.
908    #[serde(rename = "cpeUri")]
909    pub cpe_uri: Option<String>,
910    /// The distribution channel-specific description of this package.
911    pub description: Option<String>,
912    /// The latest available version of this package in this distribution channel.
913    #[serde(rename = "latestVersion")]
914    pub latest_version: Option<Version>,
915    /// A freeform string denoting the maintainer of this package.
916    pub maintainer: Option<String>,
917    /// The distribution channel-specific homepage for this package.
918    pub url: Option<String>,
919}
920
921impl common::Part for Distribution {}
922
923/// DocumentNote represents an SPDX Document Creation Information section: https://spdx.github.io/spdx-spec/2-document-creation-information/
924///
925/// This type is not used in any activity, and only used as *part* of another schema.
926///
927#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
928#[serde_with::serde_as]
929#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
930pub struct DocumentNote {
931    /// Compliance with the SPDX specification includes populating the SPDX fields therein with data related to such fields ("SPDX-Metadata")
932    #[serde(rename = "dataLicence")]
933    pub data_licence: Option<String>,
934    /// Provide a reference number that can be used to understand how to parse and interpret the rest of the file
935    #[serde(rename = "spdxVersion")]
936    pub spdx_version: Option<String>,
937}
938
939impl common::Part for DocumentNote {}
940
941/// DocumentOccurrence represents an SPDX Document Creation Information section: https://spdx.github.io/spdx-spec/2-document-creation-information/
942///
943/// This type is not used in any activity, and only used as *part* of another schema.
944///
945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
946#[serde_with::serde_as]
947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
948pub struct DocumentOccurrence {
949    /// Identify when the SPDX file was originally created. The date is to be specified according to combined date and time in UTC format as specified in ISO 8601 standard
950    #[serde(rename = "createTime")]
951    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
952    /// A field for creators of the SPDX file to provide general comments about the creation of the SPDX file or any other relevant comment not included in the other fields
953    #[serde(rename = "creatorComment")]
954    pub creator_comment: Option<String>,
955    /// Identify who (or what, in the case of a tool) created the SPDX file. If the SPDX file was created by an individual, indicate the person's name
956    pub creators: Option<Vec<String>>,
957    /// A field for creators of the SPDX file content to provide comments to the consumers of the SPDX document
958    #[serde(rename = "documentComment")]
959    pub document_comment: Option<String>,
960    /// Identify any external SPDX documents referenced within this SPDX document
961    #[serde(rename = "externalDocumentRefs")]
962    pub external_document_refs: Option<Vec<String>>,
963    /// Identify the current SPDX document which may be referenced in relationships by other files, packages internally and documents externally
964    pub id: Option<String>,
965    /// A field for creators of the SPDX file to provide the version of the SPDX License List used when the SPDX file was created
966    #[serde(rename = "licenseListVersion")]
967    pub license_list_version: Option<String>,
968    /// Provide an SPDX document specific namespace as a unique absolute Uniform Resource Identifier (URI) as specified in RFC-3986, with the exception of the ‘#’ delimiter
969    pub namespace: Option<String>,
970    /// Identify name of this document as designated by creator
971    pub title: Option<String>,
972}
973
974impl common::Part for DocumentOccurrence {}
975
976/// 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); }
977///
978/// # Activities
979///
980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
982///
983/// * [notes delete projects](ProjectNoteDeleteCall) (response)
984/// * [occurrences delete projects](ProjectOccurrenceDeleteCall) (response)
985#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
986#[serde_with::serde_as]
987#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
988pub struct Empty {
989    _never_set: Option<bool>,
990}
991
992impl common::ResponseResult for Empty {}
993
994/// MUST match https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An authenticated message of arbitrary type.
995///
996/// This type is not used in any activity, and only used as *part* of another schema.
997///
998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
999#[serde_with::serde_as]
1000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct Envelope {
1002    /// no description provided
1003    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1004    pub payload: Option<Vec<u8>>,
1005    /// no description provided
1006    #[serde(rename = "payloadType")]
1007    pub payload_type: Option<String>,
1008    /// no description provided
1009    pub signatures: Option<Vec<EnvelopeSignature>>,
1010}
1011
1012impl common::Part for Envelope {}
1013
1014/// There is no detailed description.
1015///
1016/// This type is not used in any activity, and only used as *part* of another schema.
1017///
1018#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1019#[serde_with::serde_as]
1020#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1021pub struct EnvelopeSignature {
1022    /// no description provided
1023    pub keyid: Option<String>,
1024    /// no description provided
1025    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1026    pub sig: Option<Vec<u8>>,
1027}
1028
1029impl common::Part for EnvelopeSignature {}
1030
1031/// Defines an object for the environment field in in-toto links. The suggested fields are "variables", "filesystem", and "workdir".
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 Environment {
1039    /// no description provided
1040    #[serde(rename = "customValues")]
1041    pub custom_values: Option<HashMap<String, String>>,
1042}
1043
1044impl common::Part for Environment {}
1045
1046/// The request to a call of ExportSBOM
1047///
1048/// # Activities
1049///
1050/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1051/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1052///
1053/// * [locations resources export sbom projects](ProjectLocationResourceExportSBOMCall) (request)
1054/// * [resources export sbom projects](ProjectResourceExportSBOMCall) (request)
1055#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1056#[serde_with::serde_as]
1057#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1058pub struct ExportSBOMRequest {
1059    _never_set: Option<bool>,
1060}
1061
1062impl common::RequestValue for ExportSBOMRequest {}
1063
1064/// The response from a call to ExportSBOM
1065///
1066/// # Activities
1067///
1068/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1069/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1070///
1071/// * [locations resources export sbom projects](ProjectLocationResourceExportSBOMCall) (response)
1072/// * [resources export sbom projects](ProjectResourceExportSBOMCall) (response)
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct ExportSBOMResponse {
1077    /// The name of the discovery occurrence in the form "projects/{project_id}/occurrences/{OCCURRENCE_ID} It can be used to track the progression of the SBOM export.
1078    #[serde(rename = "discoveryOccurrenceId")]
1079    pub discovery_occurrence_id: Option<String>,
1080}
1081
1082impl common::ResponseResult for ExportSBOMResponse {}
1083
1084/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
1085///
1086/// This type is not used in any activity, and only used as *part* of another schema.
1087///
1088#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1089#[serde_with::serde_as]
1090#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1091pub struct Expr {
1092    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1093    pub description: Option<String>,
1094    /// Textual representation of an expression in Common Expression Language syntax.
1095    pub expression: Option<String>,
1096    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1097    pub location: Option<String>,
1098    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
1099    pub title: Option<String>,
1100}
1101
1102impl common::Part for Expr {}
1103
1104/// An External Reference allows a Package to reference an external source of additional information, metadata, enumerations, asset identifiers, or downloadable content believed to be relevant to the Package
1105///
1106/// This type is not used in any activity, and only used as *part* of another schema.
1107///
1108#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1109#[serde_with::serde_as]
1110#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1111pub struct ExternalRef {
1112    /// An External Reference allows a Package to reference an external source of additional information, metadata, enumerations, asset identifiers, or downloadable content believed to be relevant to the Package
1113    pub category: Option<String>,
1114    /// Human-readable information about the purpose and target of the reference
1115    pub comment: Option<String>,
1116    /// The unique string with no spaces necessary to access the package-specific information, metadata, or content within the target location
1117    pub locator: Option<String>,
1118    /// Type of category (e.g. 'npm' for the PACKAGE_MANAGER category)
1119    #[serde(rename = "type")]
1120    pub type_: Option<String>,
1121}
1122
1123impl common::Part for ExternalRef {}
1124
1125/// Container message for hashes of byte content of files, used in source messages to verify integrity of source input to the build.
1126///
1127/// This type is not used in any activity, and only used as *part* of another schema.
1128///
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct FileHashes {
1133    /// Required. Collection of file hashes.
1134    #[serde(rename = "fileHash")]
1135    pub file_hash: Option<Vec<Hash>>,
1136}
1137
1138impl common::Part for FileHashes {}
1139
1140/// FileNote represents an SPDX File Information section: https://spdx.github.io/spdx-spec/4-file-information/
1141///
1142/// This type is not used in any activity, and only used as *part* of another schema.
1143///
1144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1145#[serde_with::serde_as]
1146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1147pub struct FileNote {
1148    /// Provide a unique identifier to match analysis information on each specific file in a package
1149    pub checksum: Option<Vec<String>>,
1150    /// This field provides information about the type of file identified
1151    #[serde(rename = "fileType")]
1152    pub file_type: Option<String>,
1153    /// Identify the full path and filename that corresponds to the file information in this section
1154    pub title: Option<String>,
1155}
1156
1157impl common::Part for FileNote {}
1158
1159/// FileOccurrence represents an SPDX File Information section: https://spdx.github.io/spdx-spec/4-file-information/
1160///
1161/// This type is not used in any activity, and only used as *part* of another schema.
1162///
1163#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1164#[serde_with::serde_as]
1165#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1166pub struct FileOccurrence {
1167    /// This field provides a place for the SPDX data creator to record, at the file level, acknowledgements that may be needed to be communicated in some contexts
1168    pub attributions: Option<Vec<String>>,
1169    /// This field provides a place for the SPDX file creator to record any general comments about the file
1170    pub comment: Option<String>,
1171    /// This field provides a place for the SPDX file creator to record file contributors
1172    pub contributors: Option<Vec<String>>,
1173    /// Identify the copyright holder of the file, as well as any dates present
1174    pub copyright: Option<String>,
1175    /// This field contains the license information actually found in the file, if any
1176    #[serde(rename = "filesLicenseInfo")]
1177    pub files_license_info: Option<Vec<String>>,
1178    /// Uniquely identify any element in an SPDX document which may be referenced by other elements
1179    pub id: Option<String>,
1180    /// This field contains the license the SPDX file creator has concluded as governing the file or alternative values if the governing license cannot be determined
1181    #[serde(rename = "licenseConcluded")]
1182    pub license_concluded: Option<License>,
1183    /// This field provides a place for the SPDX file creator to record license notices or other such related notices found in the file
1184    pub notice: Option<String>,
1185}
1186
1187impl common::Part for FileOccurrence {}
1188
1189/// A set of properties that uniquely identify a given Docker image.
1190///
1191/// This type is not used in any activity, and only used as *part* of another schema.
1192///
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct Fingerprint {
1197    /// Required. The layer ID of the final layer in the Docker image's v1 representation.
1198    #[serde(rename = "v1Name")]
1199    pub v1_name: Option<String>,
1200    /// Required. The ordered list of v2 blobs that represent a given image.
1201    #[serde(rename = "v2Blob")]
1202    pub v2_blob: Option<Vec<String>>,
1203    /// 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.
1204    #[serde(rename = "v2Name")]
1205    pub v2_name: Option<String>,
1206}
1207
1208impl common::Part for Fingerprint {}
1209
1210/// Per resource and severity counts of fixable and total vulnerabilities.
1211///
1212/// This type is not used in any activity, and only used as *part* of another schema.
1213///
1214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1215#[serde_with::serde_as]
1216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1217pub struct FixableTotalByDigest {
1218    /// The number of fixable vulnerabilities associated with this resource.
1219    #[serde(rename = "fixableCount")]
1220    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1221    pub fixable_count: Option<i64>,
1222    /// The affected resource.
1223    pub resource: Option<Resource>,
1224    /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across all severities.
1225    pub severity: Option<String>,
1226    /// The total number of vulnerabilities associated with this resource.
1227    #[serde(rename = "totalCount")]
1228    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1229    pub total_count: Option<i64>,
1230}
1231
1232impl common::Part for FixableTotalByDigest {}
1233
1234/// GeneratePackagesSummaryRequest is the request body for the GeneratePackagesSummary API method. It just takes a single name argument, referring to the resource.
1235///
1236/// # Activities
1237///
1238/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1239/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1240///
1241/// * [locations resources generate packages summary projects](ProjectLocationResourceGeneratePackagesSummaryCall) (request)
1242/// * [resources generate packages summary projects](ProjectResourceGeneratePackagesSummaryCall) (request)
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct GeneratePackagesSummaryRequest {
1247    _never_set: Option<bool>,
1248}
1249
1250impl common::RequestValue for GeneratePackagesSummaryRequest {}
1251
1252/// An attestation wrapper that uses the Grafeas `Signature` message. This attestation must define the `serialized_payload` that the `signatures` verify and any metadata necessary to interpret that plaintext. The signatures should always be over the `serialized_payload` bytestring.
1253///
1254/// This type is not used in any activity, and only used as *part* of another schema.
1255///
1256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1257#[serde_with::serde_as]
1258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1259pub struct GenericSignedAttestation {
1260    /// Type (for example schema) of the attestation payload that was signed. The verifier must ensure that the provided type is one that the verifier supports, and that the attestation payload is a valid instantiation of that type (for example by validating a JSON schema).
1261    #[serde(rename = "contentType")]
1262    pub content_type: Option<String>,
1263    /// The serialized payload that is verified by one or more `signatures`. The encoding and semantic meaning of this payload must match what is set in `content_type`.
1264    #[serde(rename = "serializedPayload")]
1265    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1266    pub serialized_payload: Option<Vec<u8>>,
1267    /// 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.
1268    pub signatures: Option<Vec<Signature>>,
1269}
1270
1271impl common::Part for GenericSignedAttestation {}
1272
1273/// A SourceContext referring to a Gerrit project.
1274///
1275/// This type is not used in any activity, and only used as *part* of another schema.
1276///
1277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1278#[serde_with::serde_as]
1279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1280pub struct GerritSourceContext {
1281    /// An alias, which may be a branch or tag.
1282    #[serde(rename = "aliasContext")]
1283    pub alias_context: Option<AliasContext>,
1284    /// 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.
1285    #[serde(rename = "gerritProject")]
1286    pub gerrit_project: Option<String>,
1287    /// The URI of a running Gerrit instance.
1288    #[serde(rename = "hostUri")]
1289    pub host_uri: Option<String>,
1290    /// A revision (commit) ID.
1291    #[serde(rename = "revisionId")]
1292    pub revision_id: Option<String>,
1293}
1294
1295impl common::Part for GerritSourceContext {}
1296
1297/// Request message for `GetIamPolicy` method.
1298///
1299/// # Activities
1300///
1301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1303///
1304/// * [notes get iam policy projects](ProjectNoteGetIamPolicyCall) (request)
1305/// * [occurrences get iam policy projects](ProjectOccurrenceGetIamPolicyCall) (request)
1306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1307#[serde_with::serde_as]
1308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1309pub struct GetIamPolicyRequest {
1310    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
1311    pub options: Option<GetPolicyOptions>,
1312}
1313
1314impl common::RequestValue for GetIamPolicyRequest {}
1315
1316/// Encapsulates settings provided to GetIamPolicy.
1317///
1318/// This type is not used in any activity, and only used as *part* of another schema.
1319///
1320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1321#[serde_with::serde_as]
1322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1323pub struct GetPolicyOptions {
1324    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1325    #[serde(rename = "requestedPolicyVersion")]
1326    pub requested_policy_version: Option<i32>,
1327}
1328
1329impl common::Part for GetPolicyOptions {}
1330
1331/// A GitSourceContext denotes a particular revision in a third party Git repository (e.g., GitHub).
1332///
1333/// This type is not used in any activity, and only used as *part* of another schema.
1334///
1335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1336#[serde_with::serde_as]
1337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1338pub struct GitSourceContext {
1339    /// Git commit hash.
1340    #[serde(rename = "revisionId")]
1341    pub revision_id: Option<String>,
1342    /// Git repository URL.
1343    pub url: Option<String>,
1344}
1345
1346impl common::Part for GitSourceContext {}
1347
1348/// Details of a build occurrence.
1349///
1350/// This type is not used in any activity, and only used as *part* of another schema.
1351///
1352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1353#[serde_with::serde_as]
1354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1355pub struct GrafeasV1beta1BuildDetails {
1356    /// no description provided
1357    #[serde(rename = "inTotoSlsaProvenanceV1")]
1358    pub in_toto_slsa_provenance_v1: Option<InTotoSlsaProvenanceV1>,
1359    /// Required. The actual provenance for the build.
1360    pub provenance: Option<BuildProvenance>,
1361    /// 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.
1362    #[serde(rename = "provenanceBytes")]
1363    pub provenance_bytes: Option<String>,
1364}
1365
1366impl common::Part for GrafeasV1beta1BuildDetails {}
1367
1368/// Details of a deployment occurrence.
1369///
1370/// This type is not used in any activity, and only used as *part* of another schema.
1371///
1372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1373#[serde_with::serde_as]
1374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1375pub struct GrafeasV1beta1DeploymentDetails {
1376    /// Required. Deployment history for the resource.
1377    pub deployment: Option<Deployment>,
1378}
1379
1380impl common::Part for GrafeasV1beta1DeploymentDetails {}
1381
1382/// Details of a discovery occurrence.
1383///
1384/// This type is not used in any activity, and only used as *part* of another schema.
1385///
1386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1387#[serde_with::serde_as]
1388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1389pub struct GrafeasV1beta1DiscoveryDetails {
1390    /// Required. Analysis status for the discovered resource.
1391    pub discovered: Option<Discovered>,
1392}
1393
1394impl common::Part for GrafeasV1beta1DiscoveryDetails {}
1395
1396/// Details of an image occurrence.
1397///
1398/// This type is not used in any activity, and only used as *part* of another schema.
1399///
1400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1401#[serde_with::serde_as]
1402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1403pub struct GrafeasV1beta1ImageDetails {
1404    /// Required. Immutable. The child image derived from the base image.
1405    #[serde(rename = "derivedImage")]
1406    pub derived_image: Option<Derived>,
1407}
1408
1409impl common::Part for GrafeasV1beta1ImageDetails {}
1410
1411/// There is no detailed description.
1412///
1413/// This type is not used in any activity, and only used as *part* of another schema.
1414///
1415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1416#[serde_with::serde_as]
1417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1418pub struct GrafeasV1beta1IntotoArtifact {
1419    /// no description provided
1420    pub hashes: Option<ArtifactHashes>,
1421    /// no description provided
1422    #[serde(rename = "resourceUri")]
1423    pub resource_uri: Option<String>,
1424}
1425
1426impl common::Part for GrafeasV1beta1IntotoArtifact {}
1427
1428/// This corresponds to a signed in-toto link - it is made up of one or more signatures and the in-toto link itself. This is used for occurrences of a Grafeas in-toto note.
1429///
1430/// This type is not used in any activity, and only used as *part* of another schema.
1431///
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct GrafeasV1beta1IntotoDetails {
1436    /// no description provided
1437    pub signatures: Option<Vec<GrafeasV1beta1IntotoSignature>>,
1438    /// no description provided
1439    pub signed: Option<Link>,
1440}
1441
1442impl common::Part for GrafeasV1beta1IntotoDetails {}
1443
1444/// A signature object consists of the KeyID used and the signature itself.
1445///
1446/// This type is not used in any activity, and only used as *part* of another schema.
1447///
1448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1449#[serde_with::serde_as]
1450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1451pub struct GrafeasV1beta1IntotoSignature {
1452    /// no description provided
1453    pub keyid: Option<String>,
1454    /// no description provided
1455    pub sig: Option<String>,
1456}
1457
1458impl common::Part for GrafeasV1beta1IntotoSignature {}
1459
1460/// Details of a package occurrence.
1461///
1462/// This type is not used in any activity, and only used as *part* of another schema.
1463///
1464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1465#[serde_with::serde_as]
1466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1467pub struct GrafeasV1beta1PackageDetails {
1468    /// Required. Where the package was installed.
1469    pub installation: Option<Installation>,
1470}
1471
1472impl common::Part for GrafeasV1beta1PackageDetails {}
1473
1474/// Details of a vulnerability Occurrence.
1475///
1476/// This type is not used in any activity, and only used as *part* of another schema.
1477///
1478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1479#[serde_with::serde_as]
1480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1481pub struct GrafeasV1beta1VulnerabilityDetails {
1482    /// 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.
1483    #[serde(rename = "cvssScore")]
1484    pub cvss_score: Option<f32>,
1485    /// The cvss v2 score for the vulnerability.
1486    #[serde(rename = "cvssV2")]
1487    pub cvss_v2: Option<CVSS>,
1488    /// The cvss v3 score for the vulnerability.
1489    #[serde(rename = "cvssV3")]
1490    pub cvss_v3: Option<CVSS>,
1491    /// Output only. CVSS version used to populate cvss_score and severity.
1492    #[serde(rename = "cvssVersion")]
1493    pub cvss_version: Option<String>,
1494    /// The distro assigned severity for this vulnerability when it is available, and note provider assigned severity when distro has not yet assigned a severity for this vulnerability. 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.
1495    #[serde(rename = "effectiveSeverity")]
1496    pub effective_severity: Option<String>,
1497    /// Occurrence-specific extra details about the vulnerability.
1498    #[serde(rename = "extraDetails")]
1499    pub extra_details: Option<String>,
1500    /// Output only. A detailed description of this vulnerability.
1501    #[serde(rename = "longDescription")]
1502    pub long_description: Option<String>,
1503    /// Required. The set of affected locations and their fixes (if available) within the associated resource.
1504    #[serde(rename = "packageIssue")]
1505    pub package_issue: Option<Vec<PackageIssue>>,
1506    /// Output only. URLs related to this vulnerability.
1507    #[serde(rename = "relatedUrls")]
1508    pub related_urls: Option<Vec<RelatedUrl>>,
1509    /// Output only. The note provider assigned Severity of the vulnerability.
1510    pub severity: Option<String>,
1511    /// Output only. A one sentence description of this vulnerability.
1512    #[serde(rename = "shortDescription")]
1513    pub short_description: Option<String>,
1514    /// The type of package; whether native or non native(ruby gems, node.js packages etc)
1515    #[serde(rename = "type")]
1516    pub type_: Option<String>,
1517    /// no description provided
1518    #[serde(rename = "vexAssessment")]
1519    pub vex_assessment: Option<VexAssessment>,
1520}
1521
1522impl common::Part for GrafeasV1beta1VulnerabilityDetails {}
1523
1524/// Container message for hash values.
1525///
1526/// This type is not used in any activity, and only used as *part* of another schema.
1527///
1528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1529#[serde_with::serde_as]
1530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1531pub struct Hash {
1532    /// Required. The type of hash that was performed.
1533    #[serde(rename = "type")]
1534    pub type_: Option<String>,
1535    /// Required. The hash value.
1536    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1537    pub value: Option<Vec<u8>>,
1538}
1539
1540impl common::Part for Hash {}
1541
1542/// This submessage provides human-readable hints about the purpose of the authority. Because the name of a note acts as its resource reference, it is important to disambiguate the canonical name of the Note (which might be a UUID for security purposes) from "readable" names more suitable for debug output. Note that these hints should not be used to look up authorities in security sensitive contexts, such as when looking up attestations to verify.
1543///
1544/// This type is not used in any activity, and only used as *part* of another schema.
1545///
1546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1547#[serde_with::serde_as]
1548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1549pub struct Hint {
1550    /// Required. The human readable name of this attestation authority, for example "qa".
1551    #[serde(rename = "humanReadableName")]
1552    pub human_readable_name: Option<String>,
1553}
1554
1555impl common::Part for Hint {}
1556
1557/// This contains the fields corresponding to the definition of a software supply chain step in an in-toto layout. This information goes into a Grafeas note.
1558///
1559/// This type is not used in any activity, and only used as *part* of another schema.
1560///
1561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1562#[serde_with::serde_as]
1563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1564pub struct InToto {
1565    /// This field contains the expected command used to perform the step.
1566    #[serde(rename = "expectedCommand")]
1567    pub expected_command: Option<Vec<String>>,
1568    /// The following fields contain in-toto artifact rules identifying the artifacts that enter this supply chain step, and exit the supply chain step, i.e. materials and products of the step.
1569    #[serde(rename = "expectedMaterials")]
1570    pub expected_materials: Option<Vec<ArtifactRule>>,
1571    /// no description provided
1572    #[serde(rename = "expectedProducts")]
1573    pub expected_products: Option<Vec<ArtifactRule>>,
1574    /// This field contains the public keys that can be used to verify the signatures on the step metadata.
1575    #[serde(rename = "signingKeys")]
1576    pub signing_keys: Option<Vec<SigningKey>>,
1577    /// This field identifies the name of the step in the supply chain.
1578    #[serde(rename = "stepName")]
1579    pub step_name: Option<String>,
1580    /// This field contains a value that indicates the minimum number of keys that need to be used to sign the step's in-toto link.
1581    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1582    pub threshold: Option<i64>,
1583}
1584
1585impl common::Part for InToto {}
1586
1587/// There is no detailed description.
1588///
1589/// This type is not used in any activity, and only used as *part* of another schema.
1590///
1591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1592#[serde_with::serde_as]
1593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1594pub struct InTotoSlsaProvenanceV1 {
1595    /// InToto spec defined at https://github.com/in-toto/attestation/tree/main/spec#statement
1596    pub _type: Option<String>,
1597    /// no description provided
1598    pub predicate: Option<SlsaProvenanceV1>,
1599    /// no description provided
1600    #[serde(rename = "predicateType")]
1601    pub predicate_type: Option<String>,
1602    /// no description provided
1603    pub subject: Option<Vec<Subject>>,
1604}
1605
1606impl common::Part for InTotoSlsaProvenanceV1 {}
1607
1608/// This represents how a particular software package may be installed on a system.
1609///
1610/// This type is not used in any activity, and only used as *part* of another schema.
1611///
1612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1613#[serde_with::serde_as]
1614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1615pub struct Installation {
1616    /// Output only. The CPU architecture for which packages in this distribution channel were built. Architecture will be blank for language packages.
1617    pub architecture: Option<String>,
1618    /// 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.
1619    #[serde(rename = "cpeUri")]
1620    pub cpe_uri: Option<String>,
1621    /// Licenses that have been declared by the authors of the package.
1622    pub license: Option<License>,
1623    /// All of the places within the filesystem versions of this package have been found.
1624    pub location: Option<Vec<Location>>,
1625    /// Required. Output only. The name of the installed package.
1626    pub name: Option<String>,
1627    /// Output only. The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
1628    #[serde(rename = "packageType")]
1629    pub package_type: Option<String>,
1630    /// Output only. The version of the package.
1631    pub version: Option<Version>,
1632}
1633
1634impl common::Part for Installation {}
1635
1636/// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
1637///
1638/// This type is not used in any activity, and only used as *part* of another schema.
1639///
1640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1641#[serde_with::serde_as]
1642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1643pub struct Justification {
1644    /// Additional details on why this justification was chosen.
1645    pub details: Option<String>,
1646    /// The justification type for this vulnerability.
1647    #[serde(rename = "justificationType")]
1648    pub justification_type: Option<String>,
1649}
1650
1651impl common::Part for Justification {}
1652
1653/// There is no detailed description.
1654///
1655/// This type is not used in any activity, and only used as *part* of another schema.
1656///
1657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1658#[serde_with::serde_as]
1659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1660pub struct KnowledgeBase {
1661    /// The KB name (generally of the form KB[0-9]+ i.e. KB123456).
1662    pub name: Option<String>,
1663    /// A link to the KB in the Windows update catalog - https://www.catalog.update.microsoft.com/
1664    pub url: Option<String>,
1665}
1666
1667impl common::Part for KnowledgeBase {}
1668
1669/// Layer holds metadata specific to a layer of a Docker image.
1670///
1671/// This type is not used in any activity, and only used as *part* of another schema.
1672///
1673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1674#[serde_with::serde_as]
1675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1676pub struct Layer {
1677    /// The recovered arguments to the Dockerfile directive.
1678    pub arguments: Option<String>,
1679    /// Required. The recovered Dockerfile directive used to construct this layer.
1680    pub directive: Option<String>,
1681}
1682
1683impl common::Part for Layer {}
1684
1685/// License information.
1686///
1687/// This type is not used in any activity, and only used as *part* of another schema.
1688///
1689#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1690#[serde_with::serde_as]
1691#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1692pub struct License {
1693    /// Comments
1694    pub comments: Option<String>,
1695    /// 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".
1696    pub expression: Option<String>,
1697}
1698
1699impl common::Part for License {}
1700
1701/// Per license count
1702///
1703/// This type is not used in any activity, and only used as *part* of another schema.
1704///
1705#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1706#[serde_with::serde_as]
1707#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1708pub struct LicensesSummary {
1709    /// The number of fixable vulnerabilities associated with this resource.
1710    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1711    pub count: Option<i64>,
1712    /// The license of the package. Note that the format of this value is not guaranteed. It may be nil, an empty string, a boolean value (A | B), a differently formed boolean value (A OR B), etc...
1713    pub license: Option<String>,
1714}
1715
1716impl common::Part for LicensesSummary {}
1717
1718/// This corresponds to an in-toto link.
1719///
1720/// This type is not used in any activity, and only used as *part* of another schema.
1721///
1722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1723#[serde_with::serde_as]
1724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1725pub struct Link {
1726    /// ByProducts are data generated as part of a software supply chain step, but are not the actual result of the step.
1727    pub byproducts: Option<ByProducts>,
1728    /// This field contains the full command executed for the step. This can also be empty if links are generated for operations that aren't directly mapped to a specific command. Each term in the command is an independent string in the list. An example of a command in the in-toto metadata field is: "command": ["git", "clone", "https://github.com/in-toto/demo-project.git"]
1729    pub command: Option<Vec<String>>,
1730    /// This is a field that can be used to capture information about the environment. It is suggested for this field to contain information that details environment variables, filesystem information, and the present working directory. The recommended structure of this field is: "environment": { "custom_values": { "variables": "", "filesystem": "", "workdir": "", "": "..." } }
1731    pub environment: Option<Environment>,
1732    /// Materials are the supply chain artifacts that go into the step and are used for the operation performed. The key of the map is the path of the artifact and the structure contains the recorded hash information. An example is: "materials": [ { "resource_uri": "foo/bar", "hashes": { "sha256": "ebebf...", : } } ]
1733    pub materials: Option<Vec<GrafeasV1beta1IntotoArtifact>>,
1734    /// Products are the supply chain artifacts generated as a result of the step. The structure is identical to that of materials.
1735    pub products: Option<Vec<GrafeasV1beta1IntotoArtifact>>,
1736}
1737
1738impl common::Part for Link {}
1739
1740/// Response for listing occurrences for a note.
1741///
1742/// # Activities
1743///
1744/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1745/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1746///
1747/// * [locations notes occurrences list projects](ProjectLocationNoteOccurrenceListCall) (response)
1748/// * [notes occurrences list projects](ProjectNoteOccurrenceListCall) (response)
1749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1750#[serde_with::serde_as]
1751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1752pub struct ListNoteOccurrencesResponse {
1753    /// Token to provide to skip to a particular spot in the list.
1754    #[serde(rename = "nextPageToken")]
1755    pub next_page_token: Option<String>,
1756    /// The occurrences attached to the specified note.
1757    pub occurrences: Option<Vec<Occurrence>>,
1758}
1759
1760impl common::ResponseResult for ListNoteOccurrencesResponse {}
1761
1762/// Response for listing notes.
1763///
1764/// # Activities
1765///
1766/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1767/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1768///
1769/// * [locations notes list projects](ProjectLocationNoteListCall) (response)
1770/// * [notes list projects](ProjectNoteListCall) (response)
1771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1772#[serde_with::serde_as]
1773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1774pub struct ListNotesResponse {
1775    /// The next pagination token in the list response. It should be used as `page_token` for the following request. An empty value means no more results.
1776    #[serde(rename = "nextPageToken")]
1777    pub next_page_token: Option<String>,
1778    /// The notes requested.
1779    pub notes: Option<Vec<Note>>,
1780}
1781
1782impl common::ResponseResult for ListNotesResponse {}
1783
1784/// Response for listing occurrences.
1785///
1786/// # Activities
1787///
1788/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1789/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1790///
1791/// * [locations occurrences list projects](ProjectLocationOccurrenceListCall) (response)
1792/// * [occurrences list projects](ProjectOccurrenceListCall) (response)
1793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1794#[serde_with::serde_as]
1795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1796pub struct ListOccurrencesResponse {
1797    /// The next pagination token in the list response. It should be used as `page_token` for the following request. An empty value means no more results.
1798    #[serde(rename = "nextPageToken")]
1799    pub next_page_token: Option<String>,
1800    /// The occurrences requested.
1801    pub occurrences: Option<Vec<Occurrence>>,
1802}
1803
1804impl common::ResponseResult for ListOccurrencesResponse {}
1805
1806/// An occurrence of a particular package installation found within a system's filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
1807///
1808/// This type is not used in any activity, and only used as *part* of another schema.
1809///
1810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1811#[serde_with::serde_as]
1812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1813pub struct Location {
1814    /// Deprecated. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) denoting the package manager version distributing a package.
1815    #[serde(rename = "cpeUri")]
1816    pub cpe_uri: Option<String>,
1817    /// The path from which we gathered that this package/version is installed.
1818    pub path: Option<String>,
1819    /// Deprecated. The version installed at this location.
1820    pub version: Option<Version>,
1821}
1822
1823impl common::Part for Location {}
1824
1825/// A type of analysis that can be done for a resource.
1826///
1827/// # Activities
1828///
1829/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1830/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1831///
1832/// * [locations notes get projects](ProjectLocationNoteGetCall) (response)
1833/// * [locations occurrences get notes projects](ProjectLocationOccurrenceGetNoteCall) (response)
1834/// * [notes create projects](ProjectNoteCreateCall) (request|response)
1835/// * [notes get projects](ProjectNoteGetCall) (response)
1836/// * [notes patch projects](ProjectNotePatchCall) (request|response)
1837/// * [occurrences get notes projects](ProjectOccurrenceGetNoteCall) (response)
1838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1839#[serde_with::serde_as]
1840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1841pub struct Note {
1842    /// A note describing an attestation role.
1843    #[serde(rename = "attestationAuthority")]
1844    pub attestation_authority: Option<Authority>,
1845    /// A note describing a base image.
1846    #[serde(rename = "baseImage")]
1847    pub base_image: Option<Basis>,
1848    /// A note describing build provenance for a verifiable build.
1849    pub build: Option<Build>,
1850    /// Output only. The time this note was created. This field can be used as a filter in list requests.
1851    #[serde(rename = "createTime")]
1852    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1853    /// A note describing something that can be deployed.
1854    pub deployable: Option<Deployable>,
1855    /// A note describing the initial analysis of a resource.
1856    pub discovery: Option<Discovery>,
1857    /// Time of expiration for this note. Empty if note does not expire.
1858    #[serde(rename = "expirationTime")]
1859    pub expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1860    /// A note describing an in-toto link.
1861    pub intoto: Option<InToto>,
1862    /// Output only. The type of analysis. This field can be used as a filter in list requests.
1863    pub kind: Option<String>,
1864    /// A detailed description of this note.
1865    #[serde(rename = "longDescription")]
1866    pub long_description: Option<String>,
1867    /// Output only. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
1868    pub name: Option<String>,
1869    /// A note describing a package hosted by various package managers.
1870    pub package: Option<Package>,
1871    /// Other notes related to this note.
1872    #[serde(rename = "relatedNoteNames")]
1873    pub related_note_names: Option<Vec<String>>,
1874    /// URLs associated with this note.
1875    #[serde(rename = "relatedUrl")]
1876    pub related_url: Option<Vec<RelatedUrl>>,
1877    /// A note describing a software bill of materials.
1878    pub sbom: Option<DocumentNote>,
1879    /// A note describing an SBOM reference.
1880    #[serde(rename = "sbomReference")]
1881    pub sbom_reference: Option<SBOMReferenceNote>,
1882    /// A one sentence description of this note.
1883    #[serde(rename = "shortDescription")]
1884    pub short_description: Option<String>,
1885    /// A note describing an SPDX File.
1886    #[serde(rename = "spdxFile")]
1887    pub spdx_file: Option<FileNote>,
1888    /// A note describing an SPDX Package.
1889    #[serde(rename = "spdxPackage")]
1890    pub spdx_package: Option<PackageInfoNote>,
1891    /// A note describing an SPDX File.
1892    #[serde(rename = "spdxRelationship")]
1893    pub spdx_relationship: Option<RelationshipNote>,
1894    /// Output only. The time this note was last updated. This field can be used as a filter in list requests.
1895    #[serde(rename = "updateTime")]
1896    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1897    /// A note describing a package vulnerability.
1898    pub vulnerability: Option<Vulnerability>,
1899    /// A note describing a vulnerability assessment.
1900    #[serde(rename = "vulnerabilityAssessment")]
1901    pub vulnerability_assessment: Option<VulnerabilityAssessmentNote>,
1902}
1903
1904impl common::RequestValue for Note {}
1905impl common::ResponseResult for Note {}
1906
1907/// An instance of an analysis type that has been found on a resource.
1908///
1909/// # Activities
1910///
1911/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1912/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1913///
1914/// * [locations occurrences get projects](ProjectLocationOccurrenceGetCall) (response)
1915/// * [occurrences create projects](ProjectOccurrenceCreateCall) (request|response)
1916/// * [occurrences get projects](ProjectOccurrenceGetCall) (response)
1917/// * [occurrences patch projects](ProjectOccurrencePatchCall) (request|response)
1918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1919#[serde_with::serde_as]
1920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1921pub struct Occurrence {
1922    /// Describes an attestation of an artifact.
1923    pub attestation: Option<Details>,
1924    /// Describes a verifiable build.
1925    pub build: Option<GrafeasV1beta1BuildDetails>,
1926    /// Output only. The time this occurrence was created.
1927    #[serde(rename = "createTime")]
1928    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1929    /// Describes the deployment of an artifact on a runtime.
1930    pub deployment: Option<GrafeasV1beta1DeploymentDetails>,
1931    /// Describes how this resource derives from the basis in the associated note.
1932    #[serde(rename = "derivedImage")]
1933    pub derived_image: Option<GrafeasV1beta1ImageDetails>,
1934    /// Describes when a resource was discovered.
1935    pub discovered: Option<GrafeasV1beta1DiscoveryDetails>,
1936    /// https://github.com/secure-systems-lab/dsse
1937    pub envelope: Option<Envelope>,
1938    /// Describes the installation of a package on the linked resource.
1939    pub installation: Option<GrafeasV1beta1PackageDetails>,
1940    /// Describes a specific in-toto link.
1941    pub intoto: Option<GrafeasV1beta1IntotoDetails>,
1942    /// Output only. This explicitly denotes which of the occurrence details are specified. This field can be used as a filter in list requests.
1943    pub kind: Option<String>,
1944    /// Output only. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
1945    pub name: Option<String>,
1946    /// 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.
1947    #[serde(rename = "noteName")]
1948    pub note_name: Option<String>,
1949    /// A description of actions that can be taken to remedy the note.
1950    pub remediation: Option<String>,
1951    /// Required. Immutable. The resource for which the occurrence applies.
1952    pub resource: Option<Resource>,
1953    /// Describes a specific software bill of materials document.
1954    pub sbom: Option<DocumentOccurrence>,
1955    /// Describes a specific SBOM reference occurrences.
1956    #[serde(rename = "sbomReference")]
1957    pub sbom_reference: Option<SBOMReferenceOccurrence>,
1958    /// Describes a specific SPDX File.
1959    #[serde(rename = "spdxFile")]
1960    pub spdx_file: Option<FileOccurrence>,
1961    /// Describes a specific SPDX Package.
1962    #[serde(rename = "spdxPackage")]
1963    pub spdx_package: Option<PackageInfoOccurrence>,
1964    /// Describes a specific SPDX Relationship.
1965    #[serde(rename = "spdxRelationship")]
1966    pub spdx_relationship: Option<RelationshipOccurrence>,
1967    /// Output only. The time this occurrence was last updated.
1968    #[serde(rename = "updateTime")]
1969    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1970    /// Describes a security vulnerability.
1971    pub vulnerability: Option<GrafeasV1beta1VulnerabilityDetails>,
1972}
1973
1974impl common::RequestValue for Occurrence {}
1975impl common::ResponseResult for Occurrence {}
1976
1977/// Package represents a particular package version.
1978///
1979/// This type is not used in any activity, and only used as *part* of another schema.
1980///
1981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1982#[serde_with::serde_as]
1983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1984pub struct Package {
1985    /// The CPU architecture for which packages in this distribution channel were built. Architecture will be blank for language packages.
1986    pub architecture: Option<String>,
1987    /// 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.
1988    #[serde(rename = "cpeUri")]
1989    pub cpe_uri: Option<String>,
1990    /// The description of this package.
1991    pub description: Option<String>,
1992    /// Hash value, typically a file digest, that allows unique identification a specific package.
1993    pub digest: Option<Vec<Digest>>,
1994    /// The various channels by which a package is distributed.
1995    pub distribution: Option<Vec<Distribution>>,
1996    /// Licenses that have been declared by the authors of the package.
1997    pub license: Option<License>,
1998    /// A freeform text denoting the maintainer of this package.
1999    pub maintainer: Option<String>,
2000    /// Required. Immutable. The name of the package.
2001    pub name: Option<String>,
2002    /// The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
2003    #[serde(rename = "packageType")]
2004    pub package_type: Option<String>,
2005    /// The homepage for this package.
2006    pub url: Option<String>,
2007    /// The version of the package.
2008    pub version: Option<Version>,
2009}
2010
2011impl common::Part for Package {}
2012
2013/// PackageInfoNote represents an SPDX Package Information section: https://spdx.github.io/spdx-spec/3-package-information/
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 PackageInfoNote {
2021    /// Indicates whether the file content of this package has been available for or subjected to analysis when creating the SPDX document
2022    pub analyzed: Option<bool>,
2023    /// A place for the SPDX data creator to record, at the package level, acknowledgements that may be needed to be communicated in some contexts
2024    pub attribution: Option<String>,
2025    /// Provide an independently reproducible mechanism that permits unique identification of a specific package that correlates to the data in this SPDX file
2026    pub checksum: Option<String>,
2027    /// Identify the copyright holders of the package, as well as any dates present
2028    pub copyright: Option<String>,
2029    /// A more detailed description of the package
2030    #[serde(rename = "detailedDescription")]
2031    pub detailed_description: Option<String>,
2032    /// This section identifies the download Universal Resource Locator (URL), or a specific location within a version control system (VCS) for the package at the time that the SPDX file was created
2033    #[serde(rename = "downloadLocation")]
2034    pub download_location: Option<String>,
2035    /// ExternalRef
2036    #[serde(rename = "externalRefs")]
2037    pub external_refs: Option<Vec<ExternalRef>>,
2038    /// Contain the license the SPDX file creator has concluded as governing the This field is to contain a list of all licenses found in the package. The relationship between licenses (i.e., conjunctive, disjunctive) is not specified in this field – it is simply a listing of all licenses found
2039    #[serde(rename = "filesLicenseInfo")]
2040    pub files_license_info: Option<Vec<String>>,
2041    /// Provide a place for the SPDX file creator to record a web site that serves as the package's home page
2042    #[serde(rename = "homePage")]
2043    pub home_page: Option<String>,
2044    /// List the licenses that have been declared by the authors of the package
2045    #[serde(rename = "licenseDeclared")]
2046    pub license_declared: Option<License>,
2047    /// If the package identified in the SPDX file originated from a different person or organization than identified as Package Supplier, this field identifies from where or whom the package originally came
2048    pub originator: Option<String>,
2049    /// The type of package: OS, MAVEN, GO, GO_STDLIB, etc.
2050    #[serde(rename = "packageType")]
2051    pub package_type: Option<String>,
2052    /// A short description of the package
2053    #[serde(rename = "summaryDescription")]
2054    pub summary_description: Option<String>,
2055    /// Identify the actual distribution source for the package/directory identified in the SPDX file
2056    pub supplier: Option<String>,
2057    /// Identify the full name of the package as given by the Package Originator
2058    pub title: Option<String>,
2059    /// This field provides an independently reproducible mechanism identifying specific contents of a package based on the actual files (except the SPDX file itself, if it is included in the package) that make up each package and that correlates to the data in this SPDX file
2060    #[serde(rename = "verificationCode")]
2061    pub verification_code: Option<String>,
2062    /// Identify the version of the package
2063    pub version: Option<String>,
2064}
2065
2066impl common::Part for PackageInfoNote {}
2067
2068/// PackageInfoOccurrence represents an SPDX Package Information section: https://spdx.github.io/spdx-spec/3-package-information/
2069///
2070/// This type is not used in any activity, and only used as *part* of another schema.
2071///
2072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2073#[serde_with::serde_as]
2074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2075pub struct PackageInfoOccurrence {
2076    /// A place for the SPDX file creator to record any general comments about the package being described
2077    pub comment: Option<String>,
2078    /// Provide the actual file name of the package, or path of the directory being treated as a package
2079    pub filename: Option<String>,
2080    /// Output only. Provide a place for the SPDX file creator to record a web site that serves as the package's home page
2081    #[serde(rename = "homePage")]
2082    pub home_page: Option<String>,
2083    /// Uniquely identify any element in an SPDX document which may be referenced by other elements
2084    pub id: Option<String>,
2085    /// package or alternative values, if the governing license cannot be determined
2086    #[serde(rename = "licenseConcluded")]
2087    pub license_concluded: Option<License>,
2088    /// Output only. The type of package: OS, MAVEN, GO, GO_STDLIB, etc.
2089    #[serde(rename = "packageType")]
2090    pub package_type: Option<String>,
2091    /// Provide a place for the SPDX file creator to record any relevant background information or additional comments about the origin of the package
2092    #[serde(rename = "sourceInfo")]
2093    pub source_info: Option<String>,
2094    /// Output only. A short description of the package
2095    #[serde(rename = "summaryDescription")]
2096    pub summary_description: Option<String>,
2097    /// Output only. Identify the full name of the package as given by the Package Originator
2098    pub title: Option<String>,
2099    /// Output only. Identify the version of the package
2100    pub version: Option<String>,
2101}
2102
2103impl common::Part for PackageInfoOccurrence {}
2104
2105/// This message wraps a location affected by a vulnerability and its associated fix (if one is available).
2106///
2107/// This type is not used in any activity, and only used as *part* of another schema.
2108///
2109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2110#[serde_with::serde_as]
2111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2112pub struct PackageIssue {
2113    /// Required. The location of the vulnerability.
2114    #[serde(rename = "affectedLocation")]
2115    pub affected_location: Option<VulnerabilityLocation>,
2116    /// 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.
2117    #[serde(rename = "effectiveSeverity")]
2118    pub effective_severity: Option<String>,
2119    /// The location of the available fix for vulnerability.
2120    #[serde(rename = "fixedLocation")]
2121    pub fixed_location: Option<VulnerabilityLocation>,
2122    /// The type of package (e.g. OS, MAVEN, GO).
2123    #[serde(rename = "packageType")]
2124    pub package_type: Option<String>,
2125    /// Deprecated, use Details.effective_severity instead The severity (e.g., distro assigned severity) for this vulnerability.
2126    #[serde(rename = "severityName")]
2127    pub severity_name: Option<String>,
2128}
2129
2130impl common::Part for PackageIssue {}
2131
2132/// A summary of the packages found within the given resource.
2133///
2134/// # Activities
2135///
2136/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2137/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2138///
2139/// * [locations resources generate packages summary projects](ProjectLocationResourceGeneratePackagesSummaryCall) (response)
2140/// * [resources generate packages summary projects](ProjectResourceGeneratePackagesSummaryCall) (response)
2141#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2142#[serde_with::serde_as]
2143#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2144pub struct PackagesSummaryResponse {
2145    /// A listing by license name of each of the licenses and their counts.
2146    #[serde(rename = "licensesSummary")]
2147    pub licenses_summary: Option<Vec<LicensesSummary>>,
2148    /// The unique URL of the image or the container for which this summary applies.
2149    #[serde(rename = "resourceUrl")]
2150    pub resource_url: Option<String>,
2151}
2152
2153impl common::ResponseResult for PackagesSummaryResponse {}
2154
2155/// An attestation wrapper with a PGP-compatible signature. This message only supports `ATTACHED` signatures, where the payload that is signed is included alongside the signature itself in the same file.
2156///
2157/// This type is not used in any activity, and only used as *part* of another schema.
2158///
2159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2160#[serde_with::serde_as]
2161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2162pub struct PgpSignedAttestation {
2163    /// Type (for example schema) of the attestation payload that was signed. The verifier must ensure that the provided type is one that the verifier supports, and that the attestation payload is a valid instantiation of that type (for example by validating a JSON schema).
2164    #[serde(rename = "contentType")]
2165    pub content_type: Option<String>,
2166    /// The cryptographic fingerprint of the key used to generate the signature, as output by, e.g. `gpg --list-keys`. This should be the version 4, full 160-bit fingerprint, expressed as a 40 character hexadecimal string. See https://tools.ietf.org/html/rfc4880#section-12.2 for details. Implementations may choose to acknowledge "LONG", "SHORT", or other abbreviated key IDs, but only the full fingerprint is guaranteed to work. In gpg, the full fingerprint can be retrieved from the `fpr` field returned when calling --list-keys with --with-colons. For example: ``` gpg --with-colons --with-fingerprint --force-v4-certs \ --list-keys attester@example.com tru::1:1513631572:0:3:1:5 pub:...... fpr:::::::::24FF6481B76AC91E66A00AC657A93A81EF3AE6FB: ``` Above, the fingerprint is `24FF6481B76AC91E66A00AC657A93A81EF3AE6FB`.
2167    #[serde(rename = "pgpKeyId")]
2168    pub pgp_key_id: Option<String>,
2169    /// Required. The raw content of the signature, as output by GNU Privacy Guard (GPG) or equivalent. Since this message only supports attached signatures, the payload that was signed must be attached. While the signature format supported is dependent on the verification implementation, currently only ASCII-armored (`--armor` to gpg), non-clearsigned (`--sign` rather than `--clearsign` to gpg) are supported. Concretely, `gpg --sign --armor --output=signature.gpg payload.json` will create the signature content expected in this field in `signature.gpg` for the `payload.json` attestation payload.
2170    pub signature: Option<String>,
2171}
2172
2173impl common::Part for PgpSignedAttestation {}
2174
2175/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
2176///
2177/// # Activities
2178///
2179/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2180/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2181///
2182/// * [notes get iam policy projects](ProjectNoteGetIamPolicyCall) (response)
2183/// * [notes set iam policy projects](ProjectNoteSetIamPolicyCall) (response)
2184/// * [occurrences get iam policy projects](ProjectOccurrenceGetIamPolicyCall) (response)
2185/// * [occurrences set iam policy projects](ProjectOccurrenceSetIamPolicyCall) (response)
2186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2187#[serde_with::serde_as]
2188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2189pub struct Policy {
2190    /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
2191    pub bindings: Option<Vec<Binding>>,
2192    /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
2193    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2194    pub etag: Option<Vec<u8>>,
2195    /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
2196    pub version: Option<i32>,
2197}
2198
2199impl common::ResponseResult for Policy {}
2200
2201/// Product contains information about a product and how to uniquely identify it.
2202///
2203/// This type is not used in any activity, and only used as *part* of another schema.
2204///
2205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2206#[serde_with::serde_as]
2207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2208pub struct Product {
2209    /// Contains a URI which is vendor-specific. Example: The artifact repository URL of an image.
2210    #[serde(rename = "genericUri")]
2211    pub generic_uri: Option<String>,
2212    /// Token that identifies a product so that it can be referred to from other parts in the document. There is no predefined format as long as it uniquely identifies a group in the context of the current document.
2213    pub id: Option<String>,
2214    /// Name of the product.
2215    pub name: Option<String>,
2216}
2217
2218impl common::Part for Product {}
2219
2220/// Selects a repo using a Google Cloud Platform project ID (e.g., winged-cargo-31) and a repo name within that project.
2221///
2222/// This type is not used in any activity, and only used as *part* of another schema.
2223///
2224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2225#[serde_with::serde_as]
2226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2227pub struct ProjectRepoId {
2228    /// The ID of the project.
2229    #[serde(rename = "projectId")]
2230    pub project_id: Option<String>,
2231    /// The name of the repo. Leave empty for the default repo.
2232    #[serde(rename = "repoName")]
2233    pub repo_name: Option<String>,
2234}
2235
2236impl common::Part for ProjectRepoId {}
2237
2238/// There is no detailed description.
2239///
2240/// This type is not used in any activity, and only used as *part* of another schema.
2241///
2242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2243#[serde_with::serde_as]
2244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2245pub struct ProvenanceBuilder {
2246    /// no description provided
2247    #[serde(rename = "builderDependencies")]
2248    pub builder_dependencies: Option<Vec<ResourceDescriptor>>,
2249    /// no description provided
2250    pub id: Option<String>,
2251    /// no description provided
2252    pub version: Option<HashMap<String, String>>,
2253}
2254
2255impl common::Part for ProvenanceBuilder {}
2256
2257/// Publisher contains information about the publisher of this Note.
2258///
2259/// This type is not used in any activity, and only used as *part* of another schema.
2260///
2261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2262#[serde_with::serde_as]
2263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2264pub struct Publisher {
2265    /// Provides information about the authority of the issuing party to release the document, in particular, the party's constituency and responsibilities or other obligations.
2266    #[serde(rename = "issuingAuthority")]
2267    pub issuing_authority: Option<String>,
2268    /// Name of the publisher. Examples: 'Google', 'Google Cloud Platform'.
2269    pub name: Option<String>,
2270    /// The context or namespace. Contains a URL which is under control of the issuing party and can be used as a globally unique identifier for that issuing party. Example: https://csaf.io
2271    #[serde(rename = "publisherNamespace")]
2272    pub publisher_namespace: Option<String>,
2273}
2274
2275impl common::Part for Publisher {}
2276
2277/// Metadata for any related URL information.
2278///
2279/// This type is not used in any activity, and only used as *part* of another schema.
2280///
2281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2282#[serde_with::serde_as]
2283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2284pub struct RelatedUrl {
2285    /// Label to describe usage of the URL.
2286    pub label: Option<String>,
2287    /// Specific URL associated with the resource.
2288    pub url: Option<String>,
2289}
2290
2291impl common::Part for RelatedUrl {}
2292
2293/// RelationshipNote represents an SPDX Relationship section: https://spdx.github.io/spdx-spec/7-relationships-between-SPDX-elements/
2294///
2295/// This type is not used in any activity, and only used as *part* of another schema.
2296///
2297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2298#[serde_with::serde_as]
2299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2300pub struct RelationshipNote {
2301    /// The type of relationship between the source and target SPDX elements
2302    #[serde(rename = "type")]
2303    pub type_: Option<String>,
2304}
2305
2306impl common::Part for RelationshipNote {}
2307
2308/// RelationshipOccurrence represents an SPDX Relationship section: https://spdx.github.io/spdx-spec/7-relationships-between-SPDX-elements/
2309///
2310/// This type is not used in any activity, and only used as *part* of another schema.
2311///
2312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2313#[serde_with::serde_as]
2314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2315pub struct RelationshipOccurrence {
2316    /// A place for the SPDX file creator to record any general comments about the relationship
2317    pub comment: Option<String>,
2318    /// Also referred to as SPDXRef-A The source SPDX element (file, package, etc)
2319    pub source: Option<String>,
2320    /// Also referred to as SPDXRef-B The target SPDC element (file, package, etc) In cases where there are "known unknowns", the use of the keyword NOASSERTION can be used The keywords NONE can be used to indicate that an SPDX element (package/file/snippet) has no other elements connected by some relationship to it
2321    pub target: Option<String>,
2322    /// Output only. The type of relationship between the source and target SPDX elements
2323    #[serde(rename = "type")]
2324    pub type_: Option<String>,
2325}
2326
2327impl common::Part for RelationshipOccurrence {}
2328
2329/// Specifies details on how to handle (and presumably, fix) a vulnerability.
2330///
2331/// This type is not used in any activity, and only used as *part* of another schema.
2332///
2333#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2334#[serde_with::serde_as]
2335#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2336pub struct Remediation {
2337    /// Contains a comprehensive human-readable discussion of the remediation.
2338    pub details: Option<String>,
2339    /// The type of remediation that can be applied.
2340    #[serde(rename = "remediationType")]
2341    pub remediation_type: Option<String>,
2342    /// Contains the URL where to obtain the remediation.
2343    #[serde(rename = "remediationUri")]
2344    pub remediation_uri: Option<RelatedUrl>,
2345}
2346
2347impl common::Part for Remediation {}
2348
2349/// A unique identifier for a Cloud Repo.
2350///
2351/// This type is not used in any activity, and only used as *part* of another schema.
2352///
2353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2354#[serde_with::serde_as]
2355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2356pub struct RepoId {
2357    /// A combination of a project ID and a repo name.
2358    #[serde(rename = "projectRepoId")]
2359    pub project_repo_id: Option<ProjectRepoId>,
2360    /// A server-assigned, globally unique identifier.
2361    pub uid: Option<String>,
2362}
2363
2364impl common::Part for RepoId {}
2365
2366/// An entity that can have metadata. For example, a Docker image.
2367///
2368/// This type is not used in any activity, and only used as *part* of another schema.
2369///
2370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2371#[serde_with::serde_as]
2372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2373pub struct Resource {
2374    /// Deprecated, do not use. Use uri instead. The hash of the resource content. For example, the Docker digest.
2375    #[serde(rename = "contentHash")]
2376    pub content_hash: Option<Hash>,
2377    /// Deprecated, do not use. Use uri instead. The name of the resource. For example, the name of a Docker image - "Debian".
2378    pub name: Option<String>,
2379    /// Required. The unique URI of the resource. For example, `https://gcr.io/project/image@sha256:foo` for a Docker image.
2380    pub uri: Option<String>,
2381}
2382
2383impl common::Part for Resource {}
2384
2385/// There is no detailed description.
2386///
2387/// This type is not used in any activity, and only used as *part* of another schema.
2388///
2389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2390#[serde_with::serde_as]
2391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2392pub struct ResourceDescriptor {
2393    /// no description provided
2394    pub annotations: Option<HashMap<String, serde_json::Value>>,
2395    /// no description provided
2396    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2397    pub content: Option<Vec<u8>>,
2398    /// no description provided
2399    pub digest: Option<HashMap<String, String>>,
2400    /// no description provided
2401    #[serde(rename = "downloadLocation")]
2402    pub download_location: Option<String>,
2403    /// no description provided
2404    #[serde(rename = "mediaType")]
2405    pub media_type: Option<String>,
2406    /// no description provided
2407    pub name: Option<String>,
2408    /// no description provided
2409    pub uri: Option<String>,
2410}
2411
2412impl common::Part for ResourceDescriptor {}
2413
2414/// There is no detailed description.
2415///
2416/// This type is not used in any activity, and only used as *part* of another schema.
2417///
2418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2419#[serde_with::serde_as]
2420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2421pub struct RunDetails {
2422    /// no description provided
2423    pub builder: Option<ProvenanceBuilder>,
2424    /// no description provided
2425    pub byproducts: Option<Vec<ResourceDescriptor>>,
2426    /// no description provided
2427    pub metadata: Option<BuildMetadata>,
2428}
2429
2430impl common::Part for RunDetails {}
2431
2432/// The note representing an SBOM reference.
2433///
2434/// This type is not used in any activity, and only used as *part* of another schema.
2435///
2436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2437#[serde_with::serde_as]
2438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2439pub struct SBOMReferenceNote {
2440    /// The format that SBOM takes. E.g. may be spdx, cyclonedx, etc...
2441    pub format: Option<String>,
2442    /// The version of the format that the SBOM takes. E.g. if the format is spdx, the version may be 2.3.
2443    pub version: Option<String>,
2444}
2445
2446impl common::Part for SBOMReferenceNote {}
2447
2448/// 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.
2449///
2450/// This type is not used in any activity, and only used as *part* of another schema.
2451///
2452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2453#[serde_with::serde_as]
2454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2455pub struct SBOMReferenceOccurrence {
2456    /// The actual payload that contains the SBOM reference data.
2457    pub payload: Option<SbomReferenceIntotoPayload>,
2458    /// 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'.
2459    #[serde(rename = "payloadType")]
2460    pub payload_type: Option<String>,
2461    /// The signatures over the payload.
2462    pub signatures: Option<Vec<EnvelopeSignature>>,
2463}
2464
2465impl common::Part for SBOMReferenceOccurrence {}
2466
2467/// The status of an SBOM generation.
2468///
2469/// This type is not used in any activity, and only used as *part* of another schema.
2470///
2471#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2472#[serde_with::serde_as]
2473#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2474pub struct SBOMStatus {
2475    /// If there was an error generating an SBOM, this will indicate what that error was.
2476    pub error: Option<String>,
2477    /// The progress of the SBOM generation.
2478    #[serde(rename = "sbomState")]
2479    pub sbom_state: Option<String>,
2480}
2481
2482impl common::Part for SBOMStatus {}
2483
2484/// 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.
2485///
2486/// This type is not used in any activity, and only used as *part* of another schema.
2487///
2488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2489#[serde_with::serde_as]
2490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2491pub struct SbomReferenceIntotoPayload {
2492    /// Identifier for the schema of the Statement.
2493    pub _type: Option<String>,
2494    /// Additional parameters of the Predicate. Includes the actual data about the SBOM.
2495    pub predicate: Option<SbomReferenceIntotoPredicate>,
2496    /// URI identifying the type of the Predicate.
2497    #[serde(rename = "predicateType")]
2498    pub predicate_type: Option<String>,
2499    /// Set of software artifacts that the attestation applies to. Each element represents a single software artifact.
2500    pub subject: Option<Vec<Subject>>,
2501}
2502
2503impl common::Part for SbomReferenceIntotoPayload {}
2504
2505/// A predicate which describes the SBOM being referenced.
2506///
2507/// This type is not used in any activity, and only used as *part* of another schema.
2508///
2509#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2510#[serde_with::serde_as]
2511#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2512pub struct SbomReferenceIntotoPredicate {
2513    /// A map of algorithm to digest of the contents of the SBOM.
2514    pub digest: Option<HashMap<String, String>>,
2515    /// The location of the SBOM.
2516    pub location: Option<String>,
2517    /// The mime type of the SBOM.
2518    #[serde(rename = "mimeType")]
2519    pub mime_type: Option<String>,
2520    /// The person or system referring this predicate to the consumer.
2521    #[serde(rename = "referrerId")]
2522    pub referrer_id: Option<String>,
2523}
2524
2525impl common::Part for SbomReferenceIntotoPredicate {}
2526
2527/// Request message for `SetIamPolicy` method.
2528///
2529/// # Activities
2530///
2531/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2532/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2533///
2534/// * [notes set iam policy projects](ProjectNoteSetIamPolicyCall) (request)
2535/// * [occurrences set iam policy projects](ProjectOccurrenceSetIamPolicyCall) (request)
2536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2537#[serde_with::serde_as]
2538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2539pub struct SetIamPolicyRequest {
2540    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
2541    pub policy: Option<Policy>,
2542}
2543
2544impl common::RequestValue for SetIamPolicyRequest {}
2545
2546/// 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).
2547///
2548/// This type is not used in any activity, and only used as *part* of another schema.
2549///
2550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2551#[serde_with::serde_as]
2552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2553pub struct Signature {
2554    /// 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"
2555    #[serde(rename = "publicKeyId")]
2556    pub public_key_id: Option<String>,
2557    /// 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.
2558    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2559    pub signature: Option<Vec<u8>>,
2560}
2561
2562impl common::Part for Signature {}
2563
2564/// This defines the format used to record keys used in the software supply chain. An in-toto link is attested using one or more keys defined in the in-toto layout. An example of this is: { "key_id": "776a00e29f3559e0141b3b096f696abc6cfb0c657ab40f441132b345b0...", "key_type": "rsa", "public_key_value": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0B...", "key_scheme": "rsassa-pss-sha256" } The format for in-toto's key definition can be found in section 4.2 of the in-toto specification.
2565///
2566/// This type is not used in any activity, and only used as *part* of another schema.
2567///
2568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2569#[serde_with::serde_as]
2570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2571pub struct SigningKey {
2572    /// key_id is an identifier for the signing key.
2573    #[serde(rename = "keyId")]
2574    pub key_id: Option<String>,
2575    /// This field contains the corresponding signature scheme. Eg: "rsassa-pss-sha256".
2576    #[serde(rename = "keyScheme")]
2577    pub key_scheme: Option<String>,
2578    /// This field identifies the specific signing method. Eg: "rsa", "ed25519", and "ecdsa".
2579    #[serde(rename = "keyType")]
2580    pub key_type: Option<String>,
2581    /// This field contains the actual public key.
2582    #[serde(rename = "publicKeyValue")]
2583    pub public_key_value: Option<String>,
2584}
2585
2586impl common::Part for SigningKey {}
2587
2588/// 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.
2589///
2590/// This type is not used in any activity, and only used as *part* of another schema.
2591///
2592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2593#[serde_with::serde_as]
2594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2595pub struct SlsaProvenanceV1 {
2596    /// no description provided
2597    #[serde(rename = "buildDefinition")]
2598    pub build_definition: Option<BuildDefinition>,
2599    /// no description provided
2600    #[serde(rename = "runDetails")]
2601    pub run_details: Option<RunDetails>,
2602}
2603
2604impl common::Part for SlsaProvenanceV1 {}
2605
2606/// Source describes the location of the source used for the build.
2607///
2608/// This type is not used in any activity, and only used as *part* of another schema.
2609///
2610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2611#[serde_with::serde_as]
2612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2613pub struct Source {
2614    /// 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.
2615    #[serde(rename = "additionalContexts")]
2616    pub additional_contexts: Option<Vec<SourceContext>>,
2617    /// If provided, the input binary artifacts for the build came from this location.
2618    #[serde(rename = "artifactStorageSourceUri")]
2619    pub artifact_storage_source_uri: Option<String>,
2620    /// If provided, the source code used for the build came from this location.
2621    pub context: Option<SourceContext>,
2622    /// 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.
2623    #[serde(rename = "fileHashes")]
2624    pub file_hashes: Option<HashMap<String, FileHashes>>,
2625}
2626
2627impl common::Part for Source {}
2628
2629/// 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.
2630///
2631/// This type is not used in any activity, and only used as *part* of another schema.
2632///
2633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2634#[serde_with::serde_as]
2635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2636pub struct SourceContext {
2637    /// A SourceContext referring to a revision in a Google Cloud Source Repo.
2638    #[serde(rename = "cloudRepo")]
2639    pub cloud_repo: Option<CloudRepoSourceContext>,
2640    /// A SourceContext referring to a Gerrit project.
2641    pub gerrit: Option<GerritSourceContext>,
2642    /// A SourceContext referring to any third party Git repo (e.g., GitHub).
2643    pub git: Option<GitSourceContext>,
2644    /// Labels with user defined metadata.
2645    pub labels: Option<HashMap<String, String>>,
2646}
2647
2648impl common::Part for SourceContext {}
2649
2650/// 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).
2651///
2652/// This type is not used in any activity, and only used as *part* of another schema.
2653///
2654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2655#[serde_with::serde_as]
2656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2657pub struct Status {
2658    /// The status code, which should be an enum value of google.rpc.Code.
2659    pub code: Option<i32>,
2660    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2661    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2662    /// 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.
2663    pub message: Option<String>,
2664}
2665
2666impl common::Part for Status {}
2667
2668/// Set of software artifacts that the attestation applies to. Each element represents a single software artifact.
2669///
2670/// This type is not used in any activity, and only used as *part* of another schema.
2671///
2672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2673#[serde_with::serde_as]
2674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2675pub struct Subject {
2676    /// `"": ""` Algorithms can be e.g. sha256, sha512 See https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet
2677    pub digest: Option<HashMap<String, String>>,
2678    /// Identifier to distinguish this artifact from others within the subject.
2679    pub name: Option<String>,
2680}
2681
2682impl common::Part for Subject {}
2683
2684/// Request message for `TestIamPermissions` method.
2685///
2686/// # Activities
2687///
2688/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2689/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2690///
2691/// * [notes test iam permissions projects](ProjectNoteTestIamPermissionCall) (request)
2692/// * [occurrences test iam permissions projects](ProjectOccurrenceTestIamPermissionCall) (request)
2693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2694#[serde_with::serde_as]
2695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2696pub struct TestIamPermissionsRequest {
2697    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
2698    pub permissions: Option<Vec<String>>,
2699}
2700
2701impl common::RequestValue for TestIamPermissionsRequest {}
2702
2703/// Response message for `TestIamPermissions` method.
2704///
2705/// # Activities
2706///
2707/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2708/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2709///
2710/// * [notes test iam permissions projects](ProjectNoteTestIamPermissionCall) (response)
2711/// * [occurrences test iam permissions projects](ProjectOccurrenceTestIamPermissionCall) (response)
2712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2713#[serde_with::serde_as]
2714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2715pub struct TestIamPermissionsResponse {
2716    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2717    pub permissions: Option<Vec<String>>,
2718}
2719
2720impl common::ResponseResult for TestIamPermissionsResponse {}
2721
2722/// Version contains structured information about the version of a package.
2723///
2724/// This type is not used in any activity, and only used as *part* of another schema.
2725///
2726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2727#[serde_with::serde_as]
2728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2729pub struct Version {
2730    /// Used to correct mistakes in the version numbering scheme.
2731    pub epoch: Option<i32>,
2732    /// 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.
2733    pub inclusive: Option<bool>,
2734    /// Required. Distinguishes between sentinel MIN/MAX versions and normal versions.
2735    pub kind: Option<String>,
2736    /// Required only when version kind is NORMAL. The main part of the version name.
2737    pub name: Option<String>,
2738    /// The iteration of the package build from the above version.
2739    pub revision: Option<String>,
2740}
2741
2742impl common::Part for Version {}
2743
2744/// VexAssessment provides all publisher provided Vex information that is related to this vulnerability.
2745///
2746/// This type is not used in any activity, and only used as *part* of another schema.
2747///
2748#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2749#[serde_with::serde_as]
2750#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2751pub struct VexAssessment {
2752    /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability. Deprecated: Use vulnerability_id instead to denote CVEs.
2753    pub cve: Option<String>,
2754    /// Contains information about the impact of this vulnerability, this will change with time.
2755    pub impacts: Option<Vec<String>>,
2756    /// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
2757    pub justification: Option<Justification>,
2758    /// The VulnerabilityAssessment note from which this VexAssessment was generated. This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`.
2759    #[serde(rename = "noteName")]
2760    pub note_name: Option<String>,
2761    /// Holds a list of references associated with this vulnerability item and assessment.
2762    #[serde(rename = "relatedUris")]
2763    pub related_uris: Option<Vec<RelatedUrl>>,
2764    /// Specifies details on how to handle (and presumably, fix) a vulnerability.
2765    pub remediations: Option<Vec<Remediation>>,
2766    /// Provides the state of this Vulnerability assessment.
2767    pub state: Option<String>,
2768    /// The vulnerability identifier for this Assessment. Will hold one of common identifiers e.g. CVE, GHSA etc.
2769    #[serde(rename = "vulnerabilityId")]
2770    pub vulnerability_id: Option<String>,
2771}
2772
2773impl common::Part for VexAssessment {}
2774
2775/// Vulnerability provides metadata about a security vulnerability in a Note.
2776///
2777/// This type is not used in any activity, and only used as *part* of another schema.
2778///
2779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2780#[serde_with::serde_as]
2781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2782pub struct Vulnerability {
2783    /// The CVSS score for this vulnerability.
2784    #[serde(rename = "cvssScore")]
2785    pub cvss_score: Option<f32>,
2786    /// The full description of the CVSS for version 2.
2787    #[serde(rename = "cvssV2")]
2788    pub cvss_v2: Option<CVSS>,
2789    /// The full description of the CVSS for version 3.
2790    #[serde(rename = "cvssV3")]
2791    pub cvss_v3: Option<CVSSv3>,
2792    /// CVSS version used to populate cvss_score and severity.
2793    #[serde(rename = "cvssVersion")]
2794    pub cvss_version: Option<String>,
2795    /// A list of CWE for this vulnerability. For details, see: https://cwe.mitre.org/index.html
2796    pub cwe: Option<Vec<String>>,
2797    /// All information about the package to specifically identify this vulnerability. One entry per (version range and cpe_uri) the package vulnerability has manifested in.
2798    pub details: Option<Vec<Detail>>,
2799    /// Note provider assigned impact of the vulnerability.
2800    pub severity: Option<String>,
2801    /// The time this information was last changed at the source. This is an upstream timestamp from the underlying information source - e.g. Ubuntu security tracker.
2802    #[serde(rename = "sourceUpdateTime")]
2803    pub source_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2804    /// Windows details get their own format because the information format and model don't match a normal detail. Specifically Windows updates are done as patches, thus Windows vulnerabilities really are a missing package, rather than a package being at an incorrect version.
2805    #[serde(rename = "windowsDetails")]
2806    pub windows_details: Option<Vec<WindowsDetail>>,
2807}
2808
2809impl common::Part for Vulnerability {}
2810
2811/// A single VulnerabilityAssessmentNote represents one particular product's vulnerability assessment for one CVE.
2812///
2813/// This type is not used in any activity, and only used as *part* of another schema.
2814///
2815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2816#[serde_with::serde_as]
2817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2818pub struct VulnerabilityAssessmentNote {
2819    /// Represents a vulnerability assessment for the product.
2820    pub assessment: Option<Assessment>,
2821    /// Identifies the language used by this document, corresponding to IETF BCP 47 / RFC 5646.
2822    #[serde(rename = "languageCode")]
2823    pub language_code: Option<String>,
2824    /// A detailed description of this Vex.
2825    #[serde(rename = "longDescription")]
2826    pub long_description: Option<String>,
2827    /// The product affected by this vex.
2828    pub product: Option<Product>,
2829    /// Publisher details of this Note.
2830    pub publisher: Option<Publisher>,
2831    /// A one sentence description of this Vex.
2832    #[serde(rename = "shortDescription")]
2833    pub short_description: Option<String>,
2834    /// The title of the note. E.g. `Vex-Debian-11.4`
2835    pub title: Option<String>,
2836}
2837
2838impl common::Part for VulnerabilityAssessmentNote {}
2839
2840/// The location of the vulnerability.
2841///
2842/// This type is not used in any activity, and only used as *part* of another schema.
2843///
2844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2845#[serde_with::serde_as]
2846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2847pub struct VulnerabilityLocation {
2848    /// Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) format. Examples include distro or storage location for vulnerable jar.
2849    #[serde(rename = "cpeUri")]
2850    pub cpe_uri: Option<String>,
2851    /// Required. The package being described.
2852    pub package: Option<String>,
2853    /// Required. The version of the package being described.
2854    pub version: Option<Version>,
2855}
2856
2857impl common::Part for VulnerabilityLocation {}
2858
2859/// A summary of how many vulnerability occurrences there are per resource and severity type.
2860///
2861/// # Activities
2862///
2863/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2864/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2865///
2866/// * [locations occurrences get vulnerability summary projects](ProjectLocationOccurrenceGetVulnerabilitySummaryCall) (response)
2867/// * [occurrences get vulnerability summary projects](ProjectOccurrenceGetVulnerabilitySummaryCall) (response)
2868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2869#[serde_with::serde_as]
2870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2871pub struct VulnerabilityOccurrencesSummary {
2872    /// A listing by resource of the number of fixable and total vulnerabilities.
2873    pub counts: Option<Vec<FixableTotalByDigest>>,
2874}
2875
2876impl common::ResponseResult for VulnerabilityOccurrencesSummary {}
2877
2878/// There is no detailed description.
2879///
2880/// This type is not used in any activity, and only used as *part* of another schema.
2881///
2882#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2883#[serde_with::serde_as]
2884#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2885pub struct WindowsDetail {
2886    /// Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) in which the vulnerability manifests. Examples include distro or storage location for vulnerable jar.
2887    #[serde(rename = "cpeUri")]
2888    pub cpe_uri: Option<String>,
2889    /// The description of the vulnerability.
2890    pub description: Option<String>,
2891    /// Required. The names of the KBs which have hotfixes to mitigate this vulnerability. Note that there may be multiple hotfixes (and thus multiple KBs) that mitigate a given vulnerability. Currently any listed kb's presence is considered a fix.
2892    #[serde(rename = "fixingKbs")]
2893    pub fixing_kbs: Option<Vec<KnowledgeBase>>,
2894    /// Required. The name of the vulnerability.
2895    pub name: Option<String>,
2896}
2897
2898impl common::Part for WindowsDetail {}
2899
2900// ###################
2901// MethodBuilders ###
2902// #################
2903
2904/// A builder providing access to all methods supported on *project* resources.
2905/// It is not used directly, but through the [`ContainerAnalysis`] hub.
2906///
2907/// # Example
2908///
2909/// Instantiate a resource builder
2910///
2911/// ```test_harness,no_run
2912/// extern crate hyper;
2913/// extern crate hyper_rustls;
2914/// extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
2915///
2916/// # async fn dox() {
2917/// use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2918///
2919/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2920/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2921///     secret,
2922///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2923/// ).build().await.unwrap();
2924///
2925/// let client = hyper_util::client::legacy::Client::builder(
2926///     hyper_util::rt::TokioExecutor::new()
2927/// )
2928/// .build(
2929///     hyper_rustls::HttpsConnectorBuilder::new()
2930///         .with_native_roots()
2931///         .unwrap()
2932///         .https_or_http()
2933///         .enable_http1()
2934///         .build()
2935/// );
2936/// let mut hub = ContainerAnalysis::new(client, auth);
2937/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2938/// // like `locations_notes_get(...)`, `locations_notes_list(...)`, `locations_notes_occurrences_list(...)`, `locations_occurrences_get(...)`, `locations_occurrences_get_notes(...)`, `locations_occurrences_get_vulnerability_summary(...)`, `locations_occurrences_list(...)`, `locations_resources_export_sbom(...)`, `locations_resources_generate_packages_summary(...)`, `notes_batch_create(...)`, `notes_create(...)`, `notes_delete(...)`, `notes_get(...)`, `notes_get_iam_policy(...)`, `notes_list(...)`, `notes_occurrences_list(...)`, `notes_patch(...)`, `notes_set_iam_policy(...)`, `notes_test_iam_permissions(...)`, `occurrences_batch_create(...)`, `occurrences_create(...)`, `occurrences_delete(...)`, `occurrences_get(...)`, `occurrences_get_iam_policy(...)`, `occurrences_get_notes(...)`, `occurrences_get_vulnerability_summary(...)`, `occurrences_list(...)`, `occurrences_patch(...)`, `occurrences_set_iam_policy(...)`, `occurrences_test_iam_permissions(...)`, `resources_export_sbom(...)` and `resources_generate_packages_summary(...)`
2939/// // to build up your call.
2940/// let rb = hub.projects();
2941/// # }
2942/// ```
2943pub struct ProjectMethods<'a, C>
2944where
2945    C: 'a,
2946{
2947    hub: &'a ContainerAnalysis<C>,
2948}
2949
2950impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2951
2952impl<'a, C> ProjectMethods<'a, C> {
2953    /// Create a builder to help you perform the following task:
2954    ///
2955    /// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
2956    ///
2957    /// # Arguments
2958    ///
2959    /// * `name` - Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
2960    pub fn locations_notes_occurrences_list(
2961        &self,
2962        name: &str,
2963    ) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
2964        ProjectLocationNoteOccurrenceListCall {
2965            hub: self.hub,
2966            _name: name.to_string(),
2967            _page_token: Default::default(),
2968            _page_size: Default::default(),
2969            _filter: Default::default(),
2970            _delegate: Default::default(),
2971            _additional_params: Default::default(),
2972            _scopes: Default::default(),
2973        }
2974    }
2975
2976    /// Create a builder to help you perform the following task:
2977    ///
2978    /// Gets the specified note.
2979    ///
2980    /// # Arguments
2981    ///
2982    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
2983    pub fn locations_notes_get(&self, name: &str) -> ProjectLocationNoteGetCall<'a, C> {
2984        ProjectLocationNoteGetCall {
2985            hub: self.hub,
2986            _name: name.to_string(),
2987            _delegate: Default::default(),
2988            _additional_params: Default::default(),
2989            _scopes: Default::default(),
2990        }
2991    }
2992
2993    /// Create a builder to help you perform the following task:
2994    ///
2995    /// Lists notes for the specified project.
2996    ///
2997    /// # Arguments
2998    ///
2999    /// * `parent` - Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
3000    pub fn locations_notes_list(&self, parent: &str) -> ProjectLocationNoteListCall<'a, C> {
3001        ProjectLocationNoteListCall {
3002            hub: self.hub,
3003            _parent: parent.to_string(),
3004            _page_token: Default::default(),
3005            _page_size: Default::default(),
3006            _filter: Default::default(),
3007            _delegate: Default::default(),
3008            _additional_params: Default::default(),
3009            _scopes: Default::default(),
3010        }
3011    }
3012
3013    /// Create a builder to help you perform the following task:
3014    ///
3015    /// Gets the specified occurrence.
3016    ///
3017    /// # Arguments
3018    ///
3019    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3020    pub fn locations_occurrences_get(&self, name: &str) -> ProjectLocationOccurrenceGetCall<'a, C> {
3021        ProjectLocationOccurrenceGetCall {
3022            hub: self.hub,
3023            _name: name.to_string(),
3024            _delegate: Default::default(),
3025            _additional_params: Default::default(),
3026            _scopes: Default::default(),
3027        }
3028    }
3029
3030    /// Create a builder to help you perform the following task:
3031    ///
3032    /// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
3033    ///
3034    /// # Arguments
3035    ///
3036    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3037    pub fn locations_occurrences_get_notes(
3038        &self,
3039        name: &str,
3040    ) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
3041        ProjectLocationOccurrenceGetNoteCall {
3042            hub: self.hub,
3043            _name: name.to_string(),
3044            _delegate: Default::default(),
3045            _additional_params: Default::default(),
3046            _scopes: Default::default(),
3047        }
3048    }
3049
3050    /// Create a builder to help you perform the following task:
3051    ///
3052    /// Gets a summary of the number and severity of occurrences.
3053    ///
3054    /// # Arguments
3055    ///
3056    /// * `parent` - Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
3057    pub fn locations_occurrences_get_vulnerability_summary(
3058        &self,
3059        parent: &str,
3060    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
3061        ProjectLocationOccurrenceGetVulnerabilitySummaryCall {
3062            hub: self.hub,
3063            _parent: parent.to_string(),
3064            _filter: Default::default(),
3065            _delegate: Default::default(),
3066            _additional_params: Default::default(),
3067            _scopes: Default::default(),
3068        }
3069    }
3070
3071    /// Create a builder to help you perform the following task:
3072    ///
3073    /// Lists occurrences for the specified project.
3074    ///
3075    /// # Arguments
3076    ///
3077    /// * `parent` - Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
3078    pub fn locations_occurrences_list(
3079        &self,
3080        parent: &str,
3081    ) -> ProjectLocationOccurrenceListCall<'a, C> {
3082        ProjectLocationOccurrenceListCall {
3083            hub: self.hub,
3084            _parent: parent.to_string(),
3085            _page_token: Default::default(),
3086            _page_size: Default::default(),
3087            _filter: Default::default(),
3088            _delegate: Default::default(),
3089            _additional_params: Default::default(),
3090            _scopes: Default::default(),
3091        }
3092    }
3093
3094    /// Create a builder to help you perform the following task:
3095    ///
3096    /// Generates an SBOM and other dependency information for the given resource.
3097    ///
3098    /// # Arguments
3099    ///
3100    /// * `request` - No description provided.
3101    /// * `name` - Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3102    pub fn locations_resources_export_sbom(
3103        &self,
3104        request: ExportSBOMRequest,
3105        name: &str,
3106    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
3107        ProjectLocationResourceExportSBOMCall {
3108            hub: self.hub,
3109            _request: request,
3110            _name: name.to_string(),
3111            _delegate: Default::default(),
3112            _additional_params: Default::default(),
3113            _scopes: Default::default(),
3114        }
3115    }
3116
3117    /// Create a builder to help you perform the following task:
3118    ///
3119    /// Gets a summary of the packages within a given resource.
3120    ///
3121    /// # Arguments
3122    ///
3123    /// * `request` - No description provided.
3124    /// * `name` - Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3125    pub fn locations_resources_generate_packages_summary(
3126        &self,
3127        request: GeneratePackagesSummaryRequest,
3128        name: &str,
3129    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
3130        ProjectLocationResourceGeneratePackagesSummaryCall {
3131            hub: self.hub,
3132            _request: request,
3133            _name: name.to_string(),
3134            _delegate: Default::default(),
3135            _additional_params: Default::default(),
3136            _scopes: Default::default(),
3137        }
3138    }
3139
3140    /// Create a builder to help you perform the following task:
3141    ///
3142    /// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
3143    ///
3144    /// # Arguments
3145    ///
3146    /// * `name` - Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3147    pub fn notes_occurrences_list(&self, name: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
3148        ProjectNoteOccurrenceListCall {
3149            hub: self.hub,
3150            _name: name.to_string(),
3151            _page_token: Default::default(),
3152            _page_size: Default::default(),
3153            _filter: Default::default(),
3154            _delegate: Default::default(),
3155            _additional_params: Default::default(),
3156            _scopes: Default::default(),
3157        }
3158    }
3159
3160    /// Create a builder to help you perform the following task:
3161    ///
3162    /// Creates new notes in batch.
3163    ///
3164    /// # Arguments
3165    ///
3166    /// * `request` - No description provided.
3167    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
3168    pub fn notes_batch_create(
3169        &self,
3170        request: BatchCreateNotesRequest,
3171        parent: &str,
3172    ) -> ProjectNoteBatchCreateCall<'a, C> {
3173        ProjectNoteBatchCreateCall {
3174            hub: self.hub,
3175            _request: request,
3176            _parent: parent.to_string(),
3177            _delegate: Default::default(),
3178            _additional_params: Default::default(),
3179            _scopes: Default::default(),
3180        }
3181    }
3182
3183    /// Create a builder to help you perform the following task:
3184    ///
3185    /// Creates a new note.
3186    ///
3187    /// # Arguments
3188    ///
3189    /// * `request` - No description provided.
3190    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
3191    pub fn notes_create(&self, request: Note, parent: &str) -> ProjectNoteCreateCall<'a, C> {
3192        ProjectNoteCreateCall {
3193            hub: self.hub,
3194            _request: request,
3195            _parent: parent.to_string(),
3196            _note_id: Default::default(),
3197            _delegate: Default::default(),
3198            _additional_params: Default::default(),
3199            _scopes: Default::default(),
3200        }
3201    }
3202
3203    /// Create a builder to help you perform the following task:
3204    ///
3205    /// Deletes the specified note.
3206    ///
3207    /// # Arguments
3208    ///
3209    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3210    pub fn notes_delete(&self, name: &str) -> ProjectNoteDeleteCall<'a, C> {
3211        ProjectNoteDeleteCall {
3212            hub: self.hub,
3213            _name: name.to_string(),
3214            _delegate: Default::default(),
3215            _additional_params: Default::default(),
3216            _scopes: Default::default(),
3217        }
3218    }
3219
3220    /// Create a builder to help you perform the following task:
3221    ///
3222    /// Gets the specified note.
3223    ///
3224    /// # Arguments
3225    ///
3226    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3227    pub fn notes_get(&self, name: &str) -> ProjectNoteGetCall<'a, C> {
3228        ProjectNoteGetCall {
3229            hub: self.hub,
3230            _name: name.to_string(),
3231            _delegate: Default::default(),
3232            _additional_params: Default::default(),
3233            _scopes: Default::default(),
3234        }
3235    }
3236
3237    /// Create a builder to help you perform the following task:
3238    ///
3239    /// Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3240    ///
3241    /// # Arguments
3242    ///
3243    /// * `request` - No description provided.
3244    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3245    pub fn notes_get_iam_policy(
3246        &self,
3247        request: GetIamPolicyRequest,
3248        resource: &str,
3249    ) -> ProjectNoteGetIamPolicyCall<'a, C> {
3250        ProjectNoteGetIamPolicyCall {
3251            hub: self.hub,
3252            _request: request,
3253            _resource: resource.to_string(),
3254            _delegate: Default::default(),
3255            _additional_params: Default::default(),
3256            _scopes: Default::default(),
3257        }
3258    }
3259
3260    /// Create a builder to help you perform the following task:
3261    ///
3262    /// Lists notes for the specified project.
3263    ///
3264    /// # Arguments
3265    ///
3266    /// * `parent` - Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
3267    pub fn notes_list(&self, parent: &str) -> ProjectNoteListCall<'a, C> {
3268        ProjectNoteListCall {
3269            hub: self.hub,
3270            _parent: parent.to_string(),
3271            _page_token: Default::default(),
3272            _page_size: Default::default(),
3273            _filter: Default::default(),
3274            _delegate: Default::default(),
3275            _additional_params: Default::default(),
3276            _scopes: Default::default(),
3277        }
3278    }
3279
3280    /// Create a builder to help you perform the following task:
3281    ///
3282    /// Updates the specified note.
3283    ///
3284    /// # Arguments
3285    ///
3286    /// * `request` - No description provided.
3287    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3288    pub fn notes_patch(&self, request: Note, name: &str) -> ProjectNotePatchCall<'a, C> {
3289        ProjectNotePatchCall {
3290            hub: self.hub,
3291            _request: request,
3292            _name: name.to_string(),
3293            _update_mask: Default::default(),
3294            _delegate: Default::default(),
3295            _additional_params: Default::default(),
3296            _scopes: Default::default(),
3297        }
3298    }
3299
3300    /// Create a builder to help you perform the following task:
3301    ///
3302    /// Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3303    ///
3304    /// # Arguments
3305    ///
3306    /// * `request` - No description provided.
3307    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3308    pub fn notes_set_iam_policy(
3309        &self,
3310        request: SetIamPolicyRequest,
3311        resource: &str,
3312    ) -> ProjectNoteSetIamPolicyCall<'a, C> {
3313        ProjectNoteSetIamPolicyCall {
3314            hub: self.hub,
3315            _request: request,
3316            _resource: resource.to_string(),
3317            _delegate: Default::default(),
3318            _additional_params: Default::default(),
3319            _scopes: Default::default(),
3320        }
3321    }
3322
3323    /// Create a builder to help you perform the following task:
3324    ///
3325    /// Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3326    ///
3327    /// # Arguments
3328    ///
3329    /// * `request` - No description provided.
3330    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3331    pub fn notes_test_iam_permissions(
3332        &self,
3333        request: TestIamPermissionsRequest,
3334        resource: &str,
3335    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
3336        ProjectNoteTestIamPermissionCall {
3337            hub: self.hub,
3338            _request: request,
3339            _resource: resource.to_string(),
3340            _delegate: Default::default(),
3341            _additional_params: Default::default(),
3342            _scopes: Default::default(),
3343        }
3344    }
3345
3346    /// Create a builder to help you perform the following task:
3347    ///
3348    /// Creates new occurrences in batch.
3349    ///
3350    /// # Arguments
3351    ///
3352    /// * `request` - No description provided.
3353    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
3354    pub fn occurrences_batch_create(
3355        &self,
3356        request: BatchCreateOccurrencesRequest,
3357        parent: &str,
3358    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
3359        ProjectOccurrenceBatchCreateCall {
3360            hub: self.hub,
3361            _request: request,
3362            _parent: parent.to_string(),
3363            _delegate: Default::default(),
3364            _additional_params: Default::default(),
3365            _scopes: Default::default(),
3366        }
3367    }
3368
3369    /// Create a builder to help you perform the following task:
3370    ///
3371    /// Creates a new occurrence.
3372    ///
3373    /// # Arguments
3374    ///
3375    /// * `request` - No description provided.
3376    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created.
3377    pub fn occurrences_create(
3378        &self,
3379        request: Occurrence,
3380        parent: &str,
3381    ) -> ProjectOccurrenceCreateCall<'a, C> {
3382        ProjectOccurrenceCreateCall {
3383            hub: self.hub,
3384            _request: request,
3385            _parent: parent.to_string(),
3386            _delegate: Default::default(),
3387            _additional_params: Default::default(),
3388            _scopes: Default::default(),
3389        }
3390    }
3391
3392    /// Create a builder to help you perform the following task:
3393    ///
3394    /// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
3395    ///
3396    /// # Arguments
3397    ///
3398    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3399    pub fn occurrences_delete(&self, name: &str) -> ProjectOccurrenceDeleteCall<'a, C> {
3400        ProjectOccurrenceDeleteCall {
3401            hub: self.hub,
3402            _name: name.to_string(),
3403            _delegate: Default::default(),
3404            _additional_params: Default::default(),
3405            _scopes: Default::default(),
3406        }
3407    }
3408
3409    /// Create a builder to help you perform the following task:
3410    ///
3411    /// Gets the specified occurrence.
3412    ///
3413    /// # Arguments
3414    ///
3415    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3416    pub fn occurrences_get(&self, name: &str) -> ProjectOccurrenceGetCall<'a, C> {
3417        ProjectOccurrenceGetCall {
3418            hub: self.hub,
3419            _name: name.to_string(),
3420            _delegate: Default::default(),
3421            _additional_params: Default::default(),
3422            _scopes: Default::default(),
3423        }
3424    }
3425
3426    /// Create a builder to help you perform the following task:
3427    ///
3428    /// Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3429    ///
3430    /// # Arguments
3431    ///
3432    /// * `request` - No description provided.
3433    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3434    pub fn occurrences_get_iam_policy(
3435        &self,
3436        request: GetIamPolicyRequest,
3437        resource: &str,
3438    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
3439        ProjectOccurrenceGetIamPolicyCall {
3440            hub: self.hub,
3441            _request: request,
3442            _resource: resource.to_string(),
3443            _delegate: Default::default(),
3444            _additional_params: Default::default(),
3445            _scopes: Default::default(),
3446        }
3447    }
3448
3449    /// Create a builder to help you perform the following task:
3450    ///
3451    /// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
3452    ///
3453    /// # Arguments
3454    ///
3455    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3456    pub fn occurrences_get_notes(&self, name: &str) -> ProjectOccurrenceGetNoteCall<'a, C> {
3457        ProjectOccurrenceGetNoteCall {
3458            hub: self.hub,
3459            _name: name.to_string(),
3460            _delegate: Default::default(),
3461            _additional_params: Default::default(),
3462            _scopes: Default::default(),
3463        }
3464    }
3465
3466    /// Create a builder to help you perform the following task:
3467    ///
3468    /// Gets a summary of the number and severity of occurrences.
3469    ///
3470    /// # Arguments
3471    ///
3472    /// * `parent` - Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
3473    pub fn occurrences_get_vulnerability_summary(
3474        &self,
3475        parent: &str,
3476    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
3477        ProjectOccurrenceGetVulnerabilitySummaryCall {
3478            hub: self.hub,
3479            _parent: parent.to_string(),
3480            _filter: Default::default(),
3481            _delegate: Default::default(),
3482            _additional_params: Default::default(),
3483            _scopes: Default::default(),
3484        }
3485    }
3486
3487    /// Create a builder to help you perform the following task:
3488    ///
3489    /// Lists occurrences for the specified project.
3490    ///
3491    /// # Arguments
3492    ///
3493    /// * `parent` - Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
3494    pub fn occurrences_list(&self, parent: &str) -> ProjectOccurrenceListCall<'a, C> {
3495        ProjectOccurrenceListCall {
3496            hub: self.hub,
3497            _parent: parent.to_string(),
3498            _page_token: Default::default(),
3499            _page_size: Default::default(),
3500            _filter: Default::default(),
3501            _delegate: Default::default(),
3502            _additional_params: Default::default(),
3503            _scopes: Default::default(),
3504        }
3505    }
3506
3507    /// Create a builder to help you perform the following task:
3508    ///
3509    /// Updates the specified occurrence.
3510    ///
3511    /// # Arguments
3512    ///
3513    /// * `request` - No description provided.
3514    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3515    pub fn occurrences_patch(
3516        &self,
3517        request: Occurrence,
3518        name: &str,
3519    ) -> ProjectOccurrencePatchCall<'a, C> {
3520        ProjectOccurrencePatchCall {
3521            hub: self.hub,
3522            _request: request,
3523            _name: name.to_string(),
3524            _update_mask: Default::default(),
3525            _delegate: Default::default(),
3526            _additional_params: Default::default(),
3527            _scopes: Default::default(),
3528        }
3529    }
3530
3531    /// Create a builder to help you perform the following task:
3532    ///
3533    /// Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3534    ///
3535    /// # Arguments
3536    ///
3537    /// * `request` - No description provided.
3538    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3539    pub fn occurrences_set_iam_policy(
3540        &self,
3541        request: SetIamPolicyRequest,
3542        resource: &str,
3543    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
3544        ProjectOccurrenceSetIamPolicyCall {
3545            hub: self.hub,
3546            _request: request,
3547            _resource: resource.to_string(),
3548            _delegate: Default::default(),
3549            _additional_params: Default::default(),
3550            _scopes: Default::default(),
3551        }
3552    }
3553
3554    /// Create a builder to help you perform the following task:
3555    ///
3556    /// Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
3557    ///
3558    /// # Arguments
3559    ///
3560    /// * `request` - No description provided.
3561    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3562    pub fn occurrences_test_iam_permissions(
3563        &self,
3564        request: TestIamPermissionsRequest,
3565        resource: &str,
3566    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
3567        ProjectOccurrenceTestIamPermissionCall {
3568            hub: self.hub,
3569            _request: request,
3570            _resource: resource.to_string(),
3571            _delegate: Default::default(),
3572            _additional_params: Default::default(),
3573            _scopes: Default::default(),
3574        }
3575    }
3576
3577    /// Create a builder to help you perform the following task:
3578    ///
3579    /// Generates an SBOM and other dependency information for the given resource.
3580    ///
3581    /// # Arguments
3582    ///
3583    /// * `request` - No description provided.
3584    /// * `name` - Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3585    pub fn resources_export_sbom(
3586        &self,
3587        request: ExportSBOMRequest,
3588        name: &str,
3589    ) -> ProjectResourceExportSBOMCall<'a, C> {
3590        ProjectResourceExportSBOMCall {
3591            hub: self.hub,
3592            _request: request,
3593            _name: name.to_string(),
3594            _delegate: Default::default(),
3595            _additional_params: Default::default(),
3596            _scopes: Default::default(),
3597        }
3598    }
3599
3600    /// Create a builder to help you perform the following task:
3601    ///
3602    /// Gets a summary of the packages within a given resource.
3603    ///
3604    /// # Arguments
3605    ///
3606    /// * `request` - No description provided.
3607    /// * `name` - Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3608    pub fn resources_generate_packages_summary(
3609        &self,
3610        request: GeneratePackagesSummaryRequest,
3611        name: &str,
3612    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
3613        ProjectResourceGeneratePackagesSummaryCall {
3614            hub: self.hub,
3615            _request: request,
3616            _name: name.to_string(),
3617            _delegate: Default::default(),
3618            _additional_params: Default::default(),
3619            _scopes: Default::default(),
3620        }
3621    }
3622}
3623
3624// ###################
3625// CallBuilders   ###
3626// #################
3627
3628/// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
3629///
3630/// A builder for the *locations.notes.occurrences.list* method supported by a *project* resource.
3631/// It is not used directly, but through a [`ProjectMethods`] instance.
3632///
3633/// # Example
3634///
3635/// Instantiate a resource method builder
3636///
3637/// ```test_harness,no_run
3638/// # extern crate hyper;
3639/// # extern crate hyper_rustls;
3640/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
3641/// # async fn dox() {
3642/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3643///
3644/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3645/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3646/// #     secret,
3647/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3648/// # ).build().await.unwrap();
3649///
3650/// # let client = hyper_util::client::legacy::Client::builder(
3651/// #     hyper_util::rt::TokioExecutor::new()
3652/// # )
3653/// # .build(
3654/// #     hyper_rustls::HttpsConnectorBuilder::new()
3655/// #         .with_native_roots()
3656/// #         .unwrap()
3657/// #         .https_or_http()
3658/// #         .enable_http1()
3659/// #         .build()
3660/// # );
3661/// # let mut hub = ContainerAnalysis::new(client, auth);
3662/// // You can configure optional parameters by calling the respective setters at will, and
3663/// // execute the final call using `doit()`.
3664/// // Values shown here are possibly random and not representative !
3665/// let result = hub.projects().locations_notes_occurrences_list("name")
3666///              .page_token("sed")
3667///              .page_size(-2)
3668///              .filter("takimata")
3669///              .doit().await;
3670/// # }
3671/// ```
3672pub struct ProjectLocationNoteOccurrenceListCall<'a, C>
3673where
3674    C: 'a,
3675{
3676    hub: &'a ContainerAnalysis<C>,
3677    _name: String,
3678    _page_token: Option<String>,
3679    _page_size: Option<i32>,
3680    _filter: Option<String>,
3681    _delegate: Option<&'a mut dyn common::Delegate>,
3682    _additional_params: HashMap<String, String>,
3683    _scopes: BTreeSet<String>,
3684}
3685
3686impl<'a, C> common::CallBuilder for ProjectLocationNoteOccurrenceListCall<'a, C> {}
3687
3688impl<'a, C> ProjectLocationNoteOccurrenceListCall<'a, C>
3689where
3690    C: common::Connector,
3691{
3692    /// Perform the operation you have build so far.
3693    pub async fn doit(mut self) -> common::Result<(common::Response, ListNoteOccurrencesResponse)> {
3694        use std::borrow::Cow;
3695        use std::io::{Read, Seek};
3696
3697        use common::{url::Params, ToParts};
3698        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3699
3700        let mut dd = common::DefaultDelegate;
3701        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3702        dlg.begin(common::MethodInfo {
3703            id: "containeranalysis.projects.locations.notes.occurrences.list",
3704            http_method: hyper::Method::GET,
3705        });
3706
3707        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
3708            if self._additional_params.contains_key(field) {
3709                dlg.finished(false);
3710                return Err(common::Error::FieldClash(field));
3711            }
3712        }
3713
3714        let mut params = Params::with_capacity(6 + self._additional_params.len());
3715        params.push("name", self._name);
3716        if let Some(value) = self._page_token.as_ref() {
3717            params.push("pageToken", value);
3718        }
3719        if let Some(value) = self._page_size.as_ref() {
3720            params.push("pageSize", value.to_string());
3721        }
3722        if let Some(value) = self._filter.as_ref() {
3723            params.push("filter", value);
3724        }
3725
3726        params.extend(self._additional_params.iter());
3727
3728        params.push("alt", "json");
3729        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/occurrences";
3730        if self._scopes.is_empty() {
3731            self._scopes
3732                .insert(Scope::CloudPlatform.as_ref().to_string());
3733        }
3734
3735        #[allow(clippy::single_element_loop)]
3736        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3737            url = params.uri_replacement(url, param_name, find_this, true);
3738        }
3739        {
3740            let to_remove = ["name"];
3741            params.remove_params(&to_remove);
3742        }
3743
3744        let url = params.parse_with_url(&url);
3745
3746        loop {
3747            let token = match self
3748                .hub
3749                .auth
3750                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3751                .await
3752            {
3753                Ok(token) => token,
3754                Err(e) => match dlg.token(e) {
3755                    Ok(token) => token,
3756                    Err(e) => {
3757                        dlg.finished(false);
3758                        return Err(common::Error::MissingToken(e));
3759                    }
3760                },
3761            };
3762            let mut req_result = {
3763                let client = &self.hub.client;
3764                dlg.pre_request();
3765                let mut req_builder = hyper::Request::builder()
3766                    .method(hyper::Method::GET)
3767                    .uri(url.as_str())
3768                    .header(USER_AGENT, self.hub._user_agent.clone());
3769
3770                if let Some(token) = token.as_ref() {
3771                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3772                }
3773
3774                let request = req_builder
3775                    .header(CONTENT_LENGTH, 0_u64)
3776                    .body(common::to_body::<String>(None));
3777
3778                client.request(request.unwrap()).await
3779            };
3780
3781            match req_result {
3782                Err(err) => {
3783                    if let common::Retry::After(d) = dlg.http_error(&err) {
3784                        sleep(d).await;
3785                        continue;
3786                    }
3787                    dlg.finished(false);
3788                    return Err(common::Error::HttpError(err));
3789                }
3790                Ok(res) => {
3791                    let (mut parts, body) = res.into_parts();
3792                    let mut body = common::Body::new(body);
3793                    if !parts.status.is_success() {
3794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3795                        let error = serde_json::from_str(&common::to_string(&bytes));
3796                        let response = common::to_response(parts, bytes.into());
3797
3798                        if let common::Retry::After(d) =
3799                            dlg.http_failure(&response, error.as_ref().ok())
3800                        {
3801                            sleep(d).await;
3802                            continue;
3803                        }
3804
3805                        dlg.finished(false);
3806
3807                        return Err(match error {
3808                            Ok(value) => common::Error::BadRequest(value),
3809                            _ => common::Error::Failure(response),
3810                        });
3811                    }
3812                    let response = {
3813                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3814                        let encoded = common::to_string(&bytes);
3815                        match serde_json::from_str(&encoded) {
3816                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3817                            Err(error) => {
3818                                dlg.response_json_decode_error(&encoded, &error);
3819                                return Err(common::Error::JsonDecodeError(
3820                                    encoded.to_string(),
3821                                    error,
3822                                ));
3823                            }
3824                        }
3825                    };
3826
3827                    dlg.finished(true);
3828                    return Ok(response);
3829                }
3830            }
3831        }
3832    }
3833
3834    /// Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3835    ///
3836    /// Sets the *name* path property to the given value.
3837    ///
3838    /// Even though the property as already been set when instantiating this call,
3839    /// we provide this method for API completeness.
3840    pub fn name(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3841        self._name = new_value.to_string();
3842        self
3843    }
3844    /// Token to provide to skip to a particular spot in the list.
3845    ///
3846    /// Sets the *page token* query property to the given value.
3847    pub fn page_token(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3848        self._page_token = Some(new_value.to_string());
3849        self
3850    }
3851    /// Number of occurrences to return in the list.
3852    ///
3853    /// Sets the *page size* query property to the given value.
3854    pub fn page_size(mut self, new_value: i32) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3855        self._page_size = Some(new_value);
3856        self
3857    }
3858    /// The filter expression.
3859    ///
3860    /// Sets the *filter* query property to the given value.
3861    pub fn filter(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3862        self._filter = Some(new_value.to_string());
3863        self
3864    }
3865    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3866    /// while executing the actual API request.
3867    ///
3868    /// ````text
3869    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3870    /// ````
3871    ///
3872    /// Sets the *delegate* property to the given value.
3873    pub fn delegate(
3874        mut self,
3875        new_value: &'a mut dyn common::Delegate,
3876    ) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3877        self._delegate = Some(new_value);
3878        self
3879    }
3880
3881    /// Set any additional parameter of the query string used in the request.
3882    /// It should be used to set parameters which are not yet available through their own
3883    /// setters.
3884    ///
3885    /// Please note that this method must not be used to set any of the known parameters
3886    /// which have their own setter method. If done anyway, the request will fail.
3887    ///
3888    /// # Additional Parameters
3889    ///
3890    /// * *$.xgafv* (query-string) - V1 error format.
3891    /// * *access_token* (query-string) - OAuth access token.
3892    /// * *alt* (query-string) - Data format for response.
3893    /// * *callback* (query-string) - JSONP
3894    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3895    /// * *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.
3896    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3897    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3898    /// * *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.
3899    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3900    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3901    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteOccurrenceListCall<'a, C>
3902    where
3903        T: AsRef<str>,
3904    {
3905        self._additional_params
3906            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3907        self
3908    }
3909
3910    /// Identifies the authorization scope for the method you are building.
3911    ///
3912    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3913    /// [`Scope::CloudPlatform`].
3914    ///
3915    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3916    /// tokens for more than one scope.
3917    ///
3918    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3919    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3920    /// sufficient, a read-write scope will do as well.
3921    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteOccurrenceListCall<'a, C>
3922    where
3923        St: AsRef<str>,
3924    {
3925        self._scopes.insert(String::from(scope.as_ref()));
3926        self
3927    }
3928    /// Identifies the authorization scope(s) for the method you are building.
3929    ///
3930    /// See [`Self::add_scope()`] for details.
3931    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteOccurrenceListCall<'a, C>
3932    where
3933        I: IntoIterator<Item = St>,
3934        St: AsRef<str>,
3935    {
3936        self._scopes
3937            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3938        self
3939    }
3940
3941    /// Removes all scopes, and no default scope will be used either.
3942    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3943    /// for details).
3944    pub fn clear_scopes(mut self) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3945        self._scopes.clear();
3946        self
3947    }
3948}
3949
3950/// Gets the specified note.
3951///
3952/// A builder for the *locations.notes.get* method supported by a *project* resource.
3953/// It is not used directly, but through a [`ProjectMethods`] instance.
3954///
3955/// # Example
3956///
3957/// Instantiate a resource method builder
3958///
3959/// ```test_harness,no_run
3960/// # extern crate hyper;
3961/// # extern crate hyper_rustls;
3962/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
3963/// # async fn dox() {
3964/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3965///
3966/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3967/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3968/// #     secret,
3969/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3970/// # ).build().await.unwrap();
3971///
3972/// # let client = hyper_util::client::legacy::Client::builder(
3973/// #     hyper_util::rt::TokioExecutor::new()
3974/// # )
3975/// # .build(
3976/// #     hyper_rustls::HttpsConnectorBuilder::new()
3977/// #         .with_native_roots()
3978/// #         .unwrap()
3979/// #         .https_or_http()
3980/// #         .enable_http1()
3981/// #         .build()
3982/// # );
3983/// # let mut hub = ContainerAnalysis::new(client, auth);
3984/// // You can configure optional parameters by calling the respective setters at will, and
3985/// // execute the final call using `doit()`.
3986/// // Values shown here are possibly random and not representative !
3987/// let result = hub.projects().locations_notes_get("name")
3988///              .doit().await;
3989/// # }
3990/// ```
3991pub struct ProjectLocationNoteGetCall<'a, C>
3992where
3993    C: 'a,
3994{
3995    hub: &'a ContainerAnalysis<C>,
3996    _name: String,
3997    _delegate: Option<&'a mut dyn common::Delegate>,
3998    _additional_params: HashMap<String, String>,
3999    _scopes: BTreeSet<String>,
4000}
4001
4002impl<'a, C> common::CallBuilder for ProjectLocationNoteGetCall<'a, C> {}
4003
4004impl<'a, C> ProjectLocationNoteGetCall<'a, C>
4005where
4006    C: common::Connector,
4007{
4008    /// Perform the operation you have build so far.
4009    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
4010        use std::borrow::Cow;
4011        use std::io::{Read, Seek};
4012
4013        use common::{url::Params, ToParts};
4014        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4015
4016        let mut dd = common::DefaultDelegate;
4017        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4018        dlg.begin(common::MethodInfo {
4019            id: "containeranalysis.projects.locations.notes.get",
4020            http_method: hyper::Method::GET,
4021        });
4022
4023        for &field in ["alt", "name"].iter() {
4024            if self._additional_params.contains_key(field) {
4025                dlg.finished(false);
4026                return Err(common::Error::FieldClash(field));
4027            }
4028        }
4029
4030        let mut params = Params::with_capacity(3 + self._additional_params.len());
4031        params.push("name", self._name);
4032
4033        params.extend(self._additional_params.iter());
4034
4035        params.push("alt", "json");
4036        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4037        if self._scopes.is_empty() {
4038            self._scopes
4039                .insert(Scope::CloudPlatform.as_ref().to_string());
4040        }
4041
4042        #[allow(clippy::single_element_loop)]
4043        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4044            url = params.uri_replacement(url, param_name, find_this, true);
4045        }
4046        {
4047            let to_remove = ["name"];
4048            params.remove_params(&to_remove);
4049        }
4050
4051        let url = params.parse_with_url(&url);
4052
4053        loop {
4054            let token = match self
4055                .hub
4056                .auth
4057                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4058                .await
4059            {
4060                Ok(token) => token,
4061                Err(e) => match dlg.token(e) {
4062                    Ok(token) => token,
4063                    Err(e) => {
4064                        dlg.finished(false);
4065                        return Err(common::Error::MissingToken(e));
4066                    }
4067                },
4068            };
4069            let mut req_result = {
4070                let client = &self.hub.client;
4071                dlg.pre_request();
4072                let mut req_builder = hyper::Request::builder()
4073                    .method(hyper::Method::GET)
4074                    .uri(url.as_str())
4075                    .header(USER_AGENT, self.hub._user_agent.clone());
4076
4077                if let Some(token) = token.as_ref() {
4078                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4079                }
4080
4081                let request = req_builder
4082                    .header(CONTENT_LENGTH, 0_u64)
4083                    .body(common::to_body::<String>(None));
4084
4085                client.request(request.unwrap()).await
4086            };
4087
4088            match req_result {
4089                Err(err) => {
4090                    if let common::Retry::After(d) = dlg.http_error(&err) {
4091                        sleep(d).await;
4092                        continue;
4093                    }
4094                    dlg.finished(false);
4095                    return Err(common::Error::HttpError(err));
4096                }
4097                Ok(res) => {
4098                    let (mut parts, body) = res.into_parts();
4099                    let mut body = common::Body::new(body);
4100                    if !parts.status.is_success() {
4101                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4102                        let error = serde_json::from_str(&common::to_string(&bytes));
4103                        let response = common::to_response(parts, bytes.into());
4104
4105                        if let common::Retry::After(d) =
4106                            dlg.http_failure(&response, error.as_ref().ok())
4107                        {
4108                            sleep(d).await;
4109                            continue;
4110                        }
4111
4112                        dlg.finished(false);
4113
4114                        return Err(match error {
4115                            Ok(value) => common::Error::BadRequest(value),
4116                            _ => common::Error::Failure(response),
4117                        });
4118                    }
4119                    let response = {
4120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4121                        let encoded = common::to_string(&bytes);
4122                        match serde_json::from_str(&encoded) {
4123                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4124                            Err(error) => {
4125                                dlg.response_json_decode_error(&encoded, &error);
4126                                return Err(common::Error::JsonDecodeError(
4127                                    encoded.to_string(),
4128                                    error,
4129                                ));
4130                            }
4131                        }
4132                    };
4133
4134                    dlg.finished(true);
4135                    return Ok(response);
4136                }
4137            }
4138        }
4139    }
4140
4141    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
4142    ///
4143    /// Sets the *name* path property to the given value.
4144    ///
4145    /// Even though the property as already been set when instantiating this call,
4146    /// we provide this method for API completeness.
4147    pub fn name(mut self, new_value: &str) -> ProjectLocationNoteGetCall<'a, C> {
4148        self._name = new_value.to_string();
4149        self
4150    }
4151    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4152    /// while executing the actual API request.
4153    ///
4154    /// ````text
4155    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4156    /// ````
4157    ///
4158    /// Sets the *delegate* property to the given value.
4159    pub fn delegate(
4160        mut self,
4161        new_value: &'a mut dyn common::Delegate,
4162    ) -> ProjectLocationNoteGetCall<'a, C> {
4163        self._delegate = Some(new_value);
4164        self
4165    }
4166
4167    /// Set any additional parameter of the query string used in the request.
4168    /// It should be used to set parameters which are not yet available through their own
4169    /// setters.
4170    ///
4171    /// Please note that this method must not be used to set any of the known parameters
4172    /// which have their own setter method. If done anyway, the request will fail.
4173    ///
4174    /// # Additional Parameters
4175    ///
4176    /// * *$.xgafv* (query-string) - V1 error format.
4177    /// * *access_token* (query-string) - OAuth access token.
4178    /// * *alt* (query-string) - Data format for response.
4179    /// * *callback* (query-string) - JSONP
4180    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4181    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4182    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4183    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4184    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4185    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4186    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4187    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteGetCall<'a, C>
4188    where
4189        T: AsRef<str>,
4190    {
4191        self._additional_params
4192            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4193        self
4194    }
4195
4196    /// Identifies the authorization scope for the method you are building.
4197    ///
4198    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4199    /// [`Scope::CloudPlatform`].
4200    ///
4201    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4202    /// tokens for more than one scope.
4203    ///
4204    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4205    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4206    /// sufficient, a read-write scope will do as well.
4207    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteGetCall<'a, C>
4208    where
4209        St: AsRef<str>,
4210    {
4211        self._scopes.insert(String::from(scope.as_ref()));
4212        self
4213    }
4214    /// Identifies the authorization scope(s) for the method you are building.
4215    ///
4216    /// See [`Self::add_scope()`] for details.
4217    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteGetCall<'a, C>
4218    where
4219        I: IntoIterator<Item = St>,
4220        St: AsRef<str>,
4221    {
4222        self._scopes
4223            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4224        self
4225    }
4226
4227    /// Removes all scopes, and no default scope will be used either.
4228    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4229    /// for details).
4230    pub fn clear_scopes(mut self) -> ProjectLocationNoteGetCall<'a, C> {
4231        self._scopes.clear();
4232        self
4233    }
4234}
4235
4236/// Lists notes for the specified project.
4237///
4238/// A builder for the *locations.notes.list* method supported by a *project* resource.
4239/// It is not used directly, but through a [`ProjectMethods`] instance.
4240///
4241/// # Example
4242///
4243/// Instantiate a resource method builder
4244///
4245/// ```test_harness,no_run
4246/// # extern crate hyper;
4247/// # extern crate hyper_rustls;
4248/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4249/// # async fn dox() {
4250/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4251///
4252/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4253/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4254/// #     secret,
4255/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4256/// # ).build().await.unwrap();
4257///
4258/// # let client = hyper_util::client::legacy::Client::builder(
4259/// #     hyper_util::rt::TokioExecutor::new()
4260/// # )
4261/// # .build(
4262/// #     hyper_rustls::HttpsConnectorBuilder::new()
4263/// #         .with_native_roots()
4264/// #         .unwrap()
4265/// #         .https_or_http()
4266/// #         .enable_http1()
4267/// #         .build()
4268/// # );
4269/// # let mut hub = ContainerAnalysis::new(client, auth);
4270/// // You can configure optional parameters by calling the respective setters at will, and
4271/// // execute the final call using `doit()`.
4272/// // Values shown here are possibly random and not representative !
4273/// let result = hub.projects().locations_notes_list("parent")
4274///              .page_token("ipsum")
4275///              .page_size(-62)
4276///              .filter("Lorem")
4277///              .doit().await;
4278/// # }
4279/// ```
4280pub struct ProjectLocationNoteListCall<'a, C>
4281where
4282    C: 'a,
4283{
4284    hub: &'a ContainerAnalysis<C>,
4285    _parent: String,
4286    _page_token: Option<String>,
4287    _page_size: Option<i32>,
4288    _filter: Option<String>,
4289    _delegate: Option<&'a mut dyn common::Delegate>,
4290    _additional_params: HashMap<String, String>,
4291    _scopes: BTreeSet<String>,
4292}
4293
4294impl<'a, C> common::CallBuilder for ProjectLocationNoteListCall<'a, C> {}
4295
4296impl<'a, C> ProjectLocationNoteListCall<'a, C>
4297where
4298    C: common::Connector,
4299{
4300    /// Perform the operation you have build so far.
4301    pub async fn doit(mut self) -> common::Result<(common::Response, ListNotesResponse)> {
4302        use std::borrow::Cow;
4303        use std::io::{Read, Seek};
4304
4305        use common::{url::Params, ToParts};
4306        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4307
4308        let mut dd = common::DefaultDelegate;
4309        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4310        dlg.begin(common::MethodInfo {
4311            id: "containeranalysis.projects.locations.notes.list",
4312            http_method: hyper::Method::GET,
4313        });
4314
4315        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
4316            if self._additional_params.contains_key(field) {
4317                dlg.finished(false);
4318                return Err(common::Error::FieldClash(field));
4319            }
4320        }
4321
4322        let mut params = Params::with_capacity(6 + self._additional_params.len());
4323        params.push("parent", self._parent);
4324        if let Some(value) = self._page_token.as_ref() {
4325            params.push("pageToken", value);
4326        }
4327        if let Some(value) = self._page_size.as_ref() {
4328            params.push("pageSize", value.to_string());
4329        }
4330        if let Some(value) = self._filter.as_ref() {
4331            params.push("filter", value);
4332        }
4333
4334        params.extend(self._additional_params.iter());
4335
4336        params.push("alt", "json");
4337        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
4338        if self._scopes.is_empty() {
4339            self._scopes
4340                .insert(Scope::CloudPlatform.as_ref().to_string());
4341        }
4342
4343        #[allow(clippy::single_element_loop)]
4344        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4345            url = params.uri_replacement(url, param_name, find_this, true);
4346        }
4347        {
4348            let to_remove = ["parent"];
4349            params.remove_params(&to_remove);
4350        }
4351
4352        let url = params.parse_with_url(&url);
4353
4354        loop {
4355            let token = match self
4356                .hub
4357                .auth
4358                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4359                .await
4360            {
4361                Ok(token) => token,
4362                Err(e) => match dlg.token(e) {
4363                    Ok(token) => token,
4364                    Err(e) => {
4365                        dlg.finished(false);
4366                        return Err(common::Error::MissingToken(e));
4367                    }
4368                },
4369            };
4370            let mut req_result = {
4371                let client = &self.hub.client;
4372                dlg.pre_request();
4373                let mut req_builder = hyper::Request::builder()
4374                    .method(hyper::Method::GET)
4375                    .uri(url.as_str())
4376                    .header(USER_AGENT, self.hub._user_agent.clone());
4377
4378                if let Some(token) = token.as_ref() {
4379                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4380                }
4381
4382                let request = req_builder
4383                    .header(CONTENT_LENGTH, 0_u64)
4384                    .body(common::to_body::<String>(None));
4385
4386                client.request(request.unwrap()).await
4387            };
4388
4389            match req_result {
4390                Err(err) => {
4391                    if let common::Retry::After(d) = dlg.http_error(&err) {
4392                        sleep(d).await;
4393                        continue;
4394                    }
4395                    dlg.finished(false);
4396                    return Err(common::Error::HttpError(err));
4397                }
4398                Ok(res) => {
4399                    let (mut parts, body) = res.into_parts();
4400                    let mut body = common::Body::new(body);
4401                    if !parts.status.is_success() {
4402                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4403                        let error = serde_json::from_str(&common::to_string(&bytes));
4404                        let response = common::to_response(parts, bytes.into());
4405
4406                        if let common::Retry::After(d) =
4407                            dlg.http_failure(&response, error.as_ref().ok())
4408                        {
4409                            sleep(d).await;
4410                            continue;
4411                        }
4412
4413                        dlg.finished(false);
4414
4415                        return Err(match error {
4416                            Ok(value) => common::Error::BadRequest(value),
4417                            _ => common::Error::Failure(response),
4418                        });
4419                    }
4420                    let response = {
4421                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4422                        let encoded = common::to_string(&bytes);
4423                        match serde_json::from_str(&encoded) {
4424                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4425                            Err(error) => {
4426                                dlg.response_json_decode_error(&encoded, &error);
4427                                return Err(common::Error::JsonDecodeError(
4428                                    encoded.to_string(),
4429                                    error,
4430                                ));
4431                            }
4432                        }
4433                    };
4434
4435                    dlg.finished(true);
4436                    return Ok(response);
4437                }
4438            }
4439        }
4440    }
4441
4442    /// Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
4443    ///
4444    /// Sets the *parent* path property to the given value.
4445    ///
4446    /// Even though the property as already been set when instantiating this call,
4447    /// we provide this method for API completeness.
4448    pub fn parent(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
4449        self._parent = new_value.to_string();
4450        self
4451    }
4452    /// Token to provide to skip to a particular spot in the list.
4453    ///
4454    /// Sets the *page token* query property to the given value.
4455    pub fn page_token(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
4456        self._page_token = Some(new_value.to_string());
4457        self
4458    }
4459    /// Number of notes to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.
4460    ///
4461    /// Sets the *page size* query property to the given value.
4462    pub fn page_size(mut self, new_value: i32) -> ProjectLocationNoteListCall<'a, C> {
4463        self._page_size = Some(new_value);
4464        self
4465    }
4466    /// The filter expression.
4467    ///
4468    /// Sets the *filter* query property to the given value.
4469    pub fn filter(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
4470        self._filter = Some(new_value.to_string());
4471        self
4472    }
4473    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4474    /// while executing the actual API request.
4475    ///
4476    /// ````text
4477    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4478    /// ````
4479    ///
4480    /// Sets the *delegate* property to the given value.
4481    pub fn delegate(
4482        mut self,
4483        new_value: &'a mut dyn common::Delegate,
4484    ) -> ProjectLocationNoteListCall<'a, C> {
4485        self._delegate = Some(new_value);
4486        self
4487    }
4488
4489    /// Set any additional parameter of the query string used in the request.
4490    /// It should be used to set parameters which are not yet available through their own
4491    /// setters.
4492    ///
4493    /// Please note that this method must not be used to set any of the known parameters
4494    /// which have their own setter method. If done anyway, the request will fail.
4495    ///
4496    /// # Additional Parameters
4497    ///
4498    /// * *$.xgafv* (query-string) - V1 error format.
4499    /// * *access_token* (query-string) - OAuth access token.
4500    /// * *alt* (query-string) - Data format for response.
4501    /// * *callback* (query-string) - JSONP
4502    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4503    /// * *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.
4504    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4505    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4506    /// * *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.
4507    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4508    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4509    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteListCall<'a, C>
4510    where
4511        T: AsRef<str>,
4512    {
4513        self._additional_params
4514            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4515        self
4516    }
4517
4518    /// Identifies the authorization scope for the method you are building.
4519    ///
4520    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4521    /// [`Scope::CloudPlatform`].
4522    ///
4523    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4524    /// tokens for more than one scope.
4525    ///
4526    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4527    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4528    /// sufficient, a read-write scope will do as well.
4529    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteListCall<'a, C>
4530    where
4531        St: AsRef<str>,
4532    {
4533        self._scopes.insert(String::from(scope.as_ref()));
4534        self
4535    }
4536    /// Identifies the authorization scope(s) for the method you are building.
4537    ///
4538    /// See [`Self::add_scope()`] for details.
4539    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteListCall<'a, C>
4540    where
4541        I: IntoIterator<Item = St>,
4542        St: AsRef<str>,
4543    {
4544        self._scopes
4545            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4546        self
4547    }
4548
4549    /// Removes all scopes, and no default scope will be used either.
4550    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4551    /// for details).
4552    pub fn clear_scopes(mut self) -> ProjectLocationNoteListCall<'a, C> {
4553        self._scopes.clear();
4554        self
4555    }
4556}
4557
4558/// Gets the specified occurrence.
4559///
4560/// A builder for the *locations.occurrences.get* method supported by a *project* resource.
4561/// It is not used directly, but through a [`ProjectMethods`] instance.
4562///
4563/// # Example
4564///
4565/// Instantiate a resource method builder
4566///
4567/// ```test_harness,no_run
4568/// # extern crate hyper;
4569/// # extern crate hyper_rustls;
4570/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4571/// # async fn dox() {
4572/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4573///
4574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4575/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4576/// #     secret,
4577/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4578/// # ).build().await.unwrap();
4579///
4580/// # let client = hyper_util::client::legacy::Client::builder(
4581/// #     hyper_util::rt::TokioExecutor::new()
4582/// # )
4583/// # .build(
4584/// #     hyper_rustls::HttpsConnectorBuilder::new()
4585/// #         .with_native_roots()
4586/// #         .unwrap()
4587/// #         .https_or_http()
4588/// #         .enable_http1()
4589/// #         .build()
4590/// # );
4591/// # let mut hub = ContainerAnalysis::new(client, auth);
4592/// // You can configure optional parameters by calling the respective setters at will, and
4593/// // execute the final call using `doit()`.
4594/// // Values shown here are possibly random and not representative !
4595/// let result = hub.projects().locations_occurrences_get("name")
4596///              .doit().await;
4597/// # }
4598/// ```
4599pub struct ProjectLocationOccurrenceGetCall<'a, C>
4600where
4601    C: 'a,
4602{
4603    hub: &'a ContainerAnalysis<C>,
4604    _name: String,
4605    _delegate: Option<&'a mut dyn common::Delegate>,
4606    _additional_params: HashMap<String, String>,
4607    _scopes: BTreeSet<String>,
4608}
4609
4610impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetCall<'a, C> {}
4611
4612impl<'a, C> ProjectLocationOccurrenceGetCall<'a, C>
4613where
4614    C: common::Connector,
4615{
4616    /// Perform the operation you have build so far.
4617    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
4618        use std::borrow::Cow;
4619        use std::io::{Read, Seek};
4620
4621        use common::{url::Params, ToParts};
4622        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4623
4624        let mut dd = common::DefaultDelegate;
4625        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4626        dlg.begin(common::MethodInfo {
4627            id: "containeranalysis.projects.locations.occurrences.get",
4628            http_method: hyper::Method::GET,
4629        });
4630
4631        for &field in ["alt", "name"].iter() {
4632            if self._additional_params.contains_key(field) {
4633                dlg.finished(false);
4634                return Err(common::Error::FieldClash(field));
4635            }
4636        }
4637
4638        let mut params = Params::with_capacity(3 + self._additional_params.len());
4639        params.push("name", self._name);
4640
4641        params.extend(self._additional_params.iter());
4642
4643        params.push("alt", "json");
4644        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4645        if self._scopes.is_empty() {
4646            self._scopes
4647                .insert(Scope::CloudPlatform.as_ref().to_string());
4648        }
4649
4650        #[allow(clippy::single_element_loop)]
4651        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4652            url = params.uri_replacement(url, param_name, find_this, true);
4653        }
4654        {
4655            let to_remove = ["name"];
4656            params.remove_params(&to_remove);
4657        }
4658
4659        let url = params.parse_with_url(&url);
4660
4661        loop {
4662            let token = match self
4663                .hub
4664                .auth
4665                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4666                .await
4667            {
4668                Ok(token) => token,
4669                Err(e) => match dlg.token(e) {
4670                    Ok(token) => token,
4671                    Err(e) => {
4672                        dlg.finished(false);
4673                        return Err(common::Error::MissingToken(e));
4674                    }
4675                },
4676            };
4677            let mut req_result = {
4678                let client = &self.hub.client;
4679                dlg.pre_request();
4680                let mut req_builder = hyper::Request::builder()
4681                    .method(hyper::Method::GET)
4682                    .uri(url.as_str())
4683                    .header(USER_AGENT, self.hub._user_agent.clone());
4684
4685                if let Some(token) = token.as_ref() {
4686                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4687                }
4688
4689                let request = req_builder
4690                    .header(CONTENT_LENGTH, 0_u64)
4691                    .body(common::to_body::<String>(None));
4692
4693                client.request(request.unwrap()).await
4694            };
4695
4696            match req_result {
4697                Err(err) => {
4698                    if let common::Retry::After(d) = dlg.http_error(&err) {
4699                        sleep(d).await;
4700                        continue;
4701                    }
4702                    dlg.finished(false);
4703                    return Err(common::Error::HttpError(err));
4704                }
4705                Ok(res) => {
4706                    let (mut parts, body) = res.into_parts();
4707                    let mut body = common::Body::new(body);
4708                    if !parts.status.is_success() {
4709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4710                        let error = serde_json::from_str(&common::to_string(&bytes));
4711                        let response = common::to_response(parts, bytes.into());
4712
4713                        if let common::Retry::After(d) =
4714                            dlg.http_failure(&response, error.as_ref().ok())
4715                        {
4716                            sleep(d).await;
4717                            continue;
4718                        }
4719
4720                        dlg.finished(false);
4721
4722                        return Err(match error {
4723                            Ok(value) => common::Error::BadRequest(value),
4724                            _ => common::Error::Failure(response),
4725                        });
4726                    }
4727                    let response = {
4728                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4729                        let encoded = common::to_string(&bytes);
4730                        match serde_json::from_str(&encoded) {
4731                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4732                            Err(error) => {
4733                                dlg.response_json_decode_error(&encoded, &error);
4734                                return Err(common::Error::JsonDecodeError(
4735                                    encoded.to_string(),
4736                                    error,
4737                                ));
4738                            }
4739                        }
4740                    };
4741
4742                    dlg.finished(true);
4743                    return Ok(response);
4744                }
4745            }
4746        }
4747    }
4748
4749    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
4750    ///
4751    /// Sets the *name* path property to the given value.
4752    ///
4753    /// Even though the property as already been set when instantiating this call,
4754    /// we provide this method for API completeness.
4755    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrenceGetCall<'a, C> {
4756        self._name = new_value.to_string();
4757        self
4758    }
4759    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4760    /// while executing the actual API request.
4761    ///
4762    /// ````text
4763    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4764    /// ````
4765    ///
4766    /// Sets the *delegate* property to the given value.
4767    pub fn delegate(
4768        mut self,
4769        new_value: &'a mut dyn common::Delegate,
4770    ) -> ProjectLocationOccurrenceGetCall<'a, C> {
4771        self._delegate = Some(new_value);
4772        self
4773    }
4774
4775    /// Set any additional parameter of the query string used in the request.
4776    /// It should be used to set parameters which are not yet available through their own
4777    /// setters.
4778    ///
4779    /// Please note that this method must not be used to set any of the known parameters
4780    /// which have their own setter method. If done anyway, the request will fail.
4781    ///
4782    /// # Additional Parameters
4783    ///
4784    /// * *$.xgafv* (query-string) - V1 error format.
4785    /// * *access_token* (query-string) - OAuth access token.
4786    /// * *alt* (query-string) - Data format for response.
4787    /// * *callback* (query-string) - JSONP
4788    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4789    /// * *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.
4790    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4791    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4792    /// * *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.
4793    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4794    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4795    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceGetCall<'a, C>
4796    where
4797        T: AsRef<str>,
4798    {
4799        self._additional_params
4800            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4801        self
4802    }
4803
4804    /// Identifies the authorization scope for the method you are building.
4805    ///
4806    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4807    /// [`Scope::CloudPlatform`].
4808    ///
4809    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4810    /// tokens for more than one scope.
4811    ///
4812    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4813    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4814    /// sufficient, a read-write scope will do as well.
4815    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceGetCall<'a, C>
4816    where
4817        St: AsRef<str>,
4818    {
4819        self._scopes.insert(String::from(scope.as_ref()));
4820        self
4821    }
4822    /// Identifies the authorization scope(s) for the method you are building.
4823    ///
4824    /// See [`Self::add_scope()`] for details.
4825    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceGetCall<'a, C>
4826    where
4827        I: IntoIterator<Item = St>,
4828        St: AsRef<str>,
4829    {
4830        self._scopes
4831            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4832        self
4833    }
4834
4835    /// Removes all scopes, and no default scope will be used either.
4836    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4837    /// for details).
4838    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetCall<'a, C> {
4839        self._scopes.clear();
4840        self
4841    }
4842}
4843
4844/// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
4845///
4846/// A builder for the *locations.occurrences.getNotes* method supported by a *project* resource.
4847/// It is not used directly, but through a [`ProjectMethods`] instance.
4848///
4849/// # Example
4850///
4851/// Instantiate a resource method builder
4852///
4853/// ```test_harness,no_run
4854/// # extern crate hyper;
4855/// # extern crate hyper_rustls;
4856/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4857/// # async fn dox() {
4858/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4859///
4860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4862/// #     secret,
4863/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4864/// # ).build().await.unwrap();
4865///
4866/// # let client = hyper_util::client::legacy::Client::builder(
4867/// #     hyper_util::rt::TokioExecutor::new()
4868/// # )
4869/// # .build(
4870/// #     hyper_rustls::HttpsConnectorBuilder::new()
4871/// #         .with_native_roots()
4872/// #         .unwrap()
4873/// #         .https_or_http()
4874/// #         .enable_http1()
4875/// #         .build()
4876/// # );
4877/// # let mut hub = ContainerAnalysis::new(client, auth);
4878/// // You can configure optional parameters by calling the respective setters at will, and
4879/// // execute the final call using `doit()`.
4880/// // Values shown here are possibly random and not representative !
4881/// let result = hub.projects().locations_occurrences_get_notes("name")
4882///              .doit().await;
4883/// # }
4884/// ```
4885pub struct ProjectLocationOccurrenceGetNoteCall<'a, C>
4886where
4887    C: 'a,
4888{
4889    hub: &'a ContainerAnalysis<C>,
4890    _name: String,
4891    _delegate: Option<&'a mut dyn common::Delegate>,
4892    _additional_params: HashMap<String, String>,
4893    _scopes: BTreeSet<String>,
4894}
4895
4896impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetNoteCall<'a, C> {}
4897
4898impl<'a, C> ProjectLocationOccurrenceGetNoteCall<'a, C>
4899where
4900    C: common::Connector,
4901{
4902    /// Perform the operation you have build so far.
4903    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
4904        use std::borrow::Cow;
4905        use std::io::{Read, Seek};
4906
4907        use common::{url::Params, ToParts};
4908        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4909
4910        let mut dd = common::DefaultDelegate;
4911        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4912        dlg.begin(common::MethodInfo {
4913            id: "containeranalysis.projects.locations.occurrences.getNotes",
4914            http_method: hyper::Method::GET,
4915        });
4916
4917        for &field in ["alt", "name"].iter() {
4918            if self._additional_params.contains_key(field) {
4919                dlg.finished(false);
4920                return Err(common::Error::FieldClash(field));
4921            }
4922        }
4923
4924        let mut params = Params::with_capacity(3 + self._additional_params.len());
4925        params.push("name", self._name);
4926
4927        params.extend(self._additional_params.iter());
4928
4929        params.push("alt", "json");
4930        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/notes";
4931        if self._scopes.is_empty() {
4932            self._scopes
4933                .insert(Scope::CloudPlatform.as_ref().to_string());
4934        }
4935
4936        #[allow(clippy::single_element_loop)]
4937        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4938            url = params.uri_replacement(url, param_name, find_this, true);
4939        }
4940        {
4941            let to_remove = ["name"];
4942            params.remove_params(&to_remove);
4943        }
4944
4945        let url = params.parse_with_url(&url);
4946
4947        loop {
4948            let token = match self
4949                .hub
4950                .auth
4951                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4952                .await
4953            {
4954                Ok(token) => token,
4955                Err(e) => match dlg.token(e) {
4956                    Ok(token) => token,
4957                    Err(e) => {
4958                        dlg.finished(false);
4959                        return Err(common::Error::MissingToken(e));
4960                    }
4961                },
4962            };
4963            let mut req_result = {
4964                let client = &self.hub.client;
4965                dlg.pre_request();
4966                let mut req_builder = hyper::Request::builder()
4967                    .method(hyper::Method::GET)
4968                    .uri(url.as_str())
4969                    .header(USER_AGENT, self.hub._user_agent.clone());
4970
4971                if let Some(token) = token.as_ref() {
4972                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4973                }
4974
4975                let request = req_builder
4976                    .header(CONTENT_LENGTH, 0_u64)
4977                    .body(common::to_body::<String>(None));
4978
4979                client.request(request.unwrap()).await
4980            };
4981
4982            match req_result {
4983                Err(err) => {
4984                    if let common::Retry::After(d) = dlg.http_error(&err) {
4985                        sleep(d).await;
4986                        continue;
4987                    }
4988                    dlg.finished(false);
4989                    return Err(common::Error::HttpError(err));
4990                }
4991                Ok(res) => {
4992                    let (mut parts, body) = res.into_parts();
4993                    let mut body = common::Body::new(body);
4994                    if !parts.status.is_success() {
4995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4996                        let error = serde_json::from_str(&common::to_string(&bytes));
4997                        let response = common::to_response(parts, bytes.into());
4998
4999                        if let common::Retry::After(d) =
5000                            dlg.http_failure(&response, error.as_ref().ok())
5001                        {
5002                            sleep(d).await;
5003                            continue;
5004                        }
5005
5006                        dlg.finished(false);
5007
5008                        return Err(match error {
5009                            Ok(value) => common::Error::BadRequest(value),
5010                            _ => common::Error::Failure(response),
5011                        });
5012                    }
5013                    let response = {
5014                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5015                        let encoded = common::to_string(&bytes);
5016                        match serde_json::from_str(&encoded) {
5017                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5018                            Err(error) => {
5019                                dlg.response_json_decode_error(&encoded, &error);
5020                                return Err(common::Error::JsonDecodeError(
5021                                    encoded.to_string(),
5022                                    error,
5023                                ));
5024                            }
5025                        }
5026                    };
5027
5028                    dlg.finished(true);
5029                    return Ok(response);
5030                }
5031            }
5032        }
5033    }
5034
5035    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
5036    ///
5037    /// Sets the *name* path property to the given value.
5038    ///
5039    /// Even though the property as already been set when instantiating this call,
5040    /// we provide this method for API completeness.
5041    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
5042        self._name = new_value.to_string();
5043        self
5044    }
5045    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5046    /// while executing the actual API request.
5047    ///
5048    /// ````text
5049    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5050    /// ````
5051    ///
5052    /// Sets the *delegate* property to the given value.
5053    pub fn delegate(
5054        mut self,
5055        new_value: &'a mut dyn common::Delegate,
5056    ) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
5057        self._delegate = Some(new_value);
5058        self
5059    }
5060
5061    /// Set any additional parameter of the query string used in the request.
5062    /// It should be used to set parameters which are not yet available through their own
5063    /// setters.
5064    ///
5065    /// Please note that this method must not be used to set any of the known parameters
5066    /// which have their own setter method. If done anyway, the request will fail.
5067    ///
5068    /// # Additional Parameters
5069    ///
5070    /// * *$.xgafv* (query-string) - V1 error format.
5071    /// * *access_token* (query-string) - OAuth access token.
5072    /// * *alt* (query-string) - Data format for response.
5073    /// * *callback* (query-string) - JSONP
5074    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5075    /// * *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.
5076    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5077    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5078    /// * *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.
5079    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5080    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5081    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
5082    where
5083        T: AsRef<str>,
5084    {
5085        self._additional_params
5086            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5087        self
5088    }
5089
5090    /// Identifies the authorization scope for the method you are building.
5091    ///
5092    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5093    /// [`Scope::CloudPlatform`].
5094    ///
5095    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5096    /// tokens for more than one scope.
5097    ///
5098    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5099    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5100    /// sufficient, a read-write scope will do as well.
5101    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
5102    where
5103        St: AsRef<str>,
5104    {
5105        self._scopes.insert(String::from(scope.as_ref()));
5106        self
5107    }
5108    /// Identifies the authorization scope(s) for the method you are building.
5109    ///
5110    /// See [`Self::add_scope()`] for details.
5111    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
5112    where
5113        I: IntoIterator<Item = St>,
5114        St: AsRef<str>,
5115    {
5116        self._scopes
5117            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5118        self
5119    }
5120
5121    /// Removes all scopes, and no default scope will be used either.
5122    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5123    /// for details).
5124    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
5125        self._scopes.clear();
5126        self
5127    }
5128}
5129
5130/// Gets a summary of the number and severity of occurrences.
5131///
5132/// A builder for the *locations.occurrences.getVulnerabilitySummary* method supported by a *project* resource.
5133/// It is not used directly, but through a [`ProjectMethods`] instance.
5134///
5135/// # Example
5136///
5137/// Instantiate a resource method builder
5138///
5139/// ```test_harness,no_run
5140/// # extern crate hyper;
5141/// # extern crate hyper_rustls;
5142/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5143/// # async fn dox() {
5144/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5145///
5146/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5147/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5148/// #     secret,
5149/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5150/// # ).build().await.unwrap();
5151///
5152/// # let client = hyper_util::client::legacy::Client::builder(
5153/// #     hyper_util::rt::TokioExecutor::new()
5154/// # )
5155/// # .build(
5156/// #     hyper_rustls::HttpsConnectorBuilder::new()
5157/// #         .with_native_roots()
5158/// #         .unwrap()
5159/// #         .https_or_http()
5160/// #         .enable_http1()
5161/// #         .build()
5162/// # );
5163/// # let mut hub = ContainerAnalysis::new(client, auth);
5164/// // You can configure optional parameters by calling the respective setters at will, and
5165/// // execute the final call using `doit()`.
5166/// // Values shown here are possibly random and not representative !
5167/// let result = hub.projects().locations_occurrences_get_vulnerability_summary("parent")
5168///              .filter("ea")
5169///              .doit().await;
5170/// # }
5171/// ```
5172pub struct ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
5173where
5174    C: 'a,
5175{
5176    hub: &'a ContainerAnalysis<C>,
5177    _parent: String,
5178    _filter: Option<String>,
5179    _delegate: Option<&'a mut dyn common::Delegate>,
5180    _additional_params: HashMap<String, String>,
5181    _scopes: BTreeSet<String>,
5182}
5183
5184impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {}
5185
5186impl<'a, C> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
5187where
5188    C: common::Connector,
5189{
5190    /// Perform the operation you have build so far.
5191    pub async fn doit(
5192        mut self,
5193    ) -> common::Result<(common::Response, VulnerabilityOccurrencesSummary)> {
5194        use std::borrow::Cow;
5195        use std::io::{Read, Seek};
5196
5197        use common::{url::Params, ToParts};
5198        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5199
5200        let mut dd = common::DefaultDelegate;
5201        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5202        dlg.begin(common::MethodInfo {
5203            id: "containeranalysis.projects.locations.occurrences.getVulnerabilitySummary",
5204            http_method: hyper::Method::GET,
5205        });
5206
5207        for &field in ["alt", "parent", "filter"].iter() {
5208            if self._additional_params.contains_key(field) {
5209                dlg.finished(false);
5210                return Err(common::Error::FieldClash(field));
5211            }
5212        }
5213
5214        let mut params = Params::with_capacity(4 + self._additional_params.len());
5215        params.push("parent", self._parent);
5216        if let Some(value) = self._filter.as_ref() {
5217            params.push("filter", value);
5218        }
5219
5220        params.extend(self._additional_params.iter());
5221
5222        params.push("alt", "json");
5223        let mut url =
5224            self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:vulnerabilitySummary";
5225        if self._scopes.is_empty() {
5226            self._scopes
5227                .insert(Scope::CloudPlatform.as_ref().to_string());
5228        }
5229
5230        #[allow(clippy::single_element_loop)]
5231        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5232            url = params.uri_replacement(url, param_name, find_this, true);
5233        }
5234        {
5235            let to_remove = ["parent"];
5236            params.remove_params(&to_remove);
5237        }
5238
5239        let url = params.parse_with_url(&url);
5240
5241        loop {
5242            let token = match self
5243                .hub
5244                .auth
5245                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5246                .await
5247            {
5248                Ok(token) => token,
5249                Err(e) => match dlg.token(e) {
5250                    Ok(token) => token,
5251                    Err(e) => {
5252                        dlg.finished(false);
5253                        return Err(common::Error::MissingToken(e));
5254                    }
5255                },
5256            };
5257            let mut req_result = {
5258                let client = &self.hub.client;
5259                dlg.pre_request();
5260                let mut req_builder = hyper::Request::builder()
5261                    .method(hyper::Method::GET)
5262                    .uri(url.as_str())
5263                    .header(USER_AGENT, self.hub._user_agent.clone());
5264
5265                if let Some(token) = token.as_ref() {
5266                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5267                }
5268
5269                let request = req_builder
5270                    .header(CONTENT_LENGTH, 0_u64)
5271                    .body(common::to_body::<String>(None));
5272
5273                client.request(request.unwrap()).await
5274            };
5275
5276            match req_result {
5277                Err(err) => {
5278                    if let common::Retry::After(d) = dlg.http_error(&err) {
5279                        sleep(d).await;
5280                        continue;
5281                    }
5282                    dlg.finished(false);
5283                    return Err(common::Error::HttpError(err));
5284                }
5285                Ok(res) => {
5286                    let (mut parts, body) = res.into_parts();
5287                    let mut body = common::Body::new(body);
5288                    if !parts.status.is_success() {
5289                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5290                        let error = serde_json::from_str(&common::to_string(&bytes));
5291                        let response = common::to_response(parts, bytes.into());
5292
5293                        if let common::Retry::After(d) =
5294                            dlg.http_failure(&response, error.as_ref().ok())
5295                        {
5296                            sleep(d).await;
5297                            continue;
5298                        }
5299
5300                        dlg.finished(false);
5301
5302                        return Err(match error {
5303                            Ok(value) => common::Error::BadRequest(value),
5304                            _ => common::Error::Failure(response),
5305                        });
5306                    }
5307                    let response = {
5308                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5309                        let encoded = common::to_string(&bytes);
5310                        match serde_json::from_str(&encoded) {
5311                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5312                            Err(error) => {
5313                                dlg.response_json_decode_error(&encoded, &error);
5314                                return Err(common::Error::JsonDecodeError(
5315                                    encoded.to_string(),
5316                                    error,
5317                                ));
5318                            }
5319                        }
5320                    };
5321
5322                    dlg.finished(true);
5323                    return Ok(response);
5324                }
5325            }
5326        }
5327    }
5328
5329    /// Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
5330    ///
5331    /// Sets the *parent* path property to the given value.
5332    ///
5333    /// Even though the property as already been set when instantiating this call,
5334    /// we provide this method for API completeness.
5335    pub fn parent(
5336        mut self,
5337        new_value: &str,
5338    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
5339        self._parent = new_value.to_string();
5340        self
5341    }
5342    /// The filter expression.
5343    ///
5344    /// Sets the *filter* query property to the given value.
5345    pub fn filter(
5346        mut self,
5347        new_value: &str,
5348    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
5349        self._filter = Some(new_value.to_string());
5350        self
5351    }
5352    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5353    /// while executing the actual API request.
5354    ///
5355    /// ````text
5356    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5357    /// ````
5358    ///
5359    /// Sets the *delegate* property to the given value.
5360    pub fn delegate(
5361        mut self,
5362        new_value: &'a mut dyn common::Delegate,
5363    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
5364        self._delegate = Some(new_value);
5365        self
5366    }
5367
5368    /// Set any additional parameter of the query string used in the request.
5369    /// It should be used to set parameters which are not yet available through their own
5370    /// setters.
5371    ///
5372    /// Please note that this method must not be used to set any of the known parameters
5373    /// which have their own setter method. If done anyway, the request will fail.
5374    ///
5375    /// # Additional Parameters
5376    ///
5377    /// * *$.xgafv* (query-string) - V1 error format.
5378    /// * *access_token* (query-string) - OAuth access token.
5379    /// * *alt* (query-string) - Data format for response.
5380    /// * *callback* (query-string) - JSONP
5381    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5382    /// * *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.
5383    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5384    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5385    /// * *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.
5386    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5387    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5388    pub fn param<T>(
5389        mut self,
5390        name: T,
5391        value: T,
5392    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
5393    where
5394        T: AsRef<str>,
5395    {
5396        self._additional_params
5397            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5398        self
5399    }
5400
5401    /// Identifies the authorization scope for the method you are building.
5402    ///
5403    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5404    /// [`Scope::CloudPlatform`].
5405    ///
5406    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5407    /// tokens for more than one scope.
5408    ///
5409    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5410    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5411    /// sufficient, a read-write scope will do as well.
5412    pub fn add_scope<St>(
5413        mut self,
5414        scope: St,
5415    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
5416    where
5417        St: AsRef<str>,
5418    {
5419        self._scopes.insert(String::from(scope.as_ref()));
5420        self
5421    }
5422    /// Identifies the authorization scope(s) for the method you are building.
5423    ///
5424    /// See [`Self::add_scope()`] for details.
5425    pub fn add_scopes<I, St>(
5426        mut self,
5427        scopes: I,
5428    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
5429    where
5430        I: IntoIterator<Item = St>,
5431        St: AsRef<str>,
5432    {
5433        self._scopes
5434            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5435        self
5436    }
5437
5438    /// Removes all scopes, and no default scope will be used either.
5439    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5440    /// for details).
5441    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
5442        self._scopes.clear();
5443        self
5444    }
5445}
5446
5447/// Lists occurrences for the specified project.
5448///
5449/// A builder for the *locations.occurrences.list* method supported by a *project* resource.
5450/// It is not used directly, but through a [`ProjectMethods`] instance.
5451///
5452/// # Example
5453///
5454/// Instantiate a resource method builder
5455///
5456/// ```test_harness,no_run
5457/// # extern crate hyper;
5458/// # extern crate hyper_rustls;
5459/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5460/// # async fn dox() {
5461/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5462///
5463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5464/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5465/// #     secret,
5466/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5467/// # ).build().await.unwrap();
5468///
5469/// # let client = hyper_util::client::legacy::Client::builder(
5470/// #     hyper_util::rt::TokioExecutor::new()
5471/// # )
5472/// # .build(
5473/// #     hyper_rustls::HttpsConnectorBuilder::new()
5474/// #         .with_native_roots()
5475/// #         .unwrap()
5476/// #         .https_or_http()
5477/// #         .enable_http1()
5478/// #         .build()
5479/// # );
5480/// # let mut hub = ContainerAnalysis::new(client, auth);
5481/// // You can configure optional parameters by calling the respective setters at will, and
5482/// // execute the final call using `doit()`.
5483/// // Values shown here are possibly random and not representative !
5484/// let result = hub.projects().locations_occurrences_list("parent")
5485///              .page_token("invidunt")
5486///              .page_size(-47)
5487///              .filter("duo")
5488///              .doit().await;
5489/// # }
5490/// ```
5491pub struct ProjectLocationOccurrenceListCall<'a, C>
5492where
5493    C: 'a,
5494{
5495    hub: &'a ContainerAnalysis<C>,
5496    _parent: String,
5497    _page_token: Option<String>,
5498    _page_size: Option<i32>,
5499    _filter: Option<String>,
5500    _delegate: Option<&'a mut dyn common::Delegate>,
5501    _additional_params: HashMap<String, String>,
5502    _scopes: BTreeSet<String>,
5503}
5504
5505impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceListCall<'a, C> {}
5506
5507impl<'a, C> ProjectLocationOccurrenceListCall<'a, C>
5508where
5509    C: common::Connector,
5510{
5511    /// Perform the operation you have build so far.
5512    pub async fn doit(mut self) -> common::Result<(common::Response, ListOccurrencesResponse)> {
5513        use std::borrow::Cow;
5514        use std::io::{Read, Seek};
5515
5516        use common::{url::Params, ToParts};
5517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5518
5519        let mut dd = common::DefaultDelegate;
5520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5521        dlg.begin(common::MethodInfo {
5522            id: "containeranalysis.projects.locations.occurrences.list",
5523            http_method: hyper::Method::GET,
5524        });
5525
5526        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5527            if self._additional_params.contains_key(field) {
5528                dlg.finished(false);
5529                return Err(common::Error::FieldClash(field));
5530            }
5531        }
5532
5533        let mut params = Params::with_capacity(6 + self._additional_params.len());
5534        params.push("parent", self._parent);
5535        if let Some(value) = self._page_token.as_ref() {
5536            params.push("pageToken", value);
5537        }
5538        if let Some(value) = self._page_size.as_ref() {
5539            params.push("pageSize", value.to_string());
5540        }
5541        if let Some(value) = self._filter.as_ref() {
5542            params.push("filter", value);
5543        }
5544
5545        params.extend(self._additional_params.iter());
5546
5547        params.push("alt", "json");
5548        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
5549        if self._scopes.is_empty() {
5550            self._scopes
5551                .insert(Scope::CloudPlatform.as_ref().to_string());
5552        }
5553
5554        #[allow(clippy::single_element_loop)]
5555        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5556            url = params.uri_replacement(url, param_name, find_this, true);
5557        }
5558        {
5559            let to_remove = ["parent"];
5560            params.remove_params(&to_remove);
5561        }
5562
5563        let url = params.parse_with_url(&url);
5564
5565        loop {
5566            let token = match self
5567                .hub
5568                .auth
5569                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5570                .await
5571            {
5572                Ok(token) => token,
5573                Err(e) => match dlg.token(e) {
5574                    Ok(token) => token,
5575                    Err(e) => {
5576                        dlg.finished(false);
5577                        return Err(common::Error::MissingToken(e));
5578                    }
5579                },
5580            };
5581            let mut req_result = {
5582                let client = &self.hub.client;
5583                dlg.pre_request();
5584                let mut req_builder = hyper::Request::builder()
5585                    .method(hyper::Method::GET)
5586                    .uri(url.as_str())
5587                    .header(USER_AGENT, self.hub._user_agent.clone());
5588
5589                if let Some(token) = token.as_ref() {
5590                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5591                }
5592
5593                let request = req_builder
5594                    .header(CONTENT_LENGTH, 0_u64)
5595                    .body(common::to_body::<String>(None));
5596
5597                client.request(request.unwrap()).await
5598            };
5599
5600            match req_result {
5601                Err(err) => {
5602                    if let common::Retry::After(d) = dlg.http_error(&err) {
5603                        sleep(d).await;
5604                        continue;
5605                    }
5606                    dlg.finished(false);
5607                    return Err(common::Error::HttpError(err));
5608                }
5609                Ok(res) => {
5610                    let (mut parts, body) = res.into_parts();
5611                    let mut body = common::Body::new(body);
5612                    if !parts.status.is_success() {
5613                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5614                        let error = serde_json::from_str(&common::to_string(&bytes));
5615                        let response = common::to_response(parts, bytes.into());
5616
5617                        if let common::Retry::After(d) =
5618                            dlg.http_failure(&response, error.as_ref().ok())
5619                        {
5620                            sleep(d).await;
5621                            continue;
5622                        }
5623
5624                        dlg.finished(false);
5625
5626                        return Err(match error {
5627                            Ok(value) => common::Error::BadRequest(value),
5628                            _ => common::Error::Failure(response),
5629                        });
5630                    }
5631                    let response = {
5632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5633                        let encoded = common::to_string(&bytes);
5634                        match serde_json::from_str(&encoded) {
5635                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5636                            Err(error) => {
5637                                dlg.response_json_decode_error(&encoded, &error);
5638                                return Err(common::Error::JsonDecodeError(
5639                                    encoded.to_string(),
5640                                    error,
5641                                ));
5642                            }
5643                        }
5644                    };
5645
5646                    dlg.finished(true);
5647                    return Ok(response);
5648                }
5649            }
5650        }
5651    }
5652
5653    /// Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
5654    ///
5655    /// Sets the *parent* path property to the given value.
5656    ///
5657    /// Even though the property as already been set when instantiating this call,
5658    /// we provide this method for API completeness.
5659    pub fn parent(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
5660        self._parent = new_value.to_string();
5661        self
5662    }
5663    /// Token to provide to skip to a particular spot in the list.
5664    ///
5665    /// Sets the *page token* query property to the given value.
5666    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
5667        self._page_token = Some(new_value.to_string());
5668        self
5669    }
5670    /// Number of occurrences to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.
5671    ///
5672    /// Sets the *page size* query property to the given value.
5673    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOccurrenceListCall<'a, C> {
5674        self._page_size = Some(new_value);
5675        self
5676    }
5677    /// The filter expression.
5678    ///
5679    /// Sets the *filter* query property to the given value.
5680    pub fn filter(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
5681        self._filter = Some(new_value.to_string());
5682        self
5683    }
5684    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5685    /// while executing the actual API request.
5686    ///
5687    /// ````text
5688    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5689    /// ````
5690    ///
5691    /// Sets the *delegate* property to the given value.
5692    pub fn delegate(
5693        mut self,
5694        new_value: &'a mut dyn common::Delegate,
5695    ) -> ProjectLocationOccurrenceListCall<'a, C> {
5696        self._delegate = Some(new_value);
5697        self
5698    }
5699
5700    /// Set any additional parameter of the query string used in the request.
5701    /// It should be used to set parameters which are not yet available through their own
5702    /// setters.
5703    ///
5704    /// Please note that this method must not be used to set any of the known parameters
5705    /// which have their own setter method. If done anyway, the request will fail.
5706    ///
5707    /// # Additional Parameters
5708    ///
5709    /// * *$.xgafv* (query-string) - V1 error format.
5710    /// * *access_token* (query-string) - OAuth access token.
5711    /// * *alt* (query-string) - Data format for response.
5712    /// * *callback* (query-string) - JSONP
5713    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5714    /// * *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.
5715    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5716    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5717    /// * *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.
5718    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5719    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5720    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceListCall<'a, C>
5721    where
5722        T: AsRef<str>,
5723    {
5724        self._additional_params
5725            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5726        self
5727    }
5728
5729    /// Identifies the authorization scope for the method you are building.
5730    ///
5731    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5732    /// [`Scope::CloudPlatform`].
5733    ///
5734    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5735    /// tokens for more than one scope.
5736    ///
5737    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5738    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5739    /// sufficient, a read-write scope will do as well.
5740    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceListCall<'a, C>
5741    where
5742        St: AsRef<str>,
5743    {
5744        self._scopes.insert(String::from(scope.as_ref()));
5745        self
5746    }
5747    /// Identifies the authorization scope(s) for the method you are building.
5748    ///
5749    /// See [`Self::add_scope()`] for details.
5750    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceListCall<'a, C>
5751    where
5752        I: IntoIterator<Item = St>,
5753        St: AsRef<str>,
5754    {
5755        self._scopes
5756            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5757        self
5758    }
5759
5760    /// Removes all scopes, and no default scope will be used either.
5761    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5762    /// for details).
5763    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceListCall<'a, C> {
5764        self._scopes.clear();
5765        self
5766    }
5767}
5768
5769/// Generates an SBOM and other dependency information for the given resource.
5770///
5771/// A builder for the *locations.resources.exportSBOM* method supported by a *project* resource.
5772/// It is not used directly, but through a [`ProjectMethods`] instance.
5773///
5774/// # Example
5775///
5776/// Instantiate a resource method builder
5777///
5778/// ```test_harness,no_run
5779/// # extern crate hyper;
5780/// # extern crate hyper_rustls;
5781/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5782/// use containeranalysis1_beta1::api::ExportSBOMRequest;
5783/// # async fn dox() {
5784/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5785///
5786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5788/// #     secret,
5789/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5790/// # ).build().await.unwrap();
5791///
5792/// # let client = hyper_util::client::legacy::Client::builder(
5793/// #     hyper_util::rt::TokioExecutor::new()
5794/// # )
5795/// # .build(
5796/// #     hyper_rustls::HttpsConnectorBuilder::new()
5797/// #         .with_native_roots()
5798/// #         .unwrap()
5799/// #         .https_or_http()
5800/// #         .enable_http1()
5801/// #         .build()
5802/// # );
5803/// # let mut hub = ContainerAnalysis::new(client, auth);
5804/// // As the method needs a request, you would usually fill it with the desired information
5805/// // into the respective structure. Some of the parts shown here might not be applicable !
5806/// // Values shown here are possibly random and not representative !
5807/// let mut req = ExportSBOMRequest::default();
5808///
5809/// // You can configure optional parameters by calling the respective setters at will, and
5810/// // execute the final call using `doit()`.
5811/// // Values shown here are possibly random and not representative !
5812/// let result = hub.projects().locations_resources_export_sbom(req, "name")
5813///              .doit().await;
5814/// # }
5815/// ```
5816pub struct ProjectLocationResourceExportSBOMCall<'a, C>
5817where
5818    C: 'a,
5819{
5820    hub: &'a ContainerAnalysis<C>,
5821    _request: ExportSBOMRequest,
5822    _name: String,
5823    _delegate: Option<&'a mut dyn common::Delegate>,
5824    _additional_params: HashMap<String, String>,
5825    _scopes: BTreeSet<String>,
5826}
5827
5828impl<'a, C> common::CallBuilder for ProjectLocationResourceExportSBOMCall<'a, C> {}
5829
5830impl<'a, C> ProjectLocationResourceExportSBOMCall<'a, C>
5831where
5832    C: common::Connector,
5833{
5834    /// Perform the operation you have build so far.
5835    pub async fn doit(mut self) -> common::Result<(common::Response, ExportSBOMResponse)> {
5836        use std::borrow::Cow;
5837        use std::io::{Read, Seek};
5838
5839        use common::{url::Params, ToParts};
5840        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5841
5842        let mut dd = common::DefaultDelegate;
5843        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5844        dlg.begin(common::MethodInfo {
5845            id: "containeranalysis.projects.locations.resources.exportSBOM",
5846            http_method: hyper::Method::POST,
5847        });
5848
5849        for &field in ["alt", "name"].iter() {
5850            if self._additional_params.contains_key(field) {
5851                dlg.finished(false);
5852                return Err(common::Error::FieldClash(field));
5853            }
5854        }
5855
5856        let mut params = Params::with_capacity(4 + self._additional_params.len());
5857        params.push("name", self._name);
5858
5859        params.extend(self._additional_params.iter());
5860
5861        params.push("alt", "json");
5862        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:exportSBOM";
5863        if self._scopes.is_empty() {
5864            self._scopes
5865                .insert(Scope::CloudPlatform.as_ref().to_string());
5866        }
5867
5868        #[allow(clippy::single_element_loop)]
5869        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5870            url = params.uri_replacement(url, param_name, find_this, true);
5871        }
5872        {
5873            let to_remove = ["name"];
5874            params.remove_params(&to_remove);
5875        }
5876
5877        let url = params.parse_with_url(&url);
5878
5879        let mut json_mime_type = mime::APPLICATION_JSON;
5880        let mut request_value_reader = {
5881            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5882            common::remove_json_null_values(&mut value);
5883            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5884            serde_json::to_writer(&mut dst, &value).unwrap();
5885            dst
5886        };
5887        let request_size = request_value_reader
5888            .seek(std::io::SeekFrom::End(0))
5889            .unwrap();
5890        request_value_reader
5891            .seek(std::io::SeekFrom::Start(0))
5892            .unwrap();
5893
5894        loop {
5895            let token = match self
5896                .hub
5897                .auth
5898                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5899                .await
5900            {
5901                Ok(token) => token,
5902                Err(e) => match dlg.token(e) {
5903                    Ok(token) => token,
5904                    Err(e) => {
5905                        dlg.finished(false);
5906                        return Err(common::Error::MissingToken(e));
5907                    }
5908                },
5909            };
5910            request_value_reader
5911                .seek(std::io::SeekFrom::Start(0))
5912                .unwrap();
5913            let mut req_result = {
5914                let client = &self.hub.client;
5915                dlg.pre_request();
5916                let mut req_builder = hyper::Request::builder()
5917                    .method(hyper::Method::POST)
5918                    .uri(url.as_str())
5919                    .header(USER_AGENT, self.hub._user_agent.clone());
5920
5921                if let Some(token) = token.as_ref() {
5922                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5923                }
5924
5925                let request = req_builder
5926                    .header(CONTENT_TYPE, json_mime_type.to_string())
5927                    .header(CONTENT_LENGTH, request_size as u64)
5928                    .body(common::to_body(
5929                        request_value_reader.get_ref().clone().into(),
5930                    ));
5931
5932                client.request(request.unwrap()).await
5933            };
5934
5935            match req_result {
5936                Err(err) => {
5937                    if let common::Retry::After(d) = dlg.http_error(&err) {
5938                        sleep(d).await;
5939                        continue;
5940                    }
5941                    dlg.finished(false);
5942                    return Err(common::Error::HttpError(err));
5943                }
5944                Ok(res) => {
5945                    let (mut parts, body) = res.into_parts();
5946                    let mut body = common::Body::new(body);
5947                    if !parts.status.is_success() {
5948                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5949                        let error = serde_json::from_str(&common::to_string(&bytes));
5950                        let response = common::to_response(parts, bytes.into());
5951
5952                        if let common::Retry::After(d) =
5953                            dlg.http_failure(&response, error.as_ref().ok())
5954                        {
5955                            sleep(d).await;
5956                            continue;
5957                        }
5958
5959                        dlg.finished(false);
5960
5961                        return Err(match error {
5962                            Ok(value) => common::Error::BadRequest(value),
5963                            _ => common::Error::Failure(response),
5964                        });
5965                    }
5966                    let response = {
5967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5968                        let encoded = common::to_string(&bytes);
5969                        match serde_json::from_str(&encoded) {
5970                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5971                            Err(error) => {
5972                                dlg.response_json_decode_error(&encoded, &error);
5973                                return Err(common::Error::JsonDecodeError(
5974                                    encoded.to_string(),
5975                                    error,
5976                                ));
5977                            }
5978                        }
5979                    };
5980
5981                    dlg.finished(true);
5982                    return Ok(response);
5983                }
5984            }
5985        }
5986    }
5987
5988    ///
5989    /// Sets the *request* property to the given value.
5990    ///
5991    /// Even though the property as already been set when instantiating this call,
5992    /// we provide this method for API completeness.
5993    pub fn request(
5994        mut self,
5995        new_value: ExportSBOMRequest,
5996    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
5997        self._request = new_value;
5998        self
5999    }
6000    /// Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
6001    ///
6002    /// Sets the *name* path property to the given value.
6003    ///
6004    /// Even though the property as already been set when instantiating this call,
6005    /// we provide this method for API completeness.
6006    pub fn name(mut self, new_value: &str) -> ProjectLocationResourceExportSBOMCall<'a, C> {
6007        self._name = new_value.to_string();
6008        self
6009    }
6010    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6011    /// while executing the actual API request.
6012    ///
6013    /// ````text
6014    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6015    /// ````
6016    ///
6017    /// Sets the *delegate* property to the given value.
6018    pub fn delegate(
6019        mut self,
6020        new_value: &'a mut dyn common::Delegate,
6021    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
6022        self._delegate = Some(new_value);
6023        self
6024    }
6025
6026    /// Set any additional parameter of the query string used in the request.
6027    /// It should be used to set parameters which are not yet available through their own
6028    /// setters.
6029    ///
6030    /// Please note that this method must not be used to set any of the known parameters
6031    /// which have their own setter method. If done anyway, the request will fail.
6032    ///
6033    /// # Additional Parameters
6034    ///
6035    /// * *$.xgafv* (query-string) - V1 error format.
6036    /// * *access_token* (query-string) - OAuth access token.
6037    /// * *alt* (query-string) - Data format for response.
6038    /// * *callback* (query-string) - JSONP
6039    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6040    /// * *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.
6041    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6042    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6043    /// * *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.
6044    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6045    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6046    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationResourceExportSBOMCall<'a, C>
6047    where
6048        T: AsRef<str>,
6049    {
6050        self._additional_params
6051            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6052        self
6053    }
6054
6055    /// Identifies the authorization scope for the method you are building.
6056    ///
6057    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6058    /// [`Scope::CloudPlatform`].
6059    ///
6060    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6061    /// tokens for more than one scope.
6062    ///
6063    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6064    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6065    /// sufficient, a read-write scope will do as well.
6066    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationResourceExportSBOMCall<'a, C>
6067    where
6068        St: AsRef<str>,
6069    {
6070        self._scopes.insert(String::from(scope.as_ref()));
6071        self
6072    }
6073    /// Identifies the authorization scope(s) for the method you are building.
6074    ///
6075    /// See [`Self::add_scope()`] for details.
6076    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationResourceExportSBOMCall<'a, C>
6077    where
6078        I: IntoIterator<Item = St>,
6079        St: AsRef<str>,
6080    {
6081        self._scopes
6082            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6083        self
6084    }
6085
6086    /// Removes all scopes, and no default scope will be used either.
6087    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6088    /// for details).
6089    pub fn clear_scopes(mut self) -> ProjectLocationResourceExportSBOMCall<'a, C> {
6090        self._scopes.clear();
6091        self
6092    }
6093}
6094
6095/// Gets a summary of the packages within a given resource.
6096///
6097/// A builder for the *locations.resources.generatePackagesSummary* method supported by a *project* resource.
6098/// It is not used directly, but through a [`ProjectMethods`] instance.
6099///
6100/// # Example
6101///
6102/// Instantiate a resource method builder
6103///
6104/// ```test_harness,no_run
6105/// # extern crate hyper;
6106/// # extern crate hyper_rustls;
6107/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6108/// use containeranalysis1_beta1::api::GeneratePackagesSummaryRequest;
6109/// # async fn dox() {
6110/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6111///
6112/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6113/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6114/// #     secret,
6115/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6116/// # ).build().await.unwrap();
6117///
6118/// # let client = hyper_util::client::legacy::Client::builder(
6119/// #     hyper_util::rt::TokioExecutor::new()
6120/// # )
6121/// # .build(
6122/// #     hyper_rustls::HttpsConnectorBuilder::new()
6123/// #         .with_native_roots()
6124/// #         .unwrap()
6125/// #         .https_or_http()
6126/// #         .enable_http1()
6127/// #         .build()
6128/// # );
6129/// # let mut hub = ContainerAnalysis::new(client, auth);
6130/// // As the method needs a request, you would usually fill it with the desired information
6131/// // into the respective structure. Some of the parts shown here might not be applicable !
6132/// // Values shown here are possibly random and not representative !
6133/// let mut req = GeneratePackagesSummaryRequest::default();
6134///
6135/// // You can configure optional parameters by calling the respective setters at will, and
6136/// // execute the final call using `doit()`.
6137/// // Values shown here are possibly random and not representative !
6138/// let result = hub.projects().locations_resources_generate_packages_summary(req, "name")
6139///              .doit().await;
6140/// # }
6141/// ```
6142pub struct ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
6143where
6144    C: 'a,
6145{
6146    hub: &'a ContainerAnalysis<C>,
6147    _request: GeneratePackagesSummaryRequest,
6148    _name: String,
6149    _delegate: Option<&'a mut dyn common::Delegate>,
6150    _additional_params: HashMap<String, String>,
6151    _scopes: BTreeSet<String>,
6152}
6153
6154impl<'a, C> common::CallBuilder for ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {}
6155
6156impl<'a, C> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
6157where
6158    C: common::Connector,
6159{
6160    /// Perform the operation you have build so far.
6161    pub async fn doit(mut self) -> common::Result<(common::Response, PackagesSummaryResponse)> {
6162        use std::borrow::Cow;
6163        use std::io::{Read, Seek};
6164
6165        use common::{url::Params, ToParts};
6166        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6167
6168        let mut dd = common::DefaultDelegate;
6169        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6170        dlg.begin(common::MethodInfo {
6171            id: "containeranalysis.projects.locations.resources.generatePackagesSummary",
6172            http_method: hyper::Method::POST,
6173        });
6174
6175        for &field in ["alt", "name"].iter() {
6176            if self._additional_params.contains_key(field) {
6177                dlg.finished(false);
6178                return Err(common::Error::FieldClash(field));
6179            }
6180        }
6181
6182        let mut params = Params::with_capacity(4 + self._additional_params.len());
6183        params.push("name", self._name);
6184
6185        params.extend(self._additional_params.iter());
6186
6187        params.push("alt", "json");
6188        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:generatePackagesSummary";
6189        if self._scopes.is_empty() {
6190            self._scopes
6191                .insert(Scope::CloudPlatform.as_ref().to_string());
6192        }
6193
6194        #[allow(clippy::single_element_loop)]
6195        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6196            url = params.uri_replacement(url, param_name, find_this, true);
6197        }
6198        {
6199            let to_remove = ["name"];
6200            params.remove_params(&to_remove);
6201        }
6202
6203        let url = params.parse_with_url(&url);
6204
6205        let mut json_mime_type = mime::APPLICATION_JSON;
6206        let mut request_value_reader = {
6207            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6208            common::remove_json_null_values(&mut value);
6209            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6210            serde_json::to_writer(&mut dst, &value).unwrap();
6211            dst
6212        };
6213        let request_size = request_value_reader
6214            .seek(std::io::SeekFrom::End(0))
6215            .unwrap();
6216        request_value_reader
6217            .seek(std::io::SeekFrom::Start(0))
6218            .unwrap();
6219
6220        loop {
6221            let token = match self
6222                .hub
6223                .auth
6224                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6225                .await
6226            {
6227                Ok(token) => token,
6228                Err(e) => match dlg.token(e) {
6229                    Ok(token) => token,
6230                    Err(e) => {
6231                        dlg.finished(false);
6232                        return Err(common::Error::MissingToken(e));
6233                    }
6234                },
6235            };
6236            request_value_reader
6237                .seek(std::io::SeekFrom::Start(0))
6238                .unwrap();
6239            let mut req_result = {
6240                let client = &self.hub.client;
6241                dlg.pre_request();
6242                let mut req_builder = hyper::Request::builder()
6243                    .method(hyper::Method::POST)
6244                    .uri(url.as_str())
6245                    .header(USER_AGENT, self.hub._user_agent.clone());
6246
6247                if let Some(token) = token.as_ref() {
6248                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6249                }
6250
6251                let request = req_builder
6252                    .header(CONTENT_TYPE, json_mime_type.to_string())
6253                    .header(CONTENT_LENGTH, request_size as u64)
6254                    .body(common::to_body(
6255                        request_value_reader.get_ref().clone().into(),
6256                    ));
6257
6258                client.request(request.unwrap()).await
6259            };
6260
6261            match req_result {
6262                Err(err) => {
6263                    if let common::Retry::After(d) = dlg.http_error(&err) {
6264                        sleep(d).await;
6265                        continue;
6266                    }
6267                    dlg.finished(false);
6268                    return Err(common::Error::HttpError(err));
6269                }
6270                Ok(res) => {
6271                    let (mut parts, body) = res.into_parts();
6272                    let mut body = common::Body::new(body);
6273                    if !parts.status.is_success() {
6274                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6275                        let error = serde_json::from_str(&common::to_string(&bytes));
6276                        let response = common::to_response(parts, bytes.into());
6277
6278                        if let common::Retry::After(d) =
6279                            dlg.http_failure(&response, error.as_ref().ok())
6280                        {
6281                            sleep(d).await;
6282                            continue;
6283                        }
6284
6285                        dlg.finished(false);
6286
6287                        return Err(match error {
6288                            Ok(value) => common::Error::BadRequest(value),
6289                            _ => common::Error::Failure(response),
6290                        });
6291                    }
6292                    let response = {
6293                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6294                        let encoded = common::to_string(&bytes);
6295                        match serde_json::from_str(&encoded) {
6296                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6297                            Err(error) => {
6298                                dlg.response_json_decode_error(&encoded, &error);
6299                                return Err(common::Error::JsonDecodeError(
6300                                    encoded.to_string(),
6301                                    error,
6302                                ));
6303                            }
6304                        }
6305                    };
6306
6307                    dlg.finished(true);
6308                    return Ok(response);
6309                }
6310            }
6311        }
6312    }
6313
6314    ///
6315    /// Sets the *request* property to the given value.
6316    ///
6317    /// Even though the property as already been set when instantiating this call,
6318    /// we provide this method for API completeness.
6319    pub fn request(
6320        mut self,
6321        new_value: GeneratePackagesSummaryRequest,
6322    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
6323        self._request = new_value;
6324        self
6325    }
6326    /// Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
6327    ///
6328    /// Sets the *name* path property to the given value.
6329    ///
6330    /// Even though the property as already been set when instantiating this call,
6331    /// we provide this method for API completeness.
6332    pub fn name(
6333        mut self,
6334        new_value: &str,
6335    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
6336        self._name = new_value.to_string();
6337        self
6338    }
6339    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6340    /// while executing the actual API request.
6341    ///
6342    /// ````text
6343    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6344    /// ````
6345    ///
6346    /// Sets the *delegate* property to the given value.
6347    pub fn delegate(
6348        mut self,
6349        new_value: &'a mut dyn common::Delegate,
6350    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
6351        self._delegate = Some(new_value);
6352        self
6353    }
6354
6355    /// Set any additional parameter of the query string used in the request.
6356    /// It should be used to set parameters which are not yet available through their own
6357    /// setters.
6358    ///
6359    /// Please note that this method must not be used to set any of the known parameters
6360    /// which have their own setter method. If done anyway, the request will fail.
6361    ///
6362    /// # Additional Parameters
6363    ///
6364    /// * *$.xgafv* (query-string) - V1 error format.
6365    /// * *access_token* (query-string) - OAuth access token.
6366    /// * *alt* (query-string) - Data format for response.
6367    /// * *callback* (query-string) - JSONP
6368    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6369    /// * *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.
6370    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6371    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6372    /// * *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.
6373    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6374    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6375    pub fn param<T>(
6376        mut self,
6377        name: T,
6378        value: T,
6379    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
6380    where
6381        T: AsRef<str>,
6382    {
6383        self._additional_params
6384            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6385        self
6386    }
6387
6388    /// Identifies the authorization scope for the method you are building.
6389    ///
6390    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6391    /// [`Scope::CloudPlatform`].
6392    ///
6393    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6394    /// tokens for more than one scope.
6395    ///
6396    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6397    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6398    /// sufficient, a read-write scope will do as well.
6399    pub fn add_scope<St>(
6400        mut self,
6401        scope: St,
6402    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
6403    where
6404        St: AsRef<str>,
6405    {
6406        self._scopes.insert(String::from(scope.as_ref()));
6407        self
6408    }
6409    /// Identifies the authorization scope(s) for the method you are building.
6410    ///
6411    /// See [`Self::add_scope()`] for details.
6412    pub fn add_scopes<I, St>(
6413        mut self,
6414        scopes: I,
6415    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
6416    where
6417        I: IntoIterator<Item = St>,
6418        St: AsRef<str>,
6419    {
6420        self._scopes
6421            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6422        self
6423    }
6424
6425    /// Removes all scopes, and no default scope will be used either.
6426    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6427    /// for details).
6428    pub fn clear_scopes(mut self) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
6429        self._scopes.clear();
6430        self
6431    }
6432}
6433
6434/// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
6435///
6436/// A builder for the *notes.occurrences.list* method supported by a *project* resource.
6437/// It is not used directly, but through a [`ProjectMethods`] instance.
6438///
6439/// # Example
6440///
6441/// Instantiate a resource method builder
6442///
6443/// ```test_harness,no_run
6444/// # extern crate hyper;
6445/// # extern crate hyper_rustls;
6446/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6447/// # async fn dox() {
6448/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6449///
6450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6452/// #     secret,
6453/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6454/// # ).build().await.unwrap();
6455///
6456/// # let client = hyper_util::client::legacy::Client::builder(
6457/// #     hyper_util::rt::TokioExecutor::new()
6458/// # )
6459/// # .build(
6460/// #     hyper_rustls::HttpsConnectorBuilder::new()
6461/// #         .with_native_roots()
6462/// #         .unwrap()
6463/// #         .https_or_http()
6464/// #         .enable_http1()
6465/// #         .build()
6466/// # );
6467/// # let mut hub = ContainerAnalysis::new(client, auth);
6468/// // You can configure optional parameters by calling the respective setters at will, and
6469/// // execute the final call using `doit()`.
6470/// // Values shown here are possibly random and not representative !
6471/// let result = hub.projects().notes_occurrences_list("name")
6472///              .page_token("gubergren")
6473///              .page_size(-16)
6474///              .filter("est")
6475///              .doit().await;
6476/// # }
6477/// ```
6478pub struct ProjectNoteOccurrenceListCall<'a, C>
6479where
6480    C: 'a,
6481{
6482    hub: &'a ContainerAnalysis<C>,
6483    _name: String,
6484    _page_token: Option<String>,
6485    _page_size: Option<i32>,
6486    _filter: Option<String>,
6487    _delegate: Option<&'a mut dyn common::Delegate>,
6488    _additional_params: HashMap<String, String>,
6489    _scopes: BTreeSet<String>,
6490}
6491
6492impl<'a, C> common::CallBuilder for ProjectNoteOccurrenceListCall<'a, C> {}
6493
6494impl<'a, C> ProjectNoteOccurrenceListCall<'a, C>
6495where
6496    C: common::Connector,
6497{
6498    /// Perform the operation you have build so far.
6499    pub async fn doit(mut self) -> common::Result<(common::Response, ListNoteOccurrencesResponse)> {
6500        use std::borrow::Cow;
6501        use std::io::{Read, Seek};
6502
6503        use common::{url::Params, ToParts};
6504        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6505
6506        let mut dd = common::DefaultDelegate;
6507        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6508        dlg.begin(common::MethodInfo {
6509            id: "containeranalysis.projects.notes.occurrences.list",
6510            http_method: hyper::Method::GET,
6511        });
6512
6513        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
6514            if self._additional_params.contains_key(field) {
6515                dlg.finished(false);
6516                return Err(common::Error::FieldClash(field));
6517            }
6518        }
6519
6520        let mut params = Params::with_capacity(6 + self._additional_params.len());
6521        params.push("name", self._name);
6522        if let Some(value) = self._page_token.as_ref() {
6523            params.push("pageToken", value);
6524        }
6525        if let Some(value) = self._page_size.as_ref() {
6526            params.push("pageSize", value.to_string());
6527        }
6528        if let Some(value) = self._filter.as_ref() {
6529            params.push("filter", value);
6530        }
6531
6532        params.extend(self._additional_params.iter());
6533
6534        params.push("alt", "json");
6535        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/occurrences";
6536        if self._scopes.is_empty() {
6537            self._scopes
6538                .insert(Scope::CloudPlatform.as_ref().to_string());
6539        }
6540
6541        #[allow(clippy::single_element_loop)]
6542        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6543            url = params.uri_replacement(url, param_name, find_this, true);
6544        }
6545        {
6546            let to_remove = ["name"];
6547            params.remove_params(&to_remove);
6548        }
6549
6550        let url = params.parse_with_url(&url);
6551
6552        loop {
6553            let token = match self
6554                .hub
6555                .auth
6556                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6557                .await
6558            {
6559                Ok(token) => token,
6560                Err(e) => match dlg.token(e) {
6561                    Ok(token) => token,
6562                    Err(e) => {
6563                        dlg.finished(false);
6564                        return Err(common::Error::MissingToken(e));
6565                    }
6566                },
6567            };
6568            let mut req_result = {
6569                let client = &self.hub.client;
6570                dlg.pre_request();
6571                let mut req_builder = hyper::Request::builder()
6572                    .method(hyper::Method::GET)
6573                    .uri(url.as_str())
6574                    .header(USER_AGENT, self.hub._user_agent.clone());
6575
6576                if let Some(token) = token.as_ref() {
6577                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6578                }
6579
6580                let request = req_builder
6581                    .header(CONTENT_LENGTH, 0_u64)
6582                    .body(common::to_body::<String>(None));
6583
6584                client.request(request.unwrap()).await
6585            };
6586
6587            match req_result {
6588                Err(err) => {
6589                    if let common::Retry::After(d) = dlg.http_error(&err) {
6590                        sleep(d).await;
6591                        continue;
6592                    }
6593                    dlg.finished(false);
6594                    return Err(common::Error::HttpError(err));
6595                }
6596                Ok(res) => {
6597                    let (mut parts, body) = res.into_parts();
6598                    let mut body = common::Body::new(body);
6599                    if !parts.status.is_success() {
6600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6601                        let error = serde_json::from_str(&common::to_string(&bytes));
6602                        let response = common::to_response(parts, bytes.into());
6603
6604                        if let common::Retry::After(d) =
6605                            dlg.http_failure(&response, error.as_ref().ok())
6606                        {
6607                            sleep(d).await;
6608                            continue;
6609                        }
6610
6611                        dlg.finished(false);
6612
6613                        return Err(match error {
6614                            Ok(value) => common::Error::BadRequest(value),
6615                            _ => common::Error::Failure(response),
6616                        });
6617                    }
6618                    let response = {
6619                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6620                        let encoded = common::to_string(&bytes);
6621                        match serde_json::from_str(&encoded) {
6622                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6623                            Err(error) => {
6624                                dlg.response_json_decode_error(&encoded, &error);
6625                                return Err(common::Error::JsonDecodeError(
6626                                    encoded.to_string(),
6627                                    error,
6628                                ));
6629                            }
6630                        }
6631                    };
6632
6633                    dlg.finished(true);
6634                    return Ok(response);
6635                }
6636            }
6637        }
6638    }
6639
6640    /// Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
6641    ///
6642    /// Sets the *name* path property to the given value.
6643    ///
6644    /// Even though the property as already been set when instantiating this call,
6645    /// we provide this method for API completeness.
6646    pub fn name(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
6647        self._name = new_value.to_string();
6648        self
6649    }
6650    /// Token to provide to skip to a particular spot in the list.
6651    ///
6652    /// Sets the *page token* query property to the given value.
6653    pub fn page_token(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
6654        self._page_token = Some(new_value.to_string());
6655        self
6656    }
6657    /// Number of occurrences to return in the list.
6658    ///
6659    /// Sets the *page size* query property to the given value.
6660    pub fn page_size(mut self, new_value: i32) -> ProjectNoteOccurrenceListCall<'a, C> {
6661        self._page_size = Some(new_value);
6662        self
6663    }
6664    /// The filter expression.
6665    ///
6666    /// Sets the *filter* query property to the given value.
6667    pub fn filter(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
6668        self._filter = Some(new_value.to_string());
6669        self
6670    }
6671    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6672    /// while executing the actual API request.
6673    ///
6674    /// ````text
6675    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6676    /// ````
6677    ///
6678    /// Sets the *delegate* property to the given value.
6679    pub fn delegate(
6680        mut self,
6681        new_value: &'a mut dyn common::Delegate,
6682    ) -> ProjectNoteOccurrenceListCall<'a, C> {
6683        self._delegate = Some(new_value);
6684        self
6685    }
6686
6687    /// Set any additional parameter of the query string used in the request.
6688    /// It should be used to set parameters which are not yet available through their own
6689    /// setters.
6690    ///
6691    /// Please note that this method must not be used to set any of the known parameters
6692    /// which have their own setter method. If done anyway, the request will fail.
6693    ///
6694    /// # Additional Parameters
6695    ///
6696    /// * *$.xgafv* (query-string) - V1 error format.
6697    /// * *access_token* (query-string) - OAuth access token.
6698    /// * *alt* (query-string) - Data format for response.
6699    /// * *callback* (query-string) - JSONP
6700    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6701    /// * *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.
6702    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6703    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6704    /// * *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.
6705    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6706    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6707    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteOccurrenceListCall<'a, C>
6708    where
6709        T: AsRef<str>,
6710    {
6711        self._additional_params
6712            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6713        self
6714    }
6715
6716    /// Identifies the authorization scope for the method you are building.
6717    ///
6718    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6719    /// [`Scope::CloudPlatform`].
6720    ///
6721    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6722    /// tokens for more than one scope.
6723    ///
6724    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6725    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6726    /// sufficient, a read-write scope will do as well.
6727    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteOccurrenceListCall<'a, C>
6728    where
6729        St: AsRef<str>,
6730    {
6731        self._scopes.insert(String::from(scope.as_ref()));
6732        self
6733    }
6734    /// Identifies the authorization scope(s) for the method you are building.
6735    ///
6736    /// See [`Self::add_scope()`] for details.
6737    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteOccurrenceListCall<'a, C>
6738    where
6739        I: IntoIterator<Item = St>,
6740        St: AsRef<str>,
6741    {
6742        self._scopes
6743            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6744        self
6745    }
6746
6747    /// Removes all scopes, and no default scope will be used either.
6748    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6749    /// for details).
6750    pub fn clear_scopes(mut self) -> ProjectNoteOccurrenceListCall<'a, C> {
6751        self._scopes.clear();
6752        self
6753    }
6754}
6755
6756/// Creates new notes in batch.
6757///
6758/// A builder for the *notes.batchCreate* method supported by a *project* resource.
6759/// It is not used directly, but through a [`ProjectMethods`] instance.
6760///
6761/// # Example
6762///
6763/// Instantiate a resource method builder
6764///
6765/// ```test_harness,no_run
6766/// # extern crate hyper;
6767/// # extern crate hyper_rustls;
6768/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6769/// use containeranalysis1_beta1::api::BatchCreateNotesRequest;
6770/// # async fn dox() {
6771/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6772///
6773/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6774/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6775/// #     secret,
6776/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6777/// # ).build().await.unwrap();
6778///
6779/// # let client = hyper_util::client::legacy::Client::builder(
6780/// #     hyper_util::rt::TokioExecutor::new()
6781/// # )
6782/// # .build(
6783/// #     hyper_rustls::HttpsConnectorBuilder::new()
6784/// #         .with_native_roots()
6785/// #         .unwrap()
6786/// #         .https_or_http()
6787/// #         .enable_http1()
6788/// #         .build()
6789/// # );
6790/// # let mut hub = ContainerAnalysis::new(client, auth);
6791/// // As the method needs a request, you would usually fill it with the desired information
6792/// // into the respective structure. Some of the parts shown here might not be applicable !
6793/// // Values shown here are possibly random and not representative !
6794/// let mut req = BatchCreateNotesRequest::default();
6795///
6796/// // You can configure optional parameters by calling the respective setters at will, and
6797/// // execute the final call using `doit()`.
6798/// // Values shown here are possibly random and not representative !
6799/// let result = hub.projects().notes_batch_create(req, "parent")
6800///              .doit().await;
6801/// # }
6802/// ```
6803pub struct ProjectNoteBatchCreateCall<'a, C>
6804where
6805    C: 'a,
6806{
6807    hub: &'a ContainerAnalysis<C>,
6808    _request: BatchCreateNotesRequest,
6809    _parent: String,
6810    _delegate: Option<&'a mut dyn common::Delegate>,
6811    _additional_params: HashMap<String, String>,
6812    _scopes: BTreeSet<String>,
6813}
6814
6815impl<'a, C> common::CallBuilder for ProjectNoteBatchCreateCall<'a, C> {}
6816
6817impl<'a, C> ProjectNoteBatchCreateCall<'a, C>
6818where
6819    C: common::Connector,
6820{
6821    /// Perform the operation you have build so far.
6822    pub async fn doit(mut self) -> common::Result<(common::Response, BatchCreateNotesResponse)> {
6823        use std::borrow::Cow;
6824        use std::io::{Read, Seek};
6825
6826        use common::{url::Params, ToParts};
6827        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6828
6829        let mut dd = common::DefaultDelegate;
6830        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6831        dlg.begin(common::MethodInfo {
6832            id: "containeranalysis.projects.notes.batchCreate",
6833            http_method: hyper::Method::POST,
6834        });
6835
6836        for &field in ["alt", "parent"].iter() {
6837            if self._additional_params.contains_key(field) {
6838                dlg.finished(false);
6839                return Err(common::Error::FieldClash(field));
6840            }
6841        }
6842
6843        let mut params = Params::with_capacity(4 + self._additional_params.len());
6844        params.push("parent", self._parent);
6845
6846        params.extend(self._additional_params.iter());
6847
6848        params.push("alt", "json");
6849        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes:batchCreate";
6850        if self._scopes.is_empty() {
6851            self._scopes
6852                .insert(Scope::CloudPlatform.as_ref().to_string());
6853        }
6854
6855        #[allow(clippy::single_element_loop)]
6856        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6857            url = params.uri_replacement(url, param_name, find_this, true);
6858        }
6859        {
6860            let to_remove = ["parent"];
6861            params.remove_params(&to_remove);
6862        }
6863
6864        let url = params.parse_with_url(&url);
6865
6866        let mut json_mime_type = mime::APPLICATION_JSON;
6867        let mut request_value_reader = {
6868            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6869            common::remove_json_null_values(&mut value);
6870            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6871            serde_json::to_writer(&mut dst, &value).unwrap();
6872            dst
6873        };
6874        let request_size = request_value_reader
6875            .seek(std::io::SeekFrom::End(0))
6876            .unwrap();
6877        request_value_reader
6878            .seek(std::io::SeekFrom::Start(0))
6879            .unwrap();
6880
6881        loop {
6882            let token = match self
6883                .hub
6884                .auth
6885                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6886                .await
6887            {
6888                Ok(token) => token,
6889                Err(e) => match dlg.token(e) {
6890                    Ok(token) => token,
6891                    Err(e) => {
6892                        dlg.finished(false);
6893                        return Err(common::Error::MissingToken(e));
6894                    }
6895                },
6896            };
6897            request_value_reader
6898                .seek(std::io::SeekFrom::Start(0))
6899                .unwrap();
6900            let mut req_result = {
6901                let client = &self.hub.client;
6902                dlg.pre_request();
6903                let mut req_builder = hyper::Request::builder()
6904                    .method(hyper::Method::POST)
6905                    .uri(url.as_str())
6906                    .header(USER_AGENT, self.hub._user_agent.clone());
6907
6908                if let Some(token) = token.as_ref() {
6909                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6910                }
6911
6912                let request = req_builder
6913                    .header(CONTENT_TYPE, json_mime_type.to_string())
6914                    .header(CONTENT_LENGTH, request_size as u64)
6915                    .body(common::to_body(
6916                        request_value_reader.get_ref().clone().into(),
6917                    ));
6918
6919                client.request(request.unwrap()).await
6920            };
6921
6922            match req_result {
6923                Err(err) => {
6924                    if let common::Retry::After(d) = dlg.http_error(&err) {
6925                        sleep(d).await;
6926                        continue;
6927                    }
6928                    dlg.finished(false);
6929                    return Err(common::Error::HttpError(err));
6930                }
6931                Ok(res) => {
6932                    let (mut parts, body) = res.into_parts();
6933                    let mut body = common::Body::new(body);
6934                    if !parts.status.is_success() {
6935                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6936                        let error = serde_json::from_str(&common::to_string(&bytes));
6937                        let response = common::to_response(parts, bytes.into());
6938
6939                        if let common::Retry::After(d) =
6940                            dlg.http_failure(&response, error.as_ref().ok())
6941                        {
6942                            sleep(d).await;
6943                            continue;
6944                        }
6945
6946                        dlg.finished(false);
6947
6948                        return Err(match error {
6949                            Ok(value) => common::Error::BadRequest(value),
6950                            _ => common::Error::Failure(response),
6951                        });
6952                    }
6953                    let response = {
6954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6955                        let encoded = common::to_string(&bytes);
6956                        match serde_json::from_str(&encoded) {
6957                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6958                            Err(error) => {
6959                                dlg.response_json_decode_error(&encoded, &error);
6960                                return Err(common::Error::JsonDecodeError(
6961                                    encoded.to_string(),
6962                                    error,
6963                                ));
6964                            }
6965                        }
6966                    };
6967
6968                    dlg.finished(true);
6969                    return Ok(response);
6970                }
6971            }
6972        }
6973    }
6974
6975    ///
6976    /// Sets the *request* property to the given value.
6977    ///
6978    /// Even though the property as already been set when instantiating this call,
6979    /// we provide this method for API completeness.
6980    pub fn request(
6981        mut self,
6982        new_value: BatchCreateNotesRequest,
6983    ) -> ProjectNoteBatchCreateCall<'a, C> {
6984        self._request = new_value;
6985        self
6986    }
6987    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
6988    ///
6989    /// Sets the *parent* path property to the given value.
6990    ///
6991    /// Even though the property as already been set when instantiating this call,
6992    /// we provide this method for API completeness.
6993    pub fn parent(mut self, new_value: &str) -> ProjectNoteBatchCreateCall<'a, C> {
6994        self._parent = new_value.to_string();
6995        self
6996    }
6997    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6998    /// while executing the actual API request.
6999    ///
7000    /// ````text
7001    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7002    /// ````
7003    ///
7004    /// Sets the *delegate* property to the given value.
7005    pub fn delegate(
7006        mut self,
7007        new_value: &'a mut dyn common::Delegate,
7008    ) -> ProjectNoteBatchCreateCall<'a, C> {
7009        self._delegate = Some(new_value);
7010        self
7011    }
7012
7013    /// Set any additional parameter of the query string used in the request.
7014    /// It should be used to set parameters which are not yet available through their own
7015    /// setters.
7016    ///
7017    /// Please note that this method must not be used to set any of the known parameters
7018    /// which have their own setter method. If done anyway, the request will fail.
7019    ///
7020    /// # Additional Parameters
7021    ///
7022    /// * *$.xgafv* (query-string) - V1 error format.
7023    /// * *access_token* (query-string) - OAuth access token.
7024    /// * *alt* (query-string) - Data format for response.
7025    /// * *callback* (query-string) - JSONP
7026    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7027    /// * *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.
7028    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7029    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7030    /// * *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.
7031    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7032    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7033    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteBatchCreateCall<'a, C>
7034    where
7035        T: AsRef<str>,
7036    {
7037        self._additional_params
7038            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7039        self
7040    }
7041
7042    /// Identifies the authorization scope for the method you are building.
7043    ///
7044    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7045    /// [`Scope::CloudPlatform`].
7046    ///
7047    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7048    /// tokens for more than one scope.
7049    ///
7050    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7051    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7052    /// sufficient, a read-write scope will do as well.
7053    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteBatchCreateCall<'a, C>
7054    where
7055        St: AsRef<str>,
7056    {
7057        self._scopes.insert(String::from(scope.as_ref()));
7058        self
7059    }
7060    /// Identifies the authorization scope(s) for the method you are building.
7061    ///
7062    /// See [`Self::add_scope()`] for details.
7063    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteBatchCreateCall<'a, C>
7064    where
7065        I: IntoIterator<Item = St>,
7066        St: AsRef<str>,
7067    {
7068        self._scopes
7069            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7070        self
7071    }
7072
7073    /// Removes all scopes, and no default scope will be used either.
7074    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7075    /// for details).
7076    pub fn clear_scopes(mut self) -> ProjectNoteBatchCreateCall<'a, C> {
7077        self._scopes.clear();
7078        self
7079    }
7080}
7081
7082/// Creates a new note.
7083///
7084/// A builder for the *notes.create* method supported by a *project* resource.
7085/// It is not used directly, but through a [`ProjectMethods`] instance.
7086///
7087/// # Example
7088///
7089/// Instantiate a resource method builder
7090///
7091/// ```test_harness,no_run
7092/// # extern crate hyper;
7093/// # extern crate hyper_rustls;
7094/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7095/// use containeranalysis1_beta1::api::Note;
7096/// # async fn dox() {
7097/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7098///
7099/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7100/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7101/// #     secret,
7102/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7103/// # ).build().await.unwrap();
7104///
7105/// # let client = hyper_util::client::legacy::Client::builder(
7106/// #     hyper_util::rt::TokioExecutor::new()
7107/// # )
7108/// # .build(
7109/// #     hyper_rustls::HttpsConnectorBuilder::new()
7110/// #         .with_native_roots()
7111/// #         .unwrap()
7112/// #         .https_or_http()
7113/// #         .enable_http1()
7114/// #         .build()
7115/// # );
7116/// # let mut hub = ContainerAnalysis::new(client, auth);
7117/// // As the method needs a request, you would usually fill it with the desired information
7118/// // into the respective structure. Some of the parts shown here might not be applicable !
7119/// // Values shown here are possibly random and not representative !
7120/// let mut req = Note::default();
7121///
7122/// // You can configure optional parameters by calling the respective setters at will, and
7123/// // execute the final call using `doit()`.
7124/// // Values shown here are possibly random and not representative !
7125/// let result = hub.projects().notes_create(req, "parent")
7126///              .note_id("est")
7127///              .doit().await;
7128/// # }
7129/// ```
7130pub struct ProjectNoteCreateCall<'a, C>
7131where
7132    C: 'a,
7133{
7134    hub: &'a ContainerAnalysis<C>,
7135    _request: Note,
7136    _parent: String,
7137    _note_id: Option<String>,
7138    _delegate: Option<&'a mut dyn common::Delegate>,
7139    _additional_params: HashMap<String, String>,
7140    _scopes: BTreeSet<String>,
7141}
7142
7143impl<'a, C> common::CallBuilder for ProjectNoteCreateCall<'a, C> {}
7144
7145impl<'a, C> ProjectNoteCreateCall<'a, C>
7146where
7147    C: common::Connector,
7148{
7149    /// Perform the operation you have build so far.
7150    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
7151        use std::borrow::Cow;
7152        use std::io::{Read, Seek};
7153
7154        use common::{url::Params, ToParts};
7155        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7156
7157        let mut dd = common::DefaultDelegate;
7158        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7159        dlg.begin(common::MethodInfo {
7160            id: "containeranalysis.projects.notes.create",
7161            http_method: hyper::Method::POST,
7162        });
7163
7164        for &field in ["alt", "parent", "noteId"].iter() {
7165            if self._additional_params.contains_key(field) {
7166                dlg.finished(false);
7167                return Err(common::Error::FieldClash(field));
7168            }
7169        }
7170
7171        let mut params = Params::with_capacity(5 + self._additional_params.len());
7172        params.push("parent", self._parent);
7173        if let Some(value) = self._note_id.as_ref() {
7174            params.push("noteId", value);
7175        }
7176
7177        params.extend(self._additional_params.iter());
7178
7179        params.push("alt", "json");
7180        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
7181        if self._scopes.is_empty() {
7182            self._scopes
7183                .insert(Scope::CloudPlatform.as_ref().to_string());
7184        }
7185
7186        #[allow(clippy::single_element_loop)]
7187        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7188            url = params.uri_replacement(url, param_name, find_this, true);
7189        }
7190        {
7191            let to_remove = ["parent"];
7192            params.remove_params(&to_remove);
7193        }
7194
7195        let url = params.parse_with_url(&url);
7196
7197        let mut json_mime_type = mime::APPLICATION_JSON;
7198        let mut request_value_reader = {
7199            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7200            common::remove_json_null_values(&mut value);
7201            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7202            serde_json::to_writer(&mut dst, &value).unwrap();
7203            dst
7204        };
7205        let request_size = request_value_reader
7206            .seek(std::io::SeekFrom::End(0))
7207            .unwrap();
7208        request_value_reader
7209            .seek(std::io::SeekFrom::Start(0))
7210            .unwrap();
7211
7212        loop {
7213            let token = match self
7214                .hub
7215                .auth
7216                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7217                .await
7218            {
7219                Ok(token) => token,
7220                Err(e) => match dlg.token(e) {
7221                    Ok(token) => token,
7222                    Err(e) => {
7223                        dlg.finished(false);
7224                        return Err(common::Error::MissingToken(e));
7225                    }
7226                },
7227            };
7228            request_value_reader
7229                .seek(std::io::SeekFrom::Start(0))
7230                .unwrap();
7231            let mut req_result = {
7232                let client = &self.hub.client;
7233                dlg.pre_request();
7234                let mut req_builder = hyper::Request::builder()
7235                    .method(hyper::Method::POST)
7236                    .uri(url.as_str())
7237                    .header(USER_AGENT, self.hub._user_agent.clone());
7238
7239                if let Some(token) = token.as_ref() {
7240                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7241                }
7242
7243                let request = req_builder
7244                    .header(CONTENT_TYPE, json_mime_type.to_string())
7245                    .header(CONTENT_LENGTH, request_size as u64)
7246                    .body(common::to_body(
7247                        request_value_reader.get_ref().clone().into(),
7248                    ));
7249
7250                client.request(request.unwrap()).await
7251            };
7252
7253            match req_result {
7254                Err(err) => {
7255                    if let common::Retry::After(d) = dlg.http_error(&err) {
7256                        sleep(d).await;
7257                        continue;
7258                    }
7259                    dlg.finished(false);
7260                    return Err(common::Error::HttpError(err));
7261                }
7262                Ok(res) => {
7263                    let (mut parts, body) = res.into_parts();
7264                    let mut body = common::Body::new(body);
7265                    if !parts.status.is_success() {
7266                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7267                        let error = serde_json::from_str(&common::to_string(&bytes));
7268                        let response = common::to_response(parts, bytes.into());
7269
7270                        if let common::Retry::After(d) =
7271                            dlg.http_failure(&response, error.as_ref().ok())
7272                        {
7273                            sleep(d).await;
7274                            continue;
7275                        }
7276
7277                        dlg.finished(false);
7278
7279                        return Err(match error {
7280                            Ok(value) => common::Error::BadRequest(value),
7281                            _ => common::Error::Failure(response),
7282                        });
7283                    }
7284                    let response = {
7285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7286                        let encoded = common::to_string(&bytes);
7287                        match serde_json::from_str(&encoded) {
7288                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7289                            Err(error) => {
7290                                dlg.response_json_decode_error(&encoded, &error);
7291                                return Err(common::Error::JsonDecodeError(
7292                                    encoded.to_string(),
7293                                    error,
7294                                ));
7295                            }
7296                        }
7297                    };
7298
7299                    dlg.finished(true);
7300                    return Ok(response);
7301                }
7302            }
7303        }
7304    }
7305
7306    ///
7307    /// Sets the *request* property to the given value.
7308    ///
7309    /// Even though the property as already been set when instantiating this call,
7310    /// we provide this method for API completeness.
7311    pub fn request(mut self, new_value: Note) -> ProjectNoteCreateCall<'a, C> {
7312        self._request = new_value;
7313        self
7314    }
7315    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
7316    ///
7317    /// Sets the *parent* path property to the given value.
7318    ///
7319    /// Even though the property as already been set when instantiating this call,
7320    /// we provide this method for API completeness.
7321    pub fn parent(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C> {
7322        self._parent = new_value.to_string();
7323        self
7324    }
7325    /// Required. The ID to use for this note.
7326    ///
7327    /// Sets the *note id* query property to the given value.
7328    pub fn note_id(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C> {
7329        self._note_id = Some(new_value.to_string());
7330        self
7331    }
7332    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7333    /// while executing the actual API request.
7334    ///
7335    /// ````text
7336    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7337    /// ````
7338    ///
7339    /// Sets the *delegate* property to the given value.
7340    pub fn delegate(
7341        mut self,
7342        new_value: &'a mut dyn common::Delegate,
7343    ) -> ProjectNoteCreateCall<'a, C> {
7344        self._delegate = Some(new_value);
7345        self
7346    }
7347
7348    /// Set any additional parameter of the query string used in the request.
7349    /// It should be used to set parameters which are not yet available through their own
7350    /// setters.
7351    ///
7352    /// Please note that this method must not be used to set any of the known parameters
7353    /// which have their own setter method. If done anyway, the request will fail.
7354    ///
7355    /// # Additional Parameters
7356    ///
7357    /// * *$.xgafv* (query-string) - V1 error format.
7358    /// * *access_token* (query-string) - OAuth access token.
7359    /// * *alt* (query-string) - Data format for response.
7360    /// * *callback* (query-string) - JSONP
7361    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7362    /// * *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.
7363    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7364    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7365    /// * *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.
7366    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7367    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7368    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteCreateCall<'a, C>
7369    where
7370        T: AsRef<str>,
7371    {
7372        self._additional_params
7373            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7374        self
7375    }
7376
7377    /// Identifies the authorization scope for the method you are building.
7378    ///
7379    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7380    /// [`Scope::CloudPlatform`].
7381    ///
7382    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7383    /// tokens for more than one scope.
7384    ///
7385    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7386    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7387    /// sufficient, a read-write scope will do as well.
7388    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteCreateCall<'a, C>
7389    where
7390        St: AsRef<str>,
7391    {
7392        self._scopes.insert(String::from(scope.as_ref()));
7393        self
7394    }
7395    /// Identifies the authorization scope(s) for the method you are building.
7396    ///
7397    /// See [`Self::add_scope()`] for details.
7398    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteCreateCall<'a, C>
7399    where
7400        I: IntoIterator<Item = St>,
7401        St: AsRef<str>,
7402    {
7403        self._scopes
7404            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7405        self
7406    }
7407
7408    /// Removes all scopes, and no default scope will be used either.
7409    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7410    /// for details).
7411    pub fn clear_scopes(mut self) -> ProjectNoteCreateCall<'a, C> {
7412        self._scopes.clear();
7413        self
7414    }
7415}
7416
7417/// Deletes the specified note.
7418///
7419/// A builder for the *notes.delete* method supported by a *project* resource.
7420/// It is not used directly, but through a [`ProjectMethods`] instance.
7421///
7422/// # Example
7423///
7424/// Instantiate a resource method builder
7425///
7426/// ```test_harness,no_run
7427/// # extern crate hyper;
7428/// # extern crate hyper_rustls;
7429/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7430/// # async fn dox() {
7431/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7432///
7433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7434/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7435/// #     secret,
7436/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7437/// # ).build().await.unwrap();
7438///
7439/// # let client = hyper_util::client::legacy::Client::builder(
7440/// #     hyper_util::rt::TokioExecutor::new()
7441/// # )
7442/// # .build(
7443/// #     hyper_rustls::HttpsConnectorBuilder::new()
7444/// #         .with_native_roots()
7445/// #         .unwrap()
7446/// #         .https_or_http()
7447/// #         .enable_http1()
7448/// #         .build()
7449/// # );
7450/// # let mut hub = ContainerAnalysis::new(client, auth);
7451/// // You can configure optional parameters by calling the respective setters at will, and
7452/// // execute the final call using `doit()`.
7453/// // Values shown here are possibly random and not representative !
7454/// let result = hub.projects().notes_delete("name")
7455///              .doit().await;
7456/// # }
7457/// ```
7458pub struct ProjectNoteDeleteCall<'a, C>
7459where
7460    C: 'a,
7461{
7462    hub: &'a ContainerAnalysis<C>,
7463    _name: String,
7464    _delegate: Option<&'a mut dyn common::Delegate>,
7465    _additional_params: HashMap<String, String>,
7466    _scopes: BTreeSet<String>,
7467}
7468
7469impl<'a, C> common::CallBuilder for ProjectNoteDeleteCall<'a, C> {}
7470
7471impl<'a, C> ProjectNoteDeleteCall<'a, C>
7472where
7473    C: common::Connector,
7474{
7475    /// Perform the operation you have build so far.
7476    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7477        use std::borrow::Cow;
7478        use std::io::{Read, Seek};
7479
7480        use common::{url::Params, ToParts};
7481        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7482
7483        let mut dd = common::DefaultDelegate;
7484        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7485        dlg.begin(common::MethodInfo {
7486            id: "containeranalysis.projects.notes.delete",
7487            http_method: hyper::Method::DELETE,
7488        });
7489
7490        for &field in ["alt", "name"].iter() {
7491            if self._additional_params.contains_key(field) {
7492                dlg.finished(false);
7493                return Err(common::Error::FieldClash(field));
7494            }
7495        }
7496
7497        let mut params = Params::with_capacity(3 + self._additional_params.len());
7498        params.push("name", self._name);
7499
7500        params.extend(self._additional_params.iter());
7501
7502        params.push("alt", "json");
7503        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7504        if self._scopes.is_empty() {
7505            self._scopes
7506                .insert(Scope::CloudPlatform.as_ref().to_string());
7507        }
7508
7509        #[allow(clippy::single_element_loop)]
7510        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7511            url = params.uri_replacement(url, param_name, find_this, true);
7512        }
7513        {
7514            let to_remove = ["name"];
7515            params.remove_params(&to_remove);
7516        }
7517
7518        let url = params.parse_with_url(&url);
7519
7520        loop {
7521            let token = match self
7522                .hub
7523                .auth
7524                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7525                .await
7526            {
7527                Ok(token) => token,
7528                Err(e) => match dlg.token(e) {
7529                    Ok(token) => token,
7530                    Err(e) => {
7531                        dlg.finished(false);
7532                        return Err(common::Error::MissingToken(e));
7533                    }
7534                },
7535            };
7536            let mut req_result = {
7537                let client = &self.hub.client;
7538                dlg.pre_request();
7539                let mut req_builder = hyper::Request::builder()
7540                    .method(hyper::Method::DELETE)
7541                    .uri(url.as_str())
7542                    .header(USER_AGENT, self.hub._user_agent.clone());
7543
7544                if let Some(token) = token.as_ref() {
7545                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7546                }
7547
7548                let request = req_builder
7549                    .header(CONTENT_LENGTH, 0_u64)
7550                    .body(common::to_body::<String>(None));
7551
7552                client.request(request.unwrap()).await
7553            };
7554
7555            match req_result {
7556                Err(err) => {
7557                    if let common::Retry::After(d) = dlg.http_error(&err) {
7558                        sleep(d).await;
7559                        continue;
7560                    }
7561                    dlg.finished(false);
7562                    return Err(common::Error::HttpError(err));
7563                }
7564                Ok(res) => {
7565                    let (mut parts, body) = res.into_parts();
7566                    let mut body = common::Body::new(body);
7567                    if !parts.status.is_success() {
7568                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7569                        let error = serde_json::from_str(&common::to_string(&bytes));
7570                        let response = common::to_response(parts, bytes.into());
7571
7572                        if let common::Retry::After(d) =
7573                            dlg.http_failure(&response, error.as_ref().ok())
7574                        {
7575                            sleep(d).await;
7576                            continue;
7577                        }
7578
7579                        dlg.finished(false);
7580
7581                        return Err(match error {
7582                            Ok(value) => common::Error::BadRequest(value),
7583                            _ => common::Error::Failure(response),
7584                        });
7585                    }
7586                    let response = {
7587                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7588                        let encoded = common::to_string(&bytes);
7589                        match serde_json::from_str(&encoded) {
7590                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7591                            Err(error) => {
7592                                dlg.response_json_decode_error(&encoded, &error);
7593                                return Err(common::Error::JsonDecodeError(
7594                                    encoded.to_string(),
7595                                    error,
7596                                ));
7597                            }
7598                        }
7599                    };
7600
7601                    dlg.finished(true);
7602                    return Ok(response);
7603                }
7604            }
7605        }
7606    }
7607
7608    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
7609    ///
7610    /// Sets the *name* path property to the given value.
7611    ///
7612    /// Even though the property as already been set when instantiating this call,
7613    /// we provide this method for API completeness.
7614    pub fn name(mut self, new_value: &str) -> ProjectNoteDeleteCall<'a, C> {
7615        self._name = new_value.to_string();
7616        self
7617    }
7618    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7619    /// while executing the actual API request.
7620    ///
7621    /// ````text
7622    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7623    /// ````
7624    ///
7625    /// Sets the *delegate* property to the given value.
7626    pub fn delegate(
7627        mut self,
7628        new_value: &'a mut dyn common::Delegate,
7629    ) -> ProjectNoteDeleteCall<'a, C> {
7630        self._delegate = Some(new_value);
7631        self
7632    }
7633
7634    /// Set any additional parameter of the query string used in the request.
7635    /// It should be used to set parameters which are not yet available through their own
7636    /// setters.
7637    ///
7638    /// Please note that this method must not be used to set any of the known parameters
7639    /// which have their own setter method. If done anyway, the request will fail.
7640    ///
7641    /// # Additional Parameters
7642    ///
7643    /// * *$.xgafv* (query-string) - V1 error format.
7644    /// * *access_token* (query-string) - OAuth access token.
7645    /// * *alt* (query-string) - Data format for response.
7646    /// * *callback* (query-string) - JSONP
7647    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7648    /// * *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.
7649    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7650    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7651    /// * *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.
7652    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7653    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7654    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteDeleteCall<'a, C>
7655    where
7656        T: AsRef<str>,
7657    {
7658        self._additional_params
7659            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7660        self
7661    }
7662
7663    /// Identifies the authorization scope for the method you are building.
7664    ///
7665    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7666    /// [`Scope::CloudPlatform`].
7667    ///
7668    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7669    /// tokens for more than one scope.
7670    ///
7671    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7672    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7673    /// sufficient, a read-write scope will do as well.
7674    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteDeleteCall<'a, C>
7675    where
7676        St: AsRef<str>,
7677    {
7678        self._scopes.insert(String::from(scope.as_ref()));
7679        self
7680    }
7681    /// Identifies the authorization scope(s) for the method you are building.
7682    ///
7683    /// See [`Self::add_scope()`] for details.
7684    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteDeleteCall<'a, C>
7685    where
7686        I: IntoIterator<Item = St>,
7687        St: AsRef<str>,
7688    {
7689        self._scopes
7690            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7691        self
7692    }
7693
7694    /// Removes all scopes, and no default scope will be used either.
7695    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7696    /// for details).
7697    pub fn clear_scopes(mut self) -> ProjectNoteDeleteCall<'a, C> {
7698        self._scopes.clear();
7699        self
7700    }
7701}
7702
7703/// Gets the specified note.
7704///
7705/// A builder for the *notes.get* method supported by a *project* resource.
7706/// It is not used directly, but through a [`ProjectMethods`] instance.
7707///
7708/// # Example
7709///
7710/// Instantiate a resource method builder
7711///
7712/// ```test_harness,no_run
7713/// # extern crate hyper;
7714/// # extern crate hyper_rustls;
7715/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7716/// # async fn dox() {
7717/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7718///
7719/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7721/// #     secret,
7722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7723/// # ).build().await.unwrap();
7724///
7725/// # let client = hyper_util::client::legacy::Client::builder(
7726/// #     hyper_util::rt::TokioExecutor::new()
7727/// # )
7728/// # .build(
7729/// #     hyper_rustls::HttpsConnectorBuilder::new()
7730/// #         .with_native_roots()
7731/// #         .unwrap()
7732/// #         .https_or_http()
7733/// #         .enable_http1()
7734/// #         .build()
7735/// # );
7736/// # let mut hub = ContainerAnalysis::new(client, auth);
7737/// // You can configure optional parameters by calling the respective setters at will, and
7738/// // execute the final call using `doit()`.
7739/// // Values shown here are possibly random and not representative !
7740/// let result = hub.projects().notes_get("name")
7741///              .doit().await;
7742/// # }
7743/// ```
7744pub struct ProjectNoteGetCall<'a, C>
7745where
7746    C: 'a,
7747{
7748    hub: &'a ContainerAnalysis<C>,
7749    _name: String,
7750    _delegate: Option<&'a mut dyn common::Delegate>,
7751    _additional_params: HashMap<String, String>,
7752    _scopes: BTreeSet<String>,
7753}
7754
7755impl<'a, C> common::CallBuilder for ProjectNoteGetCall<'a, C> {}
7756
7757impl<'a, C> ProjectNoteGetCall<'a, C>
7758where
7759    C: common::Connector,
7760{
7761    /// Perform the operation you have build so far.
7762    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
7763        use std::borrow::Cow;
7764        use std::io::{Read, Seek};
7765
7766        use common::{url::Params, ToParts};
7767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7768
7769        let mut dd = common::DefaultDelegate;
7770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7771        dlg.begin(common::MethodInfo {
7772            id: "containeranalysis.projects.notes.get",
7773            http_method: hyper::Method::GET,
7774        });
7775
7776        for &field in ["alt", "name"].iter() {
7777            if self._additional_params.contains_key(field) {
7778                dlg.finished(false);
7779                return Err(common::Error::FieldClash(field));
7780            }
7781        }
7782
7783        let mut params = Params::with_capacity(3 + self._additional_params.len());
7784        params.push("name", self._name);
7785
7786        params.extend(self._additional_params.iter());
7787
7788        params.push("alt", "json");
7789        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7790        if self._scopes.is_empty() {
7791            self._scopes
7792                .insert(Scope::CloudPlatform.as_ref().to_string());
7793        }
7794
7795        #[allow(clippy::single_element_loop)]
7796        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7797            url = params.uri_replacement(url, param_name, find_this, true);
7798        }
7799        {
7800            let to_remove = ["name"];
7801            params.remove_params(&to_remove);
7802        }
7803
7804        let url = params.parse_with_url(&url);
7805
7806        loop {
7807            let token = match self
7808                .hub
7809                .auth
7810                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7811                .await
7812            {
7813                Ok(token) => token,
7814                Err(e) => match dlg.token(e) {
7815                    Ok(token) => token,
7816                    Err(e) => {
7817                        dlg.finished(false);
7818                        return Err(common::Error::MissingToken(e));
7819                    }
7820                },
7821            };
7822            let mut req_result = {
7823                let client = &self.hub.client;
7824                dlg.pre_request();
7825                let mut req_builder = hyper::Request::builder()
7826                    .method(hyper::Method::GET)
7827                    .uri(url.as_str())
7828                    .header(USER_AGENT, self.hub._user_agent.clone());
7829
7830                if let Some(token) = token.as_ref() {
7831                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7832                }
7833
7834                let request = req_builder
7835                    .header(CONTENT_LENGTH, 0_u64)
7836                    .body(common::to_body::<String>(None));
7837
7838                client.request(request.unwrap()).await
7839            };
7840
7841            match req_result {
7842                Err(err) => {
7843                    if let common::Retry::After(d) = dlg.http_error(&err) {
7844                        sleep(d).await;
7845                        continue;
7846                    }
7847                    dlg.finished(false);
7848                    return Err(common::Error::HttpError(err));
7849                }
7850                Ok(res) => {
7851                    let (mut parts, body) = res.into_parts();
7852                    let mut body = common::Body::new(body);
7853                    if !parts.status.is_success() {
7854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7855                        let error = serde_json::from_str(&common::to_string(&bytes));
7856                        let response = common::to_response(parts, bytes.into());
7857
7858                        if let common::Retry::After(d) =
7859                            dlg.http_failure(&response, error.as_ref().ok())
7860                        {
7861                            sleep(d).await;
7862                            continue;
7863                        }
7864
7865                        dlg.finished(false);
7866
7867                        return Err(match error {
7868                            Ok(value) => common::Error::BadRequest(value),
7869                            _ => common::Error::Failure(response),
7870                        });
7871                    }
7872                    let response = {
7873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7874                        let encoded = common::to_string(&bytes);
7875                        match serde_json::from_str(&encoded) {
7876                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7877                            Err(error) => {
7878                                dlg.response_json_decode_error(&encoded, &error);
7879                                return Err(common::Error::JsonDecodeError(
7880                                    encoded.to_string(),
7881                                    error,
7882                                ));
7883                            }
7884                        }
7885                    };
7886
7887                    dlg.finished(true);
7888                    return Ok(response);
7889                }
7890            }
7891        }
7892    }
7893
7894    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
7895    ///
7896    /// Sets the *name* path property to the given value.
7897    ///
7898    /// Even though the property as already been set when instantiating this call,
7899    /// we provide this method for API completeness.
7900    pub fn name(mut self, new_value: &str) -> ProjectNoteGetCall<'a, C> {
7901        self._name = new_value.to_string();
7902        self
7903    }
7904    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7905    /// while executing the actual API request.
7906    ///
7907    /// ````text
7908    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7909    /// ````
7910    ///
7911    /// Sets the *delegate* property to the given value.
7912    pub fn delegate(
7913        mut self,
7914        new_value: &'a mut dyn common::Delegate,
7915    ) -> ProjectNoteGetCall<'a, C> {
7916        self._delegate = Some(new_value);
7917        self
7918    }
7919
7920    /// Set any additional parameter of the query string used in the request.
7921    /// It should be used to set parameters which are not yet available through their own
7922    /// setters.
7923    ///
7924    /// Please note that this method must not be used to set any of the known parameters
7925    /// which have their own setter method. If done anyway, the request will fail.
7926    ///
7927    /// # Additional Parameters
7928    ///
7929    /// * *$.xgafv* (query-string) - V1 error format.
7930    /// * *access_token* (query-string) - OAuth access token.
7931    /// * *alt* (query-string) - Data format for response.
7932    /// * *callback* (query-string) - JSONP
7933    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7934    /// * *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.
7935    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7936    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7937    /// * *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.
7938    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7939    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7940    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteGetCall<'a, C>
7941    where
7942        T: AsRef<str>,
7943    {
7944        self._additional_params
7945            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7946        self
7947    }
7948
7949    /// Identifies the authorization scope for the method you are building.
7950    ///
7951    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7952    /// [`Scope::CloudPlatform`].
7953    ///
7954    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7955    /// tokens for more than one scope.
7956    ///
7957    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7958    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7959    /// sufficient, a read-write scope will do as well.
7960    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteGetCall<'a, C>
7961    where
7962        St: AsRef<str>,
7963    {
7964        self._scopes.insert(String::from(scope.as_ref()));
7965        self
7966    }
7967    /// Identifies the authorization scope(s) for the method you are building.
7968    ///
7969    /// See [`Self::add_scope()`] for details.
7970    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteGetCall<'a, C>
7971    where
7972        I: IntoIterator<Item = St>,
7973        St: AsRef<str>,
7974    {
7975        self._scopes
7976            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7977        self
7978    }
7979
7980    /// Removes all scopes, and no default scope will be used either.
7981    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7982    /// for details).
7983    pub fn clear_scopes(mut self) -> ProjectNoteGetCall<'a, C> {
7984        self._scopes.clear();
7985        self
7986    }
7987}
7988
7989/// Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
7990///
7991/// A builder for the *notes.getIamPolicy* method supported by a *project* resource.
7992/// It is not used directly, but through a [`ProjectMethods`] instance.
7993///
7994/// # Example
7995///
7996/// Instantiate a resource method builder
7997///
7998/// ```test_harness,no_run
7999/// # extern crate hyper;
8000/// # extern crate hyper_rustls;
8001/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8002/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
8003/// # async fn dox() {
8004/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8005///
8006/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8008/// #     secret,
8009/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8010/// # ).build().await.unwrap();
8011///
8012/// # let client = hyper_util::client::legacy::Client::builder(
8013/// #     hyper_util::rt::TokioExecutor::new()
8014/// # )
8015/// # .build(
8016/// #     hyper_rustls::HttpsConnectorBuilder::new()
8017/// #         .with_native_roots()
8018/// #         .unwrap()
8019/// #         .https_or_http()
8020/// #         .enable_http1()
8021/// #         .build()
8022/// # );
8023/// # let mut hub = ContainerAnalysis::new(client, auth);
8024/// // As the method needs a request, you would usually fill it with the desired information
8025/// // into the respective structure. Some of the parts shown here might not be applicable !
8026/// // Values shown here are possibly random and not representative !
8027/// let mut req = GetIamPolicyRequest::default();
8028///
8029/// // You can configure optional parameters by calling the respective setters at will, and
8030/// // execute the final call using `doit()`.
8031/// // Values shown here are possibly random and not representative !
8032/// let result = hub.projects().notes_get_iam_policy(req, "resource")
8033///              .doit().await;
8034/// # }
8035/// ```
8036pub struct ProjectNoteGetIamPolicyCall<'a, C>
8037where
8038    C: 'a,
8039{
8040    hub: &'a ContainerAnalysis<C>,
8041    _request: GetIamPolicyRequest,
8042    _resource: String,
8043    _delegate: Option<&'a mut dyn common::Delegate>,
8044    _additional_params: HashMap<String, String>,
8045    _scopes: BTreeSet<String>,
8046}
8047
8048impl<'a, C> common::CallBuilder for ProjectNoteGetIamPolicyCall<'a, C> {}
8049
8050impl<'a, C> ProjectNoteGetIamPolicyCall<'a, C>
8051where
8052    C: common::Connector,
8053{
8054    /// Perform the operation you have build so far.
8055    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
8056        use std::borrow::Cow;
8057        use std::io::{Read, Seek};
8058
8059        use common::{url::Params, ToParts};
8060        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8061
8062        let mut dd = common::DefaultDelegate;
8063        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8064        dlg.begin(common::MethodInfo {
8065            id: "containeranalysis.projects.notes.getIamPolicy",
8066            http_method: hyper::Method::POST,
8067        });
8068
8069        for &field in ["alt", "resource"].iter() {
8070            if self._additional_params.contains_key(field) {
8071                dlg.finished(false);
8072                return Err(common::Error::FieldClash(field));
8073            }
8074        }
8075
8076        let mut params = Params::with_capacity(4 + self._additional_params.len());
8077        params.push("resource", self._resource);
8078
8079        params.extend(self._additional_params.iter());
8080
8081        params.push("alt", "json");
8082        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
8083        if self._scopes.is_empty() {
8084            self._scopes
8085                .insert(Scope::CloudPlatform.as_ref().to_string());
8086        }
8087
8088        #[allow(clippy::single_element_loop)]
8089        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8090            url = params.uri_replacement(url, param_name, find_this, true);
8091        }
8092        {
8093            let to_remove = ["resource"];
8094            params.remove_params(&to_remove);
8095        }
8096
8097        let url = params.parse_with_url(&url);
8098
8099        let mut json_mime_type = mime::APPLICATION_JSON;
8100        let mut request_value_reader = {
8101            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8102            common::remove_json_null_values(&mut value);
8103            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8104            serde_json::to_writer(&mut dst, &value).unwrap();
8105            dst
8106        };
8107        let request_size = request_value_reader
8108            .seek(std::io::SeekFrom::End(0))
8109            .unwrap();
8110        request_value_reader
8111            .seek(std::io::SeekFrom::Start(0))
8112            .unwrap();
8113
8114        loop {
8115            let token = match self
8116                .hub
8117                .auth
8118                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8119                .await
8120            {
8121                Ok(token) => token,
8122                Err(e) => match dlg.token(e) {
8123                    Ok(token) => token,
8124                    Err(e) => {
8125                        dlg.finished(false);
8126                        return Err(common::Error::MissingToken(e));
8127                    }
8128                },
8129            };
8130            request_value_reader
8131                .seek(std::io::SeekFrom::Start(0))
8132                .unwrap();
8133            let mut req_result = {
8134                let client = &self.hub.client;
8135                dlg.pre_request();
8136                let mut req_builder = hyper::Request::builder()
8137                    .method(hyper::Method::POST)
8138                    .uri(url.as_str())
8139                    .header(USER_AGENT, self.hub._user_agent.clone());
8140
8141                if let Some(token) = token.as_ref() {
8142                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8143                }
8144
8145                let request = req_builder
8146                    .header(CONTENT_TYPE, json_mime_type.to_string())
8147                    .header(CONTENT_LENGTH, request_size as u64)
8148                    .body(common::to_body(
8149                        request_value_reader.get_ref().clone().into(),
8150                    ));
8151
8152                client.request(request.unwrap()).await
8153            };
8154
8155            match req_result {
8156                Err(err) => {
8157                    if let common::Retry::After(d) = dlg.http_error(&err) {
8158                        sleep(d).await;
8159                        continue;
8160                    }
8161                    dlg.finished(false);
8162                    return Err(common::Error::HttpError(err));
8163                }
8164                Ok(res) => {
8165                    let (mut parts, body) = res.into_parts();
8166                    let mut body = common::Body::new(body);
8167                    if !parts.status.is_success() {
8168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8169                        let error = serde_json::from_str(&common::to_string(&bytes));
8170                        let response = common::to_response(parts, bytes.into());
8171
8172                        if let common::Retry::After(d) =
8173                            dlg.http_failure(&response, error.as_ref().ok())
8174                        {
8175                            sleep(d).await;
8176                            continue;
8177                        }
8178
8179                        dlg.finished(false);
8180
8181                        return Err(match error {
8182                            Ok(value) => common::Error::BadRequest(value),
8183                            _ => common::Error::Failure(response),
8184                        });
8185                    }
8186                    let response = {
8187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8188                        let encoded = common::to_string(&bytes);
8189                        match serde_json::from_str(&encoded) {
8190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8191                            Err(error) => {
8192                                dlg.response_json_decode_error(&encoded, &error);
8193                                return Err(common::Error::JsonDecodeError(
8194                                    encoded.to_string(),
8195                                    error,
8196                                ));
8197                            }
8198                        }
8199                    };
8200
8201                    dlg.finished(true);
8202                    return Ok(response);
8203                }
8204            }
8205        }
8206    }
8207
8208    ///
8209    /// Sets the *request* property to the given value.
8210    ///
8211    /// Even though the property as already been set when instantiating this call,
8212    /// we provide this method for API completeness.
8213    pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectNoteGetIamPolicyCall<'a, C> {
8214        self._request = new_value;
8215        self
8216    }
8217    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
8218    ///
8219    /// Sets the *resource* path property to the given value.
8220    ///
8221    /// Even though the property as already been set when instantiating this call,
8222    /// we provide this method for API completeness.
8223    pub fn resource(mut self, new_value: &str) -> ProjectNoteGetIamPolicyCall<'a, C> {
8224        self._resource = new_value.to_string();
8225        self
8226    }
8227    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8228    /// while executing the actual API request.
8229    ///
8230    /// ````text
8231    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8232    /// ````
8233    ///
8234    /// Sets the *delegate* property to the given value.
8235    pub fn delegate(
8236        mut self,
8237        new_value: &'a mut dyn common::Delegate,
8238    ) -> ProjectNoteGetIamPolicyCall<'a, C> {
8239        self._delegate = Some(new_value);
8240        self
8241    }
8242
8243    /// Set any additional parameter of the query string used in the request.
8244    /// It should be used to set parameters which are not yet available through their own
8245    /// setters.
8246    ///
8247    /// Please note that this method must not be used to set any of the known parameters
8248    /// which have their own setter method. If done anyway, the request will fail.
8249    ///
8250    /// # Additional Parameters
8251    ///
8252    /// * *$.xgafv* (query-string) - V1 error format.
8253    /// * *access_token* (query-string) - OAuth access token.
8254    /// * *alt* (query-string) - Data format for response.
8255    /// * *callback* (query-string) - JSONP
8256    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8257    /// * *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.
8258    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8259    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8260    /// * *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.
8261    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8262    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8263    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteGetIamPolicyCall<'a, C>
8264    where
8265        T: AsRef<str>,
8266    {
8267        self._additional_params
8268            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8269        self
8270    }
8271
8272    /// Identifies the authorization scope for the method you are building.
8273    ///
8274    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8275    /// [`Scope::CloudPlatform`].
8276    ///
8277    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8278    /// tokens for more than one scope.
8279    ///
8280    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8281    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8282    /// sufficient, a read-write scope will do as well.
8283    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteGetIamPolicyCall<'a, C>
8284    where
8285        St: AsRef<str>,
8286    {
8287        self._scopes.insert(String::from(scope.as_ref()));
8288        self
8289    }
8290    /// Identifies the authorization scope(s) for the method you are building.
8291    ///
8292    /// See [`Self::add_scope()`] for details.
8293    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteGetIamPolicyCall<'a, C>
8294    where
8295        I: IntoIterator<Item = St>,
8296        St: AsRef<str>,
8297    {
8298        self._scopes
8299            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8300        self
8301    }
8302
8303    /// Removes all scopes, and no default scope will be used either.
8304    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8305    /// for details).
8306    pub fn clear_scopes(mut self) -> ProjectNoteGetIamPolicyCall<'a, C> {
8307        self._scopes.clear();
8308        self
8309    }
8310}
8311
8312/// Lists notes for the specified project.
8313///
8314/// A builder for the *notes.list* method supported by a *project* resource.
8315/// It is not used directly, but through a [`ProjectMethods`] instance.
8316///
8317/// # Example
8318///
8319/// Instantiate a resource method builder
8320///
8321/// ```test_harness,no_run
8322/// # extern crate hyper;
8323/// # extern crate hyper_rustls;
8324/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8325/// # async fn dox() {
8326/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8327///
8328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8330/// #     secret,
8331/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8332/// # ).build().await.unwrap();
8333///
8334/// # let client = hyper_util::client::legacy::Client::builder(
8335/// #     hyper_util::rt::TokioExecutor::new()
8336/// # )
8337/// # .build(
8338/// #     hyper_rustls::HttpsConnectorBuilder::new()
8339/// #         .with_native_roots()
8340/// #         .unwrap()
8341/// #         .https_or_http()
8342/// #         .enable_http1()
8343/// #         .build()
8344/// # );
8345/// # let mut hub = ContainerAnalysis::new(client, auth);
8346/// // You can configure optional parameters by calling the respective setters at will, and
8347/// // execute the final call using `doit()`.
8348/// // Values shown here are possibly random and not representative !
8349/// let result = hub.projects().notes_list("parent")
8350///              .page_token("eos")
8351///              .page_size(-86)
8352///              .filter("sed")
8353///              .doit().await;
8354/// # }
8355/// ```
8356pub struct ProjectNoteListCall<'a, C>
8357where
8358    C: 'a,
8359{
8360    hub: &'a ContainerAnalysis<C>,
8361    _parent: String,
8362    _page_token: Option<String>,
8363    _page_size: Option<i32>,
8364    _filter: Option<String>,
8365    _delegate: Option<&'a mut dyn common::Delegate>,
8366    _additional_params: HashMap<String, String>,
8367    _scopes: BTreeSet<String>,
8368}
8369
8370impl<'a, C> common::CallBuilder for ProjectNoteListCall<'a, C> {}
8371
8372impl<'a, C> ProjectNoteListCall<'a, C>
8373where
8374    C: common::Connector,
8375{
8376    /// Perform the operation you have build so far.
8377    pub async fn doit(mut self) -> common::Result<(common::Response, ListNotesResponse)> {
8378        use std::borrow::Cow;
8379        use std::io::{Read, Seek};
8380
8381        use common::{url::Params, ToParts};
8382        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8383
8384        let mut dd = common::DefaultDelegate;
8385        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8386        dlg.begin(common::MethodInfo {
8387            id: "containeranalysis.projects.notes.list",
8388            http_method: hyper::Method::GET,
8389        });
8390
8391        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
8392            if self._additional_params.contains_key(field) {
8393                dlg.finished(false);
8394                return Err(common::Error::FieldClash(field));
8395            }
8396        }
8397
8398        let mut params = Params::with_capacity(6 + self._additional_params.len());
8399        params.push("parent", self._parent);
8400        if let Some(value) = self._page_token.as_ref() {
8401            params.push("pageToken", value);
8402        }
8403        if let Some(value) = self._page_size.as_ref() {
8404            params.push("pageSize", value.to_string());
8405        }
8406        if let Some(value) = self._filter.as_ref() {
8407            params.push("filter", value);
8408        }
8409
8410        params.extend(self._additional_params.iter());
8411
8412        params.push("alt", "json");
8413        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
8414        if self._scopes.is_empty() {
8415            self._scopes
8416                .insert(Scope::CloudPlatform.as_ref().to_string());
8417        }
8418
8419        #[allow(clippy::single_element_loop)]
8420        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8421            url = params.uri_replacement(url, param_name, find_this, true);
8422        }
8423        {
8424            let to_remove = ["parent"];
8425            params.remove_params(&to_remove);
8426        }
8427
8428        let url = params.parse_with_url(&url);
8429
8430        loop {
8431            let token = match self
8432                .hub
8433                .auth
8434                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8435                .await
8436            {
8437                Ok(token) => token,
8438                Err(e) => match dlg.token(e) {
8439                    Ok(token) => token,
8440                    Err(e) => {
8441                        dlg.finished(false);
8442                        return Err(common::Error::MissingToken(e));
8443                    }
8444                },
8445            };
8446            let mut req_result = {
8447                let client = &self.hub.client;
8448                dlg.pre_request();
8449                let mut req_builder = hyper::Request::builder()
8450                    .method(hyper::Method::GET)
8451                    .uri(url.as_str())
8452                    .header(USER_AGENT, self.hub._user_agent.clone());
8453
8454                if let Some(token) = token.as_ref() {
8455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8456                }
8457
8458                let request = req_builder
8459                    .header(CONTENT_LENGTH, 0_u64)
8460                    .body(common::to_body::<String>(None));
8461
8462                client.request(request.unwrap()).await
8463            };
8464
8465            match req_result {
8466                Err(err) => {
8467                    if let common::Retry::After(d) = dlg.http_error(&err) {
8468                        sleep(d).await;
8469                        continue;
8470                    }
8471                    dlg.finished(false);
8472                    return Err(common::Error::HttpError(err));
8473                }
8474                Ok(res) => {
8475                    let (mut parts, body) = res.into_parts();
8476                    let mut body = common::Body::new(body);
8477                    if !parts.status.is_success() {
8478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8479                        let error = serde_json::from_str(&common::to_string(&bytes));
8480                        let response = common::to_response(parts, bytes.into());
8481
8482                        if let common::Retry::After(d) =
8483                            dlg.http_failure(&response, error.as_ref().ok())
8484                        {
8485                            sleep(d).await;
8486                            continue;
8487                        }
8488
8489                        dlg.finished(false);
8490
8491                        return Err(match error {
8492                            Ok(value) => common::Error::BadRequest(value),
8493                            _ => common::Error::Failure(response),
8494                        });
8495                    }
8496                    let response = {
8497                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8498                        let encoded = common::to_string(&bytes);
8499                        match serde_json::from_str(&encoded) {
8500                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8501                            Err(error) => {
8502                                dlg.response_json_decode_error(&encoded, &error);
8503                                return Err(common::Error::JsonDecodeError(
8504                                    encoded.to_string(),
8505                                    error,
8506                                ));
8507                            }
8508                        }
8509                    };
8510
8511                    dlg.finished(true);
8512                    return Ok(response);
8513                }
8514            }
8515        }
8516    }
8517
8518    /// Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
8519    ///
8520    /// Sets the *parent* path property to the given value.
8521    ///
8522    /// Even though the property as already been set when instantiating this call,
8523    /// we provide this method for API completeness.
8524    pub fn parent(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
8525        self._parent = new_value.to_string();
8526        self
8527    }
8528    /// Token to provide to skip to a particular spot in the list.
8529    ///
8530    /// Sets the *page token* query property to the given value.
8531    pub fn page_token(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
8532        self._page_token = Some(new_value.to_string());
8533        self
8534    }
8535    /// Number of notes to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.
8536    ///
8537    /// Sets the *page size* query property to the given value.
8538    pub fn page_size(mut self, new_value: i32) -> ProjectNoteListCall<'a, C> {
8539        self._page_size = Some(new_value);
8540        self
8541    }
8542    /// The filter expression.
8543    ///
8544    /// Sets the *filter* query property to the given value.
8545    pub fn filter(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
8546        self._filter = Some(new_value.to_string());
8547        self
8548    }
8549    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8550    /// while executing the actual API request.
8551    ///
8552    /// ````text
8553    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8554    /// ````
8555    ///
8556    /// Sets the *delegate* property to the given value.
8557    pub fn delegate(
8558        mut self,
8559        new_value: &'a mut dyn common::Delegate,
8560    ) -> ProjectNoteListCall<'a, C> {
8561        self._delegate = Some(new_value);
8562        self
8563    }
8564
8565    /// Set any additional parameter of the query string used in the request.
8566    /// It should be used to set parameters which are not yet available through their own
8567    /// setters.
8568    ///
8569    /// Please note that this method must not be used to set any of the known parameters
8570    /// which have their own setter method. If done anyway, the request will fail.
8571    ///
8572    /// # Additional Parameters
8573    ///
8574    /// * *$.xgafv* (query-string) - V1 error format.
8575    /// * *access_token* (query-string) - OAuth access token.
8576    /// * *alt* (query-string) - Data format for response.
8577    /// * *callback* (query-string) - JSONP
8578    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8579    /// * *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.
8580    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8581    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8582    /// * *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.
8583    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8584    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8585    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteListCall<'a, C>
8586    where
8587        T: AsRef<str>,
8588    {
8589        self._additional_params
8590            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8591        self
8592    }
8593
8594    /// Identifies the authorization scope for the method you are building.
8595    ///
8596    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8597    /// [`Scope::CloudPlatform`].
8598    ///
8599    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8600    /// tokens for more than one scope.
8601    ///
8602    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8603    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8604    /// sufficient, a read-write scope will do as well.
8605    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteListCall<'a, C>
8606    where
8607        St: AsRef<str>,
8608    {
8609        self._scopes.insert(String::from(scope.as_ref()));
8610        self
8611    }
8612    /// Identifies the authorization scope(s) for the method you are building.
8613    ///
8614    /// See [`Self::add_scope()`] for details.
8615    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteListCall<'a, C>
8616    where
8617        I: IntoIterator<Item = St>,
8618        St: AsRef<str>,
8619    {
8620        self._scopes
8621            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8622        self
8623    }
8624
8625    /// Removes all scopes, and no default scope will be used either.
8626    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8627    /// for details).
8628    pub fn clear_scopes(mut self) -> ProjectNoteListCall<'a, C> {
8629        self._scopes.clear();
8630        self
8631    }
8632}
8633
8634/// Updates the specified note.
8635///
8636/// A builder for the *notes.patch* method supported by a *project* resource.
8637/// It is not used directly, but through a [`ProjectMethods`] instance.
8638///
8639/// # Example
8640///
8641/// Instantiate a resource method builder
8642///
8643/// ```test_harness,no_run
8644/// # extern crate hyper;
8645/// # extern crate hyper_rustls;
8646/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8647/// use containeranalysis1_beta1::api::Note;
8648/// # async fn dox() {
8649/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8650///
8651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8653/// #     secret,
8654/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8655/// # ).build().await.unwrap();
8656///
8657/// # let client = hyper_util::client::legacy::Client::builder(
8658/// #     hyper_util::rt::TokioExecutor::new()
8659/// # )
8660/// # .build(
8661/// #     hyper_rustls::HttpsConnectorBuilder::new()
8662/// #         .with_native_roots()
8663/// #         .unwrap()
8664/// #         .https_or_http()
8665/// #         .enable_http1()
8666/// #         .build()
8667/// # );
8668/// # let mut hub = ContainerAnalysis::new(client, auth);
8669/// // As the method needs a request, you would usually fill it with the desired information
8670/// // into the respective structure. Some of the parts shown here might not be applicable !
8671/// // Values shown here are possibly random and not representative !
8672/// let mut req = Note::default();
8673///
8674/// // You can configure optional parameters by calling the respective setters at will, and
8675/// // execute the final call using `doit()`.
8676/// // Values shown here are possibly random and not representative !
8677/// let result = hub.projects().notes_patch(req, "name")
8678///              .update_mask(FieldMask::new::<&str>(&[]))
8679///              .doit().await;
8680/// # }
8681/// ```
8682pub struct ProjectNotePatchCall<'a, C>
8683where
8684    C: 'a,
8685{
8686    hub: &'a ContainerAnalysis<C>,
8687    _request: Note,
8688    _name: String,
8689    _update_mask: Option<common::FieldMask>,
8690    _delegate: Option<&'a mut dyn common::Delegate>,
8691    _additional_params: HashMap<String, String>,
8692    _scopes: BTreeSet<String>,
8693}
8694
8695impl<'a, C> common::CallBuilder for ProjectNotePatchCall<'a, C> {}
8696
8697impl<'a, C> ProjectNotePatchCall<'a, C>
8698where
8699    C: common::Connector,
8700{
8701    /// Perform the operation you have build so far.
8702    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
8703        use std::borrow::Cow;
8704        use std::io::{Read, Seek};
8705
8706        use common::{url::Params, ToParts};
8707        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8708
8709        let mut dd = common::DefaultDelegate;
8710        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8711        dlg.begin(common::MethodInfo {
8712            id: "containeranalysis.projects.notes.patch",
8713            http_method: hyper::Method::PATCH,
8714        });
8715
8716        for &field in ["alt", "name", "updateMask"].iter() {
8717            if self._additional_params.contains_key(field) {
8718                dlg.finished(false);
8719                return Err(common::Error::FieldClash(field));
8720            }
8721        }
8722
8723        let mut params = Params::with_capacity(5 + self._additional_params.len());
8724        params.push("name", self._name);
8725        if let Some(value) = self._update_mask.as_ref() {
8726            params.push("updateMask", value.to_string());
8727        }
8728
8729        params.extend(self._additional_params.iter());
8730
8731        params.push("alt", "json");
8732        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8733        if self._scopes.is_empty() {
8734            self._scopes
8735                .insert(Scope::CloudPlatform.as_ref().to_string());
8736        }
8737
8738        #[allow(clippy::single_element_loop)]
8739        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8740            url = params.uri_replacement(url, param_name, find_this, true);
8741        }
8742        {
8743            let to_remove = ["name"];
8744            params.remove_params(&to_remove);
8745        }
8746
8747        let url = params.parse_with_url(&url);
8748
8749        let mut json_mime_type = mime::APPLICATION_JSON;
8750        let mut request_value_reader = {
8751            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8752            common::remove_json_null_values(&mut value);
8753            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8754            serde_json::to_writer(&mut dst, &value).unwrap();
8755            dst
8756        };
8757        let request_size = request_value_reader
8758            .seek(std::io::SeekFrom::End(0))
8759            .unwrap();
8760        request_value_reader
8761            .seek(std::io::SeekFrom::Start(0))
8762            .unwrap();
8763
8764        loop {
8765            let token = match self
8766                .hub
8767                .auth
8768                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8769                .await
8770            {
8771                Ok(token) => token,
8772                Err(e) => match dlg.token(e) {
8773                    Ok(token) => token,
8774                    Err(e) => {
8775                        dlg.finished(false);
8776                        return Err(common::Error::MissingToken(e));
8777                    }
8778                },
8779            };
8780            request_value_reader
8781                .seek(std::io::SeekFrom::Start(0))
8782                .unwrap();
8783            let mut req_result = {
8784                let client = &self.hub.client;
8785                dlg.pre_request();
8786                let mut req_builder = hyper::Request::builder()
8787                    .method(hyper::Method::PATCH)
8788                    .uri(url.as_str())
8789                    .header(USER_AGENT, self.hub._user_agent.clone());
8790
8791                if let Some(token) = token.as_ref() {
8792                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8793                }
8794
8795                let request = req_builder
8796                    .header(CONTENT_TYPE, json_mime_type.to_string())
8797                    .header(CONTENT_LENGTH, request_size as u64)
8798                    .body(common::to_body(
8799                        request_value_reader.get_ref().clone().into(),
8800                    ));
8801
8802                client.request(request.unwrap()).await
8803            };
8804
8805            match req_result {
8806                Err(err) => {
8807                    if let common::Retry::After(d) = dlg.http_error(&err) {
8808                        sleep(d).await;
8809                        continue;
8810                    }
8811                    dlg.finished(false);
8812                    return Err(common::Error::HttpError(err));
8813                }
8814                Ok(res) => {
8815                    let (mut parts, body) = res.into_parts();
8816                    let mut body = common::Body::new(body);
8817                    if !parts.status.is_success() {
8818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8819                        let error = serde_json::from_str(&common::to_string(&bytes));
8820                        let response = common::to_response(parts, bytes.into());
8821
8822                        if let common::Retry::After(d) =
8823                            dlg.http_failure(&response, error.as_ref().ok())
8824                        {
8825                            sleep(d).await;
8826                            continue;
8827                        }
8828
8829                        dlg.finished(false);
8830
8831                        return Err(match error {
8832                            Ok(value) => common::Error::BadRequest(value),
8833                            _ => common::Error::Failure(response),
8834                        });
8835                    }
8836                    let response = {
8837                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8838                        let encoded = common::to_string(&bytes);
8839                        match serde_json::from_str(&encoded) {
8840                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8841                            Err(error) => {
8842                                dlg.response_json_decode_error(&encoded, &error);
8843                                return Err(common::Error::JsonDecodeError(
8844                                    encoded.to_string(),
8845                                    error,
8846                                ));
8847                            }
8848                        }
8849                    };
8850
8851                    dlg.finished(true);
8852                    return Ok(response);
8853                }
8854            }
8855        }
8856    }
8857
8858    ///
8859    /// Sets the *request* property to the given value.
8860    ///
8861    /// Even though the property as already been set when instantiating this call,
8862    /// we provide this method for API completeness.
8863    pub fn request(mut self, new_value: Note) -> ProjectNotePatchCall<'a, C> {
8864        self._request = new_value;
8865        self
8866    }
8867    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8868    ///
8869    /// Sets the *name* path property to the given value.
8870    ///
8871    /// Even though the property as already been set when instantiating this call,
8872    /// we provide this method for API completeness.
8873    pub fn name(mut self, new_value: &str) -> ProjectNotePatchCall<'a, C> {
8874        self._name = new_value.to_string();
8875        self
8876    }
8877    /// The fields to update.
8878    ///
8879    /// Sets the *update mask* query property to the given value.
8880    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectNotePatchCall<'a, C> {
8881        self._update_mask = Some(new_value);
8882        self
8883    }
8884    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8885    /// while executing the actual API request.
8886    ///
8887    /// ````text
8888    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8889    /// ````
8890    ///
8891    /// Sets the *delegate* property to the given value.
8892    pub fn delegate(
8893        mut self,
8894        new_value: &'a mut dyn common::Delegate,
8895    ) -> ProjectNotePatchCall<'a, C> {
8896        self._delegate = Some(new_value);
8897        self
8898    }
8899
8900    /// Set any additional parameter of the query string used in the request.
8901    /// It should be used to set parameters which are not yet available through their own
8902    /// setters.
8903    ///
8904    /// Please note that this method must not be used to set any of the known parameters
8905    /// which have their own setter method. If done anyway, the request will fail.
8906    ///
8907    /// # Additional Parameters
8908    ///
8909    /// * *$.xgafv* (query-string) - V1 error format.
8910    /// * *access_token* (query-string) - OAuth access token.
8911    /// * *alt* (query-string) - Data format for response.
8912    /// * *callback* (query-string) - JSONP
8913    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8914    /// * *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.
8915    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8916    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8917    /// * *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.
8918    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8919    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8920    pub fn param<T>(mut self, name: T, value: T) -> ProjectNotePatchCall<'a, C>
8921    where
8922        T: AsRef<str>,
8923    {
8924        self._additional_params
8925            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8926        self
8927    }
8928
8929    /// Identifies the authorization scope for the method you are building.
8930    ///
8931    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8932    /// [`Scope::CloudPlatform`].
8933    ///
8934    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8935    /// tokens for more than one scope.
8936    ///
8937    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8938    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8939    /// sufficient, a read-write scope will do as well.
8940    pub fn add_scope<St>(mut self, scope: St) -> ProjectNotePatchCall<'a, C>
8941    where
8942        St: AsRef<str>,
8943    {
8944        self._scopes.insert(String::from(scope.as_ref()));
8945        self
8946    }
8947    /// Identifies the authorization scope(s) for the method you are building.
8948    ///
8949    /// See [`Self::add_scope()`] for details.
8950    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNotePatchCall<'a, C>
8951    where
8952        I: IntoIterator<Item = St>,
8953        St: AsRef<str>,
8954    {
8955        self._scopes
8956            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8957        self
8958    }
8959
8960    /// Removes all scopes, and no default scope will be used either.
8961    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8962    /// for details).
8963    pub fn clear_scopes(mut self) -> ProjectNotePatchCall<'a, C> {
8964        self._scopes.clear();
8965        self
8966    }
8967}
8968
8969/// Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
8970///
8971/// A builder for the *notes.setIamPolicy* method supported by a *project* resource.
8972/// It is not used directly, but through a [`ProjectMethods`] instance.
8973///
8974/// # Example
8975///
8976/// Instantiate a resource method builder
8977///
8978/// ```test_harness,no_run
8979/// # extern crate hyper;
8980/// # extern crate hyper_rustls;
8981/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8982/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
8983/// # async fn dox() {
8984/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8985///
8986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8988/// #     secret,
8989/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8990/// # ).build().await.unwrap();
8991///
8992/// # let client = hyper_util::client::legacy::Client::builder(
8993/// #     hyper_util::rt::TokioExecutor::new()
8994/// # )
8995/// # .build(
8996/// #     hyper_rustls::HttpsConnectorBuilder::new()
8997/// #         .with_native_roots()
8998/// #         .unwrap()
8999/// #         .https_or_http()
9000/// #         .enable_http1()
9001/// #         .build()
9002/// # );
9003/// # let mut hub = ContainerAnalysis::new(client, auth);
9004/// // As the method needs a request, you would usually fill it with the desired information
9005/// // into the respective structure. Some of the parts shown here might not be applicable !
9006/// // Values shown here are possibly random and not representative !
9007/// let mut req = SetIamPolicyRequest::default();
9008///
9009/// // You can configure optional parameters by calling the respective setters at will, and
9010/// // execute the final call using `doit()`.
9011/// // Values shown here are possibly random and not representative !
9012/// let result = hub.projects().notes_set_iam_policy(req, "resource")
9013///              .doit().await;
9014/// # }
9015/// ```
9016pub struct ProjectNoteSetIamPolicyCall<'a, C>
9017where
9018    C: 'a,
9019{
9020    hub: &'a ContainerAnalysis<C>,
9021    _request: SetIamPolicyRequest,
9022    _resource: String,
9023    _delegate: Option<&'a mut dyn common::Delegate>,
9024    _additional_params: HashMap<String, String>,
9025    _scopes: BTreeSet<String>,
9026}
9027
9028impl<'a, C> common::CallBuilder for ProjectNoteSetIamPolicyCall<'a, C> {}
9029
9030impl<'a, C> ProjectNoteSetIamPolicyCall<'a, C>
9031where
9032    C: common::Connector,
9033{
9034    /// Perform the operation you have build so far.
9035    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9036        use std::borrow::Cow;
9037        use std::io::{Read, Seek};
9038
9039        use common::{url::Params, ToParts};
9040        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9041
9042        let mut dd = common::DefaultDelegate;
9043        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9044        dlg.begin(common::MethodInfo {
9045            id: "containeranalysis.projects.notes.setIamPolicy",
9046            http_method: hyper::Method::POST,
9047        });
9048
9049        for &field in ["alt", "resource"].iter() {
9050            if self._additional_params.contains_key(field) {
9051                dlg.finished(false);
9052                return Err(common::Error::FieldClash(field));
9053            }
9054        }
9055
9056        let mut params = Params::with_capacity(4 + self._additional_params.len());
9057        params.push("resource", self._resource);
9058
9059        params.extend(self._additional_params.iter());
9060
9061        params.push("alt", "json");
9062        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
9063        if self._scopes.is_empty() {
9064            self._scopes
9065                .insert(Scope::CloudPlatform.as_ref().to_string());
9066        }
9067
9068        #[allow(clippy::single_element_loop)]
9069        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9070            url = params.uri_replacement(url, param_name, find_this, true);
9071        }
9072        {
9073            let to_remove = ["resource"];
9074            params.remove_params(&to_remove);
9075        }
9076
9077        let url = params.parse_with_url(&url);
9078
9079        let mut json_mime_type = mime::APPLICATION_JSON;
9080        let mut request_value_reader = {
9081            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9082            common::remove_json_null_values(&mut value);
9083            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9084            serde_json::to_writer(&mut dst, &value).unwrap();
9085            dst
9086        };
9087        let request_size = request_value_reader
9088            .seek(std::io::SeekFrom::End(0))
9089            .unwrap();
9090        request_value_reader
9091            .seek(std::io::SeekFrom::Start(0))
9092            .unwrap();
9093
9094        loop {
9095            let token = match self
9096                .hub
9097                .auth
9098                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9099                .await
9100            {
9101                Ok(token) => token,
9102                Err(e) => match dlg.token(e) {
9103                    Ok(token) => token,
9104                    Err(e) => {
9105                        dlg.finished(false);
9106                        return Err(common::Error::MissingToken(e));
9107                    }
9108                },
9109            };
9110            request_value_reader
9111                .seek(std::io::SeekFrom::Start(0))
9112                .unwrap();
9113            let mut req_result = {
9114                let client = &self.hub.client;
9115                dlg.pre_request();
9116                let mut req_builder = hyper::Request::builder()
9117                    .method(hyper::Method::POST)
9118                    .uri(url.as_str())
9119                    .header(USER_AGENT, self.hub._user_agent.clone());
9120
9121                if let Some(token) = token.as_ref() {
9122                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9123                }
9124
9125                let request = req_builder
9126                    .header(CONTENT_TYPE, json_mime_type.to_string())
9127                    .header(CONTENT_LENGTH, request_size as u64)
9128                    .body(common::to_body(
9129                        request_value_reader.get_ref().clone().into(),
9130                    ));
9131
9132                client.request(request.unwrap()).await
9133            };
9134
9135            match req_result {
9136                Err(err) => {
9137                    if let common::Retry::After(d) = dlg.http_error(&err) {
9138                        sleep(d).await;
9139                        continue;
9140                    }
9141                    dlg.finished(false);
9142                    return Err(common::Error::HttpError(err));
9143                }
9144                Ok(res) => {
9145                    let (mut parts, body) = res.into_parts();
9146                    let mut body = common::Body::new(body);
9147                    if !parts.status.is_success() {
9148                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9149                        let error = serde_json::from_str(&common::to_string(&bytes));
9150                        let response = common::to_response(parts, bytes.into());
9151
9152                        if let common::Retry::After(d) =
9153                            dlg.http_failure(&response, error.as_ref().ok())
9154                        {
9155                            sleep(d).await;
9156                            continue;
9157                        }
9158
9159                        dlg.finished(false);
9160
9161                        return Err(match error {
9162                            Ok(value) => common::Error::BadRequest(value),
9163                            _ => common::Error::Failure(response),
9164                        });
9165                    }
9166                    let response = {
9167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9168                        let encoded = common::to_string(&bytes);
9169                        match serde_json::from_str(&encoded) {
9170                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9171                            Err(error) => {
9172                                dlg.response_json_decode_error(&encoded, &error);
9173                                return Err(common::Error::JsonDecodeError(
9174                                    encoded.to_string(),
9175                                    error,
9176                                ));
9177                            }
9178                        }
9179                    };
9180
9181                    dlg.finished(true);
9182                    return Ok(response);
9183                }
9184            }
9185        }
9186    }
9187
9188    ///
9189    /// Sets the *request* property to the given value.
9190    ///
9191    /// Even though the property as already been set when instantiating this call,
9192    /// we provide this method for API completeness.
9193    pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectNoteSetIamPolicyCall<'a, C> {
9194        self._request = new_value;
9195        self
9196    }
9197    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
9198    ///
9199    /// Sets the *resource* path property to the given value.
9200    ///
9201    /// Even though the property as already been set when instantiating this call,
9202    /// we provide this method for API completeness.
9203    pub fn resource(mut self, new_value: &str) -> ProjectNoteSetIamPolicyCall<'a, C> {
9204        self._resource = new_value.to_string();
9205        self
9206    }
9207    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9208    /// while executing the actual API request.
9209    ///
9210    /// ````text
9211    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9212    /// ````
9213    ///
9214    /// Sets the *delegate* property to the given value.
9215    pub fn delegate(
9216        mut self,
9217        new_value: &'a mut dyn common::Delegate,
9218    ) -> ProjectNoteSetIamPolicyCall<'a, C> {
9219        self._delegate = Some(new_value);
9220        self
9221    }
9222
9223    /// Set any additional parameter of the query string used in the request.
9224    /// It should be used to set parameters which are not yet available through their own
9225    /// setters.
9226    ///
9227    /// Please note that this method must not be used to set any of the known parameters
9228    /// which have their own setter method. If done anyway, the request will fail.
9229    ///
9230    /// # Additional Parameters
9231    ///
9232    /// * *$.xgafv* (query-string) - V1 error format.
9233    /// * *access_token* (query-string) - OAuth access token.
9234    /// * *alt* (query-string) - Data format for response.
9235    /// * *callback* (query-string) - JSONP
9236    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9237    /// * *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.
9238    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9239    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9240    /// * *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.
9241    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9242    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9243    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteSetIamPolicyCall<'a, C>
9244    where
9245        T: AsRef<str>,
9246    {
9247        self._additional_params
9248            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9249        self
9250    }
9251
9252    /// Identifies the authorization scope for the method you are building.
9253    ///
9254    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9255    /// [`Scope::CloudPlatform`].
9256    ///
9257    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9258    /// tokens for more than one scope.
9259    ///
9260    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9261    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9262    /// sufficient, a read-write scope will do as well.
9263    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteSetIamPolicyCall<'a, C>
9264    where
9265        St: AsRef<str>,
9266    {
9267        self._scopes.insert(String::from(scope.as_ref()));
9268        self
9269    }
9270    /// Identifies the authorization scope(s) for the method you are building.
9271    ///
9272    /// See [`Self::add_scope()`] for details.
9273    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteSetIamPolicyCall<'a, C>
9274    where
9275        I: IntoIterator<Item = St>,
9276        St: AsRef<str>,
9277    {
9278        self._scopes
9279            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9280        self
9281    }
9282
9283    /// Removes all scopes, and no default scope will be used either.
9284    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9285    /// for details).
9286    pub fn clear_scopes(mut self) -> ProjectNoteSetIamPolicyCall<'a, C> {
9287        self._scopes.clear();
9288        self
9289    }
9290}
9291
9292/// Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
9293///
9294/// A builder for the *notes.testIamPermissions* method supported by a *project* resource.
9295/// It is not used directly, but through a [`ProjectMethods`] instance.
9296///
9297/// # Example
9298///
9299/// Instantiate a resource method builder
9300///
9301/// ```test_harness,no_run
9302/// # extern crate hyper;
9303/// # extern crate hyper_rustls;
9304/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9305/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
9306/// # async fn dox() {
9307/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9308///
9309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9310/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9311/// #     secret,
9312/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9313/// # ).build().await.unwrap();
9314///
9315/// # let client = hyper_util::client::legacy::Client::builder(
9316/// #     hyper_util::rt::TokioExecutor::new()
9317/// # )
9318/// # .build(
9319/// #     hyper_rustls::HttpsConnectorBuilder::new()
9320/// #         .with_native_roots()
9321/// #         .unwrap()
9322/// #         .https_or_http()
9323/// #         .enable_http1()
9324/// #         .build()
9325/// # );
9326/// # let mut hub = ContainerAnalysis::new(client, auth);
9327/// // As the method needs a request, you would usually fill it with the desired information
9328/// // into the respective structure. Some of the parts shown here might not be applicable !
9329/// // Values shown here are possibly random and not representative !
9330/// let mut req = TestIamPermissionsRequest::default();
9331///
9332/// // You can configure optional parameters by calling the respective setters at will, and
9333/// // execute the final call using `doit()`.
9334/// // Values shown here are possibly random and not representative !
9335/// let result = hub.projects().notes_test_iam_permissions(req, "resource")
9336///              .doit().await;
9337/// # }
9338/// ```
9339pub struct ProjectNoteTestIamPermissionCall<'a, C>
9340where
9341    C: 'a,
9342{
9343    hub: &'a ContainerAnalysis<C>,
9344    _request: TestIamPermissionsRequest,
9345    _resource: String,
9346    _delegate: Option<&'a mut dyn common::Delegate>,
9347    _additional_params: HashMap<String, String>,
9348    _scopes: BTreeSet<String>,
9349}
9350
9351impl<'a, C> common::CallBuilder for ProjectNoteTestIamPermissionCall<'a, C> {}
9352
9353impl<'a, C> ProjectNoteTestIamPermissionCall<'a, C>
9354where
9355    C: common::Connector,
9356{
9357    /// Perform the operation you have build so far.
9358    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
9359        use std::borrow::Cow;
9360        use std::io::{Read, Seek};
9361
9362        use common::{url::Params, ToParts};
9363        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9364
9365        let mut dd = common::DefaultDelegate;
9366        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9367        dlg.begin(common::MethodInfo {
9368            id: "containeranalysis.projects.notes.testIamPermissions",
9369            http_method: hyper::Method::POST,
9370        });
9371
9372        for &field in ["alt", "resource"].iter() {
9373            if self._additional_params.contains_key(field) {
9374                dlg.finished(false);
9375                return Err(common::Error::FieldClash(field));
9376            }
9377        }
9378
9379        let mut params = Params::with_capacity(4 + self._additional_params.len());
9380        params.push("resource", self._resource);
9381
9382        params.extend(self._additional_params.iter());
9383
9384        params.push("alt", "json");
9385        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
9386        if self._scopes.is_empty() {
9387            self._scopes
9388                .insert(Scope::CloudPlatform.as_ref().to_string());
9389        }
9390
9391        #[allow(clippy::single_element_loop)]
9392        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9393            url = params.uri_replacement(url, param_name, find_this, true);
9394        }
9395        {
9396            let to_remove = ["resource"];
9397            params.remove_params(&to_remove);
9398        }
9399
9400        let url = params.parse_with_url(&url);
9401
9402        let mut json_mime_type = mime::APPLICATION_JSON;
9403        let mut request_value_reader = {
9404            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9405            common::remove_json_null_values(&mut value);
9406            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9407            serde_json::to_writer(&mut dst, &value).unwrap();
9408            dst
9409        };
9410        let request_size = request_value_reader
9411            .seek(std::io::SeekFrom::End(0))
9412            .unwrap();
9413        request_value_reader
9414            .seek(std::io::SeekFrom::Start(0))
9415            .unwrap();
9416
9417        loop {
9418            let token = match self
9419                .hub
9420                .auth
9421                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9422                .await
9423            {
9424                Ok(token) => token,
9425                Err(e) => match dlg.token(e) {
9426                    Ok(token) => token,
9427                    Err(e) => {
9428                        dlg.finished(false);
9429                        return Err(common::Error::MissingToken(e));
9430                    }
9431                },
9432            };
9433            request_value_reader
9434                .seek(std::io::SeekFrom::Start(0))
9435                .unwrap();
9436            let mut req_result = {
9437                let client = &self.hub.client;
9438                dlg.pre_request();
9439                let mut req_builder = hyper::Request::builder()
9440                    .method(hyper::Method::POST)
9441                    .uri(url.as_str())
9442                    .header(USER_AGENT, self.hub._user_agent.clone());
9443
9444                if let Some(token) = token.as_ref() {
9445                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9446                }
9447
9448                let request = req_builder
9449                    .header(CONTENT_TYPE, json_mime_type.to_string())
9450                    .header(CONTENT_LENGTH, request_size as u64)
9451                    .body(common::to_body(
9452                        request_value_reader.get_ref().clone().into(),
9453                    ));
9454
9455                client.request(request.unwrap()).await
9456            };
9457
9458            match req_result {
9459                Err(err) => {
9460                    if let common::Retry::After(d) = dlg.http_error(&err) {
9461                        sleep(d).await;
9462                        continue;
9463                    }
9464                    dlg.finished(false);
9465                    return Err(common::Error::HttpError(err));
9466                }
9467                Ok(res) => {
9468                    let (mut parts, body) = res.into_parts();
9469                    let mut body = common::Body::new(body);
9470                    if !parts.status.is_success() {
9471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9472                        let error = serde_json::from_str(&common::to_string(&bytes));
9473                        let response = common::to_response(parts, bytes.into());
9474
9475                        if let common::Retry::After(d) =
9476                            dlg.http_failure(&response, error.as_ref().ok())
9477                        {
9478                            sleep(d).await;
9479                            continue;
9480                        }
9481
9482                        dlg.finished(false);
9483
9484                        return Err(match error {
9485                            Ok(value) => common::Error::BadRequest(value),
9486                            _ => common::Error::Failure(response),
9487                        });
9488                    }
9489                    let response = {
9490                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9491                        let encoded = common::to_string(&bytes);
9492                        match serde_json::from_str(&encoded) {
9493                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9494                            Err(error) => {
9495                                dlg.response_json_decode_error(&encoded, &error);
9496                                return Err(common::Error::JsonDecodeError(
9497                                    encoded.to_string(),
9498                                    error,
9499                                ));
9500                            }
9501                        }
9502                    };
9503
9504                    dlg.finished(true);
9505                    return Ok(response);
9506                }
9507            }
9508        }
9509    }
9510
9511    ///
9512    /// Sets the *request* property to the given value.
9513    ///
9514    /// Even though the property as already been set when instantiating this call,
9515    /// we provide this method for API completeness.
9516    pub fn request(
9517        mut self,
9518        new_value: TestIamPermissionsRequest,
9519    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
9520        self._request = new_value;
9521        self
9522    }
9523    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
9524    ///
9525    /// Sets the *resource* path property to the given value.
9526    ///
9527    /// Even though the property as already been set when instantiating this call,
9528    /// we provide this method for API completeness.
9529    pub fn resource(mut self, new_value: &str) -> ProjectNoteTestIamPermissionCall<'a, C> {
9530        self._resource = new_value.to_string();
9531        self
9532    }
9533    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9534    /// while executing the actual API request.
9535    ///
9536    /// ````text
9537    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9538    /// ````
9539    ///
9540    /// Sets the *delegate* property to the given value.
9541    pub fn delegate(
9542        mut self,
9543        new_value: &'a mut dyn common::Delegate,
9544    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
9545        self._delegate = Some(new_value);
9546        self
9547    }
9548
9549    /// Set any additional parameter of the query string used in the request.
9550    /// It should be used to set parameters which are not yet available through their own
9551    /// setters.
9552    ///
9553    /// Please note that this method must not be used to set any of the known parameters
9554    /// which have their own setter method. If done anyway, the request will fail.
9555    ///
9556    /// # Additional Parameters
9557    ///
9558    /// * *$.xgafv* (query-string) - V1 error format.
9559    /// * *access_token* (query-string) - OAuth access token.
9560    /// * *alt* (query-string) - Data format for response.
9561    /// * *callback* (query-string) - JSONP
9562    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9563    /// * *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.
9564    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9565    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9566    /// * *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.
9567    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9568    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9569    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteTestIamPermissionCall<'a, C>
9570    where
9571        T: AsRef<str>,
9572    {
9573        self._additional_params
9574            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9575        self
9576    }
9577
9578    /// Identifies the authorization scope for the method you are building.
9579    ///
9580    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9581    /// [`Scope::CloudPlatform`].
9582    ///
9583    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9584    /// tokens for more than one scope.
9585    ///
9586    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9587    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9588    /// sufficient, a read-write scope will do as well.
9589    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteTestIamPermissionCall<'a, C>
9590    where
9591        St: AsRef<str>,
9592    {
9593        self._scopes.insert(String::from(scope.as_ref()));
9594        self
9595    }
9596    /// Identifies the authorization scope(s) for the method you are building.
9597    ///
9598    /// See [`Self::add_scope()`] for details.
9599    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteTestIamPermissionCall<'a, C>
9600    where
9601        I: IntoIterator<Item = St>,
9602        St: AsRef<str>,
9603    {
9604        self._scopes
9605            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9606        self
9607    }
9608
9609    /// Removes all scopes, and no default scope will be used either.
9610    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9611    /// for details).
9612    pub fn clear_scopes(mut self) -> ProjectNoteTestIamPermissionCall<'a, C> {
9613        self._scopes.clear();
9614        self
9615    }
9616}
9617
9618/// Creates new occurrences in batch.
9619///
9620/// A builder for the *occurrences.batchCreate* method supported by a *project* resource.
9621/// It is not used directly, but through a [`ProjectMethods`] instance.
9622///
9623/// # Example
9624///
9625/// Instantiate a resource method builder
9626///
9627/// ```test_harness,no_run
9628/// # extern crate hyper;
9629/// # extern crate hyper_rustls;
9630/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9631/// use containeranalysis1_beta1::api::BatchCreateOccurrencesRequest;
9632/// # async fn dox() {
9633/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9634///
9635/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9636/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9637/// #     secret,
9638/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9639/// # ).build().await.unwrap();
9640///
9641/// # let client = hyper_util::client::legacy::Client::builder(
9642/// #     hyper_util::rt::TokioExecutor::new()
9643/// # )
9644/// # .build(
9645/// #     hyper_rustls::HttpsConnectorBuilder::new()
9646/// #         .with_native_roots()
9647/// #         .unwrap()
9648/// #         .https_or_http()
9649/// #         .enable_http1()
9650/// #         .build()
9651/// # );
9652/// # let mut hub = ContainerAnalysis::new(client, auth);
9653/// // As the method needs a request, you would usually fill it with the desired information
9654/// // into the respective structure. Some of the parts shown here might not be applicable !
9655/// // Values shown here are possibly random and not representative !
9656/// let mut req = BatchCreateOccurrencesRequest::default();
9657///
9658/// // You can configure optional parameters by calling the respective setters at will, and
9659/// // execute the final call using `doit()`.
9660/// // Values shown here are possibly random and not representative !
9661/// let result = hub.projects().occurrences_batch_create(req, "parent")
9662///              .doit().await;
9663/// # }
9664/// ```
9665pub struct ProjectOccurrenceBatchCreateCall<'a, C>
9666where
9667    C: 'a,
9668{
9669    hub: &'a ContainerAnalysis<C>,
9670    _request: BatchCreateOccurrencesRequest,
9671    _parent: String,
9672    _delegate: Option<&'a mut dyn common::Delegate>,
9673    _additional_params: HashMap<String, String>,
9674    _scopes: BTreeSet<String>,
9675}
9676
9677impl<'a, C> common::CallBuilder for ProjectOccurrenceBatchCreateCall<'a, C> {}
9678
9679impl<'a, C> ProjectOccurrenceBatchCreateCall<'a, C>
9680where
9681    C: common::Connector,
9682{
9683    /// Perform the operation you have build so far.
9684    pub async fn doit(
9685        mut self,
9686    ) -> common::Result<(common::Response, BatchCreateOccurrencesResponse)> {
9687        use std::borrow::Cow;
9688        use std::io::{Read, Seek};
9689
9690        use common::{url::Params, ToParts};
9691        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9692
9693        let mut dd = common::DefaultDelegate;
9694        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9695        dlg.begin(common::MethodInfo {
9696            id: "containeranalysis.projects.occurrences.batchCreate",
9697            http_method: hyper::Method::POST,
9698        });
9699
9700        for &field in ["alt", "parent"].iter() {
9701            if self._additional_params.contains_key(field) {
9702                dlg.finished(false);
9703                return Err(common::Error::FieldClash(field));
9704            }
9705        }
9706
9707        let mut params = Params::with_capacity(4 + self._additional_params.len());
9708        params.push("parent", self._parent);
9709
9710        params.extend(self._additional_params.iter());
9711
9712        params.push("alt", "json");
9713        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:batchCreate";
9714        if self._scopes.is_empty() {
9715            self._scopes
9716                .insert(Scope::CloudPlatform.as_ref().to_string());
9717        }
9718
9719        #[allow(clippy::single_element_loop)]
9720        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9721            url = params.uri_replacement(url, param_name, find_this, true);
9722        }
9723        {
9724            let to_remove = ["parent"];
9725            params.remove_params(&to_remove);
9726        }
9727
9728        let url = params.parse_with_url(&url);
9729
9730        let mut json_mime_type = mime::APPLICATION_JSON;
9731        let mut request_value_reader = {
9732            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9733            common::remove_json_null_values(&mut value);
9734            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9735            serde_json::to_writer(&mut dst, &value).unwrap();
9736            dst
9737        };
9738        let request_size = request_value_reader
9739            .seek(std::io::SeekFrom::End(0))
9740            .unwrap();
9741        request_value_reader
9742            .seek(std::io::SeekFrom::Start(0))
9743            .unwrap();
9744
9745        loop {
9746            let token = match self
9747                .hub
9748                .auth
9749                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9750                .await
9751            {
9752                Ok(token) => token,
9753                Err(e) => match dlg.token(e) {
9754                    Ok(token) => token,
9755                    Err(e) => {
9756                        dlg.finished(false);
9757                        return Err(common::Error::MissingToken(e));
9758                    }
9759                },
9760            };
9761            request_value_reader
9762                .seek(std::io::SeekFrom::Start(0))
9763                .unwrap();
9764            let mut req_result = {
9765                let client = &self.hub.client;
9766                dlg.pre_request();
9767                let mut req_builder = hyper::Request::builder()
9768                    .method(hyper::Method::POST)
9769                    .uri(url.as_str())
9770                    .header(USER_AGENT, self.hub._user_agent.clone());
9771
9772                if let Some(token) = token.as_ref() {
9773                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9774                }
9775
9776                let request = req_builder
9777                    .header(CONTENT_TYPE, json_mime_type.to_string())
9778                    .header(CONTENT_LENGTH, request_size as u64)
9779                    .body(common::to_body(
9780                        request_value_reader.get_ref().clone().into(),
9781                    ));
9782
9783                client.request(request.unwrap()).await
9784            };
9785
9786            match req_result {
9787                Err(err) => {
9788                    if let common::Retry::After(d) = dlg.http_error(&err) {
9789                        sleep(d).await;
9790                        continue;
9791                    }
9792                    dlg.finished(false);
9793                    return Err(common::Error::HttpError(err));
9794                }
9795                Ok(res) => {
9796                    let (mut parts, body) = res.into_parts();
9797                    let mut body = common::Body::new(body);
9798                    if !parts.status.is_success() {
9799                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9800                        let error = serde_json::from_str(&common::to_string(&bytes));
9801                        let response = common::to_response(parts, bytes.into());
9802
9803                        if let common::Retry::After(d) =
9804                            dlg.http_failure(&response, error.as_ref().ok())
9805                        {
9806                            sleep(d).await;
9807                            continue;
9808                        }
9809
9810                        dlg.finished(false);
9811
9812                        return Err(match error {
9813                            Ok(value) => common::Error::BadRequest(value),
9814                            _ => common::Error::Failure(response),
9815                        });
9816                    }
9817                    let response = {
9818                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9819                        let encoded = common::to_string(&bytes);
9820                        match serde_json::from_str(&encoded) {
9821                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9822                            Err(error) => {
9823                                dlg.response_json_decode_error(&encoded, &error);
9824                                return Err(common::Error::JsonDecodeError(
9825                                    encoded.to_string(),
9826                                    error,
9827                                ));
9828                            }
9829                        }
9830                    };
9831
9832                    dlg.finished(true);
9833                    return Ok(response);
9834                }
9835            }
9836        }
9837    }
9838
9839    ///
9840    /// Sets the *request* property to the given value.
9841    ///
9842    /// Even though the property as already been set when instantiating this call,
9843    /// we provide this method for API completeness.
9844    pub fn request(
9845        mut self,
9846        new_value: BatchCreateOccurrencesRequest,
9847    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
9848        self._request = new_value;
9849        self
9850    }
9851    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
9852    ///
9853    /// Sets the *parent* path property to the given value.
9854    ///
9855    /// Even though the property as already been set when instantiating this call,
9856    /// we provide this method for API completeness.
9857    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceBatchCreateCall<'a, C> {
9858        self._parent = new_value.to_string();
9859        self
9860    }
9861    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9862    /// while executing the actual API request.
9863    ///
9864    /// ````text
9865    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9866    /// ````
9867    ///
9868    /// Sets the *delegate* property to the given value.
9869    pub fn delegate(
9870        mut self,
9871        new_value: &'a mut dyn common::Delegate,
9872    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
9873        self._delegate = Some(new_value);
9874        self
9875    }
9876
9877    /// Set any additional parameter of the query string used in the request.
9878    /// It should be used to set parameters which are not yet available through their own
9879    /// setters.
9880    ///
9881    /// Please note that this method must not be used to set any of the known parameters
9882    /// which have their own setter method. If done anyway, the request will fail.
9883    ///
9884    /// # Additional Parameters
9885    ///
9886    /// * *$.xgafv* (query-string) - V1 error format.
9887    /// * *access_token* (query-string) - OAuth access token.
9888    /// * *alt* (query-string) - Data format for response.
9889    /// * *callback* (query-string) - JSONP
9890    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9891    /// * *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.
9892    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9893    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9894    /// * *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.
9895    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9896    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9897    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceBatchCreateCall<'a, C>
9898    where
9899        T: AsRef<str>,
9900    {
9901        self._additional_params
9902            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9903        self
9904    }
9905
9906    /// Identifies the authorization scope for the method you are building.
9907    ///
9908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9909    /// [`Scope::CloudPlatform`].
9910    ///
9911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9912    /// tokens for more than one scope.
9913    ///
9914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9916    /// sufficient, a read-write scope will do as well.
9917    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceBatchCreateCall<'a, C>
9918    where
9919        St: AsRef<str>,
9920    {
9921        self._scopes.insert(String::from(scope.as_ref()));
9922        self
9923    }
9924    /// Identifies the authorization scope(s) for the method you are building.
9925    ///
9926    /// See [`Self::add_scope()`] for details.
9927    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceBatchCreateCall<'a, C>
9928    where
9929        I: IntoIterator<Item = St>,
9930        St: AsRef<str>,
9931    {
9932        self._scopes
9933            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9934        self
9935    }
9936
9937    /// Removes all scopes, and no default scope will be used either.
9938    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9939    /// for details).
9940    pub fn clear_scopes(mut self) -> ProjectOccurrenceBatchCreateCall<'a, C> {
9941        self._scopes.clear();
9942        self
9943    }
9944}
9945
9946/// Creates a new occurrence.
9947///
9948/// A builder for the *occurrences.create* method supported by a *project* resource.
9949/// It is not used directly, but through a [`ProjectMethods`] instance.
9950///
9951/// # Example
9952///
9953/// Instantiate a resource method builder
9954///
9955/// ```test_harness,no_run
9956/// # extern crate hyper;
9957/// # extern crate hyper_rustls;
9958/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9959/// use containeranalysis1_beta1::api::Occurrence;
9960/// # async fn dox() {
9961/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9962///
9963/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9964/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9965/// #     secret,
9966/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9967/// # ).build().await.unwrap();
9968///
9969/// # let client = hyper_util::client::legacy::Client::builder(
9970/// #     hyper_util::rt::TokioExecutor::new()
9971/// # )
9972/// # .build(
9973/// #     hyper_rustls::HttpsConnectorBuilder::new()
9974/// #         .with_native_roots()
9975/// #         .unwrap()
9976/// #         .https_or_http()
9977/// #         .enable_http1()
9978/// #         .build()
9979/// # );
9980/// # let mut hub = ContainerAnalysis::new(client, auth);
9981/// // As the method needs a request, you would usually fill it with the desired information
9982/// // into the respective structure. Some of the parts shown here might not be applicable !
9983/// // Values shown here are possibly random and not representative !
9984/// let mut req = Occurrence::default();
9985///
9986/// // You can configure optional parameters by calling the respective setters at will, and
9987/// // execute the final call using `doit()`.
9988/// // Values shown here are possibly random and not representative !
9989/// let result = hub.projects().occurrences_create(req, "parent")
9990///              .doit().await;
9991/// # }
9992/// ```
9993pub struct ProjectOccurrenceCreateCall<'a, C>
9994where
9995    C: 'a,
9996{
9997    hub: &'a ContainerAnalysis<C>,
9998    _request: Occurrence,
9999    _parent: String,
10000    _delegate: Option<&'a mut dyn common::Delegate>,
10001    _additional_params: HashMap<String, String>,
10002    _scopes: BTreeSet<String>,
10003}
10004
10005impl<'a, C> common::CallBuilder for ProjectOccurrenceCreateCall<'a, C> {}
10006
10007impl<'a, C> ProjectOccurrenceCreateCall<'a, C>
10008where
10009    C: common::Connector,
10010{
10011    /// Perform the operation you have build so far.
10012    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
10013        use std::borrow::Cow;
10014        use std::io::{Read, Seek};
10015
10016        use common::{url::Params, ToParts};
10017        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10018
10019        let mut dd = common::DefaultDelegate;
10020        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10021        dlg.begin(common::MethodInfo {
10022            id: "containeranalysis.projects.occurrences.create",
10023            http_method: hyper::Method::POST,
10024        });
10025
10026        for &field in ["alt", "parent"].iter() {
10027            if self._additional_params.contains_key(field) {
10028                dlg.finished(false);
10029                return Err(common::Error::FieldClash(field));
10030            }
10031        }
10032
10033        let mut params = Params::with_capacity(4 + self._additional_params.len());
10034        params.push("parent", self._parent);
10035
10036        params.extend(self._additional_params.iter());
10037
10038        params.push("alt", "json");
10039        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
10040        if self._scopes.is_empty() {
10041            self._scopes
10042                .insert(Scope::CloudPlatform.as_ref().to_string());
10043        }
10044
10045        #[allow(clippy::single_element_loop)]
10046        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10047            url = params.uri_replacement(url, param_name, find_this, true);
10048        }
10049        {
10050            let to_remove = ["parent"];
10051            params.remove_params(&to_remove);
10052        }
10053
10054        let url = params.parse_with_url(&url);
10055
10056        let mut json_mime_type = mime::APPLICATION_JSON;
10057        let mut request_value_reader = {
10058            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10059            common::remove_json_null_values(&mut value);
10060            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10061            serde_json::to_writer(&mut dst, &value).unwrap();
10062            dst
10063        };
10064        let request_size = request_value_reader
10065            .seek(std::io::SeekFrom::End(0))
10066            .unwrap();
10067        request_value_reader
10068            .seek(std::io::SeekFrom::Start(0))
10069            .unwrap();
10070
10071        loop {
10072            let token = match self
10073                .hub
10074                .auth
10075                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10076                .await
10077            {
10078                Ok(token) => token,
10079                Err(e) => match dlg.token(e) {
10080                    Ok(token) => token,
10081                    Err(e) => {
10082                        dlg.finished(false);
10083                        return Err(common::Error::MissingToken(e));
10084                    }
10085                },
10086            };
10087            request_value_reader
10088                .seek(std::io::SeekFrom::Start(0))
10089                .unwrap();
10090            let mut req_result = {
10091                let client = &self.hub.client;
10092                dlg.pre_request();
10093                let mut req_builder = hyper::Request::builder()
10094                    .method(hyper::Method::POST)
10095                    .uri(url.as_str())
10096                    .header(USER_AGENT, self.hub._user_agent.clone());
10097
10098                if let Some(token) = token.as_ref() {
10099                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10100                }
10101
10102                let request = req_builder
10103                    .header(CONTENT_TYPE, json_mime_type.to_string())
10104                    .header(CONTENT_LENGTH, request_size as u64)
10105                    .body(common::to_body(
10106                        request_value_reader.get_ref().clone().into(),
10107                    ));
10108
10109                client.request(request.unwrap()).await
10110            };
10111
10112            match req_result {
10113                Err(err) => {
10114                    if let common::Retry::After(d) = dlg.http_error(&err) {
10115                        sleep(d).await;
10116                        continue;
10117                    }
10118                    dlg.finished(false);
10119                    return Err(common::Error::HttpError(err));
10120                }
10121                Ok(res) => {
10122                    let (mut parts, body) = res.into_parts();
10123                    let mut body = common::Body::new(body);
10124                    if !parts.status.is_success() {
10125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10126                        let error = serde_json::from_str(&common::to_string(&bytes));
10127                        let response = common::to_response(parts, bytes.into());
10128
10129                        if let common::Retry::After(d) =
10130                            dlg.http_failure(&response, error.as_ref().ok())
10131                        {
10132                            sleep(d).await;
10133                            continue;
10134                        }
10135
10136                        dlg.finished(false);
10137
10138                        return Err(match error {
10139                            Ok(value) => common::Error::BadRequest(value),
10140                            _ => common::Error::Failure(response),
10141                        });
10142                    }
10143                    let response = {
10144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10145                        let encoded = common::to_string(&bytes);
10146                        match serde_json::from_str(&encoded) {
10147                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10148                            Err(error) => {
10149                                dlg.response_json_decode_error(&encoded, &error);
10150                                return Err(common::Error::JsonDecodeError(
10151                                    encoded.to_string(),
10152                                    error,
10153                                ));
10154                            }
10155                        }
10156                    };
10157
10158                    dlg.finished(true);
10159                    return Ok(response);
10160                }
10161            }
10162        }
10163    }
10164
10165    ///
10166    /// Sets the *request* property to the given value.
10167    ///
10168    /// Even though the property as already been set when instantiating this call,
10169    /// we provide this method for API completeness.
10170    pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrenceCreateCall<'a, C> {
10171        self._request = new_value;
10172        self
10173    }
10174    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created.
10175    ///
10176    /// Sets the *parent* path property to the given value.
10177    ///
10178    /// Even though the property as already been set when instantiating this call,
10179    /// we provide this method for API completeness.
10180    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceCreateCall<'a, C> {
10181        self._parent = new_value.to_string();
10182        self
10183    }
10184    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10185    /// while executing the actual API request.
10186    ///
10187    /// ````text
10188    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10189    /// ````
10190    ///
10191    /// Sets the *delegate* property to the given value.
10192    pub fn delegate(
10193        mut self,
10194        new_value: &'a mut dyn common::Delegate,
10195    ) -> ProjectOccurrenceCreateCall<'a, C> {
10196        self._delegate = Some(new_value);
10197        self
10198    }
10199
10200    /// Set any additional parameter of the query string used in the request.
10201    /// It should be used to set parameters which are not yet available through their own
10202    /// setters.
10203    ///
10204    /// Please note that this method must not be used to set any of the known parameters
10205    /// which have their own setter method. If done anyway, the request will fail.
10206    ///
10207    /// # Additional Parameters
10208    ///
10209    /// * *$.xgafv* (query-string) - V1 error format.
10210    /// * *access_token* (query-string) - OAuth access token.
10211    /// * *alt* (query-string) - Data format for response.
10212    /// * *callback* (query-string) - JSONP
10213    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10214    /// * *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.
10215    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10216    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10217    /// * *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.
10218    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10219    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10220    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceCreateCall<'a, C>
10221    where
10222        T: AsRef<str>,
10223    {
10224        self._additional_params
10225            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10226        self
10227    }
10228
10229    /// Identifies the authorization scope for the method you are building.
10230    ///
10231    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10232    /// [`Scope::CloudPlatform`].
10233    ///
10234    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10235    /// tokens for more than one scope.
10236    ///
10237    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10238    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10239    /// sufficient, a read-write scope will do as well.
10240    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceCreateCall<'a, C>
10241    where
10242        St: AsRef<str>,
10243    {
10244        self._scopes.insert(String::from(scope.as_ref()));
10245        self
10246    }
10247    /// Identifies the authorization scope(s) for the method you are building.
10248    ///
10249    /// See [`Self::add_scope()`] for details.
10250    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceCreateCall<'a, C>
10251    where
10252        I: IntoIterator<Item = St>,
10253        St: AsRef<str>,
10254    {
10255        self._scopes
10256            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10257        self
10258    }
10259
10260    /// Removes all scopes, and no default scope will be used either.
10261    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10262    /// for details).
10263    pub fn clear_scopes(mut self) -> ProjectOccurrenceCreateCall<'a, C> {
10264        self._scopes.clear();
10265        self
10266    }
10267}
10268
10269/// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
10270///
10271/// A builder for the *occurrences.delete* method supported by a *project* resource.
10272/// It is not used directly, but through a [`ProjectMethods`] instance.
10273///
10274/// # Example
10275///
10276/// Instantiate a resource method builder
10277///
10278/// ```test_harness,no_run
10279/// # extern crate hyper;
10280/// # extern crate hyper_rustls;
10281/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10282/// # async fn dox() {
10283/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10284///
10285/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10286/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10287/// #     secret,
10288/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10289/// # ).build().await.unwrap();
10290///
10291/// # let client = hyper_util::client::legacy::Client::builder(
10292/// #     hyper_util::rt::TokioExecutor::new()
10293/// # )
10294/// # .build(
10295/// #     hyper_rustls::HttpsConnectorBuilder::new()
10296/// #         .with_native_roots()
10297/// #         .unwrap()
10298/// #         .https_or_http()
10299/// #         .enable_http1()
10300/// #         .build()
10301/// # );
10302/// # let mut hub = ContainerAnalysis::new(client, auth);
10303/// // You can configure optional parameters by calling the respective setters at will, and
10304/// // execute the final call using `doit()`.
10305/// // Values shown here are possibly random and not representative !
10306/// let result = hub.projects().occurrences_delete("name")
10307///              .doit().await;
10308/// # }
10309/// ```
10310pub struct ProjectOccurrenceDeleteCall<'a, C>
10311where
10312    C: 'a,
10313{
10314    hub: &'a ContainerAnalysis<C>,
10315    _name: String,
10316    _delegate: Option<&'a mut dyn common::Delegate>,
10317    _additional_params: HashMap<String, String>,
10318    _scopes: BTreeSet<String>,
10319}
10320
10321impl<'a, C> common::CallBuilder for ProjectOccurrenceDeleteCall<'a, C> {}
10322
10323impl<'a, C> ProjectOccurrenceDeleteCall<'a, C>
10324where
10325    C: common::Connector,
10326{
10327    /// Perform the operation you have build so far.
10328    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10329        use std::borrow::Cow;
10330        use std::io::{Read, Seek};
10331
10332        use common::{url::Params, ToParts};
10333        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10334
10335        let mut dd = common::DefaultDelegate;
10336        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10337        dlg.begin(common::MethodInfo {
10338            id: "containeranalysis.projects.occurrences.delete",
10339            http_method: hyper::Method::DELETE,
10340        });
10341
10342        for &field in ["alt", "name"].iter() {
10343            if self._additional_params.contains_key(field) {
10344                dlg.finished(false);
10345                return Err(common::Error::FieldClash(field));
10346            }
10347        }
10348
10349        let mut params = Params::with_capacity(3 + self._additional_params.len());
10350        params.push("name", self._name);
10351
10352        params.extend(self._additional_params.iter());
10353
10354        params.push("alt", "json");
10355        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10356        if self._scopes.is_empty() {
10357            self._scopes
10358                .insert(Scope::CloudPlatform.as_ref().to_string());
10359        }
10360
10361        #[allow(clippy::single_element_loop)]
10362        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10363            url = params.uri_replacement(url, param_name, find_this, true);
10364        }
10365        {
10366            let to_remove = ["name"];
10367            params.remove_params(&to_remove);
10368        }
10369
10370        let url = params.parse_with_url(&url);
10371
10372        loop {
10373            let token = match self
10374                .hub
10375                .auth
10376                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10377                .await
10378            {
10379                Ok(token) => token,
10380                Err(e) => match dlg.token(e) {
10381                    Ok(token) => token,
10382                    Err(e) => {
10383                        dlg.finished(false);
10384                        return Err(common::Error::MissingToken(e));
10385                    }
10386                },
10387            };
10388            let mut req_result = {
10389                let client = &self.hub.client;
10390                dlg.pre_request();
10391                let mut req_builder = hyper::Request::builder()
10392                    .method(hyper::Method::DELETE)
10393                    .uri(url.as_str())
10394                    .header(USER_AGENT, self.hub._user_agent.clone());
10395
10396                if let Some(token) = token.as_ref() {
10397                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10398                }
10399
10400                let request = req_builder
10401                    .header(CONTENT_LENGTH, 0_u64)
10402                    .body(common::to_body::<String>(None));
10403
10404                client.request(request.unwrap()).await
10405            };
10406
10407            match req_result {
10408                Err(err) => {
10409                    if let common::Retry::After(d) = dlg.http_error(&err) {
10410                        sleep(d).await;
10411                        continue;
10412                    }
10413                    dlg.finished(false);
10414                    return Err(common::Error::HttpError(err));
10415                }
10416                Ok(res) => {
10417                    let (mut parts, body) = res.into_parts();
10418                    let mut body = common::Body::new(body);
10419                    if !parts.status.is_success() {
10420                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10421                        let error = serde_json::from_str(&common::to_string(&bytes));
10422                        let response = common::to_response(parts, bytes.into());
10423
10424                        if let common::Retry::After(d) =
10425                            dlg.http_failure(&response, error.as_ref().ok())
10426                        {
10427                            sleep(d).await;
10428                            continue;
10429                        }
10430
10431                        dlg.finished(false);
10432
10433                        return Err(match error {
10434                            Ok(value) => common::Error::BadRequest(value),
10435                            _ => common::Error::Failure(response),
10436                        });
10437                    }
10438                    let response = {
10439                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10440                        let encoded = common::to_string(&bytes);
10441                        match serde_json::from_str(&encoded) {
10442                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10443                            Err(error) => {
10444                                dlg.response_json_decode_error(&encoded, &error);
10445                                return Err(common::Error::JsonDecodeError(
10446                                    encoded.to_string(),
10447                                    error,
10448                                ));
10449                            }
10450                        }
10451                    };
10452
10453                    dlg.finished(true);
10454                    return Ok(response);
10455                }
10456            }
10457        }
10458    }
10459
10460    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
10461    ///
10462    /// Sets the *name* path property to the given value.
10463    ///
10464    /// Even though the property as already been set when instantiating this call,
10465    /// we provide this method for API completeness.
10466    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceDeleteCall<'a, C> {
10467        self._name = new_value.to_string();
10468        self
10469    }
10470    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10471    /// while executing the actual API request.
10472    ///
10473    /// ````text
10474    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10475    /// ````
10476    ///
10477    /// Sets the *delegate* property to the given value.
10478    pub fn delegate(
10479        mut self,
10480        new_value: &'a mut dyn common::Delegate,
10481    ) -> ProjectOccurrenceDeleteCall<'a, C> {
10482        self._delegate = Some(new_value);
10483        self
10484    }
10485
10486    /// Set any additional parameter of the query string used in the request.
10487    /// It should be used to set parameters which are not yet available through their own
10488    /// setters.
10489    ///
10490    /// Please note that this method must not be used to set any of the known parameters
10491    /// which have their own setter method. If done anyway, the request will fail.
10492    ///
10493    /// # Additional Parameters
10494    ///
10495    /// * *$.xgafv* (query-string) - V1 error format.
10496    /// * *access_token* (query-string) - OAuth access token.
10497    /// * *alt* (query-string) - Data format for response.
10498    /// * *callback* (query-string) - JSONP
10499    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10500    /// * *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.
10501    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10502    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10503    /// * *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.
10504    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10505    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10506    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceDeleteCall<'a, C>
10507    where
10508        T: AsRef<str>,
10509    {
10510        self._additional_params
10511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10512        self
10513    }
10514
10515    /// Identifies the authorization scope for the method you are building.
10516    ///
10517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10518    /// [`Scope::CloudPlatform`].
10519    ///
10520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10521    /// tokens for more than one scope.
10522    ///
10523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10525    /// sufficient, a read-write scope will do as well.
10526    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceDeleteCall<'a, C>
10527    where
10528        St: AsRef<str>,
10529    {
10530        self._scopes.insert(String::from(scope.as_ref()));
10531        self
10532    }
10533    /// Identifies the authorization scope(s) for the method you are building.
10534    ///
10535    /// See [`Self::add_scope()`] for details.
10536    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceDeleteCall<'a, C>
10537    where
10538        I: IntoIterator<Item = St>,
10539        St: AsRef<str>,
10540    {
10541        self._scopes
10542            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10543        self
10544    }
10545
10546    /// Removes all scopes, and no default scope will be used either.
10547    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10548    /// for details).
10549    pub fn clear_scopes(mut self) -> ProjectOccurrenceDeleteCall<'a, C> {
10550        self._scopes.clear();
10551        self
10552    }
10553}
10554
10555/// Gets the specified occurrence.
10556///
10557/// A builder for the *occurrences.get* method supported by a *project* resource.
10558/// It is not used directly, but through a [`ProjectMethods`] instance.
10559///
10560/// # Example
10561///
10562/// Instantiate a resource method builder
10563///
10564/// ```test_harness,no_run
10565/// # extern crate hyper;
10566/// # extern crate hyper_rustls;
10567/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10568/// # async fn dox() {
10569/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10570///
10571/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10573/// #     secret,
10574/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10575/// # ).build().await.unwrap();
10576///
10577/// # let client = hyper_util::client::legacy::Client::builder(
10578/// #     hyper_util::rt::TokioExecutor::new()
10579/// # )
10580/// # .build(
10581/// #     hyper_rustls::HttpsConnectorBuilder::new()
10582/// #         .with_native_roots()
10583/// #         .unwrap()
10584/// #         .https_or_http()
10585/// #         .enable_http1()
10586/// #         .build()
10587/// # );
10588/// # let mut hub = ContainerAnalysis::new(client, auth);
10589/// // You can configure optional parameters by calling the respective setters at will, and
10590/// // execute the final call using `doit()`.
10591/// // Values shown here are possibly random and not representative !
10592/// let result = hub.projects().occurrences_get("name")
10593///              .doit().await;
10594/// # }
10595/// ```
10596pub struct ProjectOccurrenceGetCall<'a, C>
10597where
10598    C: 'a,
10599{
10600    hub: &'a ContainerAnalysis<C>,
10601    _name: String,
10602    _delegate: Option<&'a mut dyn common::Delegate>,
10603    _additional_params: HashMap<String, String>,
10604    _scopes: BTreeSet<String>,
10605}
10606
10607impl<'a, C> common::CallBuilder for ProjectOccurrenceGetCall<'a, C> {}
10608
10609impl<'a, C> ProjectOccurrenceGetCall<'a, C>
10610where
10611    C: common::Connector,
10612{
10613    /// Perform the operation you have build so far.
10614    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
10615        use std::borrow::Cow;
10616        use std::io::{Read, Seek};
10617
10618        use common::{url::Params, ToParts};
10619        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10620
10621        let mut dd = common::DefaultDelegate;
10622        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10623        dlg.begin(common::MethodInfo {
10624            id: "containeranalysis.projects.occurrences.get",
10625            http_method: hyper::Method::GET,
10626        });
10627
10628        for &field in ["alt", "name"].iter() {
10629            if self._additional_params.contains_key(field) {
10630                dlg.finished(false);
10631                return Err(common::Error::FieldClash(field));
10632            }
10633        }
10634
10635        let mut params = Params::with_capacity(3 + self._additional_params.len());
10636        params.push("name", self._name);
10637
10638        params.extend(self._additional_params.iter());
10639
10640        params.push("alt", "json");
10641        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10642        if self._scopes.is_empty() {
10643            self._scopes
10644                .insert(Scope::CloudPlatform.as_ref().to_string());
10645        }
10646
10647        #[allow(clippy::single_element_loop)]
10648        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10649            url = params.uri_replacement(url, param_name, find_this, true);
10650        }
10651        {
10652            let to_remove = ["name"];
10653            params.remove_params(&to_remove);
10654        }
10655
10656        let url = params.parse_with_url(&url);
10657
10658        loop {
10659            let token = match self
10660                .hub
10661                .auth
10662                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10663                .await
10664            {
10665                Ok(token) => token,
10666                Err(e) => match dlg.token(e) {
10667                    Ok(token) => token,
10668                    Err(e) => {
10669                        dlg.finished(false);
10670                        return Err(common::Error::MissingToken(e));
10671                    }
10672                },
10673            };
10674            let mut req_result = {
10675                let client = &self.hub.client;
10676                dlg.pre_request();
10677                let mut req_builder = hyper::Request::builder()
10678                    .method(hyper::Method::GET)
10679                    .uri(url.as_str())
10680                    .header(USER_AGENT, self.hub._user_agent.clone());
10681
10682                if let Some(token) = token.as_ref() {
10683                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10684                }
10685
10686                let request = req_builder
10687                    .header(CONTENT_LENGTH, 0_u64)
10688                    .body(common::to_body::<String>(None));
10689
10690                client.request(request.unwrap()).await
10691            };
10692
10693            match req_result {
10694                Err(err) => {
10695                    if let common::Retry::After(d) = dlg.http_error(&err) {
10696                        sleep(d).await;
10697                        continue;
10698                    }
10699                    dlg.finished(false);
10700                    return Err(common::Error::HttpError(err));
10701                }
10702                Ok(res) => {
10703                    let (mut parts, body) = res.into_parts();
10704                    let mut body = common::Body::new(body);
10705                    if !parts.status.is_success() {
10706                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10707                        let error = serde_json::from_str(&common::to_string(&bytes));
10708                        let response = common::to_response(parts, bytes.into());
10709
10710                        if let common::Retry::After(d) =
10711                            dlg.http_failure(&response, error.as_ref().ok())
10712                        {
10713                            sleep(d).await;
10714                            continue;
10715                        }
10716
10717                        dlg.finished(false);
10718
10719                        return Err(match error {
10720                            Ok(value) => common::Error::BadRequest(value),
10721                            _ => common::Error::Failure(response),
10722                        });
10723                    }
10724                    let response = {
10725                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10726                        let encoded = common::to_string(&bytes);
10727                        match serde_json::from_str(&encoded) {
10728                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10729                            Err(error) => {
10730                                dlg.response_json_decode_error(&encoded, &error);
10731                                return Err(common::Error::JsonDecodeError(
10732                                    encoded.to_string(),
10733                                    error,
10734                                ));
10735                            }
10736                        }
10737                    };
10738
10739                    dlg.finished(true);
10740                    return Ok(response);
10741                }
10742            }
10743        }
10744    }
10745
10746    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
10747    ///
10748    /// Sets the *name* path property to the given value.
10749    ///
10750    /// Even though the property as already been set when instantiating this call,
10751    /// we provide this method for API completeness.
10752    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetCall<'a, C> {
10753        self._name = new_value.to_string();
10754        self
10755    }
10756    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10757    /// while executing the actual API request.
10758    ///
10759    /// ````text
10760    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10761    /// ````
10762    ///
10763    /// Sets the *delegate* property to the given value.
10764    pub fn delegate(
10765        mut self,
10766        new_value: &'a mut dyn common::Delegate,
10767    ) -> ProjectOccurrenceGetCall<'a, C> {
10768        self._delegate = Some(new_value);
10769        self
10770    }
10771
10772    /// Set any additional parameter of the query string used in the request.
10773    /// It should be used to set parameters which are not yet available through their own
10774    /// setters.
10775    ///
10776    /// Please note that this method must not be used to set any of the known parameters
10777    /// which have their own setter method. If done anyway, the request will fail.
10778    ///
10779    /// # Additional Parameters
10780    ///
10781    /// * *$.xgafv* (query-string) - V1 error format.
10782    /// * *access_token* (query-string) - OAuth access token.
10783    /// * *alt* (query-string) - Data format for response.
10784    /// * *callback* (query-string) - JSONP
10785    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10786    /// * *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.
10787    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10788    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10789    /// * *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.
10790    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10791    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10792    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetCall<'a, C>
10793    where
10794        T: AsRef<str>,
10795    {
10796        self._additional_params
10797            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10798        self
10799    }
10800
10801    /// Identifies the authorization scope for the method you are building.
10802    ///
10803    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10804    /// [`Scope::CloudPlatform`].
10805    ///
10806    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10807    /// tokens for more than one scope.
10808    ///
10809    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10810    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10811    /// sufficient, a read-write scope will do as well.
10812    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetCall<'a, C>
10813    where
10814        St: AsRef<str>,
10815    {
10816        self._scopes.insert(String::from(scope.as_ref()));
10817        self
10818    }
10819    /// Identifies the authorization scope(s) for the method you are building.
10820    ///
10821    /// See [`Self::add_scope()`] for details.
10822    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetCall<'a, C>
10823    where
10824        I: IntoIterator<Item = St>,
10825        St: AsRef<str>,
10826    {
10827        self._scopes
10828            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10829        self
10830    }
10831
10832    /// Removes all scopes, and no default scope will be used either.
10833    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10834    /// for details).
10835    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetCall<'a, C> {
10836        self._scopes.clear();
10837        self
10838    }
10839}
10840
10841/// Gets the access control policy for a note or an occurrence resource. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
10842///
10843/// A builder for the *occurrences.getIamPolicy* method supported by a *project* resource.
10844/// It is not used directly, but through a [`ProjectMethods`] instance.
10845///
10846/// # Example
10847///
10848/// Instantiate a resource method builder
10849///
10850/// ```test_harness,no_run
10851/// # extern crate hyper;
10852/// # extern crate hyper_rustls;
10853/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10854/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
10855/// # async fn dox() {
10856/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10857///
10858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10860/// #     secret,
10861/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10862/// # ).build().await.unwrap();
10863///
10864/// # let client = hyper_util::client::legacy::Client::builder(
10865/// #     hyper_util::rt::TokioExecutor::new()
10866/// # )
10867/// # .build(
10868/// #     hyper_rustls::HttpsConnectorBuilder::new()
10869/// #         .with_native_roots()
10870/// #         .unwrap()
10871/// #         .https_or_http()
10872/// #         .enable_http1()
10873/// #         .build()
10874/// # );
10875/// # let mut hub = ContainerAnalysis::new(client, auth);
10876/// // As the method needs a request, you would usually fill it with the desired information
10877/// // into the respective structure. Some of the parts shown here might not be applicable !
10878/// // Values shown here are possibly random and not representative !
10879/// let mut req = GetIamPolicyRequest::default();
10880///
10881/// // You can configure optional parameters by calling the respective setters at will, and
10882/// // execute the final call using `doit()`.
10883/// // Values shown here are possibly random and not representative !
10884/// let result = hub.projects().occurrences_get_iam_policy(req, "resource")
10885///              .doit().await;
10886/// # }
10887/// ```
10888pub struct ProjectOccurrenceGetIamPolicyCall<'a, C>
10889where
10890    C: 'a,
10891{
10892    hub: &'a ContainerAnalysis<C>,
10893    _request: GetIamPolicyRequest,
10894    _resource: String,
10895    _delegate: Option<&'a mut dyn common::Delegate>,
10896    _additional_params: HashMap<String, String>,
10897    _scopes: BTreeSet<String>,
10898}
10899
10900impl<'a, C> common::CallBuilder for ProjectOccurrenceGetIamPolicyCall<'a, C> {}
10901
10902impl<'a, C> ProjectOccurrenceGetIamPolicyCall<'a, C>
10903where
10904    C: common::Connector,
10905{
10906    /// Perform the operation you have build so far.
10907    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10908        use std::borrow::Cow;
10909        use std::io::{Read, Seek};
10910
10911        use common::{url::Params, ToParts};
10912        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10913
10914        let mut dd = common::DefaultDelegate;
10915        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10916        dlg.begin(common::MethodInfo {
10917            id: "containeranalysis.projects.occurrences.getIamPolicy",
10918            http_method: hyper::Method::POST,
10919        });
10920
10921        for &field in ["alt", "resource"].iter() {
10922            if self._additional_params.contains_key(field) {
10923                dlg.finished(false);
10924                return Err(common::Error::FieldClash(field));
10925            }
10926        }
10927
10928        let mut params = Params::with_capacity(4 + self._additional_params.len());
10929        params.push("resource", self._resource);
10930
10931        params.extend(self._additional_params.iter());
10932
10933        params.push("alt", "json");
10934        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
10935        if self._scopes.is_empty() {
10936            self._scopes
10937                .insert(Scope::CloudPlatform.as_ref().to_string());
10938        }
10939
10940        #[allow(clippy::single_element_loop)]
10941        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10942            url = params.uri_replacement(url, param_name, find_this, true);
10943        }
10944        {
10945            let to_remove = ["resource"];
10946            params.remove_params(&to_remove);
10947        }
10948
10949        let url = params.parse_with_url(&url);
10950
10951        let mut json_mime_type = mime::APPLICATION_JSON;
10952        let mut request_value_reader = {
10953            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10954            common::remove_json_null_values(&mut value);
10955            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10956            serde_json::to_writer(&mut dst, &value).unwrap();
10957            dst
10958        };
10959        let request_size = request_value_reader
10960            .seek(std::io::SeekFrom::End(0))
10961            .unwrap();
10962        request_value_reader
10963            .seek(std::io::SeekFrom::Start(0))
10964            .unwrap();
10965
10966        loop {
10967            let token = match self
10968                .hub
10969                .auth
10970                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10971                .await
10972            {
10973                Ok(token) => token,
10974                Err(e) => match dlg.token(e) {
10975                    Ok(token) => token,
10976                    Err(e) => {
10977                        dlg.finished(false);
10978                        return Err(common::Error::MissingToken(e));
10979                    }
10980                },
10981            };
10982            request_value_reader
10983                .seek(std::io::SeekFrom::Start(0))
10984                .unwrap();
10985            let mut req_result = {
10986                let client = &self.hub.client;
10987                dlg.pre_request();
10988                let mut req_builder = hyper::Request::builder()
10989                    .method(hyper::Method::POST)
10990                    .uri(url.as_str())
10991                    .header(USER_AGENT, self.hub._user_agent.clone());
10992
10993                if let Some(token) = token.as_ref() {
10994                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10995                }
10996
10997                let request = req_builder
10998                    .header(CONTENT_TYPE, json_mime_type.to_string())
10999                    .header(CONTENT_LENGTH, request_size as u64)
11000                    .body(common::to_body(
11001                        request_value_reader.get_ref().clone().into(),
11002                    ));
11003
11004                client.request(request.unwrap()).await
11005            };
11006
11007            match req_result {
11008                Err(err) => {
11009                    if let common::Retry::After(d) = dlg.http_error(&err) {
11010                        sleep(d).await;
11011                        continue;
11012                    }
11013                    dlg.finished(false);
11014                    return Err(common::Error::HttpError(err));
11015                }
11016                Ok(res) => {
11017                    let (mut parts, body) = res.into_parts();
11018                    let mut body = common::Body::new(body);
11019                    if !parts.status.is_success() {
11020                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11021                        let error = serde_json::from_str(&common::to_string(&bytes));
11022                        let response = common::to_response(parts, bytes.into());
11023
11024                        if let common::Retry::After(d) =
11025                            dlg.http_failure(&response, error.as_ref().ok())
11026                        {
11027                            sleep(d).await;
11028                            continue;
11029                        }
11030
11031                        dlg.finished(false);
11032
11033                        return Err(match error {
11034                            Ok(value) => common::Error::BadRequest(value),
11035                            _ => common::Error::Failure(response),
11036                        });
11037                    }
11038                    let response = {
11039                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11040                        let encoded = common::to_string(&bytes);
11041                        match serde_json::from_str(&encoded) {
11042                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11043                            Err(error) => {
11044                                dlg.response_json_decode_error(&encoded, &error);
11045                                return Err(common::Error::JsonDecodeError(
11046                                    encoded.to_string(),
11047                                    error,
11048                                ));
11049                            }
11050                        }
11051                    };
11052
11053                    dlg.finished(true);
11054                    return Ok(response);
11055                }
11056            }
11057        }
11058    }
11059
11060    ///
11061    /// Sets the *request* property to the given value.
11062    ///
11063    /// Even though the property as already been set when instantiating this call,
11064    /// we provide this method for API completeness.
11065    pub fn request(
11066        mut self,
11067        new_value: GetIamPolicyRequest,
11068    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
11069        self._request = new_value;
11070        self
11071    }
11072    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
11073    ///
11074    /// Sets the *resource* path property to the given value.
11075    ///
11076    /// Even though the property as already been set when instantiating this call,
11077    /// we provide this method for API completeness.
11078    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
11079        self._resource = new_value.to_string();
11080        self
11081    }
11082    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11083    /// while executing the actual API request.
11084    ///
11085    /// ````text
11086    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11087    /// ````
11088    ///
11089    /// Sets the *delegate* property to the given value.
11090    pub fn delegate(
11091        mut self,
11092        new_value: &'a mut dyn common::Delegate,
11093    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
11094        self._delegate = Some(new_value);
11095        self
11096    }
11097
11098    /// Set any additional parameter of the query string used in the request.
11099    /// It should be used to set parameters which are not yet available through their own
11100    /// setters.
11101    ///
11102    /// Please note that this method must not be used to set any of the known parameters
11103    /// which have their own setter method. If done anyway, the request will fail.
11104    ///
11105    /// # Additional Parameters
11106    ///
11107    /// * *$.xgafv* (query-string) - V1 error format.
11108    /// * *access_token* (query-string) - OAuth access token.
11109    /// * *alt* (query-string) - Data format for response.
11110    /// * *callback* (query-string) - JSONP
11111    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11112    /// * *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.
11113    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11114    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11115    /// * *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.
11116    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11117    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11118    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
11119    where
11120        T: AsRef<str>,
11121    {
11122        self._additional_params
11123            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11124        self
11125    }
11126
11127    /// Identifies the authorization scope for the method you are building.
11128    ///
11129    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11130    /// [`Scope::CloudPlatform`].
11131    ///
11132    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11133    /// tokens for more than one scope.
11134    ///
11135    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11136    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11137    /// sufficient, a read-write scope will do as well.
11138    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
11139    where
11140        St: AsRef<str>,
11141    {
11142        self._scopes.insert(String::from(scope.as_ref()));
11143        self
11144    }
11145    /// Identifies the authorization scope(s) for the method you are building.
11146    ///
11147    /// See [`Self::add_scope()`] for details.
11148    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
11149    where
11150        I: IntoIterator<Item = St>,
11151        St: AsRef<str>,
11152    {
11153        self._scopes
11154            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11155        self
11156    }
11157
11158    /// Removes all scopes, and no default scope will be used either.
11159    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11160    /// for details).
11161    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
11162        self._scopes.clear();
11163        self
11164    }
11165}
11166
11167/// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
11168///
11169/// A builder for the *occurrences.getNotes* method supported by a *project* resource.
11170/// It is not used directly, but through a [`ProjectMethods`] instance.
11171///
11172/// # Example
11173///
11174/// Instantiate a resource method builder
11175///
11176/// ```test_harness,no_run
11177/// # extern crate hyper;
11178/// # extern crate hyper_rustls;
11179/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11180/// # async fn dox() {
11181/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11182///
11183/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11184/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11185/// #     secret,
11186/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11187/// # ).build().await.unwrap();
11188///
11189/// # let client = hyper_util::client::legacy::Client::builder(
11190/// #     hyper_util::rt::TokioExecutor::new()
11191/// # )
11192/// # .build(
11193/// #     hyper_rustls::HttpsConnectorBuilder::new()
11194/// #         .with_native_roots()
11195/// #         .unwrap()
11196/// #         .https_or_http()
11197/// #         .enable_http1()
11198/// #         .build()
11199/// # );
11200/// # let mut hub = ContainerAnalysis::new(client, auth);
11201/// // You can configure optional parameters by calling the respective setters at will, and
11202/// // execute the final call using `doit()`.
11203/// // Values shown here are possibly random and not representative !
11204/// let result = hub.projects().occurrences_get_notes("name")
11205///              .doit().await;
11206/// # }
11207/// ```
11208pub struct ProjectOccurrenceGetNoteCall<'a, C>
11209where
11210    C: 'a,
11211{
11212    hub: &'a ContainerAnalysis<C>,
11213    _name: String,
11214    _delegate: Option<&'a mut dyn common::Delegate>,
11215    _additional_params: HashMap<String, String>,
11216    _scopes: BTreeSet<String>,
11217}
11218
11219impl<'a, C> common::CallBuilder for ProjectOccurrenceGetNoteCall<'a, C> {}
11220
11221impl<'a, C> ProjectOccurrenceGetNoteCall<'a, C>
11222where
11223    C: common::Connector,
11224{
11225    /// Perform the operation you have build so far.
11226    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
11227        use std::borrow::Cow;
11228        use std::io::{Read, Seek};
11229
11230        use common::{url::Params, ToParts};
11231        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11232
11233        let mut dd = common::DefaultDelegate;
11234        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11235        dlg.begin(common::MethodInfo {
11236            id: "containeranalysis.projects.occurrences.getNotes",
11237            http_method: hyper::Method::GET,
11238        });
11239
11240        for &field in ["alt", "name"].iter() {
11241            if self._additional_params.contains_key(field) {
11242                dlg.finished(false);
11243                return Err(common::Error::FieldClash(field));
11244            }
11245        }
11246
11247        let mut params = Params::with_capacity(3 + self._additional_params.len());
11248        params.push("name", self._name);
11249
11250        params.extend(self._additional_params.iter());
11251
11252        params.push("alt", "json");
11253        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/notes";
11254        if self._scopes.is_empty() {
11255            self._scopes
11256                .insert(Scope::CloudPlatform.as_ref().to_string());
11257        }
11258
11259        #[allow(clippy::single_element_loop)]
11260        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11261            url = params.uri_replacement(url, param_name, find_this, true);
11262        }
11263        {
11264            let to_remove = ["name"];
11265            params.remove_params(&to_remove);
11266        }
11267
11268        let url = params.parse_with_url(&url);
11269
11270        loop {
11271            let token = match self
11272                .hub
11273                .auth
11274                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11275                .await
11276            {
11277                Ok(token) => token,
11278                Err(e) => match dlg.token(e) {
11279                    Ok(token) => token,
11280                    Err(e) => {
11281                        dlg.finished(false);
11282                        return Err(common::Error::MissingToken(e));
11283                    }
11284                },
11285            };
11286            let mut req_result = {
11287                let client = &self.hub.client;
11288                dlg.pre_request();
11289                let mut req_builder = hyper::Request::builder()
11290                    .method(hyper::Method::GET)
11291                    .uri(url.as_str())
11292                    .header(USER_AGENT, self.hub._user_agent.clone());
11293
11294                if let Some(token) = token.as_ref() {
11295                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11296                }
11297
11298                let request = req_builder
11299                    .header(CONTENT_LENGTH, 0_u64)
11300                    .body(common::to_body::<String>(None));
11301
11302                client.request(request.unwrap()).await
11303            };
11304
11305            match req_result {
11306                Err(err) => {
11307                    if let common::Retry::After(d) = dlg.http_error(&err) {
11308                        sleep(d).await;
11309                        continue;
11310                    }
11311                    dlg.finished(false);
11312                    return Err(common::Error::HttpError(err));
11313                }
11314                Ok(res) => {
11315                    let (mut parts, body) = res.into_parts();
11316                    let mut body = common::Body::new(body);
11317                    if !parts.status.is_success() {
11318                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11319                        let error = serde_json::from_str(&common::to_string(&bytes));
11320                        let response = common::to_response(parts, bytes.into());
11321
11322                        if let common::Retry::After(d) =
11323                            dlg.http_failure(&response, error.as_ref().ok())
11324                        {
11325                            sleep(d).await;
11326                            continue;
11327                        }
11328
11329                        dlg.finished(false);
11330
11331                        return Err(match error {
11332                            Ok(value) => common::Error::BadRequest(value),
11333                            _ => common::Error::Failure(response),
11334                        });
11335                    }
11336                    let response = {
11337                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11338                        let encoded = common::to_string(&bytes);
11339                        match serde_json::from_str(&encoded) {
11340                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11341                            Err(error) => {
11342                                dlg.response_json_decode_error(&encoded, &error);
11343                                return Err(common::Error::JsonDecodeError(
11344                                    encoded.to_string(),
11345                                    error,
11346                                ));
11347                            }
11348                        }
11349                    };
11350
11351                    dlg.finished(true);
11352                    return Ok(response);
11353                }
11354            }
11355        }
11356    }
11357
11358    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
11359    ///
11360    /// Sets the *name* path property to the given value.
11361    ///
11362    /// Even though the property as already been set when instantiating this call,
11363    /// we provide this method for API completeness.
11364    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetNoteCall<'a, C> {
11365        self._name = new_value.to_string();
11366        self
11367    }
11368    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11369    /// while executing the actual API request.
11370    ///
11371    /// ````text
11372    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11373    /// ````
11374    ///
11375    /// Sets the *delegate* property to the given value.
11376    pub fn delegate(
11377        mut self,
11378        new_value: &'a mut dyn common::Delegate,
11379    ) -> ProjectOccurrenceGetNoteCall<'a, C> {
11380        self._delegate = Some(new_value);
11381        self
11382    }
11383
11384    /// Set any additional parameter of the query string used in the request.
11385    /// It should be used to set parameters which are not yet available through their own
11386    /// setters.
11387    ///
11388    /// Please note that this method must not be used to set any of the known parameters
11389    /// which have their own setter method. If done anyway, the request will fail.
11390    ///
11391    /// # Additional Parameters
11392    ///
11393    /// * *$.xgafv* (query-string) - V1 error format.
11394    /// * *access_token* (query-string) - OAuth access token.
11395    /// * *alt* (query-string) - Data format for response.
11396    /// * *callback* (query-string) - JSONP
11397    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11398    /// * *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.
11399    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11400    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11401    /// * *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.
11402    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11403    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11404    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetNoteCall<'a, C>
11405    where
11406        T: AsRef<str>,
11407    {
11408        self._additional_params
11409            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11410        self
11411    }
11412
11413    /// Identifies the authorization scope for the method you are building.
11414    ///
11415    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11416    /// [`Scope::CloudPlatform`].
11417    ///
11418    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11419    /// tokens for more than one scope.
11420    ///
11421    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11422    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11423    /// sufficient, a read-write scope will do as well.
11424    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetNoteCall<'a, C>
11425    where
11426        St: AsRef<str>,
11427    {
11428        self._scopes.insert(String::from(scope.as_ref()));
11429        self
11430    }
11431    /// Identifies the authorization scope(s) for the method you are building.
11432    ///
11433    /// See [`Self::add_scope()`] for details.
11434    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetNoteCall<'a, C>
11435    where
11436        I: IntoIterator<Item = St>,
11437        St: AsRef<str>,
11438    {
11439        self._scopes
11440            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11441        self
11442    }
11443
11444    /// Removes all scopes, and no default scope will be used either.
11445    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11446    /// for details).
11447    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetNoteCall<'a, C> {
11448        self._scopes.clear();
11449        self
11450    }
11451}
11452
11453/// Gets a summary of the number and severity of occurrences.
11454///
11455/// A builder for the *occurrences.getVulnerabilitySummary* method supported by a *project* resource.
11456/// It is not used directly, but through a [`ProjectMethods`] instance.
11457///
11458/// # Example
11459///
11460/// Instantiate a resource method builder
11461///
11462/// ```test_harness,no_run
11463/// # extern crate hyper;
11464/// # extern crate hyper_rustls;
11465/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11466/// # async fn dox() {
11467/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11468///
11469/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11470/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11471/// #     secret,
11472/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11473/// # ).build().await.unwrap();
11474///
11475/// # let client = hyper_util::client::legacy::Client::builder(
11476/// #     hyper_util::rt::TokioExecutor::new()
11477/// # )
11478/// # .build(
11479/// #     hyper_rustls::HttpsConnectorBuilder::new()
11480/// #         .with_native_roots()
11481/// #         .unwrap()
11482/// #         .https_or_http()
11483/// #         .enable_http1()
11484/// #         .build()
11485/// # );
11486/// # let mut hub = ContainerAnalysis::new(client, auth);
11487/// // You can configure optional parameters by calling the respective setters at will, and
11488/// // execute the final call using `doit()`.
11489/// // Values shown here are possibly random and not representative !
11490/// let result = hub.projects().occurrences_get_vulnerability_summary("parent")
11491///              .filter("erat")
11492///              .doit().await;
11493/// # }
11494/// ```
11495pub struct ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
11496where
11497    C: 'a,
11498{
11499    hub: &'a ContainerAnalysis<C>,
11500    _parent: String,
11501    _filter: Option<String>,
11502    _delegate: Option<&'a mut dyn common::Delegate>,
11503    _additional_params: HashMap<String, String>,
11504    _scopes: BTreeSet<String>,
11505}
11506
11507impl<'a, C> common::CallBuilder for ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {}
11508
11509impl<'a, C> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
11510where
11511    C: common::Connector,
11512{
11513    /// Perform the operation you have build so far.
11514    pub async fn doit(
11515        mut self,
11516    ) -> common::Result<(common::Response, VulnerabilityOccurrencesSummary)> {
11517        use std::borrow::Cow;
11518        use std::io::{Read, Seek};
11519
11520        use common::{url::Params, ToParts};
11521        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11522
11523        let mut dd = common::DefaultDelegate;
11524        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11525        dlg.begin(common::MethodInfo {
11526            id: "containeranalysis.projects.occurrences.getVulnerabilitySummary",
11527            http_method: hyper::Method::GET,
11528        });
11529
11530        for &field in ["alt", "parent", "filter"].iter() {
11531            if self._additional_params.contains_key(field) {
11532                dlg.finished(false);
11533                return Err(common::Error::FieldClash(field));
11534            }
11535        }
11536
11537        let mut params = Params::with_capacity(4 + self._additional_params.len());
11538        params.push("parent", self._parent);
11539        if let Some(value) = self._filter.as_ref() {
11540            params.push("filter", value);
11541        }
11542
11543        params.extend(self._additional_params.iter());
11544
11545        params.push("alt", "json");
11546        let mut url =
11547            self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:vulnerabilitySummary";
11548        if self._scopes.is_empty() {
11549            self._scopes
11550                .insert(Scope::CloudPlatform.as_ref().to_string());
11551        }
11552
11553        #[allow(clippy::single_element_loop)]
11554        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11555            url = params.uri_replacement(url, param_name, find_this, true);
11556        }
11557        {
11558            let to_remove = ["parent"];
11559            params.remove_params(&to_remove);
11560        }
11561
11562        let url = params.parse_with_url(&url);
11563
11564        loop {
11565            let token = match self
11566                .hub
11567                .auth
11568                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11569                .await
11570            {
11571                Ok(token) => token,
11572                Err(e) => match dlg.token(e) {
11573                    Ok(token) => token,
11574                    Err(e) => {
11575                        dlg.finished(false);
11576                        return Err(common::Error::MissingToken(e));
11577                    }
11578                },
11579            };
11580            let mut req_result = {
11581                let client = &self.hub.client;
11582                dlg.pre_request();
11583                let mut req_builder = hyper::Request::builder()
11584                    .method(hyper::Method::GET)
11585                    .uri(url.as_str())
11586                    .header(USER_AGENT, self.hub._user_agent.clone());
11587
11588                if let Some(token) = token.as_ref() {
11589                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11590                }
11591
11592                let request = req_builder
11593                    .header(CONTENT_LENGTH, 0_u64)
11594                    .body(common::to_body::<String>(None));
11595
11596                client.request(request.unwrap()).await
11597            };
11598
11599            match req_result {
11600                Err(err) => {
11601                    if let common::Retry::After(d) = dlg.http_error(&err) {
11602                        sleep(d).await;
11603                        continue;
11604                    }
11605                    dlg.finished(false);
11606                    return Err(common::Error::HttpError(err));
11607                }
11608                Ok(res) => {
11609                    let (mut parts, body) = res.into_parts();
11610                    let mut body = common::Body::new(body);
11611                    if !parts.status.is_success() {
11612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11613                        let error = serde_json::from_str(&common::to_string(&bytes));
11614                        let response = common::to_response(parts, bytes.into());
11615
11616                        if let common::Retry::After(d) =
11617                            dlg.http_failure(&response, error.as_ref().ok())
11618                        {
11619                            sleep(d).await;
11620                            continue;
11621                        }
11622
11623                        dlg.finished(false);
11624
11625                        return Err(match error {
11626                            Ok(value) => common::Error::BadRequest(value),
11627                            _ => common::Error::Failure(response),
11628                        });
11629                    }
11630                    let response = {
11631                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11632                        let encoded = common::to_string(&bytes);
11633                        match serde_json::from_str(&encoded) {
11634                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11635                            Err(error) => {
11636                                dlg.response_json_decode_error(&encoded, &error);
11637                                return Err(common::Error::JsonDecodeError(
11638                                    encoded.to_string(),
11639                                    error,
11640                                ));
11641                            }
11642                        }
11643                    };
11644
11645                    dlg.finished(true);
11646                    return Ok(response);
11647                }
11648            }
11649        }
11650    }
11651
11652    /// Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
11653    ///
11654    /// Sets the *parent* path property to the given value.
11655    ///
11656    /// Even though the property as already been set when instantiating this call,
11657    /// we provide this method for API completeness.
11658    pub fn parent(
11659        mut self,
11660        new_value: &str,
11661    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
11662        self._parent = new_value.to_string();
11663        self
11664    }
11665    /// The filter expression.
11666    ///
11667    /// Sets the *filter* query property to the given value.
11668    pub fn filter(
11669        mut self,
11670        new_value: &str,
11671    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
11672        self._filter = Some(new_value.to_string());
11673        self
11674    }
11675    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11676    /// while executing the actual API request.
11677    ///
11678    /// ````text
11679    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11680    /// ````
11681    ///
11682    /// Sets the *delegate* property to the given value.
11683    pub fn delegate(
11684        mut self,
11685        new_value: &'a mut dyn common::Delegate,
11686    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
11687        self._delegate = Some(new_value);
11688        self
11689    }
11690
11691    /// Set any additional parameter of the query string used in the request.
11692    /// It should be used to set parameters which are not yet available through their own
11693    /// setters.
11694    ///
11695    /// Please note that this method must not be used to set any of the known parameters
11696    /// which have their own setter method. If done anyway, the request will fail.
11697    ///
11698    /// # Additional Parameters
11699    ///
11700    /// * *$.xgafv* (query-string) - V1 error format.
11701    /// * *access_token* (query-string) - OAuth access token.
11702    /// * *alt* (query-string) - Data format for response.
11703    /// * *callback* (query-string) - JSONP
11704    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11705    /// * *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.
11706    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11707    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11708    /// * *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.
11709    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11710    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11711    pub fn param<T>(
11712        mut self,
11713        name: T,
11714        value: T,
11715    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
11716    where
11717        T: AsRef<str>,
11718    {
11719        self._additional_params
11720            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11721        self
11722    }
11723
11724    /// Identifies the authorization scope for the method you are building.
11725    ///
11726    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11727    /// [`Scope::CloudPlatform`].
11728    ///
11729    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11730    /// tokens for more than one scope.
11731    ///
11732    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11733    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11734    /// sufficient, a read-write scope will do as well.
11735    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
11736    where
11737        St: AsRef<str>,
11738    {
11739        self._scopes.insert(String::from(scope.as_ref()));
11740        self
11741    }
11742    /// Identifies the authorization scope(s) for the method you are building.
11743    ///
11744    /// See [`Self::add_scope()`] for details.
11745    pub fn add_scopes<I, St>(
11746        mut self,
11747        scopes: I,
11748    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
11749    where
11750        I: IntoIterator<Item = St>,
11751        St: AsRef<str>,
11752    {
11753        self._scopes
11754            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11755        self
11756    }
11757
11758    /// Removes all scopes, and no default scope will be used either.
11759    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11760    /// for details).
11761    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
11762        self._scopes.clear();
11763        self
11764    }
11765}
11766
11767/// Lists occurrences for the specified project.
11768///
11769/// A builder for the *occurrences.list* method supported by a *project* resource.
11770/// It is not used directly, but through a [`ProjectMethods`] instance.
11771///
11772/// # Example
11773///
11774/// Instantiate a resource method builder
11775///
11776/// ```test_harness,no_run
11777/// # extern crate hyper;
11778/// # extern crate hyper_rustls;
11779/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11780/// # async fn dox() {
11781/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11782///
11783/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11784/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11785/// #     secret,
11786/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11787/// # ).build().await.unwrap();
11788///
11789/// # let client = hyper_util::client::legacy::Client::builder(
11790/// #     hyper_util::rt::TokioExecutor::new()
11791/// # )
11792/// # .build(
11793/// #     hyper_rustls::HttpsConnectorBuilder::new()
11794/// #         .with_native_roots()
11795/// #         .unwrap()
11796/// #         .https_or_http()
11797/// #         .enable_http1()
11798/// #         .build()
11799/// # );
11800/// # let mut hub = ContainerAnalysis::new(client, auth);
11801/// // You can configure optional parameters by calling the respective setters at will, and
11802/// // execute the final call using `doit()`.
11803/// // Values shown here are possibly random and not representative !
11804/// let result = hub.projects().occurrences_list("parent")
11805///              .page_token("duo")
11806///              .page_size(-34)
11807///              .filter("et")
11808///              .doit().await;
11809/// # }
11810/// ```
11811pub struct ProjectOccurrenceListCall<'a, C>
11812where
11813    C: 'a,
11814{
11815    hub: &'a ContainerAnalysis<C>,
11816    _parent: String,
11817    _page_token: Option<String>,
11818    _page_size: Option<i32>,
11819    _filter: Option<String>,
11820    _delegate: Option<&'a mut dyn common::Delegate>,
11821    _additional_params: HashMap<String, String>,
11822    _scopes: BTreeSet<String>,
11823}
11824
11825impl<'a, C> common::CallBuilder for ProjectOccurrenceListCall<'a, C> {}
11826
11827impl<'a, C> ProjectOccurrenceListCall<'a, C>
11828where
11829    C: common::Connector,
11830{
11831    /// Perform the operation you have build so far.
11832    pub async fn doit(mut self) -> common::Result<(common::Response, ListOccurrencesResponse)> {
11833        use std::borrow::Cow;
11834        use std::io::{Read, Seek};
11835
11836        use common::{url::Params, ToParts};
11837        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11838
11839        let mut dd = common::DefaultDelegate;
11840        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11841        dlg.begin(common::MethodInfo {
11842            id: "containeranalysis.projects.occurrences.list",
11843            http_method: hyper::Method::GET,
11844        });
11845
11846        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
11847            if self._additional_params.contains_key(field) {
11848                dlg.finished(false);
11849                return Err(common::Error::FieldClash(field));
11850            }
11851        }
11852
11853        let mut params = Params::with_capacity(6 + self._additional_params.len());
11854        params.push("parent", self._parent);
11855        if let Some(value) = self._page_token.as_ref() {
11856            params.push("pageToken", value);
11857        }
11858        if let Some(value) = self._page_size.as_ref() {
11859            params.push("pageSize", value.to_string());
11860        }
11861        if let Some(value) = self._filter.as_ref() {
11862            params.push("filter", value);
11863        }
11864
11865        params.extend(self._additional_params.iter());
11866
11867        params.push("alt", "json");
11868        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
11869        if self._scopes.is_empty() {
11870            self._scopes
11871                .insert(Scope::CloudPlatform.as_ref().to_string());
11872        }
11873
11874        #[allow(clippy::single_element_loop)]
11875        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11876            url = params.uri_replacement(url, param_name, find_this, true);
11877        }
11878        {
11879            let to_remove = ["parent"];
11880            params.remove_params(&to_remove);
11881        }
11882
11883        let url = params.parse_with_url(&url);
11884
11885        loop {
11886            let token = match self
11887                .hub
11888                .auth
11889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11890                .await
11891            {
11892                Ok(token) => token,
11893                Err(e) => match dlg.token(e) {
11894                    Ok(token) => token,
11895                    Err(e) => {
11896                        dlg.finished(false);
11897                        return Err(common::Error::MissingToken(e));
11898                    }
11899                },
11900            };
11901            let mut req_result = {
11902                let client = &self.hub.client;
11903                dlg.pre_request();
11904                let mut req_builder = hyper::Request::builder()
11905                    .method(hyper::Method::GET)
11906                    .uri(url.as_str())
11907                    .header(USER_AGENT, self.hub._user_agent.clone());
11908
11909                if let Some(token) = token.as_ref() {
11910                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11911                }
11912
11913                let request = req_builder
11914                    .header(CONTENT_LENGTH, 0_u64)
11915                    .body(common::to_body::<String>(None));
11916
11917                client.request(request.unwrap()).await
11918            };
11919
11920            match req_result {
11921                Err(err) => {
11922                    if let common::Retry::After(d) = dlg.http_error(&err) {
11923                        sleep(d).await;
11924                        continue;
11925                    }
11926                    dlg.finished(false);
11927                    return Err(common::Error::HttpError(err));
11928                }
11929                Ok(res) => {
11930                    let (mut parts, body) = res.into_parts();
11931                    let mut body = common::Body::new(body);
11932                    if !parts.status.is_success() {
11933                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11934                        let error = serde_json::from_str(&common::to_string(&bytes));
11935                        let response = common::to_response(parts, bytes.into());
11936
11937                        if let common::Retry::After(d) =
11938                            dlg.http_failure(&response, error.as_ref().ok())
11939                        {
11940                            sleep(d).await;
11941                            continue;
11942                        }
11943
11944                        dlg.finished(false);
11945
11946                        return Err(match error {
11947                            Ok(value) => common::Error::BadRequest(value),
11948                            _ => common::Error::Failure(response),
11949                        });
11950                    }
11951                    let response = {
11952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11953                        let encoded = common::to_string(&bytes);
11954                        match serde_json::from_str(&encoded) {
11955                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11956                            Err(error) => {
11957                                dlg.response_json_decode_error(&encoded, &error);
11958                                return Err(common::Error::JsonDecodeError(
11959                                    encoded.to_string(),
11960                                    error,
11961                                ));
11962                            }
11963                        }
11964                    };
11965
11966                    dlg.finished(true);
11967                    return Ok(response);
11968                }
11969            }
11970        }
11971    }
11972
11973    /// Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
11974    ///
11975    /// Sets the *parent* path property to the given value.
11976    ///
11977    /// Even though the property as already been set when instantiating this call,
11978    /// we provide this method for API completeness.
11979    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
11980        self._parent = new_value.to_string();
11981        self
11982    }
11983    /// Token to provide to skip to a particular spot in the list.
11984    ///
11985    /// Sets the *page token* query property to the given value.
11986    pub fn page_token(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
11987        self._page_token = Some(new_value.to_string());
11988        self
11989    }
11990    /// Number of occurrences to return in the list. Must be positive. Max allowed page size is 1000. If not specified, page size defaults to 20.
11991    ///
11992    /// Sets the *page size* query property to the given value.
11993    pub fn page_size(mut self, new_value: i32) -> ProjectOccurrenceListCall<'a, C> {
11994        self._page_size = Some(new_value);
11995        self
11996    }
11997    /// The filter expression.
11998    ///
11999    /// Sets the *filter* query property to the given value.
12000    pub fn filter(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
12001        self._filter = Some(new_value.to_string());
12002        self
12003    }
12004    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12005    /// while executing the actual API request.
12006    ///
12007    /// ````text
12008    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12009    /// ````
12010    ///
12011    /// Sets the *delegate* property to the given value.
12012    pub fn delegate(
12013        mut self,
12014        new_value: &'a mut dyn common::Delegate,
12015    ) -> ProjectOccurrenceListCall<'a, C> {
12016        self._delegate = Some(new_value);
12017        self
12018    }
12019
12020    /// Set any additional parameter of the query string used in the request.
12021    /// It should be used to set parameters which are not yet available through their own
12022    /// setters.
12023    ///
12024    /// Please note that this method must not be used to set any of the known parameters
12025    /// which have their own setter method. If done anyway, the request will fail.
12026    ///
12027    /// # Additional Parameters
12028    ///
12029    /// * *$.xgafv* (query-string) - V1 error format.
12030    /// * *access_token* (query-string) - OAuth access token.
12031    /// * *alt* (query-string) - Data format for response.
12032    /// * *callback* (query-string) - JSONP
12033    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12034    /// * *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.
12035    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12036    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12037    /// * *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.
12038    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12039    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12040    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceListCall<'a, C>
12041    where
12042        T: AsRef<str>,
12043    {
12044        self._additional_params
12045            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12046        self
12047    }
12048
12049    /// Identifies the authorization scope for the method you are building.
12050    ///
12051    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12052    /// [`Scope::CloudPlatform`].
12053    ///
12054    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12055    /// tokens for more than one scope.
12056    ///
12057    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12058    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12059    /// sufficient, a read-write scope will do as well.
12060    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceListCall<'a, C>
12061    where
12062        St: AsRef<str>,
12063    {
12064        self._scopes.insert(String::from(scope.as_ref()));
12065        self
12066    }
12067    /// Identifies the authorization scope(s) for the method you are building.
12068    ///
12069    /// See [`Self::add_scope()`] for details.
12070    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceListCall<'a, C>
12071    where
12072        I: IntoIterator<Item = St>,
12073        St: AsRef<str>,
12074    {
12075        self._scopes
12076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12077        self
12078    }
12079
12080    /// Removes all scopes, and no default scope will be used either.
12081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12082    /// for details).
12083    pub fn clear_scopes(mut self) -> ProjectOccurrenceListCall<'a, C> {
12084        self._scopes.clear();
12085        self
12086    }
12087}
12088
12089/// Updates the specified occurrence.
12090///
12091/// A builder for the *occurrences.patch* method supported by a *project* resource.
12092/// It is not used directly, but through a [`ProjectMethods`] instance.
12093///
12094/// # Example
12095///
12096/// Instantiate a resource method builder
12097///
12098/// ```test_harness,no_run
12099/// # extern crate hyper;
12100/// # extern crate hyper_rustls;
12101/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
12102/// use containeranalysis1_beta1::api::Occurrence;
12103/// # async fn dox() {
12104/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12105///
12106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12108/// #     secret,
12109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12110/// # ).build().await.unwrap();
12111///
12112/// # let client = hyper_util::client::legacy::Client::builder(
12113/// #     hyper_util::rt::TokioExecutor::new()
12114/// # )
12115/// # .build(
12116/// #     hyper_rustls::HttpsConnectorBuilder::new()
12117/// #         .with_native_roots()
12118/// #         .unwrap()
12119/// #         .https_or_http()
12120/// #         .enable_http1()
12121/// #         .build()
12122/// # );
12123/// # let mut hub = ContainerAnalysis::new(client, auth);
12124/// // As the method needs a request, you would usually fill it with the desired information
12125/// // into the respective structure. Some of the parts shown here might not be applicable !
12126/// // Values shown here are possibly random and not representative !
12127/// let mut req = Occurrence::default();
12128///
12129/// // You can configure optional parameters by calling the respective setters at will, and
12130/// // execute the final call using `doit()`.
12131/// // Values shown here are possibly random and not representative !
12132/// let result = hub.projects().occurrences_patch(req, "name")
12133///              .update_mask(FieldMask::new::<&str>(&[]))
12134///              .doit().await;
12135/// # }
12136/// ```
12137pub struct ProjectOccurrencePatchCall<'a, C>
12138where
12139    C: 'a,
12140{
12141    hub: &'a ContainerAnalysis<C>,
12142    _request: Occurrence,
12143    _name: String,
12144    _update_mask: Option<common::FieldMask>,
12145    _delegate: Option<&'a mut dyn common::Delegate>,
12146    _additional_params: HashMap<String, String>,
12147    _scopes: BTreeSet<String>,
12148}
12149
12150impl<'a, C> common::CallBuilder for ProjectOccurrencePatchCall<'a, C> {}
12151
12152impl<'a, C> ProjectOccurrencePatchCall<'a, C>
12153where
12154    C: common::Connector,
12155{
12156    /// Perform the operation you have build so far.
12157    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
12158        use std::borrow::Cow;
12159        use std::io::{Read, Seek};
12160
12161        use common::{url::Params, ToParts};
12162        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12163
12164        let mut dd = common::DefaultDelegate;
12165        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12166        dlg.begin(common::MethodInfo {
12167            id: "containeranalysis.projects.occurrences.patch",
12168            http_method: hyper::Method::PATCH,
12169        });
12170
12171        for &field in ["alt", "name", "updateMask"].iter() {
12172            if self._additional_params.contains_key(field) {
12173                dlg.finished(false);
12174                return Err(common::Error::FieldClash(field));
12175            }
12176        }
12177
12178        let mut params = Params::with_capacity(5 + self._additional_params.len());
12179        params.push("name", self._name);
12180        if let Some(value) = self._update_mask.as_ref() {
12181            params.push("updateMask", value.to_string());
12182        }
12183
12184        params.extend(self._additional_params.iter());
12185
12186        params.push("alt", "json");
12187        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12188        if self._scopes.is_empty() {
12189            self._scopes
12190                .insert(Scope::CloudPlatform.as_ref().to_string());
12191        }
12192
12193        #[allow(clippy::single_element_loop)]
12194        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12195            url = params.uri_replacement(url, param_name, find_this, true);
12196        }
12197        {
12198            let to_remove = ["name"];
12199            params.remove_params(&to_remove);
12200        }
12201
12202        let url = params.parse_with_url(&url);
12203
12204        let mut json_mime_type = mime::APPLICATION_JSON;
12205        let mut request_value_reader = {
12206            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12207            common::remove_json_null_values(&mut value);
12208            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12209            serde_json::to_writer(&mut dst, &value).unwrap();
12210            dst
12211        };
12212        let request_size = request_value_reader
12213            .seek(std::io::SeekFrom::End(0))
12214            .unwrap();
12215        request_value_reader
12216            .seek(std::io::SeekFrom::Start(0))
12217            .unwrap();
12218
12219        loop {
12220            let token = match self
12221                .hub
12222                .auth
12223                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12224                .await
12225            {
12226                Ok(token) => token,
12227                Err(e) => match dlg.token(e) {
12228                    Ok(token) => token,
12229                    Err(e) => {
12230                        dlg.finished(false);
12231                        return Err(common::Error::MissingToken(e));
12232                    }
12233                },
12234            };
12235            request_value_reader
12236                .seek(std::io::SeekFrom::Start(0))
12237                .unwrap();
12238            let mut req_result = {
12239                let client = &self.hub.client;
12240                dlg.pre_request();
12241                let mut req_builder = hyper::Request::builder()
12242                    .method(hyper::Method::PATCH)
12243                    .uri(url.as_str())
12244                    .header(USER_AGENT, self.hub._user_agent.clone());
12245
12246                if let Some(token) = token.as_ref() {
12247                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12248                }
12249
12250                let request = req_builder
12251                    .header(CONTENT_TYPE, json_mime_type.to_string())
12252                    .header(CONTENT_LENGTH, request_size as u64)
12253                    .body(common::to_body(
12254                        request_value_reader.get_ref().clone().into(),
12255                    ));
12256
12257                client.request(request.unwrap()).await
12258            };
12259
12260            match req_result {
12261                Err(err) => {
12262                    if let common::Retry::After(d) = dlg.http_error(&err) {
12263                        sleep(d).await;
12264                        continue;
12265                    }
12266                    dlg.finished(false);
12267                    return Err(common::Error::HttpError(err));
12268                }
12269                Ok(res) => {
12270                    let (mut parts, body) = res.into_parts();
12271                    let mut body = common::Body::new(body);
12272                    if !parts.status.is_success() {
12273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12274                        let error = serde_json::from_str(&common::to_string(&bytes));
12275                        let response = common::to_response(parts, bytes.into());
12276
12277                        if let common::Retry::After(d) =
12278                            dlg.http_failure(&response, error.as_ref().ok())
12279                        {
12280                            sleep(d).await;
12281                            continue;
12282                        }
12283
12284                        dlg.finished(false);
12285
12286                        return Err(match error {
12287                            Ok(value) => common::Error::BadRequest(value),
12288                            _ => common::Error::Failure(response),
12289                        });
12290                    }
12291                    let response = {
12292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12293                        let encoded = common::to_string(&bytes);
12294                        match serde_json::from_str(&encoded) {
12295                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12296                            Err(error) => {
12297                                dlg.response_json_decode_error(&encoded, &error);
12298                                return Err(common::Error::JsonDecodeError(
12299                                    encoded.to_string(),
12300                                    error,
12301                                ));
12302                            }
12303                        }
12304                    };
12305
12306                    dlg.finished(true);
12307                    return Ok(response);
12308                }
12309            }
12310        }
12311    }
12312
12313    ///
12314    /// Sets the *request* property to the given value.
12315    ///
12316    /// Even though the property as already been set when instantiating this call,
12317    /// we provide this method for API completeness.
12318    pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrencePatchCall<'a, C> {
12319        self._request = new_value;
12320        self
12321    }
12322    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
12323    ///
12324    /// Sets the *name* path property to the given value.
12325    ///
12326    /// Even though the property as already been set when instantiating this call,
12327    /// we provide this method for API completeness.
12328    pub fn name(mut self, new_value: &str) -> ProjectOccurrencePatchCall<'a, C> {
12329        self._name = new_value.to_string();
12330        self
12331    }
12332    /// The fields to update.
12333    ///
12334    /// Sets the *update mask* query property to the given value.
12335    pub fn update_mask(
12336        mut self,
12337        new_value: common::FieldMask,
12338    ) -> ProjectOccurrencePatchCall<'a, C> {
12339        self._update_mask = Some(new_value);
12340        self
12341    }
12342    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12343    /// while executing the actual API request.
12344    ///
12345    /// ````text
12346    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12347    /// ````
12348    ///
12349    /// Sets the *delegate* property to the given value.
12350    pub fn delegate(
12351        mut self,
12352        new_value: &'a mut dyn common::Delegate,
12353    ) -> ProjectOccurrencePatchCall<'a, C> {
12354        self._delegate = Some(new_value);
12355        self
12356    }
12357
12358    /// Set any additional parameter of the query string used in the request.
12359    /// It should be used to set parameters which are not yet available through their own
12360    /// setters.
12361    ///
12362    /// Please note that this method must not be used to set any of the known parameters
12363    /// which have their own setter method. If done anyway, the request will fail.
12364    ///
12365    /// # Additional Parameters
12366    ///
12367    /// * *$.xgafv* (query-string) - V1 error format.
12368    /// * *access_token* (query-string) - OAuth access token.
12369    /// * *alt* (query-string) - Data format for response.
12370    /// * *callback* (query-string) - JSONP
12371    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12372    /// * *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.
12373    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12374    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12375    /// * *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.
12376    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12377    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12378    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrencePatchCall<'a, C>
12379    where
12380        T: AsRef<str>,
12381    {
12382        self._additional_params
12383            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12384        self
12385    }
12386
12387    /// Identifies the authorization scope for the method you are building.
12388    ///
12389    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12390    /// [`Scope::CloudPlatform`].
12391    ///
12392    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12393    /// tokens for more than one scope.
12394    ///
12395    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12396    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12397    /// sufficient, a read-write scope will do as well.
12398    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrencePatchCall<'a, C>
12399    where
12400        St: AsRef<str>,
12401    {
12402        self._scopes.insert(String::from(scope.as_ref()));
12403        self
12404    }
12405    /// Identifies the authorization scope(s) for the method you are building.
12406    ///
12407    /// See [`Self::add_scope()`] for details.
12408    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrencePatchCall<'a, C>
12409    where
12410        I: IntoIterator<Item = St>,
12411        St: AsRef<str>,
12412    {
12413        self._scopes
12414            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12415        self
12416    }
12417
12418    /// Removes all scopes, and no default scope will be used either.
12419    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12420    /// for details).
12421    pub fn clear_scopes(mut self) -> ProjectOccurrencePatchCall<'a, C> {
12422        self._scopes.clear();
12423        self
12424    }
12425}
12426
12427/// Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
12428///
12429/// A builder for the *occurrences.setIamPolicy* method supported by a *project* resource.
12430/// It is not used directly, but through a [`ProjectMethods`] instance.
12431///
12432/// # Example
12433///
12434/// Instantiate a resource method builder
12435///
12436/// ```test_harness,no_run
12437/// # extern crate hyper;
12438/// # extern crate hyper_rustls;
12439/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
12440/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
12441/// # async fn dox() {
12442/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12443///
12444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12446/// #     secret,
12447/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12448/// # ).build().await.unwrap();
12449///
12450/// # let client = hyper_util::client::legacy::Client::builder(
12451/// #     hyper_util::rt::TokioExecutor::new()
12452/// # )
12453/// # .build(
12454/// #     hyper_rustls::HttpsConnectorBuilder::new()
12455/// #         .with_native_roots()
12456/// #         .unwrap()
12457/// #         .https_or_http()
12458/// #         .enable_http1()
12459/// #         .build()
12460/// # );
12461/// # let mut hub = ContainerAnalysis::new(client, auth);
12462/// // As the method needs a request, you would usually fill it with the desired information
12463/// // into the respective structure. Some of the parts shown here might not be applicable !
12464/// // Values shown here are possibly random and not representative !
12465/// let mut req = SetIamPolicyRequest::default();
12466///
12467/// // You can configure optional parameters by calling the respective setters at will, and
12468/// // execute the final call using `doit()`.
12469/// // Values shown here are possibly random and not representative !
12470/// let result = hub.projects().occurrences_set_iam_policy(req, "resource")
12471///              .doit().await;
12472/// # }
12473/// ```
12474pub struct ProjectOccurrenceSetIamPolicyCall<'a, C>
12475where
12476    C: 'a,
12477{
12478    hub: &'a ContainerAnalysis<C>,
12479    _request: SetIamPolicyRequest,
12480    _resource: String,
12481    _delegate: Option<&'a mut dyn common::Delegate>,
12482    _additional_params: HashMap<String, String>,
12483    _scopes: BTreeSet<String>,
12484}
12485
12486impl<'a, C> common::CallBuilder for ProjectOccurrenceSetIamPolicyCall<'a, C> {}
12487
12488impl<'a, C> ProjectOccurrenceSetIamPolicyCall<'a, C>
12489where
12490    C: common::Connector,
12491{
12492    /// Perform the operation you have build so far.
12493    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12494        use std::borrow::Cow;
12495        use std::io::{Read, Seek};
12496
12497        use common::{url::Params, ToParts};
12498        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12499
12500        let mut dd = common::DefaultDelegate;
12501        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12502        dlg.begin(common::MethodInfo {
12503            id: "containeranalysis.projects.occurrences.setIamPolicy",
12504            http_method: hyper::Method::POST,
12505        });
12506
12507        for &field in ["alt", "resource"].iter() {
12508            if self._additional_params.contains_key(field) {
12509                dlg.finished(false);
12510                return Err(common::Error::FieldClash(field));
12511            }
12512        }
12513
12514        let mut params = Params::with_capacity(4 + self._additional_params.len());
12515        params.push("resource", self._resource);
12516
12517        params.extend(self._additional_params.iter());
12518
12519        params.push("alt", "json");
12520        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
12521        if self._scopes.is_empty() {
12522            self._scopes
12523                .insert(Scope::CloudPlatform.as_ref().to_string());
12524        }
12525
12526        #[allow(clippy::single_element_loop)]
12527        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12528            url = params.uri_replacement(url, param_name, find_this, true);
12529        }
12530        {
12531            let to_remove = ["resource"];
12532            params.remove_params(&to_remove);
12533        }
12534
12535        let url = params.parse_with_url(&url);
12536
12537        let mut json_mime_type = mime::APPLICATION_JSON;
12538        let mut request_value_reader = {
12539            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12540            common::remove_json_null_values(&mut value);
12541            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12542            serde_json::to_writer(&mut dst, &value).unwrap();
12543            dst
12544        };
12545        let request_size = request_value_reader
12546            .seek(std::io::SeekFrom::End(0))
12547            .unwrap();
12548        request_value_reader
12549            .seek(std::io::SeekFrom::Start(0))
12550            .unwrap();
12551
12552        loop {
12553            let token = match self
12554                .hub
12555                .auth
12556                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12557                .await
12558            {
12559                Ok(token) => token,
12560                Err(e) => match dlg.token(e) {
12561                    Ok(token) => token,
12562                    Err(e) => {
12563                        dlg.finished(false);
12564                        return Err(common::Error::MissingToken(e));
12565                    }
12566                },
12567            };
12568            request_value_reader
12569                .seek(std::io::SeekFrom::Start(0))
12570                .unwrap();
12571            let mut req_result = {
12572                let client = &self.hub.client;
12573                dlg.pre_request();
12574                let mut req_builder = hyper::Request::builder()
12575                    .method(hyper::Method::POST)
12576                    .uri(url.as_str())
12577                    .header(USER_AGENT, self.hub._user_agent.clone());
12578
12579                if let Some(token) = token.as_ref() {
12580                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12581                }
12582
12583                let request = req_builder
12584                    .header(CONTENT_TYPE, json_mime_type.to_string())
12585                    .header(CONTENT_LENGTH, request_size as u64)
12586                    .body(common::to_body(
12587                        request_value_reader.get_ref().clone().into(),
12588                    ));
12589
12590                client.request(request.unwrap()).await
12591            };
12592
12593            match req_result {
12594                Err(err) => {
12595                    if let common::Retry::After(d) = dlg.http_error(&err) {
12596                        sleep(d).await;
12597                        continue;
12598                    }
12599                    dlg.finished(false);
12600                    return Err(common::Error::HttpError(err));
12601                }
12602                Ok(res) => {
12603                    let (mut parts, body) = res.into_parts();
12604                    let mut body = common::Body::new(body);
12605                    if !parts.status.is_success() {
12606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12607                        let error = serde_json::from_str(&common::to_string(&bytes));
12608                        let response = common::to_response(parts, bytes.into());
12609
12610                        if let common::Retry::After(d) =
12611                            dlg.http_failure(&response, error.as_ref().ok())
12612                        {
12613                            sleep(d).await;
12614                            continue;
12615                        }
12616
12617                        dlg.finished(false);
12618
12619                        return Err(match error {
12620                            Ok(value) => common::Error::BadRequest(value),
12621                            _ => common::Error::Failure(response),
12622                        });
12623                    }
12624                    let response = {
12625                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12626                        let encoded = common::to_string(&bytes);
12627                        match serde_json::from_str(&encoded) {
12628                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12629                            Err(error) => {
12630                                dlg.response_json_decode_error(&encoded, &error);
12631                                return Err(common::Error::JsonDecodeError(
12632                                    encoded.to_string(),
12633                                    error,
12634                                ));
12635                            }
12636                        }
12637                    };
12638
12639                    dlg.finished(true);
12640                    return Ok(response);
12641                }
12642            }
12643        }
12644    }
12645
12646    ///
12647    /// Sets the *request* property to the given value.
12648    ///
12649    /// Even though the property as already been set when instantiating this call,
12650    /// we provide this method for API completeness.
12651    pub fn request(
12652        mut self,
12653        new_value: SetIamPolicyRequest,
12654    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
12655        self._request = new_value;
12656        self
12657    }
12658    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
12659    ///
12660    /// Sets the *resource* path property to the given value.
12661    ///
12662    /// Even though the property as already been set when instantiating this call,
12663    /// we provide this method for API completeness.
12664    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
12665        self._resource = new_value.to_string();
12666        self
12667    }
12668    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12669    /// while executing the actual API request.
12670    ///
12671    /// ````text
12672    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12673    /// ````
12674    ///
12675    /// Sets the *delegate* property to the given value.
12676    pub fn delegate(
12677        mut self,
12678        new_value: &'a mut dyn common::Delegate,
12679    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
12680        self._delegate = Some(new_value);
12681        self
12682    }
12683
12684    /// Set any additional parameter of the query string used in the request.
12685    /// It should be used to set parameters which are not yet available through their own
12686    /// setters.
12687    ///
12688    /// Please note that this method must not be used to set any of the known parameters
12689    /// which have their own setter method. If done anyway, the request will fail.
12690    ///
12691    /// # Additional Parameters
12692    ///
12693    /// * *$.xgafv* (query-string) - V1 error format.
12694    /// * *access_token* (query-string) - OAuth access token.
12695    /// * *alt* (query-string) - Data format for response.
12696    /// * *callback* (query-string) - JSONP
12697    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12698    /// * *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.
12699    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12700    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12701    /// * *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.
12702    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12703    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12704    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
12705    where
12706        T: AsRef<str>,
12707    {
12708        self._additional_params
12709            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12710        self
12711    }
12712
12713    /// Identifies the authorization scope for the method you are building.
12714    ///
12715    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12716    /// [`Scope::CloudPlatform`].
12717    ///
12718    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12719    /// tokens for more than one scope.
12720    ///
12721    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12722    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12723    /// sufficient, a read-write scope will do as well.
12724    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
12725    where
12726        St: AsRef<str>,
12727    {
12728        self._scopes.insert(String::from(scope.as_ref()));
12729        self
12730    }
12731    /// Identifies the authorization scope(s) for the method you are building.
12732    ///
12733    /// See [`Self::add_scope()`] for details.
12734    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
12735    where
12736        I: IntoIterator<Item = St>,
12737        St: AsRef<str>,
12738    {
12739        self._scopes
12740            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12741        self
12742    }
12743
12744    /// Removes all scopes, and no default scope will be used either.
12745    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12746    /// for details).
12747    pub fn clear_scopes(mut self) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
12748        self._scopes.clear();
12749        self
12750    }
12751}
12752
12753/// Returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, `containeranalysis.notes.list`). The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences.
12754///
12755/// A builder for the *occurrences.testIamPermissions* method supported by a *project* resource.
12756/// It is not used directly, but through a [`ProjectMethods`] instance.
12757///
12758/// # Example
12759///
12760/// Instantiate a resource method builder
12761///
12762/// ```test_harness,no_run
12763/// # extern crate hyper;
12764/// # extern crate hyper_rustls;
12765/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
12766/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
12767/// # async fn dox() {
12768/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12769///
12770/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12771/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12772/// #     secret,
12773/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12774/// # ).build().await.unwrap();
12775///
12776/// # let client = hyper_util::client::legacy::Client::builder(
12777/// #     hyper_util::rt::TokioExecutor::new()
12778/// # )
12779/// # .build(
12780/// #     hyper_rustls::HttpsConnectorBuilder::new()
12781/// #         .with_native_roots()
12782/// #         .unwrap()
12783/// #         .https_or_http()
12784/// #         .enable_http1()
12785/// #         .build()
12786/// # );
12787/// # let mut hub = ContainerAnalysis::new(client, auth);
12788/// // As the method needs a request, you would usually fill it with the desired information
12789/// // into the respective structure. Some of the parts shown here might not be applicable !
12790/// // Values shown here are possibly random and not representative !
12791/// let mut req = TestIamPermissionsRequest::default();
12792///
12793/// // You can configure optional parameters by calling the respective setters at will, and
12794/// // execute the final call using `doit()`.
12795/// // Values shown here are possibly random and not representative !
12796/// let result = hub.projects().occurrences_test_iam_permissions(req, "resource")
12797///              .doit().await;
12798/// # }
12799/// ```
12800pub struct ProjectOccurrenceTestIamPermissionCall<'a, C>
12801where
12802    C: 'a,
12803{
12804    hub: &'a ContainerAnalysis<C>,
12805    _request: TestIamPermissionsRequest,
12806    _resource: String,
12807    _delegate: Option<&'a mut dyn common::Delegate>,
12808    _additional_params: HashMap<String, String>,
12809    _scopes: BTreeSet<String>,
12810}
12811
12812impl<'a, C> common::CallBuilder for ProjectOccurrenceTestIamPermissionCall<'a, C> {}
12813
12814impl<'a, C> ProjectOccurrenceTestIamPermissionCall<'a, C>
12815where
12816    C: common::Connector,
12817{
12818    /// Perform the operation you have build so far.
12819    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
12820        use std::borrow::Cow;
12821        use std::io::{Read, Seek};
12822
12823        use common::{url::Params, ToParts};
12824        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12825
12826        let mut dd = common::DefaultDelegate;
12827        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12828        dlg.begin(common::MethodInfo {
12829            id: "containeranalysis.projects.occurrences.testIamPermissions",
12830            http_method: hyper::Method::POST,
12831        });
12832
12833        for &field in ["alt", "resource"].iter() {
12834            if self._additional_params.contains_key(field) {
12835                dlg.finished(false);
12836                return Err(common::Error::FieldClash(field));
12837            }
12838        }
12839
12840        let mut params = Params::with_capacity(4 + self._additional_params.len());
12841        params.push("resource", self._resource);
12842
12843        params.extend(self._additional_params.iter());
12844
12845        params.push("alt", "json");
12846        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
12847        if self._scopes.is_empty() {
12848            self._scopes
12849                .insert(Scope::CloudPlatform.as_ref().to_string());
12850        }
12851
12852        #[allow(clippy::single_element_loop)]
12853        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12854            url = params.uri_replacement(url, param_name, find_this, true);
12855        }
12856        {
12857            let to_remove = ["resource"];
12858            params.remove_params(&to_remove);
12859        }
12860
12861        let url = params.parse_with_url(&url);
12862
12863        let mut json_mime_type = mime::APPLICATION_JSON;
12864        let mut request_value_reader = {
12865            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12866            common::remove_json_null_values(&mut value);
12867            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12868            serde_json::to_writer(&mut dst, &value).unwrap();
12869            dst
12870        };
12871        let request_size = request_value_reader
12872            .seek(std::io::SeekFrom::End(0))
12873            .unwrap();
12874        request_value_reader
12875            .seek(std::io::SeekFrom::Start(0))
12876            .unwrap();
12877
12878        loop {
12879            let token = match self
12880                .hub
12881                .auth
12882                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12883                .await
12884            {
12885                Ok(token) => token,
12886                Err(e) => match dlg.token(e) {
12887                    Ok(token) => token,
12888                    Err(e) => {
12889                        dlg.finished(false);
12890                        return Err(common::Error::MissingToken(e));
12891                    }
12892                },
12893            };
12894            request_value_reader
12895                .seek(std::io::SeekFrom::Start(0))
12896                .unwrap();
12897            let mut req_result = {
12898                let client = &self.hub.client;
12899                dlg.pre_request();
12900                let mut req_builder = hyper::Request::builder()
12901                    .method(hyper::Method::POST)
12902                    .uri(url.as_str())
12903                    .header(USER_AGENT, self.hub._user_agent.clone());
12904
12905                if let Some(token) = token.as_ref() {
12906                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12907                }
12908
12909                let request = req_builder
12910                    .header(CONTENT_TYPE, json_mime_type.to_string())
12911                    .header(CONTENT_LENGTH, request_size as u64)
12912                    .body(common::to_body(
12913                        request_value_reader.get_ref().clone().into(),
12914                    ));
12915
12916                client.request(request.unwrap()).await
12917            };
12918
12919            match req_result {
12920                Err(err) => {
12921                    if let common::Retry::After(d) = dlg.http_error(&err) {
12922                        sleep(d).await;
12923                        continue;
12924                    }
12925                    dlg.finished(false);
12926                    return Err(common::Error::HttpError(err));
12927                }
12928                Ok(res) => {
12929                    let (mut parts, body) = res.into_parts();
12930                    let mut body = common::Body::new(body);
12931                    if !parts.status.is_success() {
12932                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12933                        let error = serde_json::from_str(&common::to_string(&bytes));
12934                        let response = common::to_response(parts, bytes.into());
12935
12936                        if let common::Retry::After(d) =
12937                            dlg.http_failure(&response, error.as_ref().ok())
12938                        {
12939                            sleep(d).await;
12940                            continue;
12941                        }
12942
12943                        dlg.finished(false);
12944
12945                        return Err(match error {
12946                            Ok(value) => common::Error::BadRequest(value),
12947                            _ => common::Error::Failure(response),
12948                        });
12949                    }
12950                    let response = {
12951                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12952                        let encoded = common::to_string(&bytes);
12953                        match serde_json::from_str(&encoded) {
12954                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12955                            Err(error) => {
12956                                dlg.response_json_decode_error(&encoded, &error);
12957                                return Err(common::Error::JsonDecodeError(
12958                                    encoded.to_string(),
12959                                    error,
12960                                ));
12961                            }
12962                        }
12963                    };
12964
12965                    dlg.finished(true);
12966                    return Ok(response);
12967                }
12968            }
12969        }
12970    }
12971
12972    ///
12973    /// Sets the *request* property to the given value.
12974    ///
12975    /// Even though the property as already been set when instantiating this call,
12976    /// we provide this method for API completeness.
12977    pub fn request(
12978        mut self,
12979        new_value: TestIamPermissionsRequest,
12980    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
12981        self._request = new_value;
12982        self
12983    }
12984    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
12985    ///
12986    /// Sets the *resource* path property to the given value.
12987    ///
12988    /// Even though the property as already been set when instantiating this call,
12989    /// we provide this method for API completeness.
12990    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
12991        self._resource = new_value.to_string();
12992        self
12993    }
12994    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12995    /// while executing the actual API request.
12996    ///
12997    /// ````text
12998    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12999    /// ````
13000    ///
13001    /// Sets the *delegate* property to the given value.
13002    pub fn delegate(
13003        mut self,
13004        new_value: &'a mut dyn common::Delegate,
13005    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
13006        self._delegate = Some(new_value);
13007        self
13008    }
13009
13010    /// Set any additional parameter of the query string used in the request.
13011    /// It should be used to set parameters which are not yet available through their own
13012    /// setters.
13013    ///
13014    /// Please note that this method must not be used to set any of the known parameters
13015    /// which have their own setter method. If done anyway, the request will fail.
13016    ///
13017    /// # Additional Parameters
13018    ///
13019    /// * *$.xgafv* (query-string) - V1 error format.
13020    /// * *access_token* (query-string) - OAuth access token.
13021    /// * *alt* (query-string) - Data format for response.
13022    /// * *callback* (query-string) - JSONP
13023    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13024    /// * *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.
13025    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13026    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13027    /// * *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.
13028    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13029    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13030    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
13031    where
13032        T: AsRef<str>,
13033    {
13034        self._additional_params
13035            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13036        self
13037    }
13038
13039    /// Identifies the authorization scope for the method you are building.
13040    ///
13041    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13042    /// [`Scope::CloudPlatform`].
13043    ///
13044    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13045    /// tokens for more than one scope.
13046    ///
13047    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13048    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13049    /// sufficient, a read-write scope will do as well.
13050    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
13051    where
13052        St: AsRef<str>,
13053    {
13054        self._scopes.insert(String::from(scope.as_ref()));
13055        self
13056    }
13057    /// Identifies the authorization scope(s) for the method you are building.
13058    ///
13059    /// See [`Self::add_scope()`] for details.
13060    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
13061    where
13062        I: IntoIterator<Item = St>,
13063        St: AsRef<str>,
13064    {
13065        self._scopes
13066            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13067        self
13068    }
13069
13070    /// Removes all scopes, and no default scope will be used either.
13071    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13072    /// for details).
13073    pub fn clear_scopes(mut self) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
13074        self._scopes.clear();
13075        self
13076    }
13077}
13078
13079/// Generates an SBOM and other dependency information for the given resource.
13080///
13081/// A builder for the *resources.exportSBOM* method supported by a *project* resource.
13082/// It is not used directly, but through a [`ProjectMethods`] instance.
13083///
13084/// # Example
13085///
13086/// Instantiate a resource method builder
13087///
13088/// ```test_harness,no_run
13089/// # extern crate hyper;
13090/// # extern crate hyper_rustls;
13091/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
13092/// use containeranalysis1_beta1::api::ExportSBOMRequest;
13093/// # async fn dox() {
13094/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13095///
13096/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13097/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13098/// #     secret,
13099/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13100/// # ).build().await.unwrap();
13101///
13102/// # let client = hyper_util::client::legacy::Client::builder(
13103/// #     hyper_util::rt::TokioExecutor::new()
13104/// # )
13105/// # .build(
13106/// #     hyper_rustls::HttpsConnectorBuilder::new()
13107/// #         .with_native_roots()
13108/// #         .unwrap()
13109/// #         .https_or_http()
13110/// #         .enable_http1()
13111/// #         .build()
13112/// # );
13113/// # let mut hub = ContainerAnalysis::new(client, auth);
13114/// // As the method needs a request, you would usually fill it with the desired information
13115/// // into the respective structure. Some of the parts shown here might not be applicable !
13116/// // Values shown here are possibly random and not representative !
13117/// let mut req = ExportSBOMRequest::default();
13118///
13119/// // You can configure optional parameters by calling the respective setters at will, and
13120/// // execute the final call using `doit()`.
13121/// // Values shown here are possibly random and not representative !
13122/// let result = hub.projects().resources_export_sbom(req, "name")
13123///              .doit().await;
13124/// # }
13125/// ```
13126pub struct ProjectResourceExportSBOMCall<'a, C>
13127where
13128    C: 'a,
13129{
13130    hub: &'a ContainerAnalysis<C>,
13131    _request: ExportSBOMRequest,
13132    _name: String,
13133    _delegate: Option<&'a mut dyn common::Delegate>,
13134    _additional_params: HashMap<String, String>,
13135    _scopes: BTreeSet<String>,
13136}
13137
13138impl<'a, C> common::CallBuilder for ProjectResourceExportSBOMCall<'a, C> {}
13139
13140impl<'a, C> ProjectResourceExportSBOMCall<'a, C>
13141where
13142    C: common::Connector,
13143{
13144    /// Perform the operation you have build so far.
13145    pub async fn doit(mut self) -> common::Result<(common::Response, ExportSBOMResponse)> {
13146        use std::borrow::Cow;
13147        use std::io::{Read, Seek};
13148
13149        use common::{url::Params, ToParts};
13150        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13151
13152        let mut dd = common::DefaultDelegate;
13153        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13154        dlg.begin(common::MethodInfo {
13155            id: "containeranalysis.projects.resources.exportSBOM",
13156            http_method: hyper::Method::POST,
13157        });
13158
13159        for &field in ["alt", "name"].iter() {
13160            if self._additional_params.contains_key(field) {
13161                dlg.finished(false);
13162                return Err(common::Error::FieldClash(field));
13163            }
13164        }
13165
13166        let mut params = Params::with_capacity(4 + self._additional_params.len());
13167        params.push("name", self._name);
13168
13169        params.extend(self._additional_params.iter());
13170
13171        params.push("alt", "json");
13172        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:exportSBOM";
13173        if self._scopes.is_empty() {
13174            self._scopes
13175                .insert(Scope::CloudPlatform.as_ref().to_string());
13176        }
13177
13178        #[allow(clippy::single_element_loop)]
13179        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13180            url = params.uri_replacement(url, param_name, find_this, true);
13181        }
13182        {
13183            let to_remove = ["name"];
13184            params.remove_params(&to_remove);
13185        }
13186
13187        let url = params.parse_with_url(&url);
13188
13189        let mut json_mime_type = mime::APPLICATION_JSON;
13190        let mut request_value_reader = {
13191            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13192            common::remove_json_null_values(&mut value);
13193            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13194            serde_json::to_writer(&mut dst, &value).unwrap();
13195            dst
13196        };
13197        let request_size = request_value_reader
13198            .seek(std::io::SeekFrom::End(0))
13199            .unwrap();
13200        request_value_reader
13201            .seek(std::io::SeekFrom::Start(0))
13202            .unwrap();
13203
13204        loop {
13205            let token = match self
13206                .hub
13207                .auth
13208                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13209                .await
13210            {
13211                Ok(token) => token,
13212                Err(e) => match dlg.token(e) {
13213                    Ok(token) => token,
13214                    Err(e) => {
13215                        dlg.finished(false);
13216                        return Err(common::Error::MissingToken(e));
13217                    }
13218                },
13219            };
13220            request_value_reader
13221                .seek(std::io::SeekFrom::Start(0))
13222                .unwrap();
13223            let mut req_result = {
13224                let client = &self.hub.client;
13225                dlg.pre_request();
13226                let mut req_builder = hyper::Request::builder()
13227                    .method(hyper::Method::POST)
13228                    .uri(url.as_str())
13229                    .header(USER_AGENT, self.hub._user_agent.clone());
13230
13231                if let Some(token) = token.as_ref() {
13232                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13233                }
13234
13235                let request = req_builder
13236                    .header(CONTENT_TYPE, json_mime_type.to_string())
13237                    .header(CONTENT_LENGTH, request_size as u64)
13238                    .body(common::to_body(
13239                        request_value_reader.get_ref().clone().into(),
13240                    ));
13241
13242                client.request(request.unwrap()).await
13243            };
13244
13245            match req_result {
13246                Err(err) => {
13247                    if let common::Retry::After(d) = dlg.http_error(&err) {
13248                        sleep(d).await;
13249                        continue;
13250                    }
13251                    dlg.finished(false);
13252                    return Err(common::Error::HttpError(err));
13253                }
13254                Ok(res) => {
13255                    let (mut parts, body) = res.into_parts();
13256                    let mut body = common::Body::new(body);
13257                    if !parts.status.is_success() {
13258                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13259                        let error = serde_json::from_str(&common::to_string(&bytes));
13260                        let response = common::to_response(parts, bytes.into());
13261
13262                        if let common::Retry::After(d) =
13263                            dlg.http_failure(&response, error.as_ref().ok())
13264                        {
13265                            sleep(d).await;
13266                            continue;
13267                        }
13268
13269                        dlg.finished(false);
13270
13271                        return Err(match error {
13272                            Ok(value) => common::Error::BadRequest(value),
13273                            _ => common::Error::Failure(response),
13274                        });
13275                    }
13276                    let response = {
13277                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13278                        let encoded = common::to_string(&bytes);
13279                        match serde_json::from_str(&encoded) {
13280                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13281                            Err(error) => {
13282                                dlg.response_json_decode_error(&encoded, &error);
13283                                return Err(common::Error::JsonDecodeError(
13284                                    encoded.to_string(),
13285                                    error,
13286                                ));
13287                            }
13288                        }
13289                    };
13290
13291                    dlg.finished(true);
13292                    return Ok(response);
13293                }
13294            }
13295        }
13296    }
13297
13298    ///
13299    /// Sets the *request* property to the given value.
13300    ///
13301    /// Even though the property as already been set when instantiating this call,
13302    /// we provide this method for API completeness.
13303    pub fn request(mut self, new_value: ExportSBOMRequest) -> ProjectResourceExportSBOMCall<'a, C> {
13304        self._request = new_value;
13305        self
13306    }
13307    /// Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
13308    ///
13309    /// Sets the *name* path property to the given value.
13310    ///
13311    /// Even though the property as already been set when instantiating this call,
13312    /// we provide this method for API completeness.
13313    pub fn name(mut self, new_value: &str) -> ProjectResourceExportSBOMCall<'a, C> {
13314        self._name = new_value.to_string();
13315        self
13316    }
13317    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13318    /// while executing the actual API request.
13319    ///
13320    /// ````text
13321    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13322    /// ````
13323    ///
13324    /// Sets the *delegate* property to the given value.
13325    pub fn delegate(
13326        mut self,
13327        new_value: &'a mut dyn common::Delegate,
13328    ) -> ProjectResourceExportSBOMCall<'a, C> {
13329        self._delegate = Some(new_value);
13330        self
13331    }
13332
13333    /// Set any additional parameter of the query string used in the request.
13334    /// It should be used to set parameters which are not yet available through their own
13335    /// setters.
13336    ///
13337    /// Please note that this method must not be used to set any of the known parameters
13338    /// which have their own setter method. If done anyway, the request will fail.
13339    ///
13340    /// # Additional Parameters
13341    ///
13342    /// * *$.xgafv* (query-string) - V1 error format.
13343    /// * *access_token* (query-string) - OAuth access token.
13344    /// * *alt* (query-string) - Data format for response.
13345    /// * *callback* (query-string) - JSONP
13346    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13347    /// * *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.
13348    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13349    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13350    /// * *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.
13351    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13352    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13353    pub fn param<T>(mut self, name: T, value: T) -> ProjectResourceExportSBOMCall<'a, C>
13354    where
13355        T: AsRef<str>,
13356    {
13357        self._additional_params
13358            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13359        self
13360    }
13361
13362    /// Identifies the authorization scope for the method you are building.
13363    ///
13364    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13365    /// [`Scope::CloudPlatform`].
13366    ///
13367    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13368    /// tokens for more than one scope.
13369    ///
13370    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13371    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13372    /// sufficient, a read-write scope will do as well.
13373    pub fn add_scope<St>(mut self, scope: St) -> ProjectResourceExportSBOMCall<'a, C>
13374    where
13375        St: AsRef<str>,
13376    {
13377        self._scopes.insert(String::from(scope.as_ref()));
13378        self
13379    }
13380    /// Identifies the authorization scope(s) for the method you are building.
13381    ///
13382    /// See [`Self::add_scope()`] for details.
13383    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectResourceExportSBOMCall<'a, C>
13384    where
13385        I: IntoIterator<Item = St>,
13386        St: AsRef<str>,
13387    {
13388        self._scopes
13389            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13390        self
13391    }
13392
13393    /// Removes all scopes, and no default scope will be used either.
13394    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13395    /// for details).
13396    pub fn clear_scopes(mut self) -> ProjectResourceExportSBOMCall<'a, C> {
13397        self._scopes.clear();
13398        self
13399    }
13400}
13401
13402/// Gets a summary of the packages within a given resource.
13403///
13404/// A builder for the *resources.generatePackagesSummary* method supported by a *project* resource.
13405/// It is not used directly, but through a [`ProjectMethods`] instance.
13406///
13407/// # Example
13408///
13409/// Instantiate a resource method builder
13410///
13411/// ```test_harness,no_run
13412/// # extern crate hyper;
13413/// # extern crate hyper_rustls;
13414/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
13415/// use containeranalysis1_beta1::api::GeneratePackagesSummaryRequest;
13416/// # async fn dox() {
13417/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13418///
13419/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13420/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13421/// #     secret,
13422/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13423/// # ).build().await.unwrap();
13424///
13425/// # let client = hyper_util::client::legacy::Client::builder(
13426/// #     hyper_util::rt::TokioExecutor::new()
13427/// # )
13428/// # .build(
13429/// #     hyper_rustls::HttpsConnectorBuilder::new()
13430/// #         .with_native_roots()
13431/// #         .unwrap()
13432/// #         .https_or_http()
13433/// #         .enable_http1()
13434/// #         .build()
13435/// # );
13436/// # let mut hub = ContainerAnalysis::new(client, auth);
13437/// // As the method needs a request, you would usually fill it with the desired information
13438/// // into the respective structure. Some of the parts shown here might not be applicable !
13439/// // Values shown here are possibly random and not representative !
13440/// let mut req = GeneratePackagesSummaryRequest::default();
13441///
13442/// // You can configure optional parameters by calling the respective setters at will, and
13443/// // execute the final call using `doit()`.
13444/// // Values shown here are possibly random and not representative !
13445/// let result = hub.projects().resources_generate_packages_summary(req, "name")
13446///              .doit().await;
13447/// # }
13448/// ```
13449pub struct ProjectResourceGeneratePackagesSummaryCall<'a, C>
13450where
13451    C: 'a,
13452{
13453    hub: &'a ContainerAnalysis<C>,
13454    _request: GeneratePackagesSummaryRequest,
13455    _name: String,
13456    _delegate: Option<&'a mut dyn common::Delegate>,
13457    _additional_params: HashMap<String, String>,
13458    _scopes: BTreeSet<String>,
13459}
13460
13461impl<'a, C> common::CallBuilder for ProjectResourceGeneratePackagesSummaryCall<'a, C> {}
13462
13463impl<'a, C> ProjectResourceGeneratePackagesSummaryCall<'a, C>
13464where
13465    C: common::Connector,
13466{
13467    /// Perform the operation you have build so far.
13468    pub async fn doit(mut self) -> common::Result<(common::Response, PackagesSummaryResponse)> {
13469        use std::borrow::Cow;
13470        use std::io::{Read, Seek};
13471
13472        use common::{url::Params, ToParts};
13473        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13474
13475        let mut dd = common::DefaultDelegate;
13476        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13477        dlg.begin(common::MethodInfo {
13478            id: "containeranalysis.projects.resources.generatePackagesSummary",
13479            http_method: hyper::Method::POST,
13480        });
13481
13482        for &field in ["alt", "name"].iter() {
13483            if self._additional_params.contains_key(field) {
13484                dlg.finished(false);
13485                return Err(common::Error::FieldClash(field));
13486            }
13487        }
13488
13489        let mut params = Params::with_capacity(4 + self._additional_params.len());
13490        params.push("name", self._name);
13491
13492        params.extend(self._additional_params.iter());
13493
13494        params.push("alt", "json");
13495        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:generatePackagesSummary";
13496        if self._scopes.is_empty() {
13497            self._scopes
13498                .insert(Scope::CloudPlatform.as_ref().to_string());
13499        }
13500
13501        #[allow(clippy::single_element_loop)]
13502        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13503            url = params.uri_replacement(url, param_name, find_this, true);
13504        }
13505        {
13506            let to_remove = ["name"];
13507            params.remove_params(&to_remove);
13508        }
13509
13510        let url = params.parse_with_url(&url);
13511
13512        let mut json_mime_type = mime::APPLICATION_JSON;
13513        let mut request_value_reader = {
13514            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13515            common::remove_json_null_values(&mut value);
13516            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13517            serde_json::to_writer(&mut dst, &value).unwrap();
13518            dst
13519        };
13520        let request_size = request_value_reader
13521            .seek(std::io::SeekFrom::End(0))
13522            .unwrap();
13523        request_value_reader
13524            .seek(std::io::SeekFrom::Start(0))
13525            .unwrap();
13526
13527        loop {
13528            let token = match self
13529                .hub
13530                .auth
13531                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13532                .await
13533            {
13534                Ok(token) => token,
13535                Err(e) => match dlg.token(e) {
13536                    Ok(token) => token,
13537                    Err(e) => {
13538                        dlg.finished(false);
13539                        return Err(common::Error::MissingToken(e));
13540                    }
13541                },
13542            };
13543            request_value_reader
13544                .seek(std::io::SeekFrom::Start(0))
13545                .unwrap();
13546            let mut req_result = {
13547                let client = &self.hub.client;
13548                dlg.pre_request();
13549                let mut req_builder = hyper::Request::builder()
13550                    .method(hyper::Method::POST)
13551                    .uri(url.as_str())
13552                    .header(USER_AGENT, self.hub._user_agent.clone());
13553
13554                if let Some(token) = token.as_ref() {
13555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13556                }
13557
13558                let request = req_builder
13559                    .header(CONTENT_TYPE, json_mime_type.to_string())
13560                    .header(CONTENT_LENGTH, request_size as u64)
13561                    .body(common::to_body(
13562                        request_value_reader.get_ref().clone().into(),
13563                    ));
13564
13565                client.request(request.unwrap()).await
13566            };
13567
13568            match req_result {
13569                Err(err) => {
13570                    if let common::Retry::After(d) = dlg.http_error(&err) {
13571                        sleep(d).await;
13572                        continue;
13573                    }
13574                    dlg.finished(false);
13575                    return Err(common::Error::HttpError(err));
13576                }
13577                Ok(res) => {
13578                    let (mut parts, body) = res.into_parts();
13579                    let mut body = common::Body::new(body);
13580                    if !parts.status.is_success() {
13581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13582                        let error = serde_json::from_str(&common::to_string(&bytes));
13583                        let response = common::to_response(parts, bytes.into());
13584
13585                        if let common::Retry::After(d) =
13586                            dlg.http_failure(&response, error.as_ref().ok())
13587                        {
13588                            sleep(d).await;
13589                            continue;
13590                        }
13591
13592                        dlg.finished(false);
13593
13594                        return Err(match error {
13595                            Ok(value) => common::Error::BadRequest(value),
13596                            _ => common::Error::Failure(response),
13597                        });
13598                    }
13599                    let response = {
13600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13601                        let encoded = common::to_string(&bytes);
13602                        match serde_json::from_str(&encoded) {
13603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13604                            Err(error) => {
13605                                dlg.response_json_decode_error(&encoded, &error);
13606                                return Err(common::Error::JsonDecodeError(
13607                                    encoded.to_string(),
13608                                    error,
13609                                ));
13610                            }
13611                        }
13612                    };
13613
13614                    dlg.finished(true);
13615                    return Ok(response);
13616                }
13617            }
13618        }
13619    }
13620
13621    ///
13622    /// Sets the *request* property to the given value.
13623    ///
13624    /// Even though the property as already been set when instantiating this call,
13625    /// we provide this method for API completeness.
13626    pub fn request(
13627        mut self,
13628        new_value: GeneratePackagesSummaryRequest,
13629    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
13630        self._request = new_value;
13631        self
13632    }
13633    /// Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
13634    ///
13635    /// Sets the *name* path property to the given value.
13636    ///
13637    /// Even though the property as already been set when instantiating this call,
13638    /// we provide this method for API completeness.
13639    pub fn name(mut self, new_value: &str) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
13640        self._name = new_value.to_string();
13641        self
13642    }
13643    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13644    /// while executing the actual API request.
13645    ///
13646    /// ````text
13647    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13648    /// ````
13649    ///
13650    /// Sets the *delegate* property to the given value.
13651    pub fn delegate(
13652        mut self,
13653        new_value: &'a mut dyn common::Delegate,
13654    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
13655        self._delegate = Some(new_value);
13656        self
13657    }
13658
13659    /// Set any additional parameter of the query string used in the request.
13660    /// It should be used to set parameters which are not yet available through their own
13661    /// setters.
13662    ///
13663    /// Please note that this method must not be used to set any of the known parameters
13664    /// which have their own setter method. If done anyway, the request will fail.
13665    ///
13666    /// # Additional Parameters
13667    ///
13668    /// * *$.xgafv* (query-string) - V1 error format.
13669    /// * *access_token* (query-string) - OAuth access token.
13670    /// * *alt* (query-string) - Data format for response.
13671    /// * *callback* (query-string) - JSONP
13672    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13673    /// * *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.
13674    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13675    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13676    /// * *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.
13677    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13678    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13679    pub fn param<T>(
13680        mut self,
13681        name: T,
13682        value: T,
13683    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
13684    where
13685        T: AsRef<str>,
13686    {
13687        self._additional_params
13688            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13689        self
13690    }
13691
13692    /// Identifies the authorization scope for the method you are building.
13693    ///
13694    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13695    /// [`Scope::CloudPlatform`].
13696    ///
13697    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13698    /// tokens for more than one scope.
13699    ///
13700    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13701    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13702    /// sufficient, a read-write scope will do as well.
13703    pub fn add_scope<St>(mut self, scope: St) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
13704    where
13705        St: AsRef<str>,
13706    {
13707        self._scopes.insert(String::from(scope.as_ref()));
13708        self
13709    }
13710    /// Identifies the authorization scope(s) for the method you are building.
13711    ///
13712    /// See [`Self::add_scope()`] for details.
13713    pub fn add_scopes<I, St>(
13714        mut self,
13715        scopes: I,
13716    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
13717    where
13718        I: IntoIterator<Item = St>,
13719        St: AsRef<str>,
13720    {
13721        self._scopes
13722            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13723        self
13724    }
13725
13726    /// Removes all scopes, and no default scope will be used either.
13727    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13728    /// for details).
13729    pub fn clear_scopes(mut self) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
13730        self._scopes.clear();
13731        self
13732    }
13733}