nominal-api-proto 0.1478.0

Protobuf/gRPC API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArtifactScan {
    #[prost(string, tag = "1")]
    pub scan_uuid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub input_object_key: ::prost::alloc::string::String,
    #[prost(enumeration = "ArtifactScanStatus", tag = "4")]
    pub status: i32,
    #[prost(message, optional, tag = "5")]
    pub started_at: ::core::option::Option<
        super::super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(string, optional, tag = "7")]
    pub report_object_key: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag = "8")]
    pub created_at: ::core::option::Option<
        super::super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(enumeration = "ArtifactScanType", tag = "9")]
    pub scan_type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateArtifactScanRequest {
    #[prost(message, optional, tag = "1")]
    pub artifact_scan: ::core::option::Option<ArtifactScan>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateArtifactScanResponse {
    #[prost(message, optional, tag = "1")]
    pub artifact_scan: ::core::option::Option<ArtifactScan>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetArtifactScanRequest {
    #[prost(string, tag = "1")]
    pub scan_uuid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workspace_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetArtifactScanResponse {
    #[prost(message, optional, tag = "1")]
    pub artifact_scan: ::core::option::Option<ArtifactScan>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ArtifactScanError {
    Unspecified = 0,
    InvalidRequest = 1,
    NotFound = 2,
    InputObjectKeyNotFound = 3,
    PermissionDenied = 4,
}
impl ArtifactScanError {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ARTIFACT_SCAN_ERROR_UNSPECIFIED",
            Self::InvalidRequest => "ARTIFACT_SCAN_ERROR_INVALID_REQUEST",
            Self::NotFound => "ARTIFACT_SCAN_ERROR_NOT_FOUND",
            Self::InputObjectKeyNotFound => {
                "ARTIFACT_SCAN_ERROR_INPUT_OBJECT_KEY_NOT_FOUND"
            }
            Self::PermissionDenied => "ARTIFACT_SCAN_ERROR_PERMISSION_DENIED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ARTIFACT_SCAN_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
            "ARTIFACT_SCAN_ERROR_INVALID_REQUEST" => Some(Self::InvalidRequest),
            "ARTIFACT_SCAN_ERROR_NOT_FOUND" => Some(Self::NotFound),
            "ARTIFACT_SCAN_ERROR_INPUT_OBJECT_KEY_NOT_FOUND" => {
                Some(Self::InputObjectKeyNotFound)
            }
            "ARTIFACT_SCAN_ERROR_PERMISSION_DENIED" => Some(Self::PermissionDenied),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ArtifactScanType {
    Unspecified = 0,
    JavascriptRetire = 1,
    ContainerImage = 2,
}
impl ArtifactScanType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ARTIFACT_SCAN_TYPE_UNSPECIFIED",
            Self::JavascriptRetire => "ARTIFACT_SCAN_TYPE_JAVASCRIPT_RETIRE",
            Self::ContainerImage => "ARTIFACT_SCAN_TYPE_CONTAINER_IMAGE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ARTIFACT_SCAN_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "ARTIFACT_SCAN_TYPE_JAVASCRIPT_RETIRE" => Some(Self::JavascriptRetire),
            "ARTIFACT_SCAN_TYPE_CONTAINER_IMAGE" => Some(Self::ContainerImage),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ArtifactScanStatus {
    Unspecified = 0,
    Queued = 1,
    InProgress = 2,
    Passed = 3,
    Rejected = 4,
    Failed = 5,
}
impl ArtifactScanStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ARTIFACT_SCAN_STATUS_UNSPECIFIED",
            Self::Queued => "ARTIFACT_SCAN_STATUS_QUEUED",
            Self::InProgress => "ARTIFACT_SCAN_STATUS_IN_PROGRESS",
            Self::Passed => "ARTIFACT_SCAN_STATUS_PASSED",
            Self::Rejected => "ARTIFACT_SCAN_STATUS_REJECTED",
            Self::Failed => "ARTIFACT_SCAN_STATUS_FAILED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ARTIFACT_SCAN_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "ARTIFACT_SCAN_STATUS_QUEUED" => Some(Self::Queued),
            "ARTIFACT_SCAN_STATUS_IN_PROGRESS" => Some(Self::InProgress),
            "ARTIFACT_SCAN_STATUS_PASSED" => Some(Self::Passed),
            "ARTIFACT_SCAN_STATUS_REJECTED" => Some(Self::Rejected),
            "ARTIFACT_SCAN_STATUS_FAILED" => Some(Self::Failed),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod internal_artifact_scans_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    #[derive(Debug, Clone)]
    pub struct InternalArtifactScansServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl InternalArtifactScansServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> InternalArtifactScansServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InternalArtifactScansServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            InternalArtifactScansServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        pub async fn create_artifact_scan(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateArtifactScanRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateArtifactScanResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.artifact_scanning.internal.v1.InternalArtifactScansService/CreateArtifactScan",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.artifact_scanning.internal.v1.InternalArtifactScansService",
                        "CreateArtifactScan",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn get_artifact_scan(
            &mut self,
            request: impl tonic::IntoRequest<super::GetArtifactScanRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetArtifactScanResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.artifact_scanning.internal.v1.InternalArtifactScansService/GetArtifactScan",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.artifact_scanning.internal.v1.InternalArtifactScansService",
                        "GetArtifactScan",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RunArtifactScanRequest {
    #[prost(string, tag = "1")]
    pub scan_uuid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub input_object_key: ::prost::alloc::string::String,
    #[prost(enumeration = "ArtifactScanType", tag = "4")]
    pub scan_type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetArtifactScanJobStateRequest {
    #[prost(string, tag = "1")]
    pub scan_uuid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetArtifactScanJobStateResponse {
    #[prost(enumeration = "ArtifactScanStatus", tag = "1")]
    pub state: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompleteArtifactScanRequest {
    #[prost(string, tag = "1")]
    pub scan_uuid: ::prost::alloc::string::String,
    #[prost(enumeration = "ArtifactScanResult", tag = "2")]
    pub result: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ArtifactScanResult {
    Unspecified = 0,
    Passed = 1,
    Rejected = 2,
    Failed = 3,
}
impl ArtifactScanResult {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ARTIFACT_SCAN_RESULT_UNSPECIFIED",
            Self::Passed => "ARTIFACT_SCAN_RESULT_PASSED",
            Self::Rejected => "ARTIFACT_SCAN_RESULT_REJECTED",
            Self::Failed => "ARTIFACT_SCAN_RESULT_FAILED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ARTIFACT_SCAN_RESULT_UNSPECIFIED" => Some(Self::Unspecified),
            "ARTIFACT_SCAN_RESULT_PASSED" => Some(Self::Passed),
            "ARTIFACT_SCAN_RESULT_REJECTED" => Some(Self::Rejected),
            "ARTIFACT_SCAN_RESULT_FAILED" => Some(Self::Failed),
            _ => None,
        }
    }
}