#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RelatedUrl {
#[prost(string, tag = "1")]
pub url: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub label: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Signature {
#[prost(bytes = "vec", tag = "1")]
pub signature: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "2")]
pub public_key_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NoteKind {
Unspecified = 0,
Vulnerability = 1,
Build = 2,
Image = 3,
Package = 4,
Deployment = 5,
Discovery = 6,
Attestation = 7,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Occurrence {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub resource: ::core::option::Option<Resource>,
#[prost(string, tag = "3")]
pub note_name: ::prost::alloc::string::String,
#[prost(enumeration = "NoteKind", tag = "4")]
pub kind: i32,
#[prost(string, tag = "5")]
pub remediation: ::prost::alloc::string::String,
#[prost(message, optional, tag = "6")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "7")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(oneof = "occurrence::Details", tags = "8, 9, 10, 11, 12, 13, 14")]
pub details: ::core::option::Option<occurrence::Details>,
}
pub mod occurrence {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Details {
#[prost(message, tag = "8")]
Vulnerability(super::vulnerability::Details),
#[prost(message, tag = "9")]
Build(super::build::Details),
#[prost(message, tag = "10")]
DerivedImage(super::image::Details),
#[prost(message, tag = "11")]
Installation(super::package::Details),
#[prost(message, tag = "12")]
Deployment(super::deployment::Details),
#[prost(message, tag = "13")]
Discovered(super::discovery::Details),
#[prost(message, tag = "14")]
Attestation(super::attestation::Details),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Resource {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub uri: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub content_hash: ::core::option::Option<provenance::Hash>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Note {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub short_description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub long_description: ::prost::alloc::string::String,
#[prost(enumeration = "NoteKind", tag = "4")]
pub kind: i32,
#[prost(message, repeated, tag = "5")]
pub related_url: ::prost::alloc::vec::Vec<RelatedUrl>,
#[prost(message, optional, tag = "6")]
pub expiration_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "7")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "8")]
pub update_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, repeated, tag = "9")]
pub related_note_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(oneof = "note::Type", tags = "10, 11, 12, 13, 14, 15, 16")]
pub r#type: ::core::option::Option<note::Type>,
}
pub mod note {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Type {
#[prost(message, tag = "10")]
Vulnerability(super::vulnerability::Vulnerability),
#[prost(message, tag = "11")]
Build(super::build::Build),
#[prost(message, tag = "12")]
BaseImage(super::image::Basis),
#[prost(message, tag = "13")]
Package(super::package::Package),
#[prost(message, tag = "14")]
Deployable(super::deployment::Deployable),
#[prost(message, tag = "15")]
Discovery(super::discovery::Discovery),
#[prost(message, tag = "16")]
AttestationAuthority(super::attestation::Authority),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOccurrenceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOccurrencesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub page_size: i32,
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOccurrencesResponse {
#[prost(message, repeated, tag = "1")]
pub occurrences: ::prost::alloc::vec::Vec<Occurrence>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteOccurrenceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateOccurrenceRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub occurrence: ::core::option::Option<Occurrence>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateOccurrenceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub occurrence: ::core::option::Option<Occurrence>,
#[prost(message, optional, tag = "3")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNoteRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOccurrenceNoteRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNotesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub page_size: i32,
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNotesResponse {
#[prost(message, repeated, tag = "1")]
pub notes: ::prost::alloc::vec::Vec<Note>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteNoteRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateNoteRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub note_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub note: ::core::option::Option<Note>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateNoteRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub note: ::core::option::Option<Note>,
#[prost(message, optional, tag = "3")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNoteOccurrencesRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub page_size: i32,
#[prost(string, tag = "4")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNoteOccurrencesResponse {
#[prost(message, repeated, tag = "1")]
pub occurrences: ::prost::alloc::vec::Vec<Occurrence>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateNotesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(map = "string, message", tag = "2")]
pub notes: ::std::collections::HashMap<::prost::alloc::string::String, Note>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateNotesResponse {
#[prost(message, repeated, tag = "1")]
pub notes: ::prost::alloc::vec::Vec<Note>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateOccurrencesRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub occurrences: ::prost::alloc::vec::Vec<Occurrence>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateOccurrencesResponse {
#[prost(message, repeated, tag = "1")]
pub occurrences: ::prost::alloc::vec::Vec<Occurrence>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetVulnerabilityOccurrencesSummaryRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VulnerabilityOccurrencesSummary {
#[prost(message, repeated, tag = "1")]
pub counts: ::prost::alloc::vec::Vec<vulnerability_occurrences_summary::FixableTotalByDigest>,
}
pub mod vulnerability_occurrences_summary {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FixableTotalByDigest {
#[prost(message, optional, tag = "1")]
pub resource: ::core::option::Option<super::Resource>,
#[prost(enumeration = "super::vulnerability::Severity", tag = "2")]
pub severity: i32,
#[prost(int64, tag = "3")]
pub fixable_count: i64,
#[prost(int64, tag = "4")]
pub total_count: i64,
}
}
#[doc = r" Generated client implementations."]
pub mod grafeas_v1_beta1_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " [Grafeas](grafeas.io) API."]
#[doc = ""]
#[doc = " Retrieves analysis results of Cloud components such as Docker container"]
#[doc = " images."]
#[doc = ""]
#[doc = " Analysis results are stored as a series of occurrences. An `Occurrence`"]
#[doc = " contains information about a specific analysis instance on a resource. An"]
#[doc = " occurrence refers to a `Note`. A note contains details describing the"]
#[doc = " analysis and is generally stored in a separate project, called a `Provider`."]
#[doc = " Multiple occurrences can refer to the same note."]
#[doc = ""]
#[doc = " For example, an SSL vulnerability could affect multiple images. In this case,"]
#[doc = " there would be one note for the vulnerability and an occurrence for each"]
#[doc = " image with the vulnerability referring to that note."]
#[derive(Debug, Clone)]
pub struct GrafeasV1Beta1Client<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> GrafeasV1Beta1Client<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> GrafeasV1Beta1Client<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
GrafeasV1Beta1Client::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Gets the specified occurrence."]
pub async fn get_occurrence(
&mut self,
request: impl tonic::IntoRequest<super::GetOccurrenceRequest>,
) -> Result<tonic::Response<super::Occurrence>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/GetOccurrence",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists occurrences for the specified project."]
pub async fn list_occurrences(
&mut self,
request: impl tonic::IntoRequest<super::ListOccurrencesRequest>,
) -> Result<tonic::Response<super::ListOccurrencesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/ListOccurrences",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified occurrence. For example, use this method to delete an"]
#[doc = " occurrence when the occurrence is no longer applicable for the given"]
#[doc = " resource."]
pub async fn delete_occurrence(
&mut self,
request: impl tonic::IntoRequest<super::DeleteOccurrenceRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/DeleteOccurrence",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new occurrence."]
pub async fn create_occurrence(
&mut self,
request: impl tonic::IntoRequest<super::CreateOccurrenceRequest>,
) -> Result<tonic::Response<super::Occurrence>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/CreateOccurrence",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates new occurrences in batch."]
pub async fn batch_create_occurrences(
&mut self,
request: impl tonic::IntoRequest<super::BatchCreateOccurrencesRequest>,
) -> Result<tonic::Response<super::BatchCreateOccurrencesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/BatchCreateOccurrences",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates the specified occurrence."]
pub async fn update_occurrence(
&mut self,
request: impl tonic::IntoRequest<super::UpdateOccurrenceRequest>,
) -> Result<tonic::Response<super::Occurrence>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/UpdateOccurrence",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the note attached to the specified occurrence. Consumer projects can"]
#[doc = " use this method to get a note that belongs to a provider project."]
pub async fn get_occurrence_note(
&mut self,
request: impl tonic::IntoRequest<super::GetOccurrenceNoteRequest>,
) -> Result<tonic::Response<super::Note>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/GetOccurrenceNote",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the specified note."]
pub async fn get_note(
&mut self,
request: impl tonic::IntoRequest<super::GetNoteRequest>,
) -> Result<tonic::Response<super::Note>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grafeas.v1beta1.GrafeasV1Beta1/GetNote");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists notes for the specified project."]
pub async fn list_notes(
&mut self,
request: impl tonic::IntoRequest<super::ListNotesRequest>,
) -> Result<tonic::Response<super::ListNotesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grafeas.v1beta1.GrafeasV1Beta1/ListNotes");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes the specified note."]
pub async fn delete_note(
&mut self,
request: impl tonic::IntoRequest<super::DeleteNoteRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grafeas.v1beta1.GrafeasV1Beta1/DeleteNote");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new note."]
pub async fn create_note(
&mut self,
request: impl tonic::IntoRequest<super::CreateNoteRequest>,
) -> Result<tonic::Response<super::Note>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grafeas.v1beta1.GrafeasV1Beta1/CreateNote");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates new notes in batch."]
pub async fn batch_create_notes(
&mut self,
request: impl tonic::IntoRequest<super::BatchCreateNotesRequest>,
) -> Result<tonic::Response<super::BatchCreateNotesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/BatchCreateNotes",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates the specified note."]
pub async fn update_note(
&mut self,
request: impl tonic::IntoRequest<super::UpdateNoteRequest>,
) -> Result<tonic::Response<super::Note>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/grafeas.v1beta1.GrafeasV1Beta1/UpdateNote");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists occurrences referencing the specified note. Provider projects can use"]
#[doc = " this method to get all occurrences across consumer projects referencing the"]
#[doc = " specified note."]
pub async fn list_note_occurrences(
&mut self,
request: impl tonic::IntoRequest<super::ListNoteOccurrencesRequest>,
) -> Result<tonic::Response<super::ListNoteOccurrencesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/ListNoteOccurrences",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets a summary of the number and severity of occurrences."]
pub async fn get_vulnerability_occurrences_summary(
&mut self,
request: impl tonic::IntoRequest<super::GetVulnerabilityOccurrencesSummaryRequest>,
) -> Result<tonic::Response<super::VulnerabilityOccurrencesSummary>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/grafeas.v1beta1.GrafeasV1Beta1/GetVulnerabilityOccurrencesSummary",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}