nominal-api 0.1240.0

API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PreferredRefNameConfiguration {
    #[prost(message, repeated, tag = "1")]
    pub v1: ::prost::alloc::vec::Vec<super::super::types::RefNameAndType>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcedureSettings {
    #[prost(oneof = "procedure_settings::ProcedureSettings", tags = "1")]
    pub procedure_settings: ::core::option::Option<
        procedure_settings::ProcedureSettings,
    >,
}
/// Nested message and enum types in `ProcedureSettings`.
pub mod procedure_settings {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ProcedureSettings {
        #[prost(message, tag = "1")]
        V1(super::ProcedureSettingsV1),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcedureSettingsV1 {
    #[prost(string, repeated, tag = "1")]
    pub workspace_procedures: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RemoveType {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateOrRemoveWorkspaceDisplayName {
    #[prost(
        oneof = "update_or_remove_workspace_display_name::UpdateOrRemoveWorkspaceDisplayName",
        tags = "1, 2"
    )]
    pub update_or_remove_workspace_display_name: ::core::option::Option<
        update_or_remove_workspace_display_name::UpdateOrRemoveWorkspaceDisplayName,
    >,
}
/// Nested message and enum types in `UpdateOrRemoveWorkspaceDisplayName`.
pub mod update_or_remove_workspace_display_name {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum UpdateOrRemoveWorkspaceDisplayName {
        #[prost(string, tag = "1")]
        DisplayName(::prost::alloc::string::String),
        #[prost(message, tag = "2")]
        RemoveType(super::RemoveType),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateOrRemoveWorkspaceSymbol {
    #[prost(
        oneof = "update_or_remove_workspace_symbol::UpdateOrRemoveWorkspaceSymbol",
        tags = "1, 2"
    )]
    pub update_or_remove_workspace_symbol: ::core::option::Option<
        update_or_remove_workspace_symbol::UpdateOrRemoveWorkspaceSymbol,
    >,
}
/// Nested message and enum types in `UpdateOrRemoveWorkspaceSymbol`.
pub mod update_or_remove_workspace_symbol {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum UpdateOrRemoveWorkspaceSymbol {
        #[prost(message, tag = "1")]
        Symbol(super::WorkspaceSymbol),
        #[prost(message, tag = "2")]
        RemoveType(super::RemoveType),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWorkspaceRequest {
    #[prost(message, optional, tag = "1")]
    pub display_name: ::core::option::Option<UpdateOrRemoveWorkspaceDisplayName>,
    #[prost(message, optional, tag = "2")]
    pub symbol: ::core::option::Option<UpdateOrRemoveWorkspaceSymbol>,
    #[prost(message, optional, tag = "3")]
    pub settings: ::core::option::Option<WorkspaceSettings>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Workspace {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub rid: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub org: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "4")]
    pub display_name: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag = "5")]
    pub symbol: ::core::option::Option<WorkspaceSymbol>,
    #[prost(message, optional, tag = "6")]
    pub settings: ::core::option::Option<WorkspaceSettings>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkspaceSettings {
    #[prost(message, optional, tag = "1")]
    pub ref_names: ::core::option::Option<PreferredRefNameConfiguration>,
    #[prost(message, optional, tag = "2")]
    pub procedures: ::core::option::Option<ProcedureSettings>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkspaceSymbol {
    #[prost(oneof = "workspace_symbol::WorkspaceSymbol", tags = "1, 2, 3")]
    pub workspace_symbol: ::core::option::Option<workspace_symbol::WorkspaceSymbol>,
}
/// Nested message and enum types in `WorkspaceSymbol`.
pub mod workspace_symbol {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum WorkspaceSymbol {
        #[prost(string, tag = "1")]
        Icon(::prost::alloc::string::String),
        #[prost(string, tag = "2")]
        Emoji(::prost::alloc::string::String),
        #[prost(string, tag = "3")]
        Image(::prost::alloc::string::String),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetWorkspacesRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkspacesResponse {
    #[prost(message, repeated, tag = "1")]
    pub workspaces: ::prost::alloc::vec::Vec<Workspace>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkspaceRequest {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkspaceResponse {
    #[prost(message, optional, tag = "1")]
    pub workspace: ::core::option::Option<Workspace>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWorkspaceRequestWrapper {
    #[prost(string, tag = "1")]
    pub rid: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub request: ::core::option::Option<UpdateWorkspaceRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWorkspaceResponse {
    #[prost(message, optional, tag = "1")]
    pub workspace: ::core::option::Option<Workspace>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetDefaultWorkspaceRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDefaultWorkspaceResponse {
    #[prost(message, optional, tag = "1")]
    pub workspace: ::core::option::Option<Workspace>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SecurityError {
    ForbiddenCrossWorkspaceOperation = 0,
    WorkspaceNotFound = 1,
    WorkspaceNotSpecified = 2,
}
impl SecurityError {
    /// 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::ForbiddenCrossWorkspaceOperation => {
                "SECURITY_ERROR_FORBIDDEN_CROSS_WORKSPACE_OPERATION"
            }
            Self::WorkspaceNotFound => "SECURITY_ERROR_WORKSPACE_NOT_FOUND",
            Self::WorkspaceNotSpecified => "SECURITY_ERROR_WORKSPACE_NOT_SPECIFIED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SECURITY_ERROR_FORBIDDEN_CROSS_WORKSPACE_OPERATION" => {
                Some(Self::ForbiddenCrossWorkspaceOperation)
            }
            "SECURITY_ERROR_WORKSPACE_NOT_FOUND" => Some(Self::WorkspaceNotFound),
            "SECURITY_ERROR_WORKSPACE_NOT_SPECIFIED" => Some(Self::WorkspaceNotSpecified),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod workspace_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 WorkspaceServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl WorkspaceServiceClient<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> WorkspaceServiceClient<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,
        ) -> WorkspaceServiceClient<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,
        {
            WorkspaceServiceClient::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 get_workspaces(
            &mut self,
            request: impl tonic::IntoRequest<super::GetWorkspacesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetWorkspacesResponse>,
            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.workspaces.v1.WorkspaceService/GetWorkspaces",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.workspaces.v1.WorkspaceService",
                        "GetWorkspaces",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn get_workspace(
            &mut self,
            request: impl tonic::IntoRequest<super::GetWorkspaceRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetWorkspaceResponse>,
            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.workspaces.v1.WorkspaceService/GetWorkspace",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.workspaces.v1.WorkspaceService",
                        "GetWorkspace",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn update_workspace(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateWorkspaceRequestWrapper>,
        ) -> std::result::Result<
            tonic::Response<super::UpdateWorkspaceResponse>,
            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.workspaces.v1.WorkspaceService/UpdateWorkspace",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.workspaces.v1.WorkspaceService",
                        "UpdateWorkspace",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn get_default_workspace(
            &mut self,
            request: impl tonic::IntoRequest<super::GetDefaultWorkspaceRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetDefaultWorkspaceResponse>,
            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.workspaces.v1.WorkspaceService/GetDefaultWorkspace",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.workspaces.v1.WorkspaceService",
                        "GetDefaultWorkspace",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}