nominal_api/proto/
nominal.nominalinstro.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3pub struct GetPythonPackageRegistryRequest {}
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct GetPythonPackageRegistryResponse {
6    #[prost(string, tag = "1")]
7    pub registry_url: ::prost::alloc::string::String,
8    #[prost(string, optional, tag = "2")]
9    pub registry_token: ::core::option::Option<::prost::alloc::string::String>,
10}
11#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
12#[repr(i32)]
13pub enum NominalInstroPackageRegistryError {
14    Unspecified = 0,
15    NotAvailable = 1,
16}
17impl NominalInstroPackageRegistryError {
18    /// String value of the enum field names used in the ProtoBuf definition.
19    ///
20    /// The values are not transformed in any way and thus are considered stable
21    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
22    pub fn as_str_name(&self) -> &'static str {
23        match self {
24            Self::Unspecified => "NOMINAL_INSTRO_PACKAGE_REGISTRY_ERROR_UNSPECIFIED",
25            Self::NotAvailable => "NOMINAL_INSTRO_PACKAGE_REGISTRY_ERROR_NOT_AVAILABLE",
26        }
27    }
28    /// Creates an enum from field names used in the ProtoBuf definition.
29    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
30        match value {
31            "NOMINAL_INSTRO_PACKAGE_REGISTRY_ERROR_UNSPECIFIED" => {
32                Some(Self::Unspecified)
33            }
34            "NOMINAL_INSTRO_PACKAGE_REGISTRY_ERROR_NOT_AVAILABLE" => {
35                Some(Self::NotAvailable)
36            }
37            _ => None,
38        }
39    }
40}
41/// Generated client implementations.
42pub mod nominal_instro_package_registry_service_client {
43    #![allow(
44        unused_variables,
45        dead_code,
46        missing_docs,
47        clippy::wildcard_imports,
48        clippy::let_unit_value,
49    )]
50    use tonic::codegen::*;
51    use tonic::codegen::http::Uri;
52    /// Service for accessing Nominal's private python package registry for the `nominal-instro` library.
53    /// This private registry may be discontinue in the future if all of the packges are made public.
54    /// Clients should prepare to handle the UNIMPLEMENTED status (http 501) by falling back to PyPi's public registry.
55    #[derive(Debug, Clone)]
56    pub struct NominalInstroPackageRegistryServiceClient<T> {
57        inner: tonic::client::Grpc<T>,
58    }
59    impl NominalInstroPackageRegistryServiceClient<tonic::transport::Channel> {
60        /// Attempt to create a new client by connecting to a given endpoint.
61        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
62        where
63            D: TryInto<tonic::transport::Endpoint>,
64            D::Error: Into<StdError>,
65        {
66            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
67            Ok(Self::new(conn))
68        }
69    }
70    impl<T> NominalInstroPackageRegistryServiceClient<T>
71    where
72        T: tonic::client::GrpcService<tonic::body::Body>,
73        T::Error: Into<StdError>,
74        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
75        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
76    {
77        pub fn new(inner: T) -> Self {
78            let inner = tonic::client::Grpc::new(inner);
79            Self { inner }
80        }
81        pub fn with_origin(inner: T, origin: Uri) -> Self {
82            let inner = tonic::client::Grpc::with_origin(inner, origin);
83            Self { inner }
84        }
85        pub fn with_interceptor<F>(
86            inner: T,
87            interceptor: F,
88        ) -> NominalInstroPackageRegistryServiceClient<InterceptedService<T, F>>
89        where
90            F: tonic::service::Interceptor,
91            T::ResponseBody: Default,
92            T: tonic::codegen::Service<
93                http::Request<tonic::body::Body>,
94                Response = http::Response<
95                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
96                >,
97            >,
98            <T as tonic::codegen::Service<
99                http::Request<tonic::body::Body>,
100            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
101        {
102            NominalInstroPackageRegistryServiceClient::new(
103                InterceptedService::new(inner, interceptor),
104            )
105        }
106        /// Compress requests with the given encoding.
107        ///
108        /// This requires the server to support it otherwise it might respond with an
109        /// error.
110        #[must_use]
111        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
112            self.inner = self.inner.send_compressed(encoding);
113            self
114        }
115        /// Enable decompressing responses.
116        #[must_use]
117        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
118            self.inner = self.inner.accept_compressed(encoding);
119            self
120        }
121        /// Limits the maximum size of a decoded message.
122        ///
123        /// Default: `4MB`
124        #[must_use]
125        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
126            self.inner = self.inner.max_decoding_message_size(limit);
127            self
128        }
129        /// Limits the maximum size of an encoded message.
130        ///
131        /// Default: `usize::MAX`
132        #[must_use]
133        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
134            self.inner = self.inner.max_encoding_message_size(limit);
135            self
136        }
137        /// Returns the URL for the python package registry, and a token that can be used to access it via HTTP BASIC auth.
138        pub async fn get_python_package_registry(
139            &mut self,
140            request: impl tonic::IntoRequest<super::GetPythonPackageRegistryRequest>,
141        ) -> std::result::Result<
142            tonic::Response<super::GetPythonPackageRegistryResponse>,
143            tonic::Status,
144        > {
145            self.inner
146                .ready()
147                .await
148                .map_err(|e| {
149                    tonic::Status::unknown(
150                        format!("Service was not ready: {}", e.into()),
151                    )
152                })?;
153            let codec = tonic::codec::ProstCodec::default();
154            let path = http::uri::PathAndQuery::from_static(
155                "/nominal.nominalinstro.v1.NominalInstroPackageRegistryService/GetPythonPackageRegistry",
156            );
157            let mut req = request.into_request();
158            req.extensions_mut()
159                .insert(
160                    GrpcMethod::new(
161                        "nominal.nominalinstro.v1.NominalInstroPackageRegistryService",
162                        "GetPythonPackageRegistry",
163                    ),
164                );
165            self.inner.unary(req, path, codec).await
166        }
167    }
168}