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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = ContainerAnalysis::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Note::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_notes_create(req, "parent")
99///              .note_id("At")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct ContainerAnalysis<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for ContainerAnalysis<C> {}
131
132impl<'a, C> ContainerAnalysis<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> ContainerAnalysis<C> {
137        ContainerAnalysis {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://containeranalysis.googleapis.com/".to_string(),
142            _root_url: "https://containeranalysis.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
147        ProjectMethods { hub: self }
148    }
149
150    /// Set the user-agent header field to use in all requests to the server.
151    /// It defaults to `google-api-rust-client/7.0.0`.
152    ///
153    /// Returns the previously set user-agent.
154    pub fn user_agent(&mut self, agent_name: String) -> String {
155        std::mem::replace(&mut self._user_agent, agent_name)
156    }
157
158    /// Set the base url to use in all requests to the server.
159    /// It defaults to `https://containeranalysis.googleapis.com/`.
160    ///
161    /// Returns the previously set base url.
162    pub fn base_url(&mut self, new_base_url: String) -> String {
163        std::mem::replace(&mut self._base_url, new_base_url)
164    }
165
166    /// Set the root url to use in all requests to the server.
167    /// It defaults to `https://containeranalysis.googleapis.com/`.
168    ///
169    /// Returns the previously set root url.
170    pub fn root_url(&mut self, new_root_url: String) -> String {
171        std::mem::replace(&mut self._root_url, new_root_url)
172    }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// An alias to a repo revision.
179///
180/// This type is not used in any activity, and only used as *part* of another schema.
181///
182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
183#[serde_with::serde_as]
184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
185pub struct AliasContext {
186    /// The alias kind.
187    pub kind: Option<String>,
188    /// The alias name.
189    pub name: Option<String>,
190}
191
192impl common::Part for AliasContext {}
193
194/// Indicates which analysis completed successfully. Multiple types of analysis can be performed on a single resource.
195///
196/// This type is not used in any activity, and only used as *part* of another schema.
197///
198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
199#[serde_with::serde_as]
200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
201pub struct AnalysisCompleted {
202    /// no description provided
203    #[serde(rename = "analysisType")]
204    pub analysis_type: Option<Vec<String>>,
205}
206
207impl common::Part for AnalysisCompleted {}
208
209/// Artifact describes a build product.
210///
211/// This type is not used in any activity, and only used as *part* of another schema.
212///
213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
214#[serde_with::serde_as]
215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
216pub struct Artifact {
217    /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a container.
218    pub checksum: Option<String>,
219    /// Artifact ID, if any; for container images, this will be a URL by digest like `gcr.io/projectID/imagename@sha256:123456`.
220    pub id: Option<String>,
221    /// 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.
222    pub names: Option<Vec<String>>,
223}
224
225impl common::Part for Artifact {}
226
227/// Defines a hash object for use in Materials and Products.
228///
229/// This type is not used in any activity, and only used as *part* of another schema.
230///
231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
232#[serde_with::serde_as]
233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
234pub struct ArtifactHashes {
235    /// no description provided
236    pub sha256: Option<String>,
237}
238
239impl common::Part for ArtifactHashes {}
240
241/// Defines an object to declare an in-toto artifact rule
242///
243/// This type is not used in any activity, and only used as *part* of another schema.
244///
245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
246#[serde_with::serde_as]
247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
248pub struct ArtifactRule {
249    /// no description provided
250    #[serde(rename = "artifactRule")]
251    pub artifact_rule: Option<Vec<String>>,
252}
253
254impl common::Part for ArtifactRule {}
255
256/// Assessment provides all information that is related to a single vulnerability for this product.
257///
258/// This type is not used in any activity, and only used as *part* of another schema.
259///
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct Assessment {
264    /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability. Deprecated: Use vulnerability_id instead to denote CVEs.
265    pub cve: Option<String>,
266    /// Contains information about the impact of this vulnerability, this will change with time.
267    pub impacts: Option<Vec<String>>,
268    /// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
269    pub justification: Option<Justification>,
270    /// A detailed description of this Vex.
271    #[serde(rename = "longDescription")]
272    pub long_description: Option<String>,
273    /// 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.
274    #[serde(rename = "relatedUris")]
275    pub related_uris: Option<Vec<RelatedUrl>>,
276    /// Specifies details on how to handle (and presumably, fix) a vulnerability.
277    pub remediations: Option<Vec<Remediation>>,
278    /// A one sentence description of this Vex.
279    #[serde(rename = "shortDescription")]
280    pub short_description: Option<String>,
281    /// Provides the state of this Vulnerability assessment.
282    pub state: Option<String>,
283    /// The vulnerability identifier for this Assessment. Will hold one of common identifiers e.g. CVE, GHSA etc.
284    #[serde(rename = "vulnerabilityId")]
285    pub vulnerability_id: Option<String>,
286}
287
288impl common::Part for Assessment {}
289
290/// 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).
291///
292/// This type is not used in any activity, and only used as *part* of another schema.
293///
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct Attestation {
298    /// no description provided
299    #[serde(rename = "genericSignedAttestation")]
300    pub generic_signed_attestation: Option<GenericSignedAttestation>,
301    /// A PGP signed attestation.
302    #[serde(rename = "pgpSignedAttestation")]
303    pub pgp_signed_attestation: Option<PgpSignedAttestation>,
304}
305
306impl common::Part for Attestation {}
307
308/// 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.
309///
310/// This type is not used in any activity, and only used as *part* of another schema.
311///
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct Authority {
316    /// Hint hints at the purpose of the attestation authority.
317    pub hint: Option<Hint>,
318}
319
320impl common::Part for Authority {}
321
322/// 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.
323///
324/// This type is not used in any activity, and only used as *part* of another schema.
325///
326#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
327#[serde_with::serde_as]
328#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
329pub struct Basis {
330    /// Required. Immutable. The fingerprint of the base image.
331    pub fingerprint: Option<Fingerprint>,
332    /// Required. Immutable. The resource_url for the resource representing the basis of associated occurrence images.
333    #[serde(rename = "resourceUrl")]
334    pub resource_url: Option<String>,
335}
336
337impl common::Part for Basis {}
338
339/// Request to create notes in batch.
340///
341/// # Activities
342///
343/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
344/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
345///
346/// * [locations notes batch create projects](ProjectLocationNoteBatchCreateCall) (request)
347/// * [notes batch create projects](ProjectNoteBatchCreateCall) (request)
348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
349#[serde_with::serde_as]
350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
351pub struct BatchCreateNotesRequest {
352    /// Required. The notes to create, the key is expected to be the note ID. Max allowed length is 1000.
353    pub notes: Option<HashMap<String, Note>>,
354}
355
356impl common::RequestValue for BatchCreateNotesRequest {}
357
358/// Response for creating notes in batch.
359///
360/// # Activities
361///
362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
364///
365/// * [locations notes batch create projects](ProjectLocationNoteBatchCreateCall) (response)
366/// * [notes batch create projects](ProjectNoteBatchCreateCall) (response)
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct BatchCreateNotesResponse {
371    /// The notes that were created.
372    pub notes: Option<Vec<Note>>,
373}
374
375impl common::ResponseResult for BatchCreateNotesResponse {}
376
377/// Request to create occurrences in batch.
378///
379/// # Activities
380///
381/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
383///
384/// * [locations occurrences batch create projects](ProjectLocationOccurrenceBatchCreateCall) (request)
385/// * [occurrences batch create projects](ProjectOccurrenceBatchCreateCall) (request)
386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
387#[serde_with::serde_as]
388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct BatchCreateOccurrencesRequest {
390    /// Required. The occurrences to create. Max allowed length is 1000.
391    pub occurrences: Option<Vec<Occurrence>>,
392}
393
394impl common::RequestValue for BatchCreateOccurrencesRequest {}
395
396/// Response for creating occurrences in batch.
397///
398/// # Activities
399///
400/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
401/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
402///
403/// * [locations occurrences batch create projects](ProjectLocationOccurrenceBatchCreateCall) (response)
404/// * [occurrences batch create projects](ProjectOccurrenceBatchCreateCall) (response)
405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
406#[serde_with::serde_as]
407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
408pub struct BatchCreateOccurrencesResponse {
409    /// The occurrences that were created.
410    pub occurrences: Option<Vec<Occurrence>>,
411}
412
413impl common::ResponseResult for BatchCreateOccurrencesResponse {}
414
415/// Associates `members`, or principals, with a `role`.
416///
417/// This type is not used in any activity, and only used as *part* of another schema.
418///
419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
420#[serde_with::serde_as]
421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
422pub struct Binding {
423    /// 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).
424    pub condition: Option<Expr>,
425    /// 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`.
426    pub members: Option<Vec<String>>,
427    /// 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).
428    pub role: Option<String>,
429}
430
431impl common::Part for Binding {}
432
433/// Note holding the version of the provider's builder and the signature of the provenance message in the build details occurrence.
434///
435/// This type is not used in any activity, and only used as *part* of another schema.
436///
437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
438#[serde_with::serde_as]
439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
440pub struct Build {
441    /// Required. Immutable. Version of the builder which produced this build.
442    #[serde(rename = "builderVersion")]
443    pub builder_version: Option<String>,
444    /// Signature of the build in occurrences pointing to this build note containing build details.
445    pub signature: Option<BuildSignature>,
446}
447
448impl common::Part for Build {}
449
450/// There is no detailed description.
451///
452/// This type is not used in any activity, and only used as *part* of another schema.
453///
454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
455#[serde_with::serde_as]
456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
457pub struct BuildDefinition {
458    /// no description provided
459    #[serde(rename = "buildType")]
460    pub build_type: Option<String>,
461    /// no description provided
462    #[serde(rename = "externalParameters")]
463    pub external_parameters: Option<HashMap<String, serde_json::Value>>,
464    /// no description provided
465    #[serde(rename = "internalParameters")]
466    pub internal_parameters: Option<HashMap<String, serde_json::Value>>,
467    /// no description provided
468    #[serde(rename = "resolvedDependencies")]
469    pub resolved_dependencies: Option<Vec<ResourceDescriptor>>,
470}
471
472impl common::Part for BuildDefinition {}
473
474/// There is no detailed description.
475///
476/// This type is not used in any activity, and only used as *part* of another schema.
477///
478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
479#[serde_with::serde_as]
480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
481pub struct BuildMetadata {
482    /// no description provided
483    #[serde(rename = "finishedOn")]
484    pub finished_on: Option<chrono::DateTime<chrono::offset::Utc>>,
485    /// no description provided
486    #[serde(rename = "invocationId")]
487    pub invocation_id: Option<String>,
488    /// no description provided
489    #[serde(rename = "startedOn")]
490    pub started_on: Option<chrono::DateTime<chrono::offset::Utc>>,
491}
492
493impl common::Part for BuildMetadata {}
494
495/// Provenance of a build. Contains all information needed to verify the full details about the build from source to completion.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct BuildProvenance {
503    /// Special options applied to this build. This is a catch-all field where build providers can enter any desired additional details.
504    #[serde(rename = "buildOptions")]
505    pub build_options: Option<HashMap<String, String>>,
506    /// Version string of the builder at the time this build was executed.
507    #[serde(rename = "builderVersion")]
508    pub builder_version: Option<String>,
509    /// Output of the build.
510    #[serde(rename = "builtArtifacts")]
511    pub built_artifacts: Option<Vec<Artifact>>,
512    /// Commands requested by the build.
513    pub commands: Option<Vec<Command>>,
514    /// Time at which the build was created.
515    #[serde(rename = "createTime")]
516    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
517    /// 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.
518    pub creator: Option<String>,
519    /// Time at which execution of the build was finished.
520    #[serde(rename = "endTime")]
521    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
522    /// Required. Unique identifier of the build.
523    pub id: Option<String>,
524    /// URI where any logs for this provenance were written.
525    #[serde(rename = "logsUri")]
526    pub logs_uri: Option<String>,
527    /// ID of the project.
528    #[serde(rename = "projectId")]
529    pub project_id: Option<String>,
530    /// Details of the Source input to the build.
531    #[serde(rename = "sourceProvenance")]
532    pub source_provenance: Option<Source>,
533    /// Time at which execution of the build was started.
534    #[serde(rename = "startTime")]
535    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
536    /// Trigger identifier if the build was triggered automatically; empty if not.
537    #[serde(rename = "triggerId")]
538    pub trigger_id: Option<String>,
539}
540
541impl common::Part for BuildProvenance {}
542
543/// Message encapsulating the signature of the verified build.
544///
545/// This type is not used in any activity, and only used as *part* of another schema.
546///
547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
548#[serde_with::serde_as]
549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
550pub struct BuildSignature {
551    /// 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).
552    #[serde(rename = "keyId")]
553    pub key_id: Option<String>,
554    /// The type of the key, either stored in `public_key` or referenced in `key_id`.
555    #[serde(rename = "keyType")]
556    pub key_type: Option<String>,
557    /// 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`
558    #[serde(rename = "publicKey")]
559    pub public_key: Option<String>,
560    /// Required. Signature of the related `BuildProvenance`. In JSON, this is base-64 encoded.
561    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
562    pub signature: Option<Vec<u8>>,
563}
564
565impl common::Part for BuildSignature {}
566
567/// Defines an object for the byproducts field in in-toto links. The suggested fields are "stderr", "stdout", and "return-value".
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 ByProducts {
575    /// no description provided
576    #[serde(rename = "customValues")]
577    pub custom_values: Option<HashMap<String, String>>,
578}
579
580impl common::Part for ByProducts {}
581
582/// 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
583///
584/// This type is not used in any activity, and only used as *part* of another schema.
585///
586#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
587#[serde_with::serde_as]
588#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
589pub struct CVSS {
590    /// Defined in CVSS v3, CVSS v2
591    #[serde(rename = "attackComplexity")]
592    pub attack_complexity: Option<String>,
593    /// Base Metrics Represents the intrinsic characteristics of a vulnerability that are constant over time and across user environments. Defined in CVSS v3, CVSS v2
594    #[serde(rename = "attackVector")]
595    pub attack_vector: Option<String>,
596    /// Defined in CVSS v2
597    pub authentication: Option<String>,
598    /// Defined in CVSS v3, CVSS v2
599    #[serde(rename = "availabilityImpact")]
600    pub availability_impact: Option<String>,
601    /// The base score is a function of the base metric scores.
602    #[serde(rename = "baseScore")]
603    pub base_score: Option<f32>,
604    /// Defined in CVSS v3, CVSS v2
605    #[serde(rename = "confidentialityImpact")]
606    pub confidentiality_impact: Option<String>,
607    /// no description provided
608    #[serde(rename = "exploitabilityScore")]
609    pub exploitability_score: Option<f32>,
610    /// no description provided
611    #[serde(rename = "impactScore")]
612    pub impact_score: Option<f32>,
613    /// Defined in CVSS v3, CVSS v2
614    #[serde(rename = "integrityImpact")]
615    pub integrity_impact: Option<String>,
616    /// Defined in CVSS v3
617    #[serde(rename = "privilegesRequired")]
618    pub privileges_required: Option<String>,
619    /// Defined in CVSS v3
620    pub scope: Option<String>,
621    /// Defined in CVSS v3
622    #[serde(rename = "userInteraction")]
623    pub user_interaction: Option<String>,
624}
625
626impl common::Part for CVSS {}
627
628/// Deprecated. Common Vulnerability Scoring System version 3. For details, see https://www.first.org/cvss/specification-document
629///
630/// This type is not used in any activity, and only used as *part* of another schema.
631///
632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
633#[serde_with::serde_as]
634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
635pub struct CVSSv3 {
636    /// no description provided
637    #[serde(rename = "attackComplexity")]
638    pub attack_complexity: Option<String>,
639    /// Base Metrics Represents the intrinsic characteristics of a vulnerability that are constant over time and across user environments.
640    #[serde(rename = "attackVector")]
641    pub attack_vector: Option<String>,
642    /// no description provided
643    #[serde(rename = "availabilityImpact")]
644    pub availability_impact: Option<String>,
645    /// The base score is a function of the base metric scores.
646    #[serde(rename = "baseScore")]
647    pub base_score: Option<f32>,
648    /// no description provided
649    #[serde(rename = "confidentialityImpact")]
650    pub confidentiality_impact: Option<String>,
651    /// no description provided
652    #[serde(rename = "exploitabilityScore")]
653    pub exploitability_score: Option<f32>,
654    /// no description provided
655    #[serde(rename = "impactScore")]
656    pub impact_score: Option<f32>,
657    /// no description provided
658    #[serde(rename = "integrityImpact")]
659    pub integrity_impact: Option<String>,
660    /// no description provided
661    #[serde(rename = "privilegesRequired")]
662    pub privileges_required: Option<String>,
663    /// no description provided
664    pub scope: Option<String>,
665    /// no description provided
666    #[serde(rename = "userInteraction")]
667    pub user_interaction: Option<String>,
668}
669
670impl common::Part for CVSSv3 {}
671
672/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud Source Repo.
673///
674/// This type is not used in any activity, and only used as *part* of another schema.
675///
676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
677#[serde_with::serde_as]
678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
679pub struct CloudRepoSourceContext {
680    /// An alias, which may be a branch or tag.
681    #[serde(rename = "aliasContext")]
682    pub alias_context: Option<AliasContext>,
683    /// The ID of the repo.
684    #[serde(rename = "repoId")]
685    pub repo_id: Option<RepoId>,
686    /// A revision ID.
687    #[serde(rename = "revisionId")]
688    pub revision_id: Option<String>,
689}
690
691impl common::Part for CloudRepoSourceContext {}
692
693/// Command describes a step performed as part of the build pipeline.
694///
695/// This type is not used in any activity, and only used as *part* of another schema.
696///
697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
698#[serde_with::serde_as]
699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
700pub struct Command {
701    /// Command-line arguments used when executing this command.
702    pub args: Option<Vec<String>>,
703    /// Working directory (relative to project source root) used when running this command.
704    pub dir: Option<String>,
705    /// Environment variables set before running this command.
706    pub env: Option<Vec<String>>,
707    /// Optional unique identifier for this command, used in wait_for to reference this command as a dependency.
708    pub id: Option<String>,
709    /// 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`.
710    pub name: Option<String>,
711    /// The ID(s) of the command(s) that this command depends on.
712    #[serde(rename = "waitFor")]
713    pub wait_for: Option<Vec<String>>,
714}
715
716impl common::Part for Command {}
717
718/// An artifact that can be deployed in some 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 Deployable {
726    /// Required. Resource URI for the artifact being deployed.
727    #[serde(rename = "resourceUri")]
728    pub resource_uri: Option<Vec<String>>,
729}
730
731impl common::Part for Deployable {}
732
733/// The period during which some deployable was active in a runtime.
734///
735/// This type is not used in any activity, and only used as *part* of another schema.
736///
737#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
738#[serde_with::serde_as]
739#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
740pub struct Deployment {
741    /// Address of the runtime element hosting this deployment.
742    pub address: Option<String>,
743    /// Configuration used to create this deployment.
744    pub config: Option<String>,
745    /// Required. Beginning of the lifetime of this deployment.
746    #[serde(rename = "deployTime")]
747    pub deploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
748    /// Platform hosting this deployment.
749    pub platform: Option<String>,
750    /// Output only. Resource URI for the artifact being deployed taken from the deployable field with the same name.
751    #[serde(rename = "resourceUri")]
752    pub resource_uri: Option<Vec<String>>,
753    /// End of the lifetime of this deployment.
754    #[serde(rename = "undeployTime")]
755    pub undeploy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
756    /// Identity of the user that triggered this deployment.
757    #[serde(rename = "userEmail")]
758    pub user_email: Option<String>,
759}
760
761impl common::Part for Deployment {}
762
763/// Derived describes the derived image portion (Occurrence) of the DockerImage relationship. This image would be produced from a Dockerfile with FROM .
764///
765/// This type is not used in any activity, and only used as *part* of another schema.
766///
767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
768#[serde_with::serde_as]
769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
770pub struct Derived {
771    /// Output only. This contains the base image URL for the derived image occurrence.
772    #[serde(rename = "baseResourceUrl")]
773    pub base_resource_url: Option<String>,
774    /// Output only. The number of layers by which this image differs from the associated image basis.
775    pub distance: Option<i32>,
776    /// Required. The fingerprint of the derived image.
777    pub fingerprint: Option<Fingerprint>,
778    /// 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.
779    #[serde(rename = "layerInfo")]
780    pub layer_info: Option<Vec<Layer>>,
781}
782
783impl common::Part for Derived {}
784
785/// 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
786///
787/// This type is not used in any activity, and only used as *part* of another schema.
788///
789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
790#[serde_with::serde_as]
791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
792pub struct Detail {
793    /// 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.
794    #[serde(rename = "cpeUri")]
795    pub cpe_uri: Option<String>,
796    /// A vendor-specific description of this note.
797    pub description: Option<String>,
798    /// The fix for this specific package version.
799    #[serde(rename = "fixedLocation")]
800    pub fixed_location: Option<VulnerabilityLocation>,
801    /// Whether this detail is obsolete. Occurrences are expected not to point to obsolete details.
802    #[serde(rename = "isObsolete")]
803    pub is_obsolete: Option<bool>,
804    /// The max version of the package in which the vulnerability exists.
805    #[serde(rename = "maxAffectedVersion")]
806    pub max_affected_version: Option<Version>,
807    /// The min version of the package in which the vulnerability exists.
808    #[serde(rename = "minAffectedVersion")]
809    pub min_affected_version: Option<Version>,
810    /// Required. The name of the package where the vulnerability was found.
811    pub package: Option<String>,
812    /// The type of package; whether native or non native(ruby gems, node.js packages etc).
813    #[serde(rename = "packageType")]
814    pub package_type: Option<String>,
815    /// The severity (eg: distro assigned severity) for this vulnerability.
816    #[serde(rename = "severityName")]
817    pub severity_name: Option<String>,
818    /// The source from which the information in this Detail was obtained.
819    pub source: Option<String>,
820    /// 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.
821    #[serde(rename = "sourceUpdateTime")]
822    pub source_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
823    /// The name of the vendor of the product.
824    pub vendor: Option<String>,
825}
826
827impl common::Part for Detail {}
828
829/// Details of an attestation occurrence.
830///
831/// This type is not used in any activity, and only used as *part* of another schema.
832///
833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
834#[serde_with::serde_as]
835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
836pub struct Details {
837    /// Required. Attestation for the resource.
838    pub attestation: Option<Attestation>,
839}
840
841impl common::Part for Details {}
842
843/// Digest information.
844///
845/// This type is not used in any activity, and only used as *part* of another schema.
846///
847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
848#[serde_with::serde_as]
849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
850pub struct Digest {
851    /// `SHA1`, `SHA512` etc.
852    pub algo: Option<String>,
853    /// Value of the digest.
854    #[serde(rename = "digestBytes")]
855    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
856    pub digest_bytes: Option<Vec<u8>>,
857}
858
859impl common::Part for Digest {}
860
861/// Provides information about the analysis status of a discovered resource.
862///
863/// This type is not used in any activity, and only used as *part* of another schema.
864///
865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
866#[serde_with::serde_as]
867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
868pub struct Discovered {
869    /// no description provided
870    #[serde(rename = "analysisCompleted")]
871    pub analysis_completed: Option<AnalysisCompleted>,
872    /// Indicates any errors encountered during analysis of a resource. There could be 0 or more of these errors.
873    #[serde(rename = "analysisError")]
874    pub analysis_error: Option<Vec<Status>>,
875    /// The status of discovery for the resource.
876    #[serde(rename = "analysisStatus")]
877    pub analysis_status: Option<String>,
878    /// 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.
879    #[serde(rename = "analysisStatusError")]
880    pub analysis_status_error: Option<Status>,
881    /// Whether the resource is continuously analyzed.
882    #[serde(rename = "continuousAnalysis")]
883    pub continuous_analysis: Option<String>,
884    /// Files that make up the resource described by the occurrence.
885    pub files: Option<Vec<File>>,
886    /// The last time continuous analysis was done for this resource. Deprecated, do not use.
887    #[serde(rename = "lastAnalysisTime")]
888    pub last_analysis_time: Option<chrono::DateTime<chrono::offset::Utc>>,
889    /// The last time this resource was scanned.
890    #[serde(rename = "lastScanTime")]
891    pub last_scan_time: Option<chrono::DateTime<chrono::offset::Utc>>,
892    /// The status of an SBOM generation.
893    #[serde(rename = "sbomStatus")]
894    pub sbom_status: Option<SBOMStatus>,
895}
896
897impl common::Part for Discovered {}
898
899/// 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.
900///
901/// This type is not used in any activity, and only used as *part* of another schema.
902///
903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
904#[serde_with::serde_as]
905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
906pub struct Discovery {
907    /// Required. Immutable. The kind of analysis that is handled by this discovery.
908    #[serde(rename = "analysisKind")]
909    pub analysis_kind: Option<String>,
910}
911
912impl common::Part for Discovery {}
913
914/// This represents a particular channel of distribution for a given package. E.g., Debian's jessie-backports dpkg mirror.
915///
916/// This type is not used in any activity, and only used as *part* of another schema.
917///
918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
919#[serde_with::serde_as]
920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
921pub struct Distribution {
922    /// The CPU architecture for which packages in this distribution channel were built.
923    pub architecture: Option<String>,
924    /// Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) denoting the package manager version distributing a package.
925    #[serde(rename = "cpeUri")]
926    pub cpe_uri: Option<String>,
927    /// The distribution channel-specific description of this package.
928    pub description: Option<String>,
929    /// The latest available version of this package in this distribution channel.
930    #[serde(rename = "latestVersion")]
931    pub latest_version: Option<Version>,
932    /// A freeform string denoting the maintainer of this package.
933    pub maintainer: Option<String>,
934    /// The distribution channel-specific homepage for this package.
935    pub url: Option<String>,
936}
937
938impl common::Part for Distribution {}
939
940/// DocumentNote represents an SPDX Document Creation Information section: https://spdx.github.io/spdx-spec/2-document-creation-information/
941///
942/// This type is not used in any activity, and only used as *part* of another schema.
943///
944#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
945#[serde_with::serde_as]
946#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
947pub struct DocumentNote {
948    /// Compliance with the SPDX specification includes populating the SPDX fields therein with data related to such fields ("SPDX-Metadata")
949    #[serde(rename = "dataLicence")]
950    pub data_licence: Option<String>,
951    /// Provide a reference number that can be used to understand how to parse and interpret the rest of the file
952    #[serde(rename = "spdxVersion")]
953    pub spdx_version: Option<String>,
954}
955
956impl common::Part for DocumentNote {}
957
958/// DocumentOccurrence represents an SPDX Document Creation Information section: https://spdx.github.io/spdx-spec/2-document-creation-information/
959///
960/// This type is not used in any activity, and only used as *part* of another schema.
961///
962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
963#[serde_with::serde_as]
964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
965pub struct DocumentOccurrence {
966    /// 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
967    #[serde(rename = "createTime")]
968    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
969    /// 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
970    #[serde(rename = "creatorComment")]
971    pub creator_comment: Option<String>,
972    /// 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
973    pub creators: Option<Vec<String>>,
974    /// A field for creators of the SPDX file content to provide comments to the consumers of the SPDX document
975    #[serde(rename = "documentComment")]
976    pub document_comment: Option<String>,
977    /// Identify any external SPDX documents referenced within this SPDX document
978    #[serde(rename = "externalDocumentRefs")]
979    pub external_document_refs: Option<Vec<String>>,
980    /// Identify the current SPDX document which may be referenced in relationships by other files, packages internally and documents externally
981    pub id: Option<String>,
982    /// A field for creators of the SPDX file to provide the version of the SPDX License List used when the SPDX file was created
983    #[serde(rename = "licenseListVersion")]
984    pub license_list_version: Option<String>,
985    /// 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
986    pub namespace: Option<String>,
987    /// Identify name of this document as designated by creator
988    pub title: Option<String>,
989}
990
991impl common::Part for DocumentOccurrence {}
992
993/// 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); }
994///
995/// # Activities
996///
997/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
998/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
999///
1000/// * [locations notes delete projects](ProjectLocationNoteDeleteCall) (response)
1001/// * [locations occurrences delete projects](ProjectLocationOccurrenceDeleteCall) (response)
1002/// * [notes delete projects](ProjectNoteDeleteCall) (response)
1003/// * [occurrences delete projects](ProjectOccurrenceDeleteCall) (response)
1004#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1005#[serde_with::serde_as]
1006#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1007pub struct Empty {
1008    _never_set: Option<bool>,
1009}
1010
1011impl common::ResponseResult for Empty {}
1012
1013/// MUST match https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto. An authenticated message of arbitrary type.
1014///
1015/// This type is not used in any activity, and only used as *part* of another schema.
1016///
1017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1018#[serde_with::serde_as]
1019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct Envelope {
1021    /// no description provided
1022    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1023    pub payload: Option<Vec<u8>>,
1024    /// no description provided
1025    #[serde(rename = "payloadType")]
1026    pub payload_type: Option<String>,
1027    /// no description provided
1028    pub signatures: Option<Vec<EnvelopeSignature>>,
1029}
1030
1031impl common::Part for Envelope {}
1032
1033/// There is no detailed description.
1034///
1035/// This type is not used in any activity, and only used as *part* of another schema.
1036///
1037#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1038#[serde_with::serde_as]
1039#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1040pub struct EnvelopeSignature {
1041    /// no description provided
1042    pub keyid: Option<String>,
1043    /// no description provided
1044    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1045    pub sig: Option<Vec<u8>>,
1046}
1047
1048impl common::Part for EnvelopeSignature {}
1049
1050/// Defines an object for the environment field in in-toto links. The suggested fields are "variables", "filesystem", and "workdir".
1051///
1052/// This type is not used in any activity, and only used as *part* of another schema.
1053///
1054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1055#[serde_with::serde_as]
1056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1057pub struct Environment {
1058    /// no description provided
1059    #[serde(rename = "customValues")]
1060    pub custom_values: Option<HashMap<String, String>>,
1061}
1062
1063impl common::Part for Environment {}
1064
1065/// The request to a call of ExportSBOM
1066///
1067/// # Activities
1068///
1069/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1070/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1071///
1072/// * [locations resources export sbom projects](ProjectLocationResourceExportSBOMCall) (request)
1073/// * [resources export sbom projects](ProjectResourceExportSBOMCall) (request)
1074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1075#[serde_with::serde_as]
1076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1077pub struct ExportSBOMRequest {
1078    _never_set: Option<bool>,
1079}
1080
1081impl common::RequestValue for ExportSBOMRequest {}
1082
1083/// The response from a call to ExportSBOM
1084///
1085/// # Activities
1086///
1087/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1088/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1089///
1090/// * [locations resources export sbom projects](ProjectLocationResourceExportSBOMCall) (response)
1091/// * [resources export sbom projects](ProjectResourceExportSBOMCall) (response)
1092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1093#[serde_with::serde_as]
1094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1095pub struct ExportSBOMResponse {
1096    /// 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.
1097    #[serde(rename = "discoveryOccurrenceId")]
1098    pub discovery_occurrence_id: Option<String>,
1099}
1100
1101impl common::ResponseResult for ExportSBOMResponse {}
1102
1103/// 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.
1104///
1105/// This type is not used in any activity, and only used as *part* of another schema.
1106///
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct Expr {
1111    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1112    pub description: Option<String>,
1113    /// Textual representation of an expression in Common Expression Language syntax.
1114    pub expression: Option<String>,
1115    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1116    pub location: Option<String>,
1117    /// 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.
1118    pub title: Option<String>,
1119}
1120
1121impl common::Part for Expr {}
1122
1123/// 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
1124///
1125/// This type is not used in any activity, and only used as *part* of another schema.
1126///
1127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1128#[serde_with::serde_as]
1129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1130pub struct ExternalRef {
1131    /// 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
1132    pub category: Option<String>,
1133    /// Human-readable information about the purpose and target of the reference
1134    pub comment: Option<String>,
1135    /// The unique string with no spaces necessary to access the package-specific information, metadata, or content within the target location
1136    pub locator: Option<String>,
1137    /// Type of category (e.g. 'npm' for the PACKAGE_MANAGER category)
1138    #[serde(rename = "type")]
1139    pub type_: Option<String>,
1140}
1141
1142impl common::Part for ExternalRef {}
1143
1144/// There is no detailed description.
1145///
1146/// This type is not used in any activity, and only used as *part* of another schema.
1147///
1148#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1149#[serde_with::serde_as]
1150#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1151pub struct File {
1152    /// no description provided
1153    pub digest: Option<HashMap<String, String>>,
1154    /// no description provided
1155    pub name: Option<String>,
1156}
1157
1158impl common::Part for File {}
1159
1160/// Container message for hashes of byte content of files, used in source messages to verify integrity of source input to the build.
1161///
1162/// This type is not used in any activity, and only used as *part* of another schema.
1163///
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct FileHashes {
1168    /// Required. Collection of file hashes.
1169    #[serde(rename = "fileHash")]
1170    pub file_hash: Option<Vec<Hash>>,
1171}
1172
1173impl common::Part for FileHashes {}
1174
1175/// Indicates the location at which a package was found.
1176///
1177/// This type is not used in any activity, and only used as *part* of another schema.
1178///
1179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1180#[serde_with::serde_as]
1181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1182pub struct FileLocation {
1183    /// For jars that are contained inside .war files, this filepath can indicate the path to war file combined with the path to jar file.
1184    #[serde(rename = "filePath")]
1185    pub file_path: Option<String>,
1186}
1187
1188impl common::Part for FileLocation {}
1189
1190/// FileNote represents an SPDX File Information section: https://spdx.github.io/spdx-spec/4-file-information/
1191///
1192/// This type is not used in any activity, and only used as *part* of another schema.
1193///
1194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1195#[serde_with::serde_as]
1196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1197pub struct FileNote {
1198    /// Provide a unique identifier to match analysis information on each specific file in a package
1199    pub checksum: Option<Vec<String>>,
1200    /// This field provides information about the type of file identified
1201    #[serde(rename = "fileType")]
1202    pub file_type: Option<String>,
1203    /// Identify the full path and filename that corresponds to the file information in this section
1204    pub title: Option<String>,
1205}
1206
1207impl common::Part for FileNote {}
1208
1209/// FileOccurrence represents an SPDX File Information section: https://spdx.github.io/spdx-spec/4-file-information/
1210///
1211/// This type is not used in any activity, and only used as *part* of another schema.
1212///
1213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1214#[serde_with::serde_as]
1215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1216pub struct FileOccurrence {
1217    /// 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
1218    pub attributions: Option<Vec<String>>,
1219    /// This field provides a place for the SPDX file creator to record any general comments about the file
1220    pub comment: Option<String>,
1221    /// This field provides a place for the SPDX file creator to record file contributors
1222    pub contributors: Option<Vec<String>>,
1223    /// Identify the copyright holder of the file, as well as any dates present
1224    pub copyright: Option<String>,
1225    /// This field contains the license information actually found in the file, if any
1226    #[serde(rename = "filesLicenseInfo")]
1227    pub files_license_info: Option<Vec<String>>,
1228    /// Uniquely identify any element in an SPDX document which may be referenced by other elements
1229    pub id: Option<String>,
1230    /// 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
1231    #[serde(rename = "licenseConcluded")]
1232    pub license_concluded: Option<License>,
1233    /// This field provides a place for the SPDX file creator to record license notices or other such related notices found in the file
1234    pub notice: Option<String>,
1235}
1236
1237impl common::Part for FileOccurrence {}
1238
1239/// A set of properties that uniquely identify a given Docker image.
1240///
1241/// This type is not used in any activity, and only used as *part* of another schema.
1242///
1243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1244#[serde_with::serde_as]
1245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1246pub struct Fingerprint {
1247    /// Required. The layer ID of the final layer in the Docker image's v1 representation.
1248    #[serde(rename = "v1Name")]
1249    pub v1_name: Option<String>,
1250    /// Required. The ordered list of v2 blobs that represent a given image.
1251    #[serde(rename = "v2Blob")]
1252    pub v2_blob: Option<Vec<String>>,
1253    /// 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.
1254    #[serde(rename = "v2Name")]
1255    pub v2_name: Option<String>,
1256}
1257
1258impl common::Part for Fingerprint {}
1259
1260/// Per resource and severity counts of fixable and total vulnerabilities.
1261///
1262/// This type is not used in any activity, and only used as *part* of another schema.
1263///
1264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1265#[serde_with::serde_as]
1266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1267pub struct FixableTotalByDigest {
1268    /// The number of fixable vulnerabilities associated with this resource.
1269    #[serde(rename = "fixableCount")]
1270    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1271    pub fixable_count: Option<i64>,
1272    /// The affected resource.
1273    pub resource: Option<Resource>,
1274    /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across all severities.
1275    pub severity: Option<String>,
1276    /// The total number of vulnerabilities associated with this resource.
1277    #[serde(rename = "totalCount")]
1278    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1279    pub total_count: Option<i64>,
1280}
1281
1282impl common::Part for FixableTotalByDigest {}
1283
1284/// GeneratePackagesSummaryRequest is the request body for the GeneratePackagesSummary API method. It just takes a single name argument, referring to the resource.
1285///
1286/// # Activities
1287///
1288/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1289/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1290///
1291/// * [locations resources generate packages summary projects](ProjectLocationResourceGeneratePackagesSummaryCall) (request)
1292/// * [resources generate packages summary projects](ProjectResourceGeneratePackagesSummaryCall) (request)
1293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1294#[serde_with::serde_as]
1295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1296pub struct GeneratePackagesSummaryRequest {
1297    _never_set: Option<bool>,
1298}
1299
1300impl common::RequestValue for GeneratePackagesSummaryRequest {}
1301
1302/// 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.
1303///
1304/// This type is not used in any activity, and only used as *part* of another schema.
1305///
1306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1307#[serde_with::serde_as]
1308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1309pub struct GenericSignedAttestation {
1310    /// 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).
1311    #[serde(rename = "contentType")]
1312    pub content_type: Option<String>,
1313    /// 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`.
1314    #[serde(rename = "serializedPayload")]
1315    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1316    pub serialized_payload: Option<Vec<u8>>,
1317    /// 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.
1318    pub signatures: Option<Vec<Signature>>,
1319}
1320
1321impl common::Part for GenericSignedAttestation {}
1322
1323/// A SourceContext referring to a Gerrit project.
1324///
1325/// This type is not used in any activity, and only used as *part* of another schema.
1326///
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct GerritSourceContext {
1331    /// An alias, which may be a branch or tag.
1332    #[serde(rename = "aliasContext")]
1333    pub alias_context: Option<AliasContext>,
1334    /// 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.
1335    #[serde(rename = "gerritProject")]
1336    pub gerrit_project: Option<String>,
1337    /// The URI of a running Gerrit instance.
1338    #[serde(rename = "hostUri")]
1339    pub host_uri: Option<String>,
1340    /// A revision (commit) ID.
1341    #[serde(rename = "revisionId")]
1342    pub revision_id: Option<String>,
1343}
1344
1345impl common::Part for GerritSourceContext {}
1346
1347/// Request message for `GetIamPolicy` method.
1348///
1349/// # Activities
1350///
1351/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1352/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1353///
1354/// * [locations notes get iam policy projects](ProjectLocationNoteGetIamPolicyCall) (request)
1355/// * [locations occurrences get iam policy projects](ProjectLocationOccurrenceGetIamPolicyCall) (request)
1356/// * [notes get iam policy projects](ProjectNoteGetIamPolicyCall) (request)
1357/// * [occurrences get iam policy projects](ProjectOccurrenceGetIamPolicyCall) (request)
1358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1359#[serde_with::serde_as]
1360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1361pub struct GetIamPolicyRequest {
1362    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
1363    pub options: Option<GetPolicyOptions>,
1364}
1365
1366impl common::RequestValue for GetIamPolicyRequest {}
1367
1368/// Encapsulates settings provided to GetIamPolicy.
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 GetPolicyOptions {
1376    /// 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).
1377    #[serde(rename = "requestedPolicyVersion")]
1378    pub requested_policy_version: Option<i32>,
1379}
1380
1381impl common::Part for GetPolicyOptions {}
1382
1383/// A GitSourceContext denotes a particular revision in a third party Git repository (e.g., GitHub).
1384///
1385/// This type is not used in any activity, and only used as *part* of another schema.
1386///
1387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1388#[serde_with::serde_as]
1389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1390pub struct GitSourceContext {
1391    /// Git commit hash.
1392    #[serde(rename = "revisionId")]
1393    pub revision_id: Option<String>,
1394    /// Git repository URL.
1395    pub url: Option<String>,
1396}
1397
1398impl common::Part for GitSourceContext {}
1399
1400/// Details of a build occurrence.
1401///
1402/// This type is not used in any activity, and only used as *part* of another schema.
1403///
1404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1405#[serde_with::serde_as]
1406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1407pub struct GrafeasV1beta1BuildDetails {
1408    /// no description provided
1409    #[serde(rename = "inTotoSlsaProvenanceV1")]
1410    pub in_toto_slsa_provenance_v1: Option<InTotoSlsaProvenanceV1>,
1411    /// Required. The actual provenance for the build.
1412    pub provenance: Option<BuildProvenance>,
1413    /// 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.
1414    #[serde(rename = "provenanceBytes")]
1415    pub provenance_bytes: Option<String>,
1416}
1417
1418impl common::Part for GrafeasV1beta1BuildDetails {}
1419
1420/// Details of a deployment occurrence.
1421///
1422/// This type is not used in any activity, and only used as *part* of another schema.
1423///
1424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1425#[serde_with::serde_as]
1426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1427pub struct GrafeasV1beta1DeploymentDetails {
1428    /// Required. Deployment history for the resource.
1429    pub deployment: Option<Deployment>,
1430}
1431
1432impl common::Part for GrafeasV1beta1DeploymentDetails {}
1433
1434/// Details of a discovery occurrence.
1435///
1436/// This type is not used in any activity, and only used as *part* of another schema.
1437///
1438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1439#[serde_with::serde_as]
1440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1441pub struct GrafeasV1beta1DiscoveryDetails {
1442    /// Required. Analysis status for the discovered resource.
1443    pub discovered: Option<Discovered>,
1444}
1445
1446impl common::Part for GrafeasV1beta1DiscoveryDetails {}
1447
1448/// Details of an image occurrence.
1449///
1450/// This type is not used in any activity, and only used as *part* of another schema.
1451///
1452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1453#[serde_with::serde_as]
1454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1455pub struct GrafeasV1beta1ImageDetails {
1456    /// Required. Immutable. The child image derived from the base image.
1457    #[serde(rename = "derivedImage")]
1458    pub derived_image: Option<Derived>,
1459}
1460
1461impl common::Part for GrafeasV1beta1ImageDetails {}
1462
1463/// There is no detailed description.
1464///
1465/// This type is not used in any activity, and only used as *part* of another schema.
1466///
1467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1468#[serde_with::serde_as]
1469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1470pub struct GrafeasV1beta1IntotoArtifact {
1471    /// no description provided
1472    pub hashes: Option<ArtifactHashes>,
1473    /// no description provided
1474    #[serde(rename = "resourceUri")]
1475    pub resource_uri: Option<String>,
1476}
1477
1478impl common::Part for GrafeasV1beta1IntotoArtifact {}
1479
1480/// 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.
1481///
1482/// This type is not used in any activity, and only used as *part* of another schema.
1483///
1484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1485#[serde_with::serde_as]
1486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct GrafeasV1beta1IntotoDetails {
1488    /// no description provided
1489    pub signatures: Option<Vec<GrafeasV1beta1IntotoSignature>>,
1490    /// no description provided
1491    pub signed: Option<Link>,
1492}
1493
1494impl common::Part for GrafeasV1beta1IntotoDetails {}
1495
1496/// A signature object consists of the KeyID used and the signature itself.
1497///
1498/// This type is not used in any activity, and only used as *part* of another schema.
1499///
1500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1501#[serde_with::serde_as]
1502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1503pub struct GrafeasV1beta1IntotoSignature {
1504    /// no description provided
1505    pub keyid: Option<String>,
1506    /// no description provided
1507    pub sig: Option<String>,
1508}
1509
1510impl common::Part for GrafeasV1beta1IntotoSignature {}
1511
1512/// Details of a package occurrence.
1513///
1514/// This type is not used in any activity, and only used as *part* of another schema.
1515///
1516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1517#[serde_with::serde_as]
1518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1519pub struct GrafeasV1beta1PackageDetails {
1520    /// Required. Where the package was installed.
1521    pub installation: Option<Installation>,
1522}
1523
1524impl common::Part for GrafeasV1beta1PackageDetails {}
1525
1526/// Details of a vulnerability Occurrence.
1527///
1528/// This type is not used in any activity, and only used as *part* of another schema.
1529///
1530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1531#[serde_with::serde_as]
1532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1533pub struct GrafeasV1beta1VulnerabilityDetails {
1534    /// 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.
1535    #[serde(rename = "cvssScore")]
1536    pub cvss_score: Option<f32>,
1537    /// The cvss v2 score for the vulnerability.
1538    #[serde(rename = "cvssV2")]
1539    pub cvss_v2: Option<CVSS>,
1540    /// The cvss v3 score for the vulnerability.
1541    #[serde(rename = "cvssV3")]
1542    pub cvss_v3: Option<CVSS>,
1543    /// Output only. CVSS version used to populate cvss_score and severity.
1544    #[serde(rename = "cvssVersion")]
1545    pub cvss_version: Option<String>,
1546    /// 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.
1547    #[serde(rename = "effectiveSeverity")]
1548    pub effective_severity: Option<String>,
1549    /// Occurrence-specific extra details about the vulnerability.
1550    #[serde(rename = "extraDetails")]
1551    pub extra_details: Option<String>,
1552    /// Output only. A detailed description of this vulnerability.
1553    #[serde(rename = "longDescription")]
1554    pub long_description: Option<String>,
1555    /// Required. The set of affected locations and their fixes (if available) within the associated resource.
1556    #[serde(rename = "packageIssue")]
1557    pub package_issue: Option<Vec<PackageIssue>>,
1558    /// Output only. URLs related to this vulnerability.
1559    #[serde(rename = "relatedUrls")]
1560    pub related_urls: Option<Vec<RelatedUrl>>,
1561    /// Output only. The note provider assigned Severity of the vulnerability.
1562    pub severity: Option<String>,
1563    /// Output only. A one sentence description of this vulnerability.
1564    #[serde(rename = "shortDescription")]
1565    pub short_description: Option<String>,
1566    /// The type of package; whether native or non native(ruby gems, node.js packages etc)
1567    #[serde(rename = "type")]
1568    pub type_: Option<String>,
1569    /// no description provided
1570    #[serde(rename = "vexAssessment")]
1571    pub vex_assessment: Option<VexAssessment>,
1572}
1573
1574impl common::Part for GrafeasV1beta1VulnerabilityDetails {}
1575
1576/// Container message for hash values.
1577///
1578/// This type is not used in any activity, and only used as *part* of another schema.
1579///
1580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1581#[serde_with::serde_as]
1582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1583pub struct Hash {
1584    /// Required. The type of hash that was performed.
1585    #[serde(rename = "type")]
1586    pub type_: Option<String>,
1587    /// Required. The hash value.
1588    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1589    pub value: Option<Vec<u8>>,
1590}
1591
1592impl common::Part for Hash {}
1593
1594/// 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.
1595///
1596/// This type is not used in any activity, and only used as *part* of another schema.
1597///
1598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1599#[serde_with::serde_as]
1600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1601pub struct Hint {
1602    /// Required. The human readable name of this attestation authority, for example "qa".
1603    #[serde(rename = "humanReadableName")]
1604    pub human_readable_name: Option<String>,
1605}
1606
1607impl common::Part for Hint {}
1608
1609/// 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.
1610///
1611/// This type is not used in any activity, and only used as *part* of another schema.
1612///
1613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1614#[serde_with::serde_as]
1615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1616pub struct InToto {
1617    /// This field contains the expected command used to perform the step.
1618    #[serde(rename = "expectedCommand")]
1619    pub expected_command: Option<Vec<String>>,
1620    /// 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.
1621    #[serde(rename = "expectedMaterials")]
1622    pub expected_materials: Option<Vec<ArtifactRule>>,
1623    /// no description provided
1624    #[serde(rename = "expectedProducts")]
1625    pub expected_products: Option<Vec<ArtifactRule>>,
1626    /// This field contains the public keys that can be used to verify the signatures on the step metadata.
1627    #[serde(rename = "signingKeys")]
1628    pub signing_keys: Option<Vec<SigningKey>>,
1629    /// This field identifies the name of the step in the supply chain.
1630    #[serde(rename = "stepName")]
1631    pub step_name: Option<String>,
1632    /// 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.
1633    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1634    pub threshold: Option<i64>,
1635}
1636
1637impl common::Part for InToto {}
1638
1639/// There is no detailed description.
1640///
1641/// This type is not used in any activity, and only used as *part* of another schema.
1642///
1643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1644#[serde_with::serde_as]
1645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1646pub struct InTotoSlsaProvenanceV1 {
1647    /// InToto spec defined at https://github.com/in-toto/attestation/tree/main/spec#statement
1648    pub _type: Option<String>,
1649    /// no description provided
1650    pub predicate: Option<SlsaProvenanceV1>,
1651    /// no description provided
1652    #[serde(rename = "predicateType")]
1653    pub predicate_type: Option<String>,
1654    /// no description provided
1655    pub subject: Option<Vec<Subject>>,
1656}
1657
1658impl common::Part for InTotoSlsaProvenanceV1 {}
1659
1660/// This represents how a particular software package may be installed on a system.
1661///
1662/// This type is not used in any activity, and only used as *part* of another schema.
1663///
1664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1665#[serde_with::serde_as]
1666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1667pub struct Installation {
1668    /// Output only. The CPU architecture for which packages in this distribution channel were built. Architecture will be blank for language packages.
1669    pub architecture: Option<String>,
1670    /// 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.
1671    #[serde(rename = "cpeUri")]
1672    pub cpe_uri: Option<String>,
1673    /// Licenses that have been declared by the authors of the package.
1674    pub license: Option<License>,
1675    /// All of the places within the filesystem versions of this package have been found.
1676    pub location: Option<Vec<Location>>,
1677    /// Required. Output only. The name of the installed package.
1678    pub name: Option<String>,
1679    /// Output only. The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
1680    #[serde(rename = "packageType")]
1681    pub package_type: Option<String>,
1682    /// Output only. The version of the package.
1683    pub version: Option<Version>,
1684}
1685
1686impl common::Part for Installation {}
1687
1688/// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
1689///
1690/// This type is not used in any activity, and only used as *part* of another schema.
1691///
1692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1693#[serde_with::serde_as]
1694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1695pub struct Justification {
1696    /// Additional details on why this justification was chosen.
1697    pub details: Option<String>,
1698    /// The justification type for this vulnerability.
1699    #[serde(rename = "justificationType")]
1700    pub justification_type: Option<String>,
1701}
1702
1703impl common::Part for Justification {}
1704
1705/// There is no detailed description.
1706///
1707/// This type is not used in any activity, and only used as *part* of another schema.
1708///
1709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1710#[serde_with::serde_as]
1711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1712pub struct KnowledgeBase {
1713    /// The KB name (generally of the form KB[0-9]+ i.e. KB123456).
1714    pub name: Option<String>,
1715    /// A link to the KB in the Windows update catalog - https://www.catalog.update.microsoft.com/
1716    pub url: Option<String>,
1717}
1718
1719impl common::Part for KnowledgeBase {}
1720
1721/// Layer holds metadata specific to a layer of a Docker image.
1722///
1723/// This type is not used in any activity, and only used as *part* of another schema.
1724///
1725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1726#[serde_with::serde_as]
1727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1728pub struct Layer {
1729    /// The recovered arguments to the Dockerfile directive.
1730    pub arguments: Option<String>,
1731    /// Required. The recovered Dockerfile directive used to construct this layer.
1732    pub directive: Option<String>,
1733}
1734
1735impl common::Part for Layer {}
1736
1737/// License information.
1738///
1739/// This type is not used in any activity, and only used as *part* of another schema.
1740///
1741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1742#[serde_with::serde_as]
1743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1744pub struct License {
1745    /// Comments
1746    pub comments: Option<String>,
1747    /// 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".
1748    pub expression: Option<String>,
1749}
1750
1751impl common::Part for License {}
1752
1753/// Per license count
1754///
1755/// This type is not used in any activity, and only used as *part* of another schema.
1756///
1757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1758#[serde_with::serde_as]
1759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1760pub struct LicensesSummary {
1761    /// The number of fixable vulnerabilities associated with this resource.
1762    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1763    pub count: Option<i64>,
1764    /// 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...
1765    pub license: Option<String>,
1766}
1767
1768impl common::Part for LicensesSummary {}
1769
1770/// This corresponds to an in-toto link.
1771///
1772/// This type is not used in any activity, and only used as *part* of another schema.
1773///
1774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1775#[serde_with::serde_as]
1776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1777pub struct Link {
1778    /// ByProducts are data generated as part of a software supply chain step, but are not the actual result of the step.
1779    pub byproducts: Option<ByProducts>,
1780    /// 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"]
1781    pub command: Option<Vec<String>>,
1782    /// 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": "", "": "..." } }
1783    pub environment: Option<Environment>,
1784    /// 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...", : } } ]
1785    pub materials: Option<Vec<GrafeasV1beta1IntotoArtifact>>,
1786    /// Products are the supply chain artifacts generated as a result of the step. The structure is identical to that of materials.
1787    pub products: Option<Vec<GrafeasV1beta1IntotoArtifact>>,
1788}
1789
1790impl common::Part for Link {}
1791
1792/// Response for listing occurrences for a note.
1793///
1794/// # Activities
1795///
1796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1798///
1799/// * [locations notes occurrences list projects](ProjectLocationNoteOccurrenceListCall) (response)
1800/// * [notes occurrences list projects](ProjectNoteOccurrenceListCall) (response)
1801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1802#[serde_with::serde_as]
1803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1804pub struct ListNoteOccurrencesResponse {
1805    /// Token to provide to skip to a particular spot in the list.
1806    #[serde(rename = "nextPageToken")]
1807    pub next_page_token: Option<String>,
1808    /// The occurrences attached to the specified note.
1809    pub occurrences: Option<Vec<Occurrence>>,
1810}
1811
1812impl common::ResponseResult for ListNoteOccurrencesResponse {}
1813
1814/// Response for listing notes.
1815///
1816/// # Activities
1817///
1818/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1819/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1820///
1821/// * [locations notes list projects](ProjectLocationNoteListCall) (response)
1822/// * [notes list projects](ProjectNoteListCall) (response)
1823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1824#[serde_with::serde_as]
1825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1826pub struct ListNotesResponse {
1827    /// 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.
1828    #[serde(rename = "nextPageToken")]
1829    pub next_page_token: Option<String>,
1830    /// The notes requested.
1831    pub notes: Option<Vec<Note>>,
1832    /// Unordered list. Unreachable regions. Populated for requests from the global region when `return_partial_success` is set. Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
1833    pub unreachable: Option<Vec<String>>,
1834}
1835
1836impl common::ResponseResult for ListNotesResponse {}
1837
1838/// Response for listing occurrences.
1839///
1840/// # Activities
1841///
1842/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1843/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1844///
1845/// * [locations occurrences list projects](ProjectLocationOccurrenceListCall) (response)
1846/// * [occurrences list projects](ProjectOccurrenceListCall) (response)
1847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1848#[serde_with::serde_as]
1849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1850pub struct ListOccurrencesResponse {
1851    /// 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.
1852    #[serde(rename = "nextPageToken")]
1853    pub next_page_token: Option<String>,
1854    /// The occurrences requested.
1855    pub occurrences: Option<Vec<Occurrence>>,
1856    /// Unordered list. Unreachable regions. Populated for requests from the global region when `return_partial_success` is set. Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
1857    pub unreachable: Option<Vec<String>>,
1858}
1859
1860impl common::ResponseResult for ListOccurrencesResponse {}
1861
1862/// An occurrence of a particular package installation found within a system's filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
1863///
1864/// This type is not used in any activity, and only used as *part* of another schema.
1865///
1866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1867#[serde_with::serde_as]
1868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1869pub struct Location {
1870    /// Deprecated. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) denoting the package manager version distributing a package.
1871    #[serde(rename = "cpeUri")]
1872    pub cpe_uri: Option<String>,
1873    /// The path from which we gathered that this package/version is installed.
1874    pub path: Option<String>,
1875    /// Deprecated. The version installed at this location.
1876    pub version: Option<Version>,
1877}
1878
1879impl common::Part for Location {}
1880
1881/// A type of analysis that can be done for a resource.
1882///
1883/// # Activities
1884///
1885/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1886/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1887///
1888/// * [locations notes create projects](ProjectLocationNoteCreateCall) (request|response)
1889/// * [locations notes get projects](ProjectLocationNoteGetCall) (response)
1890/// * [locations notes patch projects](ProjectLocationNotePatchCall) (request|response)
1891/// * [locations occurrences get notes projects](ProjectLocationOccurrenceGetNoteCall) (response)
1892/// * [notes create projects](ProjectNoteCreateCall) (request|response)
1893/// * [notes get projects](ProjectNoteGetCall) (response)
1894/// * [notes patch projects](ProjectNotePatchCall) (request|response)
1895/// * [occurrences get notes projects](ProjectOccurrenceGetNoteCall) (response)
1896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1897#[serde_with::serde_as]
1898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1899pub struct Note {
1900    /// A note describing an attestation role.
1901    #[serde(rename = "attestationAuthority")]
1902    pub attestation_authority: Option<Authority>,
1903    /// A note describing a base image.
1904    #[serde(rename = "baseImage")]
1905    pub base_image: Option<Basis>,
1906    /// A note describing build provenance for a verifiable build.
1907    pub build: Option<Build>,
1908    /// Output only. The time this note was created. This field can be used as a filter in list requests.
1909    #[serde(rename = "createTime")]
1910    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1911    /// A note describing something that can be deployed.
1912    pub deployable: Option<Deployable>,
1913    /// A note describing the initial analysis of a resource.
1914    pub discovery: Option<Discovery>,
1915    /// Time of expiration for this note. Empty if note does not expire.
1916    #[serde(rename = "expirationTime")]
1917    pub expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1918    /// A note describing an in-toto link.
1919    pub intoto: Option<InToto>,
1920    /// Output only. The type of analysis. This field can be used as a filter in list requests.
1921    pub kind: Option<String>,
1922    /// A detailed description of this note.
1923    #[serde(rename = "longDescription")]
1924    pub long_description: Option<String>,
1925    /// Output only. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
1926    pub name: Option<String>,
1927    /// A note describing a package hosted by various package managers.
1928    pub package: Option<Package>,
1929    /// Other notes related to this note.
1930    #[serde(rename = "relatedNoteNames")]
1931    pub related_note_names: Option<Vec<String>>,
1932    /// URLs associated with this note.
1933    #[serde(rename = "relatedUrl")]
1934    pub related_url: Option<Vec<RelatedUrl>>,
1935    /// A note describing a software bill of materials.
1936    pub sbom: Option<DocumentNote>,
1937    /// A note describing an SBOM reference.
1938    #[serde(rename = "sbomReference")]
1939    pub sbom_reference: Option<SBOMReferenceNote>,
1940    /// A note describing a secret.
1941    pub secret: Option<SecretNote>,
1942    /// A one sentence description of this note.
1943    #[serde(rename = "shortDescription")]
1944    pub short_description: Option<String>,
1945    /// A note describing an SPDX File.
1946    #[serde(rename = "spdxFile")]
1947    pub spdx_file: Option<FileNote>,
1948    /// A note describing an SPDX Package.
1949    #[serde(rename = "spdxPackage")]
1950    pub spdx_package: Option<PackageInfoNote>,
1951    /// A note describing an SPDX File.
1952    #[serde(rename = "spdxRelationship")]
1953    pub spdx_relationship: Option<RelationshipNote>,
1954    /// Output only. The time this note was last updated. This field can be used as a filter in list requests.
1955    #[serde(rename = "updateTime")]
1956    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1957    /// A note describing a package vulnerability.
1958    pub vulnerability: Option<Vulnerability>,
1959    /// A note describing a vulnerability assessment.
1960    #[serde(rename = "vulnerabilityAssessment")]
1961    pub vulnerability_assessment: Option<VulnerabilityAssessmentNote>,
1962}
1963
1964impl common::RequestValue for Note {}
1965impl common::ResponseResult for Note {}
1966
1967/// An instance of an analysis type that has been found on a resource.
1968///
1969/// # Activities
1970///
1971/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1972/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1973///
1974/// * [locations occurrences create projects](ProjectLocationOccurrenceCreateCall) (request|response)
1975/// * [locations occurrences get projects](ProjectLocationOccurrenceGetCall) (response)
1976/// * [locations occurrences patch projects](ProjectLocationOccurrencePatchCall) (request|response)
1977/// * [occurrences create projects](ProjectOccurrenceCreateCall) (request|response)
1978/// * [occurrences get projects](ProjectOccurrenceGetCall) (response)
1979/// * [occurrences patch projects](ProjectOccurrencePatchCall) (request|response)
1980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1981#[serde_with::serde_as]
1982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1983pub struct Occurrence {
1984    /// Describes an attestation of an artifact.
1985    pub attestation: Option<Details>,
1986    /// Describes a verifiable build.
1987    pub build: Option<GrafeasV1beta1BuildDetails>,
1988    /// Output only. The time this occurrence was created.
1989    #[serde(rename = "createTime")]
1990    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1991    /// Describes the deployment of an artifact on a runtime.
1992    pub deployment: Option<GrafeasV1beta1DeploymentDetails>,
1993    /// Describes how this resource derives from the basis in the associated note.
1994    #[serde(rename = "derivedImage")]
1995    pub derived_image: Option<GrafeasV1beta1ImageDetails>,
1996    /// Describes when a resource was discovered.
1997    pub discovered: Option<GrafeasV1beta1DiscoveryDetails>,
1998    /// https://github.com/secure-systems-lab/dsse
1999    pub envelope: Option<Envelope>,
2000    /// Describes the installation of a package on the linked resource.
2001    pub installation: Option<GrafeasV1beta1PackageDetails>,
2002    /// Describes a specific in-toto link.
2003    pub intoto: Option<GrafeasV1beta1IntotoDetails>,
2004    /// Output only. This explicitly denotes which of the occurrence details are specified. This field can be used as a filter in list requests.
2005    pub kind: Option<String>,
2006    /// Output only. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
2007    pub name: Option<String>,
2008    /// 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.
2009    #[serde(rename = "noteName")]
2010    pub note_name: Option<String>,
2011    /// A description of actions that can be taken to remedy the note.
2012    pub remediation: Option<String>,
2013    /// Required. Immutable. The resource for which the occurrence applies.
2014    pub resource: Option<Resource>,
2015    /// Describes a specific software bill of materials document.
2016    pub sbom: Option<DocumentOccurrence>,
2017    /// Describes a specific SBOM reference occurrences.
2018    #[serde(rename = "sbomReference")]
2019    pub sbom_reference: Option<SBOMReferenceOccurrence>,
2020    /// Describes a secret.
2021    pub secret: Option<SecretOccurrence>,
2022    /// Describes a specific SPDX File.
2023    #[serde(rename = "spdxFile")]
2024    pub spdx_file: Option<FileOccurrence>,
2025    /// Describes a specific SPDX Package.
2026    #[serde(rename = "spdxPackage")]
2027    pub spdx_package: Option<PackageInfoOccurrence>,
2028    /// Describes a specific SPDX Relationship.
2029    #[serde(rename = "spdxRelationship")]
2030    pub spdx_relationship: Option<RelationshipOccurrence>,
2031    /// Output only. The time this occurrence was last updated.
2032    #[serde(rename = "updateTime")]
2033    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2034    /// Describes a security vulnerability.
2035    pub vulnerability: Option<GrafeasV1beta1VulnerabilityDetails>,
2036}
2037
2038impl common::RequestValue for Occurrence {}
2039impl common::ResponseResult for Occurrence {}
2040
2041/// Package represents a particular package version.
2042///
2043/// This type is not used in any activity, and only used as *part* of another schema.
2044///
2045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2046#[serde_with::serde_as]
2047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2048pub struct Package {
2049    /// The CPU architecture for which packages in this distribution channel were built. Architecture will be blank for language packages.
2050    pub architecture: Option<String>,
2051    /// 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.
2052    #[serde(rename = "cpeUri")]
2053    pub cpe_uri: Option<String>,
2054    /// The description of this package.
2055    pub description: Option<String>,
2056    /// Hash value, typically a file digest, that allows unique identification a specific package.
2057    pub digest: Option<Vec<Digest>>,
2058    /// The various channels by which a package is distributed.
2059    pub distribution: Option<Vec<Distribution>>,
2060    /// Licenses that have been declared by the authors of the package.
2061    pub license: Option<License>,
2062    /// A freeform text denoting the maintainer of this package.
2063    pub maintainer: Option<String>,
2064    /// Required. Immutable. The name of the package.
2065    pub name: Option<String>,
2066    /// The type of package; whether native or non native (e.g., ruby gems, node.js packages, etc.).
2067    #[serde(rename = "packageType")]
2068    pub package_type: Option<String>,
2069    /// The homepage for this package.
2070    pub url: Option<String>,
2071    /// The version of the package.
2072    pub version: Option<Version>,
2073}
2074
2075impl common::Part for Package {}
2076
2077/// PackageInfoNote represents an SPDX Package Information section: https://spdx.github.io/spdx-spec/3-package-information/
2078///
2079/// This type is not used in any activity, and only used as *part* of another schema.
2080///
2081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2082#[serde_with::serde_as]
2083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2084pub struct PackageInfoNote {
2085    /// Indicates whether the file content of this package has been available for or subjected to analysis when creating the SPDX document
2086    pub analyzed: Option<bool>,
2087    /// A place for the SPDX data creator to record, at the package level, acknowledgements that may be needed to be communicated in some contexts
2088    pub attribution: Option<String>,
2089    /// Provide an independently reproducible mechanism that permits unique identification of a specific package that correlates to the data in this SPDX file
2090    pub checksum: Option<String>,
2091    /// Identify the copyright holders of the package, as well as any dates present
2092    pub copyright: Option<String>,
2093    /// A more detailed description of the package
2094    #[serde(rename = "detailedDescription")]
2095    pub detailed_description: Option<String>,
2096    /// 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
2097    #[serde(rename = "downloadLocation")]
2098    pub download_location: Option<String>,
2099    /// ExternalRef
2100    #[serde(rename = "externalRefs")]
2101    pub external_refs: Option<Vec<ExternalRef>>,
2102    /// 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
2103    #[serde(rename = "filesLicenseInfo")]
2104    pub files_license_info: Option<Vec<String>>,
2105    /// Provide a place for the SPDX file creator to record a web site that serves as the package's home page
2106    #[serde(rename = "homePage")]
2107    pub home_page: Option<String>,
2108    /// List the licenses that have been declared by the authors of the package
2109    #[serde(rename = "licenseDeclared")]
2110    pub license_declared: Option<License>,
2111    /// 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
2112    pub originator: Option<String>,
2113    /// The type of package: OS, MAVEN, GO, GO_STDLIB, etc.
2114    #[serde(rename = "packageType")]
2115    pub package_type: Option<String>,
2116    /// A short description of the package
2117    #[serde(rename = "summaryDescription")]
2118    pub summary_description: Option<String>,
2119    /// Identify the actual distribution source for the package/directory identified in the SPDX file
2120    pub supplier: Option<String>,
2121    /// Identify the full name of the package as given by the Package Originator
2122    pub title: Option<String>,
2123    /// 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
2124    #[serde(rename = "verificationCode")]
2125    pub verification_code: Option<String>,
2126    /// Identify the version of the package
2127    pub version: Option<String>,
2128}
2129
2130impl common::Part for PackageInfoNote {}
2131
2132/// PackageInfoOccurrence represents an SPDX Package Information section: https://spdx.github.io/spdx-spec/3-package-information/
2133///
2134/// This type is not used in any activity, and only used as *part* of another schema.
2135///
2136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2137#[serde_with::serde_as]
2138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2139pub struct PackageInfoOccurrence {
2140    /// A place for the SPDX file creator to record any general comments about the package being described
2141    pub comment: Option<String>,
2142    /// Provide the actual file name of the package, or path of the directory being treated as a package
2143    pub filename: Option<String>,
2144    /// Output only. Provide a place for the SPDX file creator to record a web site that serves as the package's home page
2145    #[serde(rename = "homePage")]
2146    pub home_page: Option<String>,
2147    /// Uniquely identify any element in an SPDX document which may be referenced by other elements
2148    pub id: Option<String>,
2149    /// package or alternative values, if the governing license cannot be determined
2150    #[serde(rename = "licenseConcluded")]
2151    pub license_concluded: Option<License>,
2152    /// Output only. The type of package: OS, MAVEN, GO, GO_STDLIB, etc.
2153    #[serde(rename = "packageType")]
2154    pub package_type: Option<String>,
2155    /// Provide a place for the SPDX file creator to record any relevant background information or additional comments about the origin of the package
2156    #[serde(rename = "sourceInfo")]
2157    pub source_info: Option<String>,
2158    /// Output only. A short description of the package
2159    #[serde(rename = "summaryDescription")]
2160    pub summary_description: Option<String>,
2161    /// Output only. Identify the full name of the package as given by the Package Originator
2162    pub title: Option<String>,
2163    /// Output only. Identify the version of the package
2164    pub version: Option<String>,
2165}
2166
2167impl common::Part for PackageInfoOccurrence {}
2168
2169/// This message wraps a location affected by a vulnerability and its associated fix (if one is available).
2170///
2171/// This type is not used in any activity, and only used as *part* of another schema.
2172///
2173#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2174#[serde_with::serde_as]
2175#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2176pub struct PackageIssue {
2177    /// Required. The location of the vulnerability.
2178    #[serde(rename = "affectedLocation")]
2179    pub affected_location: Option<VulnerabilityLocation>,
2180    /// 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.
2181    #[serde(rename = "effectiveSeverity")]
2182    pub effective_severity: Option<String>,
2183    /// The location of the available fix for vulnerability.
2184    #[serde(rename = "fixedLocation")]
2185    pub fixed_location: Option<VulnerabilityLocation>,
2186    /// The type of package (e.g. OS, MAVEN, GO).
2187    #[serde(rename = "packageType")]
2188    pub package_type: Option<String>,
2189    /// Deprecated, use Details.effective_severity instead The severity (e.g., distro assigned severity) for this vulnerability.
2190    #[serde(rename = "severityName")]
2191    pub severity_name: Option<String>,
2192}
2193
2194impl common::Part for PackageIssue {}
2195
2196/// A summary of the packages found within the given resource.
2197///
2198/// # Activities
2199///
2200/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2201/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2202///
2203/// * [locations resources generate packages summary projects](ProjectLocationResourceGeneratePackagesSummaryCall) (response)
2204/// * [resources generate packages summary projects](ProjectResourceGeneratePackagesSummaryCall) (response)
2205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2206#[serde_with::serde_as]
2207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2208pub struct PackagesSummaryResponse {
2209    /// A listing by license name of each of the licenses and their counts.
2210    #[serde(rename = "licensesSummary")]
2211    pub licenses_summary: Option<Vec<LicensesSummary>>,
2212    /// The unique URL of the image or the container for which this summary applies.
2213    #[serde(rename = "resourceUrl")]
2214    pub resource_url: Option<String>,
2215}
2216
2217impl common::ResponseResult for PackagesSummaryResponse {}
2218
2219/// 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.
2220///
2221/// This type is not used in any activity, and only used as *part* of another schema.
2222///
2223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2224#[serde_with::serde_as]
2225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2226pub struct PgpSignedAttestation {
2227    /// 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).
2228    #[serde(rename = "contentType")]
2229    pub content_type: Option<String>,
2230    /// 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`.
2231    #[serde(rename = "pgpKeyId")]
2232    pub pgp_key_id: Option<String>,
2233    /// 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.
2234    pub signature: Option<String>,
2235}
2236
2237impl common::Part for PgpSignedAttestation {}
2238
2239/// 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/).
2240///
2241/// # Activities
2242///
2243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2245///
2246/// * [locations notes get iam policy projects](ProjectLocationNoteGetIamPolicyCall) (response)
2247/// * [locations notes set iam policy projects](ProjectLocationNoteSetIamPolicyCall) (response)
2248/// * [locations occurrences get iam policy projects](ProjectLocationOccurrenceGetIamPolicyCall) (response)
2249/// * [locations occurrences set iam policy projects](ProjectLocationOccurrenceSetIamPolicyCall) (response)
2250/// * [notes get iam policy projects](ProjectNoteGetIamPolicyCall) (response)
2251/// * [notes set iam policy projects](ProjectNoteSetIamPolicyCall) (response)
2252/// * [occurrences get iam policy projects](ProjectOccurrenceGetIamPolicyCall) (response)
2253/// * [occurrences set iam policy projects](ProjectOccurrenceSetIamPolicyCall) (response)
2254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2255#[serde_with::serde_as]
2256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2257pub struct Policy {
2258    /// 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`.
2259    pub bindings: Option<Vec<Binding>>,
2260    /// `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.
2261    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2262    pub etag: Option<Vec<u8>>,
2263    /// 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).
2264    pub version: Option<i32>,
2265}
2266
2267impl common::ResponseResult for Policy {}
2268
2269/// Product contains information about a product and how to uniquely identify it.
2270///
2271/// This type is not used in any activity, and only used as *part* of another schema.
2272///
2273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2274#[serde_with::serde_as]
2275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2276pub struct Product {
2277    /// Contains a URI which is vendor-specific. Example: The artifact repository URL of an image.
2278    #[serde(rename = "genericUri")]
2279    pub generic_uri: Option<String>,
2280    /// 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.
2281    pub id: Option<String>,
2282    /// Name of the product.
2283    pub name: Option<String>,
2284}
2285
2286impl common::Part for Product {}
2287
2288/// Selects a repo using a Google Cloud Platform project ID (e.g., winged-cargo-31) and a repo name within that project.
2289///
2290/// This type is not used in any activity, and only used as *part* of another schema.
2291///
2292#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2293#[serde_with::serde_as]
2294#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2295pub struct ProjectRepoId {
2296    /// The ID of the project.
2297    #[serde(rename = "projectId")]
2298    pub project_id: Option<String>,
2299    /// The name of the repo. Leave empty for the default repo.
2300    #[serde(rename = "repoName")]
2301    pub repo_name: Option<String>,
2302}
2303
2304impl common::Part for ProjectRepoId {}
2305
2306/// There is no detailed description.
2307///
2308/// This type is not used in any activity, and only used as *part* of another schema.
2309///
2310#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2311#[serde_with::serde_as]
2312#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2313pub struct ProvenanceBuilder {
2314    /// no description provided
2315    #[serde(rename = "builderDependencies")]
2316    pub builder_dependencies: Option<Vec<ResourceDescriptor>>,
2317    /// no description provided
2318    pub id: Option<String>,
2319    /// no description provided
2320    pub version: Option<HashMap<String, String>>,
2321}
2322
2323impl common::Part for ProvenanceBuilder {}
2324
2325/// Publisher contains information about the publisher of this Note.
2326///
2327/// This type is not used in any activity, and only used as *part* of another schema.
2328///
2329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2330#[serde_with::serde_as]
2331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2332pub struct Publisher {
2333    /// Provides information about the authority of the issuing party to release the document, in particular, the party's constituency and responsibilities or other obligations.
2334    #[serde(rename = "issuingAuthority")]
2335    pub issuing_authority: Option<String>,
2336    /// Name of the publisher. Examples: 'Google', 'Google Cloud Platform'.
2337    pub name: Option<String>,
2338    /// 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
2339    #[serde(rename = "publisherNamespace")]
2340    pub publisher_namespace: Option<String>,
2341}
2342
2343impl common::Part for Publisher {}
2344
2345/// Metadata for any related URL information.
2346///
2347/// This type is not used in any activity, and only used as *part* of another schema.
2348///
2349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2350#[serde_with::serde_as]
2351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2352pub struct RelatedUrl {
2353    /// Label to describe usage of the URL.
2354    pub label: Option<String>,
2355    /// Specific URL associated with the resource.
2356    pub url: Option<String>,
2357}
2358
2359impl common::Part for RelatedUrl {}
2360
2361/// RelationshipNote represents an SPDX Relationship section: https://spdx.github.io/spdx-spec/7-relationships-between-SPDX-elements/
2362///
2363/// This type is not used in any activity, and only used as *part* of another schema.
2364///
2365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2366#[serde_with::serde_as]
2367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2368pub struct RelationshipNote {
2369    /// The type of relationship between the source and target SPDX elements
2370    #[serde(rename = "type")]
2371    pub type_: Option<String>,
2372}
2373
2374impl common::Part for RelationshipNote {}
2375
2376/// RelationshipOccurrence represents an SPDX Relationship section: https://spdx.github.io/spdx-spec/7-relationships-between-SPDX-elements/
2377///
2378/// This type is not used in any activity, and only used as *part* of another schema.
2379///
2380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2381#[serde_with::serde_as]
2382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2383pub struct RelationshipOccurrence {
2384    /// A place for the SPDX file creator to record any general comments about the relationship
2385    pub comment: Option<String>,
2386    /// Also referred to as SPDXRef-A The source SPDX element (file, package, etc)
2387    pub source: Option<String>,
2388    /// 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
2389    pub target: Option<String>,
2390    /// Output only. The type of relationship between the source and target SPDX elements
2391    #[serde(rename = "type")]
2392    pub type_: Option<String>,
2393}
2394
2395impl common::Part for RelationshipOccurrence {}
2396
2397/// Specifies details on how to handle (and presumably, fix) a vulnerability.
2398///
2399/// This type is not used in any activity, and only used as *part* of another schema.
2400///
2401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2402#[serde_with::serde_as]
2403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2404pub struct Remediation {
2405    /// Contains a comprehensive human-readable discussion of the remediation.
2406    pub details: Option<String>,
2407    /// The type of remediation that can be applied.
2408    #[serde(rename = "remediationType")]
2409    pub remediation_type: Option<String>,
2410    /// Contains the URL where to obtain the remediation.
2411    #[serde(rename = "remediationUri")]
2412    pub remediation_uri: Option<RelatedUrl>,
2413}
2414
2415impl common::Part for Remediation {}
2416
2417/// A unique identifier for a Cloud Repo.
2418///
2419/// This type is not used in any activity, and only used as *part* of another schema.
2420///
2421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2422#[serde_with::serde_as]
2423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2424pub struct RepoId {
2425    /// A combination of a project ID and a repo name.
2426    #[serde(rename = "projectRepoId")]
2427    pub project_repo_id: Option<ProjectRepoId>,
2428    /// A server-assigned, globally unique identifier.
2429    pub uid: Option<String>,
2430}
2431
2432impl common::Part for RepoId {}
2433
2434/// An entity that can have metadata. For example, a Docker image.
2435///
2436/// This type is not used in any activity, and only used as *part* of another schema.
2437///
2438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2439#[serde_with::serde_as]
2440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2441pub struct Resource {
2442    /// Deprecated, do not use. Use uri instead. The hash of the resource content. For example, the Docker digest.
2443    #[serde(rename = "contentHash")]
2444    pub content_hash: Option<Hash>,
2445    /// Deprecated, do not use. Use uri instead. The name of the resource. For example, the name of a Docker image - "Debian".
2446    pub name: Option<String>,
2447    /// Required. The unique URI of the resource. For example, `https://gcr.io/project/image@sha256:foo` for a Docker image.
2448    pub uri: Option<String>,
2449}
2450
2451impl common::Part for Resource {}
2452
2453/// There is no detailed description.
2454///
2455/// This type is not used in any activity, and only used as *part* of another schema.
2456///
2457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2458#[serde_with::serde_as]
2459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2460pub struct ResourceDescriptor {
2461    /// no description provided
2462    pub annotations: Option<HashMap<String, serde_json::Value>>,
2463    /// no description provided
2464    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2465    pub content: Option<Vec<u8>>,
2466    /// no description provided
2467    pub digest: Option<HashMap<String, String>>,
2468    /// no description provided
2469    #[serde(rename = "downloadLocation")]
2470    pub download_location: Option<String>,
2471    /// no description provided
2472    #[serde(rename = "mediaType")]
2473    pub media_type: Option<String>,
2474    /// no description provided
2475    pub name: Option<String>,
2476    /// no description provided
2477    pub uri: Option<String>,
2478}
2479
2480impl common::Part for ResourceDescriptor {}
2481
2482/// There is no detailed description.
2483///
2484/// This type is not used in any activity, and only used as *part* of another schema.
2485///
2486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2487#[serde_with::serde_as]
2488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2489pub struct RunDetails {
2490    /// no description provided
2491    pub builder: Option<ProvenanceBuilder>,
2492    /// no description provided
2493    pub byproducts: Option<Vec<ResourceDescriptor>>,
2494    /// no description provided
2495    pub metadata: Option<BuildMetadata>,
2496}
2497
2498impl common::Part for RunDetails {}
2499
2500/// The note representing an SBOM reference.
2501///
2502/// This type is not used in any activity, and only used as *part* of another schema.
2503///
2504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2505#[serde_with::serde_as]
2506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2507pub struct SBOMReferenceNote {
2508    /// The format that SBOM takes. E.g. may be spdx, cyclonedx, etc...
2509    pub format: Option<String>,
2510    /// The version of the format that the SBOM takes. E.g. if the format is spdx, the version may be 2.3.
2511    pub version: Option<String>,
2512}
2513
2514impl common::Part for SBOMReferenceNote {}
2515
2516/// 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.
2517///
2518/// This type is not used in any activity, and only used as *part* of another schema.
2519///
2520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2521#[serde_with::serde_as]
2522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2523pub struct SBOMReferenceOccurrence {
2524    /// The actual payload that contains the SBOM reference data.
2525    pub payload: Option<SbomReferenceIntotoPayload>,
2526    /// 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'.
2527    #[serde(rename = "payloadType")]
2528    pub payload_type: Option<String>,
2529    /// The signatures over the payload.
2530    pub signatures: Option<Vec<EnvelopeSignature>>,
2531}
2532
2533impl common::Part for SBOMReferenceOccurrence {}
2534
2535/// The status of an SBOM generation.
2536///
2537/// This type is not used in any activity, and only used as *part* of another schema.
2538///
2539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2540#[serde_with::serde_as]
2541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2542pub struct SBOMStatus {
2543    /// If there was an error generating an SBOM, this will indicate what that error was.
2544    pub error: Option<String>,
2545    /// The progress of the SBOM generation.
2546    #[serde(rename = "sbomState")]
2547    pub sbom_state: Option<String>,
2548}
2549
2550impl common::Part for SBOMStatus {}
2551
2552/// 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.
2553///
2554/// This type is not used in any activity, and only used as *part* of another schema.
2555///
2556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2557#[serde_with::serde_as]
2558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2559pub struct SbomReferenceIntotoPayload {
2560    /// Identifier for the schema of the Statement.
2561    pub _type: Option<String>,
2562    /// Additional parameters of the Predicate. Includes the actual data about the SBOM.
2563    pub predicate: Option<SbomReferenceIntotoPredicate>,
2564    /// URI identifying the type of the Predicate.
2565    #[serde(rename = "predicateType")]
2566    pub predicate_type: Option<String>,
2567    /// Set of software artifacts that the attestation applies to. Each element represents a single software artifact.
2568    pub subject: Option<Vec<Subject>>,
2569}
2570
2571impl common::Part for SbomReferenceIntotoPayload {}
2572
2573/// A predicate which describes the SBOM being referenced.
2574///
2575/// This type is not used in any activity, and only used as *part* of another schema.
2576///
2577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2578#[serde_with::serde_as]
2579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2580pub struct SbomReferenceIntotoPredicate {
2581    /// A map of algorithm to digest of the contents of the SBOM.
2582    pub digest: Option<HashMap<String, String>>,
2583    /// The location of the SBOM.
2584    pub location: Option<String>,
2585    /// The mime type of the SBOM.
2586    #[serde(rename = "mimeType")]
2587    pub mime_type: Option<String>,
2588    /// The person or system referring this predicate to the consumer.
2589    #[serde(rename = "referrerId")]
2590    pub referrer_id: Option<String>,
2591}
2592
2593impl common::Part for SbomReferenceIntotoPredicate {}
2594
2595/// The location of the secret.
2596///
2597/// This type is not used in any activity, and only used as *part* of another schema.
2598///
2599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2600#[serde_with::serde_as]
2601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2602pub struct SecretLocation {
2603    /// The secret is found from a file.
2604    #[serde(rename = "fileLocation")]
2605    pub file_location: Option<FileLocation>,
2606}
2607
2608impl common::Part for SecretLocation {}
2609
2610/// The note representing a secret.
2611///
2612/// This type is not used in any activity, and only used as *part* of another schema.
2613///
2614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2615#[serde_with::serde_as]
2616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2617pub struct SecretNote {
2618    _never_set: Option<bool>,
2619}
2620
2621impl common::Part for SecretNote {}
2622
2623/// The occurrence provides details of a secret.
2624///
2625/// This type is not used in any activity, and only used as *part* of another schema.
2626///
2627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2628#[serde_with::serde_as]
2629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2630pub struct SecretOccurrence {
2631    /// Required. Type of secret.
2632    pub kind: Option<String>,
2633    /// Optional. Locations where the secret is detected.
2634    pub locations: Option<Vec<SecretLocation>>,
2635    /// Optional. Status of the secret.
2636    pub statuses: Option<Vec<SecretStatus>>,
2637}
2638
2639impl common::Part for SecretOccurrence {}
2640
2641/// The status of the secret with a timestamp.
2642///
2643/// This type is not used in any activity, and only used as *part* of another schema.
2644///
2645#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2646#[serde_with::serde_as]
2647#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2648pub struct SecretStatus {
2649    /// Optional. Optional message about the status code.
2650    pub message: Option<String>,
2651    /// Optional. The status of the secret.
2652    pub status: Option<String>,
2653    /// Optional. The time the secret status was last updated.
2654    #[serde(rename = "updateTime")]
2655    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2656}
2657
2658impl common::Part for SecretStatus {}
2659
2660/// Request message for `SetIamPolicy` method.
2661///
2662/// # Activities
2663///
2664/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2665/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2666///
2667/// * [locations notes set iam policy projects](ProjectLocationNoteSetIamPolicyCall) (request)
2668/// * [locations occurrences set iam policy projects](ProjectLocationOccurrenceSetIamPolicyCall) (request)
2669/// * [notes set iam policy projects](ProjectNoteSetIamPolicyCall) (request)
2670/// * [occurrences set iam policy projects](ProjectOccurrenceSetIamPolicyCall) (request)
2671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2672#[serde_with::serde_as]
2673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2674pub struct SetIamPolicyRequest {
2675    /// 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.
2676    pub policy: Option<Policy>,
2677}
2678
2679impl common::RequestValue for SetIamPolicyRequest {}
2680
2681/// 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).
2682///
2683/// This type is not used in any activity, and only used as *part* of another schema.
2684///
2685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2686#[serde_with::serde_as]
2687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2688pub struct Signature {
2689    /// 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"
2690    #[serde(rename = "publicKeyId")]
2691    pub public_key_id: Option<String>,
2692    /// 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.
2693    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2694    pub signature: Option<Vec<u8>>,
2695}
2696
2697impl common::Part for Signature {}
2698
2699/// 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.
2700///
2701/// This type is not used in any activity, and only used as *part* of another schema.
2702///
2703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2704#[serde_with::serde_as]
2705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2706pub struct SigningKey {
2707    /// key_id is an identifier for the signing key.
2708    #[serde(rename = "keyId")]
2709    pub key_id: Option<String>,
2710    /// This field contains the corresponding signature scheme. Eg: "rsassa-pss-sha256".
2711    #[serde(rename = "keyScheme")]
2712    pub key_scheme: Option<String>,
2713    /// This field identifies the specific signing method. Eg: "rsa", "ed25519", and "ecdsa".
2714    #[serde(rename = "keyType")]
2715    pub key_type: Option<String>,
2716    /// This field contains the actual public key.
2717    #[serde(rename = "publicKeyValue")]
2718    pub public_key_value: Option<String>,
2719}
2720
2721impl common::Part for SigningKey {}
2722
2723/// 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.
2724///
2725/// This type is not used in any activity, and only used as *part* of another schema.
2726///
2727#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2728#[serde_with::serde_as]
2729#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2730pub struct SlsaProvenanceV1 {
2731    /// no description provided
2732    #[serde(rename = "buildDefinition")]
2733    pub build_definition: Option<BuildDefinition>,
2734    /// no description provided
2735    #[serde(rename = "runDetails")]
2736    pub run_details: Option<RunDetails>,
2737}
2738
2739impl common::Part for SlsaProvenanceV1 {}
2740
2741/// Source describes the location of the source used for the build.
2742///
2743/// This type is not used in any activity, and only used as *part* of another schema.
2744///
2745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2746#[serde_with::serde_as]
2747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2748pub struct Source {
2749    /// 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.
2750    #[serde(rename = "additionalContexts")]
2751    pub additional_contexts: Option<Vec<SourceContext>>,
2752    /// If provided, the input binary artifacts for the build came from this location.
2753    #[serde(rename = "artifactStorageSourceUri")]
2754    pub artifact_storage_source_uri: Option<String>,
2755    /// If provided, the source code used for the build came from this location.
2756    pub context: Option<SourceContext>,
2757    /// 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.
2758    #[serde(rename = "fileHashes")]
2759    pub file_hashes: Option<HashMap<String, FileHashes>>,
2760}
2761
2762impl common::Part for Source {}
2763
2764/// 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.
2765///
2766/// This type is not used in any activity, and only used as *part* of another schema.
2767///
2768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2769#[serde_with::serde_as]
2770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2771pub struct SourceContext {
2772    /// A SourceContext referring to a revision in a Google Cloud Source Repo.
2773    #[serde(rename = "cloudRepo")]
2774    pub cloud_repo: Option<CloudRepoSourceContext>,
2775    /// A SourceContext referring to a Gerrit project.
2776    pub gerrit: Option<GerritSourceContext>,
2777    /// A SourceContext referring to any third party Git repo (e.g., GitHub).
2778    pub git: Option<GitSourceContext>,
2779    /// Labels with user defined metadata.
2780    pub labels: Option<HashMap<String, String>>,
2781}
2782
2783impl common::Part for SourceContext {}
2784
2785/// 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).
2786///
2787/// This type is not used in any activity, and only used as *part* of another schema.
2788///
2789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2790#[serde_with::serde_as]
2791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2792pub struct Status {
2793    /// The status code, which should be an enum value of google.rpc.Code.
2794    pub code: Option<i32>,
2795    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2796    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2797    /// 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.
2798    pub message: Option<String>,
2799}
2800
2801impl common::Part for Status {}
2802
2803/// Set of software artifacts that the attestation applies to. Each element represents a single software artifact.
2804///
2805/// This type is not used in any activity, and only used as *part* of another schema.
2806///
2807#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2808#[serde_with::serde_as]
2809#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2810pub struct Subject {
2811    /// `"": ""` Algorithms can be e.g. sha256, sha512 See https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet
2812    pub digest: Option<HashMap<String, String>>,
2813    /// Identifier to distinguish this artifact from others within the subject.
2814    pub name: Option<String>,
2815}
2816
2817impl common::Part for Subject {}
2818
2819/// Request message for `TestIamPermissions` method.
2820///
2821/// # Activities
2822///
2823/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2824/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2825///
2826/// * [locations notes test iam permissions projects](ProjectLocationNoteTestIamPermissionCall) (request)
2827/// * [locations occurrences test iam permissions projects](ProjectLocationOccurrenceTestIamPermissionCall) (request)
2828/// * [notes test iam permissions projects](ProjectNoteTestIamPermissionCall) (request)
2829/// * [occurrences test iam permissions projects](ProjectOccurrenceTestIamPermissionCall) (request)
2830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2831#[serde_with::serde_as]
2832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2833pub struct TestIamPermissionsRequest {
2834    /// 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).
2835    pub permissions: Option<Vec<String>>,
2836}
2837
2838impl common::RequestValue for TestIamPermissionsRequest {}
2839
2840/// Response message for `TestIamPermissions` method.
2841///
2842/// # Activities
2843///
2844/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2845/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2846///
2847/// * [locations notes test iam permissions projects](ProjectLocationNoteTestIamPermissionCall) (response)
2848/// * [locations occurrences test iam permissions projects](ProjectLocationOccurrenceTestIamPermissionCall) (response)
2849/// * [notes test iam permissions projects](ProjectNoteTestIamPermissionCall) (response)
2850/// * [occurrences test iam permissions projects](ProjectOccurrenceTestIamPermissionCall) (response)
2851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2852#[serde_with::serde_as]
2853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2854pub struct TestIamPermissionsResponse {
2855    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
2856    pub permissions: Option<Vec<String>>,
2857}
2858
2859impl common::ResponseResult for TestIamPermissionsResponse {}
2860
2861/// Version contains structured information about the version of a package.
2862///
2863/// This type is not used in any activity, and only used as *part* of another schema.
2864///
2865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2866#[serde_with::serde_as]
2867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2868pub struct Version {
2869    /// Used to correct mistakes in the version numbering scheme.
2870    pub epoch: Option<i32>,
2871    /// 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.
2872    pub inclusive: Option<bool>,
2873    /// Required. Distinguishes between sentinel MIN/MAX versions and normal versions.
2874    pub kind: Option<String>,
2875    /// Required only when version kind is NORMAL. The main part of the version name.
2876    pub name: Option<String>,
2877    /// The iteration of the package build from the above version.
2878    pub revision: Option<String>,
2879}
2880
2881impl common::Part for Version {}
2882
2883/// VexAssessment provides all publisher provided Vex information that is related to this vulnerability.
2884///
2885/// This type is not used in any activity, and only used as *part* of another schema.
2886///
2887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2888#[serde_with::serde_as]
2889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2890pub struct VexAssessment {
2891    /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE) tracking number for the vulnerability. Deprecated: Use vulnerability_id instead to denote CVEs.
2892    pub cve: Option<String>,
2893    /// Contains information about the impact of this vulnerability, this will change with time.
2894    pub impacts: Option<Vec<String>>,
2895    /// Justification provides the justification when the state of the assessment if NOT_AFFECTED.
2896    pub justification: Option<Justification>,
2897    /// The VulnerabilityAssessment note from which this VexAssessment was generated. This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`.
2898    #[serde(rename = "noteName")]
2899    pub note_name: Option<String>,
2900    /// Holds a list of references associated with this vulnerability item and assessment.
2901    #[serde(rename = "relatedUris")]
2902    pub related_uris: Option<Vec<RelatedUrl>>,
2903    /// Specifies details on how to handle (and presumably, fix) a vulnerability.
2904    pub remediations: Option<Vec<Remediation>>,
2905    /// Provides the state of this Vulnerability assessment.
2906    pub state: Option<String>,
2907    /// The vulnerability identifier for this Assessment. Will hold one of common identifiers e.g. CVE, GHSA etc.
2908    #[serde(rename = "vulnerabilityId")]
2909    pub vulnerability_id: Option<String>,
2910}
2911
2912impl common::Part for VexAssessment {}
2913
2914/// Vulnerability provides metadata about a security vulnerability in a Note.
2915///
2916/// This type is not used in any activity, and only used as *part* of another schema.
2917///
2918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2919#[serde_with::serde_as]
2920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2921pub struct Vulnerability {
2922    /// The CVSS score for this vulnerability.
2923    #[serde(rename = "cvssScore")]
2924    pub cvss_score: Option<f32>,
2925    /// The full description of the CVSS for version 2.
2926    #[serde(rename = "cvssV2")]
2927    pub cvss_v2: Option<CVSS>,
2928    /// The full description of the CVSS for version 3.
2929    #[serde(rename = "cvssV3")]
2930    pub cvss_v3: Option<CVSSv3>,
2931    /// CVSS version used to populate cvss_score and severity.
2932    #[serde(rename = "cvssVersion")]
2933    pub cvss_version: Option<String>,
2934    /// A list of CWE for this vulnerability. For details, see: https://cwe.mitre.org/index.html
2935    pub cwe: Option<Vec<String>>,
2936    /// All information about the package to specifically identify this vulnerability. One entry per (version range and cpe_uri) the package vulnerability has manifested in.
2937    pub details: Option<Vec<Detail>>,
2938    /// Note provider assigned impact of the vulnerability.
2939    pub severity: Option<String>,
2940    /// 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.
2941    #[serde(rename = "sourceUpdateTime")]
2942    pub source_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2943    /// 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.
2944    #[serde(rename = "windowsDetails")]
2945    pub windows_details: Option<Vec<WindowsDetail>>,
2946}
2947
2948impl common::Part for Vulnerability {}
2949
2950/// A single VulnerabilityAssessmentNote represents one particular product's vulnerability assessment for one CVE.
2951///
2952/// This type is not used in any activity, and only used as *part* of another schema.
2953///
2954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2955#[serde_with::serde_as]
2956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2957pub struct VulnerabilityAssessmentNote {
2958    /// Represents a vulnerability assessment for the product.
2959    pub assessment: Option<Assessment>,
2960    /// Identifies the language used by this document, corresponding to IETF BCP 47 / RFC 5646.
2961    #[serde(rename = "languageCode")]
2962    pub language_code: Option<String>,
2963    /// A detailed description of this Vex.
2964    #[serde(rename = "longDescription")]
2965    pub long_description: Option<String>,
2966    /// The product affected by this vex.
2967    pub product: Option<Product>,
2968    /// Publisher details of this Note.
2969    pub publisher: Option<Publisher>,
2970    /// A one sentence description of this Vex.
2971    #[serde(rename = "shortDescription")]
2972    pub short_description: Option<String>,
2973    /// The title of the note. E.g. `Vex-Debian-11.4`
2974    pub title: Option<String>,
2975}
2976
2977impl common::Part for VulnerabilityAssessmentNote {}
2978
2979/// The location of the vulnerability.
2980///
2981/// This type is not used in any activity, and only used as *part* of another schema.
2982///
2983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2984#[serde_with::serde_as]
2985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2986pub struct VulnerabilityLocation {
2987    /// Required. The CPE URI in [cpe format](https://cpe.mitre.org/specification/) format. Examples include distro or storage location for vulnerable jar.
2988    #[serde(rename = "cpeUri")]
2989    pub cpe_uri: Option<String>,
2990    /// Required. The package being described.
2991    pub package: Option<String>,
2992    /// Required. The version of the package being described.
2993    pub version: Option<Version>,
2994}
2995
2996impl common::Part for VulnerabilityLocation {}
2997
2998/// A summary of how many vulnerability occurrences there are per resource and severity type.
2999///
3000/// # Activities
3001///
3002/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3003/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3004///
3005/// * [locations occurrences get vulnerability summary projects](ProjectLocationOccurrenceGetVulnerabilitySummaryCall) (response)
3006/// * [occurrences get vulnerability summary projects](ProjectOccurrenceGetVulnerabilitySummaryCall) (response)
3007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3008#[serde_with::serde_as]
3009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3010pub struct VulnerabilityOccurrencesSummary {
3011    /// A listing by resource of the number of fixable and total vulnerabilities.
3012    pub counts: Option<Vec<FixableTotalByDigest>>,
3013    /// Unordered list. Unreachable regions. Populated for requests from the global region when `return_partial_success` is set. Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
3014    pub unreachable: Option<Vec<String>>,
3015}
3016
3017impl common::ResponseResult for VulnerabilityOccurrencesSummary {}
3018
3019/// There is no detailed description.
3020///
3021/// This type is not used in any activity, and only used as *part* of another schema.
3022///
3023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3024#[serde_with::serde_as]
3025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3026pub struct WindowsDetail {
3027    /// 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.
3028    #[serde(rename = "cpeUri")]
3029    pub cpe_uri: Option<String>,
3030    /// The description of the vulnerability.
3031    pub description: Option<String>,
3032    /// 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.
3033    #[serde(rename = "fixingKbs")]
3034    pub fixing_kbs: Option<Vec<KnowledgeBase>>,
3035    /// Required. The name of the vulnerability.
3036    pub name: Option<String>,
3037}
3038
3039impl common::Part for WindowsDetail {}
3040
3041// ###################
3042// MethodBuilders ###
3043// #################
3044
3045/// A builder providing access to all methods supported on *project* resources.
3046/// It is not used directly, but through the [`ContainerAnalysis`] hub.
3047///
3048/// # Example
3049///
3050/// Instantiate a resource builder
3051///
3052/// ```test_harness,no_run
3053/// extern crate hyper;
3054/// extern crate hyper_rustls;
3055/// extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
3056///
3057/// # async fn dox() {
3058/// use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3059///
3060/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3061/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3062///     .with_native_roots()
3063///     .unwrap()
3064///     .https_only()
3065///     .enable_http2()
3066///     .build();
3067///
3068/// let executor = hyper_util::rt::TokioExecutor::new();
3069/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3070///     secret,
3071///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3072///     yup_oauth2::client::CustomHyperClientBuilder::from(
3073///         hyper_util::client::legacy::Client::builder(executor).build(connector),
3074///     ),
3075/// ).build().await.unwrap();
3076///
3077/// let client = hyper_util::client::legacy::Client::builder(
3078///     hyper_util::rt::TokioExecutor::new()
3079/// )
3080/// .build(
3081///     hyper_rustls::HttpsConnectorBuilder::new()
3082///         .with_native_roots()
3083///         .unwrap()
3084///         .https_or_http()
3085///         .enable_http2()
3086///         .build()
3087/// );
3088/// let mut hub = ContainerAnalysis::new(client, auth);
3089/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3090/// // like `locations_notes_batch_create(...)`, `locations_notes_create(...)`, `locations_notes_delete(...)`, `locations_notes_get(...)`, `locations_notes_get_iam_policy(...)`, `locations_notes_list(...)`, `locations_notes_occurrences_list(...)`, `locations_notes_patch(...)`, `locations_notes_set_iam_policy(...)`, `locations_notes_test_iam_permissions(...)`, `locations_occurrences_batch_create(...)`, `locations_occurrences_create(...)`, `locations_occurrences_delete(...)`, `locations_occurrences_get(...)`, `locations_occurrences_get_iam_policy(...)`, `locations_occurrences_get_notes(...)`, `locations_occurrences_get_vulnerability_summary(...)`, `locations_occurrences_list(...)`, `locations_occurrences_patch(...)`, `locations_occurrences_set_iam_policy(...)`, `locations_occurrences_test_iam_permissions(...)`, `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(...)`
3091/// // to build up your call.
3092/// let rb = hub.projects();
3093/// # }
3094/// ```
3095pub struct ProjectMethods<'a, C>
3096where
3097    C: 'a,
3098{
3099    hub: &'a ContainerAnalysis<C>,
3100}
3101
3102impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3103
3104impl<'a, C> ProjectMethods<'a, C> {
3105    /// Create a builder to help you perform the following task:
3106    ///
3107    /// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
3108    ///
3109    /// # Arguments
3110    ///
3111    /// * `name` - Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3112    pub fn locations_notes_occurrences_list(
3113        &self,
3114        name: &str,
3115    ) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
3116        ProjectLocationNoteOccurrenceListCall {
3117            hub: self.hub,
3118            _name: name.to_string(),
3119            _page_token: Default::default(),
3120            _page_size: Default::default(),
3121            _filter: Default::default(),
3122            _delegate: Default::default(),
3123            _additional_params: Default::default(),
3124            _scopes: Default::default(),
3125        }
3126    }
3127
3128    /// Create a builder to help you perform the following task:
3129    ///
3130    /// Creates new notes in batch.
3131    ///
3132    /// # Arguments
3133    ///
3134    /// * `request` - No description provided.
3135    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
3136    pub fn locations_notes_batch_create(
3137        &self,
3138        request: BatchCreateNotesRequest,
3139        parent: &str,
3140    ) -> ProjectLocationNoteBatchCreateCall<'a, C> {
3141        ProjectLocationNoteBatchCreateCall {
3142            hub: self.hub,
3143            _request: request,
3144            _parent: parent.to_string(),
3145            _delegate: Default::default(),
3146            _additional_params: Default::default(),
3147            _scopes: Default::default(),
3148        }
3149    }
3150
3151    /// Create a builder to help you perform the following task:
3152    ///
3153    /// Creates a new note.
3154    ///
3155    /// # Arguments
3156    ///
3157    /// * `request` - No description provided.
3158    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
3159    pub fn locations_notes_create(
3160        &self,
3161        request: Note,
3162        parent: &str,
3163    ) -> ProjectLocationNoteCreateCall<'a, C> {
3164        ProjectLocationNoteCreateCall {
3165            hub: self.hub,
3166            _request: request,
3167            _parent: parent.to_string(),
3168            _note_id: Default::default(),
3169            _delegate: Default::default(),
3170            _additional_params: Default::default(),
3171            _scopes: Default::default(),
3172        }
3173    }
3174
3175    /// Create a builder to help you perform the following task:
3176    ///
3177    /// Deletes the specified note.
3178    ///
3179    /// # Arguments
3180    ///
3181    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3182    pub fn locations_notes_delete(&self, name: &str) -> ProjectLocationNoteDeleteCall<'a, C> {
3183        ProjectLocationNoteDeleteCall {
3184            hub: self.hub,
3185            _name: name.to_string(),
3186            _delegate: Default::default(),
3187            _additional_params: Default::default(),
3188            _scopes: Default::default(),
3189        }
3190    }
3191
3192    /// Create a builder to help you perform the following task:
3193    ///
3194    /// Gets the specified note.
3195    ///
3196    /// # Arguments
3197    ///
3198    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3199    pub fn locations_notes_get(&self, name: &str) -> ProjectLocationNoteGetCall<'a, C> {
3200        ProjectLocationNoteGetCall {
3201            hub: self.hub,
3202            _name: name.to_string(),
3203            _delegate: Default::default(),
3204            _additional_params: Default::default(),
3205            _scopes: Default::default(),
3206        }
3207    }
3208
3209    /// Create a builder to help you perform the following task:
3210    ///
3211    /// 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.
3212    ///
3213    /// # Arguments
3214    ///
3215    /// * `request` - No description provided.
3216    /// * `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.
3217    pub fn locations_notes_get_iam_policy(
3218        &self,
3219        request: GetIamPolicyRequest,
3220        resource: &str,
3221    ) -> ProjectLocationNoteGetIamPolicyCall<'a, C> {
3222        ProjectLocationNoteGetIamPolicyCall {
3223            hub: self.hub,
3224            _request: request,
3225            _resource: resource.to_string(),
3226            _delegate: Default::default(),
3227            _additional_params: Default::default(),
3228            _scopes: Default::default(),
3229        }
3230    }
3231
3232    /// Create a builder to help you perform the following task:
3233    ///
3234    /// Lists notes for the specified project.
3235    ///
3236    /// # Arguments
3237    ///
3238    /// * `parent` - Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
3239    pub fn locations_notes_list(&self, parent: &str) -> ProjectLocationNoteListCall<'a, C> {
3240        ProjectLocationNoteListCall {
3241            hub: self.hub,
3242            _parent: parent.to_string(),
3243            _return_partial_success: Default::default(),
3244            _page_token: Default::default(),
3245            _page_size: Default::default(),
3246            _filter: Default::default(),
3247            _delegate: Default::default(),
3248            _additional_params: Default::default(),
3249            _scopes: Default::default(),
3250        }
3251    }
3252
3253    /// Create a builder to help you perform the following task:
3254    ///
3255    /// Updates the specified note.
3256    ///
3257    /// # Arguments
3258    ///
3259    /// * `request` - No description provided.
3260    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3261    pub fn locations_notes_patch(
3262        &self,
3263        request: Note,
3264        name: &str,
3265    ) -> ProjectLocationNotePatchCall<'a, C> {
3266        ProjectLocationNotePatchCall {
3267            hub: self.hub,
3268            _request: request,
3269            _name: name.to_string(),
3270            _update_mask: Default::default(),
3271            _delegate: Default::default(),
3272            _additional_params: Default::default(),
3273            _scopes: Default::default(),
3274        }
3275    }
3276
3277    /// Create a builder to help you perform the following task:
3278    ///
3279    /// 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.
3280    ///
3281    /// # Arguments
3282    ///
3283    /// * `request` - No description provided.
3284    /// * `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.
3285    pub fn locations_notes_set_iam_policy(
3286        &self,
3287        request: SetIamPolicyRequest,
3288        resource: &str,
3289    ) -> ProjectLocationNoteSetIamPolicyCall<'a, C> {
3290        ProjectLocationNoteSetIamPolicyCall {
3291            hub: self.hub,
3292            _request: request,
3293            _resource: resource.to_string(),
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    /// 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.
3303    ///
3304    /// # Arguments
3305    ///
3306    /// * `request` - No description provided.
3307    /// * `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.
3308    pub fn locations_notes_test_iam_permissions(
3309        &self,
3310        request: TestIamPermissionsRequest,
3311        resource: &str,
3312    ) -> ProjectLocationNoteTestIamPermissionCall<'a, C> {
3313        ProjectLocationNoteTestIamPermissionCall {
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    /// Creates new occurrences in batch.
3326    ///
3327    /// # Arguments
3328    ///
3329    /// * `request` - No description provided.
3330    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
3331    pub fn locations_occurrences_batch_create(
3332        &self,
3333        request: BatchCreateOccurrencesRequest,
3334        parent: &str,
3335    ) -> ProjectLocationOccurrenceBatchCreateCall<'a, C> {
3336        ProjectLocationOccurrenceBatchCreateCall {
3337            hub: self.hub,
3338            _request: request,
3339            _parent: parent.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 a new occurrence.
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 occurrence is to be created.
3354    pub fn locations_occurrences_create(
3355        &self,
3356        request: Occurrence,
3357        parent: &str,
3358    ) -> ProjectLocationOccurrenceCreateCall<'a, C> {
3359        ProjectLocationOccurrenceCreateCall {
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    /// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
3372    ///
3373    /// # Arguments
3374    ///
3375    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3376    pub fn locations_occurrences_delete(
3377        &self,
3378        name: &str,
3379    ) -> ProjectLocationOccurrenceDeleteCall<'a, C> {
3380        ProjectLocationOccurrenceDeleteCall {
3381            hub: self.hub,
3382            _name: name.to_string(),
3383            _delegate: Default::default(),
3384            _additional_params: Default::default(),
3385            _scopes: Default::default(),
3386        }
3387    }
3388
3389    /// Create a builder to help you perform the following task:
3390    ///
3391    /// Gets the specified occurrence.
3392    ///
3393    /// # Arguments
3394    ///
3395    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3396    pub fn locations_occurrences_get(&self, name: &str) -> ProjectLocationOccurrenceGetCall<'a, C> {
3397        ProjectLocationOccurrenceGetCall {
3398            hub: self.hub,
3399            _name: name.to_string(),
3400            _delegate: Default::default(),
3401            _additional_params: Default::default(),
3402            _scopes: Default::default(),
3403        }
3404    }
3405
3406    /// Create a builder to help you perform the following task:
3407    ///
3408    /// 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.
3409    ///
3410    /// # Arguments
3411    ///
3412    /// * `request` - No description provided.
3413    /// * `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.
3414    pub fn locations_occurrences_get_iam_policy(
3415        &self,
3416        request: GetIamPolicyRequest,
3417        resource: &str,
3418    ) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {
3419        ProjectLocationOccurrenceGetIamPolicyCall {
3420            hub: self.hub,
3421            _request: request,
3422            _resource: resource.to_string(),
3423            _delegate: Default::default(),
3424            _additional_params: Default::default(),
3425            _scopes: Default::default(),
3426        }
3427    }
3428
3429    /// Create a builder to help you perform the following task:
3430    ///
3431    /// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
3432    ///
3433    /// # Arguments
3434    ///
3435    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3436    pub fn locations_occurrences_get_notes(
3437        &self,
3438        name: &str,
3439    ) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
3440        ProjectLocationOccurrenceGetNoteCall {
3441            hub: self.hub,
3442            _name: name.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 a summary of the number and severity of occurrences.
3452    ///
3453    /// # Arguments
3454    ///
3455    /// * `parent` - Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
3456    pub fn locations_occurrences_get_vulnerability_summary(
3457        &self,
3458        parent: &str,
3459    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
3460        ProjectLocationOccurrenceGetVulnerabilitySummaryCall {
3461            hub: self.hub,
3462            _parent: parent.to_string(),
3463            _return_partial_success: Default::default(),
3464            _filter: Default::default(),
3465            _delegate: Default::default(),
3466            _additional_params: Default::default(),
3467            _scopes: Default::default(),
3468        }
3469    }
3470
3471    /// Create a builder to help you perform the following task:
3472    ///
3473    /// Lists occurrences for the specified project.
3474    ///
3475    /// # Arguments
3476    ///
3477    /// * `parent` - Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
3478    pub fn locations_occurrences_list(
3479        &self,
3480        parent: &str,
3481    ) -> ProjectLocationOccurrenceListCall<'a, C> {
3482        ProjectLocationOccurrenceListCall {
3483            hub: self.hub,
3484            _parent: parent.to_string(),
3485            _return_partial_success: Default::default(),
3486            _page_token: Default::default(),
3487            _page_size: Default::default(),
3488            _filter: Default::default(),
3489            _delegate: Default::default(),
3490            _additional_params: Default::default(),
3491            _scopes: Default::default(),
3492        }
3493    }
3494
3495    /// Create a builder to help you perform the following task:
3496    ///
3497    /// Updates the specified occurrence.
3498    ///
3499    /// # Arguments
3500    ///
3501    /// * `request` - No description provided.
3502    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3503    pub fn locations_occurrences_patch(
3504        &self,
3505        request: Occurrence,
3506        name: &str,
3507    ) -> ProjectLocationOccurrencePatchCall<'a, C> {
3508        ProjectLocationOccurrencePatchCall {
3509            hub: self.hub,
3510            _request: request,
3511            _name: name.to_string(),
3512            _update_mask: Default::default(),
3513            _delegate: Default::default(),
3514            _additional_params: Default::default(),
3515            _scopes: Default::default(),
3516        }
3517    }
3518
3519    /// Create a builder to help you perform the following task:
3520    ///
3521    /// 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.
3522    ///
3523    /// # Arguments
3524    ///
3525    /// * `request` - No description provided.
3526    /// * `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.
3527    pub fn locations_occurrences_set_iam_policy(
3528        &self,
3529        request: SetIamPolicyRequest,
3530        resource: &str,
3531    ) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {
3532        ProjectLocationOccurrenceSetIamPolicyCall {
3533            hub: self.hub,
3534            _request: request,
3535            _resource: resource.to_string(),
3536            _delegate: Default::default(),
3537            _additional_params: Default::default(),
3538            _scopes: Default::default(),
3539        }
3540    }
3541
3542    /// Create a builder to help you perform the following task:
3543    ///
3544    /// 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.
3545    ///
3546    /// # Arguments
3547    ///
3548    /// * `request` - No description provided.
3549    /// * `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.
3550    pub fn locations_occurrences_test_iam_permissions(
3551        &self,
3552        request: TestIamPermissionsRequest,
3553        resource: &str,
3554    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {
3555        ProjectLocationOccurrenceTestIamPermissionCall {
3556            hub: self.hub,
3557            _request: request,
3558            _resource: resource.to_string(),
3559            _delegate: Default::default(),
3560            _additional_params: Default::default(),
3561            _scopes: Default::default(),
3562        }
3563    }
3564
3565    /// Create a builder to help you perform the following task:
3566    ///
3567    /// Generates an SBOM and other dependency information for the given resource.
3568    ///
3569    /// # Arguments
3570    ///
3571    /// * `request` - No description provided.
3572    /// * `name` - Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3573    pub fn locations_resources_export_sbom(
3574        &self,
3575        request: ExportSBOMRequest,
3576        name: &str,
3577    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
3578        ProjectLocationResourceExportSBOMCall {
3579            hub: self.hub,
3580            _request: request,
3581            _name: name.to_string(),
3582            _delegate: Default::default(),
3583            _additional_params: Default::default(),
3584            _scopes: Default::default(),
3585        }
3586    }
3587
3588    /// Create a builder to help you perform the following task:
3589    ///
3590    /// Gets a summary of the packages within a given resource.
3591    ///
3592    /// # Arguments
3593    ///
3594    /// * `request` - No description provided.
3595    /// * `name` - Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
3596    pub fn locations_resources_generate_packages_summary(
3597        &self,
3598        request: GeneratePackagesSummaryRequest,
3599        name: &str,
3600    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
3601        ProjectLocationResourceGeneratePackagesSummaryCall {
3602            hub: self.hub,
3603            _request: request,
3604            _name: name.to_string(),
3605            _delegate: Default::default(),
3606            _additional_params: Default::default(),
3607            _scopes: Default::default(),
3608        }
3609    }
3610
3611    /// Create a builder to help you perform the following task:
3612    ///
3613    /// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
3614    ///
3615    /// # Arguments
3616    ///
3617    /// * `name` - Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3618    pub fn notes_occurrences_list(&self, name: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
3619        ProjectNoteOccurrenceListCall {
3620            hub: self.hub,
3621            _name: name.to_string(),
3622            _page_token: Default::default(),
3623            _page_size: Default::default(),
3624            _filter: Default::default(),
3625            _delegate: Default::default(),
3626            _additional_params: Default::default(),
3627            _scopes: Default::default(),
3628        }
3629    }
3630
3631    /// Create a builder to help you perform the following task:
3632    ///
3633    /// Creates new notes in batch.
3634    ///
3635    /// # Arguments
3636    ///
3637    /// * `request` - No description provided.
3638    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
3639    pub fn notes_batch_create(
3640        &self,
3641        request: BatchCreateNotesRequest,
3642        parent: &str,
3643    ) -> ProjectNoteBatchCreateCall<'a, C> {
3644        ProjectNoteBatchCreateCall {
3645            hub: self.hub,
3646            _request: request,
3647            _parent: parent.to_string(),
3648            _delegate: Default::default(),
3649            _additional_params: Default::default(),
3650            _scopes: Default::default(),
3651        }
3652    }
3653
3654    /// Create a builder to help you perform the following task:
3655    ///
3656    /// Creates a new note.
3657    ///
3658    /// # Arguments
3659    ///
3660    /// * `request` - No description provided.
3661    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
3662    pub fn notes_create(&self, request: Note, parent: &str) -> ProjectNoteCreateCall<'a, C> {
3663        ProjectNoteCreateCall {
3664            hub: self.hub,
3665            _request: request,
3666            _parent: parent.to_string(),
3667            _note_id: Default::default(),
3668            _delegate: Default::default(),
3669            _additional_params: Default::default(),
3670            _scopes: Default::default(),
3671        }
3672    }
3673
3674    /// Create a builder to help you perform the following task:
3675    ///
3676    /// Deletes the specified note.
3677    ///
3678    /// # Arguments
3679    ///
3680    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3681    pub fn notes_delete(&self, name: &str) -> ProjectNoteDeleteCall<'a, C> {
3682        ProjectNoteDeleteCall {
3683            hub: self.hub,
3684            _name: name.to_string(),
3685            _delegate: Default::default(),
3686            _additional_params: Default::default(),
3687            _scopes: Default::default(),
3688        }
3689    }
3690
3691    /// Create a builder to help you perform the following task:
3692    ///
3693    /// Gets the specified note.
3694    ///
3695    /// # Arguments
3696    ///
3697    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3698    pub fn notes_get(&self, name: &str) -> ProjectNoteGetCall<'a, C> {
3699        ProjectNoteGetCall {
3700            hub: self.hub,
3701            _name: name.to_string(),
3702            _delegate: Default::default(),
3703            _additional_params: Default::default(),
3704            _scopes: Default::default(),
3705        }
3706    }
3707
3708    /// Create a builder to help you perform the following task:
3709    ///
3710    /// 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.
3711    ///
3712    /// # Arguments
3713    ///
3714    /// * `request` - No description provided.
3715    /// * `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.
3716    pub fn notes_get_iam_policy(
3717        &self,
3718        request: GetIamPolicyRequest,
3719        resource: &str,
3720    ) -> ProjectNoteGetIamPolicyCall<'a, C> {
3721        ProjectNoteGetIamPolicyCall {
3722            hub: self.hub,
3723            _request: request,
3724            _resource: resource.to_string(),
3725            _delegate: Default::default(),
3726            _additional_params: Default::default(),
3727            _scopes: Default::default(),
3728        }
3729    }
3730
3731    /// Create a builder to help you perform the following task:
3732    ///
3733    /// Lists notes for the specified project.
3734    ///
3735    /// # Arguments
3736    ///
3737    /// * `parent` - Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
3738    pub fn notes_list(&self, parent: &str) -> ProjectNoteListCall<'a, C> {
3739        ProjectNoteListCall {
3740            hub: self.hub,
3741            _parent: parent.to_string(),
3742            _return_partial_success: Default::default(),
3743            _page_token: Default::default(),
3744            _page_size: Default::default(),
3745            _filter: Default::default(),
3746            _delegate: Default::default(),
3747            _additional_params: Default::default(),
3748            _scopes: Default::default(),
3749        }
3750    }
3751
3752    /// Create a builder to help you perform the following task:
3753    ///
3754    /// Updates the specified note.
3755    ///
3756    /// # Arguments
3757    ///
3758    /// * `request` - No description provided.
3759    /// * `name` - Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
3760    pub fn notes_patch(&self, request: Note, name: &str) -> ProjectNotePatchCall<'a, C> {
3761        ProjectNotePatchCall {
3762            hub: self.hub,
3763            _request: request,
3764            _name: name.to_string(),
3765            _update_mask: Default::default(),
3766            _delegate: Default::default(),
3767            _additional_params: Default::default(),
3768            _scopes: Default::default(),
3769        }
3770    }
3771
3772    /// Create a builder to help you perform the following task:
3773    ///
3774    /// 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.
3775    ///
3776    /// # Arguments
3777    ///
3778    /// * `request` - No description provided.
3779    /// * `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.
3780    pub fn notes_set_iam_policy(
3781        &self,
3782        request: SetIamPolicyRequest,
3783        resource: &str,
3784    ) -> ProjectNoteSetIamPolicyCall<'a, C> {
3785        ProjectNoteSetIamPolicyCall {
3786            hub: self.hub,
3787            _request: request,
3788            _resource: resource.to_string(),
3789            _delegate: Default::default(),
3790            _additional_params: Default::default(),
3791            _scopes: Default::default(),
3792        }
3793    }
3794
3795    /// Create a builder to help you perform the following task:
3796    ///
3797    /// 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.
3798    ///
3799    /// # Arguments
3800    ///
3801    /// * `request` - No description provided.
3802    /// * `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.
3803    pub fn notes_test_iam_permissions(
3804        &self,
3805        request: TestIamPermissionsRequest,
3806        resource: &str,
3807    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
3808        ProjectNoteTestIamPermissionCall {
3809            hub: self.hub,
3810            _request: request,
3811            _resource: resource.to_string(),
3812            _delegate: Default::default(),
3813            _additional_params: Default::default(),
3814            _scopes: Default::default(),
3815        }
3816    }
3817
3818    /// Create a builder to help you perform the following task:
3819    ///
3820    /// Creates new occurrences in batch.
3821    ///
3822    /// # Arguments
3823    ///
3824    /// * `request` - No description provided.
3825    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
3826    pub fn occurrences_batch_create(
3827        &self,
3828        request: BatchCreateOccurrencesRequest,
3829        parent: &str,
3830    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
3831        ProjectOccurrenceBatchCreateCall {
3832            hub: self.hub,
3833            _request: request,
3834            _parent: parent.to_string(),
3835            _delegate: Default::default(),
3836            _additional_params: Default::default(),
3837            _scopes: Default::default(),
3838        }
3839    }
3840
3841    /// Create a builder to help you perform the following task:
3842    ///
3843    /// Creates a new occurrence.
3844    ///
3845    /// # Arguments
3846    ///
3847    /// * `request` - No description provided.
3848    /// * `parent` - Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created.
3849    pub fn occurrences_create(
3850        &self,
3851        request: Occurrence,
3852        parent: &str,
3853    ) -> ProjectOccurrenceCreateCall<'a, C> {
3854        ProjectOccurrenceCreateCall {
3855            hub: self.hub,
3856            _request: request,
3857            _parent: parent.to_string(),
3858            _delegate: Default::default(),
3859            _additional_params: Default::default(),
3860            _scopes: Default::default(),
3861        }
3862    }
3863
3864    /// Create a builder to help you perform the following task:
3865    ///
3866    /// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
3867    ///
3868    /// # Arguments
3869    ///
3870    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3871    pub fn occurrences_delete(&self, name: &str) -> ProjectOccurrenceDeleteCall<'a, C> {
3872        ProjectOccurrenceDeleteCall {
3873            hub: self.hub,
3874            _name: name.to_string(),
3875            _delegate: Default::default(),
3876            _additional_params: Default::default(),
3877            _scopes: Default::default(),
3878        }
3879    }
3880
3881    /// Create a builder to help you perform the following task:
3882    ///
3883    /// Gets the specified occurrence.
3884    ///
3885    /// # Arguments
3886    ///
3887    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3888    pub fn occurrences_get(&self, name: &str) -> ProjectOccurrenceGetCall<'a, C> {
3889        ProjectOccurrenceGetCall {
3890            hub: self.hub,
3891            _name: name.to_string(),
3892            _delegate: Default::default(),
3893            _additional_params: Default::default(),
3894            _scopes: Default::default(),
3895        }
3896    }
3897
3898    /// Create a builder to help you perform the following task:
3899    ///
3900    /// 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.
3901    ///
3902    /// # Arguments
3903    ///
3904    /// * `request` - No description provided.
3905    /// * `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.
3906    pub fn occurrences_get_iam_policy(
3907        &self,
3908        request: GetIamPolicyRequest,
3909        resource: &str,
3910    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
3911        ProjectOccurrenceGetIamPolicyCall {
3912            hub: self.hub,
3913            _request: request,
3914            _resource: resource.to_string(),
3915            _delegate: Default::default(),
3916            _additional_params: Default::default(),
3917            _scopes: Default::default(),
3918        }
3919    }
3920
3921    /// Create a builder to help you perform the following task:
3922    ///
3923    /// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
3924    ///
3925    /// # Arguments
3926    ///
3927    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3928    pub fn occurrences_get_notes(&self, name: &str) -> ProjectOccurrenceGetNoteCall<'a, C> {
3929        ProjectOccurrenceGetNoteCall {
3930            hub: self.hub,
3931            _name: name.to_string(),
3932            _delegate: Default::default(),
3933            _additional_params: Default::default(),
3934            _scopes: Default::default(),
3935        }
3936    }
3937
3938    /// Create a builder to help you perform the following task:
3939    ///
3940    /// Gets a summary of the number and severity of occurrences.
3941    ///
3942    /// # Arguments
3943    ///
3944    /// * `parent` - Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
3945    pub fn occurrences_get_vulnerability_summary(
3946        &self,
3947        parent: &str,
3948    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
3949        ProjectOccurrenceGetVulnerabilitySummaryCall {
3950            hub: self.hub,
3951            _parent: parent.to_string(),
3952            _return_partial_success: Default::default(),
3953            _filter: Default::default(),
3954            _delegate: Default::default(),
3955            _additional_params: Default::default(),
3956            _scopes: Default::default(),
3957        }
3958    }
3959
3960    /// Create a builder to help you perform the following task:
3961    ///
3962    /// Lists occurrences for the specified project.
3963    ///
3964    /// # Arguments
3965    ///
3966    /// * `parent` - Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
3967    pub fn occurrences_list(&self, parent: &str) -> ProjectOccurrenceListCall<'a, C> {
3968        ProjectOccurrenceListCall {
3969            hub: self.hub,
3970            _parent: parent.to_string(),
3971            _return_partial_success: Default::default(),
3972            _page_token: Default::default(),
3973            _page_size: Default::default(),
3974            _filter: Default::default(),
3975            _delegate: Default::default(),
3976            _additional_params: Default::default(),
3977            _scopes: Default::default(),
3978        }
3979    }
3980
3981    /// Create a builder to help you perform the following task:
3982    ///
3983    /// Updates the specified occurrence.
3984    ///
3985    /// # Arguments
3986    ///
3987    /// * `request` - No description provided.
3988    /// * `name` - Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
3989    pub fn occurrences_patch(
3990        &self,
3991        request: Occurrence,
3992        name: &str,
3993    ) -> ProjectOccurrencePatchCall<'a, C> {
3994        ProjectOccurrencePatchCall {
3995            hub: self.hub,
3996            _request: request,
3997            _name: name.to_string(),
3998            _update_mask: Default::default(),
3999            _delegate: Default::default(),
4000            _additional_params: Default::default(),
4001            _scopes: Default::default(),
4002        }
4003    }
4004
4005    /// Create a builder to help you perform the following task:
4006    ///
4007    /// 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.
4008    ///
4009    /// # Arguments
4010    ///
4011    /// * `request` - No description provided.
4012    /// * `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.
4013    pub fn occurrences_set_iam_policy(
4014        &self,
4015        request: SetIamPolicyRequest,
4016        resource: &str,
4017    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
4018        ProjectOccurrenceSetIamPolicyCall {
4019            hub: self.hub,
4020            _request: request,
4021            _resource: resource.to_string(),
4022            _delegate: Default::default(),
4023            _additional_params: Default::default(),
4024            _scopes: Default::default(),
4025        }
4026    }
4027
4028    /// Create a builder to help you perform the following task:
4029    ///
4030    /// 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.
4031    ///
4032    /// # Arguments
4033    ///
4034    /// * `request` - No description provided.
4035    /// * `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.
4036    pub fn occurrences_test_iam_permissions(
4037        &self,
4038        request: TestIamPermissionsRequest,
4039        resource: &str,
4040    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
4041        ProjectOccurrenceTestIamPermissionCall {
4042            hub: self.hub,
4043            _request: request,
4044            _resource: resource.to_string(),
4045            _delegate: Default::default(),
4046            _additional_params: Default::default(),
4047            _scopes: Default::default(),
4048        }
4049    }
4050
4051    /// Create a builder to help you perform the following task:
4052    ///
4053    /// Generates an SBOM and other dependency information for the given resource.
4054    ///
4055    /// # Arguments
4056    ///
4057    /// * `request` - No description provided.
4058    /// * `name` - Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
4059    pub fn resources_export_sbom(
4060        &self,
4061        request: ExportSBOMRequest,
4062        name: &str,
4063    ) -> ProjectResourceExportSBOMCall<'a, C> {
4064        ProjectResourceExportSBOMCall {
4065            hub: self.hub,
4066            _request: request,
4067            _name: name.to_string(),
4068            _delegate: Default::default(),
4069            _additional_params: Default::default(),
4070            _scopes: Default::default(),
4071        }
4072    }
4073
4074    /// Create a builder to help you perform the following task:
4075    ///
4076    /// Gets a summary of the packages within a given resource.
4077    ///
4078    /// # Arguments
4079    ///
4080    /// * `request` - No description provided.
4081    /// * `name` - Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
4082    pub fn resources_generate_packages_summary(
4083        &self,
4084        request: GeneratePackagesSummaryRequest,
4085        name: &str,
4086    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
4087        ProjectResourceGeneratePackagesSummaryCall {
4088            hub: self.hub,
4089            _request: request,
4090            _name: name.to_string(),
4091            _delegate: Default::default(),
4092            _additional_params: Default::default(),
4093            _scopes: Default::default(),
4094        }
4095    }
4096}
4097
4098// ###################
4099// CallBuilders   ###
4100// #################
4101
4102/// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
4103///
4104/// A builder for the *locations.notes.occurrences.list* method supported by a *project* resource.
4105/// It is not used directly, but through a [`ProjectMethods`] instance.
4106///
4107/// # Example
4108///
4109/// Instantiate a resource method builder
4110///
4111/// ```test_harness,no_run
4112/// # extern crate hyper;
4113/// # extern crate hyper_rustls;
4114/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4115/// # async fn dox() {
4116/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4117///
4118/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4119/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4120/// #     .with_native_roots()
4121/// #     .unwrap()
4122/// #     .https_only()
4123/// #     .enable_http2()
4124/// #     .build();
4125///
4126/// # let executor = hyper_util::rt::TokioExecutor::new();
4127/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4128/// #     secret,
4129/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4130/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4131/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4132/// #     ),
4133/// # ).build().await.unwrap();
4134///
4135/// # let client = hyper_util::client::legacy::Client::builder(
4136/// #     hyper_util::rt::TokioExecutor::new()
4137/// # )
4138/// # .build(
4139/// #     hyper_rustls::HttpsConnectorBuilder::new()
4140/// #         .with_native_roots()
4141/// #         .unwrap()
4142/// #         .https_or_http()
4143/// #         .enable_http2()
4144/// #         .build()
4145/// # );
4146/// # let mut hub = ContainerAnalysis::new(client, auth);
4147/// // You can configure optional parameters by calling the respective setters at will, and
4148/// // execute the final call using `doit()`.
4149/// // Values shown here are possibly random and not representative !
4150/// let result = hub.projects().locations_notes_occurrences_list("name")
4151///              .page_token("sed")
4152///              .page_size(-2)
4153///              .filter("takimata")
4154///              .doit().await;
4155/// # }
4156/// ```
4157pub struct ProjectLocationNoteOccurrenceListCall<'a, C>
4158where
4159    C: 'a,
4160{
4161    hub: &'a ContainerAnalysis<C>,
4162    _name: String,
4163    _page_token: Option<String>,
4164    _page_size: Option<i32>,
4165    _filter: Option<String>,
4166    _delegate: Option<&'a mut dyn common::Delegate>,
4167    _additional_params: HashMap<String, String>,
4168    _scopes: BTreeSet<String>,
4169}
4170
4171impl<'a, C> common::CallBuilder for ProjectLocationNoteOccurrenceListCall<'a, C> {}
4172
4173impl<'a, C> ProjectLocationNoteOccurrenceListCall<'a, C>
4174where
4175    C: common::Connector,
4176{
4177    /// Perform the operation you have build so far.
4178    pub async fn doit(mut self) -> common::Result<(common::Response, ListNoteOccurrencesResponse)> {
4179        use std::borrow::Cow;
4180        use std::io::{Read, Seek};
4181
4182        use common::{url::Params, ToParts};
4183        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4184
4185        let mut dd = common::DefaultDelegate;
4186        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4187        dlg.begin(common::MethodInfo {
4188            id: "containeranalysis.projects.locations.notes.occurrences.list",
4189            http_method: hyper::Method::GET,
4190        });
4191
4192        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
4193            if self._additional_params.contains_key(field) {
4194                dlg.finished(false);
4195                return Err(common::Error::FieldClash(field));
4196            }
4197        }
4198
4199        let mut params = Params::with_capacity(6 + self._additional_params.len());
4200        params.push("name", self._name);
4201        if let Some(value) = self._page_token.as_ref() {
4202            params.push("pageToken", value);
4203        }
4204        if let Some(value) = self._page_size.as_ref() {
4205            params.push("pageSize", value.to_string());
4206        }
4207        if let Some(value) = self._filter.as_ref() {
4208            params.push("filter", value);
4209        }
4210
4211        params.extend(self._additional_params.iter());
4212
4213        params.push("alt", "json");
4214        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/occurrences";
4215        if self._scopes.is_empty() {
4216            self._scopes
4217                .insert(Scope::CloudPlatform.as_ref().to_string());
4218        }
4219
4220        #[allow(clippy::single_element_loop)]
4221        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4222            url = params.uri_replacement(url, param_name, find_this, true);
4223        }
4224        {
4225            let to_remove = ["name"];
4226            params.remove_params(&to_remove);
4227        }
4228
4229        let url = params.parse_with_url(&url);
4230
4231        loop {
4232            let token = match self
4233                .hub
4234                .auth
4235                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4236                .await
4237            {
4238                Ok(token) => token,
4239                Err(e) => match dlg.token(e) {
4240                    Ok(token) => token,
4241                    Err(e) => {
4242                        dlg.finished(false);
4243                        return Err(common::Error::MissingToken(e));
4244                    }
4245                },
4246            };
4247            let mut req_result = {
4248                let client = &self.hub.client;
4249                dlg.pre_request();
4250                let mut req_builder = hyper::Request::builder()
4251                    .method(hyper::Method::GET)
4252                    .uri(url.as_str())
4253                    .header(USER_AGENT, self.hub._user_agent.clone());
4254
4255                if let Some(token) = token.as_ref() {
4256                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4257                }
4258
4259                let request = req_builder
4260                    .header(CONTENT_LENGTH, 0_u64)
4261                    .body(common::to_body::<String>(None));
4262
4263                client.request(request.unwrap()).await
4264            };
4265
4266            match req_result {
4267                Err(err) => {
4268                    if let common::Retry::After(d) = dlg.http_error(&err) {
4269                        sleep(d).await;
4270                        continue;
4271                    }
4272                    dlg.finished(false);
4273                    return Err(common::Error::HttpError(err));
4274                }
4275                Ok(res) => {
4276                    let (mut parts, body) = res.into_parts();
4277                    let mut body = common::Body::new(body);
4278                    if !parts.status.is_success() {
4279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4280                        let error = serde_json::from_str(&common::to_string(&bytes));
4281                        let response = common::to_response(parts, bytes.into());
4282
4283                        if let common::Retry::After(d) =
4284                            dlg.http_failure(&response, error.as_ref().ok())
4285                        {
4286                            sleep(d).await;
4287                            continue;
4288                        }
4289
4290                        dlg.finished(false);
4291
4292                        return Err(match error {
4293                            Ok(value) => common::Error::BadRequest(value),
4294                            _ => common::Error::Failure(response),
4295                        });
4296                    }
4297                    let response = {
4298                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4299                        let encoded = common::to_string(&bytes);
4300                        match serde_json::from_str(&encoded) {
4301                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4302                            Err(error) => {
4303                                dlg.response_json_decode_error(&encoded, &error);
4304                                return Err(common::Error::JsonDecodeError(
4305                                    encoded.to_string(),
4306                                    error,
4307                                ));
4308                            }
4309                        }
4310                    };
4311
4312                    dlg.finished(true);
4313                    return Ok(response);
4314                }
4315            }
4316        }
4317    }
4318
4319    /// Required. The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
4320    ///
4321    /// Sets the *name* path property to the given value.
4322    ///
4323    /// Even though the property as already been set when instantiating this call,
4324    /// we provide this method for API completeness.
4325    pub fn name(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4326        self._name = new_value.to_string();
4327        self
4328    }
4329    /// Token to provide to skip to a particular spot in the list.
4330    ///
4331    /// Sets the *page token* query property to the given value.
4332    pub fn page_token(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4333        self._page_token = Some(new_value.to_string());
4334        self
4335    }
4336    /// Number of occurrences to return in the list.
4337    ///
4338    /// Sets the *page size* query property to the given value.
4339    pub fn page_size(mut self, new_value: i32) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4340        self._page_size = Some(new_value);
4341        self
4342    }
4343    /// The filter expression.
4344    ///
4345    /// Sets the *filter* query property to the given value.
4346    pub fn filter(mut self, new_value: &str) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4347        self._filter = Some(new_value.to_string());
4348        self
4349    }
4350    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4351    /// while executing the actual API request.
4352    ///
4353    /// ````text
4354    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4355    /// ````
4356    ///
4357    /// Sets the *delegate* property to the given value.
4358    pub fn delegate(
4359        mut self,
4360        new_value: &'a mut dyn common::Delegate,
4361    ) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4362        self._delegate = Some(new_value);
4363        self
4364    }
4365
4366    /// Set any additional parameter of the query string used in the request.
4367    /// It should be used to set parameters which are not yet available through their own
4368    /// setters.
4369    ///
4370    /// Please note that this method must not be used to set any of the known parameters
4371    /// which have their own setter method. If done anyway, the request will fail.
4372    ///
4373    /// # Additional Parameters
4374    ///
4375    /// * *$.xgafv* (query-string) - V1 error format.
4376    /// * *access_token* (query-string) - OAuth access token.
4377    /// * *alt* (query-string) - Data format for response.
4378    /// * *callback* (query-string) - JSONP
4379    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4380    /// * *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.
4381    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4382    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4383    /// * *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.
4384    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4385    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4386    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteOccurrenceListCall<'a, C>
4387    where
4388        T: AsRef<str>,
4389    {
4390        self._additional_params
4391            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4392        self
4393    }
4394
4395    /// Identifies the authorization scope for the method you are building.
4396    ///
4397    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4398    /// [`Scope::CloudPlatform`].
4399    ///
4400    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4401    /// tokens for more than one scope.
4402    ///
4403    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4404    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4405    /// sufficient, a read-write scope will do as well.
4406    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteOccurrenceListCall<'a, C>
4407    where
4408        St: AsRef<str>,
4409    {
4410        self._scopes.insert(String::from(scope.as_ref()));
4411        self
4412    }
4413    /// Identifies the authorization scope(s) for the method you are building.
4414    ///
4415    /// See [`Self::add_scope()`] for details.
4416    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteOccurrenceListCall<'a, C>
4417    where
4418        I: IntoIterator<Item = St>,
4419        St: AsRef<str>,
4420    {
4421        self._scopes
4422            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4423        self
4424    }
4425
4426    /// Removes all scopes, and no default scope will be used either.
4427    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4428    /// for details).
4429    pub fn clear_scopes(mut self) -> ProjectLocationNoteOccurrenceListCall<'a, C> {
4430        self._scopes.clear();
4431        self
4432    }
4433}
4434
4435/// Creates new notes in batch.
4436///
4437/// A builder for the *locations.notes.batchCreate* method supported by a *project* resource.
4438/// It is not used directly, but through a [`ProjectMethods`] instance.
4439///
4440/// # Example
4441///
4442/// Instantiate a resource method builder
4443///
4444/// ```test_harness,no_run
4445/// # extern crate hyper;
4446/// # extern crate hyper_rustls;
4447/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4448/// use containeranalysis1_beta1::api::BatchCreateNotesRequest;
4449/// # async fn dox() {
4450/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4451///
4452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4453/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4454/// #     .with_native_roots()
4455/// #     .unwrap()
4456/// #     .https_only()
4457/// #     .enable_http2()
4458/// #     .build();
4459///
4460/// # let executor = hyper_util::rt::TokioExecutor::new();
4461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4462/// #     secret,
4463/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4464/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4465/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4466/// #     ),
4467/// # ).build().await.unwrap();
4468///
4469/// # let client = hyper_util::client::legacy::Client::builder(
4470/// #     hyper_util::rt::TokioExecutor::new()
4471/// # )
4472/// # .build(
4473/// #     hyper_rustls::HttpsConnectorBuilder::new()
4474/// #         .with_native_roots()
4475/// #         .unwrap()
4476/// #         .https_or_http()
4477/// #         .enable_http2()
4478/// #         .build()
4479/// # );
4480/// # let mut hub = ContainerAnalysis::new(client, auth);
4481/// // As the method needs a request, you would usually fill it with the desired information
4482/// // into the respective structure. Some of the parts shown here might not be applicable !
4483/// // Values shown here are possibly random and not representative !
4484/// let mut req = BatchCreateNotesRequest::default();
4485///
4486/// // You can configure optional parameters by calling the respective setters at will, and
4487/// // execute the final call using `doit()`.
4488/// // Values shown here are possibly random and not representative !
4489/// let result = hub.projects().locations_notes_batch_create(req, "parent")
4490///              .doit().await;
4491/// # }
4492/// ```
4493pub struct ProjectLocationNoteBatchCreateCall<'a, C>
4494where
4495    C: 'a,
4496{
4497    hub: &'a ContainerAnalysis<C>,
4498    _request: BatchCreateNotesRequest,
4499    _parent: String,
4500    _delegate: Option<&'a mut dyn common::Delegate>,
4501    _additional_params: HashMap<String, String>,
4502    _scopes: BTreeSet<String>,
4503}
4504
4505impl<'a, C> common::CallBuilder for ProjectLocationNoteBatchCreateCall<'a, C> {}
4506
4507impl<'a, C> ProjectLocationNoteBatchCreateCall<'a, C>
4508where
4509    C: common::Connector,
4510{
4511    /// Perform the operation you have build so far.
4512    pub async fn doit(mut self) -> common::Result<(common::Response, BatchCreateNotesResponse)> {
4513        use std::borrow::Cow;
4514        use std::io::{Read, Seek};
4515
4516        use common::{url::Params, ToParts};
4517        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4518
4519        let mut dd = common::DefaultDelegate;
4520        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4521        dlg.begin(common::MethodInfo {
4522            id: "containeranalysis.projects.locations.notes.batchCreate",
4523            http_method: hyper::Method::POST,
4524        });
4525
4526        for &field in ["alt", "parent"].iter() {
4527            if self._additional_params.contains_key(field) {
4528                dlg.finished(false);
4529                return Err(common::Error::FieldClash(field));
4530            }
4531        }
4532
4533        let mut params = Params::with_capacity(4 + self._additional_params.len());
4534        params.push("parent", self._parent);
4535
4536        params.extend(self._additional_params.iter());
4537
4538        params.push("alt", "json");
4539        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes:batchCreate";
4540        if self._scopes.is_empty() {
4541            self._scopes
4542                .insert(Scope::CloudPlatform.as_ref().to_string());
4543        }
4544
4545        #[allow(clippy::single_element_loop)]
4546        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4547            url = params.uri_replacement(url, param_name, find_this, true);
4548        }
4549        {
4550            let to_remove = ["parent"];
4551            params.remove_params(&to_remove);
4552        }
4553
4554        let url = params.parse_with_url(&url);
4555
4556        let mut json_mime_type = mime::APPLICATION_JSON;
4557        let mut request_value_reader = {
4558            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4559            common::remove_json_null_values(&mut value);
4560            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4561            serde_json::to_writer(&mut dst, &value).unwrap();
4562            dst
4563        };
4564        let request_size = request_value_reader
4565            .seek(std::io::SeekFrom::End(0))
4566            .unwrap();
4567        request_value_reader
4568            .seek(std::io::SeekFrom::Start(0))
4569            .unwrap();
4570
4571        loop {
4572            let token = match self
4573                .hub
4574                .auth
4575                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4576                .await
4577            {
4578                Ok(token) => token,
4579                Err(e) => match dlg.token(e) {
4580                    Ok(token) => token,
4581                    Err(e) => {
4582                        dlg.finished(false);
4583                        return Err(common::Error::MissingToken(e));
4584                    }
4585                },
4586            };
4587            request_value_reader
4588                .seek(std::io::SeekFrom::Start(0))
4589                .unwrap();
4590            let mut req_result = {
4591                let client = &self.hub.client;
4592                dlg.pre_request();
4593                let mut req_builder = hyper::Request::builder()
4594                    .method(hyper::Method::POST)
4595                    .uri(url.as_str())
4596                    .header(USER_AGENT, self.hub._user_agent.clone());
4597
4598                if let Some(token) = token.as_ref() {
4599                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4600                }
4601
4602                let request = req_builder
4603                    .header(CONTENT_TYPE, json_mime_type.to_string())
4604                    .header(CONTENT_LENGTH, request_size as u64)
4605                    .body(common::to_body(
4606                        request_value_reader.get_ref().clone().into(),
4607                    ));
4608
4609                client.request(request.unwrap()).await
4610            };
4611
4612            match req_result {
4613                Err(err) => {
4614                    if let common::Retry::After(d) = dlg.http_error(&err) {
4615                        sleep(d).await;
4616                        continue;
4617                    }
4618                    dlg.finished(false);
4619                    return Err(common::Error::HttpError(err));
4620                }
4621                Ok(res) => {
4622                    let (mut parts, body) = res.into_parts();
4623                    let mut body = common::Body::new(body);
4624                    if !parts.status.is_success() {
4625                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4626                        let error = serde_json::from_str(&common::to_string(&bytes));
4627                        let response = common::to_response(parts, bytes.into());
4628
4629                        if let common::Retry::After(d) =
4630                            dlg.http_failure(&response, error.as_ref().ok())
4631                        {
4632                            sleep(d).await;
4633                            continue;
4634                        }
4635
4636                        dlg.finished(false);
4637
4638                        return Err(match error {
4639                            Ok(value) => common::Error::BadRequest(value),
4640                            _ => common::Error::Failure(response),
4641                        });
4642                    }
4643                    let response = {
4644                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4645                        let encoded = common::to_string(&bytes);
4646                        match serde_json::from_str(&encoded) {
4647                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4648                            Err(error) => {
4649                                dlg.response_json_decode_error(&encoded, &error);
4650                                return Err(common::Error::JsonDecodeError(
4651                                    encoded.to_string(),
4652                                    error,
4653                                ));
4654                            }
4655                        }
4656                    };
4657
4658                    dlg.finished(true);
4659                    return Ok(response);
4660                }
4661            }
4662        }
4663    }
4664
4665    ///
4666    /// Sets the *request* property to the given value.
4667    ///
4668    /// Even though the property as already been set when instantiating this call,
4669    /// we provide this method for API completeness.
4670    pub fn request(
4671        mut self,
4672        new_value: BatchCreateNotesRequest,
4673    ) -> ProjectLocationNoteBatchCreateCall<'a, C> {
4674        self._request = new_value;
4675        self
4676    }
4677    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
4678    ///
4679    /// Sets the *parent* path property to the given value.
4680    ///
4681    /// Even though the property as already been set when instantiating this call,
4682    /// we provide this method for API completeness.
4683    pub fn parent(mut self, new_value: &str) -> ProjectLocationNoteBatchCreateCall<'a, C> {
4684        self._parent = new_value.to_string();
4685        self
4686    }
4687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4688    /// while executing the actual API request.
4689    ///
4690    /// ````text
4691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4692    /// ````
4693    ///
4694    /// Sets the *delegate* property to the given value.
4695    pub fn delegate(
4696        mut self,
4697        new_value: &'a mut dyn common::Delegate,
4698    ) -> ProjectLocationNoteBatchCreateCall<'a, C> {
4699        self._delegate = Some(new_value);
4700        self
4701    }
4702
4703    /// Set any additional parameter of the query string used in the request.
4704    /// It should be used to set parameters which are not yet available through their own
4705    /// setters.
4706    ///
4707    /// Please note that this method must not be used to set any of the known parameters
4708    /// which have their own setter method. If done anyway, the request will fail.
4709    ///
4710    /// # Additional Parameters
4711    ///
4712    /// * *$.xgafv* (query-string) - V1 error format.
4713    /// * *access_token* (query-string) - OAuth access token.
4714    /// * *alt* (query-string) - Data format for response.
4715    /// * *callback* (query-string) - JSONP
4716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4717    /// * *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.
4718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4720    /// * *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.
4721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4723    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteBatchCreateCall<'a, C>
4724    where
4725        T: AsRef<str>,
4726    {
4727        self._additional_params
4728            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4729        self
4730    }
4731
4732    /// Identifies the authorization scope for the method you are building.
4733    ///
4734    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4735    /// [`Scope::CloudPlatform`].
4736    ///
4737    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4738    /// tokens for more than one scope.
4739    ///
4740    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4741    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4742    /// sufficient, a read-write scope will do as well.
4743    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteBatchCreateCall<'a, C>
4744    where
4745        St: AsRef<str>,
4746    {
4747        self._scopes.insert(String::from(scope.as_ref()));
4748        self
4749    }
4750    /// Identifies the authorization scope(s) for the method you are building.
4751    ///
4752    /// See [`Self::add_scope()`] for details.
4753    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteBatchCreateCall<'a, C>
4754    where
4755        I: IntoIterator<Item = St>,
4756        St: AsRef<str>,
4757    {
4758        self._scopes
4759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4760        self
4761    }
4762
4763    /// Removes all scopes, and no default scope will be used either.
4764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4765    /// for details).
4766    pub fn clear_scopes(mut self) -> ProjectLocationNoteBatchCreateCall<'a, C> {
4767        self._scopes.clear();
4768        self
4769    }
4770}
4771
4772/// Creates a new note.
4773///
4774/// A builder for the *locations.notes.create* method supported by a *project* resource.
4775/// It is not used directly, but through a [`ProjectMethods`] instance.
4776///
4777/// # Example
4778///
4779/// Instantiate a resource method builder
4780///
4781/// ```test_harness,no_run
4782/// # extern crate hyper;
4783/// # extern crate hyper_rustls;
4784/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
4785/// use containeranalysis1_beta1::api::Note;
4786/// # async fn dox() {
4787/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4788///
4789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4791/// #     .with_native_roots()
4792/// #     .unwrap()
4793/// #     .https_only()
4794/// #     .enable_http2()
4795/// #     .build();
4796///
4797/// # let executor = hyper_util::rt::TokioExecutor::new();
4798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4799/// #     secret,
4800/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4801/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4802/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4803/// #     ),
4804/// # ).build().await.unwrap();
4805///
4806/// # let client = hyper_util::client::legacy::Client::builder(
4807/// #     hyper_util::rt::TokioExecutor::new()
4808/// # )
4809/// # .build(
4810/// #     hyper_rustls::HttpsConnectorBuilder::new()
4811/// #         .with_native_roots()
4812/// #         .unwrap()
4813/// #         .https_or_http()
4814/// #         .enable_http2()
4815/// #         .build()
4816/// # );
4817/// # let mut hub = ContainerAnalysis::new(client, auth);
4818/// // As the method needs a request, you would usually fill it with the desired information
4819/// // into the respective structure. Some of the parts shown here might not be applicable !
4820/// // Values shown here are possibly random and not representative !
4821/// let mut req = Note::default();
4822///
4823/// // You can configure optional parameters by calling the respective setters at will, and
4824/// // execute the final call using `doit()`.
4825/// // Values shown here are possibly random and not representative !
4826/// let result = hub.projects().locations_notes_create(req, "parent")
4827///              .note_id("ipsum")
4828///              .doit().await;
4829/// # }
4830/// ```
4831pub struct ProjectLocationNoteCreateCall<'a, C>
4832where
4833    C: 'a,
4834{
4835    hub: &'a ContainerAnalysis<C>,
4836    _request: Note,
4837    _parent: String,
4838    _note_id: Option<String>,
4839    _delegate: Option<&'a mut dyn common::Delegate>,
4840    _additional_params: HashMap<String, String>,
4841    _scopes: BTreeSet<String>,
4842}
4843
4844impl<'a, C> common::CallBuilder for ProjectLocationNoteCreateCall<'a, C> {}
4845
4846impl<'a, C> ProjectLocationNoteCreateCall<'a, C>
4847where
4848    C: common::Connector,
4849{
4850    /// Perform the operation you have build so far.
4851    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
4852        use std::borrow::Cow;
4853        use std::io::{Read, Seek};
4854
4855        use common::{url::Params, ToParts};
4856        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4857
4858        let mut dd = common::DefaultDelegate;
4859        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4860        dlg.begin(common::MethodInfo {
4861            id: "containeranalysis.projects.locations.notes.create",
4862            http_method: hyper::Method::POST,
4863        });
4864
4865        for &field in ["alt", "parent", "noteId"].iter() {
4866            if self._additional_params.contains_key(field) {
4867                dlg.finished(false);
4868                return Err(common::Error::FieldClash(field));
4869            }
4870        }
4871
4872        let mut params = Params::with_capacity(5 + self._additional_params.len());
4873        params.push("parent", self._parent);
4874        if let Some(value) = self._note_id.as_ref() {
4875            params.push("noteId", value);
4876        }
4877
4878        params.extend(self._additional_params.iter());
4879
4880        params.push("alt", "json");
4881        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
4882        if self._scopes.is_empty() {
4883            self._scopes
4884                .insert(Scope::CloudPlatform.as_ref().to_string());
4885        }
4886
4887        #[allow(clippy::single_element_loop)]
4888        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4889            url = params.uri_replacement(url, param_name, find_this, true);
4890        }
4891        {
4892            let to_remove = ["parent"];
4893            params.remove_params(&to_remove);
4894        }
4895
4896        let url = params.parse_with_url(&url);
4897
4898        let mut json_mime_type = mime::APPLICATION_JSON;
4899        let mut request_value_reader = {
4900            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4901            common::remove_json_null_values(&mut value);
4902            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4903            serde_json::to_writer(&mut dst, &value).unwrap();
4904            dst
4905        };
4906        let request_size = request_value_reader
4907            .seek(std::io::SeekFrom::End(0))
4908            .unwrap();
4909        request_value_reader
4910            .seek(std::io::SeekFrom::Start(0))
4911            .unwrap();
4912
4913        loop {
4914            let token = match self
4915                .hub
4916                .auth
4917                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4918                .await
4919            {
4920                Ok(token) => token,
4921                Err(e) => match dlg.token(e) {
4922                    Ok(token) => token,
4923                    Err(e) => {
4924                        dlg.finished(false);
4925                        return Err(common::Error::MissingToken(e));
4926                    }
4927                },
4928            };
4929            request_value_reader
4930                .seek(std::io::SeekFrom::Start(0))
4931                .unwrap();
4932            let mut req_result = {
4933                let client = &self.hub.client;
4934                dlg.pre_request();
4935                let mut req_builder = hyper::Request::builder()
4936                    .method(hyper::Method::POST)
4937                    .uri(url.as_str())
4938                    .header(USER_AGENT, self.hub._user_agent.clone());
4939
4940                if let Some(token) = token.as_ref() {
4941                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4942                }
4943
4944                let request = req_builder
4945                    .header(CONTENT_TYPE, json_mime_type.to_string())
4946                    .header(CONTENT_LENGTH, request_size as u64)
4947                    .body(common::to_body(
4948                        request_value_reader.get_ref().clone().into(),
4949                    ));
4950
4951                client.request(request.unwrap()).await
4952            };
4953
4954            match req_result {
4955                Err(err) => {
4956                    if let common::Retry::After(d) = dlg.http_error(&err) {
4957                        sleep(d).await;
4958                        continue;
4959                    }
4960                    dlg.finished(false);
4961                    return Err(common::Error::HttpError(err));
4962                }
4963                Ok(res) => {
4964                    let (mut parts, body) = res.into_parts();
4965                    let mut body = common::Body::new(body);
4966                    if !parts.status.is_success() {
4967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4968                        let error = serde_json::from_str(&common::to_string(&bytes));
4969                        let response = common::to_response(parts, bytes.into());
4970
4971                        if let common::Retry::After(d) =
4972                            dlg.http_failure(&response, error.as_ref().ok())
4973                        {
4974                            sleep(d).await;
4975                            continue;
4976                        }
4977
4978                        dlg.finished(false);
4979
4980                        return Err(match error {
4981                            Ok(value) => common::Error::BadRequest(value),
4982                            _ => common::Error::Failure(response),
4983                        });
4984                    }
4985                    let response = {
4986                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4987                        let encoded = common::to_string(&bytes);
4988                        match serde_json::from_str(&encoded) {
4989                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4990                            Err(error) => {
4991                                dlg.response_json_decode_error(&encoded, &error);
4992                                return Err(common::Error::JsonDecodeError(
4993                                    encoded.to_string(),
4994                                    error,
4995                                ));
4996                            }
4997                        }
4998                    };
4999
5000                    dlg.finished(true);
5001                    return Ok(response);
5002                }
5003            }
5004        }
5005    }
5006
5007    ///
5008    /// Sets the *request* property to the given value.
5009    ///
5010    /// Even though the property as already been set when instantiating this call,
5011    /// we provide this method for API completeness.
5012    pub fn request(mut self, new_value: Note) -> ProjectLocationNoteCreateCall<'a, C> {
5013        self._request = new_value;
5014        self
5015    }
5016    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
5017    ///
5018    /// Sets the *parent* path property to the given value.
5019    ///
5020    /// Even though the property as already been set when instantiating this call,
5021    /// we provide this method for API completeness.
5022    pub fn parent(mut self, new_value: &str) -> ProjectLocationNoteCreateCall<'a, C> {
5023        self._parent = new_value.to_string();
5024        self
5025    }
5026    /// Required. The ID to use for this note.
5027    ///
5028    /// Sets the *note id* query property to the given value.
5029    pub fn note_id(mut self, new_value: &str) -> ProjectLocationNoteCreateCall<'a, C> {
5030        self._note_id = Some(new_value.to_string());
5031        self
5032    }
5033    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5034    /// while executing the actual API request.
5035    ///
5036    /// ````text
5037    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5038    /// ````
5039    ///
5040    /// Sets the *delegate* property to the given value.
5041    pub fn delegate(
5042        mut self,
5043        new_value: &'a mut dyn common::Delegate,
5044    ) -> ProjectLocationNoteCreateCall<'a, C> {
5045        self._delegate = Some(new_value);
5046        self
5047    }
5048
5049    /// Set any additional parameter of the query string used in the request.
5050    /// It should be used to set parameters which are not yet available through their own
5051    /// setters.
5052    ///
5053    /// Please note that this method must not be used to set any of the known parameters
5054    /// which have their own setter method. If done anyway, the request will fail.
5055    ///
5056    /// # Additional Parameters
5057    ///
5058    /// * *$.xgafv* (query-string) - V1 error format.
5059    /// * *access_token* (query-string) - OAuth access token.
5060    /// * *alt* (query-string) - Data format for response.
5061    /// * *callback* (query-string) - JSONP
5062    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5063    /// * *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.
5064    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5065    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5066    /// * *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.
5067    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5068    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5069    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteCreateCall<'a, C>
5070    where
5071        T: AsRef<str>,
5072    {
5073        self._additional_params
5074            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5075        self
5076    }
5077
5078    /// Identifies the authorization scope for the method you are building.
5079    ///
5080    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5081    /// [`Scope::CloudPlatform`].
5082    ///
5083    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5084    /// tokens for more than one scope.
5085    ///
5086    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5087    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5088    /// sufficient, a read-write scope will do as well.
5089    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteCreateCall<'a, C>
5090    where
5091        St: AsRef<str>,
5092    {
5093        self._scopes.insert(String::from(scope.as_ref()));
5094        self
5095    }
5096    /// Identifies the authorization scope(s) for the method you are building.
5097    ///
5098    /// See [`Self::add_scope()`] for details.
5099    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteCreateCall<'a, C>
5100    where
5101        I: IntoIterator<Item = St>,
5102        St: AsRef<str>,
5103    {
5104        self._scopes
5105            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5106        self
5107    }
5108
5109    /// Removes all scopes, and no default scope will be used either.
5110    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5111    /// for details).
5112    pub fn clear_scopes(mut self) -> ProjectLocationNoteCreateCall<'a, C> {
5113        self._scopes.clear();
5114        self
5115    }
5116}
5117
5118/// Deletes the specified note.
5119///
5120/// A builder for the *locations.notes.delete* method supported by a *project* resource.
5121/// It is not used directly, but through a [`ProjectMethods`] instance.
5122///
5123/// # Example
5124///
5125/// Instantiate a resource method builder
5126///
5127/// ```test_harness,no_run
5128/// # extern crate hyper;
5129/// # extern crate hyper_rustls;
5130/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5131/// # async fn dox() {
5132/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5133///
5134/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5135/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5136/// #     .with_native_roots()
5137/// #     .unwrap()
5138/// #     .https_only()
5139/// #     .enable_http2()
5140/// #     .build();
5141///
5142/// # let executor = hyper_util::rt::TokioExecutor::new();
5143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5144/// #     secret,
5145/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5146/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5147/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5148/// #     ),
5149/// # ).build().await.unwrap();
5150///
5151/// # let client = hyper_util::client::legacy::Client::builder(
5152/// #     hyper_util::rt::TokioExecutor::new()
5153/// # )
5154/// # .build(
5155/// #     hyper_rustls::HttpsConnectorBuilder::new()
5156/// #         .with_native_roots()
5157/// #         .unwrap()
5158/// #         .https_or_http()
5159/// #         .enable_http2()
5160/// #         .build()
5161/// # );
5162/// # let mut hub = ContainerAnalysis::new(client, auth);
5163/// // You can configure optional parameters by calling the respective setters at will, and
5164/// // execute the final call using `doit()`.
5165/// // Values shown here are possibly random and not representative !
5166/// let result = hub.projects().locations_notes_delete("name")
5167///              .doit().await;
5168/// # }
5169/// ```
5170pub struct ProjectLocationNoteDeleteCall<'a, C>
5171where
5172    C: 'a,
5173{
5174    hub: &'a ContainerAnalysis<C>,
5175    _name: String,
5176    _delegate: Option<&'a mut dyn common::Delegate>,
5177    _additional_params: HashMap<String, String>,
5178    _scopes: BTreeSet<String>,
5179}
5180
5181impl<'a, C> common::CallBuilder for ProjectLocationNoteDeleteCall<'a, C> {}
5182
5183impl<'a, C> ProjectLocationNoteDeleteCall<'a, C>
5184where
5185    C: common::Connector,
5186{
5187    /// Perform the operation you have build so far.
5188    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5189        use std::borrow::Cow;
5190        use std::io::{Read, Seek};
5191
5192        use common::{url::Params, ToParts};
5193        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5194
5195        let mut dd = common::DefaultDelegate;
5196        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5197        dlg.begin(common::MethodInfo {
5198            id: "containeranalysis.projects.locations.notes.delete",
5199            http_method: hyper::Method::DELETE,
5200        });
5201
5202        for &field in ["alt", "name"].iter() {
5203            if self._additional_params.contains_key(field) {
5204                dlg.finished(false);
5205                return Err(common::Error::FieldClash(field));
5206            }
5207        }
5208
5209        let mut params = Params::with_capacity(3 + self._additional_params.len());
5210        params.push("name", self._name);
5211
5212        params.extend(self._additional_params.iter());
5213
5214        params.push("alt", "json");
5215        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5216        if self._scopes.is_empty() {
5217            self._scopes
5218                .insert(Scope::CloudPlatform.as_ref().to_string());
5219        }
5220
5221        #[allow(clippy::single_element_loop)]
5222        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5223            url = params.uri_replacement(url, param_name, find_this, true);
5224        }
5225        {
5226            let to_remove = ["name"];
5227            params.remove_params(&to_remove);
5228        }
5229
5230        let url = params.parse_with_url(&url);
5231
5232        loop {
5233            let token = match self
5234                .hub
5235                .auth
5236                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5237                .await
5238            {
5239                Ok(token) => token,
5240                Err(e) => match dlg.token(e) {
5241                    Ok(token) => token,
5242                    Err(e) => {
5243                        dlg.finished(false);
5244                        return Err(common::Error::MissingToken(e));
5245                    }
5246                },
5247            };
5248            let mut req_result = {
5249                let client = &self.hub.client;
5250                dlg.pre_request();
5251                let mut req_builder = hyper::Request::builder()
5252                    .method(hyper::Method::DELETE)
5253                    .uri(url.as_str())
5254                    .header(USER_AGENT, self.hub._user_agent.clone());
5255
5256                if let Some(token) = token.as_ref() {
5257                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5258                }
5259
5260                let request = req_builder
5261                    .header(CONTENT_LENGTH, 0_u64)
5262                    .body(common::to_body::<String>(None));
5263
5264                client.request(request.unwrap()).await
5265            };
5266
5267            match req_result {
5268                Err(err) => {
5269                    if let common::Retry::After(d) = dlg.http_error(&err) {
5270                        sleep(d).await;
5271                        continue;
5272                    }
5273                    dlg.finished(false);
5274                    return Err(common::Error::HttpError(err));
5275                }
5276                Ok(res) => {
5277                    let (mut parts, body) = res.into_parts();
5278                    let mut body = common::Body::new(body);
5279                    if !parts.status.is_success() {
5280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5281                        let error = serde_json::from_str(&common::to_string(&bytes));
5282                        let response = common::to_response(parts, bytes.into());
5283
5284                        if let common::Retry::After(d) =
5285                            dlg.http_failure(&response, error.as_ref().ok())
5286                        {
5287                            sleep(d).await;
5288                            continue;
5289                        }
5290
5291                        dlg.finished(false);
5292
5293                        return Err(match error {
5294                            Ok(value) => common::Error::BadRequest(value),
5295                            _ => common::Error::Failure(response),
5296                        });
5297                    }
5298                    let response = {
5299                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5300                        let encoded = common::to_string(&bytes);
5301                        match serde_json::from_str(&encoded) {
5302                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5303                            Err(error) => {
5304                                dlg.response_json_decode_error(&encoded, &error);
5305                                return Err(common::Error::JsonDecodeError(
5306                                    encoded.to_string(),
5307                                    error,
5308                                ));
5309                            }
5310                        }
5311                    };
5312
5313                    dlg.finished(true);
5314                    return Ok(response);
5315                }
5316            }
5317        }
5318    }
5319
5320    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
5321    ///
5322    /// Sets the *name* path property to the given value.
5323    ///
5324    /// Even though the property as already been set when instantiating this call,
5325    /// we provide this method for API completeness.
5326    pub fn name(mut self, new_value: &str) -> ProjectLocationNoteDeleteCall<'a, C> {
5327        self._name = new_value.to_string();
5328        self
5329    }
5330    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5331    /// while executing the actual API request.
5332    ///
5333    /// ````text
5334    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5335    /// ````
5336    ///
5337    /// Sets the *delegate* property to the given value.
5338    pub fn delegate(
5339        mut self,
5340        new_value: &'a mut dyn common::Delegate,
5341    ) -> ProjectLocationNoteDeleteCall<'a, C> {
5342        self._delegate = Some(new_value);
5343        self
5344    }
5345
5346    /// Set any additional parameter of the query string used in the request.
5347    /// It should be used to set parameters which are not yet available through their own
5348    /// setters.
5349    ///
5350    /// Please note that this method must not be used to set any of the known parameters
5351    /// which have their own setter method. If done anyway, the request will fail.
5352    ///
5353    /// # Additional Parameters
5354    ///
5355    /// * *$.xgafv* (query-string) - V1 error format.
5356    /// * *access_token* (query-string) - OAuth access token.
5357    /// * *alt* (query-string) - Data format for response.
5358    /// * *callback* (query-string) - JSONP
5359    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5360    /// * *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.
5361    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5362    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5363    /// * *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.
5364    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5365    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5366    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteDeleteCall<'a, C>
5367    where
5368        T: AsRef<str>,
5369    {
5370        self._additional_params
5371            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5372        self
5373    }
5374
5375    /// Identifies the authorization scope for the method you are building.
5376    ///
5377    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5378    /// [`Scope::CloudPlatform`].
5379    ///
5380    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5381    /// tokens for more than one scope.
5382    ///
5383    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5384    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5385    /// sufficient, a read-write scope will do as well.
5386    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteDeleteCall<'a, C>
5387    where
5388        St: AsRef<str>,
5389    {
5390        self._scopes.insert(String::from(scope.as_ref()));
5391        self
5392    }
5393    /// Identifies the authorization scope(s) for the method you are building.
5394    ///
5395    /// See [`Self::add_scope()`] for details.
5396    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteDeleteCall<'a, C>
5397    where
5398        I: IntoIterator<Item = St>,
5399        St: AsRef<str>,
5400    {
5401        self._scopes
5402            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5403        self
5404    }
5405
5406    /// Removes all scopes, and no default scope will be used either.
5407    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5408    /// for details).
5409    pub fn clear_scopes(mut self) -> ProjectLocationNoteDeleteCall<'a, C> {
5410        self._scopes.clear();
5411        self
5412    }
5413}
5414
5415/// Gets the specified note.
5416///
5417/// A builder for the *locations.notes.get* method supported by a *project* resource.
5418/// It is not used directly, but through a [`ProjectMethods`] instance.
5419///
5420/// # Example
5421///
5422/// Instantiate a resource method builder
5423///
5424/// ```test_harness,no_run
5425/// # extern crate hyper;
5426/// # extern crate hyper_rustls;
5427/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5428/// # async fn dox() {
5429/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5430///
5431/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5432/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5433/// #     .with_native_roots()
5434/// #     .unwrap()
5435/// #     .https_only()
5436/// #     .enable_http2()
5437/// #     .build();
5438///
5439/// # let executor = hyper_util::rt::TokioExecutor::new();
5440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5441/// #     secret,
5442/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5443/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5444/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5445/// #     ),
5446/// # ).build().await.unwrap();
5447///
5448/// # let client = hyper_util::client::legacy::Client::builder(
5449/// #     hyper_util::rt::TokioExecutor::new()
5450/// # )
5451/// # .build(
5452/// #     hyper_rustls::HttpsConnectorBuilder::new()
5453/// #         .with_native_roots()
5454/// #         .unwrap()
5455/// #         .https_or_http()
5456/// #         .enable_http2()
5457/// #         .build()
5458/// # );
5459/// # let mut hub = ContainerAnalysis::new(client, auth);
5460/// // You can configure optional parameters by calling the respective setters at will, and
5461/// // execute the final call using `doit()`.
5462/// // Values shown here are possibly random and not representative !
5463/// let result = hub.projects().locations_notes_get("name")
5464///              .doit().await;
5465/// # }
5466/// ```
5467pub struct ProjectLocationNoteGetCall<'a, C>
5468where
5469    C: 'a,
5470{
5471    hub: &'a ContainerAnalysis<C>,
5472    _name: String,
5473    _delegate: Option<&'a mut dyn common::Delegate>,
5474    _additional_params: HashMap<String, String>,
5475    _scopes: BTreeSet<String>,
5476}
5477
5478impl<'a, C> common::CallBuilder for ProjectLocationNoteGetCall<'a, C> {}
5479
5480impl<'a, C> ProjectLocationNoteGetCall<'a, C>
5481where
5482    C: common::Connector,
5483{
5484    /// Perform the operation you have build so far.
5485    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
5486        use std::borrow::Cow;
5487        use std::io::{Read, Seek};
5488
5489        use common::{url::Params, ToParts};
5490        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5491
5492        let mut dd = common::DefaultDelegate;
5493        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5494        dlg.begin(common::MethodInfo {
5495            id: "containeranalysis.projects.locations.notes.get",
5496            http_method: hyper::Method::GET,
5497        });
5498
5499        for &field in ["alt", "name"].iter() {
5500            if self._additional_params.contains_key(field) {
5501                dlg.finished(false);
5502                return Err(common::Error::FieldClash(field));
5503            }
5504        }
5505
5506        let mut params = Params::with_capacity(3 + self._additional_params.len());
5507        params.push("name", self._name);
5508
5509        params.extend(self._additional_params.iter());
5510
5511        params.push("alt", "json");
5512        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5513        if self._scopes.is_empty() {
5514            self._scopes
5515                .insert(Scope::CloudPlatform.as_ref().to_string());
5516        }
5517
5518        #[allow(clippy::single_element_loop)]
5519        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5520            url = params.uri_replacement(url, param_name, find_this, true);
5521        }
5522        {
5523            let to_remove = ["name"];
5524            params.remove_params(&to_remove);
5525        }
5526
5527        let url = params.parse_with_url(&url);
5528
5529        loop {
5530            let token = match self
5531                .hub
5532                .auth
5533                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5534                .await
5535            {
5536                Ok(token) => token,
5537                Err(e) => match dlg.token(e) {
5538                    Ok(token) => token,
5539                    Err(e) => {
5540                        dlg.finished(false);
5541                        return Err(common::Error::MissingToken(e));
5542                    }
5543                },
5544            };
5545            let mut req_result = {
5546                let client = &self.hub.client;
5547                dlg.pre_request();
5548                let mut req_builder = hyper::Request::builder()
5549                    .method(hyper::Method::GET)
5550                    .uri(url.as_str())
5551                    .header(USER_AGENT, self.hub._user_agent.clone());
5552
5553                if let Some(token) = token.as_ref() {
5554                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5555                }
5556
5557                let request = req_builder
5558                    .header(CONTENT_LENGTH, 0_u64)
5559                    .body(common::to_body::<String>(None));
5560
5561                client.request(request.unwrap()).await
5562            };
5563
5564            match req_result {
5565                Err(err) => {
5566                    if let common::Retry::After(d) = dlg.http_error(&err) {
5567                        sleep(d).await;
5568                        continue;
5569                    }
5570                    dlg.finished(false);
5571                    return Err(common::Error::HttpError(err));
5572                }
5573                Ok(res) => {
5574                    let (mut parts, body) = res.into_parts();
5575                    let mut body = common::Body::new(body);
5576                    if !parts.status.is_success() {
5577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5578                        let error = serde_json::from_str(&common::to_string(&bytes));
5579                        let response = common::to_response(parts, bytes.into());
5580
5581                        if let common::Retry::After(d) =
5582                            dlg.http_failure(&response, error.as_ref().ok())
5583                        {
5584                            sleep(d).await;
5585                            continue;
5586                        }
5587
5588                        dlg.finished(false);
5589
5590                        return Err(match error {
5591                            Ok(value) => common::Error::BadRequest(value),
5592                            _ => common::Error::Failure(response),
5593                        });
5594                    }
5595                    let response = {
5596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5597                        let encoded = common::to_string(&bytes);
5598                        match serde_json::from_str(&encoded) {
5599                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5600                            Err(error) => {
5601                                dlg.response_json_decode_error(&encoded, &error);
5602                                return Err(common::Error::JsonDecodeError(
5603                                    encoded.to_string(),
5604                                    error,
5605                                ));
5606                            }
5607                        }
5608                    };
5609
5610                    dlg.finished(true);
5611                    return Ok(response);
5612                }
5613            }
5614        }
5615    }
5616
5617    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
5618    ///
5619    /// Sets the *name* path property to the given value.
5620    ///
5621    /// Even though the property as already been set when instantiating this call,
5622    /// we provide this method for API completeness.
5623    pub fn name(mut self, new_value: &str) -> ProjectLocationNoteGetCall<'a, C> {
5624        self._name = new_value.to_string();
5625        self
5626    }
5627    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5628    /// while executing the actual API request.
5629    ///
5630    /// ````text
5631    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5632    /// ````
5633    ///
5634    /// Sets the *delegate* property to the given value.
5635    pub fn delegate(
5636        mut self,
5637        new_value: &'a mut dyn common::Delegate,
5638    ) -> ProjectLocationNoteGetCall<'a, C> {
5639        self._delegate = Some(new_value);
5640        self
5641    }
5642
5643    /// Set any additional parameter of the query string used in the request.
5644    /// It should be used to set parameters which are not yet available through their own
5645    /// setters.
5646    ///
5647    /// Please note that this method must not be used to set any of the known parameters
5648    /// which have their own setter method. If done anyway, the request will fail.
5649    ///
5650    /// # Additional Parameters
5651    ///
5652    /// * *$.xgafv* (query-string) - V1 error format.
5653    /// * *access_token* (query-string) - OAuth access token.
5654    /// * *alt* (query-string) - Data format for response.
5655    /// * *callback* (query-string) - JSONP
5656    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5657    /// * *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.
5658    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5659    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5660    /// * *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.
5661    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5662    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5663    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteGetCall<'a, C>
5664    where
5665        T: AsRef<str>,
5666    {
5667        self._additional_params
5668            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5669        self
5670    }
5671
5672    /// Identifies the authorization scope for the method you are building.
5673    ///
5674    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5675    /// [`Scope::CloudPlatform`].
5676    ///
5677    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5678    /// tokens for more than one scope.
5679    ///
5680    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5681    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5682    /// sufficient, a read-write scope will do as well.
5683    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteGetCall<'a, C>
5684    where
5685        St: AsRef<str>,
5686    {
5687        self._scopes.insert(String::from(scope.as_ref()));
5688        self
5689    }
5690    /// Identifies the authorization scope(s) for the method you are building.
5691    ///
5692    /// See [`Self::add_scope()`] for details.
5693    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteGetCall<'a, C>
5694    where
5695        I: IntoIterator<Item = St>,
5696        St: AsRef<str>,
5697    {
5698        self._scopes
5699            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5700        self
5701    }
5702
5703    /// Removes all scopes, and no default scope will be used either.
5704    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5705    /// for details).
5706    pub fn clear_scopes(mut self) -> ProjectLocationNoteGetCall<'a, C> {
5707        self._scopes.clear();
5708        self
5709    }
5710}
5711
5712/// 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.
5713///
5714/// A builder for the *locations.notes.getIamPolicy* method supported by a *project* resource.
5715/// It is not used directly, but through a [`ProjectMethods`] instance.
5716///
5717/// # Example
5718///
5719/// Instantiate a resource method builder
5720///
5721/// ```test_harness,no_run
5722/// # extern crate hyper;
5723/// # extern crate hyper_rustls;
5724/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
5725/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
5726/// # async fn dox() {
5727/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5728///
5729/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5730/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5731/// #     .with_native_roots()
5732/// #     .unwrap()
5733/// #     .https_only()
5734/// #     .enable_http2()
5735/// #     .build();
5736///
5737/// # let executor = hyper_util::rt::TokioExecutor::new();
5738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5739/// #     secret,
5740/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5741/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5742/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5743/// #     ),
5744/// # ).build().await.unwrap();
5745///
5746/// # let client = hyper_util::client::legacy::Client::builder(
5747/// #     hyper_util::rt::TokioExecutor::new()
5748/// # )
5749/// # .build(
5750/// #     hyper_rustls::HttpsConnectorBuilder::new()
5751/// #         .with_native_roots()
5752/// #         .unwrap()
5753/// #         .https_or_http()
5754/// #         .enable_http2()
5755/// #         .build()
5756/// # );
5757/// # let mut hub = ContainerAnalysis::new(client, auth);
5758/// // As the method needs a request, you would usually fill it with the desired information
5759/// // into the respective structure. Some of the parts shown here might not be applicable !
5760/// // Values shown here are possibly random and not representative !
5761/// let mut req = GetIamPolicyRequest::default();
5762///
5763/// // You can configure optional parameters by calling the respective setters at will, and
5764/// // execute the final call using `doit()`.
5765/// // Values shown here are possibly random and not representative !
5766/// let result = hub.projects().locations_notes_get_iam_policy(req, "resource")
5767///              .doit().await;
5768/// # }
5769/// ```
5770pub struct ProjectLocationNoteGetIamPolicyCall<'a, C>
5771where
5772    C: 'a,
5773{
5774    hub: &'a ContainerAnalysis<C>,
5775    _request: GetIamPolicyRequest,
5776    _resource: String,
5777    _delegate: Option<&'a mut dyn common::Delegate>,
5778    _additional_params: HashMap<String, String>,
5779    _scopes: BTreeSet<String>,
5780}
5781
5782impl<'a, C> common::CallBuilder for ProjectLocationNoteGetIamPolicyCall<'a, C> {}
5783
5784impl<'a, C> ProjectLocationNoteGetIamPolicyCall<'a, C>
5785where
5786    C: common::Connector,
5787{
5788    /// Perform the operation you have build so far.
5789    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5790        use std::borrow::Cow;
5791        use std::io::{Read, Seek};
5792
5793        use common::{url::Params, ToParts};
5794        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5795
5796        let mut dd = common::DefaultDelegate;
5797        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5798        dlg.begin(common::MethodInfo {
5799            id: "containeranalysis.projects.locations.notes.getIamPolicy",
5800            http_method: hyper::Method::POST,
5801        });
5802
5803        for &field in ["alt", "resource"].iter() {
5804            if self._additional_params.contains_key(field) {
5805                dlg.finished(false);
5806                return Err(common::Error::FieldClash(field));
5807            }
5808        }
5809
5810        let mut params = Params::with_capacity(4 + self._additional_params.len());
5811        params.push("resource", self._resource);
5812
5813        params.extend(self._additional_params.iter());
5814
5815        params.push("alt", "json");
5816        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
5817        if self._scopes.is_empty() {
5818            self._scopes
5819                .insert(Scope::CloudPlatform.as_ref().to_string());
5820        }
5821
5822        #[allow(clippy::single_element_loop)]
5823        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5824            url = params.uri_replacement(url, param_name, find_this, true);
5825        }
5826        {
5827            let to_remove = ["resource"];
5828            params.remove_params(&to_remove);
5829        }
5830
5831        let url = params.parse_with_url(&url);
5832
5833        let mut json_mime_type = mime::APPLICATION_JSON;
5834        let mut request_value_reader = {
5835            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5836            common::remove_json_null_values(&mut value);
5837            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5838            serde_json::to_writer(&mut dst, &value).unwrap();
5839            dst
5840        };
5841        let request_size = request_value_reader
5842            .seek(std::io::SeekFrom::End(0))
5843            .unwrap();
5844        request_value_reader
5845            .seek(std::io::SeekFrom::Start(0))
5846            .unwrap();
5847
5848        loop {
5849            let token = match self
5850                .hub
5851                .auth
5852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5853                .await
5854            {
5855                Ok(token) => token,
5856                Err(e) => match dlg.token(e) {
5857                    Ok(token) => token,
5858                    Err(e) => {
5859                        dlg.finished(false);
5860                        return Err(common::Error::MissingToken(e));
5861                    }
5862                },
5863            };
5864            request_value_reader
5865                .seek(std::io::SeekFrom::Start(0))
5866                .unwrap();
5867            let mut req_result = {
5868                let client = &self.hub.client;
5869                dlg.pre_request();
5870                let mut req_builder = hyper::Request::builder()
5871                    .method(hyper::Method::POST)
5872                    .uri(url.as_str())
5873                    .header(USER_AGENT, self.hub._user_agent.clone());
5874
5875                if let Some(token) = token.as_ref() {
5876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5877                }
5878
5879                let request = req_builder
5880                    .header(CONTENT_TYPE, json_mime_type.to_string())
5881                    .header(CONTENT_LENGTH, request_size as u64)
5882                    .body(common::to_body(
5883                        request_value_reader.get_ref().clone().into(),
5884                    ));
5885
5886                client.request(request.unwrap()).await
5887            };
5888
5889            match req_result {
5890                Err(err) => {
5891                    if let common::Retry::After(d) = dlg.http_error(&err) {
5892                        sleep(d).await;
5893                        continue;
5894                    }
5895                    dlg.finished(false);
5896                    return Err(common::Error::HttpError(err));
5897                }
5898                Ok(res) => {
5899                    let (mut parts, body) = res.into_parts();
5900                    let mut body = common::Body::new(body);
5901                    if !parts.status.is_success() {
5902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5903                        let error = serde_json::from_str(&common::to_string(&bytes));
5904                        let response = common::to_response(parts, bytes.into());
5905
5906                        if let common::Retry::After(d) =
5907                            dlg.http_failure(&response, error.as_ref().ok())
5908                        {
5909                            sleep(d).await;
5910                            continue;
5911                        }
5912
5913                        dlg.finished(false);
5914
5915                        return Err(match error {
5916                            Ok(value) => common::Error::BadRequest(value),
5917                            _ => common::Error::Failure(response),
5918                        });
5919                    }
5920                    let response = {
5921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5922                        let encoded = common::to_string(&bytes);
5923                        match serde_json::from_str(&encoded) {
5924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5925                            Err(error) => {
5926                                dlg.response_json_decode_error(&encoded, &error);
5927                                return Err(common::Error::JsonDecodeError(
5928                                    encoded.to_string(),
5929                                    error,
5930                                ));
5931                            }
5932                        }
5933                    };
5934
5935                    dlg.finished(true);
5936                    return Ok(response);
5937                }
5938            }
5939        }
5940    }
5941
5942    ///
5943    /// Sets the *request* property to the given value.
5944    ///
5945    /// Even though the property as already been set when instantiating this call,
5946    /// we provide this method for API completeness.
5947    pub fn request(
5948        mut self,
5949        new_value: GetIamPolicyRequest,
5950    ) -> ProjectLocationNoteGetIamPolicyCall<'a, C> {
5951        self._request = new_value;
5952        self
5953    }
5954    /// 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.
5955    ///
5956    /// Sets the *resource* path property to the given value.
5957    ///
5958    /// Even though the property as already been set when instantiating this call,
5959    /// we provide this method for API completeness.
5960    pub fn resource(mut self, new_value: &str) -> ProjectLocationNoteGetIamPolicyCall<'a, C> {
5961        self._resource = new_value.to_string();
5962        self
5963    }
5964    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5965    /// while executing the actual API request.
5966    ///
5967    /// ````text
5968    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5969    /// ````
5970    ///
5971    /// Sets the *delegate* property to the given value.
5972    pub fn delegate(
5973        mut self,
5974        new_value: &'a mut dyn common::Delegate,
5975    ) -> ProjectLocationNoteGetIamPolicyCall<'a, C> {
5976        self._delegate = Some(new_value);
5977        self
5978    }
5979
5980    /// Set any additional parameter of the query string used in the request.
5981    /// It should be used to set parameters which are not yet available through their own
5982    /// setters.
5983    ///
5984    /// Please note that this method must not be used to set any of the known parameters
5985    /// which have their own setter method. If done anyway, the request will fail.
5986    ///
5987    /// # Additional Parameters
5988    ///
5989    /// * *$.xgafv* (query-string) - V1 error format.
5990    /// * *access_token* (query-string) - OAuth access token.
5991    /// * *alt* (query-string) - Data format for response.
5992    /// * *callback* (query-string) - JSONP
5993    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5994    /// * *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.
5995    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5996    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5997    /// * *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.
5998    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5999    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6000    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteGetIamPolicyCall<'a, C>
6001    where
6002        T: AsRef<str>,
6003    {
6004        self._additional_params
6005            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6006        self
6007    }
6008
6009    /// Identifies the authorization scope for the method you are building.
6010    ///
6011    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6012    /// [`Scope::CloudPlatform`].
6013    ///
6014    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6015    /// tokens for more than one scope.
6016    ///
6017    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6018    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6019    /// sufficient, a read-write scope will do as well.
6020    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteGetIamPolicyCall<'a, C>
6021    where
6022        St: AsRef<str>,
6023    {
6024        self._scopes.insert(String::from(scope.as_ref()));
6025        self
6026    }
6027    /// Identifies the authorization scope(s) for the method you are building.
6028    ///
6029    /// See [`Self::add_scope()`] for details.
6030    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteGetIamPolicyCall<'a, C>
6031    where
6032        I: IntoIterator<Item = St>,
6033        St: AsRef<str>,
6034    {
6035        self._scopes
6036            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6037        self
6038    }
6039
6040    /// Removes all scopes, and no default scope will be used either.
6041    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6042    /// for details).
6043    pub fn clear_scopes(mut self) -> ProjectLocationNoteGetIamPolicyCall<'a, C> {
6044        self._scopes.clear();
6045        self
6046    }
6047}
6048
6049/// Lists notes for the specified project.
6050///
6051/// A builder for the *locations.notes.list* method supported by a *project* resource.
6052/// It is not used directly, but through a [`ProjectMethods`] instance.
6053///
6054/// # Example
6055///
6056/// Instantiate a resource method builder
6057///
6058/// ```test_harness,no_run
6059/// # extern crate hyper;
6060/// # extern crate hyper_rustls;
6061/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6062/// # async fn dox() {
6063/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6064///
6065/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6066/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6067/// #     .with_native_roots()
6068/// #     .unwrap()
6069/// #     .https_only()
6070/// #     .enable_http2()
6071/// #     .build();
6072///
6073/// # let executor = hyper_util::rt::TokioExecutor::new();
6074/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6075/// #     secret,
6076/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6077/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6078/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6079/// #     ),
6080/// # ).build().await.unwrap();
6081///
6082/// # let client = hyper_util::client::legacy::Client::builder(
6083/// #     hyper_util::rt::TokioExecutor::new()
6084/// # )
6085/// # .build(
6086/// #     hyper_rustls::HttpsConnectorBuilder::new()
6087/// #         .with_native_roots()
6088/// #         .unwrap()
6089/// #         .https_or_http()
6090/// #         .enable_http2()
6091/// #         .build()
6092/// # );
6093/// # let mut hub = ContainerAnalysis::new(client, auth);
6094/// // You can configure optional parameters by calling the respective setters at will, and
6095/// // execute the final call using `doit()`.
6096/// // Values shown here are possibly random and not representative !
6097/// let result = hub.projects().locations_notes_list("parent")
6098///              .return_partial_success(true)
6099///              .page_token("invidunt")
6100///              .page_size(-47)
6101///              .filter("duo")
6102///              .doit().await;
6103/// # }
6104/// ```
6105pub struct ProjectLocationNoteListCall<'a, C>
6106where
6107    C: 'a,
6108{
6109    hub: &'a ContainerAnalysis<C>,
6110    _parent: String,
6111    _return_partial_success: Option<bool>,
6112    _page_token: Option<String>,
6113    _page_size: Option<i32>,
6114    _filter: Option<String>,
6115    _delegate: Option<&'a mut dyn common::Delegate>,
6116    _additional_params: HashMap<String, String>,
6117    _scopes: BTreeSet<String>,
6118}
6119
6120impl<'a, C> common::CallBuilder for ProjectLocationNoteListCall<'a, C> {}
6121
6122impl<'a, C> ProjectLocationNoteListCall<'a, C>
6123where
6124    C: common::Connector,
6125{
6126    /// Perform the operation you have build so far.
6127    pub async fn doit(mut self) -> common::Result<(common::Response, ListNotesResponse)> {
6128        use std::borrow::Cow;
6129        use std::io::{Read, Seek};
6130
6131        use common::{url::Params, ToParts};
6132        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6133
6134        let mut dd = common::DefaultDelegate;
6135        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6136        dlg.begin(common::MethodInfo {
6137            id: "containeranalysis.projects.locations.notes.list",
6138            http_method: hyper::Method::GET,
6139        });
6140
6141        for &field in [
6142            "alt",
6143            "parent",
6144            "returnPartialSuccess",
6145            "pageToken",
6146            "pageSize",
6147            "filter",
6148        ]
6149        .iter()
6150        {
6151            if self._additional_params.contains_key(field) {
6152                dlg.finished(false);
6153                return Err(common::Error::FieldClash(field));
6154            }
6155        }
6156
6157        let mut params = Params::with_capacity(7 + self._additional_params.len());
6158        params.push("parent", self._parent);
6159        if let Some(value) = self._return_partial_success.as_ref() {
6160            params.push("returnPartialSuccess", value.to_string());
6161        }
6162        if let Some(value) = self._page_token.as_ref() {
6163            params.push("pageToken", value);
6164        }
6165        if let Some(value) = self._page_size.as_ref() {
6166            params.push("pageSize", value.to_string());
6167        }
6168        if let Some(value) = self._filter.as_ref() {
6169            params.push("filter", value);
6170        }
6171
6172        params.extend(self._additional_params.iter());
6173
6174        params.push("alt", "json");
6175        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
6176        if self._scopes.is_empty() {
6177            self._scopes
6178                .insert(Scope::CloudPlatform.as_ref().to_string());
6179        }
6180
6181        #[allow(clippy::single_element_loop)]
6182        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6183            url = params.uri_replacement(url, param_name, find_this, true);
6184        }
6185        {
6186            let to_remove = ["parent"];
6187            params.remove_params(&to_remove);
6188        }
6189
6190        let url = params.parse_with_url(&url);
6191
6192        loop {
6193            let token = match self
6194                .hub
6195                .auth
6196                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6197                .await
6198            {
6199                Ok(token) => token,
6200                Err(e) => match dlg.token(e) {
6201                    Ok(token) => token,
6202                    Err(e) => {
6203                        dlg.finished(false);
6204                        return Err(common::Error::MissingToken(e));
6205                    }
6206                },
6207            };
6208            let mut req_result = {
6209                let client = &self.hub.client;
6210                dlg.pre_request();
6211                let mut req_builder = hyper::Request::builder()
6212                    .method(hyper::Method::GET)
6213                    .uri(url.as_str())
6214                    .header(USER_AGENT, self.hub._user_agent.clone());
6215
6216                if let Some(token) = token.as_ref() {
6217                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6218                }
6219
6220                let request = req_builder
6221                    .header(CONTENT_LENGTH, 0_u64)
6222                    .body(common::to_body::<String>(None));
6223
6224                client.request(request.unwrap()).await
6225            };
6226
6227            match req_result {
6228                Err(err) => {
6229                    if let common::Retry::After(d) = dlg.http_error(&err) {
6230                        sleep(d).await;
6231                        continue;
6232                    }
6233                    dlg.finished(false);
6234                    return Err(common::Error::HttpError(err));
6235                }
6236                Ok(res) => {
6237                    let (mut parts, body) = res.into_parts();
6238                    let mut body = common::Body::new(body);
6239                    if !parts.status.is_success() {
6240                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6241                        let error = serde_json::from_str(&common::to_string(&bytes));
6242                        let response = common::to_response(parts, bytes.into());
6243
6244                        if let common::Retry::After(d) =
6245                            dlg.http_failure(&response, error.as_ref().ok())
6246                        {
6247                            sleep(d).await;
6248                            continue;
6249                        }
6250
6251                        dlg.finished(false);
6252
6253                        return Err(match error {
6254                            Ok(value) => common::Error::BadRequest(value),
6255                            _ => common::Error::Failure(response),
6256                        });
6257                    }
6258                    let response = {
6259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6260                        let encoded = common::to_string(&bytes);
6261                        match serde_json::from_str(&encoded) {
6262                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6263                            Err(error) => {
6264                                dlg.response_json_decode_error(&encoded, &error);
6265                                return Err(common::Error::JsonDecodeError(
6266                                    encoded.to_string(),
6267                                    error,
6268                                ));
6269                            }
6270                        }
6271                    };
6272
6273                    dlg.finished(true);
6274                    return Ok(response);
6275                }
6276            }
6277        }
6278    }
6279
6280    /// Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
6281    ///
6282    /// Sets the *parent* path property to the given value.
6283    ///
6284    /// Even though the property as already been set when instantiating this call,
6285    /// we provide this method for API completeness.
6286    pub fn parent(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
6287        self._parent = new_value.to_string();
6288        self
6289    }
6290    /// If set, the request will return all reachable Notes and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
6291    ///
6292    /// Sets the *return partial success* query property to the given value.
6293    pub fn return_partial_success(mut self, new_value: bool) -> ProjectLocationNoteListCall<'a, C> {
6294        self._return_partial_success = Some(new_value);
6295        self
6296    }
6297    /// Token to provide to skip to a particular spot in the list.
6298    ///
6299    /// Sets the *page token* query property to the given value.
6300    pub fn page_token(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
6301        self._page_token = Some(new_value.to_string());
6302        self
6303    }
6304    /// 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.
6305    ///
6306    /// Sets the *page size* query property to the given value.
6307    pub fn page_size(mut self, new_value: i32) -> ProjectLocationNoteListCall<'a, C> {
6308        self._page_size = Some(new_value);
6309        self
6310    }
6311    /// The filter expression.
6312    ///
6313    /// Sets the *filter* query property to the given value.
6314    pub fn filter(mut self, new_value: &str) -> ProjectLocationNoteListCall<'a, C> {
6315        self._filter = Some(new_value.to_string());
6316        self
6317    }
6318    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6319    /// while executing the actual API request.
6320    ///
6321    /// ````text
6322    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6323    /// ````
6324    ///
6325    /// Sets the *delegate* property to the given value.
6326    pub fn delegate(
6327        mut self,
6328        new_value: &'a mut dyn common::Delegate,
6329    ) -> ProjectLocationNoteListCall<'a, C> {
6330        self._delegate = Some(new_value);
6331        self
6332    }
6333
6334    /// Set any additional parameter of the query string used in the request.
6335    /// It should be used to set parameters which are not yet available through their own
6336    /// setters.
6337    ///
6338    /// Please note that this method must not be used to set any of the known parameters
6339    /// which have their own setter method. If done anyway, the request will fail.
6340    ///
6341    /// # Additional Parameters
6342    ///
6343    /// * *$.xgafv* (query-string) - V1 error format.
6344    /// * *access_token* (query-string) - OAuth access token.
6345    /// * *alt* (query-string) - Data format for response.
6346    /// * *callback* (query-string) - JSONP
6347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6348    /// * *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.
6349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6351    /// * *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.
6352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6354    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteListCall<'a, C>
6355    where
6356        T: AsRef<str>,
6357    {
6358        self._additional_params
6359            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6360        self
6361    }
6362
6363    /// Identifies the authorization scope for the method you are building.
6364    ///
6365    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6366    /// [`Scope::CloudPlatform`].
6367    ///
6368    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6369    /// tokens for more than one scope.
6370    ///
6371    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6372    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6373    /// sufficient, a read-write scope will do as well.
6374    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteListCall<'a, C>
6375    where
6376        St: AsRef<str>,
6377    {
6378        self._scopes.insert(String::from(scope.as_ref()));
6379        self
6380    }
6381    /// Identifies the authorization scope(s) for the method you are building.
6382    ///
6383    /// See [`Self::add_scope()`] for details.
6384    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteListCall<'a, C>
6385    where
6386        I: IntoIterator<Item = St>,
6387        St: AsRef<str>,
6388    {
6389        self._scopes
6390            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6391        self
6392    }
6393
6394    /// Removes all scopes, and no default scope will be used either.
6395    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6396    /// for details).
6397    pub fn clear_scopes(mut self) -> ProjectLocationNoteListCall<'a, C> {
6398        self._scopes.clear();
6399        self
6400    }
6401}
6402
6403/// Updates the specified note.
6404///
6405/// A builder for the *locations.notes.patch* method supported by a *project* resource.
6406/// It is not used directly, but through a [`ProjectMethods`] instance.
6407///
6408/// # Example
6409///
6410/// Instantiate a resource method builder
6411///
6412/// ```test_harness,no_run
6413/// # extern crate hyper;
6414/// # extern crate hyper_rustls;
6415/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6416/// use containeranalysis1_beta1::api::Note;
6417/// # async fn dox() {
6418/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6419///
6420/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6421/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6422/// #     .with_native_roots()
6423/// #     .unwrap()
6424/// #     .https_only()
6425/// #     .enable_http2()
6426/// #     .build();
6427///
6428/// # let executor = hyper_util::rt::TokioExecutor::new();
6429/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6430/// #     secret,
6431/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6432/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6433/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6434/// #     ),
6435/// # ).build().await.unwrap();
6436///
6437/// # let client = hyper_util::client::legacy::Client::builder(
6438/// #     hyper_util::rt::TokioExecutor::new()
6439/// # )
6440/// # .build(
6441/// #     hyper_rustls::HttpsConnectorBuilder::new()
6442/// #         .with_native_roots()
6443/// #         .unwrap()
6444/// #         .https_or_http()
6445/// #         .enable_http2()
6446/// #         .build()
6447/// # );
6448/// # let mut hub = ContainerAnalysis::new(client, auth);
6449/// // As the method needs a request, you would usually fill it with the desired information
6450/// // into the respective structure. Some of the parts shown here might not be applicable !
6451/// // Values shown here are possibly random and not representative !
6452/// let mut req = Note::default();
6453///
6454/// // You can configure optional parameters by calling the respective setters at will, and
6455/// // execute the final call using `doit()`.
6456/// // Values shown here are possibly random and not representative !
6457/// let result = hub.projects().locations_notes_patch(req, "name")
6458///              .update_mask(FieldMask::new::<&str>(&[]))
6459///              .doit().await;
6460/// # }
6461/// ```
6462pub struct ProjectLocationNotePatchCall<'a, C>
6463where
6464    C: 'a,
6465{
6466    hub: &'a ContainerAnalysis<C>,
6467    _request: Note,
6468    _name: String,
6469    _update_mask: Option<common::FieldMask>,
6470    _delegate: Option<&'a mut dyn common::Delegate>,
6471    _additional_params: HashMap<String, String>,
6472    _scopes: BTreeSet<String>,
6473}
6474
6475impl<'a, C> common::CallBuilder for ProjectLocationNotePatchCall<'a, C> {}
6476
6477impl<'a, C> ProjectLocationNotePatchCall<'a, C>
6478where
6479    C: common::Connector,
6480{
6481    /// Perform the operation you have build so far.
6482    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
6483        use std::borrow::Cow;
6484        use std::io::{Read, Seek};
6485
6486        use common::{url::Params, ToParts};
6487        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6488
6489        let mut dd = common::DefaultDelegate;
6490        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6491        dlg.begin(common::MethodInfo {
6492            id: "containeranalysis.projects.locations.notes.patch",
6493            http_method: hyper::Method::PATCH,
6494        });
6495
6496        for &field in ["alt", "name", "updateMask"].iter() {
6497            if self._additional_params.contains_key(field) {
6498                dlg.finished(false);
6499                return Err(common::Error::FieldClash(field));
6500            }
6501        }
6502
6503        let mut params = Params::with_capacity(5 + self._additional_params.len());
6504        params.push("name", self._name);
6505        if let Some(value) = self._update_mask.as_ref() {
6506            params.push("updateMask", value.to_string());
6507        }
6508
6509        params.extend(self._additional_params.iter());
6510
6511        params.push("alt", "json");
6512        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6513        if self._scopes.is_empty() {
6514            self._scopes
6515                .insert(Scope::CloudPlatform.as_ref().to_string());
6516        }
6517
6518        #[allow(clippy::single_element_loop)]
6519        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6520            url = params.uri_replacement(url, param_name, find_this, true);
6521        }
6522        {
6523            let to_remove = ["name"];
6524            params.remove_params(&to_remove);
6525        }
6526
6527        let url = params.parse_with_url(&url);
6528
6529        let mut json_mime_type = mime::APPLICATION_JSON;
6530        let mut request_value_reader = {
6531            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6532            common::remove_json_null_values(&mut value);
6533            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6534            serde_json::to_writer(&mut dst, &value).unwrap();
6535            dst
6536        };
6537        let request_size = request_value_reader
6538            .seek(std::io::SeekFrom::End(0))
6539            .unwrap();
6540        request_value_reader
6541            .seek(std::io::SeekFrom::Start(0))
6542            .unwrap();
6543
6544        loop {
6545            let token = match self
6546                .hub
6547                .auth
6548                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6549                .await
6550            {
6551                Ok(token) => token,
6552                Err(e) => match dlg.token(e) {
6553                    Ok(token) => token,
6554                    Err(e) => {
6555                        dlg.finished(false);
6556                        return Err(common::Error::MissingToken(e));
6557                    }
6558                },
6559            };
6560            request_value_reader
6561                .seek(std::io::SeekFrom::Start(0))
6562                .unwrap();
6563            let mut req_result = {
6564                let client = &self.hub.client;
6565                dlg.pre_request();
6566                let mut req_builder = hyper::Request::builder()
6567                    .method(hyper::Method::PATCH)
6568                    .uri(url.as_str())
6569                    .header(USER_AGENT, self.hub._user_agent.clone());
6570
6571                if let Some(token) = token.as_ref() {
6572                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6573                }
6574
6575                let request = req_builder
6576                    .header(CONTENT_TYPE, json_mime_type.to_string())
6577                    .header(CONTENT_LENGTH, request_size as u64)
6578                    .body(common::to_body(
6579                        request_value_reader.get_ref().clone().into(),
6580                    ));
6581
6582                client.request(request.unwrap()).await
6583            };
6584
6585            match req_result {
6586                Err(err) => {
6587                    if let common::Retry::After(d) = dlg.http_error(&err) {
6588                        sleep(d).await;
6589                        continue;
6590                    }
6591                    dlg.finished(false);
6592                    return Err(common::Error::HttpError(err));
6593                }
6594                Ok(res) => {
6595                    let (mut parts, body) = res.into_parts();
6596                    let mut body = common::Body::new(body);
6597                    if !parts.status.is_success() {
6598                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6599                        let error = serde_json::from_str(&common::to_string(&bytes));
6600                        let response = common::to_response(parts, bytes.into());
6601
6602                        if let common::Retry::After(d) =
6603                            dlg.http_failure(&response, error.as_ref().ok())
6604                        {
6605                            sleep(d).await;
6606                            continue;
6607                        }
6608
6609                        dlg.finished(false);
6610
6611                        return Err(match error {
6612                            Ok(value) => common::Error::BadRequest(value),
6613                            _ => common::Error::Failure(response),
6614                        });
6615                    }
6616                    let response = {
6617                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6618                        let encoded = common::to_string(&bytes);
6619                        match serde_json::from_str(&encoded) {
6620                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6621                            Err(error) => {
6622                                dlg.response_json_decode_error(&encoded, &error);
6623                                return Err(common::Error::JsonDecodeError(
6624                                    encoded.to_string(),
6625                                    error,
6626                                ));
6627                            }
6628                        }
6629                    };
6630
6631                    dlg.finished(true);
6632                    return Ok(response);
6633                }
6634            }
6635        }
6636    }
6637
6638    ///
6639    /// Sets the *request* property to the given value.
6640    ///
6641    /// Even though the property as already been set when instantiating this call,
6642    /// we provide this method for API completeness.
6643    pub fn request(mut self, new_value: Note) -> ProjectLocationNotePatchCall<'a, C> {
6644        self._request = new_value;
6645        self
6646    }
6647    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
6648    ///
6649    /// Sets the *name* path property to the given value.
6650    ///
6651    /// Even though the property as already been set when instantiating this call,
6652    /// we provide this method for API completeness.
6653    pub fn name(mut self, new_value: &str) -> ProjectLocationNotePatchCall<'a, C> {
6654        self._name = new_value.to_string();
6655        self
6656    }
6657    /// The fields to update.
6658    ///
6659    /// Sets the *update mask* query property to the given value.
6660    pub fn update_mask(
6661        mut self,
6662        new_value: common::FieldMask,
6663    ) -> ProjectLocationNotePatchCall<'a, C> {
6664        self._update_mask = Some(new_value);
6665        self
6666    }
6667    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6668    /// while executing the actual API request.
6669    ///
6670    /// ````text
6671    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6672    /// ````
6673    ///
6674    /// Sets the *delegate* property to the given value.
6675    pub fn delegate(
6676        mut self,
6677        new_value: &'a mut dyn common::Delegate,
6678    ) -> ProjectLocationNotePatchCall<'a, C> {
6679        self._delegate = Some(new_value);
6680        self
6681    }
6682
6683    /// Set any additional parameter of the query string used in the request.
6684    /// It should be used to set parameters which are not yet available through their own
6685    /// setters.
6686    ///
6687    /// Please note that this method must not be used to set any of the known parameters
6688    /// which have their own setter method. If done anyway, the request will fail.
6689    ///
6690    /// # Additional Parameters
6691    ///
6692    /// * *$.xgafv* (query-string) - V1 error format.
6693    /// * *access_token* (query-string) - OAuth access token.
6694    /// * *alt* (query-string) - Data format for response.
6695    /// * *callback* (query-string) - JSONP
6696    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6697    /// * *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.
6698    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6699    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6700    /// * *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.
6701    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6702    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6703    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNotePatchCall<'a, C>
6704    where
6705        T: AsRef<str>,
6706    {
6707        self._additional_params
6708            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6709        self
6710    }
6711
6712    /// Identifies the authorization scope for the method you are building.
6713    ///
6714    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6715    /// [`Scope::CloudPlatform`].
6716    ///
6717    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6718    /// tokens for more than one scope.
6719    ///
6720    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6721    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6722    /// sufficient, a read-write scope will do as well.
6723    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNotePatchCall<'a, C>
6724    where
6725        St: AsRef<str>,
6726    {
6727        self._scopes.insert(String::from(scope.as_ref()));
6728        self
6729    }
6730    /// Identifies the authorization scope(s) for the method you are building.
6731    ///
6732    /// See [`Self::add_scope()`] for details.
6733    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNotePatchCall<'a, C>
6734    where
6735        I: IntoIterator<Item = St>,
6736        St: AsRef<str>,
6737    {
6738        self._scopes
6739            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6740        self
6741    }
6742
6743    /// Removes all scopes, and no default scope will be used either.
6744    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6745    /// for details).
6746    pub fn clear_scopes(mut self) -> ProjectLocationNotePatchCall<'a, C> {
6747        self._scopes.clear();
6748        self
6749    }
6750}
6751
6752/// 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.
6753///
6754/// A builder for the *locations.notes.setIamPolicy* method supported by a *project* resource.
6755/// It is not used directly, but through a [`ProjectMethods`] instance.
6756///
6757/// # Example
6758///
6759/// Instantiate a resource method builder
6760///
6761/// ```test_harness,no_run
6762/// # extern crate hyper;
6763/// # extern crate hyper_rustls;
6764/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
6765/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
6766/// # async fn dox() {
6767/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6768///
6769/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6770/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6771/// #     .with_native_roots()
6772/// #     .unwrap()
6773/// #     .https_only()
6774/// #     .enable_http2()
6775/// #     .build();
6776///
6777/// # let executor = hyper_util::rt::TokioExecutor::new();
6778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6779/// #     secret,
6780/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6781/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6782/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6783/// #     ),
6784/// # ).build().await.unwrap();
6785///
6786/// # let client = hyper_util::client::legacy::Client::builder(
6787/// #     hyper_util::rt::TokioExecutor::new()
6788/// # )
6789/// # .build(
6790/// #     hyper_rustls::HttpsConnectorBuilder::new()
6791/// #         .with_native_roots()
6792/// #         .unwrap()
6793/// #         .https_or_http()
6794/// #         .enable_http2()
6795/// #         .build()
6796/// # );
6797/// # let mut hub = ContainerAnalysis::new(client, auth);
6798/// // As the method needs a request, you would usually fill it with the desired information
6799/// // into the respective structure. Some of the parts shown here might not be applicable !
6800/// // Values shown here are possibly random and not representative !
6801/// let mut req = SetIamPolicyRequest::default();
6802///
6803/// // You can configure optional parameters by calling the respective setters at will, and
6804/// // execute the final call using `doit()`.
6805/// // Values shown here are possibly random and not representative !
6806/// let result = hub.projects().locations_notes_set_iam_policy(req, "resource")
6807///              .doit().await;
6808/// # }
6809/// ```
6810pub struct ProjectLocationNoteSetIamPolicyCall<'a, C>
6811where
6812    C: 'a,
6813{
6814    hub: &'a ContainerAnalysis<C>,
6815    _request: SetIamPolicyRequest,
6816    _resource: String,
6817    _delegate: Option<&'a mut dyn common::Delegate>,
6818    _additional_params: HashMap<String, String>,
6819    _scopes: BTreeSet<String>,
6820}
6821
6822impl<'a, C> common::CallBuilder for ProjectLocationNoteSetIamPolicyCall<'a, C> {}
6823
6824impl<'a, C> ProjectLocationNoteSetIamPolicyCall<'a, C>
6825where
6826    C: common::Connector,
6827{
6828    /// Perform the operation you have build so far.
6829    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6830        use std::borrow::Cow;
6831        use std::io::{Read, Seek};
6832
6833        use common::{url::Params, ToParts};
6834        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6835
6836        let mut dd = common::DefaultDelegate;
6837        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6838        dlg.begin(common::MethodInfo {
6839            id: "containeranalysis.projects.locations.notes.setIamPolicy",
6840            http_method: hyper::Method::POST,
6841        });
6842
6843        for &field in ["alt", "resource"].iter() {
6844            if self._additional_params.contains_key(field) {
6845                dlg.finished(false);
6846                return Err(common::Error::FieldClash(field));
6847            }
6848        }
6849
6850        let mut params = Params::with_capacity(4 + self._additional_params.len());
6851        params.push("resource", self._resource);
6852
6853        params.extend(self._additional_params.iter());
6854
6855        params.push("alt", "json");
6856        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
6857        if self._scopes.is_empty() {
6858            self._scopes
6859                .insert(Scope::CloudPlatform.as_ref().to_string());
6860        }
6861
6862        #[allow(clippy::single_element_loop)]
6863        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6864            url = params.uri_replacement(url, param_name, find_this, true);
6865        }
6866        {
6867            let to_remove = ["resource"];
6868            params.remove_params(&to_remove);
6869        }
6870
6871        let url = params.parse_with_url(&url);
6872
6873        let mut json_mime_type = mime::APPLICATION_JSON;
6874        let mut request_value_reader = {
6875            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6876            common::remove_json_null_values(&mut value);
6877            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6878            serde_json::to_writer(&mut dst, &value).unwrap();
6879            dst
6880        };
6881        let request_size = request_value_reader
6882            .seek(std::io::SeekFrom::End(0))
6883            .unwrap();
6884        request_value_reader
6885            .seek(std::io::SeekFrom::Start(0))
6886            .unwrap();
6887
6888        loop {
6889            let token = match self
6890                .hub
6891                .auth
6892                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6893                .await
6894            {
6895                Ok(token) => token,
6896                Err(e) => match dlg.token(e) {
6897                    Ok(token) => token,
6898                    Err(e) => {
6899                        dlg.finished(false);
6900                        return Err(common::Error::MissingToken(e));
6901                    }
6902                },
6903            };
6904            request_value_reader
6905                .seek(std::io::SeekFrom::Start(0))
6906                .unwrap();
6907            let mut req_result = {
6908                let client = &self.hub.client;
6909                dlg.pre_request();
6910                let mut req_builder = hyper::Request::builder()
6911                    .method(hyper::Method::POST)
6912                    .uri(url.as_str())
6913                    .header(USER_AGENT, self.hub._user_agent.clone());
6914
6915                if let Some(token) = token.as_ref() {
6916                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6917                }
6918
6919                let request = req_builder
6920                    .header(CONTENT_TYPE, json_mime_type.to_string())
6921                    .header(CONTENT_LENGTH, request_size as u64)
6922                    .body(common::to_body(
6923                        request_value_reader.get_ref().clone().into(),
6924                    ));
6925
6926                client.request(request.unwrap()).await
6927            };
6928
6929            match req_result {
6930                Err(err) => {
6931                    if let common::Retry::After(d) = dlg.http_error(&err) {
6932                        sleep(d).await;
6933                        continue;
6934                    }
6935                    dlg.finished(false);
6936                    return Err(common::Error::HttpError(err));
6937                }
6938                Ok(res) => {
6939                    let (mut parts, body) = res.into_parts();
6940                    let mut body = common::Body::new(body);
6941                    if !parts.status.is_success() {
6942                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6943                        let error = serde_json::from_str(&common::to_string(&bytes));
6944                        let response = common::to_response(parts, bytes.into());
6945
6946                        if let common::Retry::After(d) =
6947                            dlg.http_failure(&response, error.as_ref().ok())
6948                        {
6949                            sleep(d).await;
6950                            continue;
6951                        }
6952
6953                        dlg.finished(false);
6954
6955                        return Err(match error {
6956                            Ok(value) => common::Error::BadRequest(value),
6957                            _ => common::Error::Failure(response),
6958                        });
6959                    }
6960                    let response = {
6961                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6962                        let encoded = common::to_string(&bytes);
6963                        match serde_json::from_str(&encoded) {
6964                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6965                            Err(error) => {
6966                                dlg.response_json_decode_error(&encoded, &error);
6967                                return Err(common::Error::JsonDecodeError(
6968                                    encoded.to_string(),
6969                                    error,
6970                                ));
6971                            }
6972                        }
6973                    };
6974
6975                    dlg.finished(true);
6976                    return Ok(response);
6977                }
6978            }
6979        }
6980    }
6981
6982    ///
6983    /// Sets the *request* property to the given value.
6984    ///
6985    /// Even though the property as already been set when instantiating this call,
6986    /// we provide this method for API completeness.
6987    pub fn request(
6988        mut self,
6989        new_value: SetIamPolicyRequest,
6990    ) -> ProjectLocationNoteSetIamPolicyCall<'a, C> {
6991        self._request = new_value;
6992        self
6993    }
6994    /// 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.
6995    ///
6996    /// Sets the *resource* path property to the given value.
6997    ///
6998    /// Even though the property as already been set when instantiating this call,
6999    /// we provide this method for API completeness.
7000    pub fn resource(mut self, new_value: &str) -> ProjectLocationNoteSetIamPolicyCall<'a, C> {
7001        self._resource = new_value.to_string();
7002        self
7003    }
7004    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7005    /// while executing the actual API request.
7006    ///
7007    /// ````text
7008    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7009    /// ````
7010    ///
7011    /// Sets the *delegate* property to the given value.
7012    pub fn delegate(
7013        mut self,
7014        new_value: &'a mut dyn common::Delegate,
7015    ) -> ProjectLocationNoteSetIamPolicyCall<'a, C> {
7016        self._delegate = Some(new_value);
7017        self
7018    }
7019
7020    /// Set any additional parameter of the query string used in the request.
7021    /// It should be used to set parameters which are not yet available through their own
7022    /// setters.
7023    ///
7024    /// Please note that this method must not be used to set any of the known parameters
7025    /// which have their own setter method. If done anyway, the request will fail.
7026    ///
7027    /// # Additional Parameters
7028    ///
7029    /// * *$.xgafv* (query-string) - V1 error format.
7030    /// * *access_token* (query-string) - OAuth access token.
7031    /// * *alt* (query-string) - Data format for response.
7032    /// * *callback* (query-string) - JSONP
7033    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7034    /// * *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.
7035    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7036    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7037    /// * *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.
7038    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7039    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7040    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteSetIamPolicyCall<'a, C>
7041    where
7042        T: AsRef<str>,
7043    {
7044        self._additional_params
7045            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7046        self
7047    }
7048
7049    /// Identifies the authorization scope for the method you are building.
7050    ///
7051    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7052    /// [`Scope::CloudPlatform`].
7053    ///
7054    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7055    /// tokens for more than one scope.
7056    ///
7057    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7058    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7059    /// sufficient, a read-write scope will do as well.
7060    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteSetIamPolicyCall<'a, C>
7061    where
7062        St: AsRef<str>,
7063    {
7064        self._scopes.insert(String::from(scope.as_ref()));
7065        self
7066    }
7067    /// Identifies the authorization scope(s) for the method you are building.
7068    ///
7069    /// See [`Self::add_scope()`] for details.
7070    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteSetIamPolicyCall<'a, C>
7071    where
7072        I: IntoIterator<Item = St>,
7073        St: AsRef<str>,
7074    {
7075        self._scopes
7076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7077        self
7078    }
7079
7080    /// Removes all scopes, and no default scope will be used either.
7081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7082    /// for details).
7083    pub fn clear_scopes(mut self) -> ProjectLocationNoteSetIamPolicyCall<'a, C> {
7084        self._scopes.clear();
7085        self
7086    }
7087}
7088
7089/// 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.
7090///
7091/// A builder for the *locations.notes.testIamPermissions* method supported by a *project* resource.
7092/// It is not used directly, but through a [`ProjectMethods`] instance.
7093///
7094/// # Example
7095///
7096/// Instantiate a resource method builder
7097///
7098/// ```test_harness,no_run
7099/// # extern crate hyper;
7100/// # extern crate hyper_rustls;
7101/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7102/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
7103/// # async fn dox() {
7104/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7105///
7106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7107/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7108/// #     .with_native_roots()
7109/// #     .unwrap()
7110/// #     .https_only()
7111/// #     .enable_http2()
7112/// #     .build();
7113///
7114/// # let executor = hyper_util::rt::TokioExecutor::new();
7115/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7116/// #     secret,
7117/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7118/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7119/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7120/// #     ),
7121/// # ).build().await.unwrap();
7122///
7123/// # let client = hyper_util::client::legacy::Client::builder(
7124/// #     hyper_util::rt::TokioExecutor::new()
7125/// # )
7126/// # .build(
7127/// #     hyper_rustls::HttpsConnectorBuilder::new()
7128/// #         .with_native_roots()
7129/// #         .unwrap()
7130/// #         .https_or_http()
7131/// #         .enable_http2()
7132/// #         .build()
7133/// # );
7134/// # let mut hub = ContainerAnalysis::new(client, auth);
7135/// // As the method needs a request, you would usually fill it with the desired information
7136/// // into the respective structure. Some of the parts shown here might not be applicable !
7137/// // Values shown here are possibly random and not representative !
7138/// let mut req = TestIamPermissionsRequest::default();
7139///
7140/// // You can configure optional parameters by calling the respective setters at will, and
7141/// // execute the final call using `doit()`.
7142/// // Values shown here are possibly random and not representative !
7143/// let result = hub.projects().locations_notes_test_iam_permissions(req, "resource")
7144///              .doit().await;
7145/// # }
7146/// ```
7147pub struct ProjectLocationNoteTestIamPermissionCall<'a, C>
7148where
7149    C: 'a,
7150{
7151    hub: &'a ContainerAnalysis<C>,
7152    _request: TestIamPermissionsRequest,
7153    _resource: String,
7154    _delegate: Option<&'a mut dyn common::Delegate>,
7155    _additional_params: HashMap<String, String>,
7156    _scopes: BTreeSet<String>,
7157}
7158
7159impl<'a, C> common::CallBuilder for ProjectLocationNoteTestIamPermissionCall<'a, C> {}
7160
7161impl<'a, C> ProjectLocationNoteTestIamPermissionCall<'a, C>
7162where
7163    C: common::Connector,
7164{
7165    /// Perform the operation you have build so far.
7166    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7167        use std::borrow::Cow;
7168        use std::io::{Read, Seek};
7169
7170        use common::{url::Params, ToParts};
7171        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7172
7173        let mut dd = common::DefaultDelegate;
7174        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7175        dlg.begin(common::MethodInfo {
7176            id: "containeranalysis.projects.locations.notes.testIamPermissions",
7177            http_method: hyper::Method::POST,
7178        });
7179
7180        for &field in ["alt", "resource"].iter() {
7181            if self._additional_params.contains_key(field) {
7182                dlg.finished(false);
7183                return Err(common::Error::FieldClash(field));
7184            }
7185        }
7186
7187        let mut params = Params::with_capacity(4 + self._additional_params.len());
7188        params.push("resource", self._resource);
7189
7190        params.extend(self._additional_params.iter());
7191
7192        params.push("alt", "json");
7193        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
7194        if self._scopes.is_empty() {
7195            self._scopes
7196                .insert(Scope::CloudPlatform.as_ref().to_string());
7197        }
7198
7199        #[allow(clippy::single_element_loop)]
7200        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7201            url = params.uri_replacement(url, param_name, find_this, true);
7202        }
7203        {
7204            let to_remove = ["resource"];
7205            params.remove_params(&to_remove);
7206        }
7207
7208        let url = params.parse_with_url(&url);
7209
7210        let mut json_mime_type = mime::APPLICATION_JSON;
7211        let mut request_value_reader = {
7212            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7213            common::remove_json_null_values(&mut value);
7214            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7215            serde_json::to_writer(&mut dst, &value).unwrap();
7216            dst
7217        };
7218        let request_size = request_value_reader
7219            .seek(std::io::SeekFrom::End(0))
7220            .unwrap();
7221        request_value_reader
7222            .seek(std::io::SeekFrom::Start(0))
7223            .unwrap();
7224
7225        loop {
7226            let token = match self
7227                .hub
7228                .auth
7229                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7230                .await
7231            {
7232                Ok(token) => token,
7233                Err(e) => match dlg.token(e) {
7234                    Ok(token) => token,
7235                    Err(e) => {
7236                        dlg.finished(false);
7237                        return Err(common::Error::MissingToken(e));
7238                    }
7239                },
7240            };
7241            request_value_reader
7242                .seek(std::io::SeekFrom::Start(0))
7243                .unwrap();
7244            let mut req_result = {
7245                let client = &self.hub.client;
7246                dlg.pre_request();
7247                let mut req_builder = hyper::Request::builder()
7248                    .method(hyper::Method::POST)
7249                    .uri(url.as_str())
7250                    .header(USER_AGENT, self.hub._user_agent.clone());
7251
7252                if let Some(token) = token.as_ref() {
7253                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7254                }
7255
7256                let request = req_builder
7257                    .header(CONTENT_TYPE, json_mime_type.to_string())
7258                    .header(CONTENT_LENGTH, request_size as u64)
7259                    .body(common::to_body(
7260                        request_value_reader.get_ref().clone().into(),
7261                    ));
7262
7263                client.request(request.unwrap()).await
7264            };
7265
7266            match req_result {
7267                Err(err) => {
7268                    if let common::Retry::After(d) = dlg.http_error(&err) {
7269                        sleep(d).await;
7270                        continue;
7271                    }
7272                    dlg.finished(false);
7273                    return Err(common::Error::HttpError(err));
7274                }
7275                Ok(res) => {
7276                    let (mut parts, body) = res.into_parts();
7277                    let mut body = common::Body::new(body);
7278                    if !parts.status.is_success() {
7279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7280                        let error = serde_json::from_str(&common::to_string(&bytes));
7281                        let response = common::to_response(parts, bytes.into());
7282
7283                        if let common::Retry::After(d) =
7284                            dlg.http_failure(&response, error.as_ref().ok())
7285                        {
7286                            sleep(d).await;
7287                            continue;
7288                        }
7289
7290                        dlg.finished(false);
7291
7292                        return Err(match error {
7293                            Ok(value) => common::Error::BadRequest(value),
7294                            _ => common::Error::Failure(response),
7295                        });
7296                    }
7297                    let response = {
7298                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7299                        let encoded = common::to_string(&bytes);
7300                        match serde_json::from_str(&encoded) {
7301                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7302                            Err(error) => {
7303                                dlg.response_json_decode_error(&encoded, &error);
7304                                return Err(common::Error::JsonDecodeError(
7305                                    encoded.to_string(),
7306                                    error,
7307                                ));
7308                            }
7309                        }
7310                    };
7311
7312                    dlg.finished(true);
7313                    return Ok(response);
7314                }
7315            }
7316        }
7317    }
7318
7319    ///
7320    /// Sets the *request* property to the given value.
7321    ///
7322    /// Even though the property as already been set when instantiating this call,
7323    /// we provide this method for API completeness.
7324    pub fn request(
7325        mut self,
7326        new_value: TestIamPermissionsRequest,
7327    ) -> ProjectLocationNoteTestIamPermissionCall<'a, C> {
7328        self._request = new_value;
7329        self
7330    }
7331    /// 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.
7332    ///
7333    /// Sets the *resource* path property to the given value.
7334    ///
7335    /// Even though the property as already been set when instantiating this call,
7336    /// we provide this method for API completeness.
7337    pub fn resource(mut self, new_value: &str) -> ProjectLocationNoteTestIamPermissionCall<'a, C> {
7338        self._resource = new_value.to_string();
7339        self
7340    }
7341    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7342    /// while executing the actual API request.
7343    ///
7344    /// ````text
7345    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7346    /// ````
7347    ///
7348    /// Sets the *delegate* property to the given value.
7349    pub fn delegate(
7350        mut self,
7351        new_value: &'a mut dyn common::Delegate,
7352    ) -> ProjectLocationNoteTestIamPermissionCall<'a, C> {
7353        self._delegate = Some(new_value);
7354        self
7355    }
7356
7357    /// Set any additional parameter of the query string used in the request.
7358    /// It should be used to set parameters which are not yet available through their own
7359    /// setters.
7360    ///
7361    /// Please note that this method must not be used to set any of the known parameters
7362    /// which have their own setter method. If done anyway, the request will fail.
7363    ///
7364    /// # Additional Parameters
7365    ///
7366    /// * *$.xgafv* (query-string) - V1 error format.
7367    /// * *access_token* (query-string) - OAuth access token.
7368    /// * *alt* (query-string) - Data format for response.
7369    /// * *callback* (query-string) - JSONP
7370    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7371    /// * *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.
7372    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7373    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7374    /// * *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.
7375    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7376    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7377    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationNoteTestIamPermissionCall<'a, C>
7378    where
7379        T: AsRef<str>,
7380    {
7381        self._additional_params
7382            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7383        self
7384    }
7385
7386    /// Identifies the authorization scope for the method you are building.
7387    ///
7388    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7389    /// [`Scope::CloudPlatform`].
7390    ///
7391    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7392    /// tokens for more than one scope.
7393    ///
7394    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7395    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7396    /// sufficient, a read-write scope will do as well.
7397    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationNoteTestIamPermissionCall<'a, C>
7398    where
7399        St: AsRef<str>,
7400    {
7401        self._scopes.insert(String::from(scope.as_ref()));
7402        self
7403    }
7404    /// Identifies the authorization scope(s) for the method you are building.
7405    ///
7406    /// See [`Self::add_scope()`] for details.
7407    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationNoteTestIamPermissionCall<'a, C>
7408    where
7409        I: IntoIterator<Item = St>,
7410        St: AsRef<str>,
7411    {
7412        self._scopes
7413            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7414        self
7415    }
7416
7417    /// Removes all scopes, and no default scope will be used either.
7418    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7419    /// for details).
7420    pub fn clear_scopes(mut self) -> ProjectLocationNoteTestIamPermissionCall<'a, C> {
7421        self._scopes.clear();
7422        self
7423    }
7424}
7425
7426/// Creates new occurrences in batch.
7427///
7428/// A builder for the *locations.occurrences.batchCreate* method supported by a *project* resource.
7429/// It is not used directly, but through a [`ProjectMethods`] instance.
7430///
7431/// # Example
7432///
7433/// Instantiate a resource method builder
7434///
7435/// ```test_harness,no_run
7436/// # extern crate hyper;
7437/// # extern crate hyper_rustls;
7438/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7439/// use containeranalysis1_beta1::api::BatchCreateOccurrencesRequest;
7440/// # async fn dox() {
7441/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7442///
7443/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7444/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7445/// #     .with_native_roots()
7446/// #     .unwrap()
7447/// #     .https_only()
7448/// #     .enable_http2()
7449/// #     .build();
7450///
7451/// # let executor = hyper_util::rt::TokioExecutor::new();
7452/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7453/// #     secret,
7454/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7455/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7456/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7457/// #     ),
7458/// # ).build().await.unwrap();
7459///
7460/// # let client = hyper_util::client::legacy::Client::builder(
7461/// #     hyper_util::rt::TokioExecutor::new()
7462/// # )
7463/// # .build(
7464/// #     hyper_rustls::HttpsConnectorBuilder::new()
7465/// #         .with_native_roots()
7466/// #         .unwrap()
7467/// #         .https_or_http()
7468/// #         .enable_http2()
7469/// #         .build()
7470/// # );
7471/// # let mut hub = ContainerAnalysis::new(client, auth);
7472/// // As the method needs a request, you would usually fill it with the desired information
7473/// // into the respective structure. Some of the parts shown here might not be applicable !
7474/// // Values shown here are possibly random and not representative !
7475/// let mut req = BatchCreateOccurrencesRequest::default();
7476///
7477/// // You can configure optional parameters by calling the respective setters at will, and
7478/// // execute the final call using `doit()`.
7479/// // Values shown here are possibly random and not representative !
7480/// let result = hub.projects().locations_occurrences_batch_create(req, "parent")
7481///              .doit().await;
7482/// # }
7483/// ```
7484pub struct ProjectLocationOccurrenceBatchCreateCall<'a, C>
7485where
7486    C: 'a,
7487{
7488    hub: &'a ContainerAnalysis<C>,
7489    _request: BatchCreateOccurrencesRequest,
7490    _parent: String,
7491    _delegate: Option<&'a mut dyn common::Delegate>,
7492    _additional_params: HashMap<String, String>,
7493    _scopes: BTreeSet<String>,
7494}
7495
7496impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceBatchCreateCall<'a, C> {}
7497
7498impl<'a, C> ProjectLocationOccurrenceBatchCreateCall<'a, C>
7499where
7500    C: common::Connector,
7501{
7502    /// Perform the operation you have build so far.
7503    pub async fn doit(
7504        mut self,
7505    ) -> common::Result<(common::Response, BatchCreateOccurrencesResponse)> {
7506        use std::borrow::Cow;
7507        use std::io::{Read, Seek};
7508
7509        use common::{url::Params, ToParts};
7510        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7511
7512        let mut dd = common::DefaultDelegate;
7513        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7514        dlg.begin(common::MethodInfo {
7515            id: "containeranalysis.projects.locations.occurrences.batchCreate",
7516            http_method: hyper::Method::POST,
7517        });
7518
7519        for &field in ["alt", "parent"].iter() {
7520            if self._additional_params.contains_key(field) {
7521                dlg.finished(false);
7522                return Err(common::Error::FieldClash(field));
7523            }
7524        }
7525
7526        let mut params = Params::with_capacity(4 + self._additional_params.len());
7527        params.push("parent", self._parent);
7528
7529        params.extend(self._additional_params.iter());
7530
7531        params.push("alt", "json");
7532        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:batchCreate";
7533        if self._scopes.is_empty() {
7534            self._scopes
7535                .insert(Scope::CloudPlatform.as_ref().to_string());
7536        }
7537
7538        #[allow(clippy::single_element_loop)]
7539        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7540            url = params.uri_replacement(url, param_name, find_this, true);
7541        }
7542        {
7543            let to_remove = ["parent"];
7544            params.remove_params(&to_remove);
7545        }
7546
7547        let url = params.parse_with_url(&url);
7548
7549        let mut json_mime_type = mime::APPLICATION_JSON;
7550        let mut request_value_reader = {
7551            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7552            common::remove_json_null_values(&mut value);
7553            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7554            serde_json::to_writer(&mut dst, &value).unwrap();
7555            dst
7556        };
7557        let request_size = request_value_reader
7558            .seek(std::io::SeekFrom::End(0))
7559            .unwrap();
7560        request_value_reader
7561            .seek(std::io::SeekFrom::Start(0))
7562            .unwrap();
7563
7564        loop {
7565            let token = match self
7566                .hub
7567                .auth
7568                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7569                .await
7570            {
7571                Ok(token) => token,
7572                Err(e) => match dlg.token(e) {
7573                    Ok(token) => token,
7574                    Err(e) => {
7575                        dlg.finished(false);
7576                        return Err(common::Error::MissingToken(e));
7577                    }
7578                },
7579            };
7580            request_value_reader
7581                .seek(std::io::SeekFrom::Start(0))
7582                .unwrap();
7583            let mut req_result = {
7584                let client = &self.hub.client;
7585                dlg.pre_request();
7586                let mut req_builder = hyper::Request::builder()
7587                    .method(hyper::Method::POST)
7588                    .uri(url.as_str())
7589                    .header(USER_AGENT, self.hub._user_agent.clone());
7590
7591                if let Some(token) = token.as_ref() {
7592                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7593                }
7594
7595                let request = req_builder
7596                    .header(CONTENT_TYPE, json_mime_type.to_string())
7597                    .header(CONTENT_LENGTH, request_size as u64)
7598                    .body(common::to_body(
7599                        request_value_reader.get_ref().clone().into(),
7600                    ));
7601
7602                client.request(request.unwrap()).await
7603            };
7604
7605            match req_result {
7606                Err(err) => {
7607                    if let common::Retry::After(d) = dlg.http_error(&err) {
7608                        sleep(d).await;
7609                        continue;
7610                    }
7611                    dlg.finished(false);
7612                    return Err(common::Error::HttpError(err));
7613                }
7614                Ok(res) => {
7615                    let (mut parts, body) = res.into_parts();
7616                    let mut body = common::Body::new(body);
7617                    if !parts.status.is_success() {
7618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7619                        let error = serde_json::from_str(&common::to_string(&bytes));
7620                        let response = common::to_response(parts, bytes.into());
7621
7622                        if let common::Retry::After(d) =
7623                            dlg.http_failure(&response, error.as_ref().ok())
7624                        {
7625                            sleep(d).await;
7626                            continue;
7627                        }
7628
7629                        dlg.finished(false);
7630
7631                        return Err(match error {
7632                            Ok(value) => common::Error::BadRequest(value),
7633                            _ => common::Error::Failure(response),
7634                        });
7635                    }
7636                    let response = {
7637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7638                        let encoded = common::to_string(&bytes);
7639                        match serde_json::from_str(&encoded) {
7640                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7641                            Err(error) => {
7642                                dlg.response_json_decode_error(&encoded, &error);
7643                                return Err(common::Error::JsonDecodeError(
7644                                    encoded.to_string(),
7645                                    error,
7646                                ));
7647                            }
7648                        }
7649                    };
7650
7651                    dlg.finished(true);
7652                    return Ok(response);
7653                }
7654            }
7655        }
7656    }
7657
7658    ///
7659    /// Sets the *request* property to the given value.
7660    ///
7661    /// Even though the property as already been set when instantiating this call,
7662    /// we provide this method for API completeness.
7663    pub fn request(
7664        mut self,
7665        new_value: BatchCreateOccurrencesRequest,
7666    ) -> ProjectLocationOccurrenceBatchCreateCall<'a, C> {
7667        self._request = new_value;
7668        self
7669    }
7670    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
7671    ///
7672    /// Sets the *parent* path property to the given value.
7673    ///
7674    /// Even though the property as already been set when instantiating this call,
7675    /// we provide this method for API completeness.
7676    pub fn parent(mut self, new_value: &str) -> ProjectLocationOccurrenceBatchCreateCall<'a, C> {
7677        self._parent = new_value.to_string();
7678        self
7679    }
7680    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7681    /// while executing the actual API request.
7682    ///
7683    /// ````text
7684    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7685    /// ````
7686    ///
7687    /// Sets the *delegate* property to the given value.
7688    pub fn delegate(
7689        mut self,
7690        new_value: &'a mut dyn common::Delegate,
7691    ) -> ProjectLocationOccurrenceBatchCreateCall<'a, C> {
7692        self._delegate = Some(new_value);
7693        self
7694    }
7695
7696    /// Set any additional parameter of the query string used in the request.
7697    /// It should be used to set parameters which are not yet available through their own
7698    /// setters.
7699    ///
7700    /// Please note that this method must not be used to set any of the known parameters
7701    /// which have their own setter method. If done anyway, the request will fail.
7702    ///
7703    /// # Additional Parameters
7704    ///
7705    /// * *$.xgafv* (query-string) - V1 error format.
7706    /// * *access_token* (query-string) - OAuth access token.
7707    /// * *alt* (query-string) - Data format for response.
7708    /// * *callback* (query-string) - JSONP
7709    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7710    /// * *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.
7711    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7712    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7713    /// * *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.
7714    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7715    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7716    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceBatchCreateCall<'a, C>
7717    where
7718        T: AsRef<str>,
7719    {
7720        self._additional_params
7721            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7722        self
7723    }
7724
7725    /// Identifies the authorization scope for the method you are building.
7726    ///
7727    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7728    /// [`Scope::CloudPlatform`].
7729    ///
7730    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7731    /// tokens for more than one scope.
7732    ///
7733    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7734    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7735    /// sufficient, a read-write scope will do as well.
7736    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceBatchCreateCall<'a, C>
7737    where
7738        St: AsRef<str>,
7739    {
7740        self._scopes.insert(String::from(scope.as_ref()));
7741        self
7742    }
7743    /// Identifies the authorization scope(s) for the method you are building.
7744    ///
7745    /// See [`Self::add_scope()`] for details.
7746    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceBatchCreateCall<'a, C>
7747    where
7748        I: IntoIterator<Item = St>,
7749        St: AsRef<str>,
7750    {
7751        self._scopes
7752            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7753        self
7754    }
7755
7756    /// Removes all scopes, and no default scope will be used either.
7757    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7758    /// for details).
7759    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceBatchCreateCall<'a, C> {
7760        self._scopes.clear();
7761        self
7762    }
7763}
7764
7765/// Creates a new occurrence.
7766///
7767/// A builder for the *locations.occurrences.create* method supported by a *project* resource.
7768/// It is not used directly, but through a [`ProjectMethods`] instance.
7769///
7770/// # Example
7771///
7772/// Instantiate a resource method builder
7773///
7774/// ```test_harness,no_run
7775/// # extern crate hyper;
7776/// # extern crate hyper_rustls;
7777/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
7778/// use containeranalysis1_beta1::api::Occurrence;
7779/// # async fn dox() {
7780/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7781///
7782/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7783/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7784/// #     .with_native_roots()
7785/// #     .unwrap()
7786/// #     .https_only()
7787/// #     .enable_http2()
7788/// #     .build();
7789///
7790/// # let executor = hyper_util::rt::TokioExecutor::new();
7791/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7792/// #     secret,
7793/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7794/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7795/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7796/// #     ),
7797/// # ).build().await.unwrap();
7798///
7799/// # let client = hyper_util::client::legacy::Client::builder(
7800/// #     hyper_util::rt::TokioExecutor::new()
7801/// # )
7802/// # .build(
7803/// #     hyper_rustls::HttpsConnectorBuilder::new()
7804/// #         .with_native_roots()
7805/// #         .unwrap()
7806/// #         .https_or_http()
7807/// #         .enable_http2()
7808/// #         .build()
7809/// # );
7810/// # let mut hub = ContainerAnalysis::new(client, auth);
7811/// // As the method needs a request, you would usually fill it with the desired information
7812/// // into the respective structure. Some of the parts shown here might not be applicable !
7813/// // Values shown here are possibly random and not representative !
7814/// let mut req = Occurrence::default();
7815///
7816/// // You can configure optional parameters by calling the respective setters at will, and
7817/// // execute the final call using `doit()`.
7818/// // Values shown here are possibly random and not representative !
7819/// let result = hub.projects().locations_occurrences_create(req, "parent")
7820///              .doit().await;
7821/// # }
7822/// ```
7823pub struct ProjectLocationOccurrenceCreateCall<'a, C>
7824where
7825    C: 'a,
7826{
7827    hub: &'a ContainerAnalysis<C>,
7828    _request: Occurrence,
7829    _parent: String,
7830    _delegate: Option<&'a mut dyn common::Delegate>,
7831    _additional_params: HashMap<String, String>,
7832    _scopes: BTreeSet<String>,
7833}
7834
7835impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceCreateCall<'a, C> {}
7836
7837impl<'a, C> ProjectLocationOccurrenceCreateCall<'a, C>
7838where
7839    C: common::Connector,
7840{
7841    /// Perform the operation you have build so far.
7842    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
7843        use std::borrow::Cow;
7844        use std::io::{Read, Seek};
7845
7846        use common::{url::Params, ToParts};
7847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7848
7849        let mut dd = common::DefaultDelegate;
7850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7851        dlg.begin(common::MethodInfo {
7852            id: "containeranalysis.projects.locations.occurrences.create",
7853            http_method: hyper::Method::POST,
7854        });
7855
7856        for &field in ["alt", "parent"].iter() {
7857            if self._additional_params.contains_key(field) {
7858                dlg.finished(false);
7859                return Err(common::Error::FieldClash(field));
7860            }
7861        }
7862
7863        let mut params = Params::with_capacity(4 + self._additional_params.len());
7864        params.push("parent", self._parent);
7865
7866        params.extend(self._additional_params.iter());
7867
7868        params.push("alt", "json");
7869        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
7870        if self._scopes.is_empty() {
7871            self._scopes
7872                .insert(Scope::CloudPlatform.as_ref().to_string());
7873        }
7874
7875        #[allow(clippy::single_element_loop)]
7876        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7877            url = params.uri_replacement(url, param_name, find_this, true);
7878        }
7879        {
7880            let to_remove = ["parent"];
7881            params.remove_params(&to_remove);
7882        }
7883
7884        let url = params.parse_with_url(&url);
7885
7886        let mut json_mime_type = mime::APPLICATION_JSON;
7887        let mut request_value_reader = {
7888            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7889            common::remove_json_null_values(&mut value);
7890            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7891            serde_json::to_writer(&mut dst, &value).unwrap();
7892            dst
7893        };
7894        let request_size = request_value_reader
7895            .seek(std::io::SeekFrom::End(0))
7896            .unwrap();
7897        request_value_reader
7898            .seek(std::io::SeekFrom::Start(0))
7899            .unwrap();
7900
7901        loop {
7902            let token = match self
7903                .hub
7904                .auth
7905                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7906                .await
7907            {
7908                Ok(token) => token,
7909                Err(e) => match dlg.token(e) {
7910                    Ok(token) => token,
7911                    Err(e) => {
7912                        dlg.finished(false);
7913                        return Err(common::Error::MissingToken(e));
7914                    }
7915                },
7916            };
7917            request_value_reader
7918                .seek(std::io::SeekFrom::Start(0))
7919                .unwrap();
7920            let mut req_result = {
7921                let client = &self.hub.client;
7922                dlg.pre_request();
7923                let mut req_builder = hyper::Request::builder()
7924                    .method(hyper::Method::POST)
7925                    .uri(url.as_str())
7926                    .header(USER_AGENT, self.hub._user_agent.clone());
7927
7928                if let Some(token) = token.as_ref() {
7929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7930                }
7931
7932                let request = req_builder
7933                    .header(CONTENT_TYPE, json_mime_type.to_string())
7934                    .header(CONTENT_LENGTH, request_size as u64)
7935                    .body(common::to_body(
7936                        request_value_reader.get_ref().clone().into(),
7937                    ));
7938
7939                client.request(request.unwrap()).await
7940            };
7941
7942            match req_result {
7943                Err(err) => {
7944                    if let common::Retry::After(d) = dlg.http_error(&err) {
7945                        sleep(d).await;
7946                        continue;
7947                    }
7948                    dlg.finished(false);
7949                    return Err(common::Error::HttpError(err));
7950                }
7951                Ok(res) => {
7952                    let (mut parts, body) = res.into_parts();
7953                    let mut body = common::Body::new(body);
7954                    if !parts.status.is_success() {
7955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7956                        let error = serde_json::from_str(&common::to_string(&bytes));
7957                        let response = common::to_response(parts, bytes.into());
7958
7959                        if let common::Retry::After(d) =
7960                            dlg.http_failure(&response, error.as_ref().ok())
7961                        {
7962                            sleep(d).await;
7963                            continue;
7964                        }
7965
7966                        dlg.finished(false);
7967
7968                        return Err(match error {
7969                            Ok(value) => common::Error::BadRequest(value),
7970                            _ => common::Error::Failure(response),
7971                        });
7972                    }
7973                    let response = {
7974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7975                        let encoded = common::to_string(&bytes);
7976                        match serde_json::from_str(&encoded) {
7977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7978                            Err(error) => {
7979                                dlg.response_json_decode_error(&encoded, &error);
7980                                return Err(common::Error::JsonDecodeError(
7981                                    encoded.to_string(),
7982                                    error,
7983                                ));
7984                            }
7985                        }
7986                    };
7987
7988                    dlg.finished(true);
7989                    return Ok(response);
7990                }
7991            }
7992        }
7993    }
7994
7995    ///
7996    /// Sets the *request* property to the given value.
7997    ///
7998    /// Even though the property as already been set when instantiating this call,
7999    /// we provide this method for API completeness.
8000    pub fn request(mut self, new_value: Occurrence) -> ProjectLocationOccurrenceCreateCall<'a, C> {
8001        self._request = new_value;
8002        self
8003    }
8004    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created.
8005    ///
8006    /// Sets the *parent* path property to the given value.
8007    ///
8008    /// Even though the property as already been set when instantiating this call,
8009    /// we provide this method for API completeness.
8010    pub fn parent(mut self, new_value: &str) -> ProjectLocationOccurrenceCreateCall<'a, C> {
8011        self._parent = new_value.to_string();
8012        self
8013    }
8014    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8015    /// while executing the actual API request.
8016    ///
8017    /// ````text
8018    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8019    /// ````
8020    ///
8021    /// Sets the *delegate* property to the given value.
8022    pub fn delegate(
8023        mut self,
8024        new_value: &'a mut dyn common::Delegate,
8025    ) -> ProjectLocationOccurrenceCreateCall<'a, C> {
8026        self._delegate = Some(new_value);
8027        self
8028    }
8029
8030    /// Set any additional parameter of the query string used in the request.
8031    /// It should be used to set parameters which are not yet available through their own
8032    /// setters.
8033    ///
8034    /// Please note that this method must not be used to set any of the known parameters
8035    /// which have their own setter method. If done anyway, the request will fail.
8036    ///
8037    /// # Additional Parameters
8038    ///
8039    /// * *$.xgafv* (query-string) - V1 error format.
8040    /// * *access_token* (query-string) - OAuth access token.
8041    /// * *alt* (query-string) - Data format for response.
8042    /// * *callback* (query-string) - JSONP
8043    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8044    /// * *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.
8045    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8046    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8047    /// * *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.
8048    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8049    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8050    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceCreateCall<'a, C>
8051    where
8052        T: AsRef<str>,
8053    {
8054        self._additional_params
8055            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8056        self
8057    }
8058
8059    /// Identifies the authorization scope for the method you are building.
8060    ///
8061    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8062    /// [`Scope::CloudPlatform`].
8063    ///
8064    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8065    /// tokens for more than one scope.
8066    ///
8067    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8068    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8069    /// sufficient, a read-write scope will do as well.
8070    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceCreateCall<'a, C>
8071    where
8072        St: AsRef<str>,
8073    {
8074        self._scopes.insert(String::from(scope.as_ref()));
8075        self
8076    }
8077    /// Identifies the authorization scope(s) for the method you are building.
8078    ///
8079    /// See [`Self::add_scope()`] for details.
8080    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceCreateCall<'a, C>
8081    where
8082        I: IntoIterator<Item = St>,
8083        St: AsRef<str>,
8084    {
8085        self._scopes
8086            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8087        self
8088    }
8089
8090    /// Removes all scopes, and no default scope will be used either.
8091    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8092    /// for details).
8093    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceCreateCall<'a, C> {
8094        self._scopes.clear();
8095        self
8096    }
8097}
8098
8099/// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
8100///
8101/// A builder for the *locations.occurrences.delete* method supported by a *project* resource.
8102/// It is not used directly, but through a [`ProjectMethods`] instance.
8103///
8104/// # Example
8105///
8106/// Instantiate a resource method builder
8107///
8108/// ```test_harness,no_run
8109/// # extern crate hyper;
8110/// # extern crate hyper_rustls;
8111/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8112/// # async fn dox() {
8113/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8114///
8115/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8116/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8117/// #     .with_native_roots()
8118/// #     .unwrap()
8119/// #     .https_only()
8120/// #     .enable_http2()
8121/// #     .build();
8122///
8123/// # let executor = hyper_util::rt::TokioExecutor::new();
8124/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8125/// #     secret,
8126/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8127/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8128/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8129/// #     ),
8130/// # ).build().await.unwrap();
8131///
8132/// # let client = hyper_util::client::legacy::Client::builder(
8133/// #     hyper_util::rt::TokioExecutor::new()
8134/// # )
8135/// # .build(
8136/// #     hyper_rustls::HttpsConnectorBuilder::new()
8137/// #         .with_native_roots()
8138/// #         .unwrap()
8139/// #         .https_or_http()
8140/// #         .enable_http2()
8141/// #         .build()
8142/// # );
8143/// # let mut hub = ContainerAnalysis::new(client, auth);
8144/// // You can configure optional parameters by calling the respective setters at will, and
8145/// // execute the final call using `doit()`.
8146/// // Values shown here are possibly random and not representative !
8147/// let result = hub.projects().locations_occurrences_delete("name")
8148///              .doit().await;
8149/// # }
8150/// ```
8151pub struct ProjectLocationOccurrenceDeleteCall<'a, C>
8152where
8153    C: 'a,
8154{
8155    hub: &'a ContainerAnalysis<C>,
8156    _name: String,
8157    _delegate: Option<&'a mut dyn common::Delegate>,
8158    _additional_params: HashMap<String, String>,
8159    _scopes: BTreeSet<String>,
8160}
8161
8162impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceDeleteCall<'a, C> {}
8163
8164impl<'a, C> ProjectLocationOccurrenceDeleteCall<'a, C>
8165where
8166    C: common::Connector,
8167{
8168    /// Perform the operation you have build so far.
8169    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8170        use std::borrow::Cow;
8171        use std::io::{Read, Seek};
8172
8173        use common::{url::Params, ToParts};
8174        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8175
8176        let mut dd = common::DefaultDelegate;
8177        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8178        dlg.begin(common::MethodInfo {
8179            id: "containeranalysis.projects.locations.occurrences.delete",
8180            http_method: hyper::Method::DELETE,
8181        });
8182
8183        for &field in ["alt", "name"].iter() {
8184            if self._additional_params.contains_key(field) {
8185                dlg.finished(false);
8186                return Err(common::Error::FieldClash(field));
8187            }
8188        }
8189
8190        let mut params = Params::with_capacity(3 + self._additional_params.len());
8191        params.push("name", self._name);
8192
8193        params.extend(self._additional_params.iter());
8194
8195        params.push("alt", "json");
8196        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8197        if self._scopes.is_empty() {
8198            self._scopes
8199                .insert(Scope::CloudPlatform.as_ref().to_string());
8200        }
8201
8202        #[allow(clippy::single_element_loop)]
8203        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8204            url = params.uri_replacement(url, param_name, find_this, true);
8205        }
8206        {
8207            let to_remove = ["name"];
8208            params.remove_params(&to_remove);
8209        }
8210
8211        let url = params.parse_with_url(&url);
8212
8213        loop {
8214            let token = match self
8215                .hub
8216                .auth
8217                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8218                .await
8219            {
8220                Ok(token) => token,
8221                Err(e) => match dlg.token(e) {
8222                    Ok(token) => token,
8223                    Err(e) => {
8224                        dlg.finished(false);
8225                        return Err(common::Error::MissingToken(e));
8226                    }
8227                },
8228            };
8229            let mut req_result = {
8230                let client = &self.hub.client;
8231                dlg.pre_request();
8232                let mut req_builder = hyper::Request::builder()
8233                    .method(hyper::Method::DELETE)
8234                    .uri(url.as_str())
8235                    .header(USER_AGENT, self.hub._user_agent.clone());
8236
8237                if let Some(token) = token.as_ref() {
8238                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8239                }
8240
8241                let request = req_builder
8242                    .header(CONTENT_LENGTH, 0_u64)
8243                    .body(common::to_body::<String>(None));
8244
8245                client.request(request.unwrap()).await
8246            };
8247
8248            match req_result {
8249                Err(err) => {
8250                    if let common::Retry::After(d) = dlg.http_error(&err) {
8251                        sleep(d).await;
8252                        continue;
8253                    }
8254                    dlg.finished(false);
8255                    return Err(common::Error::HttpError(err));
8256                }
8257                Ok(res) => {
8258                    let (mut parts, body) = res.into_parts();
8259                    let mut body = common::Body::new(body);
8260                    if !parts.status.is_success() {
8261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8262                        let error = serde_json::from_str(&common::to_string(&bytes));
8263                        let response = common::to_response(parts, bytes.into());
8264
8265                        if let common::Retry::After(d) =
8266                            dlg.http_failure(&response, error.as_ref().ok())
8267                        {
8268                            sleep(d).await;
8269                            continue;
8270                        }
8271
8272                        dlg.finished(false);
8273
8274                        return Err(match error {
8275                            Ok(value) => common::Error::BadRequest(value),
8276                            _ => common::Error::Failure(response),
8277                        });
8278                    }
8279                    let response = {
8280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8281                        let encoded = common::to_string(&bytes);
8282                        match serde_json::from_str(&encoded) {
8283                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8284                            Err(error) => {
8285                                dlg.response_json_decode_error(&encoded, &error);
8286                                return Err(common::Error::JsonDecodeError(
8287                                    encoded.to_string(),
8288                                    error,
8289                                ));
8290                            }
8291                        }
8292                    };
8293
8294                    dlg.finished(true);
8295                    return Ok(response);
8296                }
8297            }
8298        }
8299    }
8300
8301    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
8302    ///
8303    /// Sets the *name* path property to the given value.
8304    ///
8305    /// Even though the property as already been set when instantiating this call,
8306    /// we provide this method for API completeness.
8307    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrenceDeleteCall<'a, C> {
8308        self._name = new_value.to_string();
8309        self
8310    }
8311    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8312    /// while executing the actual API request.
8313    ///
8314    /// ````text
8315    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8316    /// ````
8317    ///
8318    /// Sets the *delegate* property to the given value.
8319    pub fn delegate(
8320        mut self,
8321        new_value: &'a mut dyn common::Delegate,
8322    ) -> ProjectLocationOccurrenceDeleteCall<'a, C> {
8323        self._delegate = Some(new_value);
8324        self
8325    }
8326
8327    /// Set any additional parameter of the query string used in the request.
8328    /// It should be used to set parameters which are not yet available through their own
8329    /// setters.
8330    ///
8331    /// Please note that this method must not be used to set any of the known parameters
8332    /// which have their own setter method. If done anyway, the request will fail.
8333    ///
8334    /// # Additional Parameters
8335    ///
8336    /// * *$.xgafv* (query-string) - V1 error format.
8337    /// * *access_token* (query-string) - OAuth access token.
8338    /// * *alt* (query-string) - Data format for response.
8339    /// * *callback* (query-string) - JSONP
8340    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8341    /// * *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.
8342    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8343    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8344    /// * *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.
8345    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8346    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8347    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceDeleteCall<'a, C>
8348    where
8349        T: AsRef<str>,
8350    {
8351        self._additional_params
8352            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8353        self
8354    }
8355
8356    /// Identifies the authorization scope for the method you are building.
8357    ///
8358    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8359    /// [`Scope::CloudPlatform`].
8360    ///
8361    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8362    /// tokens for more than one scope.
8363    ///
8364    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8365    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8366    /// sufficient, a read-write scope will do as well.
8367    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceDeleteCall<'a, C>
8368    where
8369        St: AsRef<str>,
8370    {
8371        self._scopes.insert(String::from(scope.as_ref()));
8372        self
8373    }
8374    /// Identifies the authorization scope(s) for the method you are building.
8375    ///
8376    /// See [`Self::add_scope()`] for details.
8377    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceDeleteCall<'a, C>
8378    where
8379        I: IntoIterator<Item = St>,
8380        St: AsRef<str>,
8381    {
8382        self._scopes
8383            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8384        self
8385    }
8386
8387    /// Removes all scopes, and no default scope will be used either.
8388    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8389    /// for details).
8390    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceDeleteCall<'a, C> {
8391        self._scopes.clear();
8392        self
8393    }
8394}
8395
8396/// Gets the specified occurrence.
8397///
8398/// A builder for the *locations.occurrences.get* method supported by a *project* resource.
8399/// It is not used directly, but through a [`ProjectMethods`] instance.
8400///
8401/// # Example
8402///
8403/// Instantiate a resource method builder
8404///
8405/// ```test_harness,no_run
8406/// # extern crate hyper;
8407/// # extern crate hyper_rustls;
8408/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8409/// # async fn dox() {
8410/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8411///
8412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8413/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8414/// #     .with_native_roots()
8415/// #     .unwrap()
8416/// #     .https_only()
8417/// #     .enable_http2()
8418/// #     .build();
8419///
8420/// # let executor = hyper_util::rt::TokioExecutor::new();
8421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8422/// #     secret,
8423/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8424/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8425/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8426/// #     ),
8427/// # ).build().await.unwrap();
8428///
8429/// # let client = hyper_util::client::legacy::Client::builder(
8430/// #     hyper_util::rt::TokioExecutor::new()
8431/// # )
8432/// # .build(
8433/// #     hyper_rustls::HttpsConnectorBuilder::new()
8434/// #         .with_native_roots()
8435/// #         .unwrap()
8436/// #         .https_or_http()
8437/// #         .enable_http2()
8438/// #         .build()
8439/// # );
8440/// # let mut hub = ContainerAnalysis::new(client, auth);
8441/// // You can configure optional parameters by calling the respective setters at will, and
8442/// // execute the final call using `doit()`.
8443/// // Values shown here are possibly random and not representative !
8444/// let result = hub.projects().locations_occurrences_get("name")
8445///              .doit().await;
8446/// # }
8447/// ```
8448pub struct ProjectLocationOccurrenceGetCall<'a, C>
8449where
8450    C: 'a,
8451{
8452    hub: &'a ContainerAnalysis<C>,
8453    _name: String,
8454    _delegate: Option<&'a mut dyn common::Delegate>,
8455    _additional_params: HashMap<String, String>,
8456    _scopes: BTreeSet<String>,
8457}
8458
8459impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetCall<'a, C> {}
8460
8461impl<'a, C> ProjectLocationOccurrenceGetCall<'a, C>
8462where
8463    C: common::Connector,
8464{
8465    /// Perform the operation you have build so far.
8466    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
8467        use std::borrow::Cow;
8468        use std::io::{Read, Seek};
8469
8470        use common::{url::Params, ToParts};
8471        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8472
8473        let mut dd = common::DefaultDelegate;
8474        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8475        dlg.begin(common::MethodInfo {
8476            id: "containeranalysis.projects.locations.occurrences.get",
8477            http_method: hyper::Method::GET,
8478        });
8479
8480        for &field in ["alt", "name"].iter() {
8481            if self._additional_params.contains_key(field) {
8482                dlg.finished(false);
8483                return Err(common::Error::FieldClash(field));
8484            }
8485        }
8486
8487        let mut params = Params::with_capacity(3 + self._additional_params.len());
8488        params.push("name", self._name);
8489
8490        params.extend(self._additional_params.iter());
8491
8492        params.push("alt", "json");
8493        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8494        if self._scopes.is_empty() {
8495            self._scopes
8496                .insert(Scope::CloudPlatform.as_ref().to_string());
8497        }
8498
8499        #[allow(clippy::single_element_loop)]
8500        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8501            url = params.uri_replacement(url, param_name, find_this, true);
8502        }
8503        {
8504            let to_remove = ["name"];
8505            params.remove_params(&to_remove);
8506        }
8507
8508        let url = params.parse_with_url(&url);
8509
8510        loop {
8511            let token = match self
8512                .hub
8513                .auth
8514                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8515                .await
8516            {
8517                Ok(token) => token,
8518                Err(e) => match dlg.token(e) {
8519                    Ok(token) => token,
8520                    Err(e) => {
8521                        dlg.finished(false);
8522                        return Err(common::Error::MissingToken(e));
8523                    }
8524                },
8525            };
8526            let mut req_result = {
8527                let client = &self.hub.client;
8528                dlg.pre_request();
8529                let mut req_builder = hyper::Request::builder()
8530                    .method(hyper::Method::GET)
8531                    .uri(url.as_str())
8532                    .header(USER_AGENT, self.hub._user_agent.clone());
8533
8534                if let Some(token) = token.as_ref() {
8535                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8536                }
8537
8538                let request = req_builder
8539                    .header(CONTENT_LENGTH, 0_u64)
8540                    .body(common::to_body::<String>(None));
8541
8542                client.request(request.unwrap()).await
8543            };
8544
8545            match req_result {
8546                Err(err) => {
8547                    if let common::Retry::After(d) = dlg.http_error(&err) {
8548                        sleep(d).await;
8549                        continue;
8550                    }
8551                    dlg.finished(false);
8552                    return Err(common::Error::HttpError(err));
8553                }
8554                Ok(res) => {
8555                    let (mut parts, body) = res.into_parts();
8556                    let mut body = common::Body::new(body);
8557                    if !parts.status.is_success() {
8558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8559                        let error = serde_json::from_str(&common::to_string(&bytes));
8560                        let response = common::to_response(parts, bytes.into());
8561
8562                        if let common::Retry::After(d) =
8563                            dlg.http_failure(&response, error.as_ref().ok())
8564                        {
8565                            sleep(d).await;
8566                            continue;
8567                        }
8568
8569                        dlg.finished(false);
8570
8571                        return Err(match error {
8572                            Ok(value) => common::Error::BadRequest(value),
8573                            _ => common::Error::Failure(response),
8574                        });
8575                    }
8576                    let response = {
8577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8578                        let encoded = common::to_string(&bytes);
8579                        match serde_json::from_str(&encoded) {
8580                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8581                            Err(error) => {
8582                                dlg.response_json_decode_error(&encoded, &error);
8583                                return Err(common::Error::JsonDecodeError(
8584                                    encoded.to_string(),
8585                                    error,
8586                                ));
8587                            }
8588                        }
8589                    };
8590
8591                    dlg.finished(true);
8592                    return Ok(response);
8593                }
8594            }
8595        }
8596    }
8597
8598    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
8599    ///
8600    /// Sets the *name* path property to the given value.
8601    ///
8602    /// Even though the property as already been set when instantiating this call,
8603    /// we provide this method for API completeness.
8604    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrenceGetCall<'a, C> {
8605        self._name = new_value.to_string();
8606        self
8607    }
8608    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8609    /// while executing the actual API request.
8610    ///
8611    /// ````text
8612    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8613    /// ````
8614    ///
8615    /// Sets the *delegate* property to the given value.
8616    pub fn delegate(
8617        mut self,
8618        new_value: &'a mut dyn common::Delegate,
8619    ) -> ProjectLocationOccurrenceGetCall<'a, C> {
8620        self._delegate = Some(new_value);
8621        self
8622    }
8623
8624    /// Set any additional parameter of the query string used in the request.
8625    /// It should be used to set parameters which are not yet available through their own
8626    /// setters.
8627    ///
8628    /// Please note that this method must not be used to set any of the known parameters
8629    /// which have their own setter method. If done anyway, the request will fail.
8630    ///
8631    /// # Additional Parameters
8632    ///
8633    /// * *$.xgafv* (query-string) - V1 error format.
8634    /// * *access_token* (query-string) - OAuth access token.
8635    /// * *alt* (query-string) - Data format for response.
8636    /// * *callback* (query-string) - JSONP
8637    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8638    /// * *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.
8639    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8640    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8641    /// * *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.
8642    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8643    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8644    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceGetCall<'a, C>
8645    where
8646        T: AsRef<str>,
8647    {
8648        self._additional_params
8649            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8650        self
8651    }
8652
8653    /// Identifies the authorization scope for the method you are building.
8654    ///
8655    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8656    /// [`Scope::CloudPlatform`].
8657    ///
8658    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8659    /// tokens for more than one scope.
8660    ///
8661    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8662    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8663    /// sufficient, a read-write scope will do as well.
8664    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceGetCall<'a, C>
8665    where
8666        St: AsRef<str>,
8667    {
8668        self._scopes.insert(String::from(scope.as_ref()));
8669        self
8670    }
8671    /// Identifies the authorization scope(s) for the method you are building.
8672    ///
8673    /// See [`Self::add_scope()`] for details.
8674    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceGetCall<'a, C>
8675    where
8676        I: IntoIterator<Item = St>,
8677        St: AsRef<str>,
8678    {
8679        self._scopes
8680            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8681        self
8682    }
8683
8684    /// Removes all scopes, and no default scope will be used either.
8685    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8686    /// for details).
8687    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetCall<'a, C> {
8688        self._scopes.clear();
8689        self
8690    }
8691}
8692
8693/// 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.
8694///
8695/// A builder for the *locations.occurrences.getIamPolicy* method supported by a *project* resource.
8696/// It is not used directly, but through a [`ProjectMethods`] instance.
8697///
8698/// # Example
8699///
8700/// Instantiate a resource method builder
8701///
8702/// ```test_harness,no_run
8703/// # extern crate hyper;
8704/// # extern crate hyper_rustls;
8705/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
8706/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
8707/// # async fn dox() {
8708/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8709///
8710/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8711/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8712/// #     .with_native_roots()
8713/// #     .unwrap()
8714/// #     .https_only()
8715/// #     .enable_http2()
8716/// #     .build();
8717///
8718/// # let executor = hyper_util::rt::TokioExecutor::new();
8719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8720/// #     secret,
8721/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8722/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8723/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8724/// #     ),
8725/// # ).build().await.unwrap();
8726///
8727/// # let client = hyper_util::client::legacy::Client::builder(
8728/// #     hyper_util::rt::TokioExecutor::new()
8729/// # )
8730/// # .build(
8731/// #     hyper_rustls::HttpsConnectorBuilder::new()
8732/// #         .with_native_roots()
8733/// #         .unwrap()
8734/// #         .https_or_http()
8735/// #         .enable_http2()
8736/// #         .build()
8737/// # );
8738/// # let mut hub = ContainerAnalysis::new(client, auth);
8739/// // As the method needs a request, you would usually fill it with the desired information
8740/// // into the respective structure. Some of the parts shown here might not be applicable !
8741/// // Values shown here are possibly random and not representative !
8742/// let mut req = GetIamPolicyRequest::default();
8743///
8744/// // You can configure optional parameters by calling the respective setters at will, and
8745/// // execute the final call using `doit()`.
8746/// // Values shown here are possibly random and not representative !
8747/// let result = hub.projects().locations_occurrences_get_iam_policy(req, "resource")
8748///              .doit().await;
8749/// # }
8750/// ```
8751pub struct ProjectLocationOccurrenceGetIamPolicyCall<'a, C>
8752where
8753    C: 'a,
8754{
8755    hub: &'a ContainerAnalysis<C>,
8756    _request: GetIamPolicyRequest,
8757    _resource: String,
8758    _delegate: Option<&'a mut dyn common::Delegate>,
8759    _additional_params: HashMap<String, String>,
8760    _scopes: BTreeSet<String>,
8761}
8762
8763impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {}
8764
8765impl<'a, C> ProjectLocationOccurrenceGetIamPolicyCall<'a, C>
8766where
8767    C: common::Connector,
8768{
8769    /// Perform the operation you have build so far.
8770    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
8771        use std::borrow::Cow;
8772        use std::io::{Read, Seek};
8773
8774        use common::{url::Params, ToParts};
8775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8776
8777        let mut dd = common::DefaultDelegate;
8778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8779        dlg.begin(common::MethodInfo {
8780            id: "containeranalysis.projects.locations.occurrences.getIamPolicy",
8781            http_method: hyper::Method::POST,
8782        });
8783
8784        for &field in ["alt", "resource"].iter() {
8785            if self._additional_params.contains_key(field) {
8786                dlg.finished(false);
8787                return Err(common::Error::FieldClash(field));
8788            }
8789        }
8790
8791        let mut params = Params::with_capacity(4 + self._additional_params.len());
8792        params.push("resource", self._resource);
8793
8794        params.extend(self._additional_params.iter());
8795
8796        params.push("alt", "json");
8797        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
8798        if self._scopes.is_empty() {
8799            self._scopes
8800                .insert(Scope::CloudPlatform.as_ref().to_string());
8801        }
8802
8803        #[allow(clippy::single_element_loop)]
8804        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8805            url = params.uri_replacement(url, param_name, find_this, true);
8806        }
8807        {
8808            let to_remove = ["resource"];
8809            params.remove_params(&to_remove);
8810        }
8811
8812        let url = params.parse_with_url(&url);
8813
8814        let mut json_mime_type = mime::APPLICATION_JSON;
8815        let mut request_value_reader = {
8816            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8817            common::remove_json_null_values(&mut value);
8818            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8819            serde_json::to_writer(&mut dst, &value).unwrap();
8820            dst
8821        };
8822        let request_size = request_value_reader
8823            .seek(std::io::SeekFrom::End(0))
8824            .unwrap();
8825        request_value_reader
8826            .seek(std::io::SeekFrom::Start(0))
8827            .unwrap();
8828
8829        loop {
8830            let token = match self
8831                .hub
8832                .auth
8833                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8834                .await
8835            {
8836                Ok(token) => token,
8837                Err(e) => match dlg.token(e) {
8838                    Ok(token) => token,
8839                    Err(e) => {
8840                        dlg.finished(false);
8841                        return Err(common::Error::MissingToken(e));
8842                    }
8843                },
8844            };
8845            request_value_reader
8846                .seek(std::io::SeekFrom::Start(0))
8847                .unwrap();
8848            let mut req_result = {
8849                let client = &self.hub.client;
8850                dlg.pre_request();
8851                let mut req_builder = hyper::Request::builder()
8852                    .method(hyper::Method::POST)
8853                    .uri(url.as_str())
8854                    .header(USER_AGENT, self.hub._user_agent.clone());
8855
8856                if let Some(token) = token.as_ref() {
8857                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8858                }
8859
8860                let request = req_builder
8861                    .header(CONTENT_TYPE, json_mime_type.to_string())
8862                    .header(CONTENT_LENGTH, request_size as u64)
8863                    .body(common::to_body(
8864                        request_value_reader.get_ref().clone().into(),
8865                    ));
8866
8867                client.request(request.unwrap()).await
8868            };
8869
8870            match req_result {
8871                Err(err) => {
8872                    if let common::Retry::After(d) = dlg.http_error(&err) {
8873                        sleep(d).await;
8874                        continue;
8875                    }
8876                    dlg.finished(false);
8877                    return Err(common::Error::HttpError(err));
8878                }
8879                Ok(res) => {
8880                    let (mut parts, body) = res.into_parts();
8881                    let mut body = common::Body::new(body);
8882                    if !parts.status.is_success() {
8883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8884                        let error = serde_json::from_str(&common::to_string(&bytes));
8885                        let response = common::to_response(parts, bytes.into());
8886
8887                        if let common::Retry::After(d) =
8888                            dlg.http_failure(&response, error.as_ref().ok())
8889                        {
8890                            sleep(d).await;
8891                            continue;
8892                        }
8893
8894                        dlg.finished(false);
8895
8896                        return Err(match error {
8897                            Ok(value) => common::Error::BadRequest(value),
8898                            _ => common::Error::Failure(response),
8899                        });
8900                    }
8901                    let response = {
8902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8903                        let encoded = common::to_string(&bytes);
8904                        match serde_json::from_str(&encoded) {
8905                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8906                            Err(error) => {
8907                                dlg.response_json_decode_error(&encoded, &error);
8908                                return Err(common::Error::JsonDecodeError(
8909                                    encoded.to_string(),
8910                                    error,
8911                                ));
8912                            }
8913                        }
8914                    };
8915
8916                    dlg.finished(true);
8917                    return Ok(response);
8918                }
8919            }
8920        }
8921    }
8922
8923    ///
8924    /// Sets the *request* property to the given value.
8925    ///
8926    /// Even though the property as already been set when instantiating this call,
8927    /// we provide this method for API completeness.
8928    pub fn request(
8929        mut self,
8930        new_value: GetIamPolicyRequest,
8931    ) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {
8932        self._request = new_value;
8933        self
8934    }
8935    /// 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.
8936    ///
8937    /// Sets the *resource* path property to the given value.
8938    ///
8939    /// Even though the property as already been set when instantiating this call,
8940    /// we provide this method for API completeness.
8941    pub fn resource(mut self, new_value: &str) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {
8942        self._resource = new_value.to_string();
8943        self
8944    }
8945    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8946    /// while executing the actual API request.
8947    ///
8948    /// ````text
8949    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8950    /// ````
8951    ///
8952    /// Sets the *delegate* property to the given value.
8953    pub fn delegate(
8954        mut self,
8955        new_value: &'a mut dyn common::Delegate,
8956    ) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {
8957        self._delegate = Some(new_value);
8958        self
8959    }
8960
8961    /// Set any additional parameter of the query string used in the request.
8962    /// It should be used to set parameters which are not yet available through their own
8963    /// setters.
8964    ///
8965    /// Please note that this method must not be used to set any of the known parameters
8966    /// which have their own setter method. If done anyway, the request will fail.
8967    ///
8968    /// # Additional Parameters
8969    ///
8970    /// * *$.xgafv* (query-string) - V1 error format.
8971    /// * *access_token* (query-string) - OAuth access token.
8972    /// * *alt* (query-string) - Data format for response.
8973    /// * *callback* (query-string) - JSONP
8974    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8975    /// * *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.
8976    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8977    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8978    /// * *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.
8979    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8980    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8981    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C>
8982    where
8983        T: AsRef<str>,
8984    {
8985        self._additional_params
8986            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8987        self
8988    }
8989
8990    /// Identifies the authorization scope for the method you are building.
8991    ///
8992    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8993    /// [`Scope::CloudPlatform`].
8994    ///
8995    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8996    /// tokens for more than one scope.
8997    ///
8998    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8999    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9000    /// sufficient, a read-write scope will do as well.
9001    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C>
9002    where
9003        St: AsRef<str>,
9004    {
9005        self._scopes.insert(String::from(scope.as_ref()));
9006        self
9007    }
9008    /// Identifies the authorization scope(s) for the method you are building.
9009    ///
9010    /// See [`Self::add_scope()`] for details.
9011    pub fn add_scopes<I, St>(
9012        mut self,
9013        scopes: I,
9014    ) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C>
9015    where
9016        I: IntoIterator<Item = St>,
9017        St: AsRef<str>,
9018    {
9019        self._scopes
9020            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9021        self
9022    }
9023
9024    /// Removes all scopes, and no default scope will be used either.
9025    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9026    /// for details).
9027    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetIamPolicyCall<'a, C> {
9028        self._scopes.clear();
9029        self
9030    }
9031}
9032
9033/// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
9034///
9035/// A builder for the *locations.occurrences.getNotes* method supported by a *project* resource.
9036/// It is not used directly, but through a [`ProjectMethods`] instance.
9037///
9038/// # Example
9039///
9040/// Instantiate a resource method builder
9041///
9042/// ```test_harness,no_run
9043/// # extern crate hyper;
9044/// # extern crate hyper_rustls;
9045/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9046/// # async fn dox() {
9047/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9048///
9049/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9050/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9051/// #     .with_native_roots()
9052/// #     .unwrap()
9053/// #     .https_only()
9054/// #     .enable_http2()
9055/// #     .build();
9056///
9057/// # let executor = hyper_util::rt::TokioExecutor::new();
9058/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9059/// #     secret,
9060/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9061/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9062/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9063/// #     ),
9064/// # ).build().await.unwrap();
9065///
9066/// # let client = hyper_util::client::legacy::Client::builder(
9067/// #     hyper_util::rt::TokioExecutor::new()
9068/// # )
9069/// # .build(
9070/// #     hyper_rustls::HttpsConnectorBuilder::new()
9071/// #         .with_native_roots()
9072/// #         .unwrap()
9073/// #         .https_or_http()
9074/// #         .enable_http2()
9075/// #         .build()
9076/// # );
9077/// # let mut hub = ContainerAnalysis::new(client, auth);
9078/// // You can configure optional parameters by calling the respective setters at will, and
9079/// // execute the final call using `doit()`.
9080/// // Values shown here are possibly random and not representative !
9081/// let result = hub.projects().locations_occurrences_get_notes("name")
9082///              .doit().await;
9083/// # }
9084/// ```
9085pub struct ProjectLocationOccurrenceGetNoteCall<'a, C>
9086where
9087    C: 'a,
9088{
9089    hub: &'a ContainerAnalysis<C>,
9090    _name: String,
9091    _delegate: Option<&'a mut dyn common::Delegate>,
9092    _additional_params: HashMap<String, String>,
9093    _scopes: BTreeSet<String>,
9094}
9095
9096impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetNoteCall<'a, C> {}
9097
9098impl<'a, C> ProjectLocationOccurrenceGetNoteCall<'a, C>
9099where
9100    C: common::Connector,
9101{
9102    /// Perform the operation you have build so far.
9103    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
9104        use std::borrow::Cow;
9105        use std::io::{Read, Seek};
9106
9107        use common::{url::Params, ToParts};
9108        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9109
9110        let mut dd = common::DefaultDelegate;
9111        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9112        dlg.begin(common::MethodInfo {
9113            id: "containeranalysis.projects.locations.occurrences.getNotes",
9114            http_method: hyper::Method::GET,
9115        });
9116
9117        for &field in ["alt", "name"].iter() {
9118            if self._additional_params.contains_key(field) {
9119                dlg.finished(false);
9120                return Err(common::Error::FieldClash(field));
9121            }
9122        }
9123
9124        let mut params = Params::with_capacity(3 + self._additional_params.len());
9125        params.push("name", self._name);
9126
9127        params.extend(self._additional_params.iter());
9128
9129        params.push("alt", "json");
9130        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/notes";
9131        if self._scopes.is_empty() {
9132            self._scopes
9133                .insert(Scope::CloudPlatform.as_ref().to_string());
9134        }
9135
9136        #[allow(clippy::single_element_loop)]
9137        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9138            url = params.uri_replacement(url, param_name, find_this, true);
9139        }
9140        {
9141            let to_remove = ["name"];
9142            params.remove_params(&to_remove);
9143        }
9144
9145        let url = params.parse_with_url(&url);
9146
9147        loop {
9148            let token = match self
9149                .hub
9150                .auth
9151                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9152                .await
9153            {
9154                Ok(token) => token,
9155                Err(e) => match dlg.token(e) {
9156                    Ok(token) => token,
9157                    Err(e) => {
9158                        dlg.finished(false);
9159                        return Err(common::Error::MissingToken(e));
9160                    }
9161                },
9162            };
9163            let mut req_result = {
9164                let client = &self.hub.client;
9165                dlg.pre_request();
9166                let mut req_builder = hyper::Request::builder()
9167                    .method(hyper::Method::GET)
9168                    .uri(url.as_str())
9169                    .header(USER_AGENT, self.hub._user_agent.clone());
9170
9171                if let Some(token) = token.as_ref() {
9172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9173                }
9174
9175                let request = req_builder
9176                    .header(CONTENT_LENGTH, 0_u64)
9177                    .body(common::to_body::<String>(None));
9178
9179                client.request(request.unwrap()).await
9180            };
9181
9182            match req_result {
9183                Err(err) => {
9184                    if let common::Retry::After(d) = dlg.http_error(&err) {
9185                        sleep(d).await;
9186                        continue;
9187                    }
9188                    dlg.finished(false);
9189                    return Err(common::Error::HttpError(err));
9190                }
9191                Ok(res) => {
9192                    let (mut parts, body) = res.into_parts();
9193                    let mut body = common::Body::new(body);
9194                    if !parts.status.is_success() {
9195                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9196                        let error = serde_json::from_str(&common::to_string(&bytes));
9197                        let response = common::to_response(parts, bytes.into());
9198
9199                        if let common::Retry::After(d) =
9200                            dlg.http_failure(&response, error.as_ref().ok())
9201                        {
9202                            sleep(d).await;
9203                            continue;
9204                        }
9205
9206                        dlg.finished(false);
9207
9208                        return Err(match error {
9209                            Ok(value) => common::Error::BadRequest(value),
9210                            _ => common::Error::Failure(response),
9211                        });
9212                    }
9213                    let response = {
9214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9215                        let encoded = common::to_string(&bytes);
9216                        match serde_json::from_str(&encoded) {
9217                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9218                            Err(error) => {
9219                                dlg.response_json_decode_error(&encoded, &error);
9220                                return Err(common::Error::JsonDecodeError(
9221                                    encoded.to_string(),
9222                                    error,
9223                                ));
9224                            }
9225                        }
9226                    };
9227
9228                    dlg.finished(true);
9229                    return Ok(response);
9230                }
9231            }
9232        }
9233    }
9234
9235    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
9236    ///
9237    /// Sets the *name* path property to the given value.
9238    ///
9239    /// Even though the property as already been set when instantiating this call,
9240    /// we provide this method for API completeness.
9241    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
9242        self._name = new_value.to_string();
9243        self
9244    }
9245    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9246    /// while executing the actual API request.
9247    ///
9248    /// ````text
9249    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9250    /// ````
9251    ///
9252    /// Sets the *delegate* property to the given value.
9253    pub fn delegate(
9254        mut self,
9255        new_value: &'a mut dyn common::Delegate,
9256    ) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
9257        self._delegate = Some(new_value);
9258        self
9259    }
9260
9261    /// Set any additional parameter of the query string used in the request.
9262    /// It should be used to set parameters which are not yet available through their own
9263    /// setters.
9264    ///
9265    /// Please note that this method must not be used to set any of the known parameters
9266    /// which have their own setter method. If done anyway, the request will fail.
9267    ///
9268    /// # Additional Parameters
9269    ///
9270    /// * *$.xgafv* (query-string) - V1 error format.
9271    /// * *access_token* (query-string) - OAuth access token.
9272    /// * *alt* (query-string) - Data format for response.
9273    /// * *callback* (query-string) - JSONP
9274    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9275    /// * *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.
9276    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9277    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9278    /// * *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.
9279    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9280    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9281    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
9282    where
9283        T: AsRef<str>,
9284    {
9285        self._additional_params
9286            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9287        self
9288    }
9289
9290    /// Identifies the authorization scope for the method you are building.
9291    ///
9292    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9293    /// [`Scope::CloudPlatform`].
9294    ///
9295    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9296    /// tokens for more than one scope.
9297    ///
9298    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9299    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9300    /// sufficient, a read-write scope will do as well.
9301    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
9302    where
9303        St: AsRef<str>,
9304    {
9305        self._scopes.insert(String::from(scope.as_ref()));
9306        self
9307    }
9308    /// Identifies the authorization scope(s) for the method you are building.
9309    ///
9310    /// See [`Self::add_scope()`] for details.
9311    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceGetNoteCall<'a, C>
9312    where
9313        I: IntoIterator<Item = St>,
9314        St: AsRef<str>,
9315    {
9316        self._scopes
9317            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9318        self
9319    }
9320
9321    /// Removes all scopes, and no default scope will be used either.
9322    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9323    /// for details).
9324    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetNoteCall<'a, C> {
9325        self._scopes.clear();
9326        self
9327    }
9328}
9329
9330/// Gets a summary of the number and severity of occurrences.
9331///
9332/// A builder for the *locations.occurrences.getVulnerabilitySummary* method supported by a *project* resource.
9333/// It is not used directly, but through a [`ProjectMethods`] instance.
9334///
9335/// # Example
9336///
9337/// Instantiate a resource method builder
9338///
9339/// ```test_harness,no_run
9340/// # extern crate hyper;
9341/// # extern crate hyper_rustls;
9342/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9343/// # async fn dox() {
9344/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9345///
9346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9348/// #     .with_native_roots()
9349/// #     .unwrap()
9350/// #     .https_only()
9351/// #     .enable_http2()
9352/// #     .build();
9353///
9354/// # let executor = hyper_util::rt::TokioExecutor::new();
9355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9356/// #     secret,
9357/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9358/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9359/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9360/// #     ),
9361/// # ).build().await.unwrap();
9362///
9363/// # let client = hyper_util::client::legacy::Client::builder(
9364/// #     hyper_util::rt::TokioExecutor::new()
9365/// # )
9366/// # .build(
9367/// #     hyper_rustls::HttpsConnectorBuilder::new()
9368/// #         .with_native_roots()
9369/// #         .unwrap()
9370/// #         .https_or_http()
9371/// #         .enable_http2()
9372/// #         .build()
9373/// # );
9374/// # let mut hub = ContainerAnalysis::new(client, auth);
9375/// // You can configure optional parameters by calling the respective setters at will, and
9376/// // execute the final call using `doit()`.
9377/// // Values shown here are possibly random and not representative !
9378/// let result = hub.projects().locations_occurrences_get_vulnerability_summary("parent")
9379///              .return_partial_success(false)
9380///              .filter("Lorem")
9381///              .doit().await;
9382/// # }
9383/// ```
9384pub struct ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
9385where
9386    C: 'a,
9387{
9388    hub: &'a ContainerAnalysis<C>,
9389    _parent: String,
9390    _return_partial_success: Option<bool>,
9391    _filter: Option<String>,
9392    _delegate: Option<&'a mut dyn common::Delegate>,
9393    _additional_params: HashMap<String, String>,
9394    _scopes: BTreeSet<String>,
9395}
9396
9397impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {}
9398
9399impl<'a, C> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
9400where
9401    C: common::Connector,
9402{
9403    /// Perform the operation you have build so far.
9404    pub async fn doit(
9405        mut self,
9406    ) -> common::Result<(common::Response, VulnerabilityOccurrencesSummary)> {
9407        use std::borrow::Cow;
9408        use std::io::{Read, Seek};
9409
9410        use common::{url::Params, ToParts};
9411        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9412
9413        let mut dd = common::DefaultDelegate;
9414        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9415        dlg.begin(common::MethodInfo {
9416            id: "containeranalysis.projects.locations.occurrences.getVulnerabilitySummary",
9417            http_method: hyper::Method::GET,
9418        });
9419
9420        for &field in ["alt", "parent", "returnPartialSuccess", "filter"].iter() {
9421            if self._additional_params.contains_key(field) {
9422                dlg.finished(false);
9423                return Err(common::Error::FieldClash(field));
9424            }
9425        }
9426
9427        let mut params = Params::with_capacity(5 + self._additional_params.len());
9428        params.push("parent", self._parent);
9429        if let Some(value) = self._return_partial_success.as_ref() {
9430            params.push("returnPartialSuccess", value.to_string());
9431        }
9432        if let Some(value) = self._filter.as_ref() {
9433            params.push("filter", value);
9434        }
9435
9436        params.extend(self._additional_params.iter());
9437
9438        params.push("alt", "json");
9439        let mut url =
9440            self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:vulnerabilitySummary";
9441        if self._scopes.is_empty() {
9442            self._scopes
9443                .insert(Scope::CloudPlatform.as_ref().to_string());
9444        }
9445
9446        #[allow(clippy::single_element_loop)]
9447        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9448            url = params.uri_replacement(url, param_name, find_this, true);
9449        }
9450        {
9451            let to_remove = ["parent"];
9452            params.remove_params(&to_remove);
9453        }
9454
9455        let url = params.parse_with_url(&url);
9456
9457        loop {
9458            let token = match self
9459                .hub
9460                .auth
9461                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9462                .await
9463            {
9464                Ok(token) => token,
9465                Err(e) => match dlg.token(e) {
9466                    Ok(token) => token,
9467                    Err(e) => {
9468                        dlg.finished(false);
9469                        return Err(common::Error::MissingToken(e));
9470                    }
9471                },
9472            };
9473            let mut req_result = {
9474                let client = &self.hub.client;
9475                dlg.pre_request();
9476                let mut req_builder = hyper::Request::builder()
9477                    .method(hyper::Method::GET)
9478                    .uri(url.as_str())
9479                    .header(USER_AGENT, self.hub._user_agent.clone());
9480
9481                if let Some(token) = token.as_ref() {
9482                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9483                }
9484
9485                let request = req_builder
9486                    .header(CONTENT_LENGTH, 0_u64)
9487                    .body(common::to_body::<String>(None));
9488
9489                client.request(request.unwrap()).await
9490            };
9491
9492            match req_result {
9493                Err(err) => {
9494                    if let common::Retry::After(d) = dlg.http_error(&err) {
9495                        sleep(d).await;
9496                        continue;
9497                    }
9498                    dlg.finished(false);
9499                    return Err(common::Error::HttpError(err));
9500                }
9501                Ok(res) => {
9502                    let (mut parts, body) = res.into_parts();
9503                    let mut body = common::Body::new(body);
9504                    if !parts.status.is_success() {
9505                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9506                        let error = serde_json::from_str(&common::to_string(&bytes));
9507                        let response = common::to_response(parts, bytes.into());
9508
9509                        if let common::Retry::After(d) =
9510                            dlg.http_failure(&response, error.as_ref().ok())
9511                        {
9512                            sleep(d).await;
9513                            continue;
9514                        }
9515
9516                        dlg.finished(false);
9517
9518                        return Err(match error {
9519                            Ok(value) => common::Error::BadRequest(value),
9520                            _ => common::Error::Failure(response),
9521                        });
9522                    }
9523                    let response = {
9524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9525                        let encoded = common::to_string(&bytes);
9526                        match serde_json::from_str(&encoded) {
9527                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9528                            Err(error) => {
9529                                dlg.response_json_decode_error(&encoded, &error);
9530                                return Err(common::Error::JsonDecodeError(
9531                                    encoded.to_string(),
9532                                    error,
9533                                ));
9534                            }
9535                        }
9536                    };
9537
9538                    dlg.finished(true);
9539                    return Ok(response);
9540                }
9541            }
9542        }
9543    }
9544
9545    /// Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
9546    ///
9547    /// Sets the *parent* path property to the given value.
9548    ///
9549    /// Even though the property as already been set when instantiating this call,
9550    /// we provide this method for API completeness.
9551    pub fn parent(
9552        mut self,
9553        new_value: &str,
9554    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
9555        self._parent = new_value.to_string();
9556        self
9557    }
9558    /// If set, the request will return all reachable occurrence summaries and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
9559    ///
9560    /// Sets the *return partial success* query property to the given value.
9561    pub fn return_partial_success(
9562        mut self,
9563        new_value: bool,
9564    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
9565        self._return_partial_success = Some(new_value);
9566        self
9567    }
9568    /// The filter expression.
9569    ///
9570    /// Sets the *filter* query property to the given value.
9571    pub fn filter(
9572        mut self,
9573        new_value: &str,
9574    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
9575        self._filter = Some(new_value.to_string());
9576        self
9577    }
9578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9579    /// while executing the actual API request.
9580    ///
9581    /// ````text
9582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9583    /// ````
9584    ///
9585    /// Sets the *delegate* property to the given value.
9586    pub fn delegate(
9587        mut self,
9588        new_value: &'a mut dyn common::Delegate,
9589    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
9590        self._delegate = Some(new_value);
9591        self
9592    }
9593
9594    /// Set any additional parameter of the query string used in the request.
9595    /// It should be used to set parameters which are not yet available through their own
9596    /// setters.
9597    ///
9598    /// Please note that this method must not be used to set any of the known parameters
9599    /// which have their own setter method. If done anyway, the request will fail.
9600    ///
9601    /// # Additional Parameters
9602    ///
9603    /// * *$.xgafv* (query-string) - V1 error format.
9604    /// * *access_token* (query-string) - OAuth access token.
9605    /// * *alt* (query-string) - Data format for response.
9606    /// * *callback* (query-string) - JSONP
9607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9608    /// * *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.
9609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9611    /// * *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.
9612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9614    pub fn param<T>(
9615        mut self,
9616        name: T,
9617        value: T,
9618    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
9619    where
9620        T: AsRef<str>,
9621    {
9622        self._additional_params
9623            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9624        self
9625    }
9626
9627    /// Identifies the authorization scope for the method you are building.
9628    ///
9629    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9630    /// [`Scope::CloudPlatform`].
9631    ///
9632    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9633    /// tokens for more than one scope.
9634    ///
9635    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9636    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9637    /// sufficient, a read-write scope will do as well.
9638    pub fn add_scope<St>(
9639        mut self,
9640        scope: St,
9641    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
9642    where
9643        St: AsRef<str>,
9644    {
9645        self._scopes.insert(String::from(scope.as_ref()));
9646        self
9647    }
9648    /// Identifies the authorization scope(s) for the method you are building.
9649    ///
9650    /// See [`Self::add_scope()`] for details.
9651    pub fn add_scopes<I, St>(
9652        mut self,
9653        scopes: I,
9654    ) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C>
9655    where
9656        I: IntoIterator<Item = St>,
9657        St: AsRef<str>,
9658    {
9659        self._scopes
9660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9661        self
9662    }
9663
9664    /// Removes all scopes, and no default scope will be used either.
9665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9666    /// for details).
9667    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceGetVulnerabilitySummaryCall<'a, C> {
9668        self._scopes.clear();
9669        self
9670    }
9671}
9672
9673/// Lists occurrences for the specified project.
9674///
9675/// A builder for the *locations.occurrences.list* method supported by a *project* resource.
9676/// It is not used directly, but through a [`ProjectMethods`] instance.
9677///
9678/// # Example
9679///
9680/// Instantiate a resource method builder
9681///
9682/// ```test_harness,no_run
9683/// # extern crate hyper;
9684/// # extern crate hyper_rustls;
9685/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
9686/// # async fn dox() {
9687/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9688///
9689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9691/// #     .with_native_roots()
9692/// #     .unwrap()
9693/// #     .https_only()
9694/// #     .enable_http2()
9695/// #     .build();
9696///
9697/// # let executor = hyper_util::rt::TokioExecutor::new();
9698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9699/// #     secret,
9700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9703/// #     ),
9704/// # ).build().await.unwrap();
9705///
9706/// # let client = hyper_util::client::legacy::Client::builder(
9707/// #     hyper_util::rt::TokioExecutor::new()
9708/// # )
9709/// # .build(
9710/// #     hyper_rustls::HttpsConnectorBuilder::new()
9711/// #         .with_native_roots()
9712/// #         .unwrap()
9713/// #         .https_or_http()
9714/// #         .enable_http2()
9715/// #         .build()
9716/// # );
9717/// # let mut hub = ContainerAnalysis::new(client, auth);
9718/// // You can configure optional parameters by calling the respective setters at will, and
9719/// // execute the final call using `doit()`.
9720/// // Values shown here are possibly random and not representative !
9721/// let result = hub.projects().locations_occurrences_list("parent")
9722///              .return_partial_success(false)
9723///              .page_token("sed")
9724///              .page_size(-70)
9725///              .filter("sed")
9726///              .doit().await;
9727/// # }
9728/// ```
9729pub struct ProjectLocationOccurrenceListCall<'a, C>
9730where
9731    C: 'a,
9732{
9733    hub: &'a ContainerAnalysis<C>,
9734    _parent: String,
9735    _return_partial_success: Option<bool>,
9736    _page_token: Option<String>,
9737    _page_size: Option<i32>,
9738    _filter: Option<String>,
9739    _delegate: Option<&'a mut dyn common::Delegate>,
9740    _additional_params: HashMap<String, String>,
9741    _scopes: BTreeSet<String>,
9742}
9743
9744impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceListCall<'a, C> {}
9745
9746impl<'a, C> ProjectLocationOccurrenceListCall<'a, C>
9747where
9748    C: common::Connector,
9749{
9750    /// Perform the operation you have build so far.
9751    pub async fn doit(mut self) -> common::Result<(common::Response, ListOccurrencesResponse)> {
9752        use std::borrow::Cow;
9753        use std::io::{Read, Seek};
9754
9755        use common::{url::Params, ToParts};
9756        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9757
9758        let mut dd = common::DefaultDelegate;
9759        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9760        dlg.begin(common::MethodInfo {
9761            id: "containeranalysis.projects.locations.occurrences.list",
9762            http_method: hyper::Method::GET,
9763        });
9764
9765        for &field in [
9766            "alt",
9767            "parent",
9768            "returnPartialSuccess",
9769            "pageToken",
9770            "pageSize",
9771            "filter",
9772        ]
9773        .iter()
9774        {
9775            if self._additional_params.contains_key(field) {
9776                dlg.finished(false);
9777                return Err(common::Error::FieldClash(field));
9778            }
9779        }
9780
9781        let mut params = Params::with_capacity(7 + self._additional_params.len());
9782        params.push("parent", self._parent);
9783        if let Some(value) = self._return_partial_success.as_ref() {
9784            params.push("returnPartialSuccess", value.to_string());
9785        }
9786        if let Some(value) = self._page_token.as_ref() {
9787            params.push("pageToken", value);
9788        }
9789        if let Some(value) = self._page_size.as_ref() {
9790            params.push("pageSize", value.to_string());
9791        }
9792        if let Some(value) = self._filter.as_ref() {
9793            params.push("filter", value);
9794        }
9795
9796        params.extend(self._additional_params.iter());
9797
9798        params.push("alt", "json");
9799        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
9800        if self._scopes.is_empty() {
9801            self._scopes
9802                .insert(Scope::CloudPlatform.as_ref().to_string());
9803        }
9804
9805        #[allow(clippy::single_element_loop)]
9806        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9807            url = params.uri_replacement(url, param_name, find_this, true);
9808        }
9809        {
9810            let to_remove = ["parent"];
9811            params.remove_params(&to_remove);
9812        }
9813
9814        let url = params.parse_with_url(&url);
9815
9816        loop {
9817            let token = match self
9818                .hub
9819                .auth
9820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9821                .await
9822            {
9823                Ok(token) => token,
9824                Err(e) => match dlg.token(e) {
9825                    Ok(token) => token,
9826                    Err(e) => {
9827                        dlg.finished(false);
9828                        return Err(common::Error::MissingToken(e));
9829                    }
9830                },
9831            };
9832            let mut req_result = {
9833                let client = &self.hub.client;
9834                dlg.pre_request();
9835                let mut req_builder = hyper::Request::builder()
9836                    .method(hyper::Method::GET)
9837                    .uri(url.as_str())
9838                    .header(USER_AGENT, self.hub._user_agent.clone());
9839
9840                if let Some(token) = token.as_ref() {
9841                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9842                }
9843
9844                let request = req_builder
9845                    .header(CONTENT_LENGTH, 0_u64)
9846                    .body(common::to_body::<String>(None));
9847
9848                client.request(request.unwrap()).await
9849            };
9850
9851            match req_result {
9852                Err(err) => {
9853                    if let common::Retry::After(d) = dlg.http_error(&err) {
9854                        sleep(d).await;
9855                        continue;
9856                    }
9857                    dlg.finished(false);
9858                    return Err(common::Error::HttpError(err));
9859                }
9860                Ok(res) => {
9861                    let (mut parts, body) = res.into_parts();
9862                    let mut body = common::Body::new(body);
9863                    if !parts.status.is_success() {
9864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9865                        let error = serde_json::from_str(&common::to_string(&bytes));
9866                        let response = common::to_response(parts, bytes.into());
9867
9868                        if let common::Retry::After(d) =
9869                            dlg.http_failure(&response, error.as_ref().ok())
9870                        {
9871                            sleep(d).await;
9872                            continue;
9873                        }
9874
9875                        dlg.finished(false);
9876
9877                        return Err(match error {
9878                            Ok(value) => common::Error::BadRequest(value),
9879                            _ => common::Error::Failure(response),
9880                        });
9881                    }
9882                    let response = {
9883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9884                        let encoded = common::to_string(&bytes);
9885                        match serde_json::from_str(&encoded) {
9886                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9887                            Err(error) => {
9888                                dlg.response_json_decode_error(&encoded, &error);
9889                                return Err(common::Error::JsonDecodeError(
9890                                    encoded.to_string(),
9891                                    error,
9892                                ));
9893                            }
9894                        }
9895                    };
9896
9897                    dlg.finished(true);
9898                    return Ok(response);
9899                }
9900            }
9901        }
9902    }
9903
9904    /// Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
9905    ///
9906    /// Sets the *parent* path property to the given value.
9907    ///
9908    /// Even though the property as already been set when instantiating this call,
9909    /// we provide this method for API completeness.
9910    pub fn parent(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
9911        self._parent = new_value.to_string();
9912        self
9913    }
9914    /// If set, the request will return all reachable Occurrences and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
9915    ///
9916    /// Sets the *return partial success* query property to the given value.
9917    pub fn return_partial_success(
9918        mut self,
9919        new_value: bool,
9920    ) -> ProjectLocationOccurrenceListCall<'a, C> {
9921        self._return_partial_success = Some(new_value);
9922        self
9923    }
9924    /// Token to provide to skip to a particular spot in the list.
9925    ///
9926    /// Sets the *page token* query property to the given value.
9927    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
9928        self._page_token = Some(new_value.to_string());
9929        self
9930    }
9931    /// 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.
9932    ///
9933    /// Sets the *page size* query property to the given value.
9934    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOccurrenceListCall<'a, C> {
9935        self._page_size = Some(new_value);
9936        self
9937    }
9938    /// The filter expression.
9939    ///
9940    /// Sets the *filter* query property to the given value.
9941    pub fn filter(mut self, new_value: &str) -> ProjectLocationOccurrenceListCall<'a, C> {
9942        self._filter = Some(new_value.to_string());
9943        self
9944    }
9945    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9946    /// while executing the actual API request.
9947    ///
9948    /// ````text
9949    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9950    /// ````
9951    ///
9952    /// Sets the *delegate* property to the given value.
9953    pub fn delegate(
9954        mut self,
9955        new_value: &'a mut dyn common::Delegate,
9956    ) -> ProjectLocationOccurrenceListCall<'a, C> {
9957        self._delegate = Some(new_value);
9958        self
9959    }
9960
9961    /// Set any additional parameter of the query string used in the request.
9962    /// It should be used to set parameters which are not yet available through their own
9963    /// setters.
9964    ///
9965    /// Please note that this method must not be used to set any of the known parameters
9966    /// which have their own setter method. If done anyway, the request will fail.
9967    ///
9968    /// # Additional Parameters
9969    ///
9970    /// * *$.xgafv* (query-string) - V1 error format.
9971    /// * *access_token* (query-string) - OAuth access token.
9972    /// * *alt* (query-string) - Data format for response.
9973    /// * *callback* (query-string) - JSONP
9974    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9975    /// * *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.
9976    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9977    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9978    /// * *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.
9979    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9980    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9981    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceListCall<'a, C>
9982    where
9983        T: AsRef<str>,
9984    {
9985        self._additional_params
9986            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9987        self
9988    }
9989
9990    /// Identifies the authorization scope for the method you are building.
9991    ///
9992    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9993    /// [`Scope::CloudPlatform`].
9994    ///
9995    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9996    /// tokens for more than one scope.
9997    ///
9998    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9999    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10000    /// sufficient, a read-write scope will do as well.
10001    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceListCall<'a, C>
10002    where
10003        St: AsRef<str>,
10004    {
10005        self._scopes.insert(String::from(scope.as_ref()));
10006        self
10007    }
10008    /// Identifies the authorization scope(s) for the method you are building.
10009    ///
10010    /// See [`Self::add_scope()`] for details.
10011    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrenceListCall<'a, C>
10012    where
10013        I: IntoIterator<Item = St>,
10014        St: AsRef<str>,
10015    {
10016        self._scopes
10017            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10018        self
10019    }
10020
10021    /// Removes all scopes, and no default scope will be used either.
10022    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10023    /// for details).
10024    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceListCall<'a, C> {
10025        self._scopes.clear();
10026        self
10027    }
10028}
10029
10030/// Updates the specified occurrence.
10031///
10032/// A builder for the *locations.occurrences.patch* method supported by a *project* resource.
10033/// It is not used directly, but through a [`ProjectMethods`] instance.
10034///
10035/// # Example
10036///
10037/// Instantiate a resource method builder
10038///
10039/// ```test_harness,no_run
10040/// # extern crate hyper;
10041/// # extern crate hyper_rustls;
10042/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10043/// use containeranalysis1_beta1::api::Occurrence;
10044/// # async fn dox() {
10045/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10046///
10047/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10048/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10049/// #     .with_native_roots()
10050/// #     .unwrap()
10051/// #     .https_only()
10052/// #     .enable_http2()
10053/// #     .build();
10054///
10055/// # let executor = hyper_util::rt::TokioExecutor::new();
10056/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10057/// #     secret,
10058/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10059/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10060/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10061/// #     ),
10062/// # ).build().await.unwrap();
10063///
10064/// # let client = hyper_util::client::legacy::Client::builder(
10065/// #     hyper_util::rt::TokioExecutor::new()
10066/// # )
10067/// # .build(
10068/// #     hyper_rustls::HttpsConnectorBuilder::new()
10069/// #         .with_native_roots()
10070/// #         .unwrap()
10071/// #         .https_or_http()
10072/// #         .enable_http2()
10073/// #         .build()
10074/// # );
10075/// # let mut hub = ContainerAnalysis::new(client, auth);
10076/// // As the method needs a request, you would usually fill it with the desired information
10077/// // into the respective structure. Some of the parts shown here might not be applicable !
10078/// // Values shown here are possibly random and not representative !
10079/// let mut req = Occurrence::default();
10080///
10081/// // You can configure optional parameters by calling the respective setters at will, and
10082/// // execute the final call using `doit()`.
10083/// // Values shown here are possibly random and not representative !
10084/// let result = hub.projects().locations_occurrences_patch(req, "name")
10085///              .update_mask(FieldMask::new::<&str>(&[]))
10086///              .doit().await;
10087/// # }
10088/// ```
10089pub struct ProjectLocationOccurrencePatchCall<'a, C>
10090where
10091    C: 'a,
10092{
10093    hub: &'a ContainerAnalysis<C>,
10094    _request: Occurrence,
10095    _name: String,
10096    _update_mask: Option<common::FieldMask>,
10097    _delegate: Option<&'a mut dyn common::Delegate>,
10098    _additional_params: HashMap<String, String>,
10099    _scopes: BTreeSet<String>,
10100}
10101
10102impl<'a, C> common::CallBuilder for ProjectLocationOccurrencePatchCall<'a, C> {}
10103
10104impl<'a, C> ProjectLocationOccurrencePatchCall<'a, C>
10105where
10106    C: common::Connector,
10107{
10108    /// Perform the operation you have build so far.
10109    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
10110        use std::borrow::Cow;
10111        use std::io::{Read, Seek};
10112
10113        use common::{url::Params, ToParts};
10114        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10115
10116        let mut dd = common::DefaultDelegate;
10117        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10118        dlg.begin(common::MethodInfo {
10119            id: "containeranalysis.projects.locations.occurrences.patch",
10120            http_method: hyper::Method::PATCH,
10121        });
10122
10123        for &field in ["alt", "name", "updateMask"].iter() {
10124            if self._additional_params.contains_key(field) {
10125                dlg.finished(false);
10126                return Err(common::Error::FieldClash(field));
10127            }
10128        }
10129
10130        let mut params = Params::with_capacity(5 + self._additional_params.len());
10131        params.push("name", self._name);
10132        if let Some(value) = self._update_mask.as_ref() {
10133            params.push("updateMask", value.to_string());
10134        }
10135
10136        params.extend(self._additional_params.iter());
10137
10138        params.push("alt", "json");
10139        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
10140        if self._scopes.is_empty() {
10141            self._scopes
10142                .insert(Scope::CloudPlatform.as_ref().to_string());
10143        }
10144
10145        #[allow(clippy::single_element_loop)]
10146        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10147            url = params.uri_replacement(url, param_name, find_this, true);
10148        }
10149        {
10150            let to_remove = ["name"];
10151            params.remove_params(&to_remove);
10152        }
10153
10154        let url = params.parse_with_url(&url);
10155
10156        let mut json_mime_type = mime::APPLICATION_JSON;
10157        let mut request_value_reader = {
10158            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10159            common::remove_json_null_values(&mut value);
10160            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10161            serde_json::to_writer(&mut dst, &value).unwrap();
10162            dst
10163        };
10164        let request_size = request_value_reader
10165            .seek(std::io::SeekFrom::End(0))
10166            .unwrap();
10167        request_value_reader
10168            .seek(std::io::SeekFrom::Start(0))
10169            .unwrap();
10170
10171        loop {
10172            let token = match self
10173                .hub
10174                .auth
10175                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10176                .await
10177            {
10178                Ok(token) => token,
10179                Err(e) => match dlg.token(e) {
10180                    Ok(token) => token,
10181                    Err(e) => {
10182                        dlg.finished(false);
10183                        return Err(common::Error::MissingToken(e));
10184                    }
10185                },
10186            };
10187            request_value_reader
10188                .seek(std::io::SeekFrom::Start(0))
10189                .unwrap();
10190            let mut req_result = {
10191                let client = &self.hub.client;
10192                dlg.pre_request();
10193                let mut req_builder = hyper::Request::builder()
10194                    .method(hyper::Method::PATCH)
10195                    .uri(url.as_str())
10196                    .header(USER_AGENT, self.hub._user_agent.clone());
10197
10198                if let Some(token) = token.as_ref() {
10199                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10200                }
10201
10202                let request = req_builder
10203                    .header(CONTENT_TYPE, json_mime_type.to_string())
10204                    .header(CONTENT_LENGTH, request_size as u64)
10205                    .body(common::to_body(
10206                        request_value_reader.get_ref().clone().into(),
10207                    ));
10208
10209                client.request(request.unwrap()).await
10210            };
10211
10212            match req_result {
10213                Err(err) => {
10214                    if let common::Retry::After(d) = dlg.http_error(&err) {
10215                        sleep(d).await;
10216                        continue;
10217                    }
10218                    dlg.finished(false);
10219                    return Err(common::Error::HttpError(err));
10220                }
10221                Ok(res) => {
10222                    let (mut parts, body) = res.into_parts();
10223                    let mut body = common::Body::new(body);
10224                    if !parts.status.is_success() {
10225                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10226                        let error = serde_json::from_str(&common::to_string(&bytes));
10227                        let response = common::to_response(parts, bytes.into());
10228
10229                        if let common::Retry::After(d) =
10230                            dlg.http_failure(&response, error.as_ref().ok())
10231                        {
10232                            sleep(d).await;
10233                            continue;
10234                        }
10235
10236                        dlg.finished(false);
10237
10238                        return Err(match error {
10239                            Ok(value) => common::Error::BadRequest(value),
10240                            _ => common::Error::Failure(response),
10241                        });
10242                    }
10243                    let response = {
10244                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10245                        let encoded = common::to_string(&bytes);
10246                        match serde_json::from_str(&encoded) {
10247                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10248                            Err(error) => {
10249                                dlg.response_json_decode_error(&encoded, &error);
10250                                return Err(common::Error::JsonDecodeError(
10251                                    encoded.to_string(),
10252                                    error,
10253                                ));
10254                            }
10255                        }
10256                    };
10257
10258                    dlg.finished(true);
10259                    return Ok(response);
10260                }
10261            }
10262        }
10263    }
10264
10265    ///
10266    /// Sets the *request* property to the given value.
10267    ///
10268    /// Even though the property as already been set when instantiating this call,
10269    /// we provide this method for API completeness.
10270    pub fn request(mut self, new_value: Occurrence) -> ProjectLocationOccurrencePatchCall<'a, C> {
10271        self._request = new_value;
10272        self
10273    }
10274    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
10275    ///
10276    /// Sets the *name* path property to the given value.
10277    ///
10278    /// Even though the property as already been set when instantiating this call,
10279    /// we provide this method for API completeness.
10280    pub fn name(mut self, new_value: &str) -> ProjectLocationOccurrencePatchCall<'a, C> {
10281        self._name = new_value.to_string();
10282        self
10283    }
10284    /// The fields to update.
10285    ///
10286    /// Sets the *update mask* query property to the given value.
10287    pub fn update_mask(
10288        mut self,
10289        new_value: common::FieldMask,
10290    ) -> ProjectLocationOccurrencePatchCall<'a, C> {
10291        self._update_mask = Some(new_value);
10292        self
10293    }
10294    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10295    /// while executing the actual API request.
10296    ///
10297    /// ````text
10298    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10299    /// ````
10300    ///
10301    /// Sets the *delegate* property to the given value.
10302    pub fn delegate(
10303        mut self,
10304        new_value: &'a mut dyn common::Delegate,
10305    ) -> ProjectLocationOccurrencePatchCall<'a, C> {
10306        self._delegate = Some(new_value);
10307        self
10308    }
10309
10310    /// Set any additional parameter of the query string used in the request.
10311    /// It should be used to set parameters which are not yet available through their own
10312    /// setters.
10313    ///
10314    /// Please note that this method must not be used to set any of the known parameters
10315    /// which have their own setter method. If done anyway, the request will fail.
10316    ///
10317    /// # Additional Parameters
10318    ///
10319    /// * *$.xgafv* (query-string) - V1 error format.
10320    /// * *access_token* (query-string) - OAuth access token.
10321    /// * *alt* (query-string) - Data format for response.
10322    /// * *callback* (query-string) - JSONP
10323    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10324    /// * *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.
10325    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10326    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10327    /// * *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.
10328    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10329    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10330    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrencePatchCall<'a, C>
10331    where
10332        T: AsRef<str>,
10333    {
10334        self._additional_params
10335            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10336        self
10337    }
10338
10339    /// Identifies the authorization scope for the method you are building.
10340    ///
10341    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10342    /// [`Scope::CloudPlatform`].
10343    ///
10344    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10345    /// tokens for more than one scope.
10346    ///
10347    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10348    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10349    /// sufficient, a read-write scope will do as well.
10350    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrencePatchCall<'a, C>
10351    where
10352        St: AsRef<str>,
10353    {
10354        self._scopes.insert(String::from(scope.as_ref()));
10355        self
10356    }
10357    /// Identifies the authorization scope(s) for the method you are building.
10358    ///
10359    /// See [`Self::add_scope()`] for details.
10360    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOccurrencePatchCall<'a, C>
10361    where
10362        I: IntoIterator<Item = St>,
10363        St: AsRef<str>,
10364    {
10365        self._scopes
10366            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10367        self
10368    }
10369
10370    /// Removes all scopes, and no default scope will be used either.
10371    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10372    /// for details).
10373    pub fn clear_scopes(mut self) -> ProjectLocationOccurrencePatchCall<'a, C> {
10374        self._scopes.clear();
10375        self
10376    }
10377}
10378
10379/// 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.
10380///
10381/// A builder for the *locations.occurrences.setIamPolicy* method supported by a *project* resource.
10382/// It is not used directly, but through a [`ProjectMethods`] instance.
10383///
10384/// # Example
10385///
10386/// Instantiate a resource method builder
10387///
10388/// ```test_harness,no_run
10389/// # extern crate hyper;
10390/// # extern crate hyper_rustls;
10391/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10392/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
10393/// # async fn dox() {
10394/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10395///
10396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10397/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10398/// #     .with_native_roots()
10399/// #     .unwrap()
10400/// #     .https_only()
10401/// #     .enable_http2()
10402/// #     .build();
10403///
10404/// # let executor = hyper_util::rt::TokioExecutor::new();
10405/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10406/// #     secret,
10407/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10408/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10409/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10410/// #     ),
10411/// # ).build().await.unwrap();
10412///
10413/// # let client = hyper_util::client::legacy::Client::builder(
10414/// #     hyper_util::rt::TokioExecutor::new()
10415/// # )
10416/// # .build(
10417/// #     hyper_rustls::HttpsConnectorBuilder::new()
10418/// #         .with_native_roots()
10419/// #         .unwrap()
10420/// #         .https_or_http()
10421/// #         .enable_http2()
10422/// #         .build()
10423/// # );
10424/// # let mut hub = ContainerAnalysis::new(client, auth);
10425/// // As the method needs a request, you would usually fill it with the desired information
10426/// // into the respective structure. Some of the parts shown here might not be applicable !
10427/// // Values shown here are possibly random and not representative !
10428/// let mut req = SetIamPolicyRequest::default();
10429///
10430/// // You can configure optional parameters by calling the respective setters at will, and
10431/// // execute the final call using `doit()`.
10432/// // Values shown here are possibly random and not representative !
10433/// let result = hub.projects().locations_occurrences_set_iam_policy(req, "resource")
10434///              .doit().await;
10435/// # }
10436/// ```
10437pub struct ProjectLocationOccurrenceSetIamPolicyCall<'a, C>
10438where
10439    C: 'a,
10440{
10441    hub: &'a ContainerAnalysis<C>,
10442    _request: SetIamPolicyRequest,
10443    _resource: String,
10444    _delegate: Option<&'a mut dyn common::Delegate>,
10445    _additional_params: HashMap<String, String>,
10446    _scopes: BTreeSet<String>,
10447}
10448
10449impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {}
10450
10451impl<'a, C> ProjectLocationOccurrenceSetIamPolicyCall<'a, C>
10452where
10453    C: common::Connector,
10454{
10455    /// Perform the operation you have build so far.
10456    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10457        use std::borrow::Cow;
10458        use std::io::{Read, Seek};
10459
10460        use common::{url::Params, ToParts};
10461        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10462
10463        let mut dd = common::DefaultDelegate;
10464        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10465        dlg.begin(common::MethodInfo {
10466            id: "containeranalysis.projects.locations.occurrences.setIamPolicy",
10467            http_method: hyper::Method::POST,
10468        });
10469
10470        for &field in ["alt", "resource"].iter() {
10471            if self._additional_params.contains_key(field) {
10472                dlg.finished(false);
10473                return Err(common::Error::FieldClash(field));
10474            }
10475        }
10476
10477        let mut params = Params::with_capacity(4 + self._additional_params.len());
10478        params.push("resource", self._resource);
10479
10480        params.extend(self._additional_params.iter());
10481
10482        params.push("alt", "json");
10483        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
10484        if self._scopes.is_empty() {
10485            self._scopes
10486                .insert(Scope::CloudPlatform.as_ref().to_string());
10487        }
10488
10489        #[allow(clippy::single_element_loop)]
10490        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10491            url = params.uri_replacement(url, param_name, find_this, true);
10492        }
10493        {
10494            let to_remove = ["resource"];
10495            params.remove_params(&to_remove);
10496        }
10497
10498        let url = params.parse_with_url(&url);
10499
10500        let mut json_mime_type = mime::APPLICATION_JSON;
10501        let mut request_value_reader = {
10502            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10503            common::remove_json_null_values(&mut value);
10504            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10505            serde_json::to_writer(&mut dst, &value).unwrap();
10506            dst
10507        };
10508        let request_size = request_value_reader
10509            .seek(std::io::SeekFrom::End(0))
10510            .unwrap();
10511        request_value_reader
10512            .seek(std::io::SeekFrom::Start(0))
10513            .unwrap();
10514
10515        loop {
10516            let token = match self
10517                .hub
10518                .auth
10519                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10520                .await
10521            {
10522                Ok(token) => token,
10523                Err(e) => match dlg.token(e) {
10524                    Ok(token) => token,
10525                    Err(e) => {
10526                        dlg.finished(false);
10527                        return Err(common::Error::MissingToken(e));
10528                    }
10529                },
10530            };
10531            request_value_reader
10532                .seek(std::io::SeekFrom::Start(0))
10533                .unwrap();
10534            let mut req_result = {
10535                let client = &self.hub.client;
10536                dlg.pre_request();
10537                let mut req_builder = hyper::Request::builder()
10538                    .method(hyper::Method::POST)
10539                    .uri(url.as_str())
10540                    .header(USER_AGENT, self.hub._user_agent.clone());
10541
10542                if let Some(token) = token.as_ref() {
10543                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10544                }
10545
10546                let request = req_builder
10547                    .header(CONTENT_TYPE, json_mime_type.to_string())
10548                    .header(CONTENT_LENGTH, request_size as u64)
10549                    .body(common::to_body(
10550                        request_value_reader.get_ref().clone().into(),
10551                    ));
10552
10553                client.request(request.unwrap()).await
10554            };
10555
10556            match req_result {
10557                Err(err) => {
10558                    if let common::Retry::After(d) = dlg.http_error(&err) {
10559                        sleep(d).await;
10560                        continue;
10561                    }
10562                    dlg.finished(false);
10563                    return Err(common::Error::HttpError(err));
10564                }
10565                Ok(res) => {
10566                    let (mut parts, body) = res.into_parts();
10567                    let mut body = common::Body::new(body);
10568                    if !parts.status.is_success() {
10569                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10570                        let error = serde_json::from_str(&common::to_string(&bytes));
10571                        let response = common::to_response(parts, bytes.into());
10572
10573                        if let common::Retry::After(d) =
10574                            dlg.http_failure(&response, error.as_ref().ok())
10575                        {
10576                            sleep(d).await;
10577                            continue;
10578                        }
10579
10580                        dlg.finished(false);
10581
10582                        return Err(match error {
10583                            Ok(value) => common::Error::BadRequest(value),
10584                            _ => common::Error::Failure(response),
10585                        });
10586                    }
10587                    let response = {
10588                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10589                        let encoded = common::to_string(&bytes);
10590                        match serde_json::from_str(&encoded) {
10591                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10592                            Err(error) => {
10593                                dlg.response_json_decode_error(&encoded, &error);
10594                                return Err(common::Error::JsonDecodeError(
10595                                    encoded.to_string(),
10596                                    error,
10597                                ));
10598                            }
10599                        }
10600                    };
10601
10602                    dlg.finished(true);
10603                    return Ok(response);
10604                }
10605            }
10606        }
10607    }
10608
10609    ///
10610    /// Sets the *request* property to the given value.
10611    ///
10612    /// Even though the property as already been set when instantiating this call,
10613    /// we provide this method for API completeness.
10614    pub fn request(
10615        mut self,
10616        new_value: SetIamPolicyRequest,
10617    ) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {
10618        self._request = new_value;
10619        self
10620    }
10621    /// 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.
10622    ///
10623    /// Sets the *resource* path property to the given value.
10624    ///
10625    /// Even though the property as already been set when instantiating this call,
10626    /// we provide this method for API completeness.
10627    pub fn resource(mut self, new_value: &str) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {
10628        self._resource = new_value.to_string();
10629        self
10630    }
10631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10632    /// while executing the actual API request.
10633    ///
10634    /// ````text
10635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10636    /// ````
10637    ///
10638    /// Sets the *delegate* property to the given value.
10639    pub fn delegate(
10640        mut self,
10641        new_value: &'a mut dyn common::Delegate,
10642    ) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {
10643        self._delegate = Some(new_value);
10644        self
10645    }
10646
10647    /// Set any additional parameter of the query string used in the request.
10648    /// It should be used to set parameters which are not yet available through their own
10649    /// setters.
10650    ///
10651    /// Please note that this method must not be used to set any of the known parameters
10652    /// which have their own setter method. If done anyway, the request will fail.
10653    ///
10654    /// # Additional Parameters
10655    ///
10656    /// * *$.xgafv* (query-string) - V1 error format.
10657    /// * *access_token* (query-string) - OAuth access token.
10658    /// * *alt* (query-string) - Data format for response.
10659    /// * *callback* (query-string) - JSONP
10660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10661    /// * *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.
10662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10664    /// * *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.
10665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10667    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C>
10668    where
10669        T: AsRef<str>,
10670    {
10671        self._additional_params
10672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10673        self
10674    }
10675
10676    /// Identifies the authorization scope for the method you are building.
10677    ///
10678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10679    /// [`Scope::CloudPlatform`].
10680    ///
10681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10682    /// tokens for more than one scope.
10683    ///
10684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10686    /// sufficient, a read-write scope will do as well.
10687    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C>
10688    where
10689        St: AsRef<str>,
10690    {
10691        self._scopes.insert(String::from(scope.as_ref()));
10692        self
10693    }
10694    /// Identifies the authorization scope(s) for the method you are building.
10695    ///
10696    /// See [`Self::add_scope()`] for details.
10697    pub fn add_scopes<I, St>(
10698        mut self,
10699        scopes: I,
10700    ) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C>
10701    where
10702        I: IntoIterator<Item = St>,
10703        St: AsRef<str>,
10704    {
10705        self._scopes
10706            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10707        self
10708    }
10709
10710    /// Removes all scopes, and no default scope will be used either.
10711    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10712    /// for details).
10713    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceSetIamPolicyCall<'a, C> {
10714        self._scopes.clear();
10715        self
10716    }
10717}
10718
10719/// 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.
10720///
10721/// A builder for the *locations.occurrences.testIamPermissions* method supported by a *project* resource.
10722/// It is not used directly, but through a [`ProjectMethods`] instance.
10723///
10724/// # Example
10725///
10726/// Instantiate a resource method builder
10727///
10728/// ```test_harness,no_run
10729/// # extern crate hyper;
10730/// # extern crate hyper_rustls;
10731/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
10732/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
10733/// # async fn dox() {
10734/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10735///
10736/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10737/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10738/// #     .with_native_roots()
10739/// #     .unwrap()
10740/// #     .https_only()
10741/// #     .enable_http2()
10742/// #     .build();
10743///
10744/// # let executor = hyper_util::rt::TokioExecutor::new();
10745/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10746/// #     secret,
10747/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10748/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10749/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10750/// #     ),
10751/// # ).build().await.unwrap();
10752///
10753/// # let client = hyper_util::client::legacy::Client::builder(
10754/// #     hyper_util::rt::TokioExecutor::new()
10755/// # )
10756/// # .build(
10757/// #     hyper_rustls::HttpsConnectorBuilder::new()
10758/// #         .with_native_roots()
10759/// #         .unwrap()
10760/// #         .https_or_http()
10761/// #         .enable_http2()
10762/// #         .build()
10763/// # );
10764/// # let mut hub = ContainerAnalysis::new(client, auth);
10765/// // As the method needs a request, you would usually fill it with the desired information
10766/// // into the respective structure. Some of the parts shown here might not be applicable !
10767/// // Values shown here are possibly random and not representative !
10768/// let mut req = TestIamPermissionsRequest::default();
10769///
10770/// // You can configure optional parameters by calling the respective setters at will, and
10771/// // execute the final call using `doit()`.
10772/// // Values shown here are possibly random and not representative !
10773/// let result = hub.projects().locations_occurrences_test_iam_permissions(req, "resource")
10774///              .doit().await;
10775/// # }
10776/// ```
10777pub struct ProjectLocationOccurrenceTestIamPermissionCall<'a, C>
10778where
10779    C: 'a,
10780{
10781    hub: &'a ContainerAnalysis<C>,
10782    _request: TestIamPermissionsRequest,
10783    _resource: String,
10784    _delegate: Option<&'a mut dyn common::Delegate>,
10785    _additional_params: HashMap<String, String>,
10786    _scopes: BTreeSet<String>,
10787}
10788
10789impl<'a, C> common::CallBuilder for ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {}
10790
10791impl<'a, C> ProjectLocationOccurrenceTestIamPermissionCall<'a, C>
10792where
10793    C: common::Connector,
10794{
10795    /// Perform the operation you have build so far.
10796    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
10797        use std::borrow::Cow;
10798        use std::io::{Read, Seek};
10799
10800        use common::{url::Params, ToParts};
10801        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10802
10803        let mut dd = common::DefaultDelegate;
10804        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10805        dlg.begin(common::MethodInfo {
10806            id: "containeranalysis.projects.locations.occurrences.testIamPermissions",
10807            http_method: hyper::Method::POST,
10808        });
10809
10810        for &field in ["alt", "resource"].iter() {
10811            if self._additional_params.contains_key(field) {
10812                dlg.finished(false);
10813                return Err(common::Error::FieldClash(field));
10814            }
10815        }
10816
10817        let mut params = Params::with_capacity(4 + self._additional_params.len());
10818        params.push("resource", self._resource);
10819
10820        params.extend(self._additional_params.iter());
10821
10822        params.push("alt", "json");
10823        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
10824        if self._scopes.is_empty() {
10825            self._scopes
10826                .insert(Scope::CloudPlatform.as_ref().to_string());
10827        }
10828
10829        #[allow(clippy::single_element_loop)]
10830        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10831            url = params.uri_replacement(url, param_name, find_this, true);
10832        }
10833        {
10834            let to_remove = ["resource"];
10835            params.remove_params(&to_remove);
10836        }
10837
10838        let url = params.parse_with_url(&url);
10839
10840        let mut json_mime_type = mime::APPLICATION_JSON;
10841        let mut request_value_reader = {
10842            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10843            common::remove_json_null_values(&mut value);
10844            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10845            serde_json::to_writer(&mut dst, &value).unwrap();
10846            dst
10847        };
10848        let request_size = request_value_reader
10849            .seek(std::io::SeekFrom::End(0))
10850            .unwrap();
10851        request_value_reader
10852            .seek(std::io::SeekFrom::Start(0))
10853            .unwrap();
10854
10855        loop {
10856            let token = match self
10857                .hub
10858                .auth
10859                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10860                .await
10861            {
10862                Ok(token) => token,
10863                Err(e) => match dlg.token(e) {
10864                    Ok(token) => token,
10865                    Err(e) => {
10866                        dlg.finished(false);
10867                        return Err(common::Error::MissingToken(e));
10868                    }
10869                },
10870            };
10871            request_value_reader
10872                .seek(std::io::SeekFrom::Start(0))
10873                .unwrap();
10874            let mut req_result = {
10875                let client = &self.hub.client;
10876                dlg.pre_request();
10877                let mut req_builder = hyper::Request::builder()
10878                    .method(hyper::Method::POST)
10879                    .uri(url.as_str())
10880                    .header(USER_AGENT, self.hub._user_agent.clone());
10881
10882                if let Some(token) = token.as_ref() {
10883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10884                }
10885
10886                let request = req_builder
10887                    .header(CONTENT_TYPE, json_mime_type.to_string())
10888                    .header(CONTENT_LENGTH, request_size as u64)
10889                    .body(common::to_body(
10890                        request_value_reader.get_ref().clone().into(),
10891                    ));
10892
10893                client.request(request.unwrap()).await
10894            };
10895
10896            match req_result {
10897                Err(err) => {
10898                    if let common::Retry::After(d) = dlg.http_error(&err) {
10899                        sleep(d).await;
10900                        continue;
10901                    }
10902                    dlg.finished(false);
10903                    return Err(common::Error::HttpError(err));
10904                }
10905                Ok(res) => {
10906                    let (mut parts, body) = res.into_parts();
10907                    let mut body = common::Body::new(body);
10908                    if !parts.status.is_success() {
10909                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10910                        let error = serde_json::from_str(&common::to_string(&bytes));
10911                        let response = common::to_response(parts, bytes.into());
10912
10913                        if let common::Retry::After(d) =
10914                            dlg.http_failure(&response, error.as_ref().ok())
10915                        {
10916                            sleep(d).await;
10917                            continue;
10918                        }
10919
10920                        dlg.finished(false);
10921
10922                        return Err(match error {
10923                            Ok(value) => common::Error::BadRequest(value),
10924                            _ => common::Error::Failure(response),
10925                        });
10926                    }
10927                    let response = {
10928                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10929                        let encoded = common::to_string(&bytes);
10930                        match serde_json::from_str(&encoded) {
10931                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10932                            Err(error) => {
10933                                dlg.response_json_decode_error(&encoded, &error);
10934                                return Err(common::Error::JsonDecodeError(
10935                                    encoded.to_string(),
10936                                    error,
10937                                ));
10938                            }
10939                        }
10940                    };
10941
10942                    dlg.finished(true);
10943                    return Ok(response);
10944                }
10945            }
10946        }
10947    }
10948
10949    ///
10950    /// Sets the *request* property to the given value.
10951    ///
10952    /// Even though the property as already been set when instantiating this call,
10953    /// we provide this method for API completeness.
10954    pub fn request(
10955        mut self,
10956        new_value: TestIamPermissionsRequest,
10957    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {
10958        self._request = new_value;
10959        self
10960    }
10961    /// 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.
10962    ///
10963    /// Sets the *resource* path property to the given value.
10964    ///
10965    /// Even though the property as already been set when instantiating this call,
10966    /// we provide this method for API completeness.
10967    pub fn resource(
10968        mut self,
10969        new_value: &str,
10970    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {
10971        self._resource = new_value.to_string();
10972        self
10973    }
10974    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10975    /// while executing the actual API request.
10976    ///
10977    /// ````text
10978    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10979    /// ````
10980    ///
10981    /// Sets the *delegate* property to the given value.
10982    pub fn delegate(
10983        mut self,
10984        new_value: &'a mut dyn common::Delegate,
10985    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {
10986        self._delegate = Some(new_value);
10987        self
10988    }
10989
10990    /// Set any additional parameter of the query string used in the request.
10991    /// It should be used to set parameters which are not yet available through their own
10992    /// setters.
10993    ///
10994    /// Please note that this method must not be used to set any of the known parameters
10995    /// which have their own setter method. If done anyway, the request will fail.
10996    ///
10997    /// # Additional Parameters
10998    ///
10999    /// * *$.xgafv* (query-string) - V1 error format.
11000    /// * *access_token* (query-string) - OAuth access token.
11001    /// * *alt* (query-string) - Data format for response.
11002    /// * *callback* (query-string) - JSONP
11003    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11004    /// * *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.
11005    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11006    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11007    /// * *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.
11008    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11009    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11010    pub fn param<T>(
11011        mut self,
11012        name: T,
11013        value: T,
11014    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C>
11015    where
11016        T: AsRef<str>,
11017    {
11018        self._additional_params
11019            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11020        self
11021    }
11022
11023    /// Identifies the authorization scope for the method you are building.
11024    ///
11025    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11026    /// [`Scope::CloudPlatform`].
11027    ///
11028    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11029    /// tokens for more than one scope.
11030    ///
11031    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11032    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11033    /// sufficient, a read-write scope will do as well.
11034    pub fn add_scope<St>(
11035        mut self,
11036        scope: St,
11037    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C>
11038    where
11039        St: AsRef<str>,
11040    {
11041        self._scopes.insert(String::from(scope.as_ref()));
11042        self
11043    }
11044    /// Identifies the authorization scope(s) for the method you are building.
11045    ///
11046    /// See [`Self::add_scope()`] for details.
11047    pub fn add_scopes<I, St>(
11048        mut self,
11049        scopes: I,
11050    ) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C>
11051    where
11052        I: IntoIterator<Item = St>,
11053        St: AsRef<str>,
11054    {
11055        self._scopes
11056            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11057        self
11058    }
11059
11060    /// Removes all scopes, and no default scope will be used either.
11061    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11062    /// for details).
11063    pub fn clear_scopes(mut self) -> ProjectLocationOccurrenceTestIamPermissionCall<'a, C> {
11064        self._scopes.clear();
11065        self
11066    }
11067}
11068
11069/// Generates an SBOM and other dependency information for the given resource.
11070///
11071/// A builder for the *locations.resources.exportSBOM* method supported by a *project* resource.
11072/// It is not used directly, but through a [`ProjectMethods`] instance.
11073///
11074/// # Example
11075///
11076/// Instantiate a resource method builder
11077///
11078/// ```test_harness,no_run
11079/// # extern crate hyper;
11080/// # extern crate hyper_rustls;
11081/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11082/// use containeranalysis1_beta1::api::ExportSBOMRequest;
11083/// # async fn dox() {
11084/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11085///
11086/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11087/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11088/// #     .with_native_roots()
11089/// #     .unwrap()
11090/// #     .https_only()
11091/// #     .enable_http2()
11092/// #     .build();
11093///
11094/// # let executor = hyper_util::rt::TokioExecutor::new();
11095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11096/// #     secret,
11097/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11098/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11099/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11100/// #     ),
11101/// # ).build().await.unwrap();
11102///
11103/// # let client = hyper_util::client::legacy::Client::builder(
11104/// #     hyper_util::rt::TokioExecutor::new()
11105/// # )
11106/// # .build(
11107/// #     hyper_rustls::HttpsConnectorBuilder::new()
11108/// #         .with_native_roots()
11109/// #         .unwrap()
11110/// #         .https_or_http()
11111/// #         .enable_http2()
11112/// #         .build()
11113/// # );
11114/// # let mut hub = ContainerAnalysis::new(client, auth);
11115/// // As the method needs a request, you would usually fill it with the desired information
11116/// // into the respective structure. Some of the parts shown here might not be applicable !
11117/// // Values shown here are possibly random and not representative !
11118/// let mut req = ExportSBOMRequest::default();
11119///
11120/// // You can configure optional parameters by calling the respective setters at will, and
11121/// // execute the final call using `doit()`.
11122/// // Values shown here are possibly random and not representative !
11123/// let result = hub.projects().locations_resources_export_sbom(req, "name")
11124///              .doit().await;
11125/// # }
11126/// ```
11127pub struct ProjectLocationResourceExportSBOMCall<'a, C>
11128where
11129    C: 'a,
11130{
11131    hub: &'a ContainerAnalysis<C>,
11132    _request: ExportSBOMRequest,
11133    _name: String,
11134    _delegate: Option<&'a mut dyn common::Delegate>,
11135    _additional_params: HashMap<String, String>,
11136    _scopes: BTreeSet<String>,
11137}
11138
11139impl<'a, C> common::CallBuilder for ProjectLocationResourceExportSBOMCall<'a, C> {}
11140
11141impl<'a, C> ProjectLocationResourceExportSBOMCall<'a, C>
11142where
11143    C: common::Connector,
11144{
11145    /// Perform the operation you have build so far.
11146    pub async fn doit(mut self) -> common::Result<(common::Response, ExportSBOMResponse)> {
11147        use std::borrow::Cow;
11148        use std::io::{Read, Seek};
11149
11150        use common::{url::Params, ToParts};
11151        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11152
11153        let mut dd = common::DefaultDelegate;
11154        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11155        dlg.begin(common::MethodInfo {
11156            id: "containeranalysis.projects.locations.resources.exportSBOM",
11157            http_method: hyper::Method::POST,
11158        });
11159
11160        for &field in ["alt", "name"].iter() {
11161            if self._additional_params.contains_key(field) {
11162                dlg.finished(false);
11163                return Err(common::Error::FieldClash(field));
11164            }
11165        }
11166
11167        let mut params = Params::with_capacity(4 + self._additional_params.len());
11168        params.push("name", self._name);
11169
11170        params.extend(self._additional_params.iter());
11171
11172        params.push("alt", "json");
11173        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:exportSBOM";
11174        if self._scopes.is_empty() {
11175            self._scopes
11176                .insert(Scope::CloudPlatform.as_ref().to_string());
11177        }
11178
11179        #[allow(clippy::single_element_loop)]
11180        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11181            url = params.uri_replacement(url, param_name, find_this, true);
11182        }
11183        {
11184            let to_remove = ["name"];
11185            params.remove_params(&to_remove);
11186        }
11187
11188        let url = params.parse_with_url(&url);
11189
11190        let mut json_mime_type = mime::APPLICATION_JSON;
11191        let mut request_value_reader = {
11192            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11193            common::remove_json_null_values(&mut value);
11194            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11195            serde_json::to_writer(&mut dst, &value).unwrap();
11196            dst
11197        };
11198        let request_size = request_value_reader
11199            .seek(std::io::SeekFrom::End(0))
11200            .unwrap();
11201        request_value_reader
11202            .seek(std::io::SeekFrom::Start(0))
11203            .unwrap();
11204
11205        loop {
11206            let token = match self
11207                .hub
11208                .auth
11209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11210                .await
11211            {
11212                Ok(token) => token,
11213                Err(e) => match dlg.token(e) {
11214                    Ok(token) => token,
11215                    Err(e) => {
11216                        dlg.finished(false);
11217                        return Err(common::Error::MissingToken(e));
11218                    }
11219                },
11220            };
11221            request_value_reader
11222                .seek(std::io::SeekFrom::Start(0))
11223                .unwrap();
11224            let mut req_result = {
11225                let client = &self.hub.client;
11226                dlg.pre_request();
11227                let mut req_builder = hyper::Request::builder()
11228                    .method(hyper::Method::POST)
11229                    .uri(url.as_str())
11230                    .header(USER_AGENT, self.hub._user_agent.clone());
11231
11232                if let Some(token) = token.as_ref() {
11233                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11234                }
11235
11236                let request = req_builder
11237                    .header(CONTENT_TYPE, json_mime_type.to_string())
11238                    .header(CONTENT_LENGTH, request_size as u64)
11239                    .body(common::to_body(
11240                        request_value_reader.get_ref().clone().into(),
11241                    ));
11242
11243                client.request(request.unwrap()).await
11244            };
11245
11246            match req_result {
11247                Err(err) => {
11248                    if let common::Retry::After(d) = dlg.http_error(&err) {
11249                        sleep(d).await;
11250                        continue;
11251                    }
11252                    dlg.finished(false);
11253                    return Err(common::Error::HttpError(err));
11254                }
11255                Ok(res) => {
11256                    let (mut parts, body) = res.into_parts();
11257                    let mut body = common::Body::new(body);
11258                    if !parts.status.is_success() {
11259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11260                        let error = serde_json::from_str(&common::to_string(&bytes));
11261                        let response = common::to_response(parts, bytes.into());
11262
11263                        if let common::Retry::After(d) =
11264                            dlg.http_failure(&response, error.as_ref().ok())
11265                        {
11266                            sleep(d).await;
11267                            continue;
11268                        }
11269
11270                        dlg.finished(false);
11271
11272                        return Err(match error {
11273                            Ok(value) => common::Error::BadRequest(value),
11274                            _ => common::Error::Failure(response),
11275                        });
11276                    }
11277                    let response = {
11278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11279                        let encoded = common::to_string(&bytes);
11280                        match serde_json::from_str(&encoded) {
11281                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11282                            Err(error) => {
11283                                dlg.response_json_decode_error(&encoded, &error);
11284                                return Err(common::Error::JsonDecodeError(
11285                                    encoded.to_string(),
11286                                    error,
11287                                ));
11288                            }
11289                        }
11290                    };
11291
11292                    dlg.finished(true);
11293                    return Ok(response);
11294                }
11295            }
11296        }
11297    }
11298
11299    ///
11300    /// Sets the *request* property to the given value.
11301    ///
11302    /// Even though the property as already been set when instantiating this call,
11303    /// we provide this method for API completeness.
11304    pub fn request(
11305        mut self,
11306        new_value: ExportSBOMRequest,
11307    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
11308        self._request = new_value;
11309        self
11310    }
11311    /// Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
11312    ///
11313    /// Sets the *name* path property to the given value.
11314    ///
11315    /// Even though the property as already been set when instantiating this call,
11316    /// we provide this method for API completeness.
11317    pub fn name(mut self, new_value: &str) -> ProjectLocationResourceExportSBOMCall<'a, C> {
11318        self._name = new_value.to_string();
11319        self
11320    }
11321    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11322    /// while executing the actual API request.
11323    ///
11324    /// ````text
11325    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11326    /// ````
11327    ///
11328    /// Sets the *delegate* property to the given value.
11329    pub fn delegate(
11330        mut self,
11331        new_value: &'a mut dyn common::Delegate,
11332    ) -> ProjectLocationResourceExportSBOMCall<'a, C> {
11333        self._delegate = Some(new_value);
11334        self
11335    }
11336
11337    /// Set any additional parameter of the query string used in the request.
11338    /// It should be used to set parameters which are not yet available through their own
11339    /// setters.
11340    ///
11341    /// Please note that this method must not be used to set any of the known parameters
11342    /// which have their own setter method. If done anyway, the request will fail.
11343    ///
11344    /// # Additional Parameters
11345    ///
11346    /// * *$.xgafv* (query-string) - V1 error format.
11347    /// * *access_token* (query-string) - OAuth access token.
11348    /// * *alt* (query-string) - Data format for response.
11349    /// * *callback* (query-string) - JSONP
11350    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11351    /// * *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.
11352    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11353    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11354    /// * *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.
11355    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11356    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11357    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationResourceExportSBOMCall<'a, C>
11358    where
11359        T: AsRef<str>,
11360    {
11361        self._additional_params
11362            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11363        self
11364    }
11365
11366    /// Identifies the authorization scope for the method you are building.
11367    ///
11368    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11369    /// [`Scope::CloudPlatform`].
11370    ///
11371    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11372    /// tokens for more than one scope.
11373    ///
11374    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11375    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11376    /// sufficient, a read-write scope will do as well.
11377    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationResourceExportSBOMCall<'a, C>
11378    where
11379        St: AsRef<str>,
11380    {
11381        self._scopes.insert(String::from(scope.as_ref()));
11382        self
11383    }
11384    /// Identifies the authorization scope(s) for the method you are building.
11385    ///
11386    /// See [`Self::add_scope()`] for details.
11387    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationResourceExportSBOMCall<'a, C>
11388    where
11389        I: IntoIterator<Item = St>,
11390        St: AsRef<str>,
11391    {
11392        self._scopes
11393            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11394        self
11395    }
11396
11397    /// Removes all scopes, and no default scope will be used either.
11398    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11399    /// for details).
11400    pub fn clear_scopes(mut self) -> ProjectLocationResourceExportSBOMCall<'a, C> {
11401        self._scopes.clear();
11402        self
11403    }
11404}
11405
11406/// Gets a summary of the packages within a given resource.
11407///
11408/// A builder for the *locations.resources.generatePackagesSummary* method supported by a *project* resource.
11409/// It is not used directly, but through a [`ProjectMethods`] instance.
11410///
11411/// # Example
11412///
11413/// Instantiate a resource method builder
11414///
11415/// ```test_harness,no_run
11416/// # extern crate hyper;
11417/// # extern crate hyper_rustls;
11418/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11419/// use containeranalysis1_beta1::api::GeneratePackagesSummaryRequest;
11420/// # async fn dox() {
11421/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11422///
11423/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11424/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11425/// #     .with_native_roots()
11426/// #     .unwrap()
11427/// #     .https_only()
11428/// #     .enable_http2()
11429/// #     .build();
11430///
11431/// # let executor = hyper_util::rt::TokioExecutor::new();
11432/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11433/// #     secret,
11434/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11435/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11436/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11437/// #     ),
11438/// # ).build().await.unwrap();
11439///
11440/// # let client = hyper_util::client::legacy::Client::builder(
11441/// #     hyper_util::rt::TokioExecutor::new()
11442/// # )
11443/// # .build(
11444/// #     hyper_rustls::HttpsConnectorBuilder::new()
11445/// #         .with_native_roots()
11446/// #         .unwrap()
11447/// #         .https_or_http()
11448/// #         .enable_http2()
11449/// #         .build()
11450/// # );
11451/// # let mut hub = ContainerAnalysis::new(client, auth);
11452/// // As the method needs a request, you would usually fill it with the desired information
11453/// // into the respective structure. Some of the parts shown here might not be applicable !
11454/// // Values shown here are possibly random and not representative !
11455/// let mut req = GeneratePackagesSummaryRequest::default();
11456///
11457/// // You can configure optional parameters by calling the respective setters at will, and
11458/// // execute the final call using `doit()`.
11459/// // Values shown here are possibly random and not representative !
11460/// let result = hub.projects().locations_resources_generate_packages_summary(req, "name")
11461///              .doit().await;
11462/// # }
11463/// ```
11464pub struct ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
11465where
11466    C: 'a,
11467{
11468    hub: &'a ContainerAnalysis<C>,
11469    _request: GeneratePackagesSummaryRequest,
11470    _name: String,
11471    _delegate: Option<&'a mut dyn common::Delegate>,
11472    _additional_params: HashMap<String, String>,
11473    _scopes: BTreeSet<String>,
11474}
11475
11476impl<'a, C> common::CallBuilder for ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {}
11477
11478impl<'a, C> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
11479where
11480    C: common::Connector,
11481{
11482    /// Perform the operation you have build so far.
11483    pub async fn doit(mut self) -> common::Result<(common::Response, PackagesSummaryResponse)> {
11484        use std::borrow::Cow;
11485        use std::io::{Read, Seek};
11486
11487        use common::{url::Params, ToParts};
11488        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11489
11490        let mut dd = common::DefaultDelegate;
11491        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11492        dlg.begin(common::MethodInfo {
11493            id: "containeranalysis.projects.locations.resources.generatePackagesSummary",
11494            http_method: hyper::Method::POST,
11495        });
11496
11497        for &field in ["alt", "name"].iter() {
11498            if self._additional_params.contains_key(field) {
11499                dlg.finished(false);
11500                return Err(common::Error::FieldClash(field));
11501            }
11502        }
11503
11504        let mut params = Params::with_capacity(4 + self._additional_params.len());
11505        params.push("name", self._name);
11506
11507        params.extend(self._additional_params.iter());
11508
11509        params.push("alt", "json");
11510        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:generatePackagesSummary";
11511        if self._scopes.is_empty() {
11512            self._scopes
11513                .insert(Scope::CloudPlatform.as_ref().to_string());
11514        }
11515
11516        #[allow(clippy::single_element_loop)]
11517        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11518            url = params.uri_replacement(url, param_name, find_this, true);
11519        }
11520        {
11521            let to_remove = ["name"];
11522            params.remove_params(&to_remove);
11523        }
11524
11525        let url = params.parse_with_url(&url);
11526
11527        let mut json_mime_type = mime::APPLICATION_JSON;
11528        let mut request_value_reader = {
11529            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11530            common::remove_json_null_values(&mut value);
11531            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11532            serde_json::to_writer(&mut dst, &value).unwrap();
11533            dst
11534        };
11535        let request_size = request_value_reader
11536            .seek(std::io::SeekFrom::End(0))
11537            .unwrap();
11538        request_value_reader
11539            .seek(std::io::SeekFrom::Start(0))
11540            .unwrap();
11541
11542        loop {
11543            let token = match self
11544                .hub
11545                .auth
11546                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11547                .await
11548            {
11549                Ok(token) => token,
11550                Err(e) => match dlg.token(e) {
11551                    Ok(token) => token,
11552                    Err(e) => {
11553                        dlg.finished(false);
11554                        return Err(common::Error::MissingToken(e));
11555                    }
11556                },
11557            };
11558            request_value_reader
11559                .seek(std::io::SeekFrom::Start(0))
11560                .unwrap();
11561            let mut req_result = {
11562                let client = &self.hub.client;
11563                dlg.pre_request();
11564                let mut req_builder = hyper::Request::builder()
11565                    .method(hyper::Method::POST)
11566                    .uri(url.as_str())
11567                    .header(USER_AGENT, self.hub._user_agent.clone());
11568
11569                if let Some(token) = token.as_ref() {
11570                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11571                }
11572
11573                let request = req_builder
11574                    .header(CONTENT_TYPE, json_mime_type.to_string())
11575                    .header(CONTENT_LENGTH, request_size as u64)
11576                    .body(common::to_body(
11577                        request_value_reader.get_ref().clone().into(),
11578                    ));
11579
11580                client.request(request.unwrap()).await
11581            };
11582
11583            match req_result {
11584                Err(err) => {
11585                    if let common::Retry::After(d) = dlg.http_error(&err) {
11586                        sleep(d).await;
11587                        continue;
11588                    }
11589                    dlg.finished(false);
11590                    return Err(common::Error::HttpError(err));
11591                }
11592                Ok(res) => {
11593                    let (mut parts, body) = res.into_parts();
11594                    let mut body = common::Body::new(body);
11595                    if !parts.status.is_success() {
11596                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11597                        let error = serde_json::from_str(&common::to_string(&bytes));
11598                        let response = common::to_response(parts, bytes.into());
11599
11600                        if let common::Retry::After(d) =
11601                            dlg.http_failure(&response, error.as_ref().ok())
11602                        {
11603                            sleep(d).await;
11604                            continue;
11605                        }
11606
11607                        dlg.finished(false);
11608
11609                        return Err(match error {
11610                            Ok(value) => common::Error::BadRequest(value),
11611                            _ => common::Error::Failure(response),
11612                        });
11613                    }
11614                    let response = {
11615                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11616                        let encoded = common::to_string(&bytes);
11617                        match serde_json::from_str(&encoded) {
11618                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11619                            Err(error) => {
11620                                dlg.response_json_decode_error(&encoded, &error);
11621                                return Err(common::Error::JsonDecodeError(
11622                                    encoded.to_string(),
11623                                    error,
11624                                ));
11625                            }
11626                        }
11627                    };
11628
11629                    dlg.finished(true);
11630                    return Ok(response);
11631                }
11632            }
11633        }
11634    }
11635
11636    ///
11637    /// Sets the *request* property to the given value.
11638    ///
11639    /// Even though the property as already been set when instantiating this call,
11640    /// we provide this method for API completeness.
11641    pub fn request(
11642        mut self,
11643        new_value: GeneratePackagesSummaryRequest,
11644    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
11645        self._request = new_value;
11646        self
11647    }
11648    /// Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
11649    ///
11650    /// Sets the *name* path property to the given value.
11651    ///
11652    /// Even though the property as already been set when instantiating this call,
11653    /// we provide this method for API completeness.
11654    pub fn name(
11655        mut self,
11656        new_value: &str,
11657    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
11658        self._name = new_value.to_string();
11659        self
11660    }
11661    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11662    /// while executing the actual API request.
11663    ///
11664    /// ````text
11665    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11666    /// ````
11667    ///
11668    /// Sets the *delegate* property to the given value.
11669    pub fn delegate(
11670        mut self,
11671        new_value: &'a mut dyn common::Delegate,
11672    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
11673        self._delegate = Some(new_value);
11674        self
11675    }
11676
11677    /// Set any additional parameter of the query string used in the request.
11678    /// It should be used to set parameters which are not yet available through their own
11679    /// setters.
11680    ///
11681    /// Please note that this method must not be used to set any of the known parameters
11682    /// which have their own setter method. If done anyway, the request will fail.
11683    ///
11684    /// # Additional Parameters
11685    ///
11686    /// * *$.xgafv* (query-string) - V1 error format.
11687    /// * *access_token* (query-string) - OAuth access token.
11688    /// * *alt* (query-string) - Data format for response.
11689    /// * *callback* (query-string) - JSONP
11690    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11691    /// * *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.
11692    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11693    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11694    /// * *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.
11695    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11696    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11697    pub fn param<T>(
11698        mut self,
11699        name: T,
11700        value: T,
11701    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
11702    where
11703        T: AsRef<str>,
11704    {
11705        self._additional_params
11706            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11707        self
11708    }
11709
11710    /// Identifies the authorization scope for the method you are building.
11711    ///
11712    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11713    /// [`Scope::CloudPlatform`].
11714    ///
11715    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11716    /// tokens for more than one scope.
11717    ///
11718    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11719    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11720    /// sufficient, a read-write scope will do as well.
11721    pub fn add_scope<St>(
11722        mut self,
11723        scope: St,
11724    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
11725    where
11726        St: AsRef<str>,
11727    {
11728        self._scopes.insert(String::from(scope.as_ref()));
11729        self
11730    }
11731    /// Identifies the authorization scope(s) for the method you are building.
11732    ///
11733    /// See [`Self::add_scope()`] for details.
11734    pub fn add_scopes<I, St>(
11735        mut self,
11736        scopes: I,
11737    ) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C>
11738    where
11739        I: IntoIterator<Item = St>,
11740        St: AsRef<str>,
11741    {
11742        self._scopes
11743            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11744        self
11745    }
11746
11747    /// Removes all scopes, and no default scope will be used either.
11748    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11749    /// for details).
11750    pub fn clear_scopes(mut self) -> ProjectLocationResourceGeneratePackagesSummaryCall<'a, C> {
11751        self._scopes.clear();
11752        self
11753    }
11754}
11755
11756/// Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.
11757///
11758/// A builder for the *notes.occurrences.list* method supported by a *project* resource.
11759/// It is not used directly, but through a [`ProjectMethods`] instance.
11760///
11761/// # Example
11762///
11763/// Instantiate a resource method builder
11764///
11765/// ```test_harness,no_run
11766/// # extern crate hyper;
11767/// # extern crate hyper_rustls;
11768/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
11769/// # async fn dox() {
11770/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11771///
11772/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11773/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11774/// #     .with_native_roots()
11775/// #     .unwrap()
11776/// #     .https_only()
11777/// #     .enable_http2()
11778/// #     .build();
11779///
11780/// # let executor = hyper_util::rt::TokioExecutor::new();
11781/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11782/// #     secret,
11783/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11784/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11785/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11786/// #     ),
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_http2()
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().notes_occurrences_list("name")
11805///              .page_token("et")
11806///              .page_size(-76)
11807///              .filter("erat")
11808///              .doit().await;
11809/// # }
11810/// ```
11811pub struct ProjectNoteOccurrenceListCall<'a, C>
11812where
11813    C: 'a,
11814{
11815    hub: &'a ContainerAnalysis<C>,
11816    _name: 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 ProjectNoteOccurrenceListCall<'a, C> {}
11826
11827impl<'a, C> ProjectNoteOccurrenceListCall<'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, ListNoteOccurrencesResponse)> {
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.notes.occurrences.list",
11843            http_method: hyper::Method::GET,
11844        });
11845
11846        for &field in ["alt", "name", "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("name", self._name);
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/{+name}/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 [("{+name}", "name")].iter() {
11876            url = params.uri_replacement(url, param_name, find_this, true);
11877        }
11878        {
11879            let to_remove = ["name"];
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 note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
11974    ///
11975    /// Sets the *name* 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 name(mut self, new_value: &str) -> ProjectNoteOccurrenceListCall<'a, C> {
11980        self._name = 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) -> ProjectNoteOccurrenceListCall<'a, C> {
11987        self._page_token = Some(new_value.to_string());
11988        self
11989    }
11990    /// Number of occurrences to return in the list.
11991    ///
11992    /// Sets the *page size* query property to the given value.
11993    pub fn page_size(mut self, new_value: i32) -> ProjectNoteOccurrenceListCall<'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) -> ProjectNoteOccurrenceListCall<'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    ) -> ProjectNoteOccurrenceListCall<'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) -> ProjectNoteOccurrenceListCall<'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) -> ProjectNoteOccurrenceListCall<'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) -> ProjectNoteOccurrenceListCall<'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) -> ProjectNoteOccurrenceListCall<'a, C> {
12084        self._scopes.clear();
12085        self
12086    }
12087}
12088
12089/// Creates new notes in batch.
12090///
12091/// A builder for the *notes.batchCreate* 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::BatchCreateNotesRequest;
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 connector = hyper_rustls::HttpsConnectorBuilder::new()
12108/// #     .with_native_roots()
12109/// #     .unwrap()
12110/// #     .https_only()
12111/// #     .enable_http2()
12112/// #     .build();
12113///
12114/// # let executor = hyper_util::rt::TokioExecutor::new();
12115/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12116/// #     secret,
12117/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12118/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12119/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12120/// #     ),
12121/// # ).build().await.unwrap();
12122///
12123/// # let client = hyper_util::client::legacy::Client::builder(
12124/// #     hyper_util::rt::TokioExecutor::new()
12125/// # )
12126/// # .build(
12127/// #     hyper_rustls::HttpsConnectorBuilder::new()
12128/// #         .with_native_roots()
12129/// #         .unwrap()
12130/// #         .https_or_http()
12131/// #         .enable_http2()
12132/// #         .build()
12133/// # );
12134/// # let mut hub = ContainerAnalysis::new(client, auth);
12135/// // As the method needs a request, you would usually fill it with the desired information
12136/// // into the respective structure. Some of the parts shown here might not be applicable !
12137/// // Values shown here are possibly random and not representative !
12138/// let mut req = BatchCreateNotesRequest::default();
12139///
12140/// // You can configure optional parameters by calling the respective setters at will, and
12141/// // execute the final call using `doit()`.
12142/// // Values shown here are possibly random and not representative !
12143/// let result = hub.projects().notes_batch_create(req, "parent")
12144///              .doit().await;
12145/// # }
12146/// ```
12147pub struct ProjectNoteBatchCreateCall<'a, C>
12148where
12149    C: 'a,
12150{
12151    hub: &'a ContainerAnalysis<C>,
12152    _request: BatchCreateNotesRequest,
12153    _parent: String,
12154    _delegate: Option<&'a mut dyn common::Delegate>,
12155    _additional_params: HashMap<String, String>,
12156    _scopes: BTreeSet<String>,
12157}
12158
12159impl<'a, C> common::CallBuilder for ProjectNoteBatchCreateCall<'a, C> {}
12160
12161impl<'a, C> ProjectNoteBatchCreateCall<'a, C>
12162where
12163    C: common::Connector,
12164{
12165    /// Perform the operation you have build so far.
12166    pub async fn doit(mut self) -> common::Result<(common::Response, BatchCreateNotesResponse)> {
12167        use std::borrow::Cow;
12168        use std::io::{Read, Seek};
12169
12170        use common::{url::Params, ToParts};
12171        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12172
12173        let mut dd = common::DefaultDelegate;
12174        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12175        dlg.begin(common::MethodInfo {
12176            id: "containeranalysis.projects.notes.batchCreate",
12177            http_method: hyper::Method::POST,
12178        });
12179
12180        for &field in ["alt", "parent"].iter() {
12181            if self._additional_params.contains_key(field) {
12182                dlg.finished(false);
12183                return Err(common::Error::FieldClash(field));
12184            }
12185        }
12186
12187        let mut params = Params::with_capacity(4 + self._additional_params.len());
12188        params.push("parent", self._parent);
12189
12190        params.extend(self._additional_params.iter());
12191
12192        params.push("alt", "json");
12193        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes:batchCreate";
12194        if self._scopes.is_empty() {
12195            self._scopes
12196                .insert(Scope::CloudPlatform.as_ref().to_string());
12197        }
12198
12199        #[allow(clippy::single_element_loop)]
12200        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12201            url = params.uri_replacement(url, param_name, find_this, true);
12202        }
12203        {
12204            let to_remove = ["parent"];
12205            params.remove_params(&to_remove);
12206        }
12207
12208        let url = params.parse_with_url(&url);
12209
12210        let mut json_mime_type = mime::APPLICATION_JSON;
12211        let mut request_value_reader = {
12212            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12213            common::remove_json_null_values(&mut value);
12214            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12215            serde_json::to_writer(&mut dst, &value).unwrap();
12216            dst
12217        };
12218        let request_size = request_value_reader
12219            .seek(std::io::SeekFrom::End(0))
12220            .unwrap();
12221        request_value_reader
12222            .seek(std::io::SeekFrom::Start(0))
12223            .unwrap();
12224
12225        loop {
12226            let token = match self
12227                .hub
12228                .auth
12229                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12230                .await
12231            {
12232                Ok(token) => token,
12233                Err(e) => match dlg.token(e) {
12234                    Ok(token) => token,
12235                    Err(e) => {
12236                        dlg.finished(false);
12237                        return Err(common::Error::MissingToken(e));
12238                    }
12239                },
12240            };
12241            request_value_reader
12242                .seek(std::io::SeekFrom::Start(0))
12243                .unwrap();
12244            let mut req_result = {
12245                let client = &self.hub.client;
12246                dlg.pre_request();
12247                let mut req_builder = hyper::Request::builder()
12248                    .method(hyper::Method::POST)
12249                    .uri(url.as_str())
12250                    .header(USER_AGENT, self.hub._user_agent.clone());
12251
12252                if let Some(token) = token.as_ref() {
12253                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12254                }
12255
12256                let request = req_builder
12257                    .header(CONTENT_TYPE, json_mime_type.to_string())
12258                    .header(CONTENT_LENGTH, request_size as u64)
12259                    .body(common::to_body(
12260                        request_value_reader.get_ref().clone().into(),
12261                    ));
12262
12263                client.request(request.unwrap()).await
12264            };
12265
12266            match req_result {
12267                Err(err) => {
12268                    if let common::Retry::After(d) = dlg.http_error(&err) {
12269                        sleep(d).await;
12270                        continue;
12271                    }
12272                    dlg.finished(false);
12273                    return Err(common::Error::HttpError(err));
12274                }
12275                Ok(res) => {
12276                    let (mut parts, body) = res.into_parts();
12277                    let mut body = common::Body::new(body);
12278                    if !parts.status.is_success() {
12279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12280                        let error = serde_json::from_str(&common::to_string(&bytes));
12281                        let response = common::to_response(parts, bytes.into());
12282
12283                        if let common::Retry::After(d) =
12284                            dlg.http_failure(&response, error.as_ref().ok())
12285                        {
12286                            sleep(d).await;
12287                            continue;
12288                        }
12289
12290                        dlg.finished(false);
12291
12292                        return Err(match error {
12293                            Ok(value) => common::Error::BadRequest(value),
12294                            _ => common::Error::Failure(response),
12295                        });
12296                    }
12297                    let response = {
12298                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12299                        let encoded = common::to_string(&bytes);
12300                        match serde_json::from_str(&encoded) {
12301                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12302                            Err(error) => {
12303                                dlg.response_json_decode_error(&encoded, &error);
12304                                return Err(common::Error::JsonDecodeError(
12305                                    encoded.to_string(),
12306                                    error,
12307                                ));
12308                            }
12309                        }
12310                    };
12311
12312                    dlg.finished(true);
12313                    return Ok(response);
12314                }
12315            }
12316        }
12317    }
12318
12319    ///
12320    /// Sets the *request* property to the given value.
12321    ///
12322    /// Even though the property as already been set when instantiating this call,
12323    /// we provide this method for API completeness.
12324    pub fn request(
12325        mut self,
12326        new_value: BatchCreateNotesRequest,
12327    ) -> ProjectNoteBatchCreateCall<'a, C> {
12328        self._request = new_value;
12329        self
12330    }
12331    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created.
12332    ///
12333    /// Sets the *parent* path property to the given value.
12334    ///
12335    /// Even though the property as already been set when instantiating this call,
12336    /// we provide this method for API completeness.
12337    pub fn parent(mut self, new_value: &str) -> ProjectNoteBatchCreateCall<'a, C> {
12338        self._parent = new_value.to_string();
12339        self
12340    }
12341    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12342    /// while executing the actual API request.
12343    ///
12344    /// ````text
12345    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12346    /// ````
12347    ///
12348    /// Sets the *delegate* property to the given value.
12349    pub fn delegate(
12350        mut self,
12351        new_value: &'a mut dyn common::Delegate,
12352    ) -> ProjectNoteBatchCreateCall<'a, C> {
12353        self._delegate = Some(new_value);
12354        self
12355    }
12356
12357    /// Set any additional parameter of the query string used in the request.
12358    /// It should be used to set parameters which are not yet available through their own
12359    /// setters.
12360    ///
12361    /// Please note that this method must not be used to set any of the known parameters
12362    /// which have their own setter method. If done anyway, the request will fail.
12363    ///
12364    /// # Additional Parameters
12365    ///
12366    /// * *$.xgafv* (query-string) - V1 error format.
12367    /// * *access_token* (query-string) - OAuth access token.
12368    /// * *alt* (query-string) - Data format for response.
12369    /// * *callback* (query-string) - JSONP
12370    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12371    /// * *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.
12372    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12373    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12374    /// * *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.
12375    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12376    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12377    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteBatchCreateCall<'a, C>
12378    where
12379        T: AsRef<str>,
12380    {
12381        self._additional_params
12382            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12383        self
12384    }
12385
12386    /// Identifies the authorization scope for the method you are building.
12387    ///
12388    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12389    /// [`Scope::CloudPlatform`].
12390    ///
12391    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12392    /// tokens for more than one scope.
12393    ///
12394    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12395    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12396    /// sufficient, a read-write scope will do as well.
12397    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteBatchCreateCall<'a, C>
12398    where
12399        St: AsRef<str>,
12400    {
12401        self._scopes.insert(String::from(scope.as_ref()));
12402        self
12403    }
12404    /// Identifies the authorization scope(s) for the method you are building.
12405    ///
12406    /// See [`Self::add_scope()`] for details.
12407    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteBatchCreateCall<'a, C>
12408    where
12409        I: IntoIterator<Item = St>,
12410        St: AsRef<str>,
12411    {
12412        self._scopes
12413            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12414        self
12415    }
12416
12417    /// Removes all scopes, and no default scope will be used either.
12418    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12419    /// for details).
12420    pub fn clear_scopes(mut self) -> ProjectNoteBatchCreateCall<'a, C> {
12421        self._scopes.clear();
12422        self
12423    }
12424}
12425
12426/// Creates a new note.
12427///
12428/// A builder for the *notes.create* method supported by a *project* resource.
12429/// It is not used directly, but through a [`ProjectMethods`] instance.
12430///
12431/// # Example
12432///
12433/// Instantiate a resource method builder
12434///
12435/// ```test_harness,no_run
12436/// # extern crate hyper;
12437/// # extern crate hyper_rustls;
12438/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
12439/// use containeranalysis1_beta1::api::Note;
12440/// # async fn dox() {
12441/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12442///
12443/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12444/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12445/// #     .with_native_roots()
12446/// #     .unwrap()
12447/// #     .https_only()
12448/// #     .enable_http2()
12449/// #     .build();
12450///
12451/// # let executor = hyper_util::rt::TokioExecutor::new();
12452/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12453/// #     secret,
12454/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12455/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12456/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12457/// #     ),
12458/// # ).build().await.unwrap();
12459///
12460/// # let client = hyper_util::client::legacy::Client::builder(
12461/// #     hyper_util::rt::TokioExecutor::new()
12462/// # )
12463/// # .build(
12464/// #     hyper_rustls::HttpsConnectorBuilder::new()
12465/// #         .with_native_roots()
12466/// #         .unwrap()
12467/// #         .https_or_http()
12468/// #         .enable_http2()
12469/// #         .build()
12470/// # );
12471/// # let mut hub = ContainerAnalysis::new(client, auth);
12472/// // As the method needs a request, you would usually fill it with the desired information
12473/// // into the respective structure. Some of the parts shown here might not be applicable !
12474/// // Values shown here are possibly random and not representative !
12475/// let mut req = Note::default();
12476///
12477/// // You can configure optional parameters by calling the respective setters at will, and
12478/// // execute the final call using `doit()`.
12479/// // Values shown here are possibly random and not representative !
12480/// let result = hub.projects().notes_create(req, "parent")
12481///              .note_id("dolore")
12482///              .doit().await;
12483/// # }
12484/// ```
12485pub struct ProjectNoteCreateCall<'a, C>
12486where
12487    C: 'a,
12488{
12489    hub: &'a ContainerAnalysis<C>,
12490    _request: Note,
12491    _parent: String,
12492    _note_id: Option<String>,
12493    _delegate: Option<&'a mut dyn common::Delegate>,
12494    _additional_params: HashMap<String, String>,
12495    _scopes: BTreeSet<String>,
12496}
12497
12498impl<'a, C> common::CallBuilder for ProjectNoteCreateCall<'a, C> {}
12499
12500impl<'a, C> ProjectNoteCreateCall<'a, C>
12501where
12502    C: common::Connector,
12503{
12504    /// Perform the operation you have build so far.
12505    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
12506        use std::borrow::Cow;
12507        use std::io::{Read, Seek};
12508
12509        use common::{url::Params, ToParts};
12510        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12511
12512        let mut dd = common::DefaultDelegate;
12513        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12514        dlg.begin(common::MethodInfo {
12515            id: "containeranalysis.projects.notes.create",
12516            http_method: hyper::Method::POST,
12517        });
12518
12519        for &field in ["alt", "parent", "noteId"].iter() {
12520            if self._additional_params.contains_key(field) {
12521                dlg.finished(false);
12522                return Err(common::Error::FieldClash(field));
12523            }
12524        }
12525
12526        let mut params = Params::with_capacity(5 + self._additional_params.len());
12527        params.push("parent", self._parent);
12528        if let Some(value) = self._note_id.as_ref() {
12529            params.push("noteId", value);
12530        }
12531
12532        params.extend(self._additional_params.iter());
12533
12534        params.push("alt", "json");
12535        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
12536        if self._scopes.is_empty() {
12537            self._scopes
12538                .insert(Scope::CloudPlatform.as_ref().to_string());
12539        }
12540
12541        #[allow(clippy::single_element_loop)]
12542        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12543            url = params.uri_replacement(url, param_name, find_this, true);
12544        }
12545        {
12546            let to_remove = ["parent"];
12547            params.remove_params(&to_remove);
12548        }
12549
12550        let url = params.parse_with_url(&url);
12551
12552        let mut json_mime_type = mime::APPLICATION_JSON;
12553        let mut request_value_reader = {
12554            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12555            common::remove_json_null_values(&mut value);
12556            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12557            serde_json::to_writer(&mut dst, &value).unwrap();
12558            dst
12559        };
12560        let request_size = request_value_reader
12561            .seek(std::io::SeekFrom::End(0))
12562            .unwrap();
12563        request_value_reader
12564            .seek(std::io::SeekFrom::Start(0))
12565            .unwrap();
12566
12567        loop {
12568            let token = match self
12569                .hub
12570                .auth
12571                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12572                .await
12573            {
12574                Ok(token) => token,
12575                Err(e) => match dlg.token(e) {
12576                    Ok(token) => token,
12577                    Err(e) => {
12578                        dlg.finished(false);
12579                        return Err(common::Error::MissingToken(e));
12580                    }
12581                },
12582            };
12583            request_value_reader
12584                .seek(std::io::SeekFrom::Start(0))
12585                .unwrap();
12586            let mut req_result = {
12587                let client = &self.hub.client;
12588                dlg.pre_request();
12589                let mut req_builder = hyper::Request::builder()
12590                    .method(hyper::Method::POST)
12591                    .uri(url.as_str())
12592                    .header(USER_AGENT, self.hub._user_agent.clone());
12593
12594                if let Some(token) = token.as_ref() {
12595                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12596                }
12597
12598                let request = req_builder
12599                    .header(CONTENT_TYPE, json_mime_type.to_string())
12600                    .header(CONTENT_LENGTH, request_size as u64)
12601                    .body(common::to_body(
12602                        request_value_reader.get_ref().clone().into(),
12603                    ));
12604
12605                client.request(request.unwrap()).await
12606            };
12607
12608            match req_result {
12609                Err(err) => {
12610                    if let common::Retry::After(d) = dlg.http_error(&err) {
12611                        sleep(d).await;
12612                        continue;
12613                    }
12614                    dlg.finished(false);
12615                    return Err(common::Error::HttpError(err));
12616                }
12617                Ok(res) => {
12618                    let (mut parts, body) = res.into_parts();
12619                    let mut body = common::Body::new(body);
12620                    if !parts.status.is_success() {
12621                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12622                        let error = serde_json::from_str(&common::to_string(&bytes));
12623                        let response = common::to_response(parts, bytes.into());
12624
12625                        if let common::Retry::After(d) =
12626                            dlg.http_failure(&response, error.as_ref().ok())
12627                        {
12628                            sleep(d).await;
12629                            continue;
12630                        }
12631
12632                        dlg.finished(false);
12633
12634                        return Err(match error {
12635                            Ok(value) => common::Error::BadRequest(value),
12636                            _ => common::Error::Failure(response),
12637                        });
12638                    }
12639                    let response = {
12640                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12641                        let encoded = common::to_string(&bytes);
12642                        match serde_json::from_str(&encoded) {
12643                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12644                            Err(error) => {
12645                                dlg.response_json_decode_error(&encoded, &error);
12646                                return Err(common::Error::JsonDecodeError(
12647                                    encoded.to_string(),
12648                                    error,
12649                                ));
12650                            }
12651                        }
12652                    };
12653
12654                    dlg.finished(true);
12655                    return Ok(response);
12656                }
12657            }
12658        }
12659    }
12660
12661    ///
12662    /// Sets the *request* property to the given value.
12663    ///
12664    /// Even though the property as already been set when instantiating this call,
12665    /// we provide this method for API completeness.
12666    pub fn request(mut self, new_value: Note) -> ProjectNoteCreateCall<'a, C> {
12667        self._request = new_value;
12668        self
12669    }
12670    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created.
12671    ///
12672    /// Sets the *parent* path property to the given value.
12673    ///
12674    /// Even though the property as already been set when instantiating this call,
12675    /// we provide this method for API completeness.
12676    pub fn parent(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C> {
12677        self._parent = new_value.to_string();
12678        self
12679    }
12680    /// Required. The ID to use for this note.
12681    ///
12682    /// Sets the *note id* query property to the given value.
12683    pub fn note_id(mut self, new_value: &str) -> ProjectNoteCreateCall<'a, C> {
12684        self._note_id = Some(new_value.to_string());
12685        self
12686    }
12687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12688    /// while executing the actual API request.
12689    ///
12690    /// ````text
12691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12692    /// ````
12693    ///
12694    /// Sets the *delegate* property to the given value.
12695    pub fn delegate(
12696        mut self,
12697        new_value: &'a mut dyn common::Delegate,
12698    ) -> ProjectNoteCreateCall<'a, C> {
12699        self._delegate = Some(new_value);
12700        self
12701    }
12702
12703    /// Set any additional parameter of the query string used in the request.
12704    /// It should be used to set parameters which are not yet available through their own
12705    /// setters.
12706    ///
12707    /// Please note that this method must not be used to set any of the known parameters
12708    /// which have their own setter method. If done anyway, the request will fail.
12709    ///
12710    /// # Additional Parameters
12711    ///
12712    /// * *$.xgafv* (query-string) - V1 error format.
12713    /// * *access_token* (query-string) - OAuth access token.
12714    /// * *alt* (query-string) - Data format for response.
12715    /// * *callback* (query-string) - JSONP
12716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12717    /// * *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.
12718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12720    /// * *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.
12721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12723    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteCreateCall<'a, C>
12724    where
12725        T: AsRef<str>,
12726    {
12727        self._additional_params
12728            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12729        self
12730    }
12731
12732    /// Identifies the authorization scope for the method you are building.
12733    ///
12734    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12735    /// [`Scope::CloudPlatform`].
12736    ///
12737    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12738    /// tokens for more than one scope.
12739    ///
12740    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12741    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12742    /// sufficient, a read-write scope will do as well.
12743    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteCreateCall<'a, C>
12744    where
12745        St: AsRef<str>,
12746    {
12747        self._scopes.insert(String::from(scope.as_ref()));
12748        self
12749    }
12750    /// Identifies the authorization scope(s) for the method you are building.
12751    ///
12752    /// See [`Self::add_scope()`] for details.
12753    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteCreateCall<'a, C>
12754    where
12755        I: IntoIterator<Item = St>,
12756        St: AsRef<str>,
12757    {
12758        self._scopes
12759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12760        self
12761    }
12762
12763    /// Removes all scopes, and no default scope will be used either.
12764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12765    /// for details).
12766    pub fn clear_scopes(mut self) -> ProjectNoteCreateCall<'a, C> {
12767        self._scopes.clear();
12768        self
12769    }
12770}
12771
12772/// Deletes the specified note.
12773///
12774/// A builder for the *notes.delete* method supported by a *project* resource.
12775/// It is not used directly, but through a [`ProjectMethods`] instance.
12776///
12777/// # Example
12778///
12779/// Instantiate a resource method builder
12780///
12781/// ```test_harness,no_run
12782/// # extern crate hyper;
12783/// # extern crate hyper_rustls;
12784/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
12785/// # async fn dox() {
12786/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12787///
12788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12789/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12790/// #     .with_native_roots()
12791/// #     .unwrap()
12792/// #     .https_only()
12793/// #     .enable_http2()
12794/// #     .build();
12795///
12796/// # let executor = hyper_util::rt::TokioExecutor::new();
12797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12798/// #     secret,
12799/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12800/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12801/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12802/// #     ),
12803/// # ).build().await.unwrap();
12804///
12805/// # let client = hyper_util::client::legacy::Client::builder(
12806/// #     hyper_util::rt::TokioExecutor::new()
12807/// # )
12808/// # .build(
12809/// #     hyper_rustls::HttpsConnectorBuilder::new()
12810/// #         .with_native_roots()
12811/// #         .unwrap()
12812/// #         .https_or_http()
12813/// #         .enable_http2()
12814/// #         .build()
12815/// # );
12816/// # let mut hub = ContainerAnalysis::new(client, auth);
12817/// // You can configure optional parameters by calling the respective setters at will, and
12818/// // execute the final call using `doit()`.
12819/// // Values shown here are possibly random and not representative !
12820/// let result = hub.projects().notes_delete("name")
12821///              .doit().await;
12822/// # }
12823/// ```
12824pub struct ProjectNoteDeleteCall<'a, C>
12825where
12826    C: 'a,
12827{
12828    hub: &'a ContainerAnalysis<C>,
12829    _name: String,
12830    _delegate: Option<&'a mut dyn common::Delegate>,
12831    _additional_params: HashMap<String, String>,
12832    _scopes: BTreeSet<String>,
12833}
12834
12835impl<'a, C> common::CallBuilder for ProjectNoteDeleteCall<'a, C> {}
12836
12837impl<'a, C> ProjectNoteDeleteCall<'a, C>
12838where
12839    C: common::Connector,
12840{
12841    /// Perform the operation you have build so far.
12842    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12843        use std::borrow::Cow;
12844        use std::io::{Read, Seek};
12845
12846        use common::{url::Params, ToParts};
12847        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12848
12849        let mut dd = common::DefaultDelegate;
12850        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12851        dlg.begin(common::MethodInfo {
12852            id: "containeranalysis.projects.notes.delete",
12853            http_method: hyper::Method::DELETE,
12854        });
12855
12856        for &field in ["alt", "name"].iter() {
12857            if self._additional_params.contains_key(field) {
12858                dlg.finished(false);
12859                return Err(common::Error::FieldClash(field));
12860            }
12861        }
12862
12863        let mut params = Params::with_capacity(3 + self._additional_params.len());
12864        params.push("name", self._name);
12865
12866        params.extend(self._additional_params.iter());
12867
12868        params.push("alt", "json");
12869        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
12870        if self._scopes.is_empty() {
12871            self._scopes
12872                .insert(Scope::CloudPlatform.as_ref().to_string());
12873        }
12874
12875        #[allow(clippy::single_element_loop)]
12876        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12877            url = params.uri_replacement(url, param_name, find_this, true);
12878        }
12879        {
12880            let to_remove = ["name"];
12881            params.remove_params(&to_remove);
12882        }
12883
12884        let url = params.parse_with_url(&url);
12885
12886        loop {
12887            let token = match self
12888                .hub
12889                .auth
12890                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12891                .await
12892            {
12893                Ok(token) => token,
12894                Err(e) => match dlg.token(e) {
12895                    Ok(token) => token,
12896                    Err(e) => {
12897                        dlg.finished(false);
12898                        return Err(common::Error::MissingToken(e));
12899                    }
12900                },
12901            };
12902            let mut req_result = {
12903                let client = &self.hub.client;
12904                dlg.pre_request();
12905                let mut req_builder = hyper::Request::builder()
12906                    .method(hyper::Method::DELETE)
12907                    .uri(url.as_str())
12908                    .header(USER_AGENT, self.hub._user_agent.clone());
12909
12910                if let Some(token) = token.as_ref() {
12911                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12912                }
12913
12914                let request = req_builder
12915                    .header(CONTENT_LENGTH, 0_u64)
12916                    .body(common::to_body::<String>(None));
12917
12918                client.request(request.unwrap()).await
12919            };
12920
12921            match req_result {
12922                Err(err) => {
12923                    if let common::Retry::After(d) = dlg.http_error(&err) {
12924                        sleep(d).await;
12925                        continue;
12926                    }
12927                    dlg.finished(false);
12928                    return Err(common::Error::HttpError(err));
12929                }
12930                Ok(res) => {
12931                    let (mut parts, body) = res.into_parts();
12932                    let mut body = common::Body::new(body);
12933                    if !parts.status.is_success() {
12934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12935                        let error = serde_json::from_str(&common::to_string(&bytes));
12936                        let response = common::to_response(parts, bytes.into());
12937
12938                        if let common::Retry::After(d) =
12939                            dlg.http_failure(&response, error.as_ref().ok())
12940                        {
12941                            sleep(d).await;
12942                            continue;
12943                        }
12944
12945                        dlg.finished(false);
12946
12947                        return Err(match error {
12948                            Ok(value) => common::Error::BadRequest(value),
12949                            _ => common::Error::Failure(response),
12950                        });
12951                    }
12952                    let response = {
12953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12954                        let encoded = common::to_string(&bytes);
12955                        match serde_json::from_str(&encoded) {
12956                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12957                            Err(error) => {
12958                                dlg.response_json_decode_error(&encoded, &error);
12959                                return Err(common::Error::JsonDecodeError(
12960                                    encoded.to_string(),
12961                                    error,
12962                                ));
12963                            }
12964                        }
12965                    };
12966
12967                    dlg.finished(true);
12968                    return Ok(response);
12969                }
12970            }
12971        }
12972    }
12973
12974    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
12975    ///
12976    /// Sets the *name* path property to the given value.
12977    ///
12978    /// Even though the property as already been set when instantiating this call,
12979    /// we provide this method for API completeness.
12980    pub fn name(mut self, new_value: &str) -> ProjectNoteDeleteCall<'a, C> {
12981        self._name = new_value.to_string();
12982        self
12983    }
12984    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12985    /// while executing the actual API request.
12986    ///
12987    /// ````text
12988    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12989    /// ````
12990    ///
12991    /// Sets the *delegate* property to the given value.
12992    pub fn delegate(
12993        mut self,
12994        new_value: &'a mut dyn common::Delegate,
12995    ) -> ProjectNoteDeleteCall<'a, C> {
12996        self._delegate = Some(new_value);
12997        self
12998    }
12999
13000    /// Set any additional parameter of the query string used in the request.
13001    /// It should be used to set parameters which are not yet available through their own
13002    /// setters.
13003    ///
13004    /// Please note that this method must not be used to set any of the known parameters
13005    /// which have their own setter method. If done anyway, the request will fail.
13006    ///
13007    /// # Additional Parameters
13008    ///
13009    /// * *$.xgafv* (query-string) - V1 error format.
13010    /// * *access_token* (query-string) - OAuth access token.
13011    /// * *alt* (query-string) - Data format for response.
13012    /// * *callback* (query-string) - JSONP
13013    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13014    /// * *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.
13015    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13016    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13017    /// * *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.
13018    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13019    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13020    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteDeleteCall<'a, C>
13021    where
13022        T: AsRef<str>,
13023    {
13024        self._additional_params
13025            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13026        self
13027    }
13028
13029    /// Identifies the authorization scope for the method you are building.
13030    ///
13031    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13032    /// [`Scope::CloudPlatform`].
13033    ///
13034    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13035    /// tokens for more than one scope.
13036    ///
13037    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13038    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13039    /// sufficient, a read-write scope will do as well.
13040    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteDeleteCall<'a, C>
13041    where
13042        St: AsRef<str>,
13043    {
13044        self._scopes.insert(String::from(scope.as_ref()));
13045        self
13046    }
13047    /// Identifies the authorization scope(s) for the method you are building.
13048    ///
13049    /// See [`Self::add_scope()`] for details.
13050    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteDeleteCall<'a, C>
13051    where
13052        I: IntoIterator<Item = St>,
13053        St: AsRef<str>,
13054    {
13055        self._scopes
13056            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13057        self
13058    }
13059
13060    /// Removes all scopes, and no default scope will be used either.
13061    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13062    /// for details).
13063    pub fn clear_scopes(mut self) -> ProjectNoteDeleteCall<'a, C> {
13064        self._scopes.clear();
13065        self
13066    }
13067}
13068
13069/// Gets the specified note.
13070///
13071/// A builder for the *notes.get* method supported by a *project* resource.
13072/// It is not used directly, but through a [`ProjectMethods`] instance.
13073///
13074/// # Example
13075///
13076/// Instantiate a resource method builder
13077///
13078/// ```test_harness,no_run
13079/// # extern crate hyper;
13080/// # extern crate hyper_rustls;
13081/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
13082/// # async fn dox() {
13083/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13084///
13085/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13086/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13087/// #     .with_native_roots()
13088/// #     .unwrap()
13089/// #     .https_only()
13090/// #     .enable_http2()
13091/// #     .build();
13092///
13093/// # let executor = hyper_util::rt::TokioExecutor::new();
13094/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13095/// #     secret,
13096/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13097/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13098/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13099/// #     ),
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_http2()
13111/// #         .build()
13112/// # );
13113/// # let mut hub = ContainerAnalysis::new(client, auth);
13114/// // You can configure optional parameters by calling the respective setters at will, and
13115/// // execute the final call using `doit()`.
13116/// // Values shown here are possibly random and not representative !
13117/// let result = hub.projects().notes_get("name")
13118///              .doit().await;
13119/// # }
13120/// ```
13121pub struct ProjectNoteGetCall<'a, C>
13122where
13123    C: 'a,
13124{
13125    hub: &'a ContainerAnalysis<C>,
13126    _name: String,
13127    _delegate: Option<&'a mut dyn common::Delegate>,
13128    _additional_params: HashMap<String, String>,
13129    _scopes: BTreeSet<String>,
13130}
13131
13132impl<'a, C> common::CallBuilder for ProjectNoteGetCall<'a, C> {}
13133
13134impl<'a, C> ProjectNoteGetCall<'a, C>
13135where
13136    C: common::Connector,
13137{
13138    /// Perform the operation you have build so far.
13139    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
13140        use std::borrow::Cow;
13141        use std::io::{Read, Seek};
13142
13143        use common::{url::Params, ToParts};
13144        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13145
13146        let mut dd = common::DefaultDelegate;
13147        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13148        dlg.begin(common::MethodInfo {
13149            id: "containeranalysis.projects.notes.get",
13150            http_method: hyper::Method::GET,
13151        });
13152
13153        for &field in ["alt", "name"].iter() {
13154            if self._additional_params.contains_key(field) {
13155                dlg.finished(false);
13156                return Err(common::Error::FieldClash(field));
13157            }
13158        }
13159
13160        let mut params = Params::with_capacity(3 + self._additional_params.len());
13161        params.push("name", self._name);
13162
13163        params.extend(self._additional_params.iter());
13164
13165        params.push("alt", "json");
13166        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
13167        if self._scopes.is_empty() {
13168            self._scopes
13169                .insert(Scope::CloudPlatform.as_ref().to_string());
13170        }
13171
13172        #[allow(clippy::single_element_loop)]
13173        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13174            url = params.uri_replacement(url, param_name, find_this, true);
13175        }
13176        {
13177            let to_remove = ["name"];
13178            params.remove_params(&to_remove);
13179        }
13180
13181        let url = params.parse_with_url(&url);
13182
13183        loop {
13184            let token = match self
13185                .hub
13186                .auth
13187                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13188                .await
13189            {
13190                Ok(token) => token,
13191                Err(e) => match dlg.token(e) {
13192                    Ok(token) => token,
13193                    Err(e) => {
13194                        dlg.finished(false);
13195                        return Err(common::Error::MissingToken(e));
13196                    }
13197                },
13198            };
13199            let mut req_result = {
13200                let client = &self.hub.client;
13201                dlg.pre_request();
13202                let mut req_builder = hyper::Request::builder()
13203                    .method(hyper::Method::GET)
13204                    .uri(url.as_str())
13205                    .header(USER_AGENT, self.hub._user_agent.clone());
13206
13207                if let Some(token) = token.as_ref() {
13208                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13209                }
13210
13211                let request = req_builder
13212                    .header(CONTENT_LENGTH, 0_u64)
13213                    .body(common::to_body::<String>(None));
13214
13215                client.request(request.unwrap()).await
13216            };
13217
13218            match req_result {
13219                Err(err) => {
13220                    if let common::Retry::After(d) = dlg.http_error(&err) {
13221                        sleep(d).await;
13222                        continue;
13223                    }
13224                    dlg.finished(false);
13225                    return Err(common::Error::HttpError(err));
13226                }
13227                Ok(res) => {
13228                    let (mut parts, body) = res.into_parts();
13229                    let mut body = common::Body::new(body);
13230                    if !parts.status.is_success() {
13231                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13232                        let error = serde_json::from_str(&common::to_string(&bytes));
13233                        let response = common::to_response(parts, bytes.into());
13234
13235                        if let common::Retry::After(d) =
13236                            dlg.http_failure(&response, error.as_ref().ok())
13237                        {
13238                            sleep(d).await;
13239                            continue;
13240                        }
13241
13242                        dlg.finished(false);
13243
13244                        return Err(match error {
13245                            Ok(value) => common::Error::BadRequest(value),
13246                            _ => common::Error::Failure(response),
13247                        });
13248                    }
13249                    let response = {
13250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13251                        let encoded = common::to_string(&bytes);
13252                        match serde_json::from_str(&encoded) {
13253                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13254                            Err(error) => {
13255                                dlg.response_json_decode_error(&encoded, &error);
13256                                return Err(common::Error::JsonDecodeError(
13257                                    encoded.to_string(),
13258                                    error,
13259                                ));
13260                            }
13261                        }
13262                    };
13263
13264                    dlg.finished(true);
13265                    return Ok(response);
13266                }
13267            }
13268        }
13269    }
13270
13271    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
13272    ///
13273    /// Sets the *name* path property to the given value.
13274    ///
13275    /// Even though the property as already been set when instantiating this call,
13276    /// we provide this method for API completeness.
13277    pub fn name(mut self, new_value: &str) -> ProjectNoteGetCall<'a, C> {
13278        self._name = new_value.to_string();
13279        self
13280    }
13281    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13282    /// while executing the actual API request.
13283    ///
13284    /// ````text
13285    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13286    /// ````
13287    ///
13288    /// Sets the *delegate* property to the given value.
13289    pub fn delegate(
13290        mut self,
13291        new_value: &'a mut dyn common::Delegate,
13292    ) -> ProjectNoteGetCall<'a, C> {
13293        self._delegate = Some(new_value);
13294        self
13295    }
13296
13297    /// Set any additional parameter of the query string used in the request.
13298    /// It should be used to set parameters which are not yet available through their own
13299    /// setters.
13300    ///
13301    /// Please note that this method must not be used to set any of the known parameters
13302    /// which have their own setter method. If done anyway, the request will fail.
13303    ///
13304    /// # Additional Parameters
13305    ///
13306    /// * *$.xgafv* (query-string) - V1 error format.
13307    /// * *access_token* (query-string) - OAuth access token.
13308    /// * *alt* (query-string) - Data format for response.
13309    /// * *callback* (query-string) - JSONP
13310    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13311    /// * *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.
13312    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13313    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13314    /// * *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.
13315    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13316    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13317    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteGetCall<'a, C>
13318    where
13319        T: AsRef<str>,
13320    {
13321        self._additional_params
13322            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13323        self
13324    }
13325
13326    /// Identifies the authorization scope for the method you are building.
13327    ///
13328    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13329    /// [`Scope::CloudPlatform`].
13330    ///
13331    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13332    /// tokens for more than one scope.
13333    ///
13334    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13335    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13336    /// sufficient, a read-write scope will do as well.
13337    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteGetCall<'a, C>
13338    where
13339        St: AsRef<str>,
13340    {
13341        self._scopes.insert(String::from(scope.as_ref()));
13342        self
13343    }
13344    /// Identifies the authorization scope(s) for the method you are building.
13345    ///
13346    /// See [`Self::add_scope()`] for details.
13347    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteGetCall<'a, C>
13348    where
13349        I: IntoIterator<Item = St>,
13350        St: AsRef<str>,
13351    {
13352        self._scopes
13353            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13354        self
13355    }
13356
13357    /// Removes all scopes, and no default scope will be used either.
13358    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13359    /// for details).
13360    pub fn clear_scopes(mut self) -> ProjectNoteGetCall<'a, C> {
13361        self._scopes.clear();
13362        self
13363    }
13364}
13365
13366/// 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.
13367///
13368/// A builder for the *notes.getIamPolicy* method supported by a *project* resource.
13369/// It is not used directly, but through a [`ProjectMethods`] instance.
13370///
13371/// # Example
13372///
13373/// Instantiate a resource method builder
13374///
13375/// ```test_harness,no_run
13376/// # extern crate hyper;
13377/// # extern crate hyper_rustls;
13378/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
13379/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
13380/// # async fn dox() {
13381/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13382///
13383/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13384/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13385/// #     .with_native_roots()
13386/// #     .unwrap()
13387/// #     .https_only()
13388/// #     .enable_http2()
13389/// #     .build();
13390///
13391/// # let executor = hyper_util::rt::TokioExecutor::new();
13392/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13393/// #     secret,
13394/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13395/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13396/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13397/// #     ),
13398/// # ).build().await.unwrap();
13399///
13400/// # let client = hyper_util::client::legacy::Client::builder(
13401/// #     hyper_util::rt::TokioExecutor::new()
13402/// # )
13403/// # .build(
13404/// #     hyper_rustls::HttpsConnectorBuilder::new()
13405/// #         .with_native_roots()
13406/// #         .unwrap()
13407/// #         .https_or_http()
13408/// #         .enable_http2()
13409/// #         .build()
13410/// # );
13411/// # let mut hub = ContainerAnalysis::new(client, auth);
13412/// // As the method needs a request, you would usually fill it with the desired information
13413/// // into the respective structure. Some of the parts shown here might not be applicable !
13414/// // Values shown here are possibly random and not representative !
13415/// let mut req = GetIamPolicyRequest::default();
13416///
13417/// // You can configure optional parameters by calling the respective setters at will, and
13418/// // execute the final call using `doit()`.
13419/// // Values shown here are possibly random and not representative !
13420/// let result = hub.projects().notes_get_iam_policy(req, "resource")
13421///              .doit().await;
13422/// # }
13423/// ```
13424pub struct ProjectNoteGetIamPolicyCall<'a, C>
13425where
13426    C: 'a,
13427{
13428    hub: &'a ContainerAnalysis<C>,
13429    _request: GetIamPolicyRequest,
13430    _resource: String,
13431    _delegate: Option<&'a mut dyn common::Delegate>,
13432    _additional_params: HashMap<String, String>,
13433    _scopes: BTreeSet<String>,
13434}
13435
13436impl<'a, C> common::CallBuilder for ProjectNoteGetIamPolicyCall<'a, C> {}
13437
13438impl<'a, C> ProjectNoteGetIamPolicyCall<'a, C>
13439where
13440    C: common::Connector,
13441{
13442    /// Perform the operation you have build so far.
13443    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
13444        use std::borrow::Cow;
13445        use std::io::{Read, Seek};
13446
13447        use common::{url::Params, ToParts};
13448        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13449
13450        let mut dd = common::DefaultDelegate;
13451        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13452        dlg.begin(common::MethodInfo {
13453            id: "containeranalysis.projects.notes.getIamPolicy",
13454            http_method: hyper::Method::POST,
13455        });
13456
13457        for &field in ["alt", "resource"].iter() {
13458            if self._additional_params.contains_key(field) {
13459                dlg.finished(false);
13460                return Err(common::Error::FieldClash(field));
13461            }
13462        }
13463
13464        let mut params = Params::with_capacity(4 + self._additional_params.len());
13465        params.push("resource", self._resource);
13466
13467        params.extend(self._additional_params.iter());
13468
13469        params.push("alt", "json");
13470        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
13471        if self._scopes.is_empty() {
13472            self._scopes
13473                .insert(Scope::CloudPlatform.as_ref().to_string());
13474        }
13475
13476        #[allow(clippy::single_element_loop)]
13477        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13478            url = params.uri_replacement(url, param_name, find_this, true);
13479        }
13480        {
13481            let to_remove = ["resource"];
13482            params.remove_params(&to_remove);
13483        }
13484
13485        let url = params.parse_with_url(&url);
13486
13487        let mut json_mime_type = mime::APPLICATION_JSON;
13488        let mut request_value_reader = {
13489            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13490            common::remove_json_null_values(&mut value);
13491            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13492            serde_json::to_writer(&mut dst, &value).unwrap();
13493            dst
13494        };
13495        let request_size = request_value_reader
13496            .seek(std::io::SeekFrom::End(0))
13497            .unwrap();
13498        request_value_reader
13499            .seek(std::io::SeekFrom::Start(0))
13500            .unwrap();
13501
13502        loop {
13503            let token = match self
13504                .hub
13505                .auth
13506                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13507                .await
13508            {
13509                Ok(token) => token,
13510                Err(e) => match dlg.token(e) {
13511                    Ok(token) => token,
13512                    Err(e) => {
13513                        dlg.finished(false);
13514                        return Err(common::Error::MissingToken(e));
13515                    }
13516                },
13517            };
13518            request_value_reader
13519                .seek(std::io::SeekFrom::Start(0))
13520                .unwrap();
13521            let mut req_result = {
13522                let client = &self.hub.client;
13523                dlg.pre_request();
13524                let mut req_builder = hyper::Request::builder()
13525                    .method(hyper::Method::POST)
13526                    .uri(url.as_str())
13527                    .header(USER_AGENT, self.hub._user_agent.clone());
13528
13529                if let Some(token) = token.as_ref() {
13530                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13531                }
13532
13533                let request = req_builder
13534                    .header(CONTENT_TYPE, json_mime_type.to_string())
13535                    .header(CONTENT_LENGTH, request_size as u64)
13536                    .body(common::to_body(
13537                        request_value_reader.get_ref().clone().into(),
13538                    ));
13539
13540                client.request(request.unwrap()).await
13541            };
13542
13543            match req_result {
13544                Err(err) => {
13545                    if let common::Retry::After(d) = dlg.http_error(&err) {
13546                        sleep(d).await;
13547                        continue;
13548                    }
13549                    dlg.finished(false);
13550                    return Err(common::Error::HttpError(err));
13551                }
13552                Ok(res) => {
13553                    let (mut parts, body) = res.into_parts();
13554                    let mut body = common::Body::new(body);
13555                    if !parts.status.is_success() {
13556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13557                        let error = serde_json::from_str(&common::to_string(&bytes));
13558                        let response = common::to_response(parts, bytes.into());
13559
13560                        if let common::Retry::After(d) =
13561                            dlg.http_failure(&response, error.as_ref().ok())
13562                        {
13563                            sleep(d).await;
13564                            continue;
13565                        }
13566
13567                        dlg.finished(false);
13568
13569                        return Err(match error {
13570                            Ok(value) => common::Error::BadRequest(value),
13571                            _ => common::Error::Failure(response),
13572                        });
13573                    }
13574                    let response = {
13575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13576                        let encoded = common::to_string(&bytes);
13577                        match serde_json::from_str(&encoded) {
13578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13579                            Err(error) => {
13580                                dlg.response_json_decode_error(&encoded, &error);
13581                                return Err(common::Error::JsonDecodeError(
13582                                    encoded.to_string(),
13583                                    error,
13584                                ));
13585                            }
13586                        }
13587                    };
13588
13589                    dlg.finished(true);
13590                    return Ok(response);
13591                }
13592            }
13593        }
13594    }
13595
13596    ///
13597    /// Sets the *request* property to the given value.
13598    ///
13599    /// Even though the property as already been set when instantiating this call,
13600    /// we provide this method for API completeness.
13601    pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectNoteGetIamPolicyCall<'a, C> {
13602        self._request = new_value;
13603        self
13604    }
13605    /// 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.
13606    ///
13607    /// Sets the *resource* path property to the given value.
13608    ///
13609    /// Even though the property as already been set when instantiating this call,
13610    /// we provide this method for API completeness.
13611    pub fn resource(mut self, new_value: &str) -> ProjectNoteGetIamPolicyCall<'a, C> {
13612        self._resource = new_value.to_string();
13613        self
13614    }
13615    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13616    /// while executing the actual API request.
13617    ///
13618    /// ````text
13619    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13620    /// ````
13621    ///
13622    /// Sets the *delegate* property to the given value.
13623    pub fn delegate(
13624        mut self,
13625        new_value: &'a mut dyn common::Delegate,
13626    ) -> ProjectNoteGetIamPolicyCall<'a, C> {
13627        self._delegate = Some(new_value);
13628        self
13629    }
13630
13631    /// Set any additional parameter of the query string used in the request.
13632    /// It should be used to set parameters which are not yet available through their own
13633    /// setters.
13634    ///
13635    /// Please note that this method must not be used to set any of the known parameters
13636    /// which have their own setter method. If done anyway, the request will fail.
13637    ///
13638    /// # Additional Parameters
13639    ///
13640    /// * *$.xgafv* (query-string) - V1 error format.
13641    /// * *access_token* (query-string) - OAuth access token.
13642    /// * *alt* (query-string) - Data format for response.
13643    /// * *callback* (query-string) - JSONP
13644    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13645    /// * *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.
13646    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13647    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13648    /// * *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.
13649    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13650    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13651    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteGetIamPolicyCall<'a, C>
13652    where
13653        T: AsRef<str>,
13654    {
13655        self._additional_params
13656            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13657        self
13658    }
13659
13660    /// Identifies the authorization scope for the method you are building.
13661    ///
13662    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13663    /// [`Scope::CloudPlatform`].
13664    ///
13665    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13666    /// tokens for more than one scope.
13667    ///
13668    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13669    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13670    /// sufficient, a read-write scope will do as well.
13671    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteGetIamPolicyCall<'a, C>
13672    where
13673        St: AsRef<str>,
13674    {
13675        self._scopes.insert(String::from(scope.as_ref()));
13676        self
13677    }
13678    /// Identifies the authorization scope(s) for the method you are building.
13679    ///
13680    /// See [`Self::add_scope()`] for details.
13681    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteGetIamPolicyCall<'a, C>
13682    where
13683        I: IntoIterator<Item = St>,
13684        St: AsRef<str>,
13685    {
13686        self._scopes
13687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13688        self
13689    }
13690
13691    /// Removes all scopes, and no default scope will be used either.
13692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13693    /// for details).
13694    pub fn clear_scopes(mut self) -> ProjectNoteGetIamPolicyCall<'a, C> {
13695        self._scopes.clear();
13696        self
13697    }
13698}
13699
13700/// Lists notes for the specified project.
13701///
13702/// A builder for the *notes.list* method supported by a *project* resource.
13703/// It is not used directly, but through a [`ProjectMethods`] instance.
13704///
13705/// # Example
13706///
13707/// Instantiate a resource method builder
13708///
13709/// ```test_harness,no_run
13710/// # extern crate hyper;
13711/// # extern crate hyper_rustls;
13712/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
13713/// # async fn dox() {
13714/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13715///
13716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13717/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13718/// #     .with_native_roots()
13719/// #     .unwrap()
13720/// #     .https_only()
13721/// #     .enable_http2()
13722/// #     .build();
13723///
13724/// # let executor = hyper_util::rt::TokioExecutor::new();
13725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13726/// #     secret,
13727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13728/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13729/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13730/// #     ),
13731/// # ).build().await.unwrap();
13732///
13733/// # let client = hyper_util::client::legacy::Client::builder(
13734/// #     hyper_util::rt::TokioExecutor::new()
13735/// # )
13736/// # .build(
13737/// #     hyper_rustls::HttpsConnectorBuilder::new()
13738/// #         .with_native_roots()
13739/// #         .unwrap()
13740/// #         .https_or_http()
13741/// #         .enable_http2()
13742/// #         .build()
13743/// # );
13744/// # let mut hub = ContainerAnalysis::new(client, auth);
13745/// // You can configure optional parameters by calling the respective setters at will, and
13746/// // execute the final call using `doit()`.
13747/// // Values shown here are possibly random and not representative !
13748/// let result = hub.projects().notes_list("parent")
13749///              .return_partial_success(false)
13750///              .page_token("dolor")
13751///              .page_size(-18)
13752///              .filter("et")
13753///              .doit().await;
13754/// # }
13755/// ```
13756pub struct ProjectNoteListCall<'a, C>
13757where
13758    C: 'a,
13759{
13760    hub: &'a ContainerAnalysis<C>,
13761    _parent: String,
13762    _return_partial_success: Option<bool>,
13763    _page_token: Option<String>,
13764    _page_size: Option<i32>,
13765    _filter: Option<String>,
13766    _delegate: Option<&'a mut dyn common::Delegate>,
13767    _additional_params: HashMap<String, String>,
13768    _scopes: BTreeSet<String>,
13769}
13770
13771impl<'a, C> common::CallBuilder for ProjectNoteListCall<'a, C> {}
13772
13773impl<'a, C> ProjectNoteListCall<'a, C>
13774where
13775    C: common::Connector,
13776{
13777    /// Perform the operation you have build so far.
13778    pub async fn doit(mut self) -> common::Result<(common::Response, ListNotesResponse)> {
13779        use std::borrow::Cow;
13780        use std::io::{Read, Seek};
13781
13782        use common::{url::Params, ToParts};
13783        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13784
13785        let mut dd = common::DefaultDelegate;
13786        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13787        dlg.begin(common::MethodInfo {
13788            id: "containeranalysis.projects.notes.list",
13789            http_method: hyper::Method::GET,
13790        });
13791
13792        for &field in [
13793            "alt",
13794            "parent",
13795            "returnPartialSuccess",
13796            "pageToken",
13797            "pageSize",
13798            "filter",
13799        ]
13800        .iter()
13801        {
13802            if self._additional_params.contains_key(field) {
13803                dlg.finished(false);
13804                return Err(common::Error::FieldClash(field));
13805            }
13806        }
13807
13808        let mut params = Params::with_capacity(7 + self._additional_params.len());
13809        params.push("parent", self._parent);
13810        if let Some(value) = self._return_partial_success.as_ref() {
13811            params.push("returnPartialSuccess", value.to_string());
13812        }
13813        if let Some(value) = self._page_token.as_ref() {
13814            params.push("pageToken", value);
13815        }
13816        if let Some(value) = self._page_size.as_ref() {
13817            params.push("pageSize", value.to_string());
13818        }
13819        if let Some(value) = self._filter.as_ref() {
13820            params.push("filter", value);
13821        }
13822
13823        params.extend(self._additional_params.iter());
13824
13825        params.push("alt", "json");
13826        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/notes";
13827        if self._scopes.is_empty() {
13828            self._scopes
13829                .insert(Scope::CloudPlatform.as_ref().to_string());
13830        }
13831
13832        #[allow(clippy::single_element_loop)]
13833        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13834            url = params.uri_replacement(url, param_name, find_this, true);
13835        }
13836        {
13837            let to_remove = ["parent"];
13838            params.remove_params(&to_remove);
13839        }
13840
13841        let url = params.parse_with_url(&url);
13842
13843        loop {
13844            let token = match self
13845                .hub
13846                .auth
13847                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13848                .await
13849            {
13850                Ok(token) => token,
13851                Err(e) => match dlg.token(e) {
13852                    Ok(token) => token,
13853                    Err(e) => {
13854                        dlg.finished(false);
13855                        return Err(common::Error::MissingToken(e));
13856                    }
13857                },
13858            };
13859            let mut req_result = {
13860                let client = &self.hub.client;
13861                dlg.pre_request();
13862                let mut req_builder = hyper::Request::builder()
13863                    .method(hyper::Method::GET)
13864                    .uri(url.as_str())
13865                    .header(USER_AGENT, self.hub._user_agent.clone());
13866
13867                if let Some(token) = token.as_ref() {
13868                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13869                }
13870
13871                let request = req_builder
13872                    .header(CONTENT_LENGTH, 0_u64)
13873                    .body(common::to_body::<String>(None));
13874
13875                client.request(request.unwrap()).await
13876            };
13877
13878            match req_result {
13879                Err(err) => {
13880                    if let common::Retry::After(d) = dlg.http_error(&err) {
13881                        sleep(d).await;
13882                        continue;
13883                    }
13884                    dlg.finished(false);
13885                    return Err(common::Error::HttpError(err));
13886                }
13887                Ok(res) => {
13888                    let (mut parts, body) = res.into_parts();
13889                    let mut body = common::Body::new(body);
13890                    if !parts.status.is_success() {
13891                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13892                        let error = serde_json::from_str(&common::to_string(&bytes));
13893                        let response = common::to_response(parts, bytes.into());
13894
13895                        if let common::Retry::After(d) =
13896                            dlg.http_failure(&response, error.as_ref().ok())
13897                        {
13898                            sleep(d).await;
13899                            continue;
13900                        }
13901
13902                        dlg.finished(false);
13903
13904                        return Err(match error {
13905                            Ok(value) => common::Error::BadRequest(value),
13906                            _ => common::Error::Failure(response),
13907                        });
13908                    }
13909                    let response = {
13910                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13911                        let encoded = common::to_string(&bytes);
13912                        match serde_json::from_str(&encoded) {
13913                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13914                            Err(error) => {
13915                                dlg.response_json_decode_error(&encoded, &error);
13916                                return Err(common::Error::JsonDecodeError(
13917                                    encoded.to_string(),
13918                                    error,
13919                                ));
13920                            }
13921                        }
13922                    };
13923
13924                    dlg.finished(true);
13925                    return Ok(response);
13926                }
13927            }
13928        }
13929    }
13930
13931    /// Required. The name of the project to list notes for in the form of `projects/[PROJECT_ID]`.
13932    ///
13933    /// Sets the *parent* path property to the given value.
13934    ///
13935    /// Even though the property as already been set when instantiating this call,
13936    /// we provide this method for API completeness.
13937    pub fn parent(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
13938        self._parent = new_value.to_string();
13939        self
13940    }
13941    /// If set, the request will return all reachable Notes and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
13942    ///
13943    /// Sets the *return partial success* query property to the given value.
13944    pub fn return_partial_success(mut self, new_value: bool) -> ProjectNoteListCall<'a, C> {
13945        self._return_partial_success = Some(new_value);
13946        self
13947    }
13948    /// Token to provide to skip to a particular spot in the list.
13949    ///
13950    /// Sets the *page token* query property to the given value.
13951    pub fn page_token(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
13952        self._page_token = Some(new_value.to_string());
13953        self
13954    }
13955    /// 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.
13956    ///
13957    /// Sets the *page size* query property to the given value.
13958    pub fn page_size(mut self, new_value: i32) -> ProjectNoteListCall<'a, C> {
13959        self._page_size = Some(new_value);
13960        self
13961    }
13962    /// The filter expression.
13963    ///
13964    /// Sets the *filter* query property to the given value.
13965    pub fn filter(mut self, new_value: &str) -> ProjectNoteListCall<'a, C> {
13966        self._filter = Some(new_value.to_string());
13967        self
13968    }
13969    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13970    /// while executing the actual API request.
13971    ///
13972    /// ````text
13973    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13974    /// ````
13975    ///
13976    /// Sets the *delegate* property to the given value.
13977    pub fn delegate(
13978        mut self,
13979        new_value: &'a mut dyn common::Delegate,
13980    ) -> ProjectNoteListCall<'a, C> {
13981        self._delegate = Some(new_value);
13982        self
13983    }
13984
13985    /// Set any additional parameter of the query string used in the request.
13986    /// It should be used to set parameters which are not yet available through their own
13987    /// setters.
13988    ///
13989    /// Please note that this method must not be used to set any of the known parameters
13990    /// which have their own setter method. If done anyway, the request will fail.
13991    ///
13992    /// # Additional Parameters
13993    ///
13994    /// * *$.xgafv* (query-string) - V1 error format.
13995    /// * *access_token* (query-string) - OAuth access token.
13996    /// * *alt* (query-string) - Data format for response.
13997    /// * *callback* (query-string) - JSONP
13998    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13999    /// * *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.
14000    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14001    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14002    /// * *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.
14003    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14004    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14005    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteListCall<'a, C>
14006    where
14007        T: AsRef<str>,
14008    {
14009        self._additional_params
14010            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14011        self
14012    }
14013
14014    /// Identifies the authorization scope for the method you are building.
14015    ///
14016    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14017    /// [`Scope::CloudPlatform`].
14018    ///
14019    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14020    /// tokens for more than one scope.
14021    ///
14022    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14023    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14024    /// sufficient, a read-write scope will do as well.
14025    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteListCall<'a, C>
14026    where
14027        St: AsRef<str>,
14028    {
14029        self._scopes.insert(String::from(scope.as_ref()));
14030        self
14031    }
14032    /// Identifies the authorization scope(s) for the method you are building.
14033    ///
14034    /// See [`Self::add_scope()`] for details.
14035    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteListCall<'a, C>
14036    where
14037        I: IntoIterator<Item = St>,
14038        St: AsRef<str>,
14039    {
14040        self._scopes
14041            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14042        self
14043    }
14044
14045    /// Removes all scopes, and no default scope will be used either.
14046    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14047    /// for details).
14048    pub fn clear_scopes(mut self) -> ProjectNoteListCall<'a, C> {
14049        self._scopes.clear();
14050        self
14051    }
14052}
14053
14054/// Updates the specified note.
14055///
14056/// A builder for the *notes.patch* method supported by a *project* resource.
14057/// It is not used directly, but through a [`ProjectMethods`] instance.
14058///
14059/// # Example
14060///
14061/// Instantiate a resource method builder
14062///
14063/// ```test_harness,no_run
14064/// # extern crate hyper;
14065/// # extern crate hyper_rustls;
14066/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
14067/// use containeranalysis1_beta1::api::Note;
14068/// # async fn dox() {
14069/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14070///
14071/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14072/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14073/// #     .with_native_roots()
14074/// #     .unwrap()
14075/// #     .https_only()
14076/// #     .enable_http2()
14077/// #     .build();
14078///
14079/// # let executor = hyper_util::rt::TokioExecutor::new();
14080/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14081/// #     secret,
14082/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14083/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14084/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14085/// #     ),
14086/// # ).build().await.unwrap();
14087///
14088/// # let client = hyper_util::client::legacy::Client::builder(
14089/// #     hyper_util::rt::TokioExecutor::new()
14090/// # )
14091/// # .build(
14092/// #     hyper_rustls::HttpsConnectorBuilder::new()
14093/// #         .with_native_roots()
14094/// #         .unwrap()
14095/// #         .https_or_http()
14096/// #         .enable_http2()
14097/// #         .build()
14098/// # );
14099/// # let mut hub = ContainerAnalysis::new(client, auth);
14100/// // As the method needs a request, you would usually fill it with the desired information
14101/// // into the respective structure. Some of the parts shown here might not be applicable !
14102/// // Values shown here are possibly random and not representative !
14103/// let mut req = Note::default();
14104///
14105/// // You can configure optional parameters by calling the respective setters at will, and
14106/// // execute the final call using `doit()`.
14107/// // Values shown here are possibly random and not representative !
14108/// let result = hub.projects().notes_patch(req, "name")
14109///              .update_mask(FieldMask::new::<&str>(&[]))
14110///              .doit().await;
14111/// # }
14112/// ```
14113pub struct ProjectNotePatchCall<'a, C>
14114where
14115    C: 'a,
14116{
14117    hub: &'a ContainerAnalysis<C>,
14118    _request: Note,
14119    _name: String,
14120    _update_mask: Option<common::FieldMask>,
14121    _delegate: Option<&'a mut dyn common::Delegate>,
14122    _additional_params: HashMap<String, String>,
14123    _scopes: BTreeSet<String>,
14124}
14125
14126impl<'a, C> common::CallBuilder for ProjectNotePatchCall<'a, C> {}
14127
14128impl<'a, C> ProjectNotePatchCall<'a, C>
14129where
14130    C: common::Connector,
14131{
14132    /// Perform the operation you have build so far.
14133    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
14134        use std::borrow::Cow;
14135        use std::io::{Read, Seek};
14136
14137        use common::{url::Params, ToParts};
14138        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14139
14140        let mut dd = common::DefaultDelegate;
14141        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14142        dlg.begin(common::MethodInfo {
14143            id: "containeranalysis.projects.notes.patch",
14144            http_method: hyper::Method::PATCH,
14145        });
14146
14147        for &field in ["alt", "name", "updateMask"].iter() {
14148            if self._additional_params.contains_key(field) {
14149                dlg.finished(false);
14150                return Err(common::Error::FieldClash(field));
14151            }
14152        }
14153
14154        let mut params = Params::with_capacity(5 + self._additional_params.len());
14155        params.push("name", self._name);
14156        if let Some(value) = self._update_mask.as_ref() {
14157            params.push("updateMask", value.to_string());
14158        }
14159
14160        params.extend(self._additional_params.iter());
14161
14162        params.push("alt", "json");
14163        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
14164        if self._scopes.is_empty() {
14165            self._scopes
14166                .insert(Scope::CloudPlatform.as_ref().to_string());
14167        }
14168
14169        #[allow(clippy::single_element_loop)]
14170        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14171            url = params.uri_replacement(url, param_name, find_this, true);
14172        }
14173        {
14174            let to_remove = ["name"];
14175            params.remove_params(&to_remove);
14176        }
14177
14178        let url = params.parse_with_url(&url);
14179
14180        let mut json_mime_type = mime::APPLICATION_JSON;
14181        let mut request_value_reader = {
14182            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14183            common::remove_json_null_values(&mut value);
14184            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14185            serde_json::to_writer(&mut dst, &value).unwrap();
14186            dst
14187        };
14188        let request_size = request_value_reader
14189            .seek(std::io::SeekFrom::End(0))
14190            .unwrap();
14191        request_value_reader
14192            .seek(std::io::SeekFrom::Start(0))
14193            .unwrap();
14194
14195        loop {
14196            let token = match self
14197                .hub
14198                .auth
14199                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14200                .await
14201            {
14202                Ok(token) => token,
14203                Err(e) => match dlg.token(e) {
14204                    Ok(token) => token,
14205                    Err(e) => {
14206                        dlg.finished(false);
14207                        return Err(common::Error::MissingToken(e));
14208                    }
14209                },
14210            };
14211            request_value_reader
14212                .seek(std::io::SeekFrom::Start(0))
14213                .unwrap();
14214            let mut req_result = {
14215                let client = &self.hub.client;
14216                dlg.pre_request();
14217                let mut req_builder = hyper::Request::builder()
14218                    .method(hyper::Method::PATCH)
14219                    .uri(url.as_str())
14220                    .header(USER_AGENT, self.hub._user_agent.clone());
14221
14222                if let Some(token) = token.as_ref() {
14223                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14224                }
14225
14226                let request = req_builder
14227                    .header(CONTENT_TYPE, json_mime_type.to_string())
14228                    .header(CONTENT_LENGTH, request_size as u64)
14229                    .body(common::to_body(
14230                        request_value_reader.get_ref().clone().into(),
14231                    ));
14232
14233                client.request(request.unwrap()).await
14234            };
14235
14236            match req_result {
14237                Err(err) => {
14238                    if let common::Retry::After(d) = dlg.http_error(&err) {
14239                        sleep(d).await;
14240                        continue;
14241                    }
14242                    dlg.finished(false);
14243                    return Err(common::Error::HttpError(err));
14244                }
14245                Ok(res) => {
14246                    let (mut parts, body) = res.into_parts();
14247                    let mut body = common::Body::new(body);
14248                    if !parts.status.is_success() {
14249                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14250                        let error = serde_json::from_str(&common::to_string(&bytes));
14251                        let response = common::to_response(parts, bytes.into());
14252
14253                        if let common::Retry::After(d) =
14254                            dlg.http_failure(&response, error.as_ref().ok())
14255                        {
14256                            sleep(d).await;
14257                            continue;
14258                        }
14259
14260                        dlg.finished(false);
14261
14262                        return Err(match error {
14263                            Ok(value) => common::Error::BadRequest(value),
14264                            _ => common::Error::Failure(response),
14265                        });
14266                    }
14267                    let response = {
14268                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14269                        let encoded = common::to_string(&bytes);
14270                        match serde_json::from_str(&encoded) {
14271                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14272                            Err(error) => {
14273                                dlg.response_json_decode_error(&encoded, &error);
14274                                return Err(common::Error::JsonDecodeError(
14275                                    encoded.to_string(),
14276                                    error,
14277                                ));
14278                            }
14279                        }
14280                    };
14281
14282                    dlg.finished(true);
14283                    return Ok(response);
14284                }
14285            }
14286        }
14287    }
14288
14289    ///
14290    /// Sets the *request* property to the given value.
14291    ///
14292    /// Even though the property as already been set when instantiating this call,
14293    /// we provide this method for API completeness.
14294    pub fn request(mut self, new_value: Note) -> ProjectNotePatchCall<'a, C> {
14295        self._request = new_value;
14296        self
14297    }
14298    /// Required. The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
14299    ///
14300    /// Sets the *name* path property to the given value.
14301    ///
14302    /// Even though the property as already been set when instantiating this call,
14303    /// we provide this method for API completeness.
14304    pub fn name(mut self, new_value: &str) -> ProjectNotePatchCall<'a, C> {
14305        self._name = new_value.to_string();
14306        self
14307    }
14308    /// The fields to update.
14309    ///
14310    /// Sets the *update mask* query property to the given value.
14311    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectNotePatchCall<'a, C> {
14312        self._update_mask = Some(new_value);
14313        self
14314    }
14315    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14316    /// while executing the actual API request.
14317    ///
14318    /// ````text
14319    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14320    /// ````
14321    ///
14322    /// Sets the *delegate* property to the given value.
14323    pub fn delegate(
14324        mut self,
14325        new_value: &'a mut dyn common::Delegate,
14326    ) -> ProjectNotePatchCall<'a, C> {
14327        self._delegate = Some(new_value);
14328        self
14329    }
14330
14331    /// Set any additional parameter of the query string used in the request.
14332    /// It should be used to set parameters which are not yet available through their own
14333    /// setters.
14334    ///
14335    /// Please note that this method must not be used to set any of the known parameters
14336    /// which have their own setter method. If done anyway, the request will fail.
14337    ///
14338    /// # Additional Parameters
14339    ///
14340    /// * *$.xgafv* (query-string) - V1 error format.
14341    /// * *access_token* (query-string) - OAuth access token.
14342    /// * *alt* (query-string) - Data format for response.
14343    /// * *callback* (query-string) - JSONP
14344    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14345    /// * *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.
14346    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14347    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14348    /// * *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.
14349    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14350    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14351    pub fn param<T>(mut self, name: T, value: T) -> ProjectNotePatchCall<'a, C>
14352    where
14353        T: AsRef<str>,
14354    {
14355        self._additional_params
14356            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14357        self
14358    }
14359
14360    /// Identifies the authorization scope for the method you are building.
14361    ///
14362    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14363    /// [`Scope::CloudPlatform`].
14364    ///
14365    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14366    /// tokens for more than one scope.
14367    ///
14368    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14369    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14370    /// sufficient, a read-write scope will do as well.
14371    pub fn add_scope<St>(mut self, scope: St) -> ProjectNotePatchCall<'a, C>
14372    where
14373        St: AsRef<str>,
14374    {
14375        self._scopes.insert(String::from(scope.as_ref()));
14376        self
14377    }
14378    /// Identifies the authorization scope(s) for the method you are building.
14379    ///
14380    /// See [`Self::add_scope()`] for details.
14381    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNotePatchCall<'a, C>
14382    where
14383        I: IntoIterator<Item = St>,
14384        St: AsRef<str>,
14385    {
14386        self._scopes
14387            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14388        self
14389    }
14390
14391    /// Removes all scopes, and no default scope will be used either.
14392    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14393    /// for details).
14394    pub fn clear_scopes(mut self) -> ProjectNotePatchCall<'a, C> {
14395        self._scopes.clear();
14396        self
14397    }
14398}
14399
14400/// 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.
14401///
14402/// A builder for the *notes.setIamPolicy* method supported by a *project* resource.
14403/// It is not used directly, but through a [`ProjectMethods`] instance.
14404///
14405/// # Example
14406///
14407/// Instantiate a resource method builder
14408///
14409/// ```test_harness,no_run
14410/// # extern crate hyper;
14411/// # extern crate hyper_rustls;
14412/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
14413/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
14414/// # async fn dox() {
14415/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14416///
14417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14419/// #     .with_native_roots()
14420/// #     .unwrap()
14421/// #     .https_only()
14422/// #     .enable_http2()
14423/// #     .build();
14424///
14425/// # let executor = hyper_util::rt::TokioExecutor::new();
14426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14427/// #     secret,
14428/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14429/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14430/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14431/// #     ),
14432/// # ).build().await.unwrap();
14433///
14434/// # let client = hyper_util::client::legacy::Client::builder(
14435/// #     hyper_util::rt::TokioExecutor::new()
14436/// # )
14437/// # .build(
14438/// #     hyper_rustls::HttpsConnectorBuilder::new()
14439/// #         .with_native_roots()
14440/// #         .unwrap()
14441/// #         .https_or_http()
14442/// #         .enable_http2()
14443/// #         .build()
14444/// # );
14445/// # let mut hub = ContainerAnalysis::new(client, auth);
14446/// // As the method needs a request, you would usually fill it with the desired information
14447/// // into the respective structure. Some of the parts shown here might not be applicable !
14448/// // Values shown here are possibly random and not representative !
14449/// let mut req = SetIamPolicyRequest::default();
14450///
14451/// // You can configure optional parameters by calling the respective setters at will, and
14452/// // execute the final call using `doit()`.
14453/// // Values shown here are possibly random and not representative !
14454/// let result = hub.projects().notes_set_iam_policy(req, "resource")
14455///              .doit().await;
14456/// # }
14457/// ```
14458pub struct ProjectNoteSetIamPolicyCall<'a, C>
14459where
14460    C: 'a,
14461{
14462    hub: &'a ContainerAnalysis<C>,
14463    _request: SetIamPolicyRequest,
14464    _resource: String,
14465    _delegate: Option<&'a mut dyn common::Delegate>,
14466    _additional_params: HashMap<String, String>,
14467    _scopes: BTreeSet<String>,
14468}
14469
14470impl<'a, C> common::CallBuilder for ProjectNoteSetIamPolicyCall<'a, C> {}
14471
14472impl<'a, C> ProjectNoteSetIamPolicyCall<'a, C>
14473where
14474    C: common::Connector,
14475{
14476    /// Perform the operation you have build so far.
14477    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14478        use std::borrow::Cow;
14479        use std::io::{Read, Seek};
14480
14481        use common::{url::Params, ToParts};
14482        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14483
14484        let mut dd = common::DefaultDelegate;
14485        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14486        dlg.begin(common::MethodInfo {
14487            id: "containeranalysis.projects.notes.setIamPolicy",
14488            http_method: hyper::Method::POST,
14489        });
14490
14491        for &field in ["alt", "resource"].iter() {
14492            if self._additional_params.contains_key(field) {
14493                dlg.finished(false);
14494                return Err(common::Error::FieldClash(field));
14495            }
14496        }
14497
14498        let mut params = Params::with_capacity(4 + self._additional_params.len());
14499        params.push("resource", self._resource);
14500
14501        params.extend(self._additional_params.iter());
14502
14503        params.push("alt", "json");
14504        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
14505        if self._scopes.is_empty() {
14506            self._scopes
14507                .insert(Scope::CloudPlatform.as_ref().to_string());
14508        }
14509
14510        #[allow(clippy::single_element_loop)]
14511        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14512            url = params.uri_replacement(url, param_name, find_this, true);
14513        }
14514        {
14515            let to_remove = ["resource"];
14516            params.remove_params(&to_remove);
14517        }
14518
14519        let url = params.parse_with_url(&url);
14520
14521        let mut json_mime_type = mime::APPLICATION_JSON;
14522        let mut request_value_reader = {
14523            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14524            common::remove_json_null_values(&mut value);
14525            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14526            serde_json::to_writer(&mut dst, &value).unwrap();
14527            dst
14528        };
14529        let request_size = request_value_reader
14530            .seek(std::io::SeekFrom::End(0))
14531            .unwrap();
14532        request_value_reader
14533            .seek(std::io::SeekFrom::Start(0))
14534            .unwrap();
14535
14536        loop {
14537            let token = match self
14538                .hub
14539                .auth
14540                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14541                .await
14542            {
14543                Ok(token) => token,
14544                Err(e) => match dlg.token(e) {
14545                    Ok(token) => token,
14546                    Err(e) => {
14547                        dlg.finished(false);
14548                        return Err(common::Error::MissingToken(e));
14549                    }
14550                },
14551            };
14552            request_value_reader
14553                .seek(std::io::SeekFrom::Start(0))
14554                .unwrap();
14555            let mut req_result = {
14556                let client = &self.hub.client;
14557                dlg.pre_request();
14558                let mut req_builder = hyper::Request::builder()
14559                    .method(hyper::Method::POST)
14560                    .uri(url.as_str())
14561                    .header(USER_AGENT, self.hub._user_agent.clone());
14562
14563                if let Some(token) = token.as_ref() {
14564                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14565                }
14566
14567                let request = req_builder
14568                    .header(CONTENT_TYPE, json_mime_type.to_string())
14569                    .header(CONTENT_LENGTH, request_size as u64)
14570                    .body(common::to_body(
14571                        request_value_reader.get_ref().clone().into(),
14572                    ));
14573
14574                client.request(request.unwrap()).await
14575            };
14576
14577            match req_result {
14578                Err(err) => {
14579                    if let common::Retry::After(d) = dlg.http_error(&err) {
14580                        sleep(d).await;
14581                        continue;
14582                    }
14583                    dlg.finished(false);
14584                    return Err(common::Error::HttpError(err));
14585                }
14586                Ok(res) => {
14587                    let (mut parts, body) = res.into_parts();
14588                    let mut body = common::Body::new(body);
14589                    if !parts.status.is_success() {
14590                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14591                        let error = serde_json::from_str(&common::to_string(&bytes));
14592                        let response = common::to_response(parts, bytes.into());
14593
14594                        if let common::Retry::After(d) =
14595                            dlg.http_failure(&response, error.as_ref().ok())
14596                        {
14597                            sleep(d).await;
14598                            continue;
14599                        }
14600
14601                        dlg.finished(false);
14602
14603                        return Err(match error {
14604                            Ok(value) => common::Error::BadRequest(value),
14605                            _ => common::Error::Failure(response),
14606                        });
14607                    }
14608                    let response = {
14609                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14610                        let encoded = common::to_string(&bytes);
14611                        match serde_json::from_str(&encoded) {
14612                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14613                            Err(error) => {
14614                                dlg.response_json_decode_error(&encoded, &error);
14615                                return Err(common::Error::JsonDecodeError(
14616                                    encoded.to_string(),
14617                                    error,
14618                                ));
14619                            }
14620                        }
14621                    };
14622
14623                    dlg.finished(true);
14624                    return Ok(response);
14625                }
14626            }
14627        }
14628    }
14629
14630    ///
14631    /// Sets the *request* property to the given value.
14632    ///
14633    /// Even though the property as already been set when instantiating this call,
14634    /// we provide this method for API completeness.
14635    pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectNoteSetIamPolicyCall<'a, C> {
14636        self._request = new_value;
14637        self
14638    }
14639    /// 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.
14640    ///
14641    /// Sets the *resource* path property to the given value.
14642    ///
14643    /// Even though the property as already been set when instantiating this call,
14644    /// we provide this method for API completeness.
14645    pub fn resource(mut self, new_value: &str) -> ProjectNoteSetIamPolicyCall<'a, C> {
14646        self._resource = new_value.to_string();
14647        self
14648    }
14649    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14650    /// while executing the actual API request.
14651    ///
14652    /// ````text
14653    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14654    /// ````
14655    ///
14656    /// Sets the *delegate* property to the given value.
14657    pub fn delegate(
14658        mut self,
14659        new_value: &'a mut dyn common::Delegate,
14660    ) -> ProjectNoteSetIamPolicyCall<'a, C> {
14661        self._delegate = Some(new_value);
14662        self
14663    }
14664
14665    /// Set any additional parameter of the query string used in the request.
14666    /// It should be used to set parameters which are not yet available through their own
14667    /// setters.
14668    ///
14669    /// Please note that this method must not be used to set any of the known parameters
14670    /// which have their own setter method. If done anyway, the request will fail.
14671    ///
14672    /// # Additional Parameters
14673    ///
14674    /// * *$.xgafv* (query-string) - V1 error format.
14675    /// * *access_token* (query-string) - OAuth access token.
14676    /// * *alt* (query-string) - Data format for response.
14677    /// * *callback* (query-string) - JSONP
14678    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14679    /// * *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.
14680    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14681    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14682    /// * *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.
14683    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14684    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14685    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteSetIamPolicyCall<'a, C>
14686    where
14687        T: AsRef<str>,
14688    {
14689        self._additional_params
14690            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14691        self
14692    }
14693
14694    /// Identifies the authorization scope for the method you are building.
14695    ///
14696    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14697    /// [`Scope::CloudPlatform`].
14698    ///
14699    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14700    /// tokens for more than one scope.
14701    ///
14702    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14703    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14704    /// sufficient, a read-write scope will do as well.
14705    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteSetIamPolicyCall<'a, C>
14706    where
14707        St: AsRef<str>,
14708    {
14709        self._scopes.insert(String::from(scope.as_ref()));
14710        self
14711    }
14712    /// Identifies the authorization scope(s) for the method you are building.
14713    ///
14714    /// See [`Self::add_scope()`] for details.
14715    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteSetIamPolicyCall<'a, C>
14716    where
14717        I: IntoIterator<Item = St>,
14718        St: AsRef<str>,
14719    {
14720        self._scopes
14721            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14722        self
14723    }
14724
14725    /// Removes all scopes, and no default scope will be used either.
14726    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14727    /// for details).
14728    pub fn clear_scopes(mut self) -> ProjectNoteSetIamPolicyCall<'a, C> {
14729        self._scopes.clear();
14730        self
14731    }
14732}
14733
14734/// 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.
14735///
14736/// A builder for the *notes.testIamPermissions* method supported by a *project* resource.
14737/// It is not used directly, but through a [`ProjectMethods`] instance.
14738///
14739/// # Example
14740///
14741/// Instantiate a resource method builder
14742///
14743/// ```test_harness,no_run
14744/// # extern crate hyper;
14745/// # extern crate hyper_rustls;
14746/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
14747/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
14748/// # async fn dox() {
14749/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14750///
14751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14752/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14753/// #     .with_native_roots()
14754/// #     .unwrap()
14755/// #     .https_only()
14756/// #     .enable_http2()
14757/// #     .build();
14758///
14759/// # let executor = hyper_util::rt::TokioExecutor::new();
14760/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14761/// #     secret,
14762/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14763/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14764/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14765/// #     ),
14766/// # ).build().await.unwrap();
14767///
14768/// # let client = hyper_util::client::legacy::Client::builder(
14769/// #     hyper_util::rt::TokioExecutor::new()
14770/// # )
14771/// # .build(
14772/// #     hyper_rustls::HttpsConnectorBuilder::new()
14773/// #         .with_native_roots()
14774/// #         .unwrap()
14775/// #         .https_or_http()
14776/// #         .enable_http2()
14777/// #         .build()
14778/// # );
14779/// # let mut hub = ContainerAnalysis::new(client, auth);
14780/// // As the method needs a request, you would usually fill it with the desired information
14781/// // into the respective structure. Some of the parts shown here might not be applicable !
14782/// // Values shown here are possibly random and not representative !
14783/// let mut req = TestIamPermissionsRequest::default();
14784///
14785/// // You can configure optional parameters by calling the respective setters at will, and
14786/// // execute the final call using `doit()`.
14787/// // Values shown here are possibly random and not representative !
14788/// let result = hub.projects().notes_test_iam_permissions(req, "resource")
14789///              .doit().await;
14790/// # }
14791/// ```
14792pub struct ProjectNoteTestIamPermissionCall<'a, C>
14793where
14794    C: 'a,
14795{
14796    hub: &'a ContainerAnalysis<C>,
14797    _request: TestIamPermissionsRequest,
14798    _resource: String,
14799    _delegate: Option<&'a mut dyn common::Delegate>,
14800    _additional_params: HashMap<String, String>,
14801    _scopes: BTreeSet<String>,
14802}
14803
14804impl<'a, C> common::CallBuilder for ProjectNoteTestIamPermissionCall<'a, C> {}
14805
14806impl<'a, C> ProjectNoteTestIamPermissionCall<'a, C>
14807where
14808    C: common::Connector,
14809{
14810    /// Perform the operation you have build so far.
14811    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
14812        use std::borrow::Cow;
14813        use std::io::{Read, Seek};
14814
14815        use common::{url::Params, ToParts};
14816        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14817
14818        let mut dd = common::DefaultDelegate;
14819        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14820        dlg.begin(common::MethodInfo {
14821            id: "containeranalysis.projects.notes.testIamPermissions",
14822            http_method: hyper::Method::POST,
14823        });
14824
14825        for &field in ["alt", "resource"].iter() {
14826            if self._additional_params.contains_key(field) {
14827                dlg.finished(false);
14828                return Err(common::Error::FieldClash(field));
14829            }
14830        }
14831
14832        let mut params = Params::with_capacity(4 + self._additional_params.len());
14833        params.push("resource", self._resource);
14834
14835        params.extend(self._additional_params.iter());
14836
14837        params.push("alt", "json");
14838        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
14839        if self._scopes.is_empty() {
14840            self._scopes
14841                .insert(Scope::CloudPlatform.as_ref().to_string());
14842        }
14843
14844        #[allow(clippy::single_element_loop)]
14845        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14846            url = params.uri_replacement(url, param_name, find_this, true);
14847        }
14848        {
14849            let to_remove = ["resource"];
14850            params.remove_params(&to_remove);
14851        }
14852
14853        let url = params.parse_with_url(&url);
14854
14855        let mut json_mime_type = mime::APPLICATION_JSON;
14856        let mut request_value_reader = {
14857            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14858            common::remove_json_null_values(&mut value);
14859            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14860            serde_json::to_writer(&mut dst, &value).unwrap();
14861            dst
14862        };
14863        let request_size = request_value_reader
14864            .seek(std::io::SeekFrom::End(0))
14865            .unwrap();
14866        request_value_reader
14867            .seek(std::io::SeekFrom::Start(0))
14868            .unwrap();
14869
14870        loop {
14871            let token = match self
14872                .hub
14873                .auth
14874                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14875                .await
14876            {
14877                Ok(token) => token,
14878                Err(e) => match dlg.token(e) {
14879                    Ok(token) => token,
14880                    Err(e) => {
14881                        dlg.finished(false);
14882                        return Err(common::Error::MissingToken(e));
14883                    }
14884                },
14885            };
14886            request_value_reader
14887                .seek(std::io::SeekFrom::Start(0))
14888                .unwrap();
14889            let mut req_result = {
14890                let client = &self.hub.client;
14891                dlg.pre_request();
14892                let mut req_builder = hyper::Request::builder()
14893                    .method(hyper::Method::POST)
14894                    .uri(url.as_str())
14895                    .header(USER_AGENT, self.hub._user_agent.clone());
14896
14897                if let Some(token) = token.as_ref() {
14898                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14899                }
14900
14901                let request = req_builder
14902                    .header(CONTENT_TYPE, json_mime_type.to_string())
14903                    .header(CONTENT_LENGTH, request_size as u64)
14904                    .body(common::to_body(
14905                        request_value_reader.get_ref().clone().into(),
14906                    ));
14907
14908                client.request(request.unwrap()).await
14909            };
14910
14911            match req_result {
14912                Err(err) => {
14913                    if let common::Retry::After(d) = dlg.http_error(&err) {
14914                        sleep(d).await;
14915                        continue;
14916                    }
14917                    dlg.finished(false);
14918                    return Err(common::Error::HttpError(err));
14919                }
14920                Ok(res) => {
14921                    let (mut parts, body) = res.into_parts();
14922                    let mut body = common::Body::new(body);
14923                    if !parts.status.is_success() {
14924                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14925                        let error = serde_json::from_str(&common::to_string(&bytes));
14926                        let response = common::to_response(parts, bytes.into());
14927
14928                        if let common::Retry::After(d) =
14929                            dlg.http_failure(&response, error.as_ref().ok())
14930                        {
14931                            sleep(d).await;
14932                            continue;
14933                        }
14934
14935                        dlg.finished(false);
14936
14937                        return Err(match error {
14938                            Ok(value) => common::Error::BadRequest(value),
14939                            _ => common::Error::Failure(response),
14940                        });
14941                    }
14942                    let response = {
14943                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14944                        let encoded = common::to_string(&bytes);
14945                        match serde_json::from_str(&encoded) {
14946                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14947                            Err(error) => {
14948                                dlg.response_json_decode_error(&encoded, &error);
14949                                return Err(common::Error::JsonDecodeError(
14950                                    encoded.to_string(),
14951                                    error,
14952                                ));
14953                            }
14954                        }
14955                    };
14956
14957                    dlg.finished(true);
14958                    return Ok(response);
14959                }
14960            }
14961        }
14962    }
14963
14964    ///
14965    /// Sets the *request* property to the given value.
14966    ///
14967    /// Even though the property as already been set when instantiating this call,
14968    /// we provide this method for API completeness.
14969    pub fn request(
14970        mut self,
14971        new_value: TestIamPermissionsRequest,
14972    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
14973        self._request = new_value;
14974        self
14975    }
14976    /// 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.
14977    ///
14978    /// Sets the *resource* path property to the given value.
14979    ///
14980    /// Even though the property as already been set when instantiating this call,
14981    /// we provide this method for API completeness.
14982    pub fn resource(mut self, new_value: &str) -> ProjectNoteTestIamPermissionCall<'a, C> {
14983        self._resource = new_value.to_string();
14984        self
14985    }
14986    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14987    /// while executing the actual API request.
14988    ///
14989    /// ````text
14990    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14991    /// ````
14992    ///
14993    /// Sets the *delegate* property to the given value.
14994    pub fn delegate(
14995        mut self,
14996        new_value: &'a mut dyn common::Delegate,
14997    ) -> ProjectNoteTestIamPermissionCall<'a, C> {
14998        self._delegate = Some(new_value);
14999        self
15000    }
15001
15002    /// Set any additional parameter of the query string used in the request.
15003    /// It should be used to set parameters which are not yet available through their own
15004    /// setters.
15005    ///
15006    /// Please note that this method must not be used to set any of the known parameters
15007    /// which have their own setter method. If done anyway, the request will fail.
15008    ///
15009    /// # Additional Parameters
15010    ///
15011    /// * *$.xgafv* (query-string) - V1 error format.
15012    /// * *access_token* (query-string) - OAuth access token.
15013    /// * *alt* (query-string) - Data format for response.
15014    /// * *callback* (query-string) - JSONP
15015    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15016    /// * *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.
15017    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15018    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15019    /// * *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.
15020    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15021    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15022    pub fn param<T>(mut self, name: T, value: T) -> ProjectNoteTestIamPermissionCall<'a, C>
15023    where
15024        T: AsRef<str>,
15025    {
15026        self._additional_params
15027            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15028        self
15029    }
15030
15031    /// Identifies the authorization scope for the method you are building.
15032    ///
15033    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15034    /// [`Scope::CloudPlatform`].
15035    ///
15036    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15037    /// tokens for more than one scope.
15038    ///
15039    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15040    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15041    /// sufficient, a read-write scope will do as well.
15042    pub fn add_scope<St>(mut self, scope: St) -> ProjectNoteTestIamPermissionCall<'a, C>
15043    where
15044        St: AsRef<str>,
15045    {
15046        self._scopes.insert(String::from(scope.as_ref()));
15047        self
15048    }
15049    /// Identifies the authorization scope(s) for the method you are building.
15050    ///
15051    /// See [`Self::add_scope()`] for details.
15052    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectNoteTestIamPermissionCall<'a, C>
15053    where
15054        I: IntoIterator<Item = St>,
15055        St: AsRef<str>,
15056    {
15057        self._scopes
15058            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15059        self
15060    }
15061
15062    /// Removes all scopes, and no default scope will be used either.
15063    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15064    /// for details).
15065    pub fn clear_scopes(mut self) -> ProjectNoteTestIamPermissionCall<'a, C> {
15066        self._scopes.clear();
15067        self
15068    }
15069}
15070
15071/// Creates new occurrences in batch.
15072///
15073/// A builder for the *occurrences.batchCreate* method supported by a *project* resource.
15074/// It is not used directly, but through a [`ProjectMethods`] instance.
15075///
15076/// # Example
15077///
15078/// Instantiate a resource method builder
15079///
15080/// ```test_harness,no_run
15081/// # extern crate hyper;
15082/// # extern crate hyper_rustls;
15083/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
15084/// use containeranalysis1_beta1::api::BatchCreateOccurrencesRequest;
15085/// # async fn dox() {
15086/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15087///
15088/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15089/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15090/// #     .with_native_roots()
15091/// #     .unwrap()
15092/// #     .https_only()
15093/// #     .enable_http2()
15094/// #     .build();
15095///
15096/// # let executor = hyper_util::rt::TokioExecutor::new();
15097/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15098/// #     secret,
15099/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15100/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15101/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15102/// #     ),
15103/// # ).build().await.unwrap();
15104///
15105/// # let client = hyper_util::client::legacy::Client::builder(
15106/// #     hyper_util::rt::TokioExecutor::new()
15107/// # )
15108/// # .build(
15109/// #     hyper_rustls::HttpsConnectorBuilder::new()
15110/// #         .with_native_roots()
15111/// #         .unwrap()
15112/// #         .https_or_http()
15113/// #         .enable_http2()
15114/// #         .build()
15115/// # );
15116/// # let mut hub = ContainerAnalysis::new(client, auth);
15117/// // As the method needs a request, you would usually fill it with the desired information
15118/// // into the respective structure. Some of the parts shown here might not be applicable !
15119/// // Values shown here are possibly random and not representative !
15120/// let mut req = BatchCreateOccurrencesRequest::default();
15121///
15122/// // You can configure optional parameters by calling the respective setters at will, and
15123/// // execute the final call using `doit()`.
15124/// // Values shown here are possibly random and not representative !
15125/// let result = hub.projects().occurrences_batch_create(req, "parent")
15126///              .doit().await;
15127/// # }
15128/// ```
15129pub struct ProjectOccurrenceBatchCreateCall<'a, C>
15130where
15131    C: 'a,
15132{
15133    hub: &'a ContainerAnalysis<C>,
15134    _request: BatchCreateOccurrencesRequest,
15135    _parent: String,
15136    _delegate: Option<&'a mut dyn common::Delegate>,
15137    _additional_params: HashMap<String, String>,
15138    _scopes: BTreeSet<String>,
15139}
15140
15141impl<'a, C> common::CallBuilder for ProjectOccurrenceBatchCreateCall<'a, C> {}
15142
15143impl<'a, C> ProjectOccurrenceBatchCreateCall<'a, C>
15144where
15145    C: common::Connector,
15146{
15147    /// Perform the operation you have build so far.
15148    pub async fn doit(
15149        mut self,
15150    ) -> common::Result<(common::Response, BatchCreateOccurrencesResponse)> {
15151        use std::borrow::Cow;
15152        use std::io::{Read, Seek};
15153
15154        use common::{url::Params, ToParts};
15155        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15156
15157        let mut dd = common::DefaultDelegate;
15158        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15159        dlg.begin(common::MethodInfo {
15160            id: "containeranalysis.projects.occurrences.batchCreate",
15161            http_method: hyper::Method::POST,
15162        });
15163
15164        for &field in ["alt", "parent"].iter() {
15165            if self._additional_params.contains_key(field) {
15166                dlg.finished(false);
15167                return Err(common::Error::FieldClash(field));
15168            }
15169        }
15170
15171        let mut params = Params::with_capacity(4 + self._additional_params.len());
15172        params.push("parent", self._parent);
15173
15174        params.extend(self._additional_params.iter());
15175
15176        params.push("alt", "json");
15177        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:batchCreate";
15178        if self._scopes.is_empty() {
15179            self._scopes
15180                .insert(Scope::CloudPlatform.as_ref().to_string());
15181        }
15182
15183        #[allow(clippy::single_element_loop)]
15184        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15185            url = params.uri_replacement(url, param_name, find_this, true);
15186        }
15187        {
15188            let to_remove = ["parent"];
15189            params.remove_params(&to_remove);
15190        }
15191
15192        let url = params.parse_with_url(&url);
15193
15194        let mut json_mime_type = mime::APPLICATION_JSON;
15195        let mut request_value_reader = {
15196            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15197            common::remove_json_null_values(&mut value);
15198            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15199            serde_json::to_writer(&mut dst, &value).unwrap();
15200            dst
15201        };
15202        let request_size = request_value_reader
15203            .seek(std::io::SeekFrom::End(0))
15204            .unwrap();
15205        request_value_reader
15206            .seek(std::io::SeekFrom::Start(0))
15207            .unwrap();
15208
15209        loop {
15210            let token = match self
15211                .hub
15212                .auth
15213                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15214                .await
15215            {
15216                Ok(token) => token,
15217                Err(e) => match dlg.token(e) {
15218                    Ok(token) => token,
15219                    Err(e) => {
15220                        dlg.finished(false);
15221                        return Err(common::Error::MissingToken(e));
15222                    }
15223                },
15224            };
15225            request_value_reader
15226                .seek(std::io::SeekFrom::Start(0))
15227                .unwrap();
15228            let mut req_result = {
15229                let client = &self.hub.client;
15230                dlg.pre_request();
15231                let mut req_builder = hyper::Request::builder()
15232                    .method(hyper::Method::POST)
15233                    .uri(url.as_str())
15234                    .header(USER_AGENT, self.hub._user_agent.clone());
15235
15236                if let Some(token) = token.as_ref() {
15237                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15238                }
15239
15240                let request = req_builder
15241                    .header(CONTENT_TYPE, json_mime_type.to_string())
15242                    .header(CONTENT_LENGTH, request_size as u64)
15243                    .body(common::to_body(
15244                        request_value_reader.get_ref().clone().into(),
15245                    ));
15246
15247                client.request(request.unwrap()).await
15248            };
15249
15250            match req_result {
15251                Err(err) => {
15252                    if let common::Retry::After(d) = dlg.http_error(&err) {
15253                        sleep(d).await;
15254                        continue;
15255                    }
15256                    dlg.finished(false);
15257                    return Err(common::Error::HttpError(err));
15258                }
15259                Ok(res) => {
15260                    let (mut parts, body) = res.into_parts();
15261                    let mut body = common::Body::new(body);
15262                    if !parts.status.is_success() {
15263                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15264                        let error = serde_json::from_str(&common::to_string(&bytes));
15265                        let response = common::to_response(parts, bytes.into());
15266
15267                        if let common::Retry::After(d) =
15268                            dlg.http_failure(&response, error.as_ref().ok())
15269                        {
15270                            sleep(d).await;
15271                            continue;
15272                        }
15273
15274                        dlg.finished(false);
15275
15276                        return Err(match error {
15277                            Ok(value) => common::Error::BadRequest(value),
15278                            _ => common::Error::Failure(response),
15279                        });
15280                    }
15281                    let response = {
15282                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15283                        let encoded = common::to_string(&bytes);
15284                        match serde_json::from_str(&encoded) {
15285                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15286                            Err(error) => {
15287                                dlg.response_json_decode_error(&encoded, &error);
15288                                return Err(common::Error::JsonDecodeError(
15289                                    encoded.to_string(),
15290                                    error,
15291                                ));
15292                            }
15293                        }
15294                    };
15295
15296                    dlg.finished(true);
15297                    return Ok(response);
15298                }
15299            }
15300        }
15301    }
15302
15303    ///
15304    /// Sets the *request* property to the given value.
15305    ///
15306    /// Even though the property as already been set when instantiating this call,
15307    /// we provide this method for API completeness.
15308    pub fn request(
15309        mut self,
15310        new_value: BatchCreateOccurrencesRequest,
15311    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
15312        self._request = new_value;
15313        self
15314    }
15315    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrences are to be created.
15316    ///
15317    /// Sets the *parent* path property to the given value.
15318    ///
15319    /// Even though the property as already been set when instantiating this call,
15320    /// we provide this method for API completeness.
15321    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceBatchCreateCall<'a, C> {
15322        self._parent = new_value.to_string();
15323        self
15324    }
15325    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15326    /// while executing the actual API request.
15327    ///
15328    /// ````text
15329    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15330    /// ````
15331    ///
15332    /// Sets the *delegate* property to the given value.
15333    pub fn delegate(
15334        mut self,
15335        new_value: &'a mut dyn common::Delegate,
15336    ) -> ProjectOccurrenceBatchCreateCall<'a, C> {
15337        self._delegate = Some(new_value);
15338        self
15339    }
15340
15341    /// Set any additional parameter of the query string used in the request.
15342    /// It should be used to set parameters which are not yet available through their own
15343    /// setters.
15344    ///
15345    /// Please note that this method must not be used to set any of the known parameters
15346    /// which have their own setter method. If done anyway, the request will fail.
15347    ///
15348    /// # Additional Parameters
15349    ///
15350    /// * *$.xgafv* (query-string) - V1 error format.
15351    /// * *access_token* (query-string) - OAuth access token.
15352    /// * *alt* (query-string) - Data format for response.
15353    /// * *callback* (query-string) - JSONP
15354    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15355    /// * *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.
15356    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15357    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15358    /// * *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.
15359    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15360    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15361    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceBatchCreateCall<'a, C>
15362    where
15363        T: AsRef<str>,
15364    {
15365        self._additional_params
15366            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15367        self
15368    }
15369
15370    /// Identifies the authorization scope for the method you are building.
15371    ///
15372    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15373    /// [`Scope::CloudPlatform`].
15374    ///
15375    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15376    /// tokens for more than one scope.
15377    ///
15378    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15379    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15380    /// sufficient, a read-write scope will do as well.
15381    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceBatchCreateCall<'a, C>
15382    where
15383        St: AsRef<str>,
15384    {
15385        self._scopes.insert(String::from(scope.as_ref()));
15386        self
15387    }
15388    /// Identifies the authorization scope(s) for the method you are building.
15389    ///
15390    /// See [`Self::add_scope()`] for details.
15391    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceBatchCreateCall<'a, C>
15392    where
15393        I: IntoIterator<Item = St>,
15394        St: AsRef<str>,
15395    {
15396        self._scopes
15397            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15398        self
15399    }
15400
15401    /// Removes all scopes, and no default scope will be used either.
15402    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15403    /// for details).
15404    pub fn clear_scopes(mut self) -> ProjectOccurrenceBatchCreateCall<'a, C> {
15405        self._scopes.clear();
15406        self
15407    }
15408}
15409
15410/// Creates a new occurrence.
15411///
15412/// A builder for the *occurrences.create* method supported by a *project* resource.
15413/// It is not used directly, but through a [`ProjectMethods`] instance.
15414///
15415/// # Example
15416///
15417/// Instantiate a resource method builder
15418///
15419/// ```test_harness,no_run
15420/// # extern crate hyper;
15421/// # extern crate hyper_rustls;
15422/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
15423/// use containeranalysis1_beta1::api::Occurrence;
15424/// # async fn dox() {
15425/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15426///
15427/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15428/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15429/// #     .with_native_roots()
15430/// #     .unwrap()
15431/// #     .https_only()
15432/// #     .enable_http2()
15433/// #     .build();
15434///
15435/// # let executor = hyper_util::rt::TokioExecutor::new();
15436/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15437/// #     secret,
15438/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15439/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15440/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15441/// #     ),
15442/// # ).build().await.unwrap();
15443///
15444/// # let client = hyper_util::client::legacy::Client::builder(
15445/// #     hyper_util::rt::TokioExecutor::new()
15446/// # )
15447/// # .build(
15448/// #     hyper_rustls::HttpsConnectorBuilder::new()
15449/// #         .with_native_roots()
15450/// #         .unwrap()
15451/// #         .https_or_http()
15452/// #         .enable_http2()
15453/// #         .build()
15454/// # );
15455/// # let mut hub = ContainerAnalysis::new(client, auth);
15456/// // As the method needs a request, you would usually fill it with the desired information
15457/// // into the respective structure. Some of the parts shown here might not be applicable !
15458/// // Values shown here are possibly random and not representative !
15459/// let mut req = Occurrence::default();
15460///
15461/// // You can configure optional parameters by calling the respective setters at will, and
15462/// // execute the final call using `doit()`.
15463/// // Values shown here are possibly random and not representative !
15464/// let result = hub.projects().occurrences_create(req, "parent")
15465///              .doit().await;
15466/// # }
15467/// ```
15468pub struct ProjectOccurrenceCreateCall<'a, C>
15469where
15470    C: 'a,
15471{
15472    hub: &'a ContainerAnalysis<C>,
15473    _request: Occurrence,
15474    _parent: String,
15475    _delegate: Option<&'a mut dyn common::Delegate>,
15476    _additional_params: HashMap<String, String>,
15477    _scopes: BTreeSet<String>,
15478}
15479
15480impl<'a, C> common::CallBuilder for ProjectOccurrenceCreateCall<'a, C> {}
15481
15482impl<'a, C> ProjectOccurrenceCreateCall<'a, C>
15483where
15484    C: common::Connector,
15485{
15486    /// Perform the operation you have build so far.
15487    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
15488        use std::borrow::Cow;
15489        use std::io::{Read, Seek};
15490
15491        use common::{url::Params, ToParts};
15492        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15493
15494        let mut dd = common::DefaultDelegate;
15495        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15496        dlg.begin(common::MethodInfo {
15497            id: "containeranalysis.projects.occurrences.create",
15498            http_method: hyper::Method::POST,
15499        });
15500
15501        for &field in ["alt", "parent"].iter() {
15502            if self._additional_params.contains_key(field) {
15503                dlg.finished(false);
15504                return Err(common::Error::FieldClash(field));
15505            }
15506        }
15507
15508        let mut params = Params::with_capacity(4 + self._additional_params.len());
15509        params.push("parent", self._parent);
15510
15511        params.extend(self._additional_params.iter());
15512
15513        params.push("alt", "json");
15514        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
15515        if self._scopes.is_empty() {
15516            self._scopes
15517                .insert(Scope::CloudPlatform.as_ref().to_string());
15518        }
15519
15520        #[allow(clippy::single_element_loop)]
15521        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15522            url = params.uri_replacement(url, param_name, find_this, true);
15523        }
15524        {
15525            let to_remove = ["parent"];
15526            params.remove_params(&to_remove);
15527        }
15528
15529        let url = params.parse_with_url(&url);
15530
15531        let mut json_mime_type = mime::APPLICATION_JSON;
15532        let mut request_value_reader = {
15533            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15534            common::remove_json_null_values(&mut value);
15535            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15536            serde_json::to_writer(&mut dst, &value).unwrap();
15537            dst
15538        };
15539        let request_size = request_value_reader
15540            .seek(std::io::SeekFrom::End(0))
15541            .unwrap();
15542        request_value_reader
15543            .seek(std::io::SeekFrom::Start(0))
15544            .unwrap();
15545
15546        loop {
15547            let token = match self
15548                .hub
15549                .auth
15550                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15551                .await
15552            {
15553                Ok(token) => token,
15554                Err(e) => match dlg.token(e) {
15555                    Ok(token) => token,
15556                    Err(e) => {
15557                        dlg.finished(false);
15558                        return Err(common::Error::MissingToken(e));
15559                    }
15560                },
15561            };
15562            request_value_reader
15563                .seek(std::io::SeekFrom::Start(0))
15564                .unwrap();
15565            let mut req_result = {
15566                let client = &self.hub.client;
15567                dlg.pre_request();
15568                let mut req_builder = hyper::Request::builder()
15569                    .method(hyper::Method::POST)
15570                    .uri(url.as_str())
15571                    .header(USER_AGENT, self.hub._user_agent.clone());
15572
15573                if let Some(token) = token.as_ref() {
15574                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15575                }
15576
15577                let request = req_builder
15578                    .header(CONTENT_TYPE, json_mime_type.to_string())
15579                    .header(CONTENT_LENGTH, request_size as u64)
15580                    .body(common::to_body(
15581                        request_value_reader.get_ref().clone().into(),
15582                    ));
15583
15584                client.request(request.unwrap()).await
15585            };
15586
15587            match req_result {
15588                Err(err) => {
15589                    if let common::Retry::After(d) = dlg.http_error(&err) {
15590                        sleep(d).await;
15591                        continue;
15592                    }
15593                    dlg.finished(false);
15594                    return Err(common::Error::HttpError(err));
15595                }
15596                Ok(res) => {
15597                    let (mut parts, body) = res.into_parts();
15598                    let mut body = common::Body::new(body);
15599                    if !parts.status.is_success() {
15600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15601                        let error = serde_json::from_str(&common::to_string(&bytes));
15602                        let response = common::to_response(parts, bytes.into());
15603
15604                        if let common::Retry::After(d) =
15605                            dlg.http_failure(&response, error.as_ref().ok())
15606                        {
15607                            sleep(d).await;
15608                            continue;
15609                        }
15610
15611                        dlg.finished(false);
15612
15613                        return Err(match error {
15614                            Ok(value) => common::Error::BadRequest(value),
15615                            _ => common::Error::Failure(response),
15616                        });
15617                    }
15618                    let response = {
15619                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15620                        let encoded = common::to_string(&bytes);
15621                        match serde_json::from_str(&encoded) {
15622                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15623                            Err(error) => {
15624                                dlg.response_json_decode_error(&encoded, &error);
15625                                return Err(common::Error::JsonDecodeError(
15626                                    encoded.to_string(),
15627                                    error,
15628                                ));
15629                            }
15630                        }
15631                    };
15632
15633                    dlg.finished(true);
15634                    return Ok(response);
15635                }
15636            }
15637        }
15638    }
15639
15640    ///
15641    /// Sets the *request* property to the given value.
15642    ///
15643    /// Even though the property as already been set when instantiating this call,
15644    /// we provide this method for API completeness.
15645    pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrenceCreateCall<'a, C> {
15646        self._request = new_value;
15647        self
15648    }
15649    /// Required. The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created.
15650    ///
15651    /// Sets the *parent* path property to the given value.
15652    ///
15653    /// Even though the property as already been set when instantiating this call,
15654    /// we provide this method for API completeness.
15655    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceCreateCall<'a, C> {
15656        self._parent = new_value.to_string();
15657        self
15658    }
15659    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15660    /// while executing the actual API request.
15661    ///
15662    /// ````text
15663    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15664    /// ````
15665    ///
15666    /// Sets the *delegate* property to the given value.
15667    pub fn delegate(
15668        mut self,
15669        new_value: &'a mut dyn common::Delegate,
15670    ) -> ProjectOccurrenceCreateCall<'a, C> {
15671        self._delegate = Some(new_value);
15672        self
15673    }
15674
15675    /// Set any additional parameter of the query string used in the request.
15676    /// It should be used to set parameters which are not yet available through their own
15677    /// setters.
15678    ///
15679    /// Please note that this method must not be used to set any of the known parameters
15680    /// which have their own setter method. If done anyway, the request will fail.
15681    ///
15682    /// # Additional Parameters
15683    ///
15684    /// * *$.xgafv* (query-string) - V1 error format.
15685    /// * *access_token* (query-string) - OAuth access token.
15686    /// * *alt* (query-string) - Data format for response.
15687    /// * *callback* (query-string) - JSONP
15688    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15689    /// * *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.
15690    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15691    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15692    /// * *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.
15693    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15694    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15695    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceCreateCall<'a, C>
15696    where
15697        T: AsRef<str>,
15698    {
15699        self._additional_params
15700            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15701        self
15702    }
15703
15704    /// Identifies the authorization scope for the method you are building.
15705    ///
15706    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15707    /// [`Scope::CloudPlatform`].
15708    ///
15709    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15710    /// tokens for more than one scope.
15711    ///
15712    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15713    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15714    /// sufficient, a read-write scope will do as well.
15715    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceCreateCall<'a, C>
15716    where
15717        St: AsRef<str>,
15718    {
15719        self._scopes.insert(String::from(scope.as_ref()));
15720        self
15721    }
15722    /// Identifies the authorization scope(s) for the method you are building.
15723    ///
15724    /// See [`Self::add_scope()`] for details.
15725    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceCreateCall<'a, C>
15726    where
15727        I: IntoIterator<Item = St>,
15728        St: AsRef<str>,
15729    {
15730        self._scopes
15731            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15732        self
15733    }
15734
15735    /// Removes all scopes, and no default scope will be used either.
15736    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15737    /// for details).
15738    pub fn clear_scopes(mut self) -> ProjectOccurrenceCreateCall<'a, C> {
15739        self._scopes.clear();
15740        self
15741    }
15742}
15743
15744/// Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.
15745///
15746/// A builder for the *occurrences.delete* method supported by a *project* resource.
15747/// It is not used directly, but through a [`ProjectMethods`] instance.
15748///
15749/// # Example
15750///
15751/// Instantiate a resource method builder
15752///
15753/// ```test_harness,no_run
15754/// # extern crate hyper;
15755/// # extern crate hyper_rustls;
15756/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
15757/// # async fn dox() {
15758/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15759///
15760/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15761/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15762/// #     .with_native_roots()
15763/// #     .unwrap()
15764/// #     .https_only()
15765/// #     .enable_http2()
15766/// #     .build();
15767///
15768/// # let executor = hyper_util::rt::TokioExecutor::new();
15769/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15770/// #     secret,
15771/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15772/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15773/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15774/// #     ),
15775/// # ).build().await.unwrap();
15776///
15777/// # let client = hyper_util::client::legacy::Client::builder(
15778/// #     hyper_util::rt::TokioExecutor::new()
15779/// # )
15780/// # .build(
15781/// #     hyper_rustls::HttpsConnectorBuilder::new()
15782/// #         .with_native_roots()
15783/// #         .unwrap()
15784/// #         .https_or_http()
15785/// #         .enable_http2()
15786/// #         .build()
15787/// # );
15788/// # let mut hub = ContainerAnalysis::new(client, auth);
15789/// // You can configure optional parameters by calling the respective setters at will, and
15790/// // execute the final call using `doit()`.
15791/// // Values shown here are possibly random and not representative !
15792/// let result = hub.projects().occurrences_delete("name")
15793///              .doit().await;
15794/// # }
15795/// ```
15796pub struct ProjectOccurrenceDeleteCall<'a, C>
15797where
15798    C: 'a,
15799{
15800    hub: &'a ContainerAnalysis<C>,
15801    _name: String,
15802    _delegate: Option<&'a mut dyn common::Delegate>,
15803    _additional_params: HashMap<String, String>,
15804    _scopes: BTreeSet<String>,
15805}
15806
15807impl<'a, C> common::CallBuilder for ProjectOccurrenceDeleteCall<'a, C> {}
15808
15809impl<'a, C> ProjectOccurrenceDeleteCall<'a, C>
15810where
15811    C: common::Connector,
15812{
15813    /// Perform the operation you have build so far.
15814    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
15815        use std::borrow::Cow;
15816        use std::io::{Read, Seek};
15817
15818        use common::{url::Params, ToParts};
15819        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15820
15821        let mut dd = common::DefaultDelegate;
15822        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15823        dlg.begin(common::MethodInfo {
15824            id: "containeranalysis.projects.occurrences.delete",
15825            http_method: hyper::Method::DELETE,
15826        });
15827
15828        for &field in ["alt", "name"].iter() {
15829            if self._additional_params.contains_key(field) {
15830                dlg.finished(false);
15831                return Err(common::Error::FieldClash(field));
15832            }
15833        }
15834
15835        let mut params = Params::with_capacity(3 + self._additional_params.len());
15836        params.push("name", self._name);
15837
15838        params.extend(self._additional_params.iter());
15839
15840        params.push("alt", "json");
15841        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
15842        if self._scopes.is_empty() {
15843            self._scopes
15844                .insert(Scope::CloudPlatform.as_ref().to_string());
15845        }
15846
15847        #[allow(clippy::single_element_loop)]
15848        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15849            url = params.uri_replacement(url, param_name, find_this, true);
15850        }
15851        {
15852            let to_remove = ["name"];
15853            params.remove_params(&to_remove);
15854        }
15855
15856        let url = params.parse_with_url(&url);
15857
15858        loop {
15859            let token = match self
15860                .hub
15861                .auth
15862                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15863                .await
15864            {
15865                Ok(token) => token,
15866                Err(e) => match dlg.token(e) {
15867                    Ok(token) => token,
15868                    Err(e) => {
15869                        dlg.finished(false);
15870                        return Err(common::Error::MissingToken(e));
15871                    }
15872                },
15873            };
15874            let mut req_result = {
15875                let client = &self.hub.client;
15876                dlg.pre_request();
15877                let mut req_builder = hyper::Request::builder()
15878                    .method(hyper::Method::DELETE)
15879                    .uri(url.as_str())
15880                    .header(USER_AGENT, self.hub._user_agent.clone());
15881
15882                if let Some(token) = token.as_ref() {
15883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15884                }
15885
15886                let request = req_builder
15887                    .header(CONTENT_LENGTH, 0_u64)
15888                    .body(common::to_body::<String>(None));
15889
15890                client.request(request.unwrap()).await
15891            };
15892
15893            match req_result {
15894                Err(err) => {
15895                    if let common::Retry::After(d) = dlg.http_error(&err) {
15896                        sleep(d).await;
15897                        continue;
15898                    }
15899                    dlg.finished(false);
15900                    return Err(common::Error::HttpError(err));
15901                }
15902                Ok(res) => {
15903                    let (mut parts, body) = res.into_parts();
15904                    let mut body = common::Body::new(body);
15905                    if !parts.status.is_success() {
15906                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15907                        let error = serde_json::from_str(&common::to_string(&bytes));
15908                        let response = common::to_response(parts, bytes.into());
15909
15910                        if let common::Retry::After(d) =
15911                            dlg.http_failure(&response, error.as_ref().ok())
15912                        {
15913                            sleep(d).await;
15914                            continue;
15915                        }
15916
15917                        dlg.finished(false);
15918
15919                        return Err(match error {
15920                            Ok(value) => common::Error::BadRequest(value),
15921                            _ => common::Error::Failure(response),
15922                        });
15923                    }
15924                    let response = {
15925                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15926                        let encoded = common::to_string(&bytes);
15927                        match serde_json::from_str(&encoded) {
15928                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15929                            Err(error) => {
15930                                dlg.response_json_decode_error(&encoded, &error);
15931                                return Err(common::Error::JsonDecodeError(
15932                                    encoded.to_string(),
15933                                    error,
15934                                ));
15935                            }
15936                        }
15937                    };
15938
15939                    dlg.finished(true);
15940                    return Ok(response);
15941                }
15942            }
15943        }
15944    }
15945
15946    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
15947    ///
15948    /// Sets the *name* path property to the given value.
15949    ///
15950    /// Even though the property as already been set when instantiating this call,
15951    /// we provide this method for API completeness.
15952    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceDeleteCall<'a, C> {
15953        self._name = new_value.to_string();
15954        self
15955    }
15956    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15957    /// while executing the actual API request.
15958    ///
15959    /// ````text
15960    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15961    /// ````
15962    ///
15963    /// Sets the *delegate* property to the given value.
15964    pub fn delegate(
15965        mut self,
15966        new_value: &'a mut dyn common::Delegate,
15967    ) -> ProjectOccurrenceDeleteCall<'a, C> {
15968        self._delegate = Some(new_value);
15969        self
15970    }
15971
15972    /// Set any additional parameter of the query string used in the request.
15973    /// It should be used to set parameters which are not yet available through their own
15974    /// setters.
15975    ///
15976    /// Please note that this method must not be used to set any of the known parameters
15977    /// which have their own setter method. If done anyway, the request will fail.
15978    ///
15979    /// # Additional Parameters
15980    ///
15981    /// * *$.xgafv* (query-string) - V1 error format.
15982    /// * *access_token* (query-string) - OAuth access token.
15983    /// * *alt* (query-string) - Data format for response.
15984    /// * *callback* (query-string) - JSONP
15985    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15986    /// * *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.
15987    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15988    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15989    /// * *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.
15990    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15991    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15992    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceDeleteCall<'a, C>
15993    where
15994        T: AsRef<str>,
15995    {
15996        self._additional_params
15997            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15998        self
15999    }
16000
16001    /// Identifies the authorization scope for the method you are building.
16002    ///
16003    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16004    /// [`Scope::CloudPlatform`].
16005    ///
16006    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16007    /// tokens for more than one scope.
16008    ///
16009    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16010    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16011    /// sufficient, a read-write scope will do as well.
16012    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceDeleteCall<'a, C>
16013    where
16014        St: AsRef<str>,
16015    {
16016        self._scopes.insert(String::from(scope.as_ref()));
16017        self
16018    }
16019    /// Identifies the authorization scope(s) for the method you are building.
16020    ///
16021    /// See [`Self::add_scope()`] for details.
16022    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceDeleteCall<'a, C>
16023    where
16024        I: IntoIterator<Item = St>,
16025        St: AsRef<str>,
16026    {
16027        self._scopes
16028            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16029        self
16030    }
16031
16032    /// Removes all scopes, and no default scope will be used either.
16033    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16034    /// for details).
16035    pub fn clear_scopes(mut self) -> ProjectOccurrenceDeleteCall<'a, C> {
16036        self._scopes.clear();
16037        self
16038    }
16039}
16040
16041/// Gets the specified occurrence.
16042///
16043/// A builder for the *occurrences.get* method supported by a *project* resource.
16044/// It is not used directly, but through a [`ProjectMethods`] instance.
16045///
16046/// # Example
16047///
16048/// Instantiate a resource method builder
16049///
16050/// ```test_harness,no_run
16051/// # extern crate hyper;
16052/// # extern crate hyper_rustls;
16053/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
16054/// # async fn dox() {
16055/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16056///
16057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16058/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16059/// #     .with_native_roots()
16060/// #     .unwrap()
16061/// #     .https_only()
16062/// #     .enable_http2()
16063/// #     .build();
16064///
16065/// # let executor = hyper_util::rt::TokioExecutor::new();
16066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16067/// #     secret,
16068/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16069/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16070/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16071/// #     ),
16072/// # ).build().await.unwrap();
16073///
16074/// # let client = hyper_util::client::legacy::Client::builder(
16075/// #     hyper_util::rt::TokioExecutor::new()
16076/// # )
16077/// # .build(
16078/// #     hyper_rustls::HttpsConnectorBuilder::new()
16079/// #         .with_native_roots()
16080/// #         .unwrap()
16081/// #         .https_or_http()
16082/// #         .enable_http2()
16083/// #         .build()
16084/// # );
16085/// # let mut hub = ContainerAnalysis::new(client, auth);
16086/// // You can configure optional parameters by calling the respective setters at will, and
16087/// // execute the final call using `doit()`.
16088/// // Values shown here are possibly random and not representative !
16089/// let result = hub.projects().occurrences_get("name")
16090///              .doit().await;
16091/// # }
16092/// ```
16093pub struct ProjectOccurrenceGetCall<'a, C>
16094where
16095    C: 'a,
16096{
16097    hub: &'a ContainerAnalysis<C>,
16098    _name: String,
16099    _delegate: Option<&'a mut dyn common::Delegate>,
16100    _additional_params: HashMap<String, String>,
16101    _scopes: BTreeSet<String>,
16102}
16103
16104impl<'a, C> common::CallBuilder for ProjectOccurrenceGetCall<'a, C> {}
16105
16106impl<'a, C> ProjectOccurrenceGetCall<'a, C>
16107where
16108    C: common::Connector,
16109{
16110    /// Perform the operation you have build so far.
16111    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
16112        use std::borrow::Cow;
16113        use std::io::{Read, Seek};
16114
16115        use common::{url::Params, ToParts};
16116        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16117
16118        let mut dd = common::DefaultDelegate;
16119        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16120        dlg.begin(common::MethodInfo {
16121            id: "containeranalysis.projects.occurrences.get",
16122            http_method: hyper::Method::GET,
16123        });
16124
16125        for &field in ["alt", "name"].iter() {
16126            if self._additional_params.contains_key(field) {
16127                dlg.finished(false);
16128                return Err(common::Error::FieldClash(field));
16129            }
16130        }
16131
16132        let mut params = Params::with_capacity(3 + self._additional_params.len());
16133        params.push("name", self._name);
16134
16135        params.extend(self._additional_params.iter());
16136
16137        params.push("alt", "json");
16138        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
16139        if self._scopes.is_empty() {
16140            self._scopes
16141                .insert(Scope::CloudPlatform.as_ref().to_string());
16142        }
16143
16144        #[allow(clippy::single_element_loop)]
16145        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16146            url = params.uri_replacement(url, param_name, find_this, true);
16147        }
16148        {
16149            let to_remove = ["name"];
16150            params.remove_params(&to_remove);
16151        }
16152
16153        let url = params.parse_with_url(&url);
16154
16155        loop {
16156            let token = match self
16157                .hub
16158                .auth
16159                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16160                .await
16161            {
16162                Ok(token) => token,
16163                Err(e) => match dlg.token(e) {
16164                    Ok(token) => token,
16165                    Err(e) => {
16166                        dlg.finished(false);
16167                        return Err(common::Error::MissingToken(e));
16168                    }
16169                },
16170            };
16171            let mut req_result = {
16172                let client = &self.hub.client;
16173                dlg.pre_request();
16174                let mut req_builder = hyper::Request::builder()
16175                    .method(hyper::Method::GET)
16176                    .uri(url.as_str())
16177                    .header(USER_AGENT, self.hub._user_agent.clone());
16178
16179                if let Some(token) = token.as_ref() {
16180                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16181                }
16182
16183                let request = req_builder
16184                    .header(CONTENT_LENGTH, 0_u64)
16185                    .body(common::to_body::<String>(None));
16186
16187                client.request(request.unwrap()).await
16188            };
16189
16190            match req_result {
16191                Err(err) => {
16192                    if let common::Retry::After(d) = dlg.http_error(&err) {
16193                        sleep(d).await;
16194                        continue;
16195                    }
16196                    dlg.finished(false);
16197                    return Err(common::Error::HttpError(err));
16198                }
16199                Ok(res) => {
16200                    let (mut parts, body) = res.into_parts();
16201                    let mut body = common::Body::new(body);
16202                    if !parts.status.is_success() {
16203                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16204                        let error = serde_json::from_str(&common::to_string(&bytes));
16205                        let response = common::to_response(parts, bytes.into());
16206
16207                        if let common::Retry::After(d) =
16208                            dlg.http_failure(&response, error.as_ref().ok())
16209                        {
16210                            sleep(d).await;
16211                            continue;
16212                        }
16213
16214                        dlg.finished(false);
16215
16216                        return Err(match error {
16217                            Ok(value) => common::Error::BadRequest(value),
16218                            _ => common::Error::Failure(response),
16219                        });
16220                    }
16221                    let response = {
16222                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16223                        let encoded = common::to_string(&bytes);
16224                        match serde_json::from_str(&encoded) {
16225                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16226                            Err(error) => {
16227                                dlg.response_json_decode_error(&encoded, &error);
16228                                return Err(common::Error::JsonDecodeError(
16229                                    encoded.to_string(),
16230                                    error,
16231                                ));
16232                            }
16233                        }
16234                    };
16235
16236                    dlg.finished(true);
16237                    return Ok(response);
16238                }
16239            }
16240        }
16241    }
16242
16243    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
16244    ///
16245    /// Sets the *name* path property to the given value.
16246    ///
16247    /// Even though the property as already been set when instantiating this call,
16248    /// we provide this method for API completeness.
16249    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetCall<'a, C> {
16250        self._name = new_value.to_string();
16251        self
16252    }
16253    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16254    /// while executing the actual API request.
16255    ///
16256    /// ````text
16257    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16258    /// ````
16259    ///
16260    /// Sets the *delegate* property to the given value.
16261    pub fn delegate(
16262        mut self,
16263        new_value: &'a mut dyn common::Delegate,
16264    ) -> ProjectOccurrenceGetCall<'a, C> {
16265        self._delegate = Some(new_value);
16266        self
16267    }
16268
16269    /// Set any additional parameter of the query string used in the request.
16270    /// It should be used to set parameters which are not yet available through their own
16271    /// setters.
16272    ///
16273    /// Please note that this method must not be used to set any of the known parameters
16274    /// which have their own setter method. If done anyway, the request will fail.
16275    ///
16276    /// # Additional Parameters
16277    ///
16278    /// * *$.xgafv* (query-string) - V1 error format.
16279    /// * *access_token* (query-string) - OAuth access token.
16280    /// * *alt* (query-string) - Data format for response.
16281    /// * *callback* (query-string) - JSONP
16282    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16283    /// * *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.
16284    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16285    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16286    /// * *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.
16287    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16288    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16289    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetCall<'a, C>
16290    where
16291        T: AsRef<str>,
16292    {
16293        self._additional_params
16294            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16295        self
16296    }
16297
16298    /// Identifies the authorization scope for the method you are building.
16299    ///
16300    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16301    /// [`Scope::CloudPlatform`].
16302    ///
16303    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16304    /// tokens for more than one scope.
16305    ///
16306    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16307    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16308    /// sufficient, a read-write scope will do as well.
16309    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetCall<'a, C>
16310    where
16311        St: AsRef<str>,
16312    {
16313        self._scopes.insert(String::from(scope.as_ref()));
16314        self
16315    }
16316    /// Identifies the authorization scope(s) for the method you are building.
16317    ///
16318    /// See [`Self::add_scope()`] for details.
16319    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetCall<'a, C>
16320    where
16321        I: IntoIterator<Item = St>,
16322        St: AsRef<str>,
16323    {
16324        self._scopes
16325            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16326        self
16327    }
16328
16329    /// Removes all scopes, and no default scope will be used either.
16330    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16331    /// for details).
16332    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetCall<'a, C> {
16333        self._scopes.clear();
16334        self
16335    }
16336}
16337
16338/// 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.
16339///
16340/// A builder for the *occurrences.getIamPolicy* method supported by a *project* resource.
16341/// It is not used directly, but through a [`ProjectMethods`] instance.
16342///
16343/// # Example
16344///
16345/// Instantiate a resource method builder
16346///
16347/// ```test_harness,no_run
16348/// # extern crate hyper;
16349/// # extern crate hyper_rustls;
16350/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
16351/// use containeranalysis1_beta1::api::GetIamPolicyRequest;
16352/// # async fn dox() {
16353/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16354///
16355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16356/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16357/// #     .with_native_roots()
16358/// #     .unwrap()
16359/// #     .https_only()
16360/// #     .enable_http2()
16361/// #     .build();
16362///
16363/// # let executor = hyper_util::rt::TokioExecutor::new();
16364/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16365/// #     secret,
16366/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16367/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16368/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16369/// #     ),
16370/// # ).build().await.unwrap();
16371///
16372/// # let client = hyper_util::client::legacy::Client::builder(
16373/// #     hyper_util::rt::TokioExecutor::new()
16374/// # )
16375/// # .build(
16376/// #     hyper_rustls::HttpsConnectorBuilder::new()
16377/// #         .with_native_roots()
16378/// #         .unwrap()
16379/// #         .https_or_http()
16380/// #         .enable_http2()
16381/// #         .build()
16382/// # );
16383/// # let mut hub = ContainerAnalysis::new(client, auth);
16384/// // As the method needs a request, you would usually fill it with the desired information
16385/// // into the respective structure. Some of the parts shown here might not be applicable !
16386/// // Values shown here are possibly random and not representative !
16387/// let mut req = GetIamPolicyRequest::default();
16388///
16389/// // You can configure optional parameters by calling the respective setters at will, and
16390/// // execute the final call using `doit()`.
16391/// // Values shown here are possibly random and not representative !
16392/// let result = hub.projects().occurrences_get_iam_policy(req, "resource")
16393///              .doit().await;
16394/// # }
16395/// ```
16396pub struct ProjectOccurrenceGetIamPolicyCall<'a, C>
16397where
16398    C: 'a,
16399{
16400    hub: &'a ContainerAnalysis<C>,
16401    _request: GetIamPolicyRequest,
16402    _resource: String,
16403    _delegate: Option<&'a mut dyn common::Delegate>,
16404    _additional_params: HashMap<String, String>,
16405    _scopes: BTreeSet<String>,
16406}
16407
16408impl<'a, C> common::CallBuilder for ProjectOccurrenceGetIamPolicyCall<'a, C> {}
16409
16410impl<'a, C> ProjectOccurrenceGetIamPolicyCall<'a, C>
16411where
16412    C: common::Connector,
16413{
16414    /// Perform the operation you have build so far.
16415    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16416        use std::borrow::Cow;
16417        use std::io::{Read, Seek};
16418
16419        use common::{url::Params, ToParts};
16420        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16421
16422        let mut dd = common::DefaultDelegate;
16423        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16424        dlg.begin(common::MethodInfo {
16425            id: "containeranalysis.projects.occurrences.getIamPolicy",
16426            http_method: hyper::Method::POST,
16427        });
16428
16429        for &field in ["alt", "resource"].iter() {
16430            if self._additional_params.contains_key(field) {
16431                dlg.finished(false);
16432                return Err(common::Error::FieldClash(field));
16433            }
16434        }
16435
16436        let mut params = Params::with_capacity(4 + self._additional_params.len());
16437        params.push("resource", self._resource);
16438
16439        params.extend(self._additional_params.iter());
16440
16441        params.push("alt", "json");
16442        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
16443        if self._scopes.is_empty() {
16444            self._scopes
16445                .insert(Scope::CloudPlatform.as_ref().to_string());
16446        }
16447
16448        #[allow(clippy::single_element_loop)]
16449        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16450            url = params.uri_replacement(url, param_name, find_this, true);
16451        }
16452        {
16453            let to_remove = ["resource"];
16454            params.remove_params(&to_remove);
16455        }
16456
16457        let url = params.parse_with_url(&url);
16458
16459        let mut json_mime_type = mime::APPLICATION_JSON;
16460        let mut request_value_reader = {
16461            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16462            common::remove_json_null_values(&mut value);
16463            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16464            serde_json::to_writer(&mut dst, &value).unwrap();
16465            dst
16466        };
16467        let request_size = request_value_reader
16468            .seek(std::io::SeekFrom::End(0))
16469            .unwrap();
16470        request_value_reader
16471            .seek(std::io::SeekFrom::Start(0))
16472            .unwrap();
16473
16474        loop {
16475            let token = match self
16476                .hub
16477                .auth
16478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16479                .await
16480            {
16481                Ok(token) => token,
16482                Err(e) => match dlg.token(e) {
16483                    Ok(token) => token,
16484                    Err(e) => {
16485                        dlg.finished(false);
16486                        return Err(common::Error::MissingToken(e));
16487                    }
16488                },
16489            };
16490            request_value_reader
16491                .seek(std::io::SeekFrom::Start(0))
16492                .unwrap();
16493            let mut req_result = {
16494                let client = &self.hub.client;
16495                dlg.pre_request();
16496                let mut req_builder = hyper::Request::builder()
16497                    .method(hyper::Method::POST)
16498                    .uri(url.as_str())
16499                    .header(USER_AGENT, self.hub._user_agent.clone());
16500
16501                if let Some(token) = token.as_ref() {
16502                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16503                }
16504
16505                let request = req_builder
16506                    .header(CONTENT_TYPE, json_mime_type.to_string())
16507                    .header(CONTENT_LENGTH, request_size as u64)
16508                    .body(common::to_body(
16509                        request_value_reader.get_ref().clone().into(),
16510                    ));
16511
16512                client.request(request.unwrap()).await
16513            };
16514
16515            match req_result {
16516                Err(err) => {
16517                    if let common::Retry::After(d) = dlg.http_error(&err) {
16518                        sleep(d).await;
16519                        continue;
16520                    }
16521                    dlg.finished(false);
16522                    return Err(common::Error::HttpError(err));
16523                }
16524                Ok(res) => {
16525                    let (mut parts, body) = res.into_parts();
16526                    let mut body = common::Body::new(body);
16527                    if !parts.status.is_success() {
16528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16529                        let error = serde_json::from_str(&common::to_string(&bytes));
16530                        let response = common::to_response(parts, bytes.into());
16531
16532                        if let common::Retry::After(d) =
16533                            dlg.http_failure(&response, error.as_ref().ok())
16534                        {
16535                            sleep(d).await;
16536                            continue;
16537                        }
16538
16539                        dlg.finished(false);
16540
16541                        return Err(match error {
16542                            Ok(value) => common::Error::BadRequest(value),
16543                            _ => common::Error::Failure(response),
16544                        });
16545                    }
16546                    let response = {
16547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16548                        let encoded = common::to_string(&bytes);
16549                        match serde_json::from_str(&encoded) {
16550                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16551                            Err(error) => {
16552                                dlg.response_json_decode_error(&encoded, &error);
16553                                return Err(common::Error::JsonDecodeError(
16554                                    encoded.to_string(),
16555                                    error,
16556                                ));
16557                            }
16558                        }
16559                    };
16560
16561                    dlg.finished(true);
16562                    return Ok(response);
16563                }
16564            }
16565        }
16566    }
16567
16568    ///
16569    /// Sets the *request* property to the given value.
16570    ///
16571    /// Even though the property as already been set when instantiating this call,
16572    /// we provide this method for API completeness.
16573    pub fn request(
16574        mut self,
16575        new_value: GetIamPolicyRequest,
16576    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
16577        self._request = new_value;
16578        self
16579    }
16580    /// 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.
16581    ///
16582    /// Sets the *resource* path property to the given value.
16583    ///
16584    /// Even though the property as already been set when instantiating this call,
16585    /// we provide this method for API completeness.
16586    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
16587        self._resource = new_value.to_string();
16588        self
16589    }
16590    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16591    /// while executing the actual API request.
16592    ///
16593    /// ````text
16594    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16595    /// ````
16596    ///
16597    /// Sets the *delegate* property to the given value.
16598    pub fn delegate(
16599        mut self,
16600        new_value: &'a mut dyn common::Delegate,
16601    ) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
16602        self._delegate = Some(new_value);
16603        self
16604    }
16605
16606    /// Set any additional parameter of the query string used in the request.
16607    /// It should be used to set parameters which are not yet available through their own
16608    /// setters.
16609    ///
16610    /// Please note that this method must not be used to set any of the known parameters
16611    /// which have their own setter method. If done anyway, the request will fail.
16612    ///
16613    /// # Additional Parameters
16614    ///
16615    /// * *$.xgafv* (query-string) - V1 error format.
16616    /// * *access_token* (query-string) - OAuth access token.
16617    /// * *alt* (query-string) - Data format for response.
16618    /// * *callback* (query-string) - JSONP
16619    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16620    /// * *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.
16621    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16622    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16623    /// * *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.
16624    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16625    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16626    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
16627    where
16628        T: AsRef<str>,
16629    {
16630        self._additional_params
16631            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16632        self
16633    }
16634
16635    /// Identifies the authorization scope for the method you are building.
16636    ///
16637    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16638    /// [`Scope::CloudPlatform`].
16639    ///
16640    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16641    /// tokens for more than one scope.
16642    ///
16643    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16644    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16645    /// sufficient, a read-write scope will do as well.
16646    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
16647    where
16648        St: AsRef<str>,
16649    {
16650        self._scopes.insert(String::from(scope.as_ref()));
16651        self
16652    }
16653    /// Identifies the authorization scope(s) for the method you are building.
16654    ///
16655    /// See [`Self::add_scope()`] for details.
16656    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetIamPolicyCall<'a, C>
16657    where
16658        I: IntoIterator<Item = St>,
16659        St: AsRef<str>,
16660    {
16661        self._scopes
16662            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16663        self
16664    }
16665
16666    /// Removes all scopes, and no default scope will be used either.
16667    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16668    /// for details).
16669    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetIamPolicyCall<'a, C> {
16670        self._scopes.clear();
16671        self
16672    }
16673}
16674
16675/// Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.
16676///
16677/// A builder for the *occurrences.getNotes* method supported by a *project* resource.
16678/// It is not used directly, but through a [`ProjectMethods`] instance.
16679///
16680/// # Example
16681///
16682/// Instantiate a resource method builder
16683///
16684/// ```test_harness,no_run
16685/// # extern crate hyper;
16686/// # extern crate hyper_rustls;
16687/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
16688/// # async fn dox() {
16689/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16690///
16691/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16692/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16693/// #     .with_native_roots()
16694/// #     .unwrap()
16695/// #     .https_only()
16696/// #     .enable_http2()
16697/// #     .build();
16698///
16699/// # let executor = hyper_util::rt::TokioExecutor::new();
16700/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16701/// #     secret,
16702/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16703/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16704/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16705/// #     ),
16706/// # ).build().await.unwrap();
16707///
16708/// # let client = hyper_util::client::legacy::Client::builder(
16709/// #     hyper_util::rt::TokioExecutor::new()
16710/// # )
16711/// # .build(
16712/// #     hyper_rustls::HttpsConnectorBuilder::new()
16713/// #         .with_native_roots()
16714/// #         .unwrap()
16715/// #         .https_or_http()
16716/// #         .enable_http2()
16717/// #         .build()
16718/// # );
16719/// # let mut hub = ContainerAnalysis::new(client, auth);
16720/// // You can configure optional parameters by calling the respective setters at will, and
16721/// // execute the final call using `doit()`.
16722/// // Values shown here are possibly random and not representative !
16723/// let result = hub.projects().occurrences_get_notes("name")
16724///              .doit().await;
16725/// # }
16726/// ```
16727pub struct ProjectOccurrenceGetNoteCall<'a, C>
16728where
16729    C: 'a,
16730{
16731    hub: &'a ContainerAnalysis<C>,
16732    _name: String,
16733    _delegate: Option<&'a mut dyn common::Delegate>,
16734    _additional_params: HashMap<String, String>,
16735    _scopes: BTreeSet<String>,
16736}
16737
16738impl<'a, C> common::CallBuilder for ProjectOccurrenceGetNoteCall<'a, C> {}
16739
16740impl<'a, C> ProjectOccurrenceGetNoteCall<'a, C>
16741where
16742    C: common::Connector,
16743{
16744    /// Perform the operation you have build so far.
16745    pub async fn doit(mut self) -> common::Result<(common::Response, Note)> {
16746        use std::borrow::Cow;
16747        use std::io::{Read, Seek};
16748
16749        use common::{url::Params, ToParts};
16750        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16751
16752        let mut dd = common::DefaultDelegate;
16753        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16754        dlg.begin(common::MethodInfo {
16755            id: "containeranalysis.projects.occurrences.getNotes",
16756            http_method: hyper::Method::GET,
16757        });
16758
16759        for &field in ["alt", "name"].iter() {
16760            if self._additional_params.contains_key(field) {
16761                dlg.finished(false);
16762                return Err(common::Error::FieldClash(field));
16763            }
16764        }
16765
16766        let mut params = Params::with_capacity(3 + self._additional_params.len());
16767        params.push("name", self._name);
16768
16769        params.extend(self._additional_params.iter());
16770
16771        params.push("alt", "json");
16772        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/notes";
16773        if self._scopes.is_empty() {
16774            self._scopes
16775                .insert(Scope::CloudPlatform.as_ref().to_string());
16776        }
16777
16778        #[allow(clippy::single_element_loop)]
16779        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16780            url = params.uri_replacement(url, param_name, find_this, true);
16781        }
16782        {
16783            let to_remove = ["name"];
16784            params.remove_params(&to_remove);
16785        }
16786
16787        let url = params.parse_with_url(&url);
16788
16789        loop {
16790            let token = match self
16791                .hub
16792                .auth
16793                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16794                .await
16795            {
16796                Ok(token) => token,
16797                Err(e) => match dlg.token(e) {
16798                    Ok(token) => token,
16799                    Err(e) => {
16800                        dlg.finished(false);
16801                        return Err(common::Error::MissingToken(e));
16802                    }
16803                },
16804            };
16805            let mut req_result = {
16806                let client = &self.hub.client;
16807                dlg.pre_request();
16808                let mut req_builder = hyper::Request::builder()
16809                    .method(hyper::Method::GET)
16810                    .uri(url.as_str())
16811                    .header(USER_AGENT, self.hub._user_agent.clone());
16812
16813                if let Some(token) = token.as_ref() {
16814                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16815                }
16816
16817                let request = req_builder
16818                    .header(CONTENT_LENGTH, 0_u64)
16819                    .body(common::to_body::<String>(None));
16820
16821                client.request(request.unwrap()).await
16822            };
16823
16824            match req_result {
16825                Err(err) => {
16826                    if let common::Retry::After(d) = dlg.http_error(&err) {
16827                        sleep(d).await;
16828                        continue;
16829                    }
16830                    dlg.finished(false);
16831                    return Err(common::Error::HttpError(err));
16832                }
16833                Ok(res) => {
16834                    let (mut parts, body) = res.into_parts();
16835                    let mut body = common::Body::new(body);
16836                    if !parts.status.is_success() {
16837                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16838                        let error = serde_json::from_str(&common::to_string(&bytes));
16839                        let response = common::to_response(parts, bytes.into());
16840
16841                        if let common::Retry::After(d) =
16842                            dlg.http_failure(&response, error.as_ref().ok())
16843                        {
16844                            sleep(d).await;
16845                            continue;
16846                        }
16847
16848                        dlg.finished(false);
16849
16850                        return Err(match error {
16851                            Ok(value) => common::Error::BadRequest(value),
16852                            _ => common::Error::Failure(response),
16853                        });
16854                    }
16855                    let response = {
16856                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16857                        let encoded = common::to_string(&bytes);
16858                        match serde_json::from_str(&encoded) {
16859                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16860                            Err(error) => {
16861                                dlg.response_json_decode_error(&encoded, &error);
16862                                return Err(common::Error::JsonDecodeError(
16863                                    encoded.to_string(),
16864                                    error,
16865                                ));
16866                            }
16867                        }
16868                    };
16869
16870                    dlg.finished(true);
16871                    return Ok(response);
16872                }
16873            }
16874        }
16875    }
16876
16877    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
16878    ///
16879    /// Sets the *name* path property to the given value.
16880    ///
16881    /// Even though the property as already been set when instantiating this call,
16882    /// we provide this method for API completeness.
16883    pub fn name(mut self, new_value: &str) -> ProjectOccurrenceGetNoteCall<'a, C> {
16884        self._name = new_value.to_string();
16885        self
16886    }
16887    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16888    /// while executing the actual API request.
16889    ///
16890    /// ````text
16891    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16892    /// ````
16893    ///
16894    /// Sets the *delegate* property to the given value.
16895    pub fn delegate(
16896        mut self,
16897        new_value: &'a mut dyn common::Delegate,
16898    ) -> ProjectOccurrenceGetNoteCall<'a, C> {
16899        self._delegate = Some(new_value);
16900        self
16901    }
16902
16903    /// Set any additional parameter of the query string used in the request.
16904    /// It should be used to set parameters which are not yet available through their own
16905    /// setters.
16906    ///
16907    /// Please note that this method must not be used to set any of the known parameters
16908    /// which have their own setter method. If done anyway, the request will fail.
16909    ///
16910    /// # Additional Parameters
16911    ///
16912    /// * *$.xgafv* (query-string) - V1 error format.
16913    /// * *access_token* (query-string) - OAuth access token.
16914    /// * *alt* (query-string) - Data format for response.
16915    /// * *callback* (query-string) - JSONP
16916    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16917    /// * *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.
16918    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16919    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16920    /// * *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.
16921    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16922    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16923    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceGetNoteCall<'a, C>
16924    where
16925        T: AsRef<str>,
16926    {
16927        self._additional_params
16928            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16929        self
16930    }
16931
16932    /// Identifies the authorization scope for the method you are building.
16933    ///
16934    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16935    /// [`Scope::CloudPlatform`].
16936    ///
16937    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16938    /// tokens for more than one scope.
16939    ///
16940    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16941    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16942    /// sufficient, a read-write scope will do as well.
16943    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetNoteCall<'a, C>
16944    where
16945        St: AsRef<str>,
16946    {
16947        self._scopes.insert(String::from(scope.as_ref()));
16948        self
16949    }
16950    /// Identifies the authorization scope(s) for the method you are building.
16951    ///
16952    /// See [`Self::add_scope()`] for details.
16953    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceGetNoteCall<'a, C>
16954    where
16955        I: IntoIterator<Item = St>,
16956        St: AsRef<str>,
16957    {
16958        self._scopes
16959            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16960        self
16961    }
16962
16963    /// Removes all scopes, and no default scope will be used either.
16964    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16965    /// for details).
16966    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetNoteCall<'a, C> {
16967        self._scopes.clear();
16968        self
16969    }
16970}
16971
16972/// Gets a summary of the number and severity of occurrences.
16973///
16974/// A builder for the *occurrences.getVulnerabilitySummary* method supported by a *project* resource.
16975/// It is not used directly, but through a [`ProjectMethods`] instance.
16976///
16977/// # Example
16978///
16979/// Instantiate a resource method builder
16980///
16981/// ```test_harness,no_run
16982/// # extern crate hyper;
16983/// # extern crate hyper_rustls;
16984/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
16985/// # async fn dox() {
16986/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16987///
16988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16989/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16990/// #     .with_native_roots()
16991/// #     .unwrap()
16992/// #     .https_only()
16993/// #     .enable_http2()
16994/// #     .build();
16995///
16996/// # let executor = hyper_util::rt::TokioExecutor::new();
16997/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16998/// #     secret,
16999/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17000/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17001/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17002/// #     ),
17003/// # ).build().await.unwrap();
17004///
17005/// # let client = hyper_util::client::legacy::Client::builder(
17006/// #     hyper_util::rt::TokioExecutor::new()
17007/// # )
17008/// # .build(
17009/// #     hyper_rustls::HttpsConnectorBuilder::new()
17010/// #         .with_native_roots()
17011/// #         .unwrap()
17012/// #         .https_or_http()
17013/// #         .enable_http2()
17014/// #         .build()
17015/// # );
17016/// # let mut hub = ContainerAnalysis::new(client, auth);
17017/// // You can configure optional parameters by calling the respective setters at will, and
17018/// // execute the final call using `doit()`.
17019/// // Values shown here are possibly random and not representative !
17020/// let result = hub.projects().occurrences_get_vulnerability_summary("parent")
17021///              .return_partial_success(true)
17022///              .filter("ipsum")
17023///              .doit().await;
17024/// # }
17025/// ```
17026pub struct ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
17027where
17028    C: 'a,
17029{
17030    hub: &'a ContainerAnalysis<C>,
17031    _parent: String,
17032    _return_partial_success: Option<bool>,
17033    _filter: Option<String>,
17034    _delegate: Option<&'a mut dyn common::Delegate>,
17035    _additional_params: HashMap<String, String>,
17036    _scopes: BTreeSet<String>,
17037}
17038
17039impl<'a, C> common::CallBuilder for ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {}
17040
17041impl<'a, C> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
17042where
17043    C: common::Connector,
17044{
17045    /// Perform the operation you have build so far.
17046    pub async fn doit(
17047        mut self,
17048    ) -> common::Result<(common::Response, VulnerabilityOccurrencesSummary)> {
17049        use std::borrow::Cow;
17050        use std::io::{Read, Seek};
17051
17052        use common::{url::Params, ToParts};
17053        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17054
17055        let mut dd = common::DefaultDelegate;
17056        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17057        dlg.begin(common::MethodInfo {
17058            id: "containeranalysis.projects.occurrences.getVulnerabilitySummary",
17059            http_method: hyper::Method::GET,
17060        });
17061
17062        for &field in ["alt", "parent", "returnPartialSuccess", "filter"].iter() {
17063            if self._additional_params.contains_key(field) {
17064                dlg.finished(false);
17065                return Err(common::Error::FieldClash(field));
17066            }
17067        }
17068
17069        let mut params = Params::with_capacity(5 + self._additional_params.len());
17070        params.push("parent", self._parent);
17071        if let Some(value) = self._return_partial_success.as_ref() {
17072            params.push("returnPartialSuccess", value.to_string());
17073        }
17074        if let Some(value) = self._filter.as_ref() {
17075            params.push("filter", value);
17076        }
17077
17078        params.extend(self._additional_params.iter());
17079
17080        params.push("alt", "json");
17081        let mut url =
17082            self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences:vulnerabilitySummary";
17083        if self._scopes.is_empty() {
17084            self._scopes
17085                .insert(Scope::CloudPlatform.as_ref().to_string());
17086        }
17087
17088        #[allow(clippy::single_element_loop)]
17089        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17090            url = params.uri_replacement(url, param_name, find_this, true);
17091        }
17092        {
17093            let to_remove = ["parent"];
17094            params.remove_params(&to_remove);
17095        }
17096
17097        let url = params.parse_with_url(&url);
17098
17099        loop {
17100            let token = match self
17101                .hub
17102                .auth
17103                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17104                .await
17105            {
17106                Ok(token) => token,
17107                Err(e) => match dlg.token(e) {
17108                    Ok(token) => token,
17109                    Err(e) => {
17110                        dlg.finished(false);
17111                        return Err(common::Error::MissingToken(e));
17112                    }
17113                },
17114            };
17115            let mut req_result = {
17116                let client = &self.hub.client;
17117                dlg.pre_request();
17118                let mut req_builder = hyper::Request::builder()
17119                    .method(hyper::Method::GET)
17120                    .uri(url.as_str())
17121                    .header(USER_AGENT, self.hub._user_agent.clone());
17122
17123                if let Some(token) = token.as_ref() {
17124                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17125                }
17126
17127                let request = req_builder
17128                    .header(CONTENT_LENGTH, 0_u64)
17129                    .body(common::to_body::<String>(None));
17130
17131                client.request(request.unwrap()).await
17132            };
17133
17134            match req_result {
17135                Err(err) => {
17136                    if let common::Retry::After(d) = dlg.http_error(&err) {
17137                        sleep(d).await;
17138                        continue;
17139                    }
17140                    dlg.finished(false);
17141                    return Err(common::Error::HttpError(err));
17142                }
17143                Ok(res) => {
17144                    let (mut parts, body) = res.into_parts();
17145                    let mut body = common::Body::new(body);
17146                    if !parts.status.is_success() {
17147                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17148                        let error = serde_json::from_str(&common::to_string(&bytes));
17149                        let response = common::to_response(parts, bytes.into());
17150
17151                        if let common::Retry::After(d) =
17152                            dlg.http_failure(&response, error.as_ref().ok())
17153                        {
17154                            sleep(d).await;
17155                            continue;
17156                        }
17157
17158                        dlg.finished(false);
17159
17160                        return Err(match error {
17161                            Ok(value) => common::Error::BadRequest(value),
17162                            _ => common::Error::Failure(response),
17163                        });
17164                    }
17165                    let response = {
17166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17167                        let encoded = common::to_string(&bytes);
17168                        match serde_json::from_str(&encoded) {
17169                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17170                            Err(error) => {
17171                                dlg.response_json_decode_error(&encoded, &error);
17172                                return Err(common::Error::JsonDecodeError(
17173                                    encoded.to_string(),
17174                                    error,
17175                                ));
17176                            }
17177                        }
17178                    };
17179
17180                    dlg.finished(true);
17181                    return Ok(response);
17182                }
17183            }
17184        }
17185    }
17186
17187    /// Required. The name of the project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
17188    ///
17189    /// Sets the *parent* path property to the given value.
17190    ///
17191    /// Even though the property as already been set when instantiating this call,
17192    /// we provide this method for API completeness.
17193    pub fn parent(
17194        mut self,
17195        new_value: &str,
17196    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
17197        self._parent = new_value.to_string();
17198        self
17199    }
17200    /// If set, the request will return all reachable occurrence summaries and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
17201    ///
17202    /// Sets the *return partial success* query property to the given value.
17203    pub fn return_partial_success(
17204        mut self,
17205        new_value: bool,
17206    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
17207        self._return_partial_success = Some(new_value);
17208        self
17209    }
17210    /// The filter expression.
17211    ///
17212    /// Sets the *filter* query property to the given value.
17213    pub fn filter(
17214        mut self,
17215        new_value: &str,
17216    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
17217        self._filter = Some(new_value.to_string());
17218        self
17219    }
17220    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17221    /// while executing the actual API request.
17222    ///
17223    /// ````text
17224    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17225    /// ````
17226    ///
17227    /// Sets the *delegate* property to the given value.
17228    pub fn delegate(
17229        mut self,
17230        new_value: &'a mut dyn common::Delegate,
17231    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
17232        self._delegate = Some(new_value);
17233        self
17234    }
17235
17236    /// Set any additional parameter of the query string used in the request.
17237    /// It should be used to set parameters which are not yet available through their own
17238    /// setters.
17239    ///
17240    /// Please note that this method must not be used to set any of the known parameters
17241    /// which have their own setter method. If done anyway, the request will fail.
17242    ///
17243    /// # Additional Parameters
17244    ///
17245    /// * *$.xgafv* (query-string) - V1 error format.
17246    /// * *access_token* (query-string) - OAuth access token.
17247    /// * *alt* (query-string) - Data format for response.
17248    /// * *callback* (query-string) - JSONP
17249    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17250    /// * *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.
17251    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17252    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17253    /// * *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.
17254    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17255    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17256    pub fn param<T>(
17257        mut self,
17258        name: T,
17259        value: T,
17260    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
17261    where
17262        T: AsRef<str>,
17263    {
17264        self._additional_params
17265            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17266        self
17267    }
17268
17269    /// Identifies the authorization scope for the method you are building.
17270    ///
17271    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17272    /// [`Scope::CloudPlatform`].
17273    ///
17274    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17275    /// tokens for more than one scope.
17276    ///
17277    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17278    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17279    /// sufficient, a read-write scope will do as well.
17280    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
17281    where
17282        St: AsRef<str>,
17283    {
17284        self._scopes.insert(String::from(scope.as_ref()));
17285        self
17286    }
17287    /// Identifies the authorization scope(s) for the method you are building.
17288    ///
17289    /// See [`Self::add_scope()`] for details.
17290    pub fn add_scopes<I, St>(
17291        mut self,
17292        scopes: I,
17293    ) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C>
17294    where
17295        I: IntoIterator<Item = St>,
17296        St: AsRef<str>,
17297    {
17298        self._scopes
17299            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17300        self
17301    }
17302
17303    /// Removes all scopes, and no default scope will be used either.
17304    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17305    /// for details).
17306    pub fn clear_scopes(mut self) -> ProjectOccurrenceGetVulnerabilitySummaryCall<'a, C> {
17307        self._scopes.clear();
17308        self
17309    }
17310}
17311
17312/// Lists occurrences for the specified project.
17313///
17314/// A builder for the *occurrences.list* method supported by a *project* resource.
17315/// It is not used directly, but through a [`ProjectMethods`] instance.
17316///
17317/// # Example
17318///
17319/// Instantiate a resource method builder
17320///
17321/// ```test_harness,no_run
17322/// # extern crate hyper;
17323/// # extern crate hyper_rustls;
17324/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
17325/// # async fn dox() {
17326/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17327///
17328/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17329/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17330/// #     .with_native_roots()
17331/// #     .unwrap()
17332/// #     .https_only()
17333/// #     .enable_http2()
17334/// #     .build();
17335///
17336/// # let executor = hyper_util::rt::TokioExecutor::new();
17337/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17338/// #     secret,
17339/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17340/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17341/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17342/// #     ),
17343/// # ).build().await.unwrap();
17344///
17345/// # let client = hyper_util::client::legacy::Client::builder(
17346/// #     hyper_util::rt::TokioExecutor::new()
17347/// # )
17348/// # .build(
17349/// #     hyper_rustls::HttpsConnectorBuilder::new()
17350/// #         .with_native_roots()
17351/// #         .unwrap()
17352/// #         .https_or_http()
17353/// #         .enable_http2()
17354/// #         .build()
17355/// # );
17356/// # let mut hub = ContainerAnalysis::new(client, auth);
17357/// // You can configure optional parameters by calling the respective setters at will, and
17358/// // execute the final call using `doit()`.
17359/// // Values shown here are possibly random and not representative !
17360/// let result = hub.projects().occurrences_list("parent")
17361///              .return_partial_success(true)
17362///              .page_token("consetetur")
17363///              .page_size(-28)
17364///              .filter("et")
17365///              .doit().await;
17366/// # }
17367/// ```
17368pub struct ProjectOccurrenceListCall<'a, C>
17369where
17370    C: 'a,
17371{
17372    hub: &'a ContainerAnalysis<C>,
17373    _parent: String,
17374    _return_partial_success: Option<bool>,
17375    _page_token: Option<String>,
17376    _page_size: Option<i32>,
17377    _filter: Option<String>,
17378    _delegate: Option<&'a mut dyn common::Delegate>,
17379    _additional_params: HashMap<String, String>,
17380    _scopes: BTreeSet<String>,
17381}
17382
17383impl<'a, C> common::CallBuilder for ProjectOccurrenceListCall<'a, C> {}
17384
17385impl<'a, C> ProjectOccurrenceListCall<'a, C>
17386where
17387    C: common::Connector,
17388{
17389    /// Perform the operation you have build so far.
17390    pub async fn doit(mut self) -> common::Result<(common::Response, ListOccurrencesResponse)> {
17391        use std::borrow::Cow;
17392        use std::io::{Read, Seek};
17393
17394        use common::{url::Params, ToParts};
17395        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17396
17397        let mut dd = common::DefaultDelegate;
17398        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17399        dlg.begin(common::MethodInfo {
17400            id: "containeranalysis.projects.occurrences.list",
17401            http_method: hyper::Method::GET,
17402        });
17403
17404        for &field in [
17405            "alt",
17406            "parent",
17407            "returnPartialSuccess",
17408            "pageToken",
17409            "pageSize",
17410            "filter",
17411        ]
17412        .iter()
17413        {
17414            if self._additional_params.contains_key(field) {
17415                dlg.finished(false);
17416                return Err(common::Error::FieldClash(field));
17417            }
17418        }
17419
17420        let mut params = Params::with_capacity(7 + self._additional_params.len());
17421        params.push("parent", self._parent);
17422        if let Some(value) = self._return_partial_success.as_ref() {
17423            params.push("returnPartialSuccess", value.to_string());
17424        }
17425        if let Some(value) = self._page_token.as_ref() {
17426            params.push("pageToken", value);
17427        }
17428        if let Some(value) = self._page_size.as_ref() {
17429            params.push("pageSize", value.to_string());
17430        }
17431        if let Some(value) = self._filter.as_ref() {
17432            params.push("filter", value);
17433        }
17434
17435        params.extend(self._additional_params.iter());
17436
17437        params.push("alt", "json");
17438        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/occurrences";
17439        if self._scopes.is_empty() {
17440            self._scopes
17441                .insert(Scope::CloudPlatform.as_ref().to_string());
17442        }
17443
17444        #[allow(clippy::single_element_loop)]
17445        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17446            url = params.uri_replacement(url, param_name, find_this, true);
17447        }
17448        {
17449            let to_remove = ["parent"];
17450            params.remove_params(&to_remove);
17451        }
17452
17453        let url = params.parse_with_url(&url);
17454
17455        loop {
17456            let token = match self
17457                .hub
17458                .auth
17459                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17460                .await
17461            {
17462                Ok(token) => token,
17463                Err(e) => match dlg.token(e) {
17464                    Ok(token) => token,
17465                    Err(e) => {
17466                        dlg.finished(false);
17467                        return Err(common::Error::MissingToken(e));
17468                    }
17469                },
17470            };
17471            let mut req_result = {
17472                let client = &self.hub.client;
17473                dlg.pre_request();
17474                let mut req_builder = hyper::Request::builder()
17475                    .method(hyper::Method::GET)
17476                    .uri(url.as_str())
17477                    .header(USER_AGENT, self.hub._user_agent.clone());
17478
17479                if let Some(token) = token.as_ref() {
17480                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17481                }
17482
17483                let request = req_builder
17484                    .header(CONTENT_LENGTH, 0_u64)
17485                    .body(common::to_body::<String>(None));
17486
17487                client.request(request.unwrap()).await
17488            };
17489
17490            match req_result {
17491                Err(err) => {
17492                    if let common::Retry::After(d) = dlg.http_error(&err) {
17493                        sleep(d).await;
17494                        continue;
17495                    }
17496                    dlg.finished(false);
17497                    return Err(common::Error::HttpError(err));
17498                }
17499                Ok(res) => {
17500                    let (mut parts, body) = res.into_parts();
17501                    let mut body = common::Body::new(body);
17502                    if !parts.status.is_success() {
17503                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17504                        let error = serde_json::from_str(&common::to_string(&bytes));
17505                        let response = common::to_response(parts, bytes.into());
17506
17507                        if let common::Retry::After(d) =
17508                            dlg.http_failure(&response, error.as_ref().ok())
17509                        {
17510                            sleep(d).await;
17511                            continue;
17512                        }
17513
17514                        dlg.finished(false);
17515
17516                        return Err(match error {
17517                            Ok(value) => common::Error::BadRequest(value),
17518                            _ => common::Error::Failure(response),
17519                        });
17520                    }
17521                    let response = {
17522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17523                        let encoded = common::to_string(&bytes);
17524                        match serde_json::from_str(&encoded) {
17525                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17526                            Err(error) => {
17527                                dlg.response_json_decode_error(&encoded, &error);
17528                                return Err(common::Error::JsonDecodeError(
17529                                    encoded.to_string(),
17530                                    error,
17531                                ));
17532                            }
17533                        }
17534                    };
17535
17536                    dlg.finished(true);
17537                    return Ok(response);
17538                }
17539            }
17540        }
17541    }
17542
17543    /// Required. The name of the project to list occurrences for in the form of `projects/[PROJECT_ID]`.
17544    ///
17545    /// Sets the *parent* path property to the given value.
17546    ///
17547    /// Even though the property as already been set when instantiating this call,
17548    /// we provide this method for API completeness.
17549    pub fn parent(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
17550        self._parent = new_value.to_string();
17551        self
17552    }
17553    /// If set, the request will return all reachable Occurrences and report all unreachable regions in the `unreachable` field in the response. Only applicable for requests in the global region.
17554    ///
17555    /// Sets the *return partial success* query property to the given value.
17556    pub fn return_partial_success(mut self, new_value: bool) -> ProjectOccurrenceListCall<'a, C> {
17557        self._return_partial_success = Some(new_value);
17558        self
17559    }
17560    /// Token to provide to skip to a particular spot in the list.
17561    ///
17562    /// Sets the *page token* query property to the given value.
17563    pub fn page_token(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
17564        self._page_token = Some(new_value.to_string());
17565        self
17566    }
17567    /// 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.
17568    ///
17569    /// Sets the *page size* query property to the given value.
17570    pub fn page_size(mut self, new_value: i32) -> ProjectOccurrenceListCall<'a, C> {
17571        self._page_size = Some(new_value);
17572        self
17573    }
17574    /// The filter expression.
17575    ///
17576    /// Sets the *filter* query property to the given value.
17577    pub fn filter(mut self, new_value: &str) -> ProjectOccurrenceListCall<'a, C> {
17578        self._filter = Some(new_value.to_string());
17579        self
17580    }
17581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17582    /// while executing the actual API request.
17583    ///
17584    /// ````text
17585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17586    /// ````
17587    ///
17588    /// Sets the *delegate* property to the given value.
17589    pub fn delegate(
17590        mut self,
17591        new_value: &'a mut dyn common::Delegate,
17592    ) -> ProjectOccurrenceListCall<'a, C> {
17593        self._delegate = Some(new_value);
17594        self
17595    }
17596
17597    /// Set any additional parameter of the query string used in the request.
17598    /// It should be used to set parameters which are not yet available through their own
17599    /// setters.
17600    ///
17601    /// Please note that this method must not be used to set any of the known parameters
17602    /// which have their own setter method. If done anyway, the request will fail.
17603    ///
17604    /// # Additional Parameters
17605    ///
17606    /// * *$.xgafv* (query-string) - V1 error format.
17607    /// * *access_token* (query-string) - OAuth access token.
17608    /// * *alt* (query-string) - Data format for response.
17609    /// * *callback* (query-string) - JSONP
17610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17611    /// * *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.
17612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17614    /// * *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.
17615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17617    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceListCall<'a, C>
17618    where
17619        T: AsRef<str>,
17620    {
17621        self._additional_params
17622            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17623        self
17624    }
17625
17626    /// Identifies the authorization scope for the method you are building.
17627    ///
17628    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17629    /// [`Scope::CloudPlatform`].
17630    ///
17631    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17632    /// tokens for more than one scope.
17633    ///
17634    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17635    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17636    /// sufficient, a read-write scope will do as well.
17637    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceListCall<'a, C>
17638    where
17639        St: AsRef<str>,
17640    {
17641        self._scopes.insert(String::from(scope.as_ref()));
17642        self
17643    }
17644    /// Identifies the authorization scope(s) for the method you are building.
17645    ///
17646    /// See [`Self::add_scope()`] for details.
17647    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceListCall<'a, C>
17648    where
17649        I: IntoIterator<Item = St>,
17650        St: AsRef<str>,
17651    {
17652        self._scopes
17653            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17654        self
17655    }
17656
17657    /// Removes all scopes, and no default scope will be used either.
17658    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17659    /// for details).
17660    pub fn clear_scopes(mut self) -> ProjectOccurrenceListCall<'a, C> {
17661        self._scopes.clear();
17662        self
17663    }
17664}
17665
17666/// Updates the specified occurrence.
17667///
17668/// A builder for the *occurrences.patch* method supported by a *project* resource.
17669/// It is not used directly, but through a [`ProjectMethods`] instance.
17670///
17671/// # Example
17672///
17673/// Instantiate a resource method builder
17674///
17675/// ```test_harness,no_run
17676/// # extern crate hyper;
17677/// # extern crate hyper_rustls;
17678/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
17679/// use containeranalysis1_beta1::api::Occurrence;
17680/// # async fn dox() {
17681/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17682///
17683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17684/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17685/// #     .with_native_roots()
17686/// #     .unwrap()
17687/// #     .https_only()
17688/// #     .enable_http2()
17689/// #     .build();
17690///
17691/// # let executor = hyper_util::rt::TokioExecutor::new();
17692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17693/// #     secret,
17694/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17695/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17696/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17697/// #     ),
17698/// # ).build().await.unwrap();
17699///
17700/// # let client = hyper_util::client::legacy::Client::builder(
17701/// #     hyper_util::rt::TokioExecutor::new()
17702/// # )
17703/// # .build(
17704/// #     hyper_rustls::HttpsConnectorBuilder::new()
17705/// #         .with_native_roots()
17706/// #         .unwrap()
17707/// #         .https_or_http()
17708/// #         .enable_http2()
17709/// #         .build()
17710/// # );
17711/// # let mut hub = ContainerAnalysis::new(client, auth);
17712/// // As the method needs a request, you would usually fill it with the desired information
17713/// // into the respective structure. Some of the parts shown here might not be applicable !
17714/// // Values shown here are possibly random and not representative !
17715/// let mut req = Occurrence::default();
17716///
17717/// // You can configure optional parameters by calling the respective setters at will, and
17718/// // execute the final call using `doit()`.
17719/// // Values shown here are possibly random and not representative !
17720/// let result = hub.projects().occurrences_patch(req, "name")
17721///              .update_mask(FieldMask::new::<&str>(&[]))
17722///              .doit().await;
17723/// # }
17724/// ```
17725pub struct ProjectOccurrencePatchCall<'a, C>
17726where
17727    C: 'a,
17728{
17729    hub: &'a ContainerAnalysis<C>,
17730    _request: Occurrence,
17731    _name: String,
17732    _update_mask: Option<common::FieldMask>,
17733    _delegate: Option<&'a mut dyn common::Delegate>,
17734    _additional_params: HashMap<String, String>,
17735    _scopes: BTreeSet<String>,
17736}
17737
17738impl<'a, C> common::CallBuilder for ProjectOccurrencePatchCall<'a, C> {}
17739
17740impl<'a, C> ProjectOccurrencePatchCall<'a, C>
17741where
17742    C: common::Connector,
17743{
17744    /// Perform the operation you have build so far.
17745    pub async fn doit(mut self) -> common::Result<(common::Response, Occurrence)> {
17746        use std::borrow::Cow;
17747        use std::io::{Read, Seek};
17748
17749        use common::{url::Params, ToParts};
17750        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17751
17752        let mut dd = common::DefaultDelegate;
17753        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17754        dlg.begin(common::MethodInfo {
17755            id: "containeranalysis.projects.occurrences.patch",
17756            http_method: hyper::Method::PATCH,
17757        });
17758
17759        for &field in ["alt", "name", "updateMask"].iter() {
17760            if self._additional_params.contains_key(field) {
17761                dlg.finished(false);
17762                return Err(common::Error::FieldClash(field));
17763            }
17764        }
17765
17766        let mut params = Params::with_capacity(5 + self._additional_params.len());
17767        params.push("name", self._name);
17768        if let Some(value) = self._update_mask.as_ref() {
17769            params.push("updateMask", value.to_string());
17770        }
17771
17772        params.extend(self._additional_params.iter());
17773
17774        params.push("alt", "json");
17775        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
17776        if self._scopes.is_empty() {
17777            self._scopes
17778                .insert(Scope::CloudPlatform.as_ref().to_string());
17779        }
17780
17781        #[allow(clippy::single_element_loop)]
17782        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17783            url = params.uri_replacement(url, param_name, find_this, true);
17784        }
17785        {
17786            let to_remove = ["name"];
17787            params.remove_params(&to_remove);
17788        }
17789
17790        let url = params.parse_with_url(&url);
17791
17792        let mut json_mime_type = mime::APPLICATION_JSON;
17793        let mut request_value_reader = {
17794            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17795            common::remove_json_null_values(&mut value);
17796            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17797            serde_json::to_writer(&mut dst, &value).unwrap();
17798            dst
17799        };
17800        let request_size = request_value_reader
17801            .seek(std::io::SeekFrom::End(0))
17802            .unwrap();
17803        request_value_reader
17804            .seek(std::io::SeekFrom::Start(0))
17805            .unwrap();
17806
17807        loop {
17808            let token = match self
17809                .hub
17810                .auth
17811                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17812                .await
17813            {
17814                Ok(token) => token,
17815                Err(e) => match dlg.token(e) {
17816                    Ok(token) => token,
17817                    Err(e) => {
17818                        dlg.finished(false);
17819                        return Err(common::Error::MissingToken(e));
17820                    }
17821                },
17822            };
17823            request_value_reader
17824                .seek(std::io::SeekFrom::Start(0))
17825                .unwrap();
17826            let mut req_result = {
17827                let client = &self.hub.client;
17828                dlg.pre_request();
17829                let mut req_builder = hyper::Request::builder()
17830                    .method(hyper::Method::PATCH)
17831                    .uri(url.as_str())
17832                    .header(USER_AGENT, self.hub._user_agent.clone());
17833
17834                if let Some(token) = token.as_ref() {
17835                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17836                }
17837
17838                let request = req_builder
17839                    .header(CONTENT_TYPE, json_mime_type.to_string())
17840                    .header(CONTENT_LENGTH, request_size as u64)
17841                    .body(common::to_body(
17842                        request_value_reader.get_ref().clone().into(),
17843                    ));
17844
17845                client.request(request.unwrap()).await
17846            };
17847
17848            match req_result {
17849                Err(err) => {
17850                    if let common::Retry::After(d) = dlg.http_error(&err) {
17851                        sleep(d).await;
17852                        continue;
17853                    }
17854                    dlg.finished(false);
17855                    return Err(common::Error::HttpError(err));
17856                }
17857                Ok(res) => {
17858                    let (mut parts, body) = res.into_parts();
17859                    let mut body = common::Body::new(body);
17860                    if !parts.status.is_success() {
17861                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17862                        let error = serde_json::from_str(&common::to_string(&bytes));
17863                        let response = common::to_response(parts, bytes.into());
17864
17865                        if let common::Retry::After(d) =
17866                            dlg.http_failure(&response, error.as_ref().ok())
17867                        {
17868                            sleep(d).await;
17869                            continue;
17870                        }
17871
17872                        dlg.finished(false);
17873
17874                        return Err(match error {
17875                            Ok(value) => common::Error::BadRequest(value),
17876                            _ => common::Error::Failure(response),
17877                        });
17878                    }
17879                    let response = {
17880                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17881                        let encoded = common::to_string(&bytes);
17882                        match serde_json::from_str(&encoded) {
17883                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17884                            Err(error) => {
17885                                dlg.response_json_decode_error(&encoded, &error);
17886                                return Err(common::Error::JsonDecodeError(
17887                                    encoded.to_string(),
17888                                    error,
17889                                ));
17890                            }
17891                        }
17892                    };
17893
17894                    dlg.finished(true);
17895                    return Ok(response);
17896                }
17897            }
17898        }
17899    }
17900
17901    ///
17902    /// Sets the *request* property to the given value.
17903    ///
17904    /// Even though the property as already been set when instantiating this call,
17905    /// we provide this method for API completeness.
17906    pub fn request(mut self, new_value: Occurrence) -> ProjectOccurrencePatchCall<'a, C> {
17907        self._request = new_value;
17908        self
17909    }
17910    /// Required. The name of the occurrence in the form of `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
17911    ///
17912    /// Sets the *name* path property to the given value.
17913    ///
17914    /// Even though the property as already been set when instantiating this call,
17915    /// we provide this method for API completeness.
17916    pub fn name(mut self, new_value: &str) -> ProjectOccurrencePatchCall<'a, C> {
17917        self._name = new_value.to_string();
17918        self
17919    }
17920    /// The fields to update.
17921    ///
17922    /// Sets the *update mask* query property to the given value.
17923    pub fn update_mask(
17924        mut self,
17925        new_value: common::FieldMask,
17926    ) -> ProjectOccurrencePatchCall<'a, C> {
17927        self._update_mask = Some(new_value);
17928        self
17929    }
17930    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17931    /// while executing the actual API request.
17932    ///
17933    /// ````text
17934    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17935    /// ````
17936    ///
17937    /// Sets the *delegate* property to the given value.
17938    pub fn delegate(
17939        mut self,
17940        new_value: &'a mut dyn common::Delegate,
17941    ) -> ProjectOccurrencePatchCall<'a, C> {
17942        self._delegate = Some(new_value);
17943        self
17944    }
17945
17946    /// Set any additional parameter of the query string used in the request.
17947    /// It should be used to set parameters which are not yet available through their own
17948    /// setters.
17949    ///
17950    /// Please note that this method must not be used to set any of the known parameters
17951    /// which have their own setter method. If done anyway, the request will fail.
17952    ///
17953    /// # Additional Parameters
17954    ///
17955    /// * *$.xgafv* (query-string) - V1 error format.
17956    /// * *access_token* (query-string) - OAuth access token.
17957    /// * *alt* (query-string) - Data format for response.
17958    /// * *callback* (query-string) - JSONP
17959    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17960    /// * *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.
17961    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17962    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17963    /// * *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.
17964    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17965    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17966    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrencePatchCall<'a, C>
17967    where
17968        T: AsRef<str>,
17969    {
17970        self._additional_params
17971            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17972        self
17973    }
17974
17975    /// Identifies the authorization scope for the method you are building.
17976    ///
17977    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17978    /// [`Scope::CloudPlatform`].
17979    ///
17980    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17981    /// tokens for more than one scope.
17982    ///
17983    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17984    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17985    /// sufficient, a read-write scope will do as well.
17986    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrencePatchCall<'a, C>
17987    where
17988        St: AsRef<str>,
17989    {
17990        self._scopes.insert(String::from(scope.as_ref()));
17991        self
17992    }
17993    /// Identifies the authorization scope(s) for the method you are building.
17994    ///
17995    /// See [`Self::add_scope()`] for details.
17996    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrencePatchCall<'a, C>
17997    where
17998        I: IntoIterator<Item = St>,
17999        St: AsRef<str>,
18000    {
18001        self._scopes
18002            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18003        self
18004    }
18005
18006    /// Removes all scopes, and no default scope will be used either.
18007    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18008    /// for details).
18009    pub fn clear_scopes(mut self) -> ProjectOccurrencePatchCall<'a, C> {
18010        self._scopes.clear();
18011        self
18012    }
18013}
18014
18015/// 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.
18016///
18017/// A builder for the *occurrences.setIamPolicy* method supported by a *project* resource.
18018/// It is not used directly, but through a [`ProjectMethods`] instance.
18019///
18020/// # Example
18021///
18022/// Instantiate a resource method builder
18023///
18024/// ```test_harness,no_run
18025/// # extern crate hyper;
18026/// # extern crate hyper_rustls;
18027/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
18028/// use containeranalysis1_beta1::api::SetIamPolicyRequest;
18029/// # async fn dox() {
18030/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18031///
18032/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18033/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18034/// #     .with_native_roots()
18035/// #     .unwrap()
18036/// #     .https_only()
18037/// #     .enable_http2()
18038/// #     .build();
18039///
18040/// # let executor = hyper_util::rt::TokioExecutor::new();
18041/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18042/// #     secret,
18043/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18044/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18045/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18046/// #     ),
18047/// # ).build().await.unwrap();
18048///
18049/// # let client = hyper_util::client::legacy::Client::builder(
18050/// #     hyper_util::rt::TokioExecutor::new()
18051/// # )
18052/// # .build(
18053/// #     hyper_rustls::HttpsConnectorBuilder::new()
18054/// #         .with_native_roots()
18055/// #         .unwrap()
18056/// #         .https_or_http()
18057/// #         .enable_http2()
18058/// #         .build()
18059/// # );
18060/// # let mut hub = ContainerAnalysis::new(client, auth);
18061/// // As the method needs a request, you would usually fill it with the desired information
18062/// // into the respective structure. Some of the parts shown here might not be applicable !
18063/// // Values shown here are possibly random and not representative !
18064/// let mut req = SetIamPolicyRequest::default();
18065///
18066/// // You can configure optional parameters by calling the respective setters at will, and
18067/// // execute the final call using `doit()`.
18068/// // Values shown here are possibly random and not representative !
18069/// let result = hub.projects().occurrences_set_iam_policy(req, "resource")
18070///              .doit().await;
18071/// # }
18072/// ```
18073pub struct ProjectOccurrenceSetIamPolicyCall<'a, C>
18074where
18075    C: 'a,
18076{
18077    hub: &'a ContainerAnalysis<C>,
18078    _request: SetIamPolicyRequest,
18079    _resource: String,
18080    _delegate: Option<&'a mut dyn common::Delegate>,
18081    _additional_params: HashMap<String, String>,
18082    _scopes: BTreeSet<String>,
18083}
18084
18085impl<'a, C> common::CallBuilder for ProjectOccurrenceSetIamPolicyCall<'a, C> {}
18086
18087impl<'a, C> ProjectOccurrenceSetIamPolicyCall<'a, C>
18088where
18089    C: common::Connector,
18090{
18091    /// Perform the operation you have build so far.
18092    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18093        use std::borrow::Cow;
18094        use std::io::{Read, Seek};
18095
18096        use common::{url::Params, ToParts};
18097        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18098
18099        let mut dd = common::DefaultDelegate;
18100        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18101        dlg.begin(common::MethodInfo {
18102            id: "containeranalysis.projects.occurrences.setIamPolicy",
18103            http_method: hyper::Method::POST,
18104        });
18105
18106        for &field in ["alt", "resource"].iter() {
18107            if self._additional_params.contains_key(field) {
18108                dlg.finished(false);
18109                return Err(common::Error::FieldClash(field));
18110            }
18111        }
18112
18113        let mut params = Params::with_capacity(4 + self._additional_params.len());
18114        params.push("resource", self._resource);
18115
18116        params.extend(self._additional_params.iter());
18117
18118        params.push("alt", "json");
18119        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
18120        if self._scopes.is_empty() {
18121            self._scopes
18122                .insert(Scope::CloudPlatform.as_ref().to_string());
18123        }
18124
18125        #[allow(clippy::single_element_loop)]
18126        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18127            url = params.uri_replacement(url, param_name, find_this, true);
18128        }
18129        {
18130            let to_remove = ["resource"];
18131            params.remove_params(&to_remove);
18132        }
18133
18134        let url = params.parse_with_url(&url);
18135
18136        let mut json_mime_type = mime::APPLICATION_JSON;
18137        let mut request_value_reader = {
18138            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18139            common::remove_json_null_values(&mut value);
18140            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18141            serde_json::to_writer(&mut dst, &value).unwrap();
18142            dst
18143        };
18144        let request_size = request_value_reader
18145            .seek(std::io::SeekFrom::End(0))
18146            .unwrap();
18147        request_value_reader
18148            .seek(std::io::SeekFrom::Start(0))
18149            .unwrap();
18150
18151        loop {
18152            let token = match self
18153                .hub
18154                .auth
18155                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18156                .await
18157            {
18158                Ok(token) => token,
18159                Err(e) => match dlg.token(e) {
18160                    Ok(token) => token,
18161                    Err(e) => {
18162                        dlg.finished(false);
18163                        return Err(common::Error::MissingToken(e));
18164                    }
18165                },
18166            };
18167            request_value_reader
18168                .seek(std::io::SeekFrom::Start(0))
18169                .unwrap();
18170            let mut req_result = {
18171                let client = &self.hub.client;
18172                dlg.pre_request();
18173                let mut req_builder = hyper::Request::builder()
18174                    .method(hyper::Method::POST)
18175                    .uri(url.as_str())
18176                    .header(USER_AGENT, self.hub._user_agent.clone());
18177
18178                if let Some(token) = token.as_ref() {
18179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18180                }
18181
18182                let request = req_builder
18183                    .header(CONTENT_TYPE, json_mime_type.to_string())
18184                    .header(CONTENT_LENGTH, request_size as u64)
18185                    .body(common::to_body(
18186                        request_value_reader.get_ref().clone().into(),
18187                    ));
18188
18189                client.request(request.unwrap()).await
18190            };
18191
18192            match req_result {
18193                Err(err) => {
18194                    if let common::Retry::After(d) = dlg.http_error(&err) {
18195                        sleep(d).await;
18196                        continue;
18197                    }
18198                    dlg.finished(false);
18199                    return Err(common::Error::HttpError(err));
18200                }
18201                Ok(res) => {
18202                    let (mut parts, body) = res.into_parts();
18203                    let mut body = common::Body::new(body);
18204                    if !parts.status.is_success() {
18205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18206                        let error = serde_json::from_str(&common::to_string(&bytes));
18207                        let response = common::to_response(parts, bytes.into());
18208
18209                        if let common::Retry::After(d) =
18210                            dlg.http_failure(&response, error.as_ref().ok())
18211                        {
18212                            sleep(d).await;
18213                            continue;
18214                        }
18215
18216                        dlg.finished(false);
18217
18218                        return Err(match error {
18219                            Ok(value) => common::Error::BadRequest(value),
18220                            _ => common::Error::Failure(response),
18221                        });
18222                    }
18223                    let response = {
18224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18225                        let encoded = common::to_string(&bytes);
18226                        match serde_json::from_str(&encoded) {
18227                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18228                            Err(error) => {
18229                                dlg.response_json_decode_error(&encoded, &error);
18230                                return Err(common::Error::JsonDecodeError(
18231                                    encoded.to_string(),
18232                                    error,
18233                                ));
18234                            }
18235                        }
18236                    };
18237
18238                    dlg.finished(true);
18239                    return Ok(response);
18240                }
18241            }
18242        }
18243    }
18244
18245    ///
18246    /// Sets the *request* property to the given value.
18247    ///
18248    /// Even though the property as already been set when instantiating this call,
18249    /// we provide this method for API completeness.
18250    pub fn request(
18251        mut self,
18252        new_value: SetIamPolicyRequest,
18253    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
18254        self._request = new_value;
18255        self
18256    }
18257    /// 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.
18258    ///
18259    /// Sets the *resource* path property to the given value.
18260    ///
18261    /// Even though the property as already been set when instantiating this call,
18262    /// we provide this method for API completeness.
18263    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
18264        self._resource = new_value.to_string();
18265        self
18266    }
18267    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18268    /// while executing the actual API request.
18269    ///
18270    /// ````text
18271    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18272    /// ````
18273    ///
18274    /// Sets the *delegate* property to the given value.
18275    pub fn delegate(
18276        mut self,
18277        new_value: &'a mut dyn common::Delegate,
18278    ) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
18279        self._delegate = Some(new_value);
18280        self
18281    }
18282
18283    /// Set any additional parameter of the query string used in the request.
18284    /// It should be used to set parameters which are not yet available through their own
18285    /// setters.
18286    ///
18287    /// Please note that this method must not be used to set any of the known parameters
18288    /// which have their own setter method. If done anyway, the request will fail.
18289    ///
18290    /// # Additional Parameters
18291    ///
18292    /// * *$.xgafv* (query-string) - V1 error format.
18293    /// * *access_token* (query-string) - OAuth access token.
18294    /// * *alt* (query-string) - Data format for response.
18295    /// * *callback* (query-string) - JSONP
18296    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18297    /// * *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.
18298    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18299    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18300    /// * *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.
18301    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18302    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18303    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
18304    where
18305        T: AsRef<str>,
18306    {
18307        self._additional_params
18308            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18309        self
18310    }
18311
18312    /// Identifies the authorization scope for the method you are building.
18313    ///
18314    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18315    /// [`Scope::CloudPlatform`].
18316    ///
18317    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18318    /// tokens for more than one scope.
18319    ///
18320    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18321    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18322    /// sufficient, a read-write scope will do as well.
18323    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
18324    where
18325        St: AsRef<str>,
18326    {
18327        self._scopes.insert(String::from(scope.as_ref()));
18328        self
18329    }
18330    /// Identifies the authorization scope(s) for the method you are building.
18331    ///
18332    /// See [`Self::add_scope()`] for details.
18333    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceSetIamPolicyCall<'a, C>
18334    where
18335        I: IntoIterator<Item = St>,
18336        St: AsRef<str>,
18337    {
18338        self._scopes
18339            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18340        self
18341    }
18342
18343    /// Removes all scopes, and no default scope will be used either.
18344    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18345    /// for details).
18346    pub fn clear_scopes(mut self) -> ProjectOccurrenceSetIamPolicyCall<'a, C> {
18347        self._scopes.clear();
18348        self
18349    }
18350}
18351
18352/// 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.
18353///
18354/// A builder for the *occurrences.testIamPermissions* method supported by a *project* resource.
18355/// It is not used directly, but through a [`ProjectMethods`] instance.
18356///
18357/// # Example
18358///
18359/// Instantiate a resource method builder
18360///
18361/// ```test_harness,no_run
18362/// # extern crate hyper;
18363/// # extern crate hyper_rustls;
18364/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
18365/// use containeranalysis1_beta1::api::TestIamPermissionsRequest;
18366/// # async fn dox() {
18367/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18368///
18369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18370/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18371/// #     .with_native_roots()
18372/// #     .unwrap()
18373/// #     .https_only()
18374/// #     .enable_http2()
18375/// #     .build();
18376///
18377/// # let executor = hyper_util::rt::TokioExecutor::new();
18378/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18379/// #     secret,
18380/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18381/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18382/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18383/// #     ),
18384/// # ).build().await.unwrap();
18385///
18386/// # let client = hyper_util::client::legacy::Client::builder(
18387/// #     hyper_util::rt::TokioExecutor::new()
18388/// # )
18389/// # .build(
18390/// #     hyper_rustls::HttpsConnectorBuilder::new()
18391/// #         .with_native_roots()
18392/// #         .unwrap()
18393/// #         .https_or_http()
18394/// #         .enable_http2()
18395/// #         .build()
18396/// # );
18397/// # let mut hub = ContainerAnalysis::new(client, auth);
18398/// // As the method needs a request, you would usually fill it with the desired information
18399/// // into the respective structure. Some of the parts shown here might not be applicable !
18400/// // Values shown here are possibly random and not representative !
18401/// let mut req = TestIamPermissionsRequest::default();
18402///
18403/// // You can configure optional parameters by calling the respective setters at will, and
18404/// // execute the final call using `doit()`.
18405/// // Values shown here are possibly random and not representative !
18406/// let result = hub.projects().occurrences_test_iam_permissions(req, "resource")
18407///              .doit().await;
18408/// # }
18409/// ```
18410pub struct ProjectOccurrenceTestIamPermissionCall<'a, C>
18411where
18412    C: 'a,
18413{
18414    hub: &'a ContainerAnalysis<C>,
18415    _request: TestIamPermissionsRequest,
18416    _resource: String,
18417    _delegate: Option<&'a mut dyn common::Delegate>,
18418    _additional_params: HashMap<String, String>,
18419    _scopes: BTreeSet<String>,
18420}
18421
18422impl<'a, C> common::CallBuilder for ProjectOccurrenceTestIamPermissionCall<'a, C> {}
18423
18424impl<'a, C> ProjectOccurrenceTestIamPermissionCall<'a, C>
18425where
18426    C: common::Connector,
18427{
18428    /// Perform the operation you have build so far.
18429    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
18430        use std::borrow::Cow;
18431        use std::io::{Read, Seek};
18432
18433        use common::{url::Params, ToParts};
18434        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18435
18436        let mut dd = common::DefaultDelegate;
18437        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18438        dlg.begin(common::MethodInfo {
18439            id: "containeranalysis.projects.occurrences.testIamPermissions",
18440            http_method: hyper::Method::POST,
18441        });
18442
18443        for &field in ["alt", "resource"].iter() {
18444            if self._additional_params.contains_key(field) {
18445                dlg.finished(false);
18446                return Err(common::Error::FieldClash(field));
18447            }
18448        }
18449
18450        let mut params = Params::with_capacity(4 + self._additional_params.len());
18451        params.push("resource", self._resource);
18452
18453        params.extend(self._additional_params.iter());
18454
18455        params.push("alt", "json");
18456        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
18457        if self._scopes.is_empty() {
18458            self._scopes
18459                .insert(Scope::CloudPlatform.as_ref().to_string());
18460        }
18461
18462        #[allow(clippy::single_element_loop)]
18463        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18464            url = params.uri_replacement(url, param_name, find_this, true);
18465        }
18466        {
18467            let to_remove = ["resource"];
18468            params.remove_params(&to_remove);
18469        }
18470
18471        let url = params.parse_with_url(&url);
18472
18473        let mut json_mime_type = mime::APPLICATION_JSON;
18474        let mut request_value_reader = {
18475            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18476            common::remove_json_null_values(&mut value);
18477            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18478            serde_json::to_writer(&mut dst, &value).unwrap();
18479            dst
18480        };
18481        let request_size = request_value_reader
18482            .seek(std::io::SeekFrom::End(0))
18483            .unwrap();
18484        request_value_reader
18485            .seek(std::io::SeekFrom::Start(0))
18486            .unwrap();
18487
18488        loop {
18489            let token = match self
18490                .hub
18491                .auth
18492                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18493                .await
18494            {
18495                Ok(token) => token,
18496                Err(e) => match dlg.token(e) {
18497                    Ok(token) => token,
18498                    Err(e) => {
18499                        dlg.finished(false);
18500                        return Err(common::Error::MissingToken(e));
18501                    }
18502                },
18503            };
18504            request_value_reader
18505                .seek(std::io::SeekFrom::Start(0))
18506                .unwrap();
18507            let mut req_result = {
18508                let client = &self.hub.client;
18509                dlg.pre_request();
18510                let mut req_builder = hyper::Request::builder()
18511                    .method(hyper::Method::POST)
18512                    .uri(url.as_str())
18513                    .header(USER_AGENT, self.hub._user_agent.clone());
18514
18515                if let Some(token) = token.as_ref() {
18516                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18517                }
18518
18519                let request = req_builder
18520                    .header(CONTENT_TYPE, json_mime_type.to_string())
18521                    .header(CONTENT_LENGTH, request_size as u64)
18522                    .body(common::to_body(
18523                        request_value_reader.get_ref().clone().into(),
18524                    ));
18525
18526                client.request(request.unwrap()).await
18527            };
18528
18529            match req_result {
18530                Err(err) => {
18531                    if let common::Retry::After(d) = dlg.http_error(&err) {
18532                        sleep(d).await;
18533                        continue;
18534                    }
18535                    dlg.finished(false);
18536                    return Err(common::Error::HttpError(err));
18537                }
18538                Ok(res) => {
18539                    let (mut parts, body) = res.into_parts();
18540                    let mut body = common::Body::new(body);
18541                    if !parts.status.is_success() {
18542                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18543                        let error = serde_json::from_str(&common::to_string(&bytes));
18544                        let response = common::to_response(parts, bytes.into());
18545
18546                        if let common::Retry::After(d) =
18547                            dlg.http_failure(&response, error.as_ref().ok())
18548                        {
18549                            sleep(d).await;
18550                            continue;
18551                        }
18552
18553                        dlg.finished(false);
18554
18555                        return Err(match error {
18556                            Ok(value) => common::Error::BadRequest(value),
18557                            _ => common::Error::Failure(response),
18558                        });
18559                    }
18560                    let response = {
18561                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18562                        let encoded = common::to_string(&bytes);
18563                        match serde_json::from_str(&encoded) {
18564                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18565                            Err(error) => {
18566                                dlg.response_json_decode_error(&encoded, &error);
18567                                return Err(common::Error::JsonDecodeError(
18568                                    encoded.to_string(),
18569                                    error,
18570                                ));
18571                            }
18572                        }
18573                    };
18574
18575                    dlg.finished(true);
18576                    return Ok(response);
18577                }
18578            }
18579        }
18580    }
18581
18582    ///
18583    /// Sets the *request* property to the given value.
18584    ///
18585    /// Even though the property as already been set when instantiating this call,
18586    /// we provide this method for API completeness.
18587    pub fn request(
18588        mut self,
18589        new_value: TestIamPermissionsRequest,
18590    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
18591        self._request = new_value;
18592        self
18593    }
18594    /// 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.
18595    ///
18596    /// Sets the *resource* path property to the given value.
18597    ///
18598    /// Even though the property as already been set when instantiating this call,
18599    /// we provide this method for API completeness.
18600    pub fn resource(mut self, new_value: &str) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
18601        self._resource = new_value.to_string();
18602        self
18603    }
18604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18605    /// while executing the actual API request.
18606    ///
18607    /// ````text
18608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18609    /// ````
18610    ///
18611    /// Sets the *delegate* property to the given value.
18612    pub fn delegate(
18613        mut self,
18614        new_value: &'a mut dyn common::Delegate,
18615    ) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
18616        self._delegate = Some(new_value);
18617        self
18618    }
18619
18620    /// Set any additional parameter of the query string used in the request.
18621    /// It should be used to set parameters which are not yet available through their own
18622    /// setters.
18623    ///
18624    /// Please note that this method must not be used to set any of the known parameters
18625    /// which have their own setter method. If done anyway, the request will fail.
18626    ///
18627    /// # Additional Parameters
18628    ///
18629    /// * *$.xgafv* (query-string) - V1 error format.
18630    /// * *access_token* (query-string) - OAuth access token.
18631    /// * *alt* (query-string) - Data format for response.
18632    /// * *callback* (query-string) - JSONP
18633    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18634    /// * *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.
18635    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18636    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18637    /// * *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.
18638    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18639    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18640    pub fn param<T>(mut self, name: T, value: T) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
18641    where
18642        T: AsRef<str>,
18643    {
18644        self._additional_params
18645            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18646        self
18647    }
18648
18649    /// Identifies the authorization scope for the method you are building.
18650    ///
18651    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18652    /// [`Scope::CloudPlatform`].
18653    ///
18654    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18655    /// tokens for more than one scope.
18656    ///
18657    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18658    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18659    /// sufficient, a read-write scope will do as well.
18660    pub fn add_scope<St>(mut self, scope: St) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
18661    where
18662        St: AsRef<str>,
18663    {
18664        self._scopes.insert(String::from(scope.as_ref()));
18665        self
18666    }
18667    /// Identifies the authorization scope(s) for the method you are building.
18668    ///
18669    /// See [`Self::add_scope()`] for details.
18670    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOccurrenceTestIamPermissionCall<'a, C>
18671    where
18672        I: IntoIterator<Item = St>,
18673        St: AsRef<str>,
18674    {
18675        self._scopes
18676            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18677        self
18678    }
18679
18680    /// Removes all scopes, and no default scope will be used either.
18681    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18682    /// for details).
18683    pub fn clear_scopes(mut self) -> ProjectOccurrenceTestIamPermissionCall<'a, C> {
18684        self._scopes.clear();
18685        self
18686    }
18687}
18688
18689/// Generates an SBOM and other dependency information for the given resource.
18690///
18691/// A builder for the *resources.exportSBOM* method supported by a *project* resource.
18692/// It is not used directly, but through a [`ProjectMethods`] instance.
18693///
18694/// # Example
18695///
18696/// Instantiate a resource method builder
18697///
18698/// ```test_harness,no_run
18699/// # extern crate hyper;
18700/// # extern crate hyper_rustls;
18701/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
18702/// use containeranalysis1_beta1::api::ExportSBOMRequest;
18703/// # async fn dox() {
18704/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18705///
18706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18708/// #     .with_native_roots()
18709/// #     .unwrap()
18710/// #     .https_only()
18711/// #     .enable_http2()
18712/// #     .build();
18713///
18714/// # let executor = hyper_util::rt::TokioExecutor::new();
18715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18716/// #     secret,
18717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18718/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18719/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18720/// #     ),
18721/// # ).build().await.unwrap();
18722///
18723/// # let client = hyper_util::client::legacy::Client::builder(
18724/// #     hyper_util::rt::TokioExecutor::new()
18725/// # )
18726/// # .build(
18727/// #     hyper_rustls::HttpsConnectorBuilder::new()
18728/// #         .with_native_roots()
18729/// #         .unwrap()
18730/// #         .https_or_http()
18731/// #         .enable_http2()
18732/// #         .build()
18733/// # );
18734/// # let mut hub = ContainerAnalysis::new(client, auth);
18735/// // As the method needs a request, you would usually fill it with the desired information
18736/// // into the respective structure. Some of the parts shown here might not be applicable !
18737/// // Values shown here are possibly random and not representative !
18738/// let mut req = ExportSBOMRequest::default();
18739///
18740/// // You can configure optional parameters by calling the respective setters at will, and
18741/// // execute the final call using `doit()`.
18742/// // Values shown here are possibly random and not representative !
18743/// let result = hub.projects().resources_export_sbom(req, "name")
18744///              .doit().await;
18745/// # }
18746/// ```
18747pub struct ProjectResourceExportSBOMCall<'a, C>
18748where
18749    C: 'a,
18750{
18751    hub: &'a ContainerAnalysis<C>,
18752    _request: ExportSBOMRequest,
18753    _name: String,
18754    _delegate: Option<&'a mut dyn common::Delegate>,
18755    _additional_params: HashMap<String, String>,
18756    _scopes: BTreeSet<String>,
18757}
18758
18759impl<'a, C> common::CallBuilder for ProjectResourceExportSBOMCall<'a, C> {}
18760
18761impl<'a, C> ProjectResourceExportSBOMCall<'a, C>
18762where
18763    C: common::Connector,
18764{
18765    /// Perform the operation you have build so far.
18766    pub async fn doit(mut self) -> common::Result<(common::Response, ExportSBOMResponse)> {
18767        use std::borrow::Cow;
18768        use std::io::{Read, Seek};
18769
18770        use common::{url::Params, ToParts};
18771        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18772
18773        let mut dd = common::DefaultDelegate;
18774        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18775        dlg.begin(common::MethodInfo {
18776            id: "containeranalysis.projects.resources.exportSBOM",
18777            http_method: hyper::Method::POST,
18778        });
18779
18780        for &field in ["alt", "name"].iter() {
18781            if self._additional_params.contains_key(field) {
18782                dlg.finished(false);
18783                return Err(common::Error::FieldClash(field));
18784            }
18785        }
18786
18787        let mut params = Params::with_capacity(4 + self._additional_params.len());
18788        params.push("name", self._name);
18789
18790        params.extend(self._additional_params.iter());
18791
18792        params.push("alt", "json");
18793        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:exportSBOM";
18794        if self._scopes.is_empty() {
18795            self._scopes
18796                .insert(Scope::CloudPlatform.as_ref().to_string());
18797        }
18798
18799        #[allow(clippy::single_element_loop)]
18800        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18801            url = params.uri_replacement(url, param_name, find_this, true);
18802        }
18803        {
18804            let to_remove = ["name"];
18805            params.remove_params(&to_remove);
18806        }
18807
18808        let url = params.parse_with_url(&url);
18809
18810        let mut json_mime_type = mime::APPLICATION_JSON;
18811        let mut request_value_reader = {
18812            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18813            common::remove_json_null_values(&mut value);
18814            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18815            serde_json::to_writer(&mut dst, &value).unwrap();
18816            dst
18817        };
18818        let request_size = request_value_reader
18819            .seek(std::io::SeekFrom::End(0))
18820            .unwrap();
18821        request_value_reader
18822            .seek(std::io::SeekFrom::Start(0))
18823            .unwrap();
18824
18825        loop {
18826            let token = match self
18827                .hub
18828                .auth
18829                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18830                .await
18831            {
18832                Ok(token) => token,
18833                Err(e) => match dlg.token(e) {
18834                    Ok(token) => token,
18835                    Err(e) => {
18836                        dlg.finished(false);
18837                        return Err(common::Error::MissingToken(e));
18838                    }
18839                },
18840            };
18841            request_value_reader
18842                .seek(std::io::SeekFrom::Start(0))
18843                .unwrap();
18844            let mut req_result = {
18845                let client = &self.hub.client;
18846                dlg.pre_request();
18847                let mut req_builder = hyper::Request::builder()
18848                    .method(hyper::Method::POST)
18849                    .uri(url.as_str())
18850                    .header(USER_AGENT, self.hub._user_agent.clone());
18851
18852                if let Some(token) = token.as_ref() {
18853                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18854                }
18855
18856                let request = req_builder
18857                    .header(CONTENT_TYPE, json_mime_type.to_string())
18858                    .header(CONTENT_LENGTH, request_size as u64)
18859                    .body(common::to_body(
18860                        request_value_reader.get_ref().clone().into(),
18861                    ));
18862
18863                client.request(request.unwrap()).await
18864            };
18865
18866            match req_result {
18867                Err(err) => {
18868                    if let common::Retry::After(d) = dlg.http_error(&err) {
18869                        sleep(d).await;
18870                        continue;
18871                    }
18872                    dlg.finished(false);
18873                    return Err(common::Error::HttpError(err));
18874                }
18875                Ok(res) => {
18876                    let (mut parts, body) = res.into_parts();
18877                    let mut body = common::Body::new(body);
18878                    if !parts.status.is_success() {
18879                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18880                        let error = serde_json::from_str(&common::to_string(&bytes));
18881                        let response = common::to_response(parts, bytes.into());
18882
18883                        if let common::Retry::After(d) =
18884                            dlg.http_failure(&response, error.as_ref().ok())
18885                        {
18886                            sleep(d).await;
18887                            continue;
18888                        }
18889
18890                        dlg.finished(false);
18891
18892                        return Err(match error {
18893                            Ok(value) => common::Error::BadRequest(value),
18894                            _ => common::Error::Failure(response),
18895                        });
18896                    }
18897                    let response = {
18898                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18899                        let encoded = common::to_string(&bytes);
18900                        match serde_json::from_str(&encoded) {
18901                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18902                            Err(error) => {
18903                                dlg.response_json_decode_error(&encoded, &error);
18904                                return Err(common::Error::JsonDecodeError(
18905                                    encoded.to_string(),
18906                                    error,
18907                                ));
18908                            }
18909                        }
18910                    };
18911
18912                    dlg.finished(true);
18913                    return Ok(response);
18914                }
18915            }
18916        }
18917    }
18918
18919    ///
18920    /// Sets the *request* property to the given value.
18921    ///
18922    /// Even though the property as already been set when instantiating this call,
18923    /// we provide this method for API completeness.
18924    pub fn request(mut self, new_value: ExportSBOMRequest) -> ProjectResourceExportSBOMCall<'a, C> {
18925        self._request = new_value;
18926        self
18927    }
18928    /// Required. The name of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
18929    ///
18930    /// Sets the *name* path property to the given value.
18931    ///
18932    /// Even though the property as already been set when instantiating this call,
18933    /// we provide this method for API completeness.
18934    pub fn name(mut self, new_value: &str) -> ProjectResourceExportSBOMCall<'a, C> {
18935        self._name = new_value.to_string();
18936        self
18937    }
18938    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18939    /// while executing the actual API request.
18940    ///
18941    /// ````text
18942    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18943    /// ````
18944    ///
18945    /// Sets the *delegate* property to the given value.
18946    pub fn delegate(
18947        mut self,
18948        new_value: &'a mut dyn common::Delegate,
18949    ) -> ProjectResourceExportSBOMCall<'a, C> {
18950        self._delegate = Some(new_value);
18951        self
18952    }
18953
18954    /// Set any additional parameter of the query string used in the request.
18955    /// It should be used to set parameters which are not yet available through their own
18956    /// setters.
18957    ///
18958    /// Please note that this method must not be used to set any of the known parameters
18959    /// which have their own setter method. If done anyway, the request will fail.
18960    ///
18961    /// # Additional Parameters
18962    ///
18963    /// * *$.xgafv* (query-string) - V1 error format.
18964    /// * *access_token* (query-string) - OAuth access token.
18965    /// * *alt* (query-string) - Data format for response.
18966    /// * *callback* (query-string) - JSONP
18967    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18968    /// * *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.
18969    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18970    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18971    /// * *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.
18972    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18973    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18974    pub fn param<T>(mut self, name: T, value: T) -> ProjectResourceExportSBOMCall<'a, C>
18975    where
18976        T: AsRef<str>,
18977    {
18978        self._additional_params
18979            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18980        self
18981    }
18982
18983    /// Identifies the authorization scope for the method you are building.
18984    ///
18985    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18986    /// [`Scope::CloudPlatform`].
18987    ///
18988    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18989    /// tokens for more than one scope.
18990    ///
18991    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18992    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18993    /// sufficient, a read-write scope will do as well.
18994    pub fn add_scope<St>(mut self, scope: St) -> ProjectResourceExportSBOMCall<'a, C>
18995    where
18996        St: AsRef<str>,
18997    {
18998        self._scopes.insert(String::from(scope.as_ref()));
18999        self
19000    }
19001    /// Identifies the authorization scope(s) for the method you are building.
19002    ///
19003    /// See [`Self::add_scope()`] for details.
19004    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectResourceExportSBOMCall<'a, C>
19005    where
19006        I: IntoIterator<Item = St>,
19007        St: AsRef<str>,
19008    {
19009        self._scopes
19010            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19011        self
19012    }
19013
19014    /// Removes all scopes, and no default scope will be used either.
19015    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19016    /// for details).
19017    pub fn clear_scopes(mut self) -> ProjectResourceExportSBOMCall<'a, C> {
19018        self._scopes.clear();
19019        self
19020    }
19021}
19022
19023/// Gets a summary of the packages within a given resource.
19024///
19025/// A builder for the *resources.generatePackagesSummary* method supported by a *project* resource.
19026/// It is not used directly, but through a [`ProjectMethods`] instance.
19027///
19028/// # Example
19029///
19030/// Instantiate a resource method builder
19031///
19032/// ```test_harness,no_run
19033/// # extern crate hyper;
19034/// # extern crate hyper_rustls;
19035/// # extern crate google_containeranalysis1_beta1 as containeranalysis1_beta1;
19036/// use containeranalysis1_beta1::api::GeneratePackagesSummaryRequest;
19037/// # async fn dox() {
19038/// # use containeranalysis1_beta1::{ContainerAnalysis, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19039///
19040/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19041/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19042/// #     .with_native_roots()
19043/// #     .unwrap()
19044/// #     .https_only()
19045/// #     .enable_http2()
19046/// #     .build();
19047///
19048/// # let executor = hyper_util::rt::TokioExecutor::new();
19049/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19050/// #     secret,
19051/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19052/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19053/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19054/// #     ),
19055/// # ).build().await.unwrap();
19056///
19057/// # let client = hyper_util::client::legacy::Client::builder(
19058/// #     hyper_util::rt::TokioExecutor::new()
19059/// # )
19060/// # .build(
19061/// #     hyper_rustls::HttpsConnectorBuilder::new()
19062/// #         .with_native_roots()
19063/// #         .unwrap()
19064/// #         .https_or_http()
19065/// #         .enable_http2()
19066/// #         .build()
19067/// # );
19068/// # let mut hub = ContainerAnalysis::new(client, auth);
19069/// // As the method needs a request, you would usually fill it with the desired information
19070/// // into the respective structure. Some of the parts shown here might not be applicable !
19071/// // Values shown here are possibly random and not representative !
19072/// let mut req = GeneratePackagesSummaryRequest::default();
19073///
19074/// // You can configure optional parameters by calling the respective setters at will, and
19075/// // execute the final call using `doit()`.
19076/// // Values shown here are possibly random and not representative !
19077/// let result = hub.projects().resources_generate_packages_summary(req, "name")
19078///              .doit().await;
19079/// # }
19080/// ```
19081pub struct ProjectResourceGeneratePackagesSummaryCall<'a, C>
19082where
19083    C: 'a,
19084{
19085    hub: &'a ContainerAnalysis<C>,
19086    _request: GeneratePackagesSummaryRequest,
19087    _name: String,
19088    _delegate: Option<&'a mut dyn common::Delegate>,
19089    _additional_params: HashMap<String, String>,
19090    _scopes: BTreeSet<String>,
19091}
19092
19093impl<'a, C> common::CallBuilder for ProjectResourceGeneratePackagesSummaryCall<'a, C> {}
19094
19095impl<'a, C> ProjectResourceGeneratePackagesSummaryCall<'a, C>
19096where
19097    C: common::Connector,
19098{
19099    /// Perform the operation you have build so far.
19100    pub async fn doit(mut self) -> common::Result<(common::Response, PackagesSummaryResponse)> {
19101        use std::borrow::Cow;
19102        use std::io::{Read, Seek};
19103
19104        use common::{url::Params, ToParts};
19105        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19106
19107        let mut dd = common::DefaultDelegate;
19108        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19109        dlg.begin(common::MethodInfo {
19110            id: "containeranalysis.projects.resources.generatePackagesSummary",
19111            http_method: hyper::Method::POST,
19112        });
19113
19114        for &field in ["alt", "name"].iter() {
19115            if self._additional_params.contains_key(field) {
19116                dlg.finished(false);
19117                return Err(common::Error::FieldClash(field));
19118            }
19119        }
19120
19121        let mut params = Params::with_capacity(4 + self._additional_params.len());
19122        params.push("name", self._name);
19123
19124        params.extend(self._additional_params.iter());
19125
19126        params.push("alt", "json");
19127        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:generatePackagesSummary";
19128        if self._scopes.is_empty() {
19129            self._scopes
19130                .insert(Scope::CloudPlatform.as_ref().to_string());
19131        }
19132
19133        #[allow(clippy::single_element_loop)]
19134        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19135            url = params.uri_replacement(url, param_name, find_this, true);
19136        }
19137        {
19138            let to_remove = ["name"];
19139            params.remove_params(&to_remove);
19140        }
19141
19142        let url = params.parse_with_url(&url);
19143
19144        let mut json_mime_type = mime::APPLICATION_JSON;
19145        let mut request_value_reader = {
19146            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19147            common::remove_json_null_values(&mut value);
19148            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19149            serde_json::to_writer(&mut dst, &value).unwrap();
19150            dst
19151        };
19152        let request_size = request_value_reader
19153            .seek(std::io::SeekFrom::End(0))
19154            .unwrap();
19155        request_value_reader
19156            .seek(std::io::SeekFrom::Start(0))
19157            .unwrap();
19158
19159        loop {
19160            let token = match self
19161                .hub
19162                .auth
19163                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19164                .await
19165            {
19166                Ok(token) => token,
19167                Err(e) => match dlg.token(e) {
19168                    Ok(token) => token,
19169                    Err(e) => {
19170                        dlg.finished(false);
19171                        return Err(common::Error::MissingToken(e));
19172                    }
19173                },
19174            };
19175            request_value_reader
19176                .seek(std::io::SeekFrom::Start(0))
19177                .unwrap();
19178            let mut req_result = {
19179                let client = &self.hub.client;
19180                dlg.pre_request();
19181                let mut req_builder = hyper::Request::builder()
19182                    .method(hyper::Method::POST)
19183                    .uri(url.as_str())
19184                    .header(USER_AGENT, self.hub._user_agent.clone());
19185
19186                if let Some(token) = token.as_ref() {
19187                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19188                }
19189
19190                let request = req_builder
19191                    .header(CONTENT_TYPE, json_mime_type.to_string())
19192                    .header(CONTENT_LENGTH, request_size as u64)
19193                    .body(common::to_body(
19194                        request_value_reader.get_ref().clone().into(),
19195                    ));
19196
19197                client.request(request.unwrap()).await
19198            };
19199
19200            match req_result {
19201                Err(err) => {
19202                    if let common::Retry::After(d) = dlg.http_error(&err) {
19203                        sleep(d).await;
19204                        continue;
19205                    }
19206                    dlg.finished(false);
19207                    return Err(common::Error::HttpError(err));
19208                }
19209                Ok(res) => {
19210                    let (mut parts, body) = res.into_parts();
19211                    let mut body = common::Body::new(body);
19212                    if !parts.status.is_success() {
19213                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19214                        let error = serde_json::from_str(&common::to_string(&bytes));
19215                        let response = common::to_response(parts, bytes.into());
19216
19217                        if let common::Retry::After(d) =
19218                            dlg.http_failure(&response, error.as_ref().ok())
19219                        {
19220                            sleep(d).await;
19221                            continue;
19222                        }
19223
19224                        dlg.finished(false);
19225
19226                        return Err(match error {
19227                            Ok(value) => common::Error::BadRequest(value),
19228                            _ => common::Error::Failure(response),
19229                        });
19230                    }
19231                    let response = {
19232                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19233                        let encoded = common::to_string(&bytes);
19234                        match serde_json::from_str(&encoded) {
19235                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19236                            Err(error) => {
19237                                dlg.response_json_decode_error(&encoded, &error);
19238                                return Err(common::Error::JsonDecodeError(
19239                                    encoded.to_string(),
19240                                    error,
19241                                ));
19242                            }
19243                        }
19244                    };
19245
19246                    dlg.finished(true);
19247                    return Ok(response);
19248                }
19249            }
19250        }
19251    }
19252
19253    ///
19254    /// Sets the *request* property to the given value.
19255    ///
19256    /// Even though the property as already been set when instantiating this call,
19257    /// we provide this method for API completeness.
19258    pub fn request(
19259        mut self,
19260        new_value: GeneratePackagesSummaryRequest,
19261    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
19262        self._request = new_value;
19263        self
19264    }
19265    /// Required. The name of the resource to get a packages summary for in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
19266    ///
19267    /// Sets the *name* path property to the given value.
19268    ///
19269    /// Even though the property as already been set when instantiating this call,
19270    /// we provide this method for API completeness.
19271    pub fn name(mut self, new_value: &str) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
19272        self._name = new_value.to_string();
19273        self
19274    }
19275    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19276    /// while executing the actual API request.
19277    ///
19278    /// ````text
19279    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19280    /// ````
19281    ///
19282    /// Sets the *delegate* property to the given value.
19283    pub fn delegate(
19284        mut self,
19285        new_value: &'a mut dyn common::Delegate,
19286    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
19287        self._delegate = Some(new_value);
19288        self
19289    }
19290
19291    /// Set any additional parameter of the query string used in the request.
19292    /// It should be used to set parameters which are not yet available through their own
19293    /// setters.
19294    ///
19295    /// Please note that this method must not be used to set any of the known parameters
19296    /// which have their own setter method. If done anyway, the request will fail.
19297    ///
19298    /// # Additional Parameters
19299    ///
19300    /// * *$.xgafv* (query-string) - V1 error format.
19301    /// * *access_token* (query-string) - OAuth access token.
19302    /// * *alt* (query-string) - Data format for response.
19303    /// * *callback* (query-string) - JSONP
19304    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19305    /// * *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.
19306    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19307    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19308    /// * *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.
19309    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19310    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19311    pub fn param<T>(
19312        mut self,
19313        name: T,
19314        value: T,
19315    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
19316    where
19317        T: AsRef<str>,
19318    {
19319        self._additional_params
19320            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19321        self
19322    }
19323
19324    /// Identifies the authorization scope for the method you are building.
19325    ///
19326    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19327    /// [`Scope::CloudPlatform`].
19328    ///
19329    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19330    /// tokens for more than one scope.
19331    ///
19332    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19333    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19334    /// sufficient, a read-write scope will do as well.
19335    pub fn add_scope<St>(mut self, scope: St) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
19336    where
19337        St: AsRef<str>,
19338    {
19339        self._scopes.insert(String::from(scope.as_ref()));
19340        self
19341    }
19342    /// Identifies the authorization scope(s) for the method you are building.
19343    ///
19344    /// See [`Self::add_scope()`] for details.
19345    pub fn add_scopes<I, St>(
19346        mut self,
19347        scopes: I,
19348    ) -> ProjectResourceGeneratePackagesSummaryCall<'a, C>
19349    where
19350        I: IntoIterator<Item = St>,
19351        St: AsRef<str>,
19352    {
19353        self._scopes
19354            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19355        self
19356    }
19357
19358    /// Removes all scopes, and no default scope will be used either.
19359    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19360    /// for details).
19361    pub fn clear_scopes(mut self) -> ProjectResourceGeneratePackagesSummaryCall<'a, C> {
19362        self._scopes.clear();
19363        self
19364    }
19365}