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