Skip to main content

nominal_api/proto/
nominal.registry.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ContainerImage {
4    #[prost(string, tag = "1")]
5    pub rid: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub name: ::prost::alloc::string::String,
8    #[prost(string, tag = "3")]
9    pub tag: ::prost::alloc::string::String,
10    #[prost(int64, optional, tag = "4")]
11    pub size_bytes: ::core::option::Option<i64>,
12    #[prost(enumeration = "ContainerImageStatus", tag = "5")]
13    pub status: i32,
14    #[prost(message, optional, tag = "6")]
15    pub created_at: ::core::option::Option<
16        super::super::super::google::protobuf::Timestamp,
17    >,
18}
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct CreateImageRequest {
21    #[prost(string, tag = "1")]
22    pub workspace_rid: ::prost::alloc::string::String,
23    #[prost(string, tag = "2")]
24    pub name: ::prost::alloc::string::String,
25    #[prost(string, tag = "3")]
26    pub tag: ::prost::alloc::string::String,
27    /// Object storage key returned by the existing multipart upload flow (UploadService).
28    #[prost(string, tag = "4")]
29    pub object_key: ::prost::alloc::string::String,
30}
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct CreateImageResponse {
33    #[prost(message, optional, tag = "1")]
34    pub image: ::core::option::Option<ContainerImage>,
35}
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct GetImageRequest {
38    #[prost(string, tag = "1")]
39    pub rid: ::prost::alloc::string::String,
40    #[prost(string, tag = "2")]
41    pub workspace_rid: ::prost::alloc::string::String,
42}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct GetImageResponse {
45    #[prost(message, optional, tag = "1")]
46    pub image: ::core::option::Option<ContainerImage>,
47}
48#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct DeleteImageRequest {
50    #[prost(string, tag = "1")]
51    pub rid: ::prost::alloc::string::String,
52    #[prost(string, tag = "2")]
53    pub workspace_rid: ::prost::alloc::string::String,
54}
55#[derive(Clone, Copy, PartialEq, ::prost::Message)]
56pub struct DeleteImageResponse {}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct NameFilter {
59    #[prost(string, tag = "1")]
60    pub name: ::prost::alloc::string::String,
61}
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct TagFilter {
64    #[prost(string, tag = "1")]
65    pub tag: ::prost::alloc::string::String,
66}
67#[derive(Clone, Copy, PartialEq, ::prost::Message)]
68pub struct StatusFilter {
69    #[prost(enumeration = "ContainerImageStatus", tag = "1")]
70    pub status: i32,
71}
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct AndFilter {
74    #[prost(message, repeated, tag = "1")]
75    pub clauses: ::prost::alloc::vec::Vec<SearchFilter>,
76}
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct SearchFilter {
79    #[prost(oneof = "search_filter::Filter", tags = "1, 2, 3, 4")]
80    pub filter: ::core::option::Option<search_filter::Filter>,
81}
82/// Nested message and enum types in `SearchFilter`.
83pub mod search_filter {
84    #[derive(Clone, PartialEq, ::prost::Oneof)]
85    pub enum Filter {
86        #[prost(message, tag = "1")]
87        Name(super::NameFilter),
88        #[prost(message, tag = "2")]
89        Tag(super::TagFilter),
90        #[prost(message, tag = "3")]
91        Status(super::StatusFilter),
92        #[prost(message, tag = "4")]
93        And(super::AndFilter),
94    }
95}
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct SearchImagesRequest {
98    #[prost(string, tag = "1")]
99    pub workspace_rid: ::prost::alloc::string::String,
100    /// Optional composable filter. Omit to list all images in the workspace.
101    #[prost(message, optional, tag = "2")]
102    pub filter: ::core::option::Option<SearchFilter>,
103    #[prost(int32, optional, tag = "3")]
104    pub page_size: ::core::option::Option<i32>,
105    #[prost(string, optional, tag = "4")]
106    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
107}
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct SearchImagesResponse {
110    #[prost(message, repeated, tag = "1")]
111    pub images: ::prost::alloc::vec::Vec<ContainerImage>,
112    #[prost(string, optional, tag = "2")]
113    pub next_page_token: ::core::option::Option<::prost::alloc::string::String>,
114}
115#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
116#[repr(i32)]
117pub enum ContainerImageStatus {
118    Unspecified = 0,
119    Pending = 1,
120    Ready = 2,
121    Failed = 3,
122}
123impl ContainerImageStatus {
124    /// String value of the enum field names used in the ProtoBuf definition.
125    ///
126    /// The values are not transformed in any way and thus are considered stable
127    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
128    pub fn as_str_name(&self) -> &'static str {
129        match self {
130            Self::Unspecified => "CONTAINER_IMAGE_STATUS_UNSPECIFIED",
131            Self::Pending => "CONTAINER_IMAGE_STATUS_PENDING",
132            Self::Ready => "CONTAINER_IMAGE_STATUS_READY",
133            Self::Failed => "CONTAINER_IMAGE_STATUS_FAILED",
134        }
135    }
136    /// Creates an enum from field names used in the ProtoBuf definition.
137    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
138        match value {
139            "CONTAINER_IMAGE_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
140            "CONTAINER_IMAGE_STATUS_PENDING" => Some(Self::Pending),
141            "CONTAINER_IMAGE_STATUS_READY" => Some(Self::Ready),
142            "CONTAINER_IMAGE_STATUS_FAILED" => Some(Self::Failed),
143            _ => None,
144        }
145    }
146}
147/// Generated client implementations.
148pub mod registry_service_client {
149    #![allow(
150        unused_variables,
151        dead_code,
152        missing_docs,
153        clippy::wildcard_imports,
154        clippy::let_unit_value,
155    )]
156    use tonic::codegen::*;
157    use tonic::codegen::http::Uri;
158    /// Manages container images in the internal registry.
159    #[derive(Debug, Clone)]
160    pub struct RegistryServiceClient<T> {
161        inner: tonic::client::Grpc<T>,
162    }
163    impl RegistryServiceClient<tonic::transport::Channel> {
164        /// Attempt to create a new client by connecting to a given endpoint.
165        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
166        where
167            D: TryInto<tonic::transport::Endpoint>,
168            D::Error: Into<StdError>,
169        {
170            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
171            Ok(Self::new(conn))
172        }
173    }
174    impl<T> RegistryServiceClient<T>
175    where
176        T: tonic::client::GrpcService<tonic::body::Body>,
177        T::Error: Into<StdError>,
178        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
179        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
180    {
181        pub fn new(inner: T) -> Self {
182            let inner = tonic::client::Grpc::new(inner);
183            Self { inner }
184        }
185        pub fn with_origin(inner: T, origin: Uri) -> Self {
186            let inner = tonic::client::Grpc::with_origin(inner, origin);
187            Self { inner }
188        }
189        pub fn with_interceptor<F>(
190            inner: T,
191            interceptor: F,
192        ) -> RegistryServiceClient<InterceptedService<T, F>>
193        where
194            F: tonic::service::Interceptor,
195            T::ResponseBody: Default,
196            T: tonic::codegen::Service<
197                http::Request<tonic::body::Body>,
198                Response = http::Response<
199                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
200                >,
201            >,
202            <T as tonic::codegen::Service<
203                http::Request<tonic::body::Body>,
204            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
205        {
206            RegistryServiceClient::new(InterceptedService::new(inner, interceptor))
207        }
208        /// Compress requests with the given encoding.
209        ///
210        /// This requires the server to support it otherwise it might respond with an
211        /// error.
212        #[must_use]
213        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
214            self.inner = self.inner.send_compressed(encoding);
215            self
216        }
217        /// Enable decompressing responses.
218        #[must_use]
219        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
220            self.inner = self.inner.accept_compressed(encoding);
221            self
222        }
223        /// Limits the maximum size of a decoded message.
224        ///
225        /// Default: `4MB`
226        #[must_use]
227        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
228            self.inner = self.inner.max_decoding_message_size(limit);
229            self
230        }
231        /// Limits the maximum size of an encoded message.
232        ///
233        /// Default: `usize::MAX`
234        #[must_use]
235        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
236            self.inner = self.inner.max_encoding_message_size(limit);
237            self
238        }
239        /// Create a container image from a previously uploaded tarball, triggering the push to the
240        /// internal registry. The client should first upload the tarball via the existing UploadService
241        /// multipart flow, then call this endpoint with the object key to create the image record and
242        /// start the push.
243        pub async fn create_image(
244            &mut self,
245            request: impl tonic::IntoRequest<super::CreateImageRequest>,
246        ) -> std::result::Result<
247            tonic::Response<super::CreateImageResponse>,
248            tonic::Status,
249        > {
250            self.inner
251                .ready()
252                .await
253                .map_err(|e| {
254                    tonic::Status::unknown(
255                        format!("Service was not ready: {}", e.into()),
256                    )
257                })?;
258            let codec = tonic::codec::ProstCodec::default();
259            let path = http::uri::PathAndQuery::from_static(
260                "/nominal.registry.v1.RegistryService/CreateImage",
261            );
262            let mut req = request.into_request();
263            req.extensions_mut()
264                .insert(
265                    GrpcMethod::new("nominal.registry.v1.RegistryService", "CreateImage"),
266                );
267            self.inner.unary(req, path, codec).await
268        }
269        /// Get the current status of a container image.
270        pub async fn get_image(
271            &mut self,
272            request: impl tonic::IntoRequest<super::GetImageRequest>,
273        ) -> std::result::Result<
274            tonic::Response<super::GetImageResponse>,
275            tonic::Status,
276        > {
277            self.inner
278                .ready()
279                .await
280                .map_err(|e| {
281                    tonic::Status::unknown(
282                        format!("Service was not ready: {}", e.into()),
283                    )
284                })?;
285            let codec = tonic::codec::ProstCodec::default();
286            let path = http::uri::PathAndQuery::from_static(
287                "/nominal.registry.v1.RegistryService/GetImage",
288            );
289            let mut req = request.into_request();
290            req.extensions_mut()
291                .insert(
292                    GrpcMethod::new("nominal.registry.v1.RegistryService", "GetImage"),
293                );
294            self.inner.unary(req, path, codec).await
295        }
296        /// Delete a container image.
297        pub async fn delete_image(
298            &mut self,
299            request: impl tonic::IntoRequest<super::DeleteImageRequest>,
300        ) -> std::result::Result<
301            tonic::Response<super::DeleteImageResponse>,
302            tonic::Status,
303        > {
304            self.inner
305                .ready()
306                .await
307                .map_err(|e| {
308                    tonic::Status::unknown(
309                        format!("Service was not ready: {}", e.into()),
310                    )
311                })?;
312            let codec = tonic::codec::ProstCodec::default();
313            let path = http::uri::PathAndQuery::from_static(
314                "/nominal.registry.v1.RegistryService/DeleteImage",
315            );
316            let mut req = request.into_request();
317            req.extensions_mut()
318                .insert(
319                    GrpcMethod::new("nominal.registry.v1.RegistryService", "DeleteImage"),
320                );
321            self.inner.unary(req, path, codec).await
322        }
323        /// Search for container images within a workspace, with optional filters and cursor-based pagination.
324        pub async fn search_images(
325            &mut self,
326            request: impl tonic::IntoRequest<super::SearchImagesRequest>,
327        ) -> std::result::Result<
328            tonic::Response<super::SearchImagesResponse>,
329            tonic::Status,
330        > {
331            self.inner
332                .ready()
333                .await
334                .map_err(|e| {
335                    tonic::Status::unknown(
336                        format!("Service was not ready: {}", e.into()),
337                    )
338                })?;
339            let codec = tonic::codec::ProstCodec::default();
340            let path = http::uri::PathAndQuery::from_static(
341                "/nominal.registry.v1.RegistryService/SearchImages",
342            );
343            let mut req = request.into_request();
344            req.extensions_mut()
345                .insert(
346                    GrpcMethod::new(
347                        "nominal.registry.v1.RegistryService",
348                        "SearchImages",
349                    ),
350                );
351            self.inner.unary(req, path, codec).await
352        }
353    }
354}