google_cloud_vectorsearch_v1/model.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// A dataObject resource in Vector Search.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct DataObject {
44 /// Identifier. The fully qualified resource name of the dataObject.
45 ///
46 /// Format:
47 /// `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{data_object_id}`
48 /// The data_object_id must be 1-63 characters
49 /// long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
50 pub name: std::string::String,
51
52 /// Output only. The id of the dataObject.
53 pub data_object_id: std::string::String,
54
55 /// Output only. Timestamp the dataObject was created at.
56 pub create_time: std::option::Option<wkt::Timestamp>,
57
58 /// Output only. Timestamp the dataObject was last updated.
59 pub update_time: std::option::Option<wkt::Timestamp>,
60
61 /// Optional. The data of the dataObject.
62 pub data: std::option::Option<wkt::Struct>,
63
64 /// Optional. The vectors of the dataObject.
65 pub vectors: std::collections::HashMap<std::string::String, crate::model::Vector>,
66
67 /// Optional. The etag of the dataObject.
68 pub etag: std::string::String,
69
70 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
71}
72
73impl DataObject {
74 pub fn new() -> Self {
75 std::default::Default::default()
76 }
77
78 /// Sets the value of [name][crate::model::DataObject::name].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_cloud_vectorsearch_v1::model::DataObject;
83 /// let x = DataObject::new().set_name("example");
84 /// ```
85 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
86 self.name = v.into();
87 self
88 }
89
90 /// Sets the value of [data_object_id][crate::model::DataObject::data_object_id].
91 ///
92 /// # Example
93 /// ```ignore,no_run
94 /// # use google_cloud_vectorsearch_v1::model::DataObject;
95 /// let x = DataObject::new().set_data_object_id("example");
96 /// ```
97 pub fn set_data_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98 self.data_object_id = v.into();
99 self
100 }
101
102 /// Sets the value of [create_time][crate::model::DataObject::create_time].
103 ///
104 /// # Example
105 /// ```ignore,no_run
106 /// # use google_cloud_vectorsearch_v1::model::DataObject;
107 /// use wkt::Timestamp;
108 /// let x = DataObject::new().set_create_time(Timestamp::default()/* use setters */);
109 /// ```
110 pub fn set_create_time<T>(mut self, v: T) -> Self
111 where
112 T: std::convert::Into<wkt::Timestamp>,
113 {
114 self.create_time = std::option::Option::Some(v.into());
115 self
116 }
117
118 /// Sets or clears the value of [create_time][crate::model::DataObject::create_time].
119 ///
120 /// # Example
121 /// ```ignore,no_run
122 /// # use google_cloud_vectorsearch_v1::model::DataObject;
123 /// use wkt::Timestamp;
124 /// let x = DataObject::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
125 /// let x = DataObject::new().set_or_clear_create_time(None::<Timestamp>);
126 /// ```
127 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
128 where
129 T: std::convert::Into<wkt::Timestamp>,
130 {
131 self.create_time = v.map(|x| x.into());
132 self
133 }
134
135 /// Sets the value of [update_time][crate::model::DataObject::update_time].
136 ///
137 /// # Example
138 /// ```ignore,no_run
139 /// # use google_cloud_vectorsearch_v1::model::DataObject;
140 /// use wkt::Timestamp;
141 /// let x = DataObject::new().set_update_time(Timestamp::default()/* use setters */);
142 /// ```
143 pub fn set_update_time<T>(mut self, v: T) -> Self
144 where
145 T: std::convert::Into<wkt::Timestamp>,
146 {
147 self.update_time = std::option::Option::Some(v.into());
148 self
149 }
150
151 /// Sets or clears the value of [update_time][crate::model::DataObject::update_time].
152 ///
153 /// # Example
154 /// ```ignore,no_run
155 /// # use google_cloud_vectorsearch_v1::model::DataObject;
156 /// use wkt::Timestamp;
157 /// let x = DataObject::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
158 /// let x = DataObject::new().set_or_clear_update_time(None::<Timestamp>);
159 /// ```
160 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
161 where
162 T: std::convert::Into<wkt::Timestamp>,
163 {
164 self.update_time = v.map(|x| x.into());
165 self
166 }
167
168 /// Sets the value of [data][crate::model::DataObject::data].
169 ///
170 /// # Example
171 /// ```ignore,no_run
172 /// # use google_cloud_vectorsearch_v1::model::DataObject;
173 /// use wkt::Struct;
174 /// let x = DataObject::new().set_data(Struct::default()/* use setters */);
175 /// ```
176 pub fn set_data<T>(mut self, v: T) -> Self
177 where
178 T: std::convert::Into<wkt::Struct>,
179 {
180 self.data = std::option::Option::Some(v.into());
181 self
182 }
183
184 /// Sets or clears the value of [data][crate::model::DataObject::data].
185 ///
186 /// # Example
187 /// ```ignore,no_run
188 /// # use google_cloud_vectorsearch_v1::model::DataObject;
189 /// use wkt::Struct;
190 /// let x = DataObject::new().set_or_clear_data(Some(Struct::default()/* use setters */));
191 /// let x = DataObject::new().set_or_clear_data(None::<Struct>);
192 /// ```
193 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
194 where
195 T: std::convert::Into<wkt::Struct>,
196 {
197 self.data = v.map(|x| x.into());
198 self
199 }
200
201 /// Sets the value of [vectors][crate::model::DataObject::vectors].
202 ///
203 /// # Example
204 /// ```ignore,no_run
205 /// # use google_cloud_vectorsearch_v1::model::DataObject;
206 /// use google_cloud_vectorsearch_v1::model::Vector;
207 /// let x = DataObject::new().set_vectors([
208 /// ("key0", Vector::default()/* use setters */),
209 /// ("key1", Vector::default()/* use (different) setters */),
210 /// ]);
211 /// ```
212 pub fn set_vectors<T, K, V>(mut self, v: T) -> Self
213 where
214 T: std::iter::IntoIterator<Item = (K, V)>,
215 K: std::convert::Into<std::string::String>,
216 V: std::convert::Into<crate::model::Vector>,
217 {
218 use std::iter::Iterator;
219 self.vectors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
220 self
221 }
222
223 /// Sets the value of [etag][crate::model::DataObject::etag].
224 ///
225 /// # Example
226 /// ```ignore,no_run
227 /// # use google_cloud_vectorsearch_v1::model::DataObject;
228 /// let x = DataObject::new().set_etag("example");
229 /// ```
230 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
231 self.etag = v.into();
232 self
233 }
234}
235
236impl wkt::message::Message for DataObject {
237 fn typename() -> &'static str {
238 "type.googleapis.com/google.cloud.vectorsearch.v1.DataObject"
239 }
240}
241
242/// A vector which can be either dense or sparse.
243#[derive(Clone, Default, PartialEq)]
244#[non_exhaustive]
245pub struct Vector {
246 /// The type of the vector.
247 pub vector_type: std::option::Option<crate::model::vector::VectorType>,
248
249 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
250}
251
252impl Vector {
253 pub fn new() -> Self {
254 std::default::Default::default()
255 }
256
257 /// Sets the value of [vector_type][crate::model::Vector::vector_type].
258 ///
259 /// Note that all the setters affecting `vector_type` are mutually
260 /// exclusive.
261 ///
262 /// # Example
263 /// ```ignore,no_run
264 /// # use google_cloud_vectorsearch_v1::model::Vector;
265 /// use google_cloud_vectorsearch_v1::model::DenseVector;
266 /// let x = Vector::new().set_vector_type(Some(
267 /// google_cloud_vectorsearch_v1::model::vector::VectorType::Dense(DenseVector::default().into())));
268 /// ```
269 pub fn set_vector_type<
270 T: std::convert::Into<std::option::Option<crate::model::vector::VectorType>>,
271 >(
272 mut self,
273 v: T,
274 ) -> Self {
275 self.vector_type = v.into();
276 self
277 }
278
279 /// The value of [vector_type][crate::model::Vector::vector_type]
280 /// if it holds a `Dense`, `None` if the field is not set or
281 /// holds a different branch.
282 pub fn dense(&self) -> std::option::Option<&std::boxed::Box<crate::model::DenseVector>> {
283 #[allow(unreachable_patterns)]
284 self.vector_type.as_ref().and_then(|v| match v {
285 crate::model::vector::VectorType::Dense(v) => std::option::Option::Some(v),
286 _ => std::option::Option::None,
287 })
288 }
289
290 /// Sets the value of [vector_type][crate::model::Vector::vector_type]
291 /// to hold a `Dense`.
292 ///
293 /// Note that all the setters affecting `vector_type` are
294 /// mutually exclusive.
295 ///
296 /// # Example
297 /// ```ignore,no_run
298 /// # use google_cloud_vectorsearch_v1::model::Vector;
299 /// use google_cloud_vectorsearch_v1::model::DenseVector;
300 /// let x = Vector::new().set_dense(DenseVector::default()/* use setters */);
301 /// assert!(x.dense().is_some());
302 /// assert!(x.sparse().is_none());
303 /// ```
304 pub fn set_dense<T: std::convert::Into<std::boxed::Box<crate::model::DenseVector>>>(
305 mut self,
306 v: T,
307 ) -> Self {
308 self.vector_type =
309 std::option::Option::Some(crate::model::vector::VectorType::Dense(v.into()));
310 self
311 }
312
313 /// The value of [vector_type][crate::model::Vector::vector_type]
314 /// if it holds a `Sparse`, `None` if the field is not set or
315 /// holds a different branch.
316 pub fn sparse(&self) -> std::option::Option<&std::boxed::Box<crate::model::SparseVector>> {
317 #[allow(unreachable_patterns)]
318 self.vector_type.as_ref().and_then(|v| match v {
319 crate::model::vector::VectorType::Sparse(v) => std::option::Option::Some(v),
320 _ => std::option::Option::None,
321 })
322 }
323
324 /// Sets the value of [vector_type][crate::model::Vector::vector_type]
325 /// to hold a `Sparse`.
326 ///
327 /// Note that all the setters affecting `vector_type` are
328 /// mutually exclusive.
329 ///
330 /// # Example
331 /// ```ignore,no_run
332 /// # use google_cloud_vectorsearch_v1::model::Vector;
333 /// use google_cloud_vectorsearch_v1::model::SparseVector;
334 /// let x = Vector::new().set_sparse(SparseVector::default()/* use setters */);
335 /// assert!(x.sparse().is_some());
336 /// assert!(x.dense().is_none());
337 /// ```
338 pub fn set_sparse<T: std::convert::Into<std::boxed::Box<crate::model::SparseVector>>>(
339 mut self,
340 v: T,
341 ) -> Self {
342 self.vector_type =
343 std::option::Option::Some(crate::model::vector::VectorType::Sparse(v.into()));
344 self
345 }
346}
347
348impl wkt::message::Message for Vector {
349 fn typename() -> &'static str {
350 "type.googleapis.com/google.cloud.vectorsearch.v1.Vector"
351 }
352}
353
354/// Defines additional types related to [Vector].
355pub mod vector {
356 #[allow(unused_imports)]
357 use super::*;
358
359 /// The type of the vector.
360 #[derive(Clone, Debug, PartialEq)]
361 #[non_exhaustive]
362 pub enum VectorType {
363 /// A dense vector.
364 Dense(std::boxed::Box<crate::model::DenseVector>),
365 /// A sparse vector.
366 Sparse(std::boxed::Box<crate::model::SparseVector>),
367 }
368}
369
370/// A dense vector.
371#[derive(Clone, Default, PartialEq)]
372#[non_exhaustive]
373pub struct DenseVector {
374 /// Required. The values of the vector.
375 pub values: std::vec::Vec<f32>,
376
377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
378}
379
380impl DenseVector {
381 pub fn new() -> Self {
382 std::default::Default::default()
383 }
384
385 /// Sets the value of [values][crate::model::DenseVector::values].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_vectorsearch_v1::model::DenseVector;
390 /// let x = DenseVector::new().set_values([1.0, 2.0, 3.0]);
391 /// ```
392 pub fn set_values<T, V>(mut self, v: T) -> Self
393 where
394 T: std::iter::IntoIterator<Item = V>,
395 V: std::convert::Into<f32>,
396 {
397 use std::iter::Iterator;
398 self.values = v.into_iter().map(|i| i.into()).collect();
399 self
400 }
401}
402
403impl wkt::message::Message for DenseVector {
404 fn typename() -> &'static str {
405 "type.googleapis.com/google.cloud.vectorsearch.v1.DenseVector"
406 }
407}
408
409/// A sparse vector.
410#[derive(Clone, Default, PartialEq)]
411#[non_exhaustive]
412pub struct SparseVector {
413 /// Required. The values of the vector.
414 pub values: std::vec::Vec<f32>,
415
416 /// Required. The corresponding indices for the values.
417 pub indices: std::vec::Vec<i32>,
418
419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
420}
421
422impl SparseVector {
423 pub fn new() -> Self {
424 std::default::Default::default()
425 }
426
427 /// Sets the value of [values][crate::model::SparseVector::values].
428 ///
429 /// # Example
430 /// ```ignore,no_run
431 /// # use google_cloud_vectorsearch_v1::model::SparseVector;
432 /// let x = SparseVector::new().set_values([1.0, 2.0, 3.0]);
433 /// ```
434 pub fn set_values<T, V>(mut self, v: T) -> Self
435 where
436 T: std::iter::IntoIterator<Item = V>,
437 V: std::convert::Into<f32>,
438 {
439 use std::iter::Iterator;
440 self.values = v.into_iter().map(|i| i.into()).collect();
441 self
442 }
443
444 /// Sets the value of [indices][crate::model::SparseVector::indices].
445 ///
446 /// # Example
447 /// ```ignore,no_run
448 /// # use google_cloud_vectorsearch_v1::model::SparseVector;
449 /// let x = SparseVector::new().set_indices([1, 2, 3]);
450 /// ```
451 pub fn set_indices<T, V>(mut self, v: T) -> Self
452 where
453 T: std::iter::IntoIterator<Item = V>,
454 V: std::convert::Into<i32>,
455 {
456 use std::iter::Iterator;
457 self.indices = v.into_iter().map(|i| i.into()).collect();
458 self
459 }
460}
461
462impl wkt::message::Message for SparseVector {
463 fn typename() -> &'static str {
464 "type.googleapis.com/google.cloud.vectorsearch.v1.SparseVector"
465 }
466}
467
468/// Defines a output fields struct for data in DataObject.
469#[derive(Clone, Default, PartialEq)]
470#[non_exhaustive]
471pub struct OutputFields {
472 /// Optional. The fields from the data fields to include in the output.
473 pub data_fields: std::vec::Vec<std::string::String>,
474
475 /// Optional. The fields from the vector fields to include in the output.
476 pub vector_fields: std::vec::Vec<std::string::String>,
477
478 /// Optional. The fields from the DataObject metadata to include in the output.
479 pub metadata_fields: std::vec::Vec<std::string::String>,
480
481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
482}
483
484impl OutputFields {
485 pub fn new() -> Self {
486 std::default::Default::default()
487 }
488
489 /// Sets the value of [data_fields][crate::model::OutputFields::data_fields].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_vectorsearch_v1::model::OutputFields;
494 /// let x = OutputFields::new().set_data_fields(["a", "b", "c"]);
495 /// ```
496 pub fn set_data_fields<T, V>(mut self, v: T) -> Self
497 where
498 T: std::iter::IntoIterator<Item = V>,
499 V: std::convert::Into<std::string::String>,
500 {
501 use std::iter::Iterator;
502 self.data_fields = v.into_iter().map(|i| i.into()).collect();
503 self
504 }
505
506 /// Sets the value of [vector_fields][crate::model::OutputFields::vector_fields].
507 ///
508 /// # Example
509 /// ```ignore,no_run
510 /// # use google_cloud_vectorsearch_v1::model::OutputFields;
511 /// let x = OutputFields::new().set_vector_fields(["a", "b", "c"]);
512 /// ```
513 pub fn set_vector_fields<T, V>(mut self, v: T) -> Self
514 where
515 T: std::iter::IntoIterator<Item = V>,
516 V: std::convert::Into<std::string::String>,
517 {
518 use std::iter::Iterator;
519 self.vector_fields = v.into_iter().map(|i| i.into()).collect();
520 self
521 }
522
523 /// Sets the value of [metadata_fields][crate::model::OutputFields::metadata_fields].
524 ///
525 /// # Example
526 /// ```ignore,no_run
527 /// # use google_cloud_vectorsearch_v1::model::OutputFields;
528 /// let x = OutputFields::new().set_metadata_fields(["a", "b", "c"]);
529 /// ```
530 pub fn set_metadata_fields<T, V>(mut self, v: T) -> Self
531 where
532 T: std::iter::IntoIterator<Item = V>,
533 V: std::convert::Into<std::string::String>,
534 {
535 use std::iter::Iterator;
536 self.metadata_fields = v.into_iter().map(|i| i.into()).collect();
537 self
538 }
539}
540
541impl wkt::message::Message for OutputFields {
542 fn typename() -> &'static str {
543 "type.googleapis.com/google.cloud.vectorsearch.v1.OutputFields"
544 }
545}
546
547/// Represents a hint to the search index engine.
548#[derive(Clone, Default, PartialEq)]
549#[non_exhaustive]
550pub struct SearchHint {
551 /// The type of index to use.
552 pub index_type: std::option::Option<crate::model::search_hint::IndexType>,
553
554 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
555}
556
557impl SearchHint {
558 pub fn new() -> Self {
559 std::default::Default::default()
560 }
561
562 /// Sets the value of [index_type][crate::model::SearchHint::index_type].
563 ///
564 /// Note that all the setters affecting `index_type` are mutually
565 /// exclusive.
566 ///
567 /// # Example
568 /// ```ignore,no_run
569 /// # use google_cloud_vectorsearch_v1::model::SearchHint;
570 /// use google_cloud_vectorsearch_v1::model::search_hint::KnnHint;
571 /// let x = SearchHint::new().set_index_type(Some(
572 /// google_cloud_vectorsearch_v1::model::search_hint::IndexType::KnnHint(KnnHint::default().into())));
573 /// ```
574 pub fn set_index_type<
575 T: std::convert::Into<std::option::Option<crate::model::search_hint::IndexType>>,
576 >(
577 mut self,
578 v: T,
579 ) -> Self {
580 self.index_type = v.into();
581 self
582 }
583
584 /// The value of [index_type][crate::model::SearchHint::index_type]
585 /// if it holds a `KnnHint`, `None` if the field is not set or
586 /// holds a different branch.
587 pub fn knn_hint(
588 &self,
589 ) -> std::option::Option<&std::boxed::Box<crate::model::search_hint::KnnHint>> {
590 #[allow(unreachable_patterns)]
591 self.index_type.as_ref().and_then(|v| match v {
592 crate::model::search_hint::IndexType::KnnHint(v) => std::option::Option::Some(v),
593 _ => std::option::Option::None,
594 })
595 }
596
597 /// Sets the value of [index_type][crate::model::SearchHint::index_type]
598 /// to hold a `KnnHint`.
599 ///
600 /// Note that all the setters affecting `index_type` are
601 /// mutually exclusive.
602 ///
603 /// # Example
604 /// ```ignore,no_run
605 /// # use google_cloud_vectorsearch_v1::model::SearchHint;
606 /// use google_cloud_vectorsearch_v1::model::search_hint::KnnHint;
607 /// let x = SearchHint::new().set_knn_hint(KnnHint::default()/* use setters */);
608 /// assert!(x.knn_hint().is_some());
609 /// assert!(x.index_hint().is_none());
610 /// ```
611 pub fn set_knn_hint<
612 T: std::convert::Into<std::boxed::Box<crate::model::search_hint::KnnHint>>,
613 >(
614 mut self,
615 v: T,
616 ) -> Self {
617 self.index_type =
618 std::option::Option::Some(crate::model::search_hint::IndexType::KnnHint(v.into()));
619 self
620 }
621
622 /// The value of [index_type][crate::model::SearchHint::index_type]
623 /// if it holds a `IndexHint`, `None` if the field is not set or
624 /// holds a different branch.
625 pub fn index_hint(
626 &self,
627 ) -> std::option::Option<&std::boxed::Box<crate::model::search_hint::IndexHint>> {
628 #[allow(unreachable_patterns)]
629 self.index_type.as_ref().and_then(|v| match v {
630 crate::model::search_hint::IndexType::IndexHint(v) => std::option::Option::Some(v),
631 _ => std::option::Option::None,
632 })
633 }
634
635 /// Sets the value of [index_type][crate::model::SearchHint::index_type]
636 /// to hold a `IndexHint`.
637 ///
638 /// Note that all the setters affecting `index_type` are
639 /// mutually exclusive.
640 ///
641 /// # Example
642 /// ```ignore,no_run
643 /// # use google_cloud_vectorsearch_v1::model::SearchHint;
644 /// use google_cloud_vectorsearch_v1::model::search_hint::IndexHint;
645 /// let x = SearchHint::new().set_index_hint(IndexHint::default()/* use setters */);
646 /// assert!(x.index_hint().is_some());
647 /// assert!(x.knn_hint().is_none());
648 /// ```
649 pub fn set_index_hint<
650 T: std::convert::Into<std::boxed::Box<crate::model::search_hint::IndexHint>>,
651 >(
652 mut self,
653 v: T,
654 ) -> Self {
655 self.index_type =
656 std::option::Option::Some(crate::model::search_hint::IndexType::IndexHint(v.into()));
657 self
658 }
659}
660
661impl wkt::message::Message for SearchHint {
662 fn typename() -> &'static str {
663 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchHint"
664 }
665}
666
667/// Defines additional types related to [SearchHint].
668pub mod search_hint {
669 #[allow(unused_imports)]
670 use super::*;
671
672 /// Message to specify the index to use for the search.
673 #[derive(Clone, Default, PartialEq)]
674 #[non_exhaustive]
675 pub struct IndexHint {
676 /// Required. The resource name of the index to use for the search.
677 /// The index must be in the same project, location, and collection.
678 /// Format:
679 /// `projects/{project}/locations/{location}/collections/{collection}/indexes/{index}`
680 pub name: std::string::String,
681
682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
683 }
684
685 impl IndexHint {
686 pub fn new() -> Self {
687 std::default::Default::default()
688 }
689
690 /// Sets the value of [name][crate::model::search_hint::IndexHint::name].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_vectorsearch_v1::model::search_hint::IndexHint;
695 /// let x = IndexHint::new().set_name("example");
696 /// ```
697 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
698 self.name = v.into();
699 self
700 }
701 }
702
703 impl wkt::message::Message for IndexHint {
704 fn typename() -> &'static str {
705 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchHint.IndexHint"
706 }
707 }
708
709 /// KnnHint will be used if search should be explicitly done on system's
710 /// default K-Nearest Neighbor (KNN) index engine.
711 #[derive(Clone, Default, PartialEq)]
712 #[non_exhaustive]
713 pub struct KnnHint {
714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
715 }
716
717 impl KnnHint {
718 pub fn new() -> Self {
719 std::default::Default::default()
720 }
721 }
722
723 impl wkt::message::Message for KnnHint {
724 fn typename() -> &'static str {
725 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchHint.KnnHint"
726 }
727 }
728
729 /// The type of index to use.
730 #[derive(Clone, Debug, PartialEq)]
731 #[non_exhaustive]
732 pub enum IndexType {
733 /// Optional. If set, the search will use the system's default
734 /// K-Nearest Neighbor (KNN) index engine.
735 KnnHint(std::boxed::Box<crate::model::search_hint::KnnHint>),
736 /// Optional. Specifies that the search should use a particular index.
737 IndexHint(std::boxed::Box<crate::model::search_hint::IndexHint>),
738 }
739}
740
741/// A single search request within a batch operation.
742#[derive(Clone, Default, PartialEq)]
743#[non_exhaustive]
744pub struct Search {
745 /// The type of search to perform.
746 pub search_type: std::option::Option<crate::model::search::SearchType>,
747
748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
749}
750
751impl Search {
752 pub fn new() -> Self {
753 std::default::Default::default()
754 }
755
756 /// Sets the value of [search_type][crate::model::Search::search_type].
757 ///
758 /// Note that all the setters affecting `search_type` are mutually
759 /// exclusive.
760 ///
761 /// # Example
762 /// ```ignore,no_run
763 /// # use google_cloud_vectorsearch_v1::model::Search;
764 /// use google_cloud_vectorsearch_v1::model::VectorSearch;
765 /// let x = Search::new().set_search_type(Some(
766 /// google_cloud_vectorsearch_v1::model::search::SearchType::VectorSearch(VectorSearch::default().into())));
767 /// ```
768 pub fn set_search_type<
769 T: std::convert::Into<std::option::Option<crate::model::search::SearchType>>,
770 >(
771 mut self,
772 v: T,
773 ) -> Self {
774 self.search_type = v.into();
775 self
776 }
777
778 /// The value of [search_type][crate::model::Search::search_type]
779 /// if it holds a `VectorSearch`, `None` if the field is not set or
780 /// holds a different branch.
781 pub fn vector_search(
782 &self,
783 ) -> std::option::Option<&std::boxed::Box<crate::model::VectorSearch>> {
784 #[allow(unreachable_patterns)]
785 self.search_type.as_ref().and_then(|v| match v {
786 crate::model::search::SearchType::VectorSearch(v) => std::option::Option::Some(v),
787 _ => std::option::Option::None,
788 })
789 }
790
791 /// Sets the value of [search_type][crate::model::Search::search_type]
792 /// to hold a `VectorSearch`.
793 ///
794 /// Note that all the setters affecting `search_type` are
795 /// mutually exclusive.
796 ///
797 /// # Example
798 /// ```ignore,no_run
799 /// # use google_cloud_vectorsearch_v1::model::Search;
800 /// use google_cloud_vectorsearch_v1::model::VectorSearch;
801 /// let x = Search::new().set_vector_search(VectorSearch::default()/* use setters */);
802 /// assert!(x.vector_search().is_some());
803 /// assert!(x.semantic_search().is_none());
804 /// assert!(x.text_search().is_none());
805 /// ```
806 pub fn set_vector_search<T: std::convert::Into<std::boxed::Box<crate::model::VectorSearch>>>(
807 mut self,
808 v: T,
809 ) -> Self {
810 self.search_type =
811 std::option::Option::Some(crate::model::search::SearchType::VectorSearch(v.into()));
812 self
813 }
814
815 /// The value of [search_type][crate::model::Search::search_type]
816 /// if it holds a `SemanticSearch`, `None` if the field is not set or
817 /// holds a different branch.
818 pub fn semantic_search(
819 &self,
820 ) -> std::option::Option<&std::boxed::Box<crate::model::SemanticSearch>> {
821 #[allow(unreachable_patterns)]
822 self.search_type.as_ref().and_then(|v| match v {
823 crate::model::search::SearchType::SemanticSearch(v) => std::option::Option::Some(v),
824 _ => std::option::Option::None,
825 })
826 }
827
828 /// Sets the value of [search_type][crate::model::Search::search_type]
829 /// to hold a `SemanticSearch`.
830 ///
831 /// Note that all the setters affecting `search_type` are
832 /// mutually exclusive.
833 ///
834 /// # Example
835 /// ```ignore,no_run
836 /// # use google_cloud_vectorsearch_v1::model::Search;
837 /// use google_cloud_vectorsearch_v1::model::SemanticSearch;
838 /// let x = Search::new().set_semantic_search(SemanticSearch::default()/* use setters */);
839 /// assert!(x.semantic_search().is_some());
840 /// assert!(x.vector_search().is_none());
841 /// assert!(x.text_search().is_none());
842 /// ```
843 pub fn set_semantic_search<
844 T: std::convert::Into<std::boxed::Box<crate::model::SemanticSearch>>,
845 >(
846 mut self,
847 v: T,
848 ) -> Self {
849 self.search_type =
850 std::option::Option::Some(crate::model::search::SearchType::SemanticSearch(v.into()));
851 self
852 }
853
854 /// The value of [search_type][crate::model::Search::search_type]
855 /// if it holds a `TextSearch`, `None` if the field is not set or
856 /// holds a different branch.
857 pub fn text_search(&self) -> std::option::Option<&std::boxed::Box<crate::model::TextSearch>> {
858 #[allow(unreachable_patterns)]
859 self.search_type.as_ref().and_then(|v| match v {
860 crate::model::search::SearchType::TextSearch(v) => std::option::Option::Some(v),
861 _ => std::option::Option::None,
862 })
863 }
864
865 /// Sets the value of [search_type][crate::model::Search::search_type]
866 /// to hold a `TextSearch`.
867 ///
868 /// Note that all the setters affecting `search_type` are
869 /// mutually exclusive.
870 ///
871 /// # Example
872 /// ```ignore,no_run
873 /// # use google_cloud_vectorsearch_v1::model::Search;
874 /// use google_cloud_vectorsearch_v1::model::TextSearch;
875 /// let x = Search::new().set_text_search(TextSearch::default()/* use setters */);
876 /// assert!(x.text_search().is_some());
877 /// assert!(x.vector_search().is_none());
878 /// assert!(x.semantic_search().is_none());
879 /// ```
880 pub fn set_text_search<T: std::convert::Into<std::boxed::Box<crate::model::TextSearch>>>(
881 mut self,
882 v: T,
883 ) -> Self {
884 self.search_type =
885 std::option::Option::Some(crate::model::search::SearchType::TextSearch(v.into()));
886 self
887 }
888}
889
890impl wkt::message::Message for Search {
891 fn typename() -> &'static str {
892 "type.googleapis.com/google.cloud.vectorsearch.v1.Search"
893 }
894}
895
896/// Defines additional types related to [Search].
897pub mod search {
898 #[allow(unused_imports)]
899 use super::*;
900
901 /// The type of search to perform.
902 #[derive(Clone, Debug, PartialEq)]
903 #[non_exhaustive]
904 pub enum SearchType {
905 /// A vector-based search.
906 VectorSearch(std::boxed::Box<crate::model::VectorSearch>),
907 /// A semantic search.
908 SemanticSearch(std::boxed::Box<crate::model::SemanticSearch>),
909 /// A text search operation.
910 TextSearch(std::boxed::Box<crate::model::TextSearch>),
911 }
912}
913
914/// Defines a search operation using a query vector.
915#[derive(Clone, Default, PartialEq)]
916#[non_exhaustive]
917pub struct VectorSearch {
918 /// Required. The vector field to search.
919 pub search_field: std::string::String,
920
921 /// Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
922 /// represented as a google.protobuf.Struct.
923 pub filter: std::option::Option<wkt::Struct>,
924
925 /// Optional. The number of nearest neighbors to return.
926 pub top_k: std::option::Option<i32>,
927
928 /// Optional. Mask specifying which fields to return.
929 pub output_fields: std::option::Option<crate::model::OutputFields>,
930
931 /// Optional. Sets the search hint. If no strategy is specified, the service
932 /// will use an index if one is available, and fall back to the default KNN
933 /// search otherwise.
934 pub search_hint: std::option::Option<crate::model::SearchHint>,
935
936 /// Optional. The distance metric to use for the KNN search. If not specified,
937 /// DOT_PRODUCT will be used as the default.
938 pub distance_metric: crate::model::DistanceMetric,
939
940 pub vector_type: std::option::Option<crate::model::vector_search::VectorType>,
941
942 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
943}
944
945impl VectorSearch {
946 pub fn new() -> Self {
947 std::default::Default::default()
948 }
949
950 /// Sets the value of [search_field][crate::model::VectorSearch::search_field].
951 ///
952 /// # Example
953 /// ```ignore,no_run
954 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
955 /// let x = VectorSearch::new().set_search_field("example");
956 /// ```
957 pub fn set_search_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
958 self.search_field = v.into();
959 self
960 }
961
962 /// Sets the value of [filter][crate::model::VectorSearch::filter].
963 ///
964 /// # Example
965 /// ```ignore,no_run
966 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
967 /// use wkt::Struct;
968 /// let x = VectorSearch::new().set_filter(Struct::default()/* use setters */);
969 /// ```
970 pub fn set_filter<T>(mut self, v: T) -> Self
971 where
972 T: std::convert::Into<wkt::Struct>,
973 {
974 self.filter = std::option::Option::Some(v.into());
975 self
976 }
977
978 /// Sets or clears the value of [filter][crate::model::VectorSearch::filter].
979 ///
980 /// # Example
981 /// ```ignore,no_run
982 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
983 /// use wkt::Struct;
984 /// let x = VectorSearch::new().set_or_clear_filter(Some(Struct::default()/* use setters */));
985 /// let x = VectorSearch::new().set_or_clear_filter(None::<Struct>);
986 /// ```
987 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
988 where
989 T: std::convert::Into<wkt::Struct>,
990 {
991 self.filter = v.map(|x| x.into());
992 self
993 }
994
995 /// Sets the value of [top_k][crate::model::VectorSearch::top_k].
996 ///
997 /// # Example
998 /// ```ignore,no_run
999 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1000 /// let x = VectorSearch::new().set_top_k(42);
1001 /// ```
1002 pub fn set_top_k<T>(mut self, v: T) -> Self
1003 where
1004 T: std::convert::Into<i32>,
1005 {
1006 self.top_k = std::option::Option::Some(v.into());
1007 self
1008 }
1009
1010 /// Sets or clears the value of [top_k][crate::model::VectorSearch::top_k].
1011 ///
1012 /// # Example
1013 /// ```ignore,no_run
1014 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1015 /// let x = VectorSearch::new().set_or_clear_top_k(Some(42));
1016 /// let x = VectorSearch::new().set_or_clear_top_k(None::<i32>);
1017 /// ```
1018 pub fn set_or_clear_top_k<T>(mut self, v: std::option::Option<T>) -> Self
1019 where
1020 T: std::convert::Into<i32>,
1021 {
1022 self.top_k = v.map(|x| x.into());
1023 self
1024 }
1025
1026 /// Sets the value of [output_fields][crate::model::VectorSearch::output_fields].
1027 ///
1028 /// # Example
1029 /// ```ignore,no_run
1030 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1031 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1032 /// let x = VectorSearch::new().set_output_fields(OutputFields::default()/* use setters */);
1033 /// ```
1034 pub fn set_output_fields<T>(mut self, v: T) -> Self
1035 where
1036 T: std::convert::Into<crate::model::OutputFields>,
1037 {
1038 self.output_fields = std::option::Option::Some(v.into());
1039 self
1040 }
1041
1042 /// Sets or clears the value of [output_fields][crate::model::VectorSearch::output_fields].
1043 ///
1044 /// # Example
1045 /// ```ignore,no_run
1046 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1047 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1048 /// let x = VectorSearch::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
1049 /// let x = VectorSearch::new().set_or_clear_output_fields(None::<OutputFields>);
1050 /// ```
1051 pub fn set_or_clear_output_fields<T>(mut self, v: std::option::Option<T>) -> Self
1052 where
1053 T: std::convert::Into<crate::model::OutputFields>,
1054 {
1055 self.output_fields = v.map(|x| x.into());
1056 self
1057 }
1058
1059 /// Sets the value of [search_hint][crate::model::VectorSearch::search_hint].
1060 ///
1061 /// # Example
1062 /// ```ignore,no_run
1063 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1064 /// use google_cloud_vectorsearch_v1::model::SearchHint;
1065 /// let x = VectorSearch::new().set_search_hint(SearchHint::default()/* use setters */);
1066 /// ```
1067 pub fn set_search_hint<T>(mut self, v: T) -> Self
1068 where
1069 T: std::convert::Into<crate::model::SearchHint>,
1070 {
1071 self.search_hint = std::option::Option::Some(v.into());
1072 self
1073 }
1074
1075 /// Sets or clears the value of [search_hint][crate::model::VectorSearch::search_hint].
1076 ///
1077 /// # Example
1078 /// ```ignore,no_run
1079 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1080 /// use google_cloud_vectorsearch_v1::model::SearchHint;
1081 /// let x = VectorSearch::new().set_or_clear_search_hint(Some(SearchHint::default()/* use setters */));
1082 /// let x = VectorSearch::new().set_or_clear_search_hint(None::<SearchHint>);
1083 /// ```
1084 pub fn set_or_clear_search_hint<T>(mut self, v: std::option::Option<T>) -> Self
1085 where
1086 T: std::convert::Into<crate::model::SearchHint>,
1087 {
1088 self.search_hint = v.map(|x| x.into());
1089 self
1090 }
1091
1092 /// Sets the value of [distance_metric][crate::model::VectorSearch::distance_metric].
1093 ///
1094 /// # Example
1095 /// ```ignore,no_run
1096 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1097 /// use google_cloud_vectorsearch_v1::model::DistanceMetric;
1098 /// let x0 = VectorSearch::new().set_distance_metric(DistanceMetric::DotProduct);
1099 /// let x1 = VectorSearch::new().set_distance_metric(DistanceMetric::CosineDistance);
1100 /// ```
1101 pub fn set_distance_metric<T: std::convert::Into<crate::model::DistanceMetric>>(
1102 mut self,
1103 v: T,
1104 ) -> Self {
1105 self.distance_metric = v.into();
1106 self
1107 }
1108
1109 /// Sets the value of [vector_type][crate::model::VectorSearch::vector_type].
1110 ///
1111 /// Note that all the setters affecting `vector_type` are mutually
1112 /// exclusive.
1113 ///
1114 /// # Example
1115 /// ```ignore,no_run
1116 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1117 /// use google_cloud_vectorsearch_v1::model::DenseVector;
1118 /// let x = VectorSearch::new().set_vector_type(Some(
1119 /// google_cloud_vectorsearch_v1::model::vector_search::VectorType::Vector(DenseVector::default().into())));
1120 /// ```
1121 pub fn set_vector_type<
1122 T: std::convert::Into<std::option::Option<crate::model::vector_search::VectorType>>,
1123 >(
1124 mut self,
1125 v: T,
1126 ) -> Self {
1127 self.vector_type = v.into();
1128 self
1129 }
1130
1131 /// The value of [vector_type][crate::model::VectorSearch::vector_type]
1132 /// if it holds a `Vector`, `None` if the field is not set or
1133 /// holds a different branch.
1134 pub fn vector(&self) -> std::option::Option<&std::boxed::Box<crate::model::DenseVector>> {
1135 #[allow(unreachable_patterns)]
1136 self.vector_type.as_ref().and_then(|v| match v {
1137 crate::model::vector_search::VectorType::Vector(v) => std::option::Option::Some(v),
1138 _ => std::option::Option::None,
1139 })
1140 }
1141
1142 /// Sets the value of [vector_type][crate::model::VectorSearch::vector_type]
1143 /// to hold a `Vector`.
1144 ///
1145 /// Note that all the setters affecting `vector_type` are
1146 /// mutually exclusive.
1147 ///
1148 /// # Example
1149 /// ```ignore,no_run
1150 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1151 /// use google_cloud_vectorsearch_v1::model::DenseVector;
1152 /// let x = VectorSearch::new().set_vector(DenseVector::default()/* use setters */);
1153 /// assert!(x.vector().is_some());
1154 /// assert!(x.sparse_vector().is_none());
1155 /// ```
1156 pub fn set_vector<T: std::convert::Into<std::boxed::Box<crate::model::DenseVector>>>(
1157 mut self,
1158 v: T,
1159 ) -> Self {
1160 self.vector_type =
1161 std::option::Option::Some(crate::model::vector_search::VectorType::Vector(v.into()));
1162 self
1163 }
1164
1165 /// The value of [vector_type][crate::model::VectorSearch::vector_type]
1166 /// if it holds a `SparseVector`, `None` if the field is not set or
1167 /// holds a different branch.
1168 pub fn sparse_vector(
1169 &self,
1170 ) -> std::option::Option<&std::boxed::Box<crate::model::SparseVector>> {
1171 #[allow(unreachable_patterns)]
1172 self.vector_type.as_ref().and_then(|v| match v {
1173 crate::model::vector_search::VectorType::SparseVector(v) => {
1174 std::option::Option::Some(v)
1175 }
1176 _ => std::option::Option::None,
1177 })
1178 }
1179
1180 /// Sets the value of [vector_type][crate::model::VectorSearch::vector_type]
1181 /// to hold a `SparseVector`.
1182 ///
1183 /// Note that all the setters affecting `vector_type` are
1184 /// mutually exclusive.
1185 ///
1186 /// # Example
1187 /// ```ignore,no_run
1188 /// # use google_cloud_vectorsearch_v1::model::VectorSearch;
1189 /// use google_cloud_vectorsearch_v1::model::SparseVector;
1190 /// let x = VectorSearch::new().set_sparse_vector(SparseVector::default()/* use setters */);
1191 /// assert!(x.sparse_vector().is_some());
1192 /// assert!(x.vector().is_none());
1193 /// ```
1194 pub fn set_sparse_vector<T: std::convert::Into<std::boxed::Box<crate::model::SparseVector>>>(
1195 mut self,
1196 v: T,
1197 ) -> Self {
1198 self.vector_type = std::option::Option::Some(
1199 crate::model::vector_search::VectorType::SparseVector(v.into()),
1200 );
1201 self
1202 }
1203}
1204
1205impl wkt::message::Message for VectorSearch {
1206 fn typename() -> &'static str {
1207 "type.googleapis.com/google.cloud.vectorsearch.v1.VectorSearch"
1208 }
1209}
1210
1211/// Defines additional types related to [VectorSearch].
1212pub mod vector_search {
1213 #[allow(unused_imports)]
1214 use super::*;
1215
1216 #[derive(Clone, Debug, PartialEq)]
1217 #[non_exhaustive]
1218 pub enum VectorType {
1219 /// A dense vector for the query.
1220 Vector(std::boxed::Box<crate::model::DenseVector>),
1221 /// A sparse vector for the query.
1222 SparseVector(std::boxed::Box<crate::model::SparseVector>),
1223 }
1224}
1225
1226/// Defines a semantic search operation.
1227#[derive(Clone, Default, PartialEq)]
1228#[non_exhaustive]
1229pub struct SemanticSearch {
1230 /// Required. The query text, which is used to generate an embedding according
1231 /// to the embedding model specified in the collection config.
1232 pub search_text: std::string::String,
1233
1234 /// Required. The vector field to search.
1235 pub search_field: std::string::String,
1236
1237 /// Required. The task type of the query embedding.
1238 pub task_type: crate::model::EmbeddingTaskType,
1239
1240 /// Optional. The fields to return in the search results.
1241 pub output_fields: std::option::Option<crate::model::OutputFields>,
1242
1243 /// Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
1244 /// represented as a google.protobuf.Struct.
1245 pub filter: std::option::Option<wkt::Struct>,
1246
1247 /// Optional. The number of data objects to return.
1248 pub top_k: std::option::Option<i32>,
1249
1250 /// Optional. Sets the search hint. If no strategy is specified, the service
1251 /// will use an index if one is available, and fall back to KNN search
1252 /// otherwise.
1253 pub search_hint: std::option::Option<crate::model::SearchHint>,
1254
1255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1256}
1257
1258impl SemanticSearch {
1259 pub fn new() -> Self {
1260 std::default::Default::default()
1261 }
1262
1263 /// Sets the value of [search_text][crate::model::SemanticSearch::search_text].
1264 ///
1265 /// # Example
1266 /// ```ignore,no_run
1267 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1268 /// let x = SemanticSearch::new().set_search_text("example");
1269 /// ```
1270 pub fn set_search_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1271 self.search_text = v.into();
1272 self
1273 }
1274
1275 /// Sets the value of [search_field][crate::model::SemanticSearch::search_field].
1276 ///
1277 /// # Example
1278 /// ```ignore,no_run
1279 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1280 /// let x = SemanticSearch::new().set_search_field("example");
1281 /// ```
1282 pub fn set_search_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1283 self.search_field = v.into();
1284 self
1285 }
1286
1287 /// Sets the value of [task_type][crate::model::SemanticSearch::task_type].
1288 ///
1289 /// # Example
1290 /// ```ignore,no_run
1291 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1292 /// use google_cloud_vectorsearch_v1::model::EmbeddingTaskType;
1293 /// let x0 = SemanticSearch::new().set_task_type(EmbeddingTaskType::RetrievalQuery);
1294 /// let x1 = SemanticSearch::new().set_task_type(EmbeddingTaskType::RetrievalDocument);
1295 /// let x2 = SemanticSearch::new().set_task_type(EmbeddingTaskType::SemanticSimilarity);
1296 /// ```
1297 pub fn set_task_type<T: std::convert::Into<crate::model::EmbeddingTaskType>>(
1298 mut self,
1299 v: T,
1300 ) -> Self {
1301 self.task_type = v.into();
1302 self
1303 }
1304
1305 /// Sets the value of [output_fields][crate::model::SemanticSearch::output_fields].
1306 ///
1307 /// # Example
1308 /// ```ignore,no_run
1309 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1310 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1311 /// let x = SemanticSearch::new().set_output_fields(OutputFields::default()/* use setters */);
1312 /// ```
1313 pub fn set_output_fields<T>(mut self, v: T) -> Self
1314 where
1315 T: std::convert::Into<crate::model::OutputFields>,
1316 {
1317 self.output_fields = std::option::Option::Some(v.into());
1318 self
1319 }
1320
1321 /// Sets or clears the value of [output_fields][crate::model::SemanticSearch::output_fields].
1322 ///
1323 /// # Example
1324 /// ```ignore,no_run
1325 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1326 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1327 /// let x = SemanticSearch::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
1328 /// let x = SemanticSearch::new().set_or_clear_output_fields(None::<OutputFields>);
1329 /// ```
1330 pub fn set_or_clear_output_fields<T>(mut self, v: std::option::Option<T>) -> Self
1331 where
1332 T: std::convert::Into<crate::model::OutputFields>,
1333 {
1334 self.output_fields = v.map(|x| x.into());
1335 self
1336 }
1337
1338 /// Sets the value of [filter][crate::model::SemanticSearch::filter].
1339 ///
1340 /// # Example
1341 /// ```ignore,no_run
1342 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1343 /// use wkt::Struct;
1344 /// let x = SemanticSearch::new().set_filter(Struct::default()/* use setters */);
1345 /// ```
1346 pub fn set_filter<T>(mut self, v: T) -> Self
1347 where
1348 T: std::convert::Into<wkt::Struct>,
1349 {
1350 self.filter = std::option::Option::Some(v.into());
1351 self
1352 }
1353
1354 /// Sets or clears the value of [filter][crate::model::SemanticSearch::filter].
1355 ///
1356 /// # Example
1357 /// ```ignore,no_run
1358 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1359 /// use wkt::Struct;
1360 /// let x = SemanticSearch::new().set_or_clear_filter(Some(Struct::default()/* use setters */));
1361 /// let x = SemanticSearch::new().set_or_clear_filter(None::<Struct>);
1362 /// ```
1363 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
1364 where
1365 T: std::convert::Into<wkt::Struct>,
1366 {
1367 self.filter = v.map(|x| x.into());
1368 self
1369 }
1370
1371 /// Sets the value of [top_k][crate::model::SemanticSearch::top_k].
1372 ///
1373 /// # Example
1374 /// ```ignore,no_run
1375 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1376 /// let x = SemanticSearch::new().set_top_k(42);
1377 /// ```
1378 pub fn set_top_k<T>(mut self, v: T) -> Self
1379 where
1380 T: std::convert::Into<i32>,
1381 {
1382 self.top_k = std::option::Option::Some(v.into());
1383 self
1384 }
1385
1386 /// Sets or clears the value of [top_k][crate::model::SemanticSearch::top_k].
1387 ///
1388 /// # Example
1389 /// ```ignore,no_run
1390 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1391 /// let x = SemanticSearch::new().set_or_clear_top_k(Some(42));
1392 /// let x = SemanticSearch::new().set_or_clear_top_k(None::<i32>);
1393 /// ```
1394 pub fn set_or_clear_top_k<T>(mut self, v: std::option::Option<T>) -> Self
1395 where
1396 T: std::convert::Into<i32>,
1397 {
1398 self.top_k = v.map(|x| x.into());
1399 self
1400 }
1401
1402 /// Sets the value of [search_hint][crate::model::SemanticSearch::search_hint].
1403 ///
1404 /// # Example
1405 /// ```ignore,no_run
1406 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1407 /// use google_cloud_vectorsearch_v1::model::SearchHint;
1408 /// let x = SemanticSearch::new().set_search_hint(SearchHint::default()/* use setters */);
1409 /// ```
1410 pub fn set_search_hint<T>(mut self, v: T) -> Self
1411 where
1412 T: std::convert::Into<crate::model::SearchHint>,
1413 {
1414 self.search_hint = std::option::Option::Some(v.into());
1415 self
1416 }
1417
1418 /// Sets or clears the value of [search_hint][crate::model::SemanticSearch::search_hint].
1419 ///
1420 /// # Example
1421 /// ```ignore,no_run
1422 /// # use google_cloud_vectorsearch_v1::model::SemanticSearch;
1423 /// use google_cloud_vectorsearch_v1::model::SearchHint;
1424 /// let x = SemanticSearch::new().set_or_clear_search_hint(Some(SearchHint::default()/* use setters */));
1425 /// let x = SemanticSearch::new().set_or_clear_search_hint(None::<SearchHint>);
1426 /// ```
1427 pub fn set_or_clear_search_hint<T>(mut self, v: std::option::Option<T>) -> Self
1428 where
1429 T: std::convert::Into<crate::model::SearchHint>,
1430 {
1431 self.search_hint = v.map(|x| x.into());
1432 self
1433 }
1434}
1435
1436impl wkt::message::Message for SemanticSearch {
1437 fn typename() -> &'static str {
1438 "type.googleapis.com/google.cloud.vectorsearch.v1.SemanticSearch"
1439 }
1440}
1441
1442/// Defines a text search operation.
1443#[derive(Clone, Default, PartialEq)]
1444#[non_exhaustive]
1445pub struct TextSearch {
1446 /// Required. The query text.
1447 pub search_text: std::string::String,
1448
1449 /// Required. The data field names to search.
1450 pub data_field_names: std::vec::Vec<std::string::String>,
1451
1452 /// Optional. The fields to return in the search results.
1453 pub output_fields: std::option::Option<crate::model::OutputFields>,
1454
1455 /// Optional. The number of results to return.
1456 pub top_k: std::option::Option<i32>,
1457
1458 /// Optional. A JSON filter expression, e.g. `{"genre": {"$eq": "sci-fi"}}`,
1459 /// represented as a `google.protobuf.Struct`.
1460 pub filter: std::option::Option<wkt::Struct>,
1461
1462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1463}
1464
1465impl TextSearch {
1466 pub fn new() -> Self {
1467 std::default::Default::default()
1468 }
1469
1470 /// Sets the value of [search_text][crate::model::TextSearch::search_text].
1471 ///
1472 /// # Example
1473 /// ```ignore,no_run
1474 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1475 /// let x = TextSearch::new().set_search_text("example");
1476 /// ```
1477 pub fn set_search_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1478 self.search_text = v.into();
1479 self
1480 }
1481
1482 /// Sets the value of [data_field_names][crate::model::TextSearch::data_field_names].
1483 ///
1484 /// # Example
1485 /// ```ignore,no_run
1486 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1487 /// let x = TextSearch::new().set_data_field_names(["a", "b", "c"]);
1488 /// ```
1489 pub fn set_data_field_names<T, V>(mut self, v: T) -> Self
1490 where
1491 T: std::iter::IntoIterator<Item = V>,
1492 V: std::convert::Into<std::string::String>,
1493 {
1494 use std::iter::Iterator;
1495 self.data_field_names = v.into_iter().map(|i| i.into()).collect();
1496 self
1497 }
1498
1499 /// Sets the value of [output_fields][crate::model::TextSearch::output_fields].
1500 ///
1501 /// # Example
1502 /// ```ignore,no_run
1503 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1504 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1505 /// let x = TextSearch::new().set_output_fields(OutputFields::default()/* use setters */);
1506 /// ```
1507 pub fn set_output_fields<T>(mut self, v: T) -> Self
1508 where
1509 T: std::convert::Into<crate::model::OutputFields>,
1510 {
1511 self.output_fields = std::option::Option::Some(v.into());
1512 self
1513 }
1514
1515 /// Sets or clears the value of [output_fields][crate::model::TextSearch::output_fields].
1516 ///
1517 /// # Example
1518 /// ```ignore,no_run
1519 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1520 /// use google_cloud_vectorsearch_v1::model::OutputFields;
1521 /// let x = TextSearch::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
1522 /// let x = TextSearch::new().set_or_clear_output_fields(None::<OutputFields>);
1523 /// ```
1524 pub fn set_or_clear_output_fields<T>(mut self, v: std::option::Option<T>) -> Self
1525 where
1526 T: std::convert::Into<crate::model::OutputFields>,
1527 {
1528 self.output_fields = v.map(|x| x.into());
1529 self
1530 }
1531
1532 /// Sets the value of [top_k][crate::model::TextSearch::top_k].
1533 ///
1534 /// # Example
1535 /// ```ignore,no_run
1536 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1537 /// let x = TextSearch::new().set_top_k(42);
1538 /// ```
1539 pub fn set_top_k<T>(mut self, v: T) -> Self
1540 where
1541 T: std::convert::Into<i32>,
1542 {
1543 self.top_k = std::option::Option::Some(v.into());
1544 self
1545 }
1546
1547 /// Sets or clears the value of [top_k][crate::model::TextSearch::top_k].
1548 ///
1549 /// # Example
1550 /// ```ignore,no_run
1551 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1552 /// let x = TextSearch::new().set_or_clear_top_k(Some(42));
1553 /// let x = TextSearch::new().set_or_clear_top_k(None::<i32>);
1554 /// ```
1555 pub fn set_or_clear_top_k<T>(mut self, v: std::option::Option<T>) -> Self
1556 where
1557 T: std::convert::Into<i32>,
1558 {
1559 self.top_k = v.map(|x| x.into());
1560 self
1561 }
1562
1563 /// Sets the value of [filter][crate::model::TextSearch::filter].
1564 ///
1565 /// # Example
1566 /// ```ignore,no_run
1567 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1568 /// use wkt::Struct;
1569 /// let x = TextSearch::new().set_filter(Struct::default()/* use setters */);
1570 /// ```
1571 pub fn set_filter<T>(mut self, v: T) -> Self
1572 where
1573 T: std::convert::Into<wkt::Struct>,
1574 {
1575 self.filter = std::option::Option::Some(v.into());
1576 self
1577 }
1578
1579 /// Sets or clears the value of [filter][crate::model::TextSearch::filter].
1580 ///
1581 /// # Example
1582 /// ```ignore,no_run
1583 /// # use google_cloud_vectorsearch_v1::model::TextSearch;
1584 /// use wkt::Struct;
1585 /// let x = TextSearch::new().set_or_clear_filter(Some(Struct::default()/* use setters */));
1586 /// let x = TextSearch::new().set_or_clear_filter(None::<Struct>);
1587 /// ```
1588 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
1589 where
1590 T: std::convert::Into<wkt::Struct>,
1591 {
1592 self.filter = v.map(|x| x.into());
1593 self
1594 }
1595}
1596
1597impl wkt::message::Message for TextSearch {
1598 fn typename() -> &'static str {
1599 "type.googleapis.com/google.cloud.vectorsearch.v1.TextSearch"
1600 }
1601}
1602
1603/// Request for performing a single search.
1604#[derive(Clone, Default, PartialEq)]
1605#[non_exhaustive]
1606pub struct SearchDataObjectsRequest {
1607 /// Required. The resource name of the Collection for which to search.
1608 /// Format: `projects/{project}/locations/{location}/collections/{collection}`
1609 pub parent: std::string::String,
1610
1611 /// Optional. The standard list page size. Only supported for KNN. If not set,
1612 /// up to search_type.top_k results will be returned. The maximum value is
1613 /// 1000; values above 1000 will be coerced to 1000.
1614 pub page_size: i32,
1615
1616 /// Optional. The standard list page token.
1617 /// Typically obtained via
1618 /// [SearchDataObjectsResponse.next_page_token][google.cloud.vectorsearch.v1.SearchDataObjectsResponse.next_page_token]
1619 /// of the previous
1620 /// [DataObjectSearchService.SearchDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.SearchDataObjects]
1621 /// call.
1622 ///
1623 /// [google.cloud.vectorsearch.v1.DataObjectSearchService.SearchDataObjects]: crate::client::DataObjectSearchService::search_data_objects
1624 /// [google.cloud.vectorsearch.v1.SearchDataObjectsResponse.next_page_token]: crate::model::SearchDataObjectsResponse::next_page_token
1625 pub page_token: std::string::String,
1626
1627 /// The query to search for.
1628 pub search_type: std::option::Option<crate::model::search_data_objects_request::SearchType>,
1629
1630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1631}
1632
1633impl SearchDataObjectsRequest {
1634 pub fn new() -> Self {
1635 std::default::Default::default()
1636 }
1637
1638 /// Sets the value of [parent][crate::model::SearchDataObjectsRequest::parent].
1639 ///
1640 /// # Example
1641 /// ```ignore,no_run
1642 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1643 /// let x = SearchDataObjectsRequest::new().set_parent("example");
1644 /// ```
1645 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1646 self.parent = v.into();
1647 self
1648 }
1649
1650 /// Sets the value of [page_size][crate::model::SearchDataObjectsRequest::page_size].
1651 ///
1652 /// # Example
1653 /// ```ignore,no_run
1654 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1655 /// let x = SearchDataObjectsRequest::new().set_page_size(42);
1656 /// ```
1657 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1658 self.page_size = v.into();
1659 self
1660 }
1661
1662 /// Sets the value of [page_token][crate::model::SearchDataObjectsRequest::page_token].
1663 ///
1664 /// # Example
1665 /// ```ignore,no_run
1666 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1667 /// let x = SearchDataObjectsRequest::new().set_page_token("example");
1668 /// ```
1669 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1670 self.page_token = v.into();
1671 self
1672 }
1673
1674 /// Sets the value of [search_type][crate::model::SearchDataObjectsRequest::search_type].
1675 ///
1676 /// Note that all the setters affecting `search_type` are mutually
1677 /// exclusive.
1678 ///
1679 /// # Example
1680 /// ```ignore,no_run
1681 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1682 /// use google_cloud_vectorsearch_v1::model::VectorSearch;
1683 /// let x = SearchDataObjectsRequest::new().set_search_type(Some(
1684 /// google_cloud_vectorsearch_v1::model::search_data_objects_request::SearchType::VectorSearch(VectorSearch::default().into())));
1685 /// ```
1686 pub fn set_search_type<
1687 T: std::convert::Into<
1688 std::option::Option<crate::model::search_data_objects_request::SearchType>,
1689 >,
1690 >(
1691 mut self,
1692 v: T,
1693 ) -> Self {
1694 self.search_type = v.into();
1695 self
1696 }
1697
1698 /// The value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1699 /// if it holds a `VectorSearch`, `None` if the field is not set or
1700 /// holds a different branch.
1701 pub fn vector_search(
1702 &self,
1703 ) -> std::option::Option<&std::boxed::Box<crate::model::VectorSearch>> {
1704 #[allow(unreachable_patterns)]
1705 self.search_type.as_ref().and_then(|v| match v {
1706 crate::model::search_data_objects_request::SearchType::VectorSearch(v) => {
1707 std::option::Option::Some(v)
1708 }
1709 _ => std::option::Option::None,
1710 })
1711 }
1712
1713 /// Sets the value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1714 /// to hold a `VectorSearch`.
1715 ///
1716 /// Note that all the setters affecting `search_type` are
1717 /// mutually exclusive.
1718 ///
1719 /// # Example
1720 /// ```ignore,no_run
1721 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1722 /// use google_cloud_vectorsearch_v1::model::VectorSearch;
1723 /// let x = SearchDataObjectsRequest::new().set_vector_search(VectorSearch::default()/* use setters */);
1724 /// assert!(x.vector_search().is_some());
1725 /// assert!(x.semantic_search().is_none());
1726 /// assert!(x.text_search().is_none());
1727 /// ```
1728 pub fn set_vector_search<T: std::convert::Into<std::boxed::Box<crate::model::VectorSearch>>>(
1729 mut self,
1730 v: T,
1731 ) -> Self {
1732 self.search_type = std::option::Option::Some(
1733 crate::model::search_data_objects_request::SearchType::VectorSearch(v.into()),
1734 );
1735 self
1736 }
1737
1738 /// The value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1739 /// if it holds a `SemanticSearch`, `None` if the field is not set or
1740 /// holds a different branch.
1741 pub fn semantic_search(
1742 &self,
1743 ) -> std::option::Option<&std::boxed::Box<crate::model::SemanticSearch>> {
1744 #[allow(unreachable_patterns)]
1745 self.search_type.as_ref().and_then(|v| match v {
1746 crate::model::search_data_objects_request::SearchType::SemanticSearch(v) => {
1747 std::option::Option::Some(v)
1748 }
1749 _ => std::option::Option::None,
1750 })
1751 }
1752
1753 /// Sets the value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1754 /// to hold a `SemanticSearch`.
1755 ///
1756 /// Note that all the setters affecting `search_type` are
1757 /// mutually exclusive.
1758 ///
1759 /// # Example
1760 /// ```ignore,no_run
1761 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1762 /// use google_cloud_vectorsearch_v1::model::SemanticSearch;
1763 /// let x = SearchDataObjectsRequest::new().set_semantic_search(SemanticSearch::default()/* use setters */);
1764 /// assert!(x.semantic_search().is_some());
1765 /// assert!(x.vector_search().is_none());
1766 /// assert!(x.text_search().is_none());
1767 /// ```
1768 pub fn set_semantic_search<
1769 T: std::convert::Into<std::boxed::Box<crate::model::SemanticSearch>>,
1770 >(
1771 mut self,
1772 v: T,
1773 ) -> Self {
1774 self.search_type = std::option::Option::Some(
1775 crate::model::search_data_objects_request::SearchType::SemanticSearch(v.into()),
1776 );
1777 self
1778 }
1779
1780 /// The value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1781 /// if it holds a `TextSearch`, `None` if the field is not set or
1782 /// holds a different branch.
1783 pub fn text_search(&self) -> std::option::Option<&std::boxed::Box<crate::model::TextSearch>> {
1784 #[allow(unreachable_patterns)]
1785 self.search_type.as_ref().and_then(|v| match v {
1786 crate::model::search_data_objects_request::SearchType::TextSearch(v) => {
1787 std::option::Option::Some(v)
1788 }
1789 _ => std::option::Option::None,
1790 })
1791 }
1792
1793 /// Sets the value of [search_type][crate::model::SearchDataObjectsRequest::search_type]
1794 /// to hold a `TextSearch`.
1795 ///
1796 /// Note that all the setters affecting `search_type` are
1797 /// mutually exclusive.
1798 ///
1799 /// # Example
1800 /// ```ignore,no_run
1801 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsRequest;
1802 /// use google_cloud_vectorsearch_v1::model::TextSearch;
1803 /// let x = SearchDataObjectsRequest::new().set_text_search(TextSearch::default()/* use setters */);
1804 /// assert!(x.text_search().is_some());
1805 /// assert!(x.vector_search().is_none());
1806 /// assert!(x.semantic_search().is_none());
1807 /// ```
1808 pub fn set_text_search<T: std::convert::Into<std::boxed::Box<crate::model::TextSearch>>>(
1809 mut self,
1810 v: T,
1811 ) -> Self {
1812 self.search_type = std::option::Option::Some(
1813 crate::model::search_data_objects_request::SearchType::TextSearch(v.into()),
1814 );
1815 self
1816 }
1817}
1818
1819impl wkt::message::Message for SearchDataObjectsRequest {
1820 fn typename() -> &'static str {
1821 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchDataObjectsRequest"
1822 }
1823}
1824
1825/// Defines additional types related to [SearchDataObjectsRequest].
1826pub mod search_data_objects_request {
1827 #[allow(unused_imports)]
1828 use super::*;
1829
1830 /// The query to search for.
1831 #[derive(Clone, Debug, PartialEq)]
1832 #[non_exhaustive]
1833 pub enum SearchType {
1834 /// A vector search operation.
1835 VectorSearch(std::boxed::Box<crate::model::VectorSearch>),
1836 /// A semantic search operation.
1837 SemanticSearch(std::boxed::Box<crate::model::SemanticSearch>),
1838 /// Optional. A text search operation.
1839 TextSearch(std::boxed::Box<crate::model::TextSearch>),
1840 }
1841}
1842
1843/// A single search result.
1844#[derive(Clone, Default, PartialEq)]
1845#[non_exhaustive]
1846pub struct SearchResult {
1847 /// Output only. The matching data object.
1848 pub data_object: std::option::Option<crate::model::DataObject>,
1849
1850 /// Output only. Similarity distance or ranker score returned by
1851 /// BatchSearchDataObjects.
1852 pub distance: std::option::Option<f64>,
1853
1854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1855}
1856
1857impl SearchResult {
1858 pub fn new() -> Self {
1859 std::default::Default::default()
1860 }
1861
1862 /// Sets the value of [data_object][crate::model::SearchResult::data_object].
1863 ///
1864 /// # Example
1865 /// ```ignore,no_run
1866 /// # use google_cloud_vectorsearch_v1::model::SearchResult;
1867 /// use google_cloud_vectorsearch_v1::model::DataObject;
1868 /// let x = SearchResult::new().set_data_object(DataObject::default()/* use setters */);
1869 /// ```
1870 pub fn set_data_object<T>(mut self, v: T) -> Self
1871 where
1872 T: std::convert::Into<crate::model::DataObject>,
1873 {
1874 self.data_object = std::option::Option::Some(v.into());
1875 self
1876 }
1877
1878 /// Sets or clears the value of [data_object][crate::model::SearchResult::data_object].
1879 ///
1880 /// # Example
1881 /// ```ignore,no_run
1882 /// # use google_cloud_vectorsearch_v1::model::SearchResult;
1883 /// use google_cloud_vectorsearch_v1::model::DataObject;
1884 /// let x = SearchResult::new().set_or_clear_data_object(Some(DataObject::default()/* use setters */));
1885 /// let x = SearchResult::new().set_or_clear_data_object(None::<DataObject>);
1886 /// ```
1887 pub fn set_or_clear_data_object<T>(mut self, v: std::option::Option<T>) -> Self
1888 where
1889 T: std::convert::Into<crate::model::DataObject>,
1890 {
1891 self.data_object = v.map(|x| x.into());
1892 self
1893 }
1894
1895 /// Sets the value of [distance][crate::model::SearchResult::distance].
1896 ///
1897 /// # Example
1898 /// ```ignore,no_run
1899 /// # use google_cloud_vectorsearch_v1::model::SearchResult;
1900 /// let x = SearchResult::new().set_distance(42.0);
1901 /// ```
1902 pub fn set_distance<T>(mut self, v: T) -> Self
1903 where
1904 T: std::convert::Into<f64>,
1905 {
1906 self.distance = std::option::Option::Some(v.into());
1907 self
1908 }
1909
1910 /// Sets or clears the value of [distance][crate::model::SearchResult::distance].
1911 ///
1912 /// # Example
1913 /// ```ignore,no_run
1914 /// # use google_cloud_vectorsearch_v1::model::SearchResult;
1915 /// let x = SearchResult::new().set_or_clear_distance(Some(42.0));
1916 /// let x = SearchResult::new().set_or_clear_distance(None::<f32>);
1917 /// ```
1918 pub fn set_or_clear_distance<T>(mut self, v: std::option::Option<T>) -> Self
1919 where
1920 T: std::convert::Into<f64>,
1921 {
1922 self.distance = v.map(|x| x.into());
1923 self
1924 }
1925}
1926
1927impl wkt::message::Message for SearchResult {
1928 fn typename() -> &'static str {
1929 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchResult"
1930 }
1931}
1932
1933/// Response for a search request.
1934#[derive(Clone, Default, PartialEq)]
1935#[non_exhaustive]
1936pub struct SearchDataObjectsResponse {
1937 /// Output only. The list of dataObjects that match the search criteria.
1938 pub results: std::vec::Vec<crate::model::SearchResult>,
1939
1940 /// Output only. A token to retrieve next page of results.
1941 /// Pass to [DataObjectSearchService.SearchDataObjectsRequest.page_token][] to
1942 /// obtain that page.
1943 pub next_page_token: std::string::String,
1944
1945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1946}
1947
1948impl SearchDataObjectsResponse {
1949 pub fn new() -> Self {
1950 std::default::Default::default()
1951 }
1952
1953 /// Sets the value of [results][crate::model::SearchDataObjectsResponse::results].
1954 ///
1955 /// # Example
1956 /// ```ignore,no_run
1957 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsResponse;
1958 /// use google_cloud_vectorsearch_v1::model::SearchResult;
1959 /// let x = SearchDataObjectsResponse::new()
1960 /// .set_results([
1961 /// SearchResult::default()/* use setters */,
1962 /// SearchResult::default()/* use (different) setters */,
1963 /// ]);
1964 /// ```
1965 pub fn set_results<T, V>(mut self, v: T) -> Self
1966 where
1967 T: std::iter::IntoIterator<Item = V>,
1968 V: std::convert::Into<crate::model::SearchResult>,
1969 {
1970 use std::iter::Iterator;
1971 self.results = v.into_iter().map(|i| i.into()).collect();
1972 self
1973 }
1974
1975 /// Sets the value of [next_page_token][crate::model::SearchDataObjectsResponse::next_page_token].
1976 ///
1977 /// # Example
1978 /// ```ignore,no_run
1979 /// # use google_cloud_vectorsearch_v1::model::SearchDataObjectsResponse;
1980 /// let x = SearchDataObjectsResponse::new().set_next_page_token("example");
1981 /// ```
1982 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.next_page_token = v.into();
1984 self
1985 }
1986}
1987
1988impl wkt::message::Message for SearchDataObjectsResponse {
1989 fn typename() -> &'static str {
1990 "type.googleapis.com/google.cloud.vectorsearch.v1.SearchDataObjectsResponse"
1991 }
1992}
1993
1994#[doc(hidden)]
1995impl google_cloud_gax::paginator::internal::PageableResponse for SearchDataObjectsResponse {
1996 type PageItem = crate::model::SearchResult;
1997
1998 fn items(self) -> std::vec::Vec<Self::PageItem> {
1999 self.results
2000 }
2001
2002 fn next_page_token(&self) -> std::string::String {
2003 use std::clone::Clone;
2004 self.next_page_token.clone()
2005 }
2006}
2007
2008/// Request message for
2009/// [DataObjectSearchService.AggregateDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.AggregateDataObjects].
2010///
2011/// [google.cloud.vectorsearch.v1.DataObjectSearchService.AggregateDataObjects]: crate::client::DataObjectSearchService::aggregate_data_objects
2012#[derive(Clone, Default, PartialEq)]
2013#[non_exhaustive]
2014pub struct AggregateDataObjectsRequest {
2015 /// Required. The resource name of the Collection for which to query.
2016 /// Format: `projects/{project}/locations/{location}/collections/{collection}`
2017 pub parent: std::string::String,
2018
2019 /// Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
2020 /// represented as a google.protobuf.Struct.
2021 pub filter: std::option::Option<wkt::Struct>,
2022
2023 /// Required. The aggregation method to apply to the query.
2024 pub aggregate: crate::model::AggregationMethod,
2025
2026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2027}
2028
2029impl AggregateDataObjectsRequest {
2030 pub fn new() -> Self {
2031 std::default::Default::default()
2032 }
2033
2034 /// Sets the value of [parent][crate::model::AggregateDataObjectsRequest::parent].
2035 ///
2036 /// # Example
2037 /// ```ignore,no_run
2038 /// # use google_cloud_vectorsearch_v1::model::AggregateDataObjectsRequest;
2039 /// let x = AggregateDataObjectsRequest::new().set_parent("example");
2040 /// ```
2041 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.parent = v.into();
2043 self
2044 }
2045
2046 /// Sets the value of [filter][crate::model::AggregateDataObjectsRequest::filter].
2047 ///
2048 /// # Example
2049 /// ```ignore,no_run
2050 /// # use google_cloud_vectorsearch_v1::model::AggregateDataObjectsRequest;
2051 /// use wkt::Struct;
2052 /// let x = AggregateDataObjectsRequest::new().set_filter(Struct::default()/* use setters */);
2053 /// ```
2054 pub fn set_filter<T>(mut self, v: T) -> Self
2055 where
2056 T: std::convert::Into<wkt::Struct>,
2057 {
2058 self.filter = std::option::Option::Some(v.into());
2059 self
2060 }
2061
2062 /// Sets or clears the value of [filter][crate::model::AggregateDataObjectsRequest::filter].
2063 ///
2064 /// # Example
2065 /// ```ignore,no_run
2066 /// # use google_cloud_vectorsearch_v1::model::AggregateDataObjectsRequest;
2067 /// use wkt::Struct;
2068 /// let x = AggregateDataObjectsRequest::new().set_or_clear_filter(Some(Struct::default()/* use setters */));
2069 /// let x = AggregateDataObjectsRequest::new().set_or_clear_filter(None::<Struct>);
2070 /// ```
2071 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
2072 where
2073 T: std::convert::Into<wkt::Struct>,
2074 {
2075 self.filter = v.map(|x| x.into());
2076 self
2077 }
2078
2079 /// Sets the value of [aggregate][crate::model::AggregateDataObjectsRequest::aggregate].
2080 ///
2081 /// # Example
2082 /// ```ignore,no_run
2083 /// # use google_cloud_vectorsearch_v1::model::AggregateDataObjectsRequest;
2084 /// use google_cloud_vectorsearch_v1::model::AggregationMethod;
2085 /// let x0 = AggregateDataObjectsRequest::new().set_aggregate(AggregationMethod::Count);
2086 /// ```
2087 pub fn set_aggregate<T: std::convert::Into<crate::model::AggregationMethod>>(
2088 mut self,
2089 v: T,
2090 ) -> Self {
2091 self.aggregate = v.into();
2092 self
2093 }
2094}
2095
2096impl wkt::message::Message for AggregateDataObjectsRequest {
2097 fn typename() -> &'static str {
2098 "type.googleapis.com/google.cloud.vectorsearch.v1.AggregateDataObjectsRequest"
2099 }
2100}
2101
2102/// Response message for
2103/// [DataObjectSearchService.AggregateDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.AggregateDataObjects].
2104///
2105/// [google.cloud.vectorsearch.v1.DataObjectSearchService.AggregateDataObjects]: crate::client::DataObjectSearchService::aggregate_data_objects
2106#[derive(Clone, Default, PartialEq)]
2107#[non_exhaustive]
2108pub struct AggregateDataObjectsResponse {
2109 /// Output only. The aggregated results of the query.
2110 pub aggregate_results: std::vec::Vec<wkt::Struct>,
2111
2112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2113}
2114
2115impl AggregateDataObjectsResponse {
2116 pub fn new() -> Self {
2117 std::default::Default::default()
2118 }
2119
2120 /// Sets the value of [aggregate_results][crate::model::AggregateDataObjectsResponse::aggregate_results].
2121 ///
2122 /// # Example
2123 /// ```ignore,no_run
2124 /// # use google_cloud_vectorsearch_v1::model::AggregateDataObjectsResponse;
2125 /// use wkt::Struct;
2126 /// let x = AggregateDataObjectsResponse::new()
2127 /// .set_aggregate_results([
2128 /// Struct::default()/* use setters */,
2129 /// Struct::default()/* use (different) setters */,
2130 /// ]);
2131 /// ```
2132 pub fn set_aggregate_results<T, V>(mut self, v: T) -> Self
2133 where
2134 T: std::iter::IntoIterator<Item = V>,
2135 V: std::convert::Into<wkt::Struct>,
2136 {
2137 use std::iter::Iterator;
2138 self.aggregate_results = v.into_iter().map(|i| i.into()).collect();
2139 self
2140 }
2141}
2142
2143impl wkt::message::Message for AggregateDataObjectsResponse {
2144 fn typename() -> &'static str {
2145 "type.googleapis.com/google.cloud.vectorsearch.v1.AggregateDataObjectsResponse"
2146 }
2147}
2148
2149/// Request message for
2150/// [DataObjectSearchService.QueryDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects].
2151///
2152/// [google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects]: crate::client::DataObjectSearchService::query_data_objects
2153#[derive(Clone, Default, PartialEq)]
2154#[non_exhaustive]
2155pub struct QueryDataObjectsRequest {
2156 /// Required. The resource name of the Collection for which to query.
2157 /// Format: `projects/{project}/locations/{location}/collections/{collection}`
2158 pub parent: std::string::String,
2159
2160 /// Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
2161 /// represented as a google.protobuf.Struct.
2162 pub filter: std::option::Option<wkt::Struct>,
2163
2164 /// Optional. Mask specifying which fields to return.
2165 pub output_fields: std::option::Option<crate::model::OutputFields>,
2166
2167 /// Optional. The standard list page size. Default is 100.
2168 /// The maximum value is 1000; values above 1000 will be coerced to 1000.
2169 pub page_size: i32,
2170
2171 /// Optional. The standard list page token.
2172 /// Typically obtained via
2173 /// [QueryDataObjectsResponse.next_page_token][google.cloud.vectorsearch.v1.QueryDataObjectsResponse.next_page_token]
2174 /// of the previous
2175 /// [DataObjectSearchService.QueryDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects]
2176 /// call.
2177 ///
2178 /// [google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects]: crate::client::DataObjectSearchService::query_data_objects
2179 /// [google.cloud.vectorsearch.v1.QueryDataObjectsResponse.next_page_token]: crate::model::QueryDataObjectsResponse::next_page_token
2180 pub page_token: std::string::String,
2181
2182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2183}
2184
2185impl QueryDataObjectsRequest {
2186 pub fn new() -> Self {
2187 std::default::Default::default()
2188 }
2189
2190 /// Sets the value of [parent][crate::model::QueryDataObjectsRequest::parent].
2191 ///
2192 /// # Example
2193 /// ```ignore,no_run
2194 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2195 /// let x = QueryDataObjectsRequest::new().set_parent("example");
2196 /// ```
2197 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2198 self.parent = v.into();
2199 self
2200 }
2201
2202 /// Sets the value of [filter][crate::model::QueryDataObjectsRequest::filter].
2203 ///
2204 /// # Example
2205 /// ```ignore,no_run
2206 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2207 /// use wkt::Struct;
2208 /// let x = QueryDataObjectsRequest::new().set_filter(Struct::default()/* use setters */);
2209 /// ```
2210 pub fn set_filter<T>(mut self, v: T) -> Self
2211 where
2212 T: std::convert::Into<wkt::Struct>,
2213 {
2214 self.filter = std::option::Option::Some(v.into());
2215 self
2216 }
2217
2218 /// Sets or clears the value of [filter][crate::model::QueryDataObjectsRequest::filter].
2219 ///
2220 /// # Example
2221 /// ```ignore,no_run
2222 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2223 /// use wkt::Struct;
2224 /// let x = QueryDataObjectsRequest::new().set_or_clear_filter(Some(Struct::default()/* use setters */));
2225 /// let x = QueryDataObjectsRequest::new().set_or_clear_filter(None::<Struct>);
2226 /// ```
2227 pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
2228 where
2229 T: std::convert::Into<wkt::Struct>,
2230 {
2231 self.filter = v.map(|x| x.into());
2232 self
2233 }
2234
2235 /// Sets the value of [output_fields][crate::model::QueryDataObjectsRequest::output_fields].
2236 ///
2237 /// # Example
2238 /// ```ignore,no_run
2239 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2240 /// use google_cloud_vectorsearch_v1::model::OutputFields;
2241 /// let x = QueryDataObjectsRequest::new().set_output_fields(OutputFields::default()/* use setters */);
2242 /// ```
2243 pub fn set_output_fields<T>(mut self, v: T) -> Self
2244 where
2245 T: std::convert::Into<crate::model::OutputFields>,
2246 {
2247 self.output_fields = std::option::Option::Some(v.into());
2248 self
2249 }
2250
2251 /// Sets or clears the value of [output_fields][crate::model::QueryDataObjectsRequest::output_fields].
2252 ///
2253 /// # Example
2254 /// ```ignore,no_run
2255 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2256 /// use google_cloud_vectorsearch_v1::model::OutputFields;
2257 /// let x = QueryDataObjectsRequest::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
2258 /// let x = QueryDataObjectsRequest::new().set_or_clear_output_fields(None::<OutputFields>);
2259 /// ```
2260 pub fn set_or_clear_output_fields<T>(mut self, v: std::option::Option<T>) -> Self
2261 where
2262 T: std::convert::Into<crate::model::OutputFields>,
2263 {
2264 self.output_fields = v.map(|x| x.into());
2265 self
2266 }
2267
2268 /// Sets the value of [page_size][crate::model::QueryDataObjectsRequest::page_size].
2269 ///
2270 /// # Example
2271 /// ```ignore,no_run
2272 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2273 /// let x = QueryDataObjectsRequest::new().set_page_size(42);
2274 /// ```
2275 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2276 self.page_size = v.into();
2277 self
2278 }
2279
2280 /// Sets the value of [page_token][crate::model::QueryDataObjectsRequest::page_token].
2281 ///
2282 /// # Example
2283 /// ```ignore,no_run
2284 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsRequest;
2285 /// let x = QueryDataObjectsRequest::new().set_page_token("example");
2286 /// ```
2287 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2288 self.page_token = v.into();
2289 self
2290 }
2291}
2292
2293impl wkt::message::Message for QueryDataObjectsRequest {
2294 fn typename() -> &'static str {
2295 "type.googleapis.com/google.cloud.vectorsearch.v1.QueryDataObjectsRequest"
2296 }
2297}
2298
2299/// Response message for
2300/// [DataObjectSearchService.QueryDataObjects][google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects].
2301///
2302/// [google.cloud.vectorsearch.v1.DataObjectSearchService.QueryDataObjects]: crate::client::DataObjectSearchService::query_data_objects
2303#[derive(Clone, Default, PartialEq)]
2304#[non_exhaustive]
2305pub struct QueryDataObjectsResponse {
2306 /// Output only. The list of dataObjects that match the query.
2307 pub data_objects: std::vec::Vec<crate::model::DataObject>,
2308
2309 /// Output only. A token to retrieve next page of results.
2310 /// Pass to [DataObjectSearchService.QueryDataObjectsRequest.page_token][] to
2311 /// obtain that page.
2312 pub next_page_token: std::string::String,
2313
2314 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2315}
2316
2317impl QueryDataObjectsResponse {
2318 pub fn new() -> Self {
2319 std::default::Default::default()
2320 }
2321
2322 /// Sets the value of [data_objects][crate::model::QueryDataObjectsResponse::data_objects].
2323 ///
2324 /// # Example
2325 /// ```ignore,no_run
2326 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsResponse;
2327 /// use google_cloud_vectorsearch_v1::model::DataObject;
2328 /// let x = QueryDataObjectsResponse::new()
2329 /// .set_data_objects([
2330 /// DataObject::default()/* use setters */,
2331 /// DataObject::default()/* use (different) setters */,
2332 /// ]);
2333 /// ```
2334 pub fn set_data_objects<T, V>(mut self, v: T) -> Self
2335 where
2336 T: std::iter::IntoIterator<Item = V>,
2337 V: std::convert::Into<crate::model::DataObject>,
2338 {
2339 use std::iter::Iterator;
2340 self.data_objects = v.into_iter().map(|i| i.into()).collect();
2341 self
2342 }
2343
2344 /// Sets the value of [next_page_token][crate::model::QueryDataObjectsResponse::next_page_token].
2345 ///
2346 /// # Example
2347 /// ```ignore,no_run
2348 /// # use google_cloud_vectorsearch_v1::model::QueryDataObjectsResponse;
2349 /// let x = QueryDataObjectsResponse::new().set_next_page_token("example");
2350 /// ```
2351 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2352 self.next_page_token = v.into();
2353 self
2354 }
2355}
2356
2357impl wkt::message::Message for QueryDataObjectsResponse {
2358 fn typename() -> &'static str {
2359 "type.googleapis.com/google.cloud.vectorsearch.v1.QueryDataObjectsResponse"
2360 }
2361}
2362
2363#[doc(hidden)]
2364impl google_cloud_gax::paginator::internal::PageableResponse for QueryDataObjectsResponse {
2365 type PageItem = crate::model::DataObject;
2366
2367 fn items(self) -> std::vec::Vec<Self::PageItem> {
2368 self.data_objects
2369 }
2370
2371 fn next_page_token(&self) -> std::string::String {
2372 use std::clone::Clone;
2373 self.next_page_token.clone()
2374 }
2375}
2376
2377/// A request to perform a batch of search operations.
2378#[derive(Clone, Default, PartialEq)]
2379#[non_exhaustive]
2380pub struct BatchSearchDataObjectsRequest {
2381 /// Required. The resource name of the Collection for which to search.
2382 /// Format: `projects/{project}/locations/{location}/collections/{collection}`
2383 pub parent: std::string::String,
2384
2385 /// Required. A list of search requests to execute in parallel.
2386 pub searches: std::vec::Vec<crate::model::Search>,
2387
2388 /// Optional. Options for combining the results of the batch search operations.
2389 pub combine:
2390 std::option::Option<crate::model::batch_search_data_objects_request::CombineResultsOptions>,
2391
2392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2393}
2394
2395impl BatchSearchDataObjectsRequest {
2396 pub fn new() -> Self {
2397 std::default::Default::default()
2398 }
2399
2400 /// Sets the value of [parent][crate::model::BatchSearchDataObjectsRequest::parent].
2401 ///
2402 /// # Example
2403 /// ```ignore,no_run
2404 /// # use google_cloud_vectorsearch_v1::model::BatchSearchDataObjectsRequest;
2405 /// let x = BatchSearchDataObjectsRequest::new().set_parent("example");
2406 /// ```
2407 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2408 self.parent = v.into();
2409 self
2410 }
2411
2412 /// Sets the value of [searches][crate::model::BatchSearchDataObjectsRequest::searches].
2413 ///
2414 /// # Example
2415 /// ```ignore,no_run
2416 /// # use google_cloud_vectorsearch_v1::model::BatchSearchDataObjectsRequest;
2417 /// use google_cloud_vectorsearch_v1::model::Search;
2418 /// let x = BatchSearchDataObjectsRequest::new()
2419 /// .set_searches([
2420 /// Search::default()/* use setters */,
2421 /// Search::default()/* use (different) setters */,
2422 /// ]);
2423 /// ```
2424 pub fn set_searches<T, V>(mut self, v: T) -> Self
2425 where
2426 T: std::iter::IntoIterator<Item = V>,
2427 V: std::convert::Into<crate::model::Search>,
2428 {
2429 use std::iter::Iterator;
2430 self.searches = v.into_iter().map(|i| i.into()).collect();
2431 self
2432 }
2433
2434 /// Sets the value of [combine][crate::model::BatchSearchDataObjectsRequest::combine].
2435 ///
2436 /// # Example
2437 /// ```ignore,no_run
2438 /// # use google_cloud_vectorsearch_v1::model::BatchSearchDataObjectsRequest;
2439 /// use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2440 /// let x = BatchSearchDataObjectsRequest::new().set_combine(CombineResultsOptions::default()/* use setters */);
2441 /// ```
2442 pub fn set_combine<T>(mut self, v: T) -> Self
2443 where
2444 T: std::convert::Into<
2445 crate::model::batch_search_data_objects_request::CombineResultsOptions,
2446 >,
2447 {
2448 self.combine = std::option::Option::Some(v.into());
2449 self
2450 }
2451
2452 /// Sets or clears the value of [combine][crate::model::BatchSearchDataObjectsRequest::combine].
2453 ///
2454 /// # Example
2455 /// ```ignore,no_run
2456 /// # use google_cloud_vectorsearch_v1::model::BatchSearchDataObjectsRequest;
2457 /// use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2458 /// let x = BatchSearchDataObjectsRequest::new().set_or_clear_combine(Some(CombineResultsOptions::default()/* use setters */));
2459 /// let x = BatchSearchDataObjectsRequest::new().set_or_clear_combine(None::<CombineResultsOptions>);
2460 /// ```
2461 pub fn set_or_clear_combine<T>(mut self, v: std::option::Option<T>) -> Self
2462 where
2463 T: std::convert::Into<
2464 crate::model::batch_search_data_objects_request::CombineResultsOptions,
2465 >,
2466 {
2467 self.combine = v.map(|x| x.into());
2468 self
2469 }
2470}
2471
2472impl wkt::message::Message for BatchSearchDataObjectsRequest {
2473 fn typename() -> &'static str {
2474 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchSearchDataObjectsRequest"
2475 }
2476}
2477
2478/// Defines additional types related to [BatchSearchDataObjectsRequest].
2479pub mod batch_search_data_objects_request {
2480 #[allow(unused_imports)]
2481 use super::*;
2482
2483 /// Options for combining the results of the batch search operations.
2484 #[derive(Clone, Default, PartialEq)]
2485 #[non_exhaustive]
2486 pub struct CombineResultsOptions {
2487 /// Required. The ranker to use for combining the results.
2488 pub ranker: std::option::Option<crate::model::Ranker>,
2489
2490 /// Optional. Mask specifying which fields to return.
2491 pub output_fields: std::option::Option<crate::model::OutputFields>,
2492
2493 /// Optional. The number of results to return. If not set, a default value
2494 /// will be used.
2495 pub top_k: i32,
2496
2497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2498 }
2499
2500 impl CombineResultsOptions {
2501 pub fn new() -> Self {
2502 std::default::Default::default()
2503 }
2504
2505 /// Sets the value of [ranker][crate::model::batch_search_data_objects_request::CombineResultsOptions::ranker].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2510 /// use google_cloud_vectorsearch_v1::model::Ranker;
2511 /// let x = CombineResultsOptions::new().set_ranker(Ranker::default()/* use setters */);
2512 /// ```
2513 pub fn set_ranker<T>(mut self, v: T) -> Self
2514 where
2515 T: std::convert::Into<crate::model::Ranker>,
2516 {
2517 self.ranker = std::option::Option::Some(v.into());
2518 self
2519 }
2520
2521 /// Sets or clears the value of [ranker][crate::model::batch_search_data_objects_request::CombineResultsOptions::ranker].
2522 ///
2523 /// # Example
2524 /// ```ignore,no_run
2525 /// # use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2526 /// use google_cloud_vectorsearch_v1::model::Ranker;
2527 /// let x = CombineResultsOptions::new().set_or_clear_ranker(Some(Ranker::default()/* use setters */));
2528 /// let x = CombineResultsOptions::new().set_or_clear_ranker(None::<Ranker>);
2529 /// ```
2530 pub fn set_or_clear_ranker<T>(mut self, v: std::option::Option<T>) -> Self
2531 where
2532 T: std::convert::Into<crate::model::Ranker>,
2533 {
2534 self.ranker = v.map(|x| x.into());
2535 self
2536 }
2537
2538 /// Sets the value of [output_fields][crate::model::batch_search_data_objects_request::CombineResultsOptions::output_fields].
2539 ///
2540 /// # Example
2541 /// ```ignore,no_run
2542 /// # use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2543 /// use google_cloud_vectorsearch_v1::model::OutputFields;
2544 /// let x = CombineResultsOptions::new().set_output_fields(OutputFields::default()/* use setters */);
2545 /// ```
2546 pub fn set_output_fields<T>(mut self, v: T) -> Self
2547 where
2548 T: std::convert::Into<crate::model::OutputFields>,
2549 {
2550 self.output_fields = std::option::Option::Some(v.into());
2551 self
2552 }
2553
2554 /// Sets or clears the value of [output_fields][crate::model::batch_search_data_objects_request::CombineResultsOptions::output_fields].
2555 ///
2556 /// # Example
2557 /// ```ignore,no_run
2558 /// # use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2559 /// use google_cloud_vectorsearch_v1::model::OutputFields;
2560 /// let x = CombineResultsOptions::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
2561 /// let x = CombineResultsOptions::new().set_or_clear_output_fields(None::<OutputFields>);
2562 /// ```
2563 pub fn set_or_clear_output_fields<T>(mut self, v: std::option::Option<T>) -> Self
2564 where
2565 T: std::convert::Into<crate::model::OutputFields>,
2566 {
2567 self.output_fields = v.map(|x| x.into());
2568 self
2569 }
2570
2571 /// Sets the value of [top_k][crate::model::batch_search_data_objects_request::CombineResultsOptions::top_k].
2572 ///
2573 /// # Example
2574 /// ```ignore,no_run
2575 /// # use google_cloud_vectorsearch_v1::model::batch_search_data_objects_request::CombineResultsOptions;
2576 /// let x = CombineResultsOptions::new().set_top_k(42);
2577 /// ```
2578 pub fn set_top_k<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2579 self.top_k = v.into();
2580 self
2581 }
2582 }
2583
2584 impl wkt::message::Message for CombineResultsOptions {
2585 fn typename() -> &'static str {
2586 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchSearchDataObjectsRequest.CombineResultsOptions"
2587 }
2588 }
2589}
2590
2591/// Defines a ranker to combine results from multiple searches.
2592#[derive(Clone, Default, PartialEq)]
2593#[non_exhaustive]
2594pub struct Ranker {
2595 /// The ranking method to use.
2596 pub ranker: std::option::Option<crate::model::ranker::Ranker>,
2597
2598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2599}
2600
2601impl Ranker {
2602 pub fn new() -> Self {
2603 std::default::Default::default()
2604 }
2605
2606 /// Sets the value of [ranker][crate::model::Ranker::ranker].
2607 ///
2608 /// Note that all the setters affecting `ranker` are mutually
2609 /// exclusive.
2610 ///
2611 /// # Example
2612 /// ```ignore,no_run
2613 /// # use google_cloud_vectorsearch_v1::model::Ranker;
2614 /// use google_cloud_vectorsearch_v1::model::ReciprocalRankFusion;
2615 /// let x = Ranker::new().set_ranker(Some(
2616 /// google_cloud_vectorsearch_v1::model::ranker::Ranker::Rrf(ReciprocalRankFusion::default().into())));
2617 /// ```
2618 pub fn set_ranker<T: std::convert::Into<std::option::Option<crate::model::ranker::Ranker>>>(
2619 mut self,
2620 v: T,
2621 ) -> Self {
2622 self.ranker = v.into();
2623 self
2624 }
2625
2626 /// The value of [ranker][crate::model::Ranker::ranker]
2627 /// if it holds a `Rrf`, `None` if the field is not set or
2628 /// holds a different branch.
2629 pub fn rrf(&self) -> std::option::Option<&std::boxed::Box<crate::model::ReciprocalRankFusion>> {
2630 #[allow(unreachable_patterns)]
2631 self.ranker.as_ref().and_then(|v| match v {
2632 crate::model::ranker::Ranker::Rrf(v) => std::option::Option::Some(v),
2633 _ => std::option::Option::None,
2634 })
2635 }
2636
2637 /// Sets the value of [ranker][crate::model::Ranker::ranker]
2638 /// to hold a `Rrf`.
2639 ///
2640 /// Note that all the setters affecting `ranker` are
2641 /// mutually exclusive.
2642 ///
2643 /// # Example
2644 /// ```ignore,no_run
2645 /// # use google_cloud_vectorsearch_v1::model::Ranker;
2646 /// use google_cloud_vectorsearch_v1::model::ReciprocalRankFusion;
2647 /// let x = Ranker::new().set_rrf(ReciprocalRankFusion::default()/* use setters */);
2648 /// assert!(x.rrf().is_some());
2649 /// ```
2650 pub fn set_rrf<T: std::convert::Into<std::boxed::Box<crate::model::ReciprocalRankFusion>>>(
2651 mut self,
2652 v: T,
2653 ) -> Self {
2654 self.ranker = std::option::Option::Some(crate::model::ranker::Ranker::Rrf(v.into()));
2655 self
2656 }
2657}
2658
2659impl wkt::message::Message for Ranker {
2660 fn typename() -> &'static str {
2661 "type.googleapis.com/google.cloud.vectorsearch.v1.Ranker"
2662 }
2663}
2664
2665/// Defines additional types related to [Ranker].
2666pub mod ranker {
2667 #[allow(unused_imports)]
2668 use super::*;
2669
2670 /// The ranking method to use.
2671 #[derive(Clone, Debug, PartialEq)]
2672 #[non_exhaustive]
2673 pub enum Ranker {
2674 /// Reciprocal Rank Fusion ranking.
2675 Rrf(std::boxed::Box<crate::model::ReciprocalRankFusion>),
2676 }
2677}
2678
2679/// Defines the Reciprocal Rank Fusion (RRF) algorithm for result ranking.
2680#[derive(Clone, Default, PartialEq)]
2681#[non_exhaustive]
2682pub struct ReciprocalRankFusion {
2683 /// Required. The weights to apply to each search result set during fusion.
2684 pub weights: std::vec::Vec<f64>,
2685
2686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2687}
2688
2689impl ReciprocalRankFusion {
2690 pub fn new() -> Self {
2691 std::default::Default::default()
2692 }
2693
2694 /// Sets the value of [weights][crate::model::ReciprocalRankFusion::weights].
2695 ///
2696 /// # Example
2697 /// ```ignore,no_run
2698 /// # use google_cloud_vectorsearch_v1::model::ReciprocalRankFusion;
2699 /// let x = ReciprocalRankFusion::new().set_weights([1.0, 2.0, 3.0]);
2700 /// ```
2701 pub fn set_weights<T, V>(mut self, v: T) -> Self
2702 where
2703 T: std::iter::IntoIterator<Item = V>,
2704 V: std::convert::Into<f64>,
2705 {
2706 use std::iter::Iterator;
2707 self.weights = v.into_iter().map(|i| i.into()).collect();
2708 self
2709 }
2710}
2711
2712impl wkt::message::Message for ReciprocalRankFusion {
2713 fn typename() -> &'static str {
2714 "type.googleapis.com/google.cloud.vectorsearch.v1.ReciprocalRankFusion"
2715 }
2716}
2717
2718/// A response from a batch search operation.
2719#[derive(Clone, Default, PartialEq)]
2720#[non_exhaustive]
2721pub struct BatchSearchDataObjectsResponse {
2722 /// Output only. A list of search responses, one for each request in the batch.
2723 /// If a ranker is used, a single ranked list of results is returned.
2724 pub results: std::vec::Vec<crate::model::SearchDataObjectsResponse>,
2725
2726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2727}
2728
2729impl BatchSearchDataObjectsResponse {
2730 pub fn new() -> Self {
2731 std::default::Default::default()
2732 }
2733
2734 /// Sets the value of [results][crate::model::BatchSearchDataObjectsResponse::results].
2735 ///
2736 /// # Example
2737 /// ```ignore,no_run
2738 /// # use google_cloud_vectorsearch_v1::model::BatchSearchDataObjectsResponse;
2739 /// use google_cloud_vectorsearch_v1::model::SearchDataObjectsResponse;
2740 /// let x = BatchSearchDataObjectsResponse::new()
2741 /// .set_results([
2742 /// SearchDataObjectsResponse::default()/* use setters */,
2743 /// SearchDataObjectsResponse::default()/* use (different) setters */,
2744 /// ]);
2745 /// ```
2746 pub fn set_results<T, V>(mut self, v: T) -> Self
2747 where
2748 T: std::iter::IntoIterator<Item = V>,
2749 V: std::convert::Into<crate::model::SearchDataObjectsResponse>,
2750 {
2751 use std::iter::Iterator;
2752 self.results = v.into_iter().map(|i| i.into()).collect();
2753 self
2754 }
2755}
2756
2757impl wkt::message::Message for BatchSearchDataObjectsResponse {
2758 fn typename() -> &'static str {
2759 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchSearchDataObjectsResponse"
2760 }
2761}
2762
2763/// Request message for
2764/// [DataObjectService.CreateDataObject][google.cloud.vectorsearch.v1.DataObjectService.CreateDataObject].
2765///
2766/// [google.cloud.vectorsearch.v1.DataObjectService.CreateDataObject]: crate::client::DataObjectService::create_data_object
2767#[derive(Clone, Default, PartialEq)]
2768#[non_exhaustive]
2769pub struct CreateDataObjectRequest {
2770 /// Required. The resource name of the Collection to create the DataObject in.
2771 /// Format: `projects/{project}/locations/{location}/collections/{collection}`
2772 pub parent: std::string::String,
2773
2774 /// Required. The id of the dataObject to create.
2775 /// The id must be 1-63 characters long, and comply with
2776 /// [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
2777 /// Specifically, it must be 1-63 characters long and match the regular
2778 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
2779 pub data_object_id: std::string::String,
2780
2781 /// Required. The DataObject to create.
2782 pub data_object: std::option::Option<crate::model::DataObject>,
2783
2784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2785}
2786
2787impl CreateDataObjectRequest {
2788 pub fn new() -> Self {
2789 std::default::Default::default()
2790 }
2791
2792 /// Sets the value of [parent][crate::model::CreateDataObjectRequest::parent].
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_vectorsearch_v1::model::CreateDataObjectRequest;
2797 /// let x = CreateDataObjectRequest::new().set_parent("example");
2798 /// ```
2799 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2800 self.parent = v.into();
2801 self
2802 }
2803
2804 /// Sets the value of [data_object_id][crate::model::CreateDataObjectRequest::data_object_id].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_vectorsearch_v1::model::CreateDataObjectRequest;
2809 /// let x = CreateDataObjectRequest::new().set_data_object_id("example");
2810 /// ```
2811 pub fn set_data_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2812 self.data_object_id = v.into();
2813 self
2814 }
2815
2816 /// Sets the value of [data_object][crate::model::CreateDataObjectRequest::data_object].
2817 ///
2818 /// # Example
2819 /// ```ignore,no_run
2820 /// # use google_cloud_vectorsearch_v1::model::CreateDataObjectRequest;
2821 /// use google_cloud_vectorsearch_v1::model::DataObject;
2822 /// let x = CreateDataObjectRequest::new().set_data_object(DataObject::default()/* use setters */);
2823 /// ```
2824 pub fn set_data_object<T>(mut self, v: T) -> Self
2825 where
2826 T: std::convert::Into<crate::model::DataObject>,
2827 {
2828 self.data_object = std::option::Option::Some(v.into());
2829 self
2830 }
2831
2832 /// Sets or clears the value of [data_object][crate::model::CreateDataObjectRequest::data_object].
2833 ///
2834 /// # Example
2835 /// ```ignore,no_run
2836 /// # use google_cloud_vectorsearch_v1::model::CreateDataObjectRequest;
2837 /// use google_cloud_vectorsearch_v1::model::DataObject;
2838 /// let x = CreateDataObjectRequest::new().set_or_clear_data_object(Some(DataObject::default()/* use setters */));
2839 /// let x = CreateDataObjectRequest::new().set_or_clear_data_object(None::<DataObject>);
2840 /// ```
2841 pub fn set_or_clear_data_object<T>(mut self, v: std::option::Option<T>) -> Self
2842 where
2843 T: std::convert::Into<crate::model::DataObject>,
2844 {
2845 self.data_object = v.map(|x| x.into());
2846 self
2847 }
2848}
2849
2850impl wkt::message::Message for CreateDataObjectRequest {
2851 fn typename() -> &'static str {
2852 "type.googleapis.com/google.cloud.vectorsearch.v1.CreateDataObjectRequest"
2853 }
2854}
2855
2856/// Request message for
2857/// [DataObjectService.BatchCreateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects].
2858///
2859/// [google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects]: crate::client::DataObjectService::batch_create_data_objects
2860#[derive(Clone, Default, PartialEq)]
2861#[non_exhaustive]
2862pub struct BatchCreateDataObjectsRequest {
2863 /// Required. The resource name of the Collection to create the DataObjects in.
2864 /// Format: `projects/{project}/locations/{location}/collections/{collection}`.
2865 /// The parent field in the CreateDataObjectRequest messages must match this
2866 /// field.
2867 pub parent: std::string::String,
2868
2869 /// Required. The request message specifying the resources to create.
2870 /// A maximum of 1000 DataObjects can be created in a batch.
2871 pub requests: std::vec::Vec<crate::model::CreateDataObjectRequest>,
2872
2873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2874}
2875
2876impl BatchCreateDataObjectsRequest {
2877 pub fn new() -> Self {
2878 std::default::Default::default()
2879 }
2880
2881 /// Sets the value of [parent][crate::model::BatchCreateDataObjectsRequest::parent].
2882 ///
2883 /// # Example
2884 /// ```ignore,no_run
2885 /// # use google_cloud_vectorsearch_v1::model::BatchCreateDataObjectsRequest;
2886 /// let x = BatchCreateDataObjectsRequest::new().set_parent("example");
2887 /// ```
2888 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2889 self.parent = v.into();
2890 self
2891 }
2892
2893 /// Sets the value of [requests][crate::model::BatchCreateDataObjectsRequest::requests].
2894 ///
2895 /// # Example
2896 /// ```ignore,no_run
2897 /// # use google_cloud_vectorsearch_v1::model::BatchCreateDataObjectsRequest;
2898 /// use google_cloud_vectorsearch_v1::model::CreateDataObjectRequest;
2899 /// let x = BatchCreateDataObjectsRequest::new()
2900 /// .set_requests([
2901 /// CreateDataObjectRequest::default()/* use setters */,
2902 /// CreateDataObjectRequest::default()/* use (different) setters */,
2903 /// ]);
2904 /// ```
2905 pub fn set_requests<T, V>(mut self, v: T) -> Self
2906 where
2907 T: std::iter::IntoIterator<Item = V>,
2908 V: std::convert::Into<crate::model::CreateDataObjectRequest>,
2909 {
2910 use std::iter::Iterator;
2911 self.requests = v.into_iter().map(|i| i.into()).collect();
2912 self
2913 }
2914}
2915
2916impl wkt::message::Message for BatchCreateDataObjectsRequest {
2917 fn typename() -> &'static str {
2918 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchCreateDataObjectsRequest"
2919 }
2920}
2921
2922/// Response message for
2923/// [DataObjectService.BatchCreateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects].
2924///
2925/// [google.cloud.vectorsearch.v1.DataObjectService.BatchCreateDataObjects]: crate::client::DataObjectService::batch_create_data_objects
2926#[derive(Clone, Default, PartialEq)]
2927#[non_exhaustive]
2928pub struct BatchCreateDataObjectsResponse {
2929 /// Output only. DataObjects created.
2930 pub data_objects: std::vec::Vec<crate::model::DataObject>,
2931
2932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2933}
2934
2935impl BatchCreateDataObjectsResponse {
2936 pub fn new() -> Self {
2937 std::default::Default::default()
2938 }
2939
2940 /// Sets the value of [data_objects][crate::model::BatchCreateDataObjectsResponse::data_objects].
2941 ///
2942 /// # Example
2943 /// ```ignore,no_run
2944 /// # use google_cloud_vectorsearch_v1::model::BatchCreateDataObjectsResponse;
2945 /// use google_cloud_vectorsearch_v1::model::DataObject;
2946 /// let x = BatchCreateDataObjectsResponse::new()
2947 /// .set_data_objects([
2948 /// DataObject::default()/* use setters */,
2949 /// DataObject::default()/* use (different) setters */,
2950 /// ]);
2951 /// ```
2952 pub fn set_data_objects<T, V>(mut self, v: T) -> Self
2953 where
2954 T: std::iter::IntoIterator<Item = V>,
2955 V: std::convert::Into<crate::model::DataObject>,
2956 {
2957 use std::iter::Iterator;
2958 self.data_objects = v.into_iter().map(|i| i.into()).collect();
2959 self
2960 }
2961}
2962
2963impl wkt::message::Message for BatchCreateDataObjectsResponse {
2964 fn typename() -> &'static str {
2965 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchCreateDataObjectsResponse"
2966 }
2967}
2968
2969/// Request message for
2970/// [DataObjectService.GetDataObject][google.cloud.vectorsearch.v1.DataObjectService.GetDataObject].
2971///
2972/// [google.cloud.vectorsearch.v1.DataObjectService.GetDataObject]: crate::client::DataObjectService::get_data_object
2973#[derive(Clone, Default, PartialEq)]
2974#[non_exhaustive]
2975pub struct GetDataObjectRequest {
2976 /// Required. The name of the DataObject resource.
2977 /// Format:
2978 /// `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`
2979 pub name: std::string::String,
2980
2981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2982}
2983
2984impl GetDataObjectRequest {
2985 pub fn new() -> Self {
2986 std::default::Default::default()
2987 }
2988
2989 /// Sets the value of [name][crate::model::GetDataObjectRequest::name].
2990 ///
2991 /// # Example
2992 /// ```ignore,no_run
2993 /// # use google_cloud_vectorsearch_v1::model::GetDataObjectRequest;
2994 /// let x = GetDataObjectRequest::new().set_name("example");
2995 /// ```
2996 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2997 self.name = v.into();
2998 self
2999 }
3000}
3001
3002impl wkt::message::Message for GetDataObjectRequest {
3003 fn typename() -> &'static str {
3004 "type.googleapis.com/google.cloud.vectorsearch.v1.GetDataObjectRequest"
3005 }
3006}
3007
3008/// Request message for
3009/// [DataObjectService.UpdateDataObject][google.cloud.vectorsearch.v1.DataObjectService.UpdateDataObject].
3010///
3011/// [google.cloud.vectorsearch.v1.DataObjectService.UpdateDataObject]: crate::client::DataObjectService::update_data_object
3012#[derive(Clone, Default, PartialEq)]
3013#[non_exhaustive]
3014pub struct UpdateDataObjectRequest {
3015 /// Required. The DataObject which replaces the resource on the server.
3016 pub data_object: std::option::Option<crate::model::DataObject>,
3017
3018 /// Optional. The update mask applies to the resource. See
3019 /// [google.protobuf.FieldMask][google.protobuf.FieldMask].
3020 ///
3021 /// [google.protobuf.FieldMask]: wkt::FieldMask
3022 pub update_mask: std::option::Option<wkt::FieldMask>,
3023
3024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3025}
3026
3027impl UpdateDataObjectRequest {
3028 pub fn new() -> Self {
3029 std::default::Default::default()
3030 }
3031
3032 /// Sets the value of [data_object][crate::model::UpdateDataObjectRequest::data_object].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_vectorsearch_v1::model::UpdateDataObjectRequest;
3037 /// use google_cloud_vectorsearch_v1::model::DataObject;
3038 /// let x = UpdateDataObjectRequest::new().set_data_object(DataObject::default()/* use setters */);
3039 /// ```
3040 pub fn set_data_object<T>(mut self, v: T) -> Self
3041 where
3042 T: std::convert::Into<crate::model::DataObject>,
3043 {
3044 self.data_object = std::option::Option::Some(v.into());
3045 self
3046 }
3047
3048 /// Sets or clears the value of [data_object][crate::model::UpdateDataObjectRequest::data_object].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_vectorsearch_v1::model::UpdateDataObjectRequest;
3053 /// use google_cloud_vectorsearch_v1::model::DataObject;
3054 /// let x = UpdateDataObjectRequest::new().set_or_clear_data_object(Some(DataObject::default()/* use setters */));
3055 /// let x = UpdateDataObjectRequest::new().set_or_clear_data_object(None::<DataObject>);
3056 /// ```
3057 pub fn set_or_clear_data_object<T>(mut self, v: std::option::Option<T>) -> Self
3058 where
3059 T: std::convert::Into<crate::model::DataObject>,
3060 {
3061 self.data_object = v.map(|x| x.into());
3062 self
3063 }
3064
3065 /// Sets the value of [update_mask][crate::model::UpdateDataObjectRequest::update_mask].
3066 ///
3067 /// # Example
3068 /// ```ignore,no_run
3069 /// # use google_cloud_vectorsearch_v1::model::UpdateDataObjectRequest;
3070 /// use wkt::FieldMask;
3071 /// let x = UpdateDataObjectRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3072 /// ```
3073 pub fn set_update_mask<T>(mut self, v: T) -> Self
3074 where
3075 T: std::convert::Into<wkt::FieldMask>,
3076 {
3077 self.update_mask = std::option::Option::Some(v.into());
3078 self
3079 }
3080
3081 /// Sets or clears the value of [update_mask][crate::model::UpdateDataObjectRequest::update_mask].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_vectorsearch_v1::model::UpdateDataObjectRequest;
3086 /// use wkt::FieldMask;
3087 /// let x = UpdateDataObjectRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3088 /// let x = UpdateDataObjectRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3089 /// ```
3090 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3091 where
3092 T: std::convert::Into<wkt::FieldMask>,
3093 {
3094 self.update_mask = v.map(|x| x.into());
3095 self
3096 }
3097}
3098
3099impl wkt::message::Message for UpdateDataObjectRequest {
3100 fn typename() -> &'static str {
3101 "type.googleapis.com/google.cloud.vectorsearch.v1.UpdateDataObjectRequest"
3102 }
3103}
3104
3105/// Request message for
3106/// [DataObjectService.BatchUpdateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects].
3107///
3108/// [google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects]: crate::client::DataObjectService::batch_update_data_objects
3109#[derive(Clone, Default, PartialEq)]
3110#[non_exhaustive]
3111pub struct BatchUpdateDataObjectsRequest {
3112 /// Required. The resource name of the Collection to update the DataObjects in.
3113 /// Format: `projects/{project}/locations/{location}/collections/{collection}`.
3114 /// The parent field in the UpdateDataObjectRequest messages must match this
3115 /// field.
3116 pub parent: std::string::String,
3117
3118 /// Required. The request message specifying the resources to update.
3119 /// A maximum of 1000 DataObjects can be updated in a batch.
3120 pub requests: std::vec::Vec<crate::model::UpdateDataObjectRequest>,
3121
3122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3123}
3124
3125impl BatchUpdateDataObjectsRequest {
3126 pub fn new() -> Self {
3127 std::default::Default::default()
3128 }
3129
3130 /// Sets the value of [parent][crate::model::BatchUpdateDataObjectsRequest::parent].
3131 ///
3132 /// # Example
3133 /// ```ignore,no_run
3134 /// # use google_cloud_vectorsearch_v1::model::BatchUpdateDataObjectsRequest;
3135 /// let x = BatchUpdateDataObjectsRequest::new().set_parent("example");
3136 /// ```
3137 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3138 self.parent = v.into();
3139 self
3140 }
3141
3142 /// Sets the value of [requests][crate::model::BatchUpdateDataObjectsRequest::requests].
3143 ///
3144 /// # Example
3145 /// ```ignore,no_run
3146 /// # use google_cloud_vectorsearch_v1::model::BatchUpdateDataObjectsRequest;
3147 /// use google_cloud_vectorsearch_v1::model::UpdateDataObjectRequest;
3148 /// let x = BatchUpdateDataObjectsRequest::new()
3149 /// .set_requests([
3150 /// UpdateDataObjectRequest::default()/* use setters */,
3151 /// UpdateDataObjectRequest::default()/* use (different) setters */,
3152 /// ]);
3153 /// ```
3154 pub fn set_requests<T, V>(mut self, v: T) -> Self
3155 where
3156 T: std::iter::IntoIterator<Item = V>,
3157 V: std::convert::Into<crate::model::UpdateDataObjectRequest>,
3158 {
3159 use std::iter::Iterator;
3160 self.requests = v.into_iter().map(|i| i.into()).collect();
3161 self
3162 }
3163}
3164
3165impl wkt::message::Message for BatchUpdateDataObjectsRequest {
3166 fn typename() -> &'static str {
3167 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchUpdateDataObjectsRequest"
3168 }
3169}
3170
3171/// Response message for
3172/// [DataObjectService.BatchUpdateDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects].
3173///
3174/// [google.cloud.vectorsearch.v1.DataObjectService.BatchUpdateDataObjects]: crate::client::DataObjectService::batch_update_data_objects
3175#[derive(Clone, Default, PartialEq)]
3176#[non_exhaustive]
3177pub struct BatchUpdateDataObjectsResponse {
3178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3179}
3180
3181impl BatchUpdateDataObjectsResponse {
3182 pub fn new() -> Self {
3183 std::default::Default::default()
3184 }
3185}
3186
3187impl wkt::message::Message for BatchUpdateDataObjectsResponse {
3188 fn typename() -> &'static str {
3189 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchUpdateDataObjectsResponse"
3190 }
3191}
3192
3193/// Request message for
3194/// [DataObjectService.DeleteDataObject][google.cloud.vectorsearch.v1.DataObjectService.DeleteDataObject].
3195///
3196/// [google.cloud.vectorsearch.v1.DataObjectService.DeleteDataObject]: crate::client::DataObjectService::delete_data_object
3197#[derive(Clone, Default, PartialEq)]
3198#[non_exhaustive]
3199pub struct DeleteDataObjectRequest {
3200 /// Required. The name of the DataObject resource to be deleted.
3201 /// Format:
3202 /// `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`
3203 pub name: std::string::String,
3204
3205 /// Optional. The current etag of the DataObject.
3206 /// If an etag is provided and does not match the current etag of the
3207 /// DataObject, deletion will be blocked and an ABORTED error will be returned.
3208 pub etag: std::string::String,
3209
3210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3211}
3212
3213impl DeleteDataObjectRequest {
3214 pub fn new() -> Self {
3215 std::default::Default::default()
3216 }
3217
3218 /// Sets the value of [name][crate::model::DeleteDataObjectRequest::name].
3219 ///
3220 /// # Example
3221 /// ```ignore,no_run
3222 /// # use google_cloud_vectorsearch_v1::model::DeleteDataObjectRequest;
3223 /// let x = DeleteDataObjectRequest::new().set_name("example");
3224 /// ```
3225 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3226 self.name = v.into();
3227 self
3228 }
3229
3230 /// Sets the value of [etag][crate::model::DeleteDataObjectRequest::etag].
3231 ///
3232 /// # Example
3233 /// ```ignore,no_run
3234 /// # use google_cloud_vectorsearch_v1::model::DeleteDataObjectRequest;
3235 /// let x = DeleteDataObjectRequest::new().set_etag("example");
3236 /// ```
3237 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3238 self.etag = v.into();
3239 self
3240 }
3241}
3242
3243impl wkt::message::Message for DeleteDataObjectRequest {
3244 fn typename() -> &'static str {
3245 "type.googleapis.com/google.cloud.vectorsearch.v1.DeleteDataObjectRequest"
3246 }
3247}
3248
3249/// Request message for
3250/// [DataObjectService.BatchDeleteDataObjects][google.cloud.vectorsearch.v1.DataObjectService.BatchDeleteDataObjects].
3251///
3252/// [google.cloud.vectorsearch.v1.DataObjectService.BatchDeleteDataObjects]: crate::client::DataObjectService::batch_delete_data_objects
3253#[derive(Clone, Default, PartialEq)]
3254#[non_exhaustive]
3255pub struct BatchDeleteDataObjectsRequest {
3256 /// Required. The resource name of the Collection to delete the DataObjects in.
3257 /// Format: `projects/{project}/locations/{location}/collections/{collection}`.
3258 pub parent: std::string::String,
3259
3260 /// Required. The request message specifying the resources to delete.
3261 /// A maximum of 1000 DataObjects can be deleted in a batch.
3262 pub requests: std::vec::Vec<crate::model::DeleteDataObjectRequest>,
3263
3264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3265}
3266
3267impl BatchDeleteDataObjectsRequest {
3268 pub fn new() -> Self {
3269 std::default::Default::default()
3270 }
3271
3272 /// Sets the value of [parent][crate::model::BatchDeleteDataObjectsRequest::parent].
3273 ///
3274 /// # Example
3275 /// ```ignore,no_run
3276 /// # use google_cloud_vectorsearch_v1::model::BatchDeleteDataObjectsRequest;
3277 /// let x = BatchDeleteDataObjectsRequest::new().set_parent("example");
3278 /// ```
3279 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3280 self.parent = v.into();
3281 self
3282 }
3283
3284 /// Sets the value of [requests][crate::model::BatchDeleteDataObjectsRequest::requests].
3285 ///
3286 /// # Example
3287 /// ```ignore,no_run
3288 /// # use google_cloud_vectorsearch_v1::model::BatchDeleteDataObjectsRequest;
3289 /// use google_cloud_vectorsearch_v1::model::DeleteDataObjectRequest;
3290 /// let x = BatchDeleteDataObjectsRequest::new()
3291 /// .set_requests([
3292 /// DeleteDataObjectRequest::default()/* use setters */,
3293 /// DeleteDataObjectRequest::default()/* use (different) setters */,
3294 /// ]);
3295 /// ```
3296 pub fn set_requests<T, V>(mut self, v: T) -> Self
3297 where
3298 T: std::iter::IntoIterator<Item = V>,
3299 V: std::convert::Into<crate::model::DeleteDataObjectRequest>,
3300 {
3301 use std::iter::Iterator;
3302 self.requests = v.into_iter().map(|i| i.into()).collect();
3303 self
3304 }
3305}
3306
3307impl wkt::message::Message for BatchDeleteDataObjectsRequest {
3308 fn typename() -> &'static str {
3309 "type.googleapis.com/google.cloud.vectorsearch.v1.BatchDeleteDataObjectsRequest"
3310 }
3311}
3312
3313/// Message describing the configuration for generating embeddings for a vector
3314/// field using Vertex AI embeddings API.
3315#[derive(Clone, Default, PartialEq)]
3316#[non_exhaustive]
3317pub struct VertexEmbeddingConfig {
3318 /// Required. Required: ID of the embedding model to use. See
3319 /// <https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#embeddings-models>
3320 /// for the list of supported models.
3321 pub model_id: std::string::String,
3322
3323 /// Required. Required: Text template for the input to the model. The template
3324 /// must contain one or more references to fields in the DataObject, e.g.:
3325 /// "Movie Title: {title} ---- Movie Plot: {plot}".
3326 pub text_template: std::string::String,
3327
3328 /// Required. Required: Task type for the embeddings.
3329 pub task_type: crate::model::EmbeddingTaskType,
3330
3331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3332}
3333
3334impl VertexEmbeddingConfig {
3335 pub fn new() -> Self {
3336 std::default::Default::default()
3337 }
3338
3339 /// Sets the value of [model_id][crate::model::VertexEmbeddingConfig::model_id].
3340 ///
3341 /// # Example
3342 /// ```ignore,no_run
3343 /// # use google_cloud_vectorsearch_v1::model::VertexEmbeddingConfig;
3344 /// let x = VertexEmbeddingConfig::new().set_model_id("example");
3345 /// ```
3346 pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3347 self.model_id = v.into();
3348 self
3349 }
3350
3351 /// Sets the value of [text_template][crate::model::VertexEmbeddingConfig::text_template].
3352 ///
3353 /// # Example
3354 /// ```ignore,no_run
3355 /// # use google_cloud_vectorsearch_v1::model::VertexEmbeddingConfig;
3356 /// let x = VertexEmbeddingConfig::new().set_text_template("example");
3357 /// ```
3358 pub fn set_text_template<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3359 self.text_template = v.into();
3360 self
3361 }
3362
3363 /// Sets the value of [task_type][crate::model::VertexEmbeddingConfig::task_type].
3364 ///
3365 /// # Example
3366 /// ```ignore,no_run
3367 /// # use google_cloud_vectorsearch_v1::model::VertexEmbeddingConfig;
3368 /// use google_cloud_vectorsearch_v1::model::EmbeddingTaskType;
3369 /// let x0 = VertexEmbeddingConfig::new().set_task_type(EmbeddingTaskType::RetrievalQuery);
3370 /// let x1 = VertexEmbeddingConfig::new().set_task_type(EmbeddingTaskType::RetrievalDocument);
3371 /// let x2 = VertexEmbeddingConfig::new().set_task_type(EmbeddingTaskType::SemanticSimilarity);
3372 /// ```
3373 pub fn set_task_type<T: std::convert::Into<crate::model::EmbeddingTaskType>>(
3374 mut self,
3375 v: T,
3376 ) -> Self {
3377 self.task_type = v.into();
3378 self
3379 }
3380}
3381
3382impl wkt::message::Message for VertexEmbeddingConfig {
3383 fn typename() -> &'static str {
3384 "type.googleapis.com/google.cloud.vectorsearch.v1.VertexEmbeddingConfig"
3385 }
3386}
3387
3388/// Message describing Collection object
3389#[derive(Clone, Default, PartialEq)]
3390#[non_exhaustive]
3391pub struct Collection {
3392 /// Identifier. name of resource
3393 pub name: std::string::String,
3394
3395 /// Optional. User-specified display name of the collection
3396 pub display_name: std::string::String,
3397
3398 /// Optional. User-specified description of the collection
3399 pub description: std::string::String,
3400
3401 /// Output only. [Output only] Create time stamp
3402 pub create_time: std::option::Option<wkt::Timestamp>,
3403
3404 /// Output only. [Output only] Update time stamp
3405 pub update_time: std::option::Option<wkt::Timestamp>,
3406
3407 /// Optional. Labels as key value pairs.
3408 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3409
3410 /// Optional. Schema for vector fields. Only vector fields in this schema will
3411 /// be searchable. Field names must contain only alphanumeric characters,
3412 /// underscores, and hyphens.
3413 pub vector_schema: std::collections::HashMap<std::string::String, crate::model::VectorField>,
3414
3415 /// Optional. JSON Schema for data.
3416 /// Field names must contain only alphanumeric characters,
3417 /// underscores, and hyphens.
3418 pub data_schema: std::option::Option<wkt::Struct>,
3419
3420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3421}
3422
3423impl Collection {
3424 pub fn new() -> Self {
3425 std::default::Default::default()
3426 }
3427
3428 /// Sets the value of [name][crate::model::Collection::name].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_vectorsearch_v1::model::Collection;
3433 /// let x = Collection::new().set_name("example");
3434 /// ```
3435 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3436 self.name = v.into();
3437 self
3438 }
3439
3440 /// Sets the value of [display_name][crate::model::Collection::display_name].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_vectorsearch_v1::model::Collection;
3445 /// let x = Collection::new().set_display_name("example");
3446 /// ```
3447 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3448 self.display_name = v.into();
3449 self
3450 }
3451
3452 /// Sets the value of [description][crate::model::Collection::description].
3453 ///
3454 /// # Example
3455 /// ```ignore,no_run
3456 /// # use google_cloud_vectorsearch_v1::model::Collection;
3457 /// let x = Collection::new().set_description("example");
3458 /// ```
3459 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3460 self.description = v.into();
3461 self
3462 }
3463
3464 /// Sets the value of [create_time][crate::model::Collection::create_time].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_vectorsearch_v1::model::Collection;
3469 /// use wkt::Timestamp;
3470 /// let x = Collection::new().set_create_time(Timestamp::default()/* use setters */);
3471 /// ```
3472 pub fn set_create_time<T>(mut self, v: T) -> Self
3473 where
3474 T: std::convert::Into<wkt::Timestamp>,
3475 {
3476 self.create_time = std::option::Option::Some(v.into());
3477 self
3478 }
3479
3480 /// Sets or clears the value of [create_time][crate::model::Collection::create_time].
3481 ///
3482 /// # Example
3483 /// ```ignore,no_run
3484 /// # use google_cloud_vectorsearch_v1::model::Collection;
3485 /// use wkt::Timestamp;
3486 /// let x = Collection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3487 /// let x = Collection::new().set_or_clear_create_time(None::<Timestamp>);
3488 /// ```
3489 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3490 where
3491 T: std::convert::Into<wkt::Timestamp>,
3492 {
3493 self.create_time = v.map(|x| x.into());
3494 self
3495 }
3496
3497 /// Sets the value of [update_time][crate::model::Collection::update_time].
3498 ///
3499 /// # Example
3500 /// ```ignore,no_run
3501 /// # use google_cloud_vectorsearch_v1::model::Collection;
3502 /// use wkt::Timestamp;
3503 /// let x = Collection::new().set_update_time(Timestamp::default()/* use setters */);
3504 /// ```
3505 pub fn set_update_time<T>(mut self, v: T) -> Self
3506 where
3507 T: std::convert::Into<wkt::Timestamp>,
3508 {
3509 self.update_time = std::option::Option::Some(v.into());
3510 self
3511 }
3512
3513 /// Sets or clears the value of [update_time][crate::model::Collection::update_time].
3514 ///
3515 /// # Example
3516 /// ```ignore,no_run
3517 /// # use google_cloud_vectorsearch_v1::model::Collection;
3518 /// use wkt::Timestamp;
3519 /// let x = Collection::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3520 /// let x = Collection::new().set_or_clear_update_time(None::<Timestamp>);
3521 /// ```
3522 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3523 where
3524 T: std::convert::Into<wkt::Timestamp>,
3525 {
3526 self.update_time = v.map(|x| x.into());
3527 self
3528 }
3529
3530 /// Sets the value of [labels][crate::model::Collection::labels].
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_vectorsearch_v1::model::Collection;
3535 /// let x = Collection::new().set_labels([
3536 /// ("key0", "abc"),
3537 /// ("key1", "xyz"),
3538 /// ]);
3539 /// ```
3540 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3541 where
3542 T: std::iter::IntoIterator<Item = (K, V)>,
3543 K: std::convert::Into<std::string::String>,
3544 V: std::convert::Into<std::string::String>,
3545 {
3546 use std::iter::Iterator;
3547 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3548 self
3549 }
3550
3551 /// Sets the value of [vector_schema][crate::model::Collection::vector_schema].
3552 ///
3553 /// # Example
3554 /// ```ignore,no_run
3555 /// # use google_cloud_vectorsearch_v1::model::Collection;
3556 /// use google_cloud_vectorsearch_v1::model::VectorField;
3557 /// let x = Collection::new().set_vector_schema([
3558 /// ("key0", VectorField::default()/* use setters */),
3559 /// ("key1", VectorField::default()/* use (different) setters */),
3560 /// ]);
3561 /// ```
3562 pub fn set_vector_schema<T, K, V>(mut self, v: T) -> Self
3563 where
3564 T: std::iter::IntoIterator<Item = (K, V)>,
3565 K: std::convert::Into<std::string::String>,
3566 V: std::convert::Into<crate::model::VectorField>,
3567 {
3568 use std::iter::Iterator;
3569 self.vector_schema = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3570 self
3571 }
3572
3573 /// Sets the value of [data_schema][crate::model::Collection::data_schema].
3574 ///
3575 /// # Example
3576 /// ```ignore,no_run
3577 /// # use google_cloud_vectorsearch_v1::model::Collection;
3578 /// use wkt::Struct;
3579 /// let x = Collection::new().set_data_schema(Struct::default()/* use setters */);
3580 /// ```
3581 pub fn set_data_schema<T>(mut self, v: T) -> Self
3582 where
3583 T: std::convert::Into<wkt::Struct>,
3584 {
3585 self.data_schema = std::option::Option::Some(v.into());
3586 self
3587 }
3588
3589 /// Sets or clears the value of [data_schema][crate::model::Collection::data_schema].
3590 ///
3591 /// # Example
3592 /// ```ignore,no_run
3593 /// # use google_cloud_vectorsearch_v1::model::Collection;
3594 /// use wkt::Struct;
3595 /// let x = Collection::new().set_or_clear_data_schema(Some(Struct::default()/* use setters */));
3596 /// let x = Collection::new().set_or_clear_data_schema(None::<Struct>);
3597 /// ```
3598 pub fn set_or_clear_data_schema<T>(mut self, v: std::option::Option<T>) -> Self
3599 where
3600 T: std::convert::Into<wkt::Struct>,
3601 {
3602 self.data_schema = v.map(|x| x.into());
3603 self
3604 }
3605}
3606
3607impl wkt::message::Message for Collection {
3608 fn typename() -> &'static str {
3609 "type.googleapis.com/google.cloud.vectorsearch.v1.Collection"
3610 }
3611}
3612
3613/// Message describing a vector field.
3614#[derive(Clone, Default, PartialEq)]
3615#[non_exhaustive]
3616pub struct VectorField {
3617 /// Vector type configuration.
3618 pub vector_type_config: std::option::Option<crate::model::vector_field::VectorTypeConfig>,
3619
3620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3621}
3622
3623impl VectorField {
3624 pub fn new() -> Self {
3625 std::default::Default::default()
3626 }
3627
3628 /// Sets the value of [vector_type_config][crate::model::VectorField::vector_type_config].
3629 ///
3630 /// Note that all the setters affecting `vector_type_config` are mutually
3631 /// exclusive.
3632 ///
3633 /// # Example
3634 /// ```ignore,no_run
3635 /// # use google_cloud_vectorsearch_v1::model::VectorField;
3636 /// use google_cloud_vectorsearch_v1::model::DenseVectorField;
3637 /// let x = VectorField::new().set_vector_type_config(Some(
3638 /// google_cloud_vectorsearch_v1::model::vector_field::VectorTypeConfig::DenseVector(DenseVectorField::default().into())));
3639 /// ```
3640 pub fn set_vector_type_config<
3641 T: std::convert::Into<std::option::Option<crate::model::vector_field::VectorTypeConfig>>,
3642 >(
3643 mut self,
3644 v: T,
3645 ) -> Self {
3646 self.vector_type_config = v.into();
3647 self
3648 }
3649
3650 /// The value of [vector_type_config][crate::model::VectorField::vector_type_config]
3651 /// if it holds a `DenseVector`, `None` if the field is not set or
3652 /// holds a different branch.
3653 pub fn dense_vector(
3654 &self,
3655 ) -> std::option::Option<&std::boxed::Box<crate::model::DenseVectorField>> {
3656 #[allow(unreachable_patterns)]
3657 self.vector_type_config.as_ref().and_then(|v| match v {
3658 crate::model::vector_field::VectorTypeConfig::DenseVector(v) => {
3659 std::option::Option::Some(v)
3660 }
3661 _ => std::option::Option::None,
3662 })
3663 }
3664
3665 /// Sets the value of [vector_type_config][crate::model::VectorField::vector_type_config]
3666 /// to hold a `DenseVector`.
3667 ///
3668 /// Note that all the setters affecting `vector_type_config` are
3669 /// mutually exclusive.
3670 ///
3671 /// # Example
3672 /// ```ignore,no_run
3673 /// # use google_cloud_vectorsearch_v1::model::VectorField;
3674 /// use google_cloud_vectorsearch_v1::model::DenseVectorField;
3675 /// let x = VectorField::new().set_dense_vector(DenseVectorField::default()/* use setters */);
3676 /// assert!(x.dense_vector().is_some());
3677 /// assert!(x.sparse_vector().is_none());
3678 /// ```
3679 pub fn set_dense_vector<
3680 T: std::convert::Into<std::boxed::Box<crate::model::DenseVectorField>>,
3681 >(
3682 mut self,
3683 v: T,
3684 ) -> Self {
3685 self.vector_type_config = std::option::Option::Some(
3686 crate::model::vector_field::VectorTypeConfig::DenseVector(v.into()),
3687 );
3688 self
3689 }
3690
3691 /// The value of [vector_type_config][crate::model::VectorField::vector_type_config]
3692 /// if it holds a `SparseVector`, `None` if the field is not set or
3693 /// holds a different branch.
3694 pub fn sparse_vector(
3695 &self,
3696 ) -> std::option::Option<&std::boxed::Box<crate::model::SparseVectorField>> {
3697 #[allow(unreachable_patterns)]
3698 self.vector_type_config.as_ref().and_then(|v| match v {
3699 crate::model::vector_field::VectorTypeConfig::SparseVector(v) => {
3700 std::option::Option::Some(v)
3701 }
3702 _ => std::option::Option::None,
3703 })
3704 }
3705
3706 /// Sets the value of [vector_type_config][crate::model::VectorField::vector_type_config]
3707 /// to hold a `SparseVector`.
3708 ///
3709 /// Note that all the setters affecting `vector_type_config` are
3710 /// mutually exclusive.
3711 ///
3712 /// # Example
3713 /// ```ignore,no_run
3714 /// # use google_cloud_vectorsearch_v1::model::VectorField;
3715 /// use google_cloud_vectorsearch_v1::model::SparseVectorField;
3716 /// let x = VectorField::new().set_sparse_vector(SparseVectorField::default()/* use setters */);
3717 /// assert!(x.sparse_vector().is_some());
3718 /// assert!(x.dense_vector().is_none());
3719 /// ```
3720 pub fn set_sparse_vector<
3721 T: std::convert::Into<std::boxed::Box<crate::model::SparseVectorField>>,
3722 >(
3723 mut self,
3724 v: T,
3725 ) -> Self {
3726 self.vector_type_config = std::option::Option::Some(
3727 crate::model::vector_field::VectorTypeConfig::SparseVector(v.into()),
3728 );
3729 self
3730 }
3731}
3732
3733impl wkt::message::Message for VectorField {
3734 fn typename() -> &'static str {
3735 "type.googleapis.com/google.cloud.vectorsearch.v1.VectorField"
3736 }
3737}
3738
3739/// Defines additional types related to [VectorField].
3740pub mod vector_field {
3741 #[allow(unused_imports)]
3742 use super::*;
3743
3744 /// Vector type configuration.
3745 #[derive(Clone, Debug, PartialEq)]
3746 #[non_exhaustive]
3747 pub enum VectorTypeConfig {
3748 /// Dense vector field.
3749 DenseVector(std::boxed::Box<crate::model::DenseVectorField>),
3750 /// Sparse vector field.
3751 SparseVector(std::boxed::Box<crate::model::SparseVectorField>),
3752 }
3753}
3754
3755/// Message describing a dense vector field.
3756#[derive(Clone, Default, PartialEq)]
3757#[non_exhaustive]
3758pub struct DenseVectorField {
3759 /// Dimensionality of the vector field.
3760 pub dimensions: i32,
3761
3762 /// Optional. Configuration for generating embeddings for the vector field. If
3763 /// not specified, the embedding field must be populated in the DataObject.
3764 pub vertex_embedding_config: std::option::Option<crate::model::VertexEmbeddingConfig>,
3765
3766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3767}
3768
3769impl DenseVectorField {
3770 pub fn new() -> Self {
3771 std::default::Default::default()
3772 }
3773
3774 /// Sets the value of [dimensions][crate::model::DenseVectorField::dimensions].
3775 ///
3776 /// # Example
3777 /// ```ignore,no_run
3778 /// # use google_cloud_vectorsearch_v1::model::DenseVectorField;
3779 /// let x = DenseVectorField::new().set_dimensions(42);
3780 /// ```
3781 pub fn set_dimensions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3782 self.dimensions = v.into();
3783 self
3784 }
3785
3786 /// Sets the value of [vertex_embedding_config][crate::model::DenseVectorField::vertex_embedding_config].
3787 ///
3788 /// # Example
3789 /// ```ignore,no_run
3790 /// # use google_cloud_vectorsearch_v1::model::DenseVectorField;
3791 /// use google_cloud_vectorsearch_v1::model::VertexEmbeddingConfig;
3792 /// let x = DenseVectorField::new().set_vertex_embedding_config(VertexEmbeddingConfig::default()/* use setters */);
3793 /// ```
3794 pub fn set_vertex_embedding_config<T>(mut self, v: T) -> Self
3795 where
3796 T: std::convert::Into<crate::model::VertexEmbeddingConfig>,
3797 {
3798 self.vertex_embedding_config = std::option::Option::Some(v.into());
3799 self
3800 }
3801
3802 /// Sets or clears the value of [vertex_embedding_config][crate::model::DenseVectorField::vertex_embedding_config].
3803 ///
3804 /// # Example
3805 /// ```ignore,no_run
3806 /// # use google_cloud_vectorsearch_v1::model::DenseVectorField;
3807 /// use google_cloud_vectorsearch_v1::model::VertexEmbeddingConfig;
3808 /// let x = DenseVectorField::new().set_or_clear_vertex_embedding_config(Some(VertexEmbeddingConfig::default()/* use setters */));
3809 /// let x = DenseVectorField::new().set_or_clear_vertex_embedding_config(None::<VertexEmbeddingConfig>);
3810 /// ```
3811 pub fn set_or_clear_vertex_embedding_config<T>(mut self, v: std::option::Option<T>) -> Self
3812 where
3813 T: std::convert::Into<crate::model::VertexEmbeddingConfig>,
3814 {
3815 self.vertex_embedding_config = v.map(|x| x.into());
3816 self
3817 }
3818}
3819
3820impl wkt::message::Message for DenseVectorField {
3821 fn typename() -> &'static str {
3822 "type.googleapis.com/google.cloud.vectorsearch.v1.DenseVectorField"
3823 }
3824}
3825
3826/// Message describing a sparse vector field.
3827#[derive(Clone, Default, PartialEq)]
3828#[non_exhaustive]
3829pub struct SparseVectorField {
3830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3831}
3832
3833impl SparseVectorField {
3834 pub fn new() -> Self {
3835 std::default::Default::default()
3836 }
3837}
3838
3839impl wkt::message::Message for SparseVectorField {
3840 fn typename() -> &'static str {
3841 "type.googleapis.com/google.cloud.vectorsearch.v1.SparseVectorField"
3842 }
3843}
3844
3845/// Message for requesting list of Collections
3846#[derive(Clone, Default, PartialEq)]
3847#[non_exhaustive]
3848pub struct ListCollectionsRequest {
3849 /// Required. Parent value for ListCollectionsRequest
3850 pub parent: std::string::String,
3851
3852 /// Optional. Requested page size. Server may return fewer items than
3853 /// requested. If unspecified, server will pick an appropriate default.
3854 pub page_size: i32,
3855
3856 /// Optional. A token identifying a page of results the server should return.
3857 pub page_token: std::string::String,
3858
3859 /// Optional. Filtering results
3860 pub filter: std::string::String,
3861
3862 /// Optional. Hint for how to order the results
3863 pub order_by: std::string::String,
3864
3865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3866}
3867
3868impl ListCollectionsRequest {
3869 pub fn new() -> Self {
3870 std::default::Default::default()
3871 }
3872
3873 /// Sets the value of [parent][crate::model::ListCollectionsRequest::parent].
3874 ///
3875 /// # Example
3876 /// ```ignore,no_run
3877 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsRequest;
3878 /// let x = ListCollectionsRequest::new().set_parent("example");
3879 /// ```
3880 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3881 self.parent = v.into();
3882 self
3883 }
3884
3885 /// Sets the value of [page_size][crate::model::ListCollectionsRequest::page_size].
3886 ///
3887 /// # Example
3888 /// ```ignore,no_run
3889 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsRequest;
3890 /// let x = ListCollectionsRequest::new().set_page_size(42);
3891 /// ```
3892 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3893 self.page_size = v.into();
3894 self
3895 }
3896
3897 /// Sets the value of [page_token][crate::model::ListCollectionsRequest::page_token].
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsRequest;
3902 /// let x = ListCollectionsRequest::new().set_page_token("example");
3903 /// ```
3904 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3905 self.page_token = v.into();
3906 self
3907 }
3908
3909 /// Sets the value of [filter][crate::model::ListCollectionsRequest::filter].
3910 ///
3911 /// # Example
3912 /// ```ignore,no_run
3913 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsRequest;
3914 /// let x = ListCollectionsRequest::new().set_filter("example");
3915 /// ```
3916 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3917 self.filter = v.into();
3918 self
3919 }
3920
3921 /// Sets the value of [order_by][crate::model::ListCollectionsRequest::order_by].
3922 ///
3923 /// # Example
3924 /// ```ignore,no_run
3925 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsRequest;
3926 /// let x = ListCollectionsRequest::new().set_order_by("example");
3927 /// ```
3928 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3929 self.order_by = v.into();
3930 self
3931 }
3932}
3933
3934impl wkt::message::Message for ListCollectionsRequest {
3935 fn typename() -> &'static str {
3936 "type.googleapis.com/google.cloud.vectorsearch.v1.ListCollectionsRequest"
3937 }
3938}
3939
3940/// Message for response to listing Collections
3941#[derive(Clone, Default, PartialEq)]
3942#[non_exhaustive]
3943pub struct ListCollectionsResponse {
3944 /// The list of Collection
3945 pub collections: std::vec::Vec<crate::model::Collection>,
3946
3947 /// A token identifying a page of results the server should return.
3948 pub next_page_token: std::string::String,
3949
3950 /// Unordered list. Locations that could not be reached.
3951 pub unreachable: std::vec::Vec<std::string::String>,
3952
3953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3954}
3955
3956impl ListCollectionsResponse {
3957 pub fn new() -> Self {
3958 std::default::Default::default()
3959 }
3960
3961 /// Sets the value of [collections][crate::model::ListCollectionsResponse::collections].
3962 ///
3963 /// # Example
3964 /// ```ignore,no_run
3965 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsResponse;
3966 /// use google_cloud_vectorsearch_v1::model::Collection;
3967 /// let x = ListCollectionsResponse::new()
3968 /// .set_collections([
3969 /// Collection::default()/* use setters */,
3970 /// Collection::default()/* use (different) setters */,
3971 /// ]);
3972 /// ```
3973 pub fn set_collections<T, V>(mut self, v: T) -> Self
3974 where
3975 T: std::iter::IntoIterator<Item = V>,
3976 V: std::convert::Into<crate::model::Collection>,
3977 {
3978 use std::iter::Iterator;
3979 self.collections = v.into_iter().map(|i| i.into()).collect();
3980 self
3981 }
3982
3983 /// Sets the value of [next_page_token][crate::model::ListCollectionsResponse::next_page_token].
3984 ///
3985 /// # Example
3986 /// ```ignore,no_run
3987 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsResponse;
3988 /// let x = ListCollectionsResponse::new().set_next_page_token("example");
3989 /// ```
3990 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3991 self.next_page_token = v.into();
3992 self
3993 }
3994
3995 /// Sets the value of [unreachable][crate::model::ListCollectionsResponse::unreachable].
3996 ///
3997 /// # Example
3998 /// ```ignore,no_run
3999 /// # use google_cloud_vectorsearch_v1::model::ListCollectionsResponse;
4000 /// let x = ListCollectionsResponse::new().set_unreachable(["a", "b", "c"]);
4001 /// ```
4002 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4003 where
4004 T: std::iter::IntoIterator<Item = V>,
4005 V: std::convert::Into<std::string::String>,
4006 {
4007 use std::iter::Iterator;
4008 self.unreachable = v.into_iter().map(|i| i.into()).collect();
4009 self
4010 }
4011}
4012
4013impl wkt::message::Message for ListCollectionsResponse {
4014 fn typename() -> &'static str {
4015 "type.googleapis.com/google.cloud.vectorsearch.v1.ListCollectionsResponse"
4016 }
4017}
4018
4019#[doc(hidden)]
4020impl google_cloud_gax::paginator::internal::PageableResponse for ListCollectionsResponse {
4021 type PageItem = crate::model::Collection;
4022
4023 fn items(self) -> std::vec::Vec<Self::PageItem> {
4024 self.collections
4025 }
4026
4027 fn next_page_token(&self) -> std::string::String {
4028 use std::clone::Clone;
4029 self.next_page_token.clone()
4030 }
4031}
4032
4033/// Message for getting a Collection
4034#[derive(Clone, Default, PartialEq)]
4035#[non_exhaustive]
4036pub struct GetCollectionRequest {
4037 /// Required. Name of the resource
4038 pub name: std::string::String,
4039
4040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4041}
4042
4043impl GetCollectionRequest {
4044 pub fn new() -> Self {
4045 std::default::Default::default()
4046 }
4047
4048 /// Sets the value of [name][crate::model::GetCollectionRequest::name].
4049 ///
4050 /// # Example
4051 /// ```ignore,no_run
4052 /// # use google_cloud_vectorsearch_v1::model::GetCollectionRequest;
4053 /// let x = GetCollectionRequest::new().set_name("example");
4054 /// ```
4055 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4056 self.name = v.into();
4057 self
4058 }
4059}
4060
4061impl wkt::message::Message for GetCollectionRequest {
4062 fn typename() -> &'static str {
4063 "type.googleapis.com/google.cloud.vectorsearch.v1.GetCollectionRequest"
4064 }
4065}
4066
4067/// Message for creating a Collection
4068#[derive(Clone, Default, PartialEq)]
4069#[non_exhaustive]
4070pub struct CreateCollectionRequest {
4071 /// Required. Value for parent.
4072 pub parent: std::string::String,
4073
4074 /// Required. ID of the Collection to create.
4075 /// The id must be 1-63 characters long, and comply with
4076 /// [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
4077 /// Specifically, it must be 1-63 characters long and match the regular
4078 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
4079 pub collection_id: std::string::String,
4080
4081 /// Required. The resource being created
4082 pub collection: std::option::Option<crate::model::Collection>,
4083
4084 /// Optional. An optional request ID to identify requests. Specify a unique
4085 /// request ID so that if you must retry your request, the server will know to
4086 /// ignore the request if it has already been completed. The server will
4087 /// guarantee that for at least 60 minutes since the first request.
4088 ///
4089 /// For example, consider a situation where you make an initial request and the
4090 /// request times out. If you make the request again with the same request
4091 /// ID, the server can check if original operation with the same request ID
4092 /// was received, and if so, will ignore the second request. This prevents
4093 /// clients from accidentally creating duplicate commitments.
4094 ///
4095 /// The request ID must be a valid UUID with the exception that zero UUID is
4096 /// not supported (00000000-0000-0000-0000-000000000000).
4097 pub request_id: std::string::String,
4098
4099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4100}
4101
4102impl CreateCollectionRequest {
4103 pub fn new() -> Self {
4104 std::default::Default::default()
4105 }
4106
4107 /// Sets the value of [parent][crate::model::CreateCollectionRequest::parent].
4108 ///
4109 /// # Example
4110 /// ```ignore,no_run
4111 /// # use google_cloud_vectorsearch_v1::model::CreateCollectionRequest;
4112 /// let x = CreateCollectionRequest::new().set_parent("example");
4113 /// ```
4114 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4115 self.parent = v.into();
4116 self
4117 }
4118
4119 /// Sets the value of [collection_id][crate::model::CreateCollectionRequest::collection_id].
4120 ///
4121 /// # Example
4122 /// ```ignore,no_run
4123 /// # use google_cloud_vectorsearch_v1::model::CreateCollectionRequest;
4124 /// let x = CreateCollectionRequest::new().set_collection_id("example");
4125 /// ```
4126 pub fn set_collection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4127 self.collection_id = v.into();
4128 self
4129 }
4130
4131 /// Sets the value of [collection][crate::model::CreateCollectionRequest::collection].
4132 ///
4133 /// # Example
4134 /// ```ignore,no_run
4135 /// # use google_cloud_vectorsearch_v1::model::CreateCollectionRequest;
4136 /// use google_cloud_vectorsearch_v1::model::Collection;
4137 /// let x = CreateCollectionRequest::new().set_collection(Collection::default()/* use setters */);
4138 /// ```
4139 pub fn set_collection<T>(mut self, v: T) -> Self
4140 where
4141 T: std::convert::Into<crate::model::Collection>,
4142 {
4143 self.collection = std::option::Option::Some(v.into());
4144 self
4145 }
4146
4147 /// Sets or clears the value of [collection][crate::model::CreateCollectionRequest::collection].
4148 ///
4149 /// # Example
4150 /// ```ignore,no_run
4151 /// # use google_cloud_vectorsearch_v1::model::CreateCollectionRequest;
4152 /// use google_cloud_vectorsearch_v1::model::Collection;
4153 /// let x = CreateCollectionRequest::new().set_or_clear_collection(Some(Collection::default()/* use setters */));
4154 /// let x = CreateCollectionRequest::new().set_or_clear_collection(None::<Collection>);
4155 /// ```
4156 pub fn set_or_clear_collection<T>(mut self, v: std::option::Option<T>) -> Self
4157 where
4158 T: std::convert::Into<crate::model::Collection>,
4159 {
4160 self.collection = v.map(|x| x.into());
4161 self
4162 }
4163
4164 /// Sets the value of [request_id][crate::model::CreateCollectionRequest::request_id].
4165 ///
4166 /// # Example
4167 /// ```ignore,no_run
4168 /// # use google_cloud_vectorsearch_v1::model::CreateCollectionRequest;
4169 /// let x = CreateCollectionRequest::new().set_request_id("example");
4170 /// ```
4171 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4172 self.request_id = v.into();
4173 self
4174 }
4175}
4176
4177impl wkt::message::Message for CreateCollectionRequest {
4178 fn typename() -> &'static str {
4179 "type.googleapis.com/google.cloud.vectorsearch.v1.CreateCollectionRequest"
4180 }
4181}
4182
4183/// Message for updating a Collection
4184#[derive(Clone, Default, PartialEq)]
4185#[non_exhaustive]
4186pub struct UpdateCollectionRequest {
4187 /// Optional. Field mask is used to specify the fields to be overwritten in the
4188 /// Collection resource by the update.
4189 /// The fields specified in the update_mask are relative to the resource, not
4190 /// the full request. A field will be overwritten if it is in the mask. If the
4191 /// user does not provide a mask then all fields present in the request will be
4192 /// overwritten.
4193 ///
4194 /// The following fields support update: `display_name`, `description`,
4195 /// `labels`, `data_schema`, `vector_schema`.
4196 /// For `data_schema` and `vector_schema`, fields can only be added, not
4197 /// deleted, but `vertex_embedding_config` in `vector_schema` can be added or
4198 /// removed.
4199 /// Partial updates for `data_schema` and `vector_schema` are also supported
4200 /// by using sub-field paths in `update_mask`, e.g.
4201 /// `data_schema.properties.foo` or `vector_schema.my_vector_field`.
4202 ///
4203 /// If `*` is provided in the update_mask, full replacement will be performed.
4204 pub update_mask: std::option::Option<wkt::FieldMask>,
4205
4206 /// Required. The resource being updated
4207 pub collection: std::option::Option<crate::model::Collection>,
4208
4209 /// Optional. An optional request ID to identify requests. Specify a unique
4210 /// request ID so that if you must retry your request, the server will know to
4211 /// ignore the request if it has already been completed. The server will
4212 /// guarantee that for at least 60 minutes since the first request.
4213 ///
4214 /// For example, consider a situation where you make an initial request and the
4215 /// request times out. If you make the request again with the same request
4216 /// ID, the server can check if original operation with the same request ID
4217 /// was received, and if so, will ignore the second request. This prevents
4218 /// clients from accidentally creating duplicate commitments.
4219 ///
4220 /// The request ID must be a valid UUID with the exception that zero UUID is
4221 /// not supported (00000000-0000-0000-0000-000000000000).
4222 pub request_id: std::string::String,
4223
4224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4225}
4226
4227impl UpdateCollectionRequest {
4228 pub fn new() -> Self {
4229 std::default::Default::default()
4230 }
4231
4232 /// Sets the value of [update_mask][crate::model::UpdateCollectionRequest::update_mask].
4233 ///
4234 /// # Example
4235 /// ```ignore,no_run
4236 /// # use google_cloud_vectorsearch_v1::model::UpdateCollectionRequest;
4237 /// use wkt::FieldMask;
4238 /// let x = UpdateCollectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4239 /// ```
4240 pub fn set_update_mask<T>(mut self, v: T) -> Self
4241 where
4242 T: std::convert::Into<wkt::FieldMask>,
4243 {
4244 self.update_mask = std::option::Option::Some(v.into());
4245 self
4246 }
4247
4248 /// Sets or clears the value of [update_mask][crate::model::UpdateCollectionRequest::update_mask].
4249 ///
4250 /// # Example
4251 /// ```ignore,no_run
4252 /// # use google_cloud_vectorsearch_v1::model::UpdateCollectionRequest;
4253 /// use wkt::FieldMask;
4254 /// let x = UpdateCollectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4255 /// let x = UpdateCollectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4256 /// ```
4257 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4258 where
4259 T: std::convert::Into<wkt::FieldMask>,
4260 {
4261 self.update_mask = v.map(|x| x.into());
4262 self
4263 }
4264
4265 /// Sets the value of [collection][crate::model::UpdateCollectionRequest::collection].
4266 ///
4267 /// # Example
4268 /// ```ignore,no_run
4269 /// # use google_cloud_vectorsearch_v1::model::UpdateCollectionRequest;
4270 /// use google_cloud_vectorsearch_v1::model::Collection;
4271 /// let x = UpdateCollectionRequest::new().set_collection(Collection::default()/* use setters */);
4272 /// ```
4273 pub fn set_collection<T>(mut self, v: T) -> Self
4274 where
4275 T: std::convert::Into<crate::model::Collection>,
4276 {
4277 self.collection = std::option::Option::Some(v.into());
4278 self
4279 }
4280
4281 /// Sets or clears the value of [collection][crate::model::UpdateCollectionRequest::collection].
4282 ///
4283 /// # Example
4284 /// ```ignore,no_run
4285 /// # use google_cloud_vectorsearch_v1::model::UpdateCollectionRequest;
4286 /// use google_cloud_vectorsearch_v1::model::Collection;
4287 /// let x = UpdateCollectionRequest::new().set_or_clear_collection(Some(Collection::default()/* use setters */));
4288 /// let x = UpdateCollectionRequest::new().set_or_clear_collection(None::<Collection>);
4289 /// ```
4290 pub fn set_or_clear_collection<T>(mut self, v: std::option::Option<T>) -> Self
4291 where
4292 T: std::convert::Into<crate::model::Collection>,
4293 {
4294 self.collection = v.map(|x| x.into());
4295 self
4296 }
4297
4298 /// Sets the value of [request_id][crate::model::UpdateCollectionRequest::request_id].
4299 ///
4300 /// # Example
4301 /// ```ignore,no_run
4302 /// # use google_cloud_vectorsearch_v1::model::UpdateCollectionRequest;
4303 /// let x = UpdateCollectionRequest::new().set_request_id("example");
4304 /// ```
4305 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4306 self.request_id = v.into();
4307 self
4308 }
4309}
4310
4311impl wkt::message::Message for UpdateCollectionRequest {
4312 fn typename() -> &'static str {
4313 "type.googleapis.com/google.cloud.vectorsearch.v1.UpdateCollectionRequest"
4314 }
4315}
4316
4317/// Message for deleting a Collection
4318#[derive(Clone, Default, PartialEq)]
4319#[non_exhaustive]
4320pub struct DeleteCollectionRequest {
4321 /// Required. Name of the resource
4322 pub name: std::string::String,
4323
4324 /// Optional. An optional request ID to identify requests. Specify a unique
4325 /// request ID so that if you must retry your request, the server will know to
4326 /// ignore the request if it has already been completed. The server will
4327 /// guarantee that for at least 60 minutes after the first request.
4328 ///
4329 /// For example, consider a situation where you make an initial request and the
4330 /// request times out. If you make the request again with the same request
4331 /// ID, the server can check if original operation with the same request ID
4332 /// was received, and if so, will ignore the second request. This prevents
4333 /// clients from accidentally creating duplicate commitments.
4334 ///
4335 /// The request ID must be a valid UUID with the exception that zero UUID is
4336 /// not supported (00000000-0000-0000-0000-000000000000).
4337 pub request_id: std::string::String,
4338
4339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4340}
4341
4342impl DeleteCollectionRequest {
4343 pub fn new() -> Self {
4344 std::default::Default::default()
4345 }
4346
4347 /// Sets the value of [name][crate::model::DeleteCollectionRequest::name].
4348 ///
4349 /// # Example
4350 /// ```ignore,no_run
4351 /// # use google_cloud_vectorsearch_v1::model::DeleteCollectionRequest;
4352 /// let x = DeleteCollectionRequest::new().set_name("example");
4353 /// ```
4354 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4355 self.name = v.into();
4356 self
4357 }
4358
4359 /// Sets the value of [request_id][crate::model::DeleteCollectionRequest::request_id].
4360 ///
4361 /// # Example
4362 /// ```ignore,no_run
4363 /// # use google_cloud_vectorsearch_v1::model::DeleteCollectionRequest;
4364 /// let x = DeleteCollectionRequest::new().set_request_id("example");
4365 /// ```
4366 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4367 self.request_id = v.into();
4368 self
4369 }
4370}
4371
4372impl wkt::message::Message for DeleteCollectionRequest {
4373 fn typename() -> &'static str {
4374 "type.googleapis.com/google.cloud.vectorsearch.v1.DeleteCollectionRequest"
4375 }
4376}
4377
4378/// Message describing Index object
4379#[derive(Clone, Default, PartialEq)]
4380#[non_exhaustive]
4381pub struct Index {
4382 /// Identifier. name of resource
4383 pub name: std::string::String,
4384
4385 /// Optional. User-specified display name of the index
4386 pub display_name: std::string::String,
4387
4388 /// Optional. User-specified description of the index
4389 pub description: std::string::String,
4390
4391 /// Optional. Labels as key value pairs.
4392 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4393
4394 /// Output only. [Output only] Create time stamp
4395 pub create_time: std::option::Option<wkt::Timestamp>,
4396
4397 /// Output only. [Output only] Update time stamp
4398 pub update_time: std::option::Option<wkt::Timestamp>,
4399
4400 /// Optional. Distance metric used for indexing. If not specified, will default
4401 /// to DOT_PRODUCT.
4402 pub distance_metric: crate::model::DistanceMetric,
4403
4404 /// Required. The collection schema field to index.
4405 pub index_field: std::string::String,
4406
4407 /// Optional. The fields to push into the index to enable fast ANN inline
4408 /// filtering.
4409 pub filter_fields: std::vec::Vec<std::string::String>,
4410
4411 /// Optional. The fields to push into the index to enable inline data
4412 /// retrieval.
4413 pub store_fields: std::vec::Vec<std::string::String>,
4414
4415 /// The infrastructure type of the index.
4416 pub infra_type: std::option::Option<crate::model::index::InfraType>,
4417
4418 /// The type of the index.
4419 pub index_type: std::option::Option<crate::model::index::IndexType>,
4420
4421 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4422}
4423
4424impl Index {
4425 pub fn new() -> Self {
4426 std::default::Default::default()
4427 }
4428
4429 /// Sets the value of [name][crate::model::Index::name].
4430 ///
4431 /// # Example
4432 /// ```ignore,no_run
4433 /// # use google_cloud_vectorsearch_v1::model::Index;
4434 /// let x = Index::new().set_name("example");
4435 /// ```
4436 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4437 self.name = v.into();
4438 self
4439 }
4440
4441 /// Sets the value of [display_name][crate::model::Index::display_name].
4442 ///
4443 /// # Example
4444 /// ```ignore,no_run
4445 /// # use google_cloud_vectorsearch_v1::model::Index;
4446 /// let x = Index::new().set_display_name("example");
4447 /// ```
4448 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4449 self.display_name = v.into();
4450 self
4451 }
4452
4453 /// Sets the value of [description][crate::model::Index::description].
4454 ///
4455 /// # Example
4456 /// ```ignore,no_run
4457 /// # use google_cloud_vectorsearch_v1::model::Index;
4458 /// let x = Index::new().set_description("example");
4459 /// ```
4460 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4461 self.description = v.into();
4462 self
4463 }
4464
4465 /// Sets the value of [labels][crate::model::Index::labels].
4466 ///
4467 /// # Example
4468 /// ```ignore,no_run
4469 /// # use google_cloud_vectorsearch_v1::model::Index;
4470 /// let x = Index::new().set_labels([
4471 /// ("key0", "abc"),
4472 /// ("key1", "xyz"),
4473 /// ]);
4474 /// ```
4475 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4476 where
4477 T: std::iter::IntoIterator<Item = (K, V)>,
4478 K: std::convert::Into<std::string::String>,
4479 V: std::convert::Into<std::string::String>,
4480 {
4481 use std::iter::Iterator;
4482 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4483 self
4484 }
4485
4486 /// Sets the value of [create_time][crate::model::Index::create_time].
4487 ///
4488 /// # Example
4489 /// ```ignore,no_run
4490 /// # use google_cloud_vectorsearch_v1::model::Index;
4491 /// use wkt::Timestamp;
4492 /// let x = Index::new().set_create_time(Timestamp::default()/* use setters */);
4493 /// ```
4494 pub fn set_create_time<T>(mut self, v: T) -> Self
4495 where
4496 T: std::convert::Into<wkt::Timestamp>,
4497 {
4498 self.create_time = std::option::Option::Some(v.into());
4499 self
4500 }
4501
4502 /// Sets or clears the value of [create_time][crate::model::Index::create_time].
4503 ///
4504 /// # Example
4505 /// ```ignore,no_run
4506 /// # use google_cloud_vectorsearch_v1::model::Index;
4507 /// use wkt::Timestamp;
4508 /// let x = Index::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4509 /// let x = Index::new().set_or_clear_create_time(None::<Timestamp>);
4510 /// ```
4511 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4512 where
4513 T: std::convert::Into<wkt::Timestamp>,
4514 {
4515 self.create_time = v.map(|x| x.into());
4516 self
4517 }
4518
4519 /// Sets the value of [update_time][crate::model::Index::update_time].
4520 ///
4521 /// # Example
4522 /// ```ignore,no_run
4523 /// # use google_cloud_vectorsearch_v1::model::Index;
4524 /// use wkt::Timestamp;
4525 /// let x = Index::new().set_update_time(Timestamp::default()/* use setters */);
4526 /// ```
4527 pub fn set_update_time<T>(mut self, v: T) -> Self
4528 where
4529 T: std::convert::Into<wkt::Timestamp>,
4530 {
4531 self.update_time = std::option::Option::Some(v.into());
4532 self
4533 }
4534
4535 /// Sets or clears the value of [update_time][crate::model::Index::update_time].
4536 ///
4537 /// # Example
4538 /// ```ignore,no_run
4539 /// # use google_cloud_vectorsearch_v1::model::Index;
4540 /// use wkt::Timestamp;
4541 /// let x = Index::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4542 /// let x = Index::new().set_or_clear_update_time(None::<Timestamp>);
4543 /// ```
4544 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4545 where
4546 T: std::convert::Into<wkt::Timestamp>,
4547 {
4548 self.update_time = v.map(|x| x.into());
4549 self
4550 }
4551
4552 /// Sets the value of [distance_metric][crate::model::Index::distance_metric].
4553 ///
4554 /// # Example
4555 /// ```ignore,no_run
4556 /// # use google_cloud_vectorsearch_v1::model::Index;
4557 /// use google_cloud_vectorsearch_v1::model::DistanceMetric;
4558 /// let x0 = Index::new().set_distance_metric(DistanceMetric::DotProduct);
4559 /// let x1 = Index::new().set_distance_metric(DistanceMetric::CosineDistance);
4560 /// ```
4561 pub fn set_distance_metric<T: std::convert::Into<crate::model::DistanceMetric>>(
4562 mut self,
4563 v: T,
4564 ) -> Self {
4565 self.distance_metric = v.into();
4566 self
4567 }
4568
4569 /// Sets the value of [index_field][crate::model::Index::index_field].
4570 ///
4571 /// # Example
4572 /// ```ignore,no_run
4573 /// # use google_cloud_vectorsearch_v1::model::Index;
4574 /// let x = Index::new().set_index_field("example");
4575 /// ```
4576 pub fn set_index_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4577 self.index_field = v.into();
4578 self
4579 }
4580
4581 /// Sets the value of [filter_fields][crate::model::Index::filter_fields].
4582 ///
4583 /// # Example
4584 /// ```ignore,no_run
4585 /// # use google_cloud_vectorsearch_v1::model::Index;
4586 /// let x = Index::new().set_filter_fields(["a", "b", "c"]);
4587 /// ```
4588 pub fn set_filter_fields<T, V>(mut self, v: T) -> Self
4589 where
4590 T: std::iter::IntoIterator<Item = V>,
4591 V: std::convert::Into<std::string::String>,
4592 {
4593 use std::iter::Iterator;
4594 self.filter_fields = v.into_iter().map(|i| i.into()).collect();
4595 self
4596 }
4597
4598 /// Sets the value of [store_fields][crate::model::Index::store_fields].
4599 ///
4600 /// # Example
4601 /// ```ignore,no_run
4602 /// # use google_cloud_vectorsearch_v1::model::Index;
4603 /// let x = Index::new().set_store_fields(["a", "b", "c"]);
4604 /// ```
4605 pub fn set_store_fields<T, V>(mut self, v: T) -> Self
4606 where
4607 T: std::iter::IntoIterator<Item = V>,
4608 V: std::convert::Into<std::string::String>,
4609 {
4610 use std::iter::Iterator;
4611 self.store_fields = v.into_iter().map(|i| i.into()).collect();
4612 self
4613 }
4614
4615 /// Sets the value of [infra_type][crate::model::Index::infra_type].
4616 ///
4617 /// Note that all the setters affecting `infra_type` are mutually
4618 /// exclusive.
4619 ///
4620 /// # Example
4621 /// ```ignore,no_run
4622 /// # use google_cloud_vectorsearch_v1::model::Index;
4623 /// use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
4624 /// let x = Index::new().set_infra_type(Some(
4625 /// google_cloud_vectorsearch_v1::model::index::InfraType::DedicatedInfrastructure(DedicatedInfrastructure::default().into())));
4626 /// ```
4627 pub fn set_infra_type<
4628 T: std::convert::Into<std::option::Option<crate::model::index::InfraType>>,
4629 >(
4630 mut self,
4631 v: T,
4632 ) -> Self {
4633 self.infra_type = v.into();
4634 self
4635 }
4636
4637 /// The value of [infra_type][crate::model::Index::infra_type]
4638 /// if it holds a `DedicatedInfrastructure`, `None` if the field is not set or
4639 /// holds a different branch.
4640 pub fn dedicated_infrastructure(
4641 &self,
4642 ) -> std::option::Option<&std::boxed::Box<crate::model::DedicatedInfrastructure>> {
4643 #[allow(unreachable_patterns)]
4644 self.infra_type.as_ref().and_then(|v| match v {
4645 crate::model::index::InfraType::DedicatedInfrastructure(v) => {
4646 std::option::Option::Some(v)
4647 }
4648 _ => std::option::Option::None,
4649 })
4650 }
4651
4652 /// Sets the value of [infra_type][crate::model::Index::infra_type]
4653 /// to hold a `DedicatedInfrastructure`.
4654 ///
4655 /// Note that all the setters affecting `infra_type` are
4656 /// mutually exclusive.
4657 ///
4658 /// # Example
4659 /// ```ignore,no_run
4660 /// # use google_cloud_vectorsearch_v1::model::Index;
4661 /// use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
4662 /// let x = Index::new().set_dedicated_infrastructure(DedicatedInfrastructure::default()/* use setters */);
4663 /// assert!(x.dedicated_infrastructure().is_some());
4664 /// ```
4665 pub fn set_dedicated_infrastructure<
4666 T: std::convert::Into<std::boxed::Box<crate::model::DedicatedInfrastructure>>,
4667 >(
4668 mut self,
4669 v: T,
4670 ) -> Self {
4671 self.infra_type = std::option::Option::Some(
4672 crate::model::index::InfraType::DedicatedInfrastructure(v.into()),
4673 );
4674 self
4675 }
4676
4677 /// Sets the value of [index_type][crate::model::Index::index_type].
4678 ///
4679 /// Note that all the setters affecting `index_type` are mutually
4680 /// exclusive.
4681 ///
4682 /// # Example
4683 /// ```ignore,no_run
4684 /// # use google_cloud_vectorsearch_v1::model::Index;
4685 /// use google_cloud_vectorsearch_v1::model::DenseScannIndex;
4686 /// let x = Index::new().set_index_type(Some(
4687 /// google_cloud_vectorsearch_v1::model::index::IndexType::DenseScann(DenseScannIndex::default().into())));
4688 /// ```
4689 pub fn set_index_type<
4690 T: std::convert::Into<std::option::Option<crate::model::index::IndexType>>,
4691 >(
4692 mut self,
4693 v: T,
4694 ) -> Self {
4695 self.index_type = v.into();
4696 self
4697 }
4698
4699 /// The value of [index_type][crate::model::Index::index_type]
4700 /// if it holds a `DenseScann`, `None` if the field is not set or
4701 /// holds a different branch.
4702 pub fn dense_scann(
4703 &self,
4704 ) -> std::option::Option<&std::boxed::Box<crate::model::DenseScannIndex>> {
4705 #[allow(unreachable_patterns)]
4706 self.index_type.as_ref().and_then(|v| match v {
4707 crate::model::index::IndexType::DenseScann(v) => std::option::Option::Some(v),
4708 _ => std::option::Option::None,
4709 })
4710 }
4711
4712 /// Sets the value of [index_type][crate::model::Index::index_type]
4713 /// to hold a `DenseScann`.
4714 ///
4715 /// Note that all the setters affecting `index_type` are
4716 /// mutually exclusive.
4717 ///
4718 /// # Example
4719 /// ```ignore,no_run
4720 /// # use google_cloud_vectorsearch_v1::model::Index;
4721 /// use google_cloud_vectorsearch_v1::model::DenseScannIndex;
4722 /// let x = Index::new().set_dense_scann(DenseScannIndex::default()/* use setters */);
4723 /// assert!(x.dense_scann().is_some());
4724 /// ```
4725 pub fn set_dense_scann<
4726 T: std::convert::Into<std::boxed::Box<crate::model::DenseScannIndex>>,
4727 >(
4728 mut self,
4729 v: T,
4730 ) -> Self {
4731 self.index_type =
4732 std::option::Option::Some(crate::model::index::IndexType::DenseScann(v.into()));
4733 self
4734 }
4735}
4736
4737impl wkt::message::Message for Index {
4738 fn typename() -> &'static str {
4739 "type.googleapis.com/google.cloud.vectorsearch.v1.Index"
4740 }
4741}
4742
4743/// Defines additional types related to [Index].
4744pub mod index {
4745 #[allow(unused_imports)]
4746 use super::*;
4747
4748 /// The infrastructure type of the index.
4749 #[derive(Clone, Debug, PartialEq)]
4750 #[non_exhaustive]
4751 pub enum InfraType {
4752 /// Optional. Dedicated infrastructure for the index.
4753 DedicatedInfrastructure(std::boxed::Box<crate::model::DedicatedInfrastructure>),
4754 }
4755
4756 /// The type of the index.
4757 #[derive(Clone, Debug, PartialEq)]
4758 #[non_exhaustive]
4759 pub enum IndexType {
4760 /// Optional. Dense ScaNN index.
4761 DenseScann(std::boxed::Box<crate::model::DenseScannIndex>),
4762 }
4763}
4764
4765/// Message for creating an Index.
4766#[derive(Clone, Default, PartialEq)]
4767#[non_exhaustive]
4768pub struct CreateIndexRequest {
4769 /// Required. The resource name of the Collection for which to create the
4770 /// Index. Format:
4771 /// `projects/{project}/locations/{location}/collections/{collection}`
4772 pub parent: std::string::String,
4773
4774 /// Required. ID of the Index to create.
4775 /// The id must be 1-63 characters long, and comply with
4776 /// [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
4777 /// Specifically, it must be 1-63 characters long and match the regular
4778 /// expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.
4779 pub index_id: std::string::String,
4780
4781 /// Required. The resource being created
4782 pub index: std::option::Option<crate::model::Index>,
4783
4784 /// Optional. An optional request ID to identify requests. Specify a unique
4785 /// request ID so that if you must retry your request, the server will know to
4786 /// ignore the request if it has already been completed. The server will
4787 /// guarantee that for at least 60 minutes since the first request.
4788 ///
4789 /// For example, consider a situation where you make an initial request and the
4790 /// request times out. If you make the request again with the same request
4791 /// ID, the server can check if original operation with the same request ID
4792 /// was received, and if so, will ignore the second request. This prevents
4793 /// clients from accidentally creating duplicate commitments.
4794 ///
4795 /// The request ID must be a valid UUID with the exception that zero UUID is
4796 /// not supported (00000000-0000-0000-0000-000000000000).
4797 pub request_id: std::string::String,
4798
4799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4800}
4801
4802impl CreateIndexRequest {
4803 pub fn new() -> Self {
4804 std::default::Default::default()
4805 }
4806
4807 /// Sets the value of [parent][crate::model::CreateIndexRequest::parent].
4808 ///
4809 /// # Example
4810 /// ```ignore,no_run
4811 /// # use google_cloud_vectorsearch_v1::model::CreateIndexRequest;
4812 /// let x = CreateIndexRequest::new().set_parent("example");
4813 /// ```
4814 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4815 self.parent = v.into();
4816 self
4817 }
4818
4819 /// Sets the value of [index_id][crate::model::CreateIndexRequest::index_id].
4820 ///
4821 /// # Example
4822 /// ```ignore,no_run
4823 /// # use google_cloud_vectorsearch_v1::model::CreateIndexRequest;
4824 /// let x = CreateIndexRequest::new().set_index_id("example");
4825 /// ```
4826 pub fn set_index_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4827 self.index_id = v.into();
4828 self
4829 }
4830
4831 /// Sets the value of [index][crate::model::CreateIndexRequest::index].
4832 ///
4833 /// # Example
4834 /// ```ignore,no_run
4835 /// # use google_cloud_vectorsearch_v1::model::CreateIndexRequest;
4836 /// use google_cloud_vectorsearch_v1::model::Index;
4837 /// let x = CreateIndexRequest::new().set_index(Index::default()/* use setters */);
4838 /// ```
4839 pub fn set_index<T>(mut self, v: T) -> Self
4840 where
4841 T: std::convert::Into<crate::model::Index>,
4842 {
4843 self.index = std::option::Option::Some(v.into());
4844 self
4845 }
4846
4847 /// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
4848 ///
4849 /// # Example
4850 /// ```ignore,no_run
4851 /// # use google_cloud_vectorsearch_v1::model::CreateIndexRequest;
4852 /// use google_cloud_vectorsearch_v1::model::Index;
4853 /// let x = CreateIndexRequest::new().set_or_clear_index(Some(Index::default()/* use setters */));
4854 /// let x = CreateIndexRequest::new().set_or_clear_index(None::<Index>);
4855 /// ```
4856 pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
4857 where
4858 T: std::convert::Into<crate::model::Index>,
4859 {
4860 self.index = v.map(|x| x.into());
4861 self
4862 }
4863
4864 /// Sets the value of [request_id][crate::model::CreateIndexRequest::request_id].
4865 ///
4866 /// # Example
4867 /// ```ignore,no_run
4868 /// # use google_cloud_vectorsearch_v1::model::CreateIndexRequest;
4869 /// let x = CreateIndexRequest::new().set_request_id("example");
4870 /// ```
4871 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4872 self.request_id = v.into();
4873 self
4874 }
4875}
4876
4877impl wkt::message::Message for CreateIndexRequest {
4878 fn typename() -> &'static str {
4879 "type.googleapis.com/google.cloud.vectorsearch.v1.CreateIndexRequest"
4880 }
4881}
4882
4883/// Message for deleting an Index.
4884#[derive(Clone, Default, PartialEq)]
4885#[non_exhaustive]
4886pub struct DeleteIndexRequest {
4887 /// Required. The resource name of the Index to delete.
4888 /// Format:
4889 /// `projects/{project}/locations/{location}/collections/{collection}/indexes/{index}`
4890 pub name: std::string::String,
4891
4892 /// Optional. An optional request ID to identify requests. Specify a unique
4893 /// request ID so that if you must retry your request, the server will know to
4894 /// ignore the request if it has already been completed. The server will
4895 /// guarantee that for at least 60 minutes since the first request.
4896 ///
4897 /// For example, consider a situation where you make an initial request and the
4898 /// request times out. If you make the request again with the same request
4899 /// ID, the server can check if original operation with the same request ID
4900 /// was received, and if so, will ignore the second request. This prevents
4901 /// clients from accidentally creating duplicate commitments.
4902 ///
4903 /// The request ID must be a valid UUID with the exception that zero UUID is
4904 /// not supported (00000000-0000-0000-0000-000000000000).
4905 pub request_id: std::string::String,
4906
4907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4908}
4909
4910impl DeleteIndexRequest {
4911 pub fn new() -> Self {
4912 std::default::Default::default()
4913 }
4914
4915 /// Sets the value of [name][crate::model::DeleteIndexRequest::name].
4916 ///
4917 /// # Example
4918 /// ```ignore,no_run
4919 /// # use google_cloud_vectorsearch_v1::model::DeleteIndexRequest;
4920 /// let x = DeleteIndexRequest::new().set_name("example");
4921 /// ```
4922 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4923 self.name = v.into();
4924 self
4925 }
4926
4927 /// Sets the value of [request_id][crate::model::DeleteIndexRequest::request_id].
4928 ///
4929 /// # Example
4930 /// ```ignore,no_run
4931 /// # use google_cloud_vectorsearch_v1::model::DeleteIndexRequest;
4932 /// let x = DeleteIndexRequest::new().set_request_id("example");
4933 /// ```
4934 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4935 self.request_id = v.into();
4936 self
4937 }
4938}
4939
4940impl wkt::message::Message for DeleteIndexRequest {
4941 fn typename() -> &'static str {
4942 "type.googleapis.com/google.cloud.vectorsearch.v1.DeleteIndexRequest"
4943 }
4944}
4945
4946/// Message for requesting list of Indexes
4947#[derive(Clone, Default, PartialEq)]
4948#[non_exhaustive]
4949pub struct ListIndexesRequest {
4950 /// Required. Parent value for ListIndexesRequest
4951 pub parent: std::string::String,
4952
4953 /// Optional. Requested page size. Server may return fewer items than
4954 /// requested. If unspecified, server will pick an appropriate default.
4955 pub page_size: i32,
4956
4957 /// Optional. A token identifying a page of results the server should return.
4958 pub page_token: std::string::String,
4959
4960 /// Optional. Filtering results
4961 pub filter: std::string::String,
4962
4963 /// Optional. Hint for how to order the results
4964 pub order_by: std::string::String,
4965
4966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4967}
4968
4969impl ListIndexesRequest {
4970 pub fn new() -> Self {
4971 std::default::Default::default()
4972 }
4973
4974 /// Sets the value of [parent][crate::model::ListIndexesRequest::parent].
4975 ///
4976 /// # Example
4977 /// ```ignore,no_run
4978 /// # use google_cloud_vectorsearch_v1::model::ListIndexesRequest;
4979 /// let x = ListIndexesRequest::new().set_parent("example");
4980 /// ```
4981 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4982 self.parent = v.into();
4983 self
4984 }
4985
4986 /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_vectorsearch_v1::model::ListIndexesRequest;
4991 /// let x = ListIndexesRequest::new().set_page_size(42);
4992 /// ```
4993 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4994 self.page_size = v.into();
4995 self
4996 }
4997
4998 /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
4999 ///
5000 /// # Example
5001 /// ```ignore,no_run
5002 /// # use google_cloud_vectorsearch_v1::model::ListIndexesRequest;
5003 /// let x = ListIndexesRequest::new().set_page_token("example");
5004 /// ```
5005 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5006 self.page_token = v.into();
5007 self
5008 }
5009
5010 /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
5011 ///
5012 /// # Example
5013 /// ```ignore,no_run
5014 /// # use google_cloud_vectorsearch_v1::model::ListIndexesRequest;
5015 /// let x = ListIndexesRequest::new().set_filter("example");
5016 /// ```
5017 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5018 self.filter = v.into();
5019 self
5020 }
5021
5022 /// Sets the value of [order_by][crate::model::ListIndexesRequest::order_by].
5023 ///
5024 /// # Example
5025 /// ```ignore,no_run
5026 /// # use google_cloud_vectorsearch_v1::model::ListIndexesRequest;
5027 /// let x = ListIndexesRequest::new().set_order_by("example");
5028 /// ```
5029 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5030 self.order_by = v.into();
5031 self
5032 }
5033}
5034
5035impl wkt::message::Message for ListIndexesRequest {
5036 fn typename() -> &'static str {
5037 "type.googleapis.com/google.cloud.vectorsearch.v1.ListIndexesRequest"
5038 }
5039}
5040
5041/// Message for response to listing Indexes
5042#[derive(Clone, Default, PartialEq)]
5043#[non_exhaustive]
5044pub struct ListIndexesResponse {
5045 /// The list of Index
5046 pub indexes: std::vec::Vec<crate::model::Index>,
5047
5048 /// A token identifying a page of results the server should return.
5049 pub next_page_token: std::string::String,
5050
5051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5052}
5053
5054impl ListIndexesResponse {
5055 pub fn new() -> Self {
5056 std::default::Default::default()
5057 }
5058
5059 /// Sets the value of [indexes][crate::model::ListIndexesResponse::indexes].
5060 ///
5061 /// # Example
5062 /// ```ignore,no_run
5063 /// # use google_cloud_vectorsearch_v1::model::ListIndexesResponse;
5064 /// use google_cloud_vectorsearch_v1::model::Index;
5065 /// let x = ListIndexesResponse::new()
5066 /// .set_indexes([
5067 /// Index::default()/* use setters */,
5068 /// Index::default()/* use (different) setters */,
5069 /// ]);
5070 /// ```
5071 pub fn set_indexes<T, V>(mut self, v: T) -> Self
5072 where
5073 T: std::iter::IntoIterator<Item = V>,
5074 V: std::convert::Into<crate::model::Index>,
5075 {
5076 use std::iter::Iterator;
5077 self.indexes = v.into_iter().map(|i| i.into()).collect();
5078 self
5079 }
5080
5081 /// Sets the value of [next_page_token][crate::model::ListIndexesResponse::next_page_token].
5082 ///
5083 /// # Example
5084 /// ```ignore,no_run
5085 /// # use google_cloud_vectorsearch_v1::model::ListIndexesResponse;
5086 /// let x = ListIndexesResponse::new().set_next_page_token("example");
5087 /// ```
5088 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5089 self.next_page_token = v.into();
5090 self
5091 }
5092}
5093
5094impl wkt::message::Message for ListIndexesResponse {
5095 fn typename() -> &'static str {
5096 "type.googleapis.com/google.cloud.vectorsearch.v1.ListIndexesResponse"
5097 }
5098}
5099
5100#[doc(hidden)]
5101impl google_cloud_gax::paginator::internal::PageableResponse for ListIndexesResponse {
5102 type PageItem = crate::model::Index;
5103
5104 fn items(self) -> std::vec::Vec<Self::PageItem> {
5105 self.indexes
5106 }
5107
5108 fn next_page_token(&self) -> std::string::String {
5109 use std::clone::Clone;
5110 self.next_page_token.clone()
5111 }
5112}
5113
5114/// Message for getting an Index
5115#[derive(Clone, Default, PartialEq)]
5116#[non_exhaustive]
5117pub struct GetIndexRequest {
5118 /// Required. Name of the resource
5119 pub name: std::string::String,
5120
5121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5122}
5123
5124impl GetIndexRequest {
5125 pub fn new() -> Self {
5126 std::default::Default::default()
5127 }
5128
5129 /// Sets the value of [name][crate::model::GetIndexRequest::name].
5130 ///
5131 /// # Example
5132 /// ```ignore,no_run
5133 /// # use google_cloud_vectorsearch_v1::model::GetIndexRequest;
5134 /// let x = GetIndexRequest::new().set_name("example");
5135 /// ```
5136 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5137 self.name = v.into();
5138 self
5139 }
5140}
5141
5142impl wkt::message::Message for GetIndexRequest {
5143 fn typename() -> &'static str {
5144 "type.googleapis.com/google.cloud.vectorsearch.v1.GetIndexRequest"
5145 }
5146}
5147
5148/// Represents the metadata of the long-running operation.
5149#[derive(Clone, Default, PartialEq)]
5150#[non_exhaustive]
5151pub struct OperationMetadata {
5152 /// Output only. The time the operation was created.
5153 pub create_time: std::option::Option<wkt::Timestamp>,
5154
5155 /// Output only. The time the operation finished running.
5156 pub end_time: std::option::Option<wkt::Timestamp>,
5157
5158 /// Output only. Server-defined resource path for the target of the operation.
5159 pub target: std::string::String,
5160
5161 /// Output only. Name of the verb executed by the operation.
5162 pub verb: std::string::String,
5163
5164 /// Output only. Human-readable status of the operation, if any.
5165 pub status_message: std::string::String,
5166
5167 /// Output only. Identifies whether the user has requested cancellation
5168 /// of the operation. Operations that have been cancelled successfully
5169 /// have
5170 /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
5171 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of `1`,
5172 /// corresponding to `Code.CANCELLED`.
5173 ///
5174 /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
5175 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
5176 pub requested_cancellation: bool,
5177
5178 /// Output only. API version used to start the operation.
5179 pub api_version: std::string::String,
5180
5181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5182}
5183
5184impl OperationMetadata {
5185 pub fn new() -> Self {
5186 std::default::Default::default()
5187 }
5188
5189 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
5190 ///
5191 /// # Example
5192 /// ```ignore,no_run
5193 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5194 /// use wkt::Timestamp;
5195 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
5196 /// ```
5197 pub fn set_create_time<T>(mut self, v: T) -> Self
5198 where
5199 T: std::convert::Into<wkt::Timestamp>,
5200 {
5201 self.create_time = std::option::Option::Some(v.into());
5202 self
5203 }
5204
5205 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
5206 ///
5207 /// # Example
5208 /// ```ignore,no_run
5209 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5210 /// use wkt::Timestamp;
5211 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5212 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
5213 /// ```
5214 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5215 where
5216 T: std::convert::Into<wkt::Timestamp>,
5217 {
5218 self.create_time = v.map(|x| x.into());
5219 self
5220 }
5221
5222 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
5223 ///
5224 /// # Example
5225 /// ```ignore,no_run
5226 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5227 /// use wkt::Timestamp;
5228 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
5229 /// ```
5230 pub fn set_end_time<T>(mut self, v: T) -> Self
5231 where
5232 T: std::convert::Into<wkt::Timestamp>,
5233 {
5234 self.end_time = std::option::Option::Some(v.into());
5235 self
5236 }
5237
5238 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
5239 ///
5240 /// # Example
5241 /// ```ignore,no_run
5242 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5243 /// use wkt::Timestamp;
5244 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5245 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
5246 /// ```
5247 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5248 where
5249 T: std::convert::Into<wkt::Timestamp>,
5250 {
5251 self.end_time = v.map(|x| x.into());
5252 self
5253 }
5254
5255 /// Sets the value of [target][crate::model::OperationMetadata::target].
5256 ///
5257 /// # Example
5258 /// ```ignore,no_run
5259 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5260 /// let x = OperationMetadata::new().set_target("example");
5261 /// ```
5262 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5263 self.target = v.into();
5264 self
5265 }
5266
5267 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
5268 ///
5269 /// # Example
5270 /// ```ignore,no_run
5271 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5272 /// let x = OperationMetadata::new().set_verb("example");
5273 /// ```
5274 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5275 self.verb = v.into();
5276 self
5277 }
5278
5279 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
5280 ///
5281 /// # Example
5282 /// ```ignore,no_run
5283 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5284 /// let x = OperationMetadata::new().set_status_message("example");
5285 /// ```
5286 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5287 self.status_message = v.into();
5288 self
5289 }
5290
5291 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
5292 ///
5293 /// # Example
5294 /// ```ignore,no_run
5295 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5296 /// let x = OperationMetadata::new().set_requested_cancellation(true);
5297 /// ```
5298 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5299 self.requested_cancellation = v.into();
5300 self
5301 }
5302
5303 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
5304 ///
5305 /// # Example
5306 /// ```ignore,no_run
5307 /// # use google_cloud_vectorsearch_v1::model::OperationMetadata;
5308 /// let x = OperationMetadata::new().set_api_version("example");
5309 /// ```
5310 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5311 self.api_version = v.into();
5312 self
5313 }
5314}
5315
5316impl wkt::message::Message for OperationMetadata {
5317 fn typename() -> &'static str {
5318 "type.googleapis.com/google.cloud.vectorsearch.v1.OperationMetadata"
5319 }
5320}
5321
5322/// Request message for
5323/// [VectorSearchService.ImportDataObjects][google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects].
5324///
5325/// [google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects]: crate::client::VectorSearchService::import_data_objects
5326#[derive(Clone, Default, PartialEq)]
5327#[non_exhaustive]
5328pub struct ImportDataObjectsRequest {
5329 /// Required. The resource name of the Collection to import DataObjects into.
5330 /// Format: `projects/{project}/locations/{location}/collections/{collection}`.
5331 pub name: std::string::String,
5332
5333 /// The configuration for the import data and error results.
5334 pub config: std::option::Option<crate::model::import_data_objects_request::Config>,
5335
5336 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5337}
5338
5339impl ImportDataObjectsRequest {
5340 pub fn new() -> Self {
5341 std::default::Default::default()
5342 }
5343
5344 /// Sets the value of [name][crate::model::ImportDataObjectsRequest::name].
5345 ///
5346 /// # Example
5347 /// ```ignore,no_run
5348 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsRequest;
5349 /// let x = ImportDataObjectsRequest::new().set_name("example");
5350 /// ```
5351 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5352 self.name = v.into();
5353 self
5354 }
5355
5356 /// Sets the value of [config][crate::model::ImportDataObjectsRequest::config].
5357 ///
5358 /// Note that all the setters affecting `config` are mutually
5359 /// exclusive.
5360 ///
5361 /// # Example
5362 /// ```ignore,no_run
5363 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsRequest;
5364 /// use google_cloud_vectorsearch_v1::model::import_data_objects_request::GcsImportConfig;
5365 /// let x = ImportDataObjectsRequest::new().set_config(Some(
5366 /// google_cloud_vectorsearch_v1::model::import_data_objects_request::Config::GcsImport(GcsImportConfig::default().into())));
5367 /// ```
5368 pub fn set_config<
5369 T: std::convert::Into<std::option::Option<crate::model::import_data_objects_request::Config>>,
5370 >(
5371 mut self,
5372 v: T,
5373 ) -> Self {
5374 self.config = v.into();
5375 self
5376 }
5377
5378 /// The value of [config][crate::model::ImportDataObjectsRequest::config]
5379 /// if it holds a `GcsImport`, `None` if the field is not set or
5380 /// holds a different branch.
5381 pub fn gcs_import(
5382 &self,
5383 ) -> std::option::Option<
5384 &std::boxed::Box<crate::model::import_data_objects_request::GcsImportConfig>,
5385 > {
5386 #[allow(unreachable_patterns)]
5387 self.config.as_ref().and_then(|v| match v {
5388 crate::model::import_data_objects_request::Config::GcsImport(v) => {
5389 std::option::Option::Some(v)
5390 }
5391 _ => std::option::Option::None,
5392 })
5393 }
5394
5395 /// Sets the value of [config][crate::model::ImportDataObjectsRequest::config]
5396 /// to hold a `GcsImport`.
5397 ///
5398 /// Note that all the setters affecting `config` are
5399 /// mutually exclusive.
5400 ///
5401 /// # Example
5402 /// ```ignore,no_run
5403 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsRequest;
5404 /// use google_cloud_vectorsearch_v1::model::import_data_objects_request::GcsImportConfig;
5405 /// let x = ImportDataObjectsRequest::new().set_gcs_import(GcsImportConfig::default()/* use setters */);
5406 /// assert!(x.gcs_import().is_some());
5407 /// ```
5408 pub fn set_gcs_import<
5409 T: std::convert::Into<
5410 std::boxed::Box<crate::model::import_data_objects_request::GcsImportConfig>,
5411 >,
5412 >(
5413 mut self,
5414 v: T,
5415 ) -> Self {
5416 self.config = std::option::Option::Some(
5417 crate::model::import_data_objects_request::Config::GcsImport(v.into()),
5418 );
5419 self
5420 }
5421}
5422
5423impl wkt::message::Message for ImportDataObjectsRequest {
5424 fn typename() -> &'static str {
5425 "type.googleapis.com/google.cloud.vectorsearch.v1.ImportDataObjectsRequest"
5426 }
5427}
5428
5429/// Defines additional types related to [ImportDataObjectsRequest].
5430pub mod import_data_objects_request {
5431 #[allow(unused_imports)]
5432 use super::*;
5433
5434 /// Google Cloud Storage configuration for the import.
5435 #[derive(Clone, Default, PartialEq)]
5436 #[non_exhaustive]
5437 pub struct GcsImportConfig {
5438 /// Required. URI prefix of the Cloud Storage DataObjects to import.
5439 pub contents_uri: std::string::String,
5440
5441 /// Required. URI prefix of the Cloud Storage location to write any errors
5442 /// encountered during the import.
5443 pub error_uri: std::string::String,
5444
5445 /// Optional. URI prefix of the Cloud Storage location to write DataObject
5446 /// `IDs` and `etags` of DataObjects that were successfully imported. The
5447 /// service will write the successfully imported DataObjects to sharded files
5448 /// under this prefix. If this field is empty, no output will be written.
5449 pub output_uri: std::string::String,
5450
5451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5452 }
5453
5454 impl GcsImportConfig {
5455 pub fn new() -> Self {
5456 std::default::Default::default()
5457 }
5458
5459 /// Sets the value of [contents_uri][crate::model::import_data_objects_request::GcsImportConfig::contents_uri].
5460 ///
5461 /// # Example
5462 /// ```ignore,no_run
5463 /// # use google_cloud_vectorsearch_v1::model::import_data_objects_request::GcsImportConfig;
5464 /// let x = GcsImportConfig::new().set_contents_uri("example");
5465 /// ```
5466 pub fn set_contents_uri<T: std::convert::Into<std::string::String>>(
5467 mut self,
5468 v: T,
5469 ) -> Self {
5470 self.contents_uri = v.into();
5471 self
5472 }
5473
5474 /// Sets the value of [error_uri][crate::model::import_data_objects_request::GcsImportConfig::error_uri].
5475 ///
5476 /// # Example
5477 /// ```ignore,no_run
5478 /// # use google_cloud_vectorsearch_v1::model::import_data_objects_request::GcsImportConfig;
5479 /// let x = GcsImportConfig::new().set_error_uri("example");
5480 /// ```
5481 pub fn set_error_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5482 self.error_uri = v.into();
5483 self
5484 }
5485
5486 /// Sets the value of [output_uri][crate::model::import_data_objects_request::GcsImportConfig::output_uri].
5487 ///
5488 /// # Example
5489 /// ```ignore,no_run
5490 /// # use google_cloud_vectorsearch_v1::model::import_data_objects_request::GcsImportConfig;
5491 /// let x = GcsImportConfig::new().set_output_uri("example");
5492 /// ```
5493 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5494 self.output_uri = v.into();
5495 self
5496 }
5497 }
5498
5499 impl wkt::message::Message for GcsImportConfig {
5500 fn typename() -> &'static str {
5501 "type.googleapis.com/google.cloud.vectorsearch.v1.ImportDataObjectsRequest.GcsImportConfig"
5502 }
5503 }
5504
5505 /// The configuration for the import data and error results.
5506 #[derive(Clone, Debug, PartialEq)]
5507 #[non_exhaustive]
5508 pub enum Config {
5509 /// The Cloud Storage location of the input content.
5510 GcsImport(std::boxed::Box<crate::model::import_data_objects_request::GcsImportConfig>),
5511 }
5512}
5513
5514/// Metadata for
5515/// [VectorSearchService.ImportDataObjects][google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects].
5516///
5517/// [google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects]: crate::client::VectorSearchService::import_data_objects
5518#[derive(Clone, Default, PartialEq)]
5519#[non_exhaustive]
5520pub struct ImportDataObjectsMetadata {
5521 /// Output only. The time the operation was created.
5522 pub create_time: std::option::Option<wkt::Timestamp>,
5523
5524 /// Output only. The time the operation was last updated.
5525 pub update_time: std::option::Option<wkt::Timestamp>,
5526
5527 /// Output only. Number of DataObjects that were processed successfully.
5528 pub success_count: i64,
5529
5530 /// Output only. Number of DataObjects that failed during processing.
5531 pub failure_count: i64,
5532
5533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5534}
5535
5536impl ImportDataObjectsMetadata {
5537 pub fn new() -> Self {
5538 std::default::Default::default()
5539 }
5540
5541 /// Sets the value of [create_time][crate::model::ImportDataObjectsMetadata::create_time].
5542 ///
5543 /// # Example
5544 /// ```ignore,no_run
5545 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5546 /// use wkt::Timestamp;
5547 /// let x = ImportDataObjectsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
5548 /// ```
5549 pub fn set_create_time<T>(mut self, v: T) -> Self
5550 where
5551 T: std::convert::Into<wkt::Timestamp>,
5552 {
5553 self.create_time = std::option::Option::Some(v.into());
5554 self
5555 }
5556
5557 /// Sets or clears the value of [create_time][crate::model::ImportDataObjectsMetadata::create_time].
5558 ///
5559 /// # Example
5560 /// ```ignore,no_run
5561 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5562 /// use wkt::Timestamp;
5563 /// let x = ImportDataObjectsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5564 /// let x = ImportDataObjectsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
5565 /// ```
5566 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5567 where
5568 T: std::convert::Into<wkt::Timestamp>,
5569 {
5570 self.create_time = v.map(|x| x.into());
5571 self
5572 }
5573
5574 /// Sets the value of [update_time][crate::model::ImportDataObjectsMetadata::update_time].
5575 ///
5576 /// # Example
5577 /// ```ignore,no_run
5578 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5579 /// use wkt::Timestamp;
5580 /// let x = ImportDataObjectsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
5581 /// ```
5582 pub fn set_update_time<T>(mut self, v: T) -> Self
5583 where
5584 T: std::convert::Into<wkt::Timestamp>,
5585 {
5586 self.update_time = std::option::Option::Some(v.into());
5587 self
5588 }
5589
5590 /// Sets or clears the value of [update_time][crate::model::ImportDataObjectsMetadata::update_time].
5591 ///
5592 /// # Example
5593 /// ```ignore,no_run
5594 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5595 /// use wkt::Timestamp;
5596 /// let x = ImportDataObjectsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5597 /// let x = ImportDataObjectsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
5598 /// ```
5599 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5600 where
5601 T: std::convert::Into<wkt::Timestamp>,
5602 {
5603 self.update_time = v.map(|x| x.into());
5604 self
5605 }
5606
5607 /// Sets the value of [success_count][crate::model::ImportDataObjectsMetadata::success_count].
5608 ///
5609 /// # Example
5610 /// ```ignore,no_run
5611 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5612 /// let x = ImportDataObjectsMetadata::new().set_success_count(42);
5613 /// ```
5614 pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5615 self.success_count = v.into();
5616 self
5617 }
5618
5619 /// Sets the value of [failure_count][crate::model::ImportDataObjectsMetadata::failure_count].
5620 ///
5621 /// # Example
5622 /// ```ignore,no_run
5623 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsMetadata;
5624 /// let x = ImportDataObjectsMetadata::new().set_failure_count(42);
5625 /// ```
5626 pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5627 self.failure_count = v.into();
5628 self
5629 }
5630}
5631
5632impl wkt::message::Message for ImportDataObjectsMetadata {
5633 fn typename() -> &'static str {
5634 "type.googleapis.com/google.cloud.vectorsearch.v1.ImportDataObjectsMetadata"
5635 }
5636}
5637
5638/// Response for
5639/// [VectorSearchService.ImportDataObjects][google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects].
5640///
5641/// [google.cloud.vectorsearch.v1.VectorSearchService.ImportDataObjects]: crate::client::VectorSearchService::import_data_objects
5642#[derive(Clone, Default, PartialEq)]
5643#[non_exhaustive]
5644pub struct ImportDataObjectsResponse {
5645 /// Status of the LRO
5646 pub status: std::option::Option<google_cloud_rpc::model::Status>,
5647
5648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5649}
5650
5651impl ImportDataObjectsResponse {
5652 pub fn new() -> Self {
5653 std::default::Default::default()
5654 }
5655
5656 /// Sets the value of [status][crate::model::ImportDataObjectsResponse::status].
5657 ///
5658 /// # Example
5659 /// ```ignore,no_run
5660 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsResponse;
5661 /// use google_cloud_rpc::model::Status;
5662 /// let x = ImportDataObjectsResponse::new().set_status(Status::default()/* use setters */);
5663 /// ```
5664 pub fn set_status<T>(mut self, v: T) -> Self
5665 where
5666 T: std::convert::Into<google_cloud_rpc::model::Status>,
5667 {
5668 self.status = std::option::Option::Some(v.into());
5669 self
5670 }
5671
5672 /// Sets or clears the value of [status][crate::model::ImportDataObjectsResponse::status].
5673 ///
5674 /// # Example
5675 /// ```ignore,no_run
5676 /// # use google_cloud_vectorsearch_v1::model::ImportDataObjectsResponse;
5677 /// use google_cloud_rpc::model::Status;
5678 /// let x = ImportDataObjectsResponse::new().set_or_clear_status(Some(Status::default()/* use setters */));
5679 /// let x = ImportDataObjectsResponse::new().set_or_clear_status(None::<Status>);
5680 /// ```
5681 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
5682 where
5683 T: std::convert::Into<google_cloud_rpc::model::Status>,
5684 {
5685 self.status = v.map(|x| x.into());
5686 self
5687 }
5688}
5689
5690impl wkt::message::Message for ImportDataObjectsResponse {
5691 fn typename() -> &'static str {
5692 "type.googleapis.com/google.cloud.vectorsearch.v1.ImportDataObjectsResponse"
5693 }
5694}
5695
5696/// Request message for
5697/// [VectorSearchService.ExportDataObjects][google.cloud.vectorsearch.v1.VectorSearchService.ExportDataObjects].
5698///
5699/// [google.cloud.vectorsearch.v1.VectorSearchService.ExportDataObjects]: crate::client::VectorSearchService::export_data_objects
5700#[derive(Clone, Default, PartialEq)]
5701#[non_exhaustive]
5702pub struct ExportDataObjectsRequest {
5703 /// Required. The resource name of the Collection from which we want to export
5704 /// Data Objects. Format:
5705 /// `projects/{project}/locations/{location}/collections/{collection}`.
5706 pub name: std::string::String,
5707
5708 /// The configuration for the export data.
5709 pub destination: std::option::Option<crate::model::export_data_objects_request::Destination>,
5710
5711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5712}
5713
5714impl ExportDataObjectsRequest {
5715 pub fn new() -> Self {
5716 std::default::Default::default()
5717 }
5718
5719 /// Sets the value of [name][crate::model::ExportDataObjectsRequest::name].
5720 ///
5721 /// # Example
5722 /// ```ignore,no_run
5723 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsRequest;
5724 /// let x = ExportDataObjectsRequest::new().set_name("example");
5725 /// ```
5726 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5727 self.name = v.into();
5728 self
5729 }
5730
5731 /// Sets the value of [destination][crate::model::ExportDataObjectsRequest::destination].
5732 ///
5733 /// Note that all the setters affecting `destination` are mutually
5734 /// exclusive.
5735 ///
5736 /// # Example
5737 /// ```ignore,no_run
5738 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsRequest;
5739 /// use google_cloud_vectorsearch_v1::model::export_data_objects_request::GcsExportDestination;
5740 /// let x = ExportDataObjectsRequest::new().set_destination(Some(
5741 /// google_cloud_vectorsearch_v1::model::export_data_objects_request::Destination::GcsDestination(GcsExportDestination::default().into())));
5742 /// ```
5743 pub fn set_destination<
5744 T: std::convert::Into<
5745 std::option::Option<crate::model::export_data_objects_request::Destination>,
5746 >,
5747 >(
5748 mut self,
5749 v: T,
5750 ) -> Self {
5751 self.destination = v.into();
5752 self
5753 }
5754
5755 /// The value of [destination][crate::model::ExportDataObjectsRequest::destination]
5756 /// if it holds a `GcsDestination`, `None` if the field is not set or
5757 /// holds a different branch.
5758 pub fn gcs_destination(
5759 &self,
5760 ) -> std::option::Option<
5761 &std::boxed::Box<crate::model::export_data_objects_request::GcsExportDestination>,
5762 > {
5763 #[allow(unreachable_patterns)]
5764 self.destination.as_ref().and_then(|v| match v {
5765 crate::model::export_data_objects_request::Destination::GcsDestination(v) => {
5766 std::option::Option::Some(v)
5767 }
5768 _ => std::option::Option::None,
5769 })
5770 }
5771
5772 /// Sets the value of [destination][crate::model::ExportDataObjectsRequest::destination]
5773 /// to hold a `GcsDestination`.
5774 ///
5775 /// Note that all the setters affecting `destination` are
5776 /// mutually exclusive.
5777 ///
5778 /// # Example
5779 /// ```ignore,no_run
5780 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsRequest;
5781 /// use google_cloud_vectorsearch_v1::model::export_data_objects_request::GcsExportDestination;
5782 /// let x = ExportDataObjectsRequest::new().set_gcs_destination(GcsExportDestination::default()/* use setters */);
5783 /// assert!(x.gcs_destination().is_some());
5784 /// ```
5785 pub fn set_gcs_destination<
5786 T: std::convert::Into<
5787 std::boxed::Box<crate::model::export_data_objects_request::GcsExportDestination>,
5788 >,
5789 >(
5790 mut self,
5791 v: T,
5792 ) -> Self {
5793 self.destination = std::option::Option::Some(
5794 crate::model::export_data_objects_request::Destination::GcsDestination(v.into()),
5795 );
5796 self
5797 }
5798}
5799
5800impl wkt::message::Message for ExportDataObjectsRequest {
5801 fn typename() -> &'static str {
5802 "type.googleapis.com/google.cloud.vectorsearch.v1.ExportDataObjectsRequest"
5803 }
5804}
5805
5806/// Defines additional types related to [ExportDataObjectsRequest].
5807pub mod export_data_objects_request {
5808 #[allow(unused_imports)]
5809 use super::*;
5810
5811 /// Google Cloud Storage configuration for the export.
5812 #[derive(Clone, Default, PartialEq)]
5813 #[non_exhaustive]
5814 pub struct GcsExportDestination {
5815 /// Required. URI prefix of the Cloud Storage where to export Data Objects.
5816 /// The bucket is required to be in the same region as the collection.
5817 pub export_uri: std::string::String,
5818
5819 /// Required. The format of the exported Data Objects.
5820 pub format: crate::model::export_data_objects_request::gcs_export_destination::Format,
5821
5822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5823 }
5824
5825 impl GcsExportDestination {
5826 pub fn new() -> Self {
5827 std::default::Default::default()
5828 }
5829
5830 /// Sets the value of [export_uri][crate::model::export_data_objects_request::GcsExportDestination::export_uri].
5831 ///
5832 /// # Example
5833 /// ```ignore,no_run
5834 /// # use google_cloud_vectorsearch_v1::model::export_data_objects_request::GcsExportDestination;
5835 /// let x = GcsExportDestination::new().set_export_uri("example");
5836 /// ```
5837 pub fn set_export_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5838 self.export_uri = v.into();
5839 self
5840 }
5841
5842 /// Sets the value of [format][crate::model::export_data_objects_request::GcsExportDestination::format].
5843 ///
5844 /// # Example
5845 /// ```ignore,no_run
5846 /// # use google_cloud_vectorsearch_v1::model::export_data_objects_request::GcsExportDestination;
5847 /// use google_cloud_vectorsearch_v1::model::export_data_objects_request::gcs_export_destination::Format;
5848 /// let x0 = GcsExportDestination::new().set_format(Format::Jsonl);
5849 /// ```
5850 pub fn set_format<
5851 T: std::convert::Into<
5852 crate::model::export_data_objects_request::gcs_export_destination::Format,
5853 >,
5854 >(
5855 mut self,
5856 v: T,
5857 ) -> Self {
5858 self.format = v.into();
5859 self
5860 }
5861 }
5862
5863 impl wkt::message::Message for GcsExportDestination {
5864 fn typename() -> &'static str {
5865 "type.googleapis.com/google.cloud.vectorsearch.v1.ExportDataObjectsRequest.GcsExportDestination"
5866 }
5867 }
5868
5869 /// Defines additional types related to [GcsExportDestination].
5870 pub mod gcs_export_destination {
5871 #[allow(unused_imports)]
5872 use super::*;
5873
5874 /// Options for the format of the exported Data Objects.
5875 ///
5876 /// # Working with unknown values
5877 ///
5878 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5879 /// additional enum variants at any time. Adding new variants is not considered
5880 /// a breaking change. Applications should write their code in anticipation of:
5881 ///
5882 /// - New values appearing in future releases of the client library, **and**
5883 /// - New values received dynamically, without application changes.
5884 ///
5885 /// Please consult the [Working with enums] section in the user guide for some
5886 /// guidelines.
5887 ///
5888 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5889 #[derive(Clone, Debug, PartialEq)]
5890 #[non_exhaustive]
5891 pub enum Format {
5892 /// Unspecified format.
5893 Unspecified,
5894 /// Exports Data Objects in `JSONL` format.
5895 Jsonl,
5896 /// If set, the enum was initialized with an unknown value.
5897 ///
5898 /// Applications can examine the value using [Format::value] or
5899 /// [Format::name].
5900 UnknownValue(format::UnknownValue),
5901 }
5902
5903 #[doc(hidden)]
5904 pub mod format {
5905 #[allow(unused_imports)]
5906 use super::*;
5907 #[derive(Clone, Debug, PartialEq)]
5908 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5909 }
5910
5911 impl Format {
5912 /// Gets the enum value.
5913 ///
5914 /// Returns `None` if the enum contains an unknown value deserialized from
5915 /// the string representation of enums.
5916 pub fn value(&self) -> std::option::Option<i32> {
5917 match self {
5918 Self::Unspecified => std::option::Option::Some(0),
5919 Self::Jsonl => std::option::Option::Some(2),
5920 Self::UnknownValue(u) => u.0.value(),
5921 }
5922 }
5923
5924 /// Gets the enum value as a string.
5925 ///
5926 /// Returns `None` if the enum contains an unknown value deserialized from
5927 /// the integer representation of enums.
5928 pub fn name(&self) -> std::option::Option<&str> {
5929 match self {
5930 Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
5931 Self::Jsonl => std::option::Option::Some("JSONL"),
5932 Self::UnknownValue(u) => u.0.name(),
5933 }
5934 }
5935 }
5936
5937 impl std::default::Default for Format {
5938 fn default() -> Self {
5939 use std::convert::From;
5940 Self::from(0)
5941 }
5942 }
5943
5944 impl std::fmt::Display for Format {
5945 fn fmt(
5946 &self,
5947 f: &mut std::fmt::Formatter<'_>,
5948 ) -> std::result::Result<(), std::fmt::Error> {
5949 wkt::internal::display_enum(f, self.name(), self.value())
5950 }
5951 }
5952
5953 impl std::convert::From<i32> for Format {
5954 fn from(value: i32) -> Self {
5955 match value {
5956 0 => Self::Unspecified,
5957 2 => Self::Jsonl,
5958 _ => Self::UnknownValue(format::UnknownValue(
5959 wkt::internal::UnknownEnumValue::Integer(value),
5960 )),
5961 }
5962 }
5963 }
5964
5965 impl std::convert::From<&str> for Format {
5966 fn from(value: &str) -> Self {
5967 use std::string::ToString;
5968 match value {
5969 "FORMAT_UNSPECIFIED" => Self::Unspecified,
5970 "JSONL" => Self::Jsonl,
5971 _ => Self::UnknownValue(format::UnknownValue(
5972 wkt::internal::UnknownEnumValue::String(value.to_string()),
5973 )),
5974 }
5975 }
5976 }
5977
5978 impl serde::ser::Serialize for Format {
5979 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5980 where
5981 S: serde::Serializer,
5982 {
5983 match self {
5984 Self::Unspecified => serializer.serialize_i32(0),
5985 Self::Jsonl => serializer.serialize_i32(2),
5986 Self::UnknownValue(u) => u.0.serialize(serializer),
5987 }
5988 }
5989 }
5990
5991 impl<'de> serde::de::Deserialize<'de> for Format {
5992 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5993 where
5994 D: serde::Deserializer<'de>,
5995 {
5996 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
5997 ".google.cloud.vectorsearch.v1.ExportDataObjectsRequest.GcsExportDestination.Format"))
5998 }
5999 }
6000 }
6001
6002 /// The configuration for the export data.
6003 #[derive(Clone, Debug, PartialEq)]
6004 #[non_exhaustive]
6005 pub enum Destination {
6006 /// The Cloud Storage location where user wants to export Data Objects.
6007 GcsDestination(
6008 std::boxed::Box<crate::model::export_data_objects_request::GcsExportDestination>,
6009 ),
6010 }
6011}
6012
6013/// Metadata for the ExportDataObjects LRO.
6014#[derive(Clone, Default, PartialEq)]
6015#[non_exhaustive]
6016pub struct ExportDataObjectsMetadata {
6017 /// Output only. The time the operation was created.
6018 pub create_time: std::option::Option<wkt::Timestamp>,
6019
6020 /// Output only. The time the operation finished.
6021 pub finish_time: std::option::Option<wkt::Timestamp>,
6022
6023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6024}
6025
6026impl ExportDataObjectsMetadata {
6027 pub fn new() -> Self {
6028 std::default::Default::default()
6029 }
6030
6031 /// Sets the value of [create_time][crate::model::ExportDataObjectsMetadata::create_time].
6032 ///
6033 /// # Example
6034 /// ```ignore,no_run
6035 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsMetadata;
6036 /// use wkt::Timestamp;
6037 /// let x = ExportDataObjectsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
6038 /// ```
6039 pub fn set_create_time<T>(mut self, v: T) -> Self
6040 where
6041 T: std::convert::Into<wkt::Timestamp>,
6042 {
6043 self.create_time = std::option::Option::Some(v.into());
6044 self
6045 }
6046
6047 /// Sets or clears the value of [create_time][crate::model::ExportDataObjectsMetadata::create_time].
6048 ///
6049 /// # Example
6050 /// ```ignore,no_run
6051 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsMetadata;
6052 /// use wkt::Timestamp;
6053 /// let x = ExportDataObjectsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6054 /// let x = ExportDataObjectsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
6055 /// ```
6056 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6057 where
6058 T: std::convert::Into<wkt::Timestamp>,
6059 {
6060 self.create_time = v.map(|x| x.into());
6061 self
6062 }
6063
6064 /// Sets the value of [finish_time][crate::model::ExportDataObjectsMetadata::finish_time].
6065 ///
6066 /// # Example
6067 /// ```ignore,no_run
6068 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsMetadata;
6069 /// use wkt::Timestamp;
6070 /// let x = ExportDataObjectsMetadata::new().set_finish_time(Timestamp::default()/* use setters */);
6071 /// ```
6072 pub fn set_finish_time<T>(mut self, v: T) -> Self
6073 where
6074 T: std::convert::Into<wkt::Timestamp>,
6075 {
6076 self.finish_time = std::option::Option::Some(v.into());
6077 self
6078 }
6079
6080 /// Sets or clears the value of [finish_time][crate::model::ExportDataObjectsMetadata::finish_time].
6081 ///
6082 /// # Example
6083 /// ```ignore,no_run
6084 /// # use google_cloud_vectorsearch_v1::model::ExportDataObjectsMetadata;
6085 /// use wkt::Timestamp;
6086 /// let x = ExportDataObjectsMetadata::new().set_or_clear_finish_time(Some(Timestamp::default()/* use setters */));
6087 /// let x = ExportDataObjectsMetadata::new().set_or_clear_finish_time(None::<Timestamp>);
6088 /// ```
6089 pub fn set_or_clear_finish_time<T>(mut self, v: std::option::Option<T>) -> Self
6090 where
6091 T: std::convert::Into<wkt::Timestamp>,
6092 {
6093 self.finish_time = v.map(|x| x.into());
6094 self
6095 }
6096}
6097
6098impl wkt::message::Message for ExportDataObjectsMetadata {
6099 fn typename() -> &'static str {
6100 "type.googleapis.com/google.cloud.vectorsearch.v1.ExportDataObjectsMetadata"
6101 }
6102}
6103
6104/// Response for the ExportDataObjects LRO.
6105#[derive(Clone, Default, PartialEq)]
6106#[non_exhaustive]
6107pub struct ExportDataObjectsResponse {
6108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6109}
6110
6111impl ExportDataObjectsResponse {
6112 pub fn new() -> Self {
6113 std::default::Default::default()
6114 }
6115}
6116
6117impl wkt::message::Message for ExportDataObjectsResponse {
6118 fn typename() -> &'static str {
6119 "type.googleapis.com/google.cloud.vectorsearch.v1.ExportDataObjectsResponse"
6120 }
6121}
6122
6123/// Represents dedicated infrastructure for the index.
6124#[derive(Clone, Default, PartialEq)]
6125#[non_exhaustive]
6126pub struct DedicatedInfrastructure {
6127 /// Optional. Mode of the dedicated infrastructure.
6128 pub mode: std::option::Option<crate::model::dedicated_infrastructure::Mode>,
6129
6130 /// Optional. Autoscaling specification.
6131 pub autoscaling_spec:
6132 std::option::Option<crate::model::dedicated_infrastructure::AutoscalingSpec>,
6133
6134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6135}
6136
6137impl DedicatedInfrastructure {
6138 pub fn new() -> Self {
6139 std::default::Default::default()
6140 }
6141
6142 /// Sets the value of [mode][crate::model::DedicatedInfrastructure::mode].
6143 ///
6144 /// # Example
6145 /// ```ignore,no_run
6146 /// # use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
6147 /// use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::Mode;
6148 /// let x0 = DedicatedInfrastructure::new().set_mode(Mode::StorageOptimized);
6149 /// let x1 = DedicatedInfrastructure::new().set_mode(Mode::PerformanceOptimized);
6150 /// ```
6151 pub fn set_mode<T>(mut self, v: T) -> Self
6152 where
6153 T: std::convert::Into<crate::model::dedicated_infrastructure::Mode>,
6154 {
6155 self.mode = std::option::Option::Some(v.into());
6156 self
6157 }
6158
6159 /// Sets or clears the value of [mode][crate::model::DedicatedInfrastructure::mode].
6160 ///
6161 /// # Example
6162 /// ```ignore,no_run
6163 /// # use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
6164 /// use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::Mode;
6165 /// let x0 = DedicatedInfrastructure::new().set_or_clear_mode(Some(Mode::StorageOptimized));
6166 /// let x1 = DedicatedInfrastructure::new().set_or_clear_mode(Some(Mode::PerformanceOptimized));
6167 /// let x_none = DedicatedInfrastructure::new().set_or_clear_mode(None::<Mode>);
6168 /// ```
6169 pub fn set_or_clear_mode<T>(mut self, v: std::option::Option<T>) -> Self
6170 where
6171 T: std::convert::Into<crate::model::dedicated_infrastructure::Mode>,
6172 {
6173 self.mode = v.map(|x| x.into());
6174 self
6175 }
6176
6177 /// Sets the value of [autoscaling_spec][crate::model::DedicatedInfrastructure::autoscaling_spec].
6178 ///
6179 /// # Example
6180 /// ```ignore,no_run
6181 /// # use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
6182 /// use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::AutoscalingSpec;
6183 /// let x = DedicatedInfrastructure::new().set_autoscaling_spec(AutoscalingSpec::default()/* use setters */);
6184 /// ```
6185 pub fn set_autoscaling_spec<T>(mut self, v: T) -> Self
6186 where
6187 T: std::convert::Into<crate::model::dedicated_infrastructure::AutoscalingSpec>,
6188 {
6189 self.autoscaling_spec = std::option::Option::Some(v.into());
6190 self
6191 }
6192
6193 /// Sets or clears the value of [autoscaling_spec][crate::model::DedicatedInfrastructure::autoscaling_spec].
6194 ///
6195 /// # Example
6196 /// ```ignore,no_run
6197 /// # use google_cloud_vectorsearch_v1::model::DedicatedInfrastructure;
6198 /// use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::AutoscalingSpec;
6199 /// let x = DedicatedInfrastructure::new().set_or_clear_autoscaling_spec(Some(AutoscalingSpec::default()/* use setters */));
6200 /// let x = DedicatedInfrastructure::new().set_or_clear_autoscaling_spec(None::<AutoscalingSpec>);
6201 /// ```
6202 pub fn set_or_clear_autoscaling_spec<T>(mut self, v: std::option::Option<T>) -> Self
6203 where
6204 T: std::convert::Into<crate::model::dedicated_infrastructure::AutoscalingSpec>,
6205 {
6206 self.autoscaling_spec = v.map(|x| x.into());
6207 self
6208 }
6209}
6210
6211impl wkt::message::Message for DedicatedInfrastructure {
6212 fn typename() -> &'static str {
6213 "type.googleapis.com/google.cloud.vectorsearch.v1.DedicatedInfrastructure"
6214 }
6215}
6216
6217/// Defines additional types related to [DedicatedInfrastructure].
6218pub mod dedicated_infrastructure {
6219 #[allow(unused_imports)]
6220 use super::*;
6221
6222 /// Specification for autoscaling.
6223 #[derive(Clone, Default, PartialEq)]
6224 #[non_exhaustive]
6225 pub struct AutoscalingSpec {
6226 /// Optional. The minimum number of replicas. If not set or set to `0`,
6227 /// defaults to `2`. Must be >= `1` and <= `1000`.
6228 pub min_replica_count: i32,
6229
6230 /// Optional. The maximum number of replicas. Must be >=
6231 /// `min_replica_count` and <= `1000`.
6232 /// For the v1beta version, if not set or set to `0`, defaults to
6233 /// the greater of `min_replica_count` and `5`.
6234 /// For all other versions, if not set or set to `0`, defaults to
6235 /// the greater of `min_replica_count` and `2`.
6236 pub max_replica_count: i32,
6237
6238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6239 }
6240
6241 impl AutoscalingSpec {
6242 pub fn new() -> Self {
6243 std::default::Default::default()
6244 }
6245
6246 /// Sets the value of [min_replica_count][crate::model::dedicated_infrastructure::AutoscalingSpec::min_replica_count].
6247 ///
6248 /// # Example
6249 /// ```ignore,no_run
6250 /// # use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::AutoscalingSpec;
6251 /// let x = AutoscalingSpec::new().set_min_replica_count(42);
6252 /// ```
6253 pub fn set_min_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6254 self.min_replica_count = v.into();
6255 self
6256 }
6257
6258 /// Sets the value of [max_replica_count][crate::model::dedicated_infrastructure::AutoscalingSpec::max_replica_count].
6259 ///
6260 /// # Example
6261 /// ```ignore,no_run
6262 /// # use google_cloud_vectorsearch_v1::model::dedicated_infrastructure::AutoscalingSpec;
6263 /// let x = AutoscalingSpec::new().set_max_replica_count(42);
6264 /// ```
6265 pub fn set_max_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6266 self.max_replica_count = v.into();
6267 self
6268 }
6269 }
6270
6271 impl wkt::message::Message for AutoscalingSpec {
6272 fn typename() -> &'static str {
6273 "type.googleapis.com/google.cloud.vectorsearch.v1.DedicatedInfrastructure.AutoscalingSpec"
6274 }
6275 }
6276
6277 /// Mode of the dedicated infrastructure.
6278 ///
6279 /// # Working with unknown values
6280 ///
6281 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6282 /// additional enum variants at any time. Adding new variants is not considered
6283 /// a breaking change. Applications should write their code in anticipation of:
6284 ///
6285 /// - New values appearing in future releases of the client library, **and**
6286 /// - New values received dynamically, without application changes.
6287 ///
6288 /// Please consult the [Working with enums] section in the user guide for some
6289 /// guidelines.
6290 ///
6291 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6292 #[derive(Clone, Debug, PartialEq)]
6293 #[non_exhaustive]
6294 pub enum Mode {
6295 /// Default will use `PERFORMANCE_OPTIMIZED`.
6296 Unspecified,
6297 /// This is storage optimized variation.
6298 StorageOptimized,
6299 /// This is Performance optimized on E2 or equivalent family.
6300 PerformanceOptimized,
6301 /// If set, the enum was initialized with an unknown value.
6302 ///
6303 /// Applications can examine the value using [Mode::value] or
6304 /// [Mode::name].
6305 UnknownValue(mode::UnknownValue),
6306 }
6307
6308 #[doc(hidden)]
6309 pub mod mode {
6310 #[allow(unused_imports)]
6311 use super::*;
6312 #[derive(Clone, Debug, PartialEq)]
6313 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6314 }
6315
6316 impl Mode {
6317 /// Gets the enum value.
6318 ///
6319 /// Returns `None` if the enum contains an unknown value deserialized from
6320 /// the string representation of enums.
6321 pub fn value(&self) -> std::option::Option<i32> {
6322 match self {
6323 Self::Unspecified => std::option::Option::Some(0),
6324 Self::StorageOptimized => std::option::Option::Some(1),
6325 Self::PerformanceOptimized => std::option::Option::Some(2),
6326 Self::UnknownValue(u) => u.0.value(),
6327 }
6328 }
6329
6330 /// Gets the enum value as a string.
6331 ///
6332 /// Returns `None` if the enum contains an unknown value deserialized from
6333 /// the integer representation of enums.
6334 pub fn name(&self) -> std::option::Option<&str> {
6335 match self {
6336 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
6337 Self::StorageOptimized => std::option::Option::Some("STORAGE_OPTIMIZED"),
6338 Self::PerformanceOptimized => std::option::Option::Some("PERFORMANCE_OPTIMIZED"),
6339 Self::UnknownValue(u) => u.0.name(),
6340 }
6341 }
6342 }
6343
6344 impl std::default::Default for Mode {
6345 fn default() -> Self {
6346 use std::convert::From;
6347 Self::from(0)
6348 }
6349 }
6350
6351 impl std::fmt::Display for Mode {
6352 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6353 wkt::internal::display_enum(f, self.name(), self.value())
6354 }
6355 }
6356
6357 impl std::convert::From<i32> for Mode {
6358 fn from(value: i32) -> Self {
6359 match value {
6360 0 => Self::Unspecified,
6361 1 => Self::StorageOptimized,
6362 2 => Self::PerformanceOptimized,
6363 _ => Self::UnknownValue(mode::UnknownValue(
6364 wkt::internal::UnknownEnumValue::Integer(value),
6365 )),
6366 }
6367 }
6368 }
6369
6370 impl std::convert::From<&str> for Mode {
6371 fn from(value: &str) -> Self {
6372 use std::string::ToString;
6373 match value {
6374 "MODE_UNSPECIFIED" => Self::Unspecified,
6375 "STORAGE_OPTIMIZED" => Self::StorageOptimized,
6376 "PERFORMANCE_OPTIMIZED" => Self::PerformanceOptimized,
6377 _ => Self::UnknownValue(mode::UnknownValue(
6378 wkt::internal::UnknownEnumValue::String(value.to_string()),
6379 )),
6380 }
6381 }
6382 }
6383
6384 impl serde::ser::Serialize for Mode {
6385 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6386 where
6387 S: serde::Serializer,
6388 {
6389 match self {
6390 Self::Unspecified => serializer.serialize_i32(0),
6391 Self::StorageOptimized => serializer.serialize_i32(1),
6392 Self::PerformanceOptimized => serializer.serialize_i32(2),
6393 Self::UnknownValue(u) => u.0.serialize(serializer),
6394 }
6395 }
6396 }
6397
6398 impl<'de> serde::de::Deserialize<'de> for Mode {
6399 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6400 where
6401 D: serde::Deserializer<'de>,
6402 {
6403 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
6404 ".google.cloud.vectorsearch.v1.DedicatedInfrastructure.Mode",
6405 ))
6406 }
6407 }
6408}
6409
6410/// Dense ScaNN index configuration.
6411#[derive(Clone, Default, PartialEq)]
6412#[non_exhaustive]
6413pub struct DenseScannIndex {
6414 /// Optional. Feature norm type.
6415 pub feature_norm_type: crate::model::dense_scann_index::FeatureNormType,
6416
6417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6418}
6419
6420impl DenseScannIndex {
6421 pub fn new() -> Self {
6422 std::default::Default::default()
6423 }
6424
6425 /// Sets the value of [feature_norm_type][crate::model::DenseScannIndex::feature_norm_type].
6426 ///
6427 /// # Example
6428 /// ```ignore,no_run
6429 /// # use google_cloud_vectorsearch_v1::model::DenseScannIndex;
6430 /// use google_cloud_vectorsearch_v1::model::dense_scann_index::FeatureNormType;
6431 /// let x0 = DenseScannIndex::new().set_feature_norm_type(FeatureNormType::None);
6432 /// let x1 = DenseScannIndex::new().set_feature_norm_type(FeatureNormType::UnitL2Norm);
6433 /// ```
6434 pub fn set_feature_norm_type<
6435 T: std::convert::Into<crate::model::dense_scann_index::FeatureNormType>,
6436 >(
6437 mut self,
6438 v: T,
6439 ) -> Self {
6440 self.feature_norm_type = v.into();
6441 self
6442 }
6443}
6444
6445impl wkt::message::Message for DenseScannIndex {
6446 fn typename() -> &'static str {
6447 "type.googleapis.com/google.cloud.vectorsearch.v1.DenseScannIndex"
6448 }
6449}
6450
6451/// Defines additional types related to [DenseScannIndex].
6452pub mod dense_scann_index {
6453 #[allow(unused_imports)]
6454 use super::*;
6455
6456 /// Feature norm type for ScaNN index.
6457 ///
6458 /// # Working with unknown values
6459 ///
6460 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6461 /// additional enum variants at any time. Adding new variants is not considered
6462 /// a breaking change. Applications should write their code in anticipation of:
6463 ///
6464 /// - New values appearing in future releases of the client library, **and**
6465 /// - New values received dynamically, without application changes.
6466 ///
6467 /// Please consult the [Working with enums] section in the user guide for some
6468 /// guidelines.
6469 ///
6470 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6471 #[derive(Clone, Debug, PartialEq)]
6472 #[non_exhaustive]
6473 pub enum FeatureNormType {
6474 /// Unspecified feature norm type.
6475 Unspecified,
6476 /// No norm applied.
6477 None,
6478 /// Unit L2 norm.
6479 UnitL2Norm,
6480 /// If set, the enum was initialized with an unknown value.
6481 ///
6482 /// Applications can examine the value using [FeatureNormType::value] or
6483 /// [FeatureNormType::name].
6484 UnknownValue(feature_norm_type::UnknownValue),
6485 }
6486
6487 #[doc(hidden)]
6488 pub mod feature_norm_type {
6489 #[allow(unused_imports)]
6490 use super::*;
6491 #[derive(Clone, Debug, PartialEq)]
6492 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6493 }
6494
6495 impl FeatureNormType {
6496 /// Gets the enum value.
6497 ///
6498 /// Returns `None` if the enum contains an unknown value deserialized from
6499 /// the string representation of enums.
6500 pub fn value(&self) -> std::option::Option<i32> {
6501 match self {
6502 Self::Unspecified => std::option::Option::Some(0),
6503 Self::None => std::option::Option::Some(1),
6504 Self::UnitL2Norm => std::option::Option::Some(2),
6505 Self::UnknownValue(u) => u.0.value(),
6506 }
6507 }
6508
6509 /// Gets the enum value as a string.
6510 ///
6511 /// Returns `None` if the enum contains an unknown value deserialized from
6512 /// the integer representation of enums.
6513 pub fn name(&self) -> std::option::Option<&str> {
6514 match self {
6515 Self::Unspecified => std::option::Option::Some("FEATURE_NORM_TYPE_UNSPECIFIED"),
6516 Self::None => std::option::Option::Some("NONE"),
6517 Self::UnitL2Norm => std::option::Option::Some("UNIT_L2_NORM"),
6518 Self::UnknownValue(u) => u.0.name(),
6519 }
6520 }
6521 }
6522
6523 impl std::default::Default for FeatureNormType {
6524 fn default() -> Self {
6525 use std::convert::From;
6526 Self::from(0)
6527 }
6528 }
6529
6530 impl std::fmt::Display for FeatureNormType {
6531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6532 wkt::internal::display_enum(f, self.name(), self.value())
6533 }
6534 }
6535
6536 impl std::convert::From<i32> for FeatureNormType {
6537 fn from(value: i32) -> Self {
6538 match value {
6539 0 => Self::Unspecified,
6540 1 => Self::None,
6541 2 => Self::UnitL2Norm,
6542 _ => Self::UnknownValue(feature_norm_type::UnknownValue(
6543 wkt::internal::UnknownEnumValue::Integer(value),
6544 )),
6545 }
6546 }
6547 }
6548
6549 impl std::convert::From<&str> for FeatureNormType {
6550 fn from(value: &str) -> Self {
6551 use std::string::ToString;
6552 match value {
6553 "FEATURE_NORM_TYPE_UNSPECIFIED" => Self::Unspecified,
6554 "NONE" => Self::None,
6555 "UNIT_L2_NORM" => Self::UnitL2Norm,
6556 _ => Self::UnknownValue(feature_norm_type::UnknownValue(
6557 wkt::internal::UnknownEnumValue::String(value.to_string()),
6558 )),
6559 }
6560 }
6561 }
6562
6563 impl serde::ser::Serialize for FeatureNormType {
6564 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6565 where
6566 S: serde::Serializer,
6567 {
6568 match self {
6569 Self::Unspecified => serializer.serialize_i32(0),
6570 Self::None => serializer.serialize_i32(1),
6571 Self::UnitL2Norm => serializer.serialize_i32(2),
6572 Self::UnknownValue(u) => u.0.serialize(serializer),
6573 }
6574 }
6575 }
6576
6577 impl<'de> serde::de::Deserialize<'de> for FeatureNormType {
6578 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6579 where
6580 D: serde::Deserializer<'de>,
6581 {
6582 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FeatureNormType>::new(
6583 ".google.cloud.vectorsearch.v1.DenseScannIndex.FeatureNormType",
6584 ))
6585 }
6586 }
6587}
6588
6589/// Distance metric for vector search.
6590///
6591/// # Working with unknown values
6592///
6593/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6594/// additional enum variants at any time. Adding new variants is not considered
6595/// a breaking change. Applications should write their code in anticipation of:
6596///
6597/// - New values appearing in future releases of the client library, **and**
6598/// - New values received dynamically, without application changes.
6599///
6600/// Please consult the [Working with enums] section in the user guide for some
6601/// guidelines.
6602///
6603/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6604#[derive(Clone, Debug, PartialEq)]
6605#[non_exhaustive]
6606pub enum DistanceMetric {
6607 /// Default value, distance metric is not specified.
6608 Unspecified,
6609 /// Dot product distance metric.
6610 DotProduct,
6611 /// Cosine distance metric.
6612 CosineDistance,
6613 /// If set, the enum was initialized with an unknown value.
6614 ///
6615 /// Applications can examine the value using [DistanceMetric::value] or
6616 /// [DistanceMetric::name].
6617 UnknownValue(distance_metric::UnknownValue),
6618}
6619
6620#[doc(hidden)]
6621pub mod distance_metric {
6622 #[allow(unused_imports)]
6623 use super::*;
6624 #[derive(Clone, Debug, PartialEq)]
6625 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6626}
6627
6628impl DistanceMetric {
6629 /// Gets the enum value.
6630 ///
6631 /// Returns `None` if the enum contains an unknown value deserialized from
6632 /// the string representation of enums.
6633 pub fn value(&self) -> std::option::Option<i32> {
6634 match self {
6635 Self::Unspecified => std::option::Option::Some(0),
6636 Self::DotProduct => std::option::Option::Some(1),
6637 Self::CosineDistance => std::option::Option::Some(2),
6638 Self::UnknownValue(u) => u.0.value(),
6639 }
6640 }
6641
6642 /// Gets the enum value as a string.
6643 ///
6644 /// Returns `None` if the enum contains an unknown value deserialized from
6645 /// the integer representation of enums.
6646 pub fn name(&self) -> std::option::Option<&str> {
6647 match self {
6648 Self::Unspecified => std::option::Option::Some("DISTANCE_METRIC_UNSPECIFIED"),
6649 Self::DotProduct => std::option::Option::Some("DOT_PRODUCT"),
6650 Self::CosineDistance => std::option::Option::Some("COSINE_DISTANCE"),
6651 Self::UnknownValue(u) => u.0.name(),
6652 }
6653 }
6654}
6655
6656impl std::default::Default for DistanceMetric {
6657 fn default() -> Self {
6658 use std::convert::From;
6659 Self::from(0)
6660 }
6661}
6662
6663impl std::fmt::Display for DistanceMetric {
6664 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6665 wkt::internal::display_enum(f, self.name(), self.value())
6666 }
6667}
6668
6669impl std::convert::From<i32> for DistanceMetric {
6670 fn from(value: i32) -> Self {
6671 match value {
6672 0 => Self::Unspecified,
6673 1 => Self::DotProduct,
6674 2 => Self::CosineDistance,
6675 _ => Self::UnknownValue(distance_metric::UnknownValue(
6676 wkt::internal::UnknownEnumValue::Integer(value),
6677 )),
6678 }
6679 }
6680}
6681
6682impl std::convert::From<&str> for DistanceMetric {
6683 fn from(value: &str) -> Self {
6684 use std::string::ToString;
6685 match value {
6686 "DISTANCE_METRIC_UNSPECIFIED" => Self::Unspecified,
6687 "DOT_PRODUCT" => Self::DotProduct,
6688 "COSINE_DISTANCE" => Self::CosineDistance,
6689 _ => Self::UnknownValue(distance_metric::UnknownValue(
6690 wkt::internal::UnknownEnumValue::String(value.to_string()),
6691 )),
6692 }
6693 }
6694}
6695
6696impl serde::ser::Serialize for DistanceMetric {
6697 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6698 where
6699 S: serde::Serializer,
6700 {
6701 match self {
6702 Self::Unspecified => serializer.serialize_i32(0),
6703 Self::DotProduct => serializer.serialize_i32(1),
6704 Self::CosineDistance => serializer.serialize_i32(2),
6705 Self::UnknownValue(u) => u.0.serialize(serializer),
6706 }
6707 }
6708}
6709
6710impl<'de> serde::de::Deserialize<'de> for DistanceMetric {
6711 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6712 where
6713 D: serde::Deserializer<'de>,
6714 {
6715 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DistanceMetric>::new(
6716 ".google.cloud.vectorsearch.v1.DistanceMetric",
6717 ))
6718 }
6719}
6720
6721/// Aggregation methods.
6722///
6723/// # Working with unknown values
6724///
6725/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6726/// additional enum variants at any time. Adding new variants is not considered
6727/// a breaking change. Applications should write their code in anticipation of:
6728///
6729/// - New values appearing in future releases of the client library, **and**
6730/// - New values received dynamically, without application changes.
6731///
6732/// Please consult the [Working with enums] section in the user guide for some
6733/// guidelines.
6734///
6735/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6736#[derive(Clone, Debug, PartialEq)]
6737#[non_exhaustive]
6738pub enum AggregationMethod {
6739 /// Should not be used.
6740 Unspecified,
6741 /// Count the number of data objects that match the filter.
6742 Count,
6743 /// If set, the enum was initialized with an unknown value.
6744 ///
6745 /// Applications can examine the value using [AggregationMethod::value] or
6746 /// [AggregationMethod::name].
6747 UnknownValue(aggregation_method::UnknownValue),
6748}
6749
6750#[doc(hidden)]
6751pub mod aggregation_method {
6752 #[allow(unused_imports)]
6753 use super::*;
6754 #[derive(Clone, Debug, PartialEq)]
6755 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6756}
6757
6758impl AggregationMethod {
6759 /// Gets the enum value.
6760 ///
6761 /// Returns `None` if the enum contains an unknown value deserialized from
6762 /// the string representation of enums.
6763 pub fn value(&self) -> std::option::Option<i32> {
6764 match self {
6765 Self::Unspecified => std::option::Option::Some(0),
6766 Self::Count => std::option::Option::Some(1),
6767 Self::UnknownValue(u) => u.0.value(),
6768 }
6769 }
6770
6771 /// Gets the enum value as a string.
6772 ///
6773 /// Returns `None` if the enum contains an unknown value deserialized from
6774 /// the integer representation of enums.
6775 pub fn name(&self) -> std::option::Option<&str> {
6776 match self {
6777 Self::Unspecified => std::option::Option::Some("AGGREGATION_METHOD_UNSPECIFIED"),
6778 Self::Count => std::option::Option::Some("COUNT"),
6779 Self::UnknownValue(u) => u.0.name(),
6780 }
6781 }
6782}
6783
6784impl std::default::Default for AggregationMethod {
6785 fn default() -> Self {
6786 use std::convert::From;
6787 Self::from(0)
6788 }
6789}
6790
6791impl std::fmt::Display for AggregationMethod {
6792 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6793 wkt::internal::display_enum(f, self.name(), self.value())
6794 }
6795}
6796
6797impl std::convert::From<i32> for AggregationMethod {
6798 fn from(value: i32) -> Self {
6799 match value {
6800 0 => Self::Unspecified,
6801 1 => Self::Count,
6802 _ => Self::UnknownValue(aggregation_method::UnknownValue(
6803 wkt::internal::UnknownEnumValue::Integer(value),
6804 )),
6805 }
6806 }
6807}
6808
6809impl std::convert::From<&str> for AggregationMethod {
6810 fn from(value: &str) -> Self {
6811 use std::string::ToString;
6812 match value {
6813 "AGGREGATION_METHOD_UNSPECIFIED" => Self::Unspecified,
6814 "COUNT" => Self::Count,
6815 _ => Self::UnknownValue(aggregation_method::UnknownValue(
6816 wkt::internal::UnknownEnumValue::String(value.to_string()),
6817 )),
6818 }
6819 }
6820}
6821
6822impl serde::ser::Serialize for AggregationMethod {
6823 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6824 where
6825 S: serde::Serializer,
6826 {
6827 match self {
6828 Self::Unspecified => serializer.serialize_i32(0),
6829 Self::Count => serializer.serialize_i32(1),
6830 Self::UnknownValue(u) => u.0.serialize(serializer),
6831 }
6832 }
6833}
6834
6835impl<'de> serde::de::Deserialize<'de> for AggregationMethod {
6836 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6837 where
6838 D: serde::Deserializer<'de>,
6839 {
6840 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AggregationMethod>::new(
6841 ".google.cloud.vectorsearch.v1.AggregationMethod",
6842 ))
6843 }
6844}
6845
6846/// Represents the task the embeddings will be used for.
6847///
6848/// # Working with unknown values
6849///
6850/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6851/// additional enum variants at any time. Adding new variants is not considered
6852/// a breaking change. Applications should write their code in anticipation of:
6853///
6854/// - New values appearing in future releases of the client library, **and**
6855/// - New values received dynamically, without application changes.
6856///
6857/// Please consult the [Working with enums] section in the user guide for some
6858/// guidelines.
6859///
6860/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6861#[derive(Clone, Debug, PartialEq)]
6862#[non_exhaustive]
6863pub enum EmbeddingTaskType {
6864 /// Unspecified task type.
6865 Unspecified,
6866 /// Specifies the given text is a query in a search/retrieval setting.
6867 RetrievalQuery,
6868 /// Specifies the given text is a document from the corpus being searched.
6869 RetrievalDocument,
6870 /// Specifies the given text will be used for STS.
6871 SemanticSimilarity,
6872 /// Specifies that the given text will be classified.
6873 Classification,
6874 /// Specifies that the embeddings will be used for clustering.
6875 Clustering,
6876 /// Specifies that the embeddings will be used for question answering.
6877 QuestionAnswering,
6878 /// Specifies that the embeddings will be used for fact verification.
6879 FactVerification,
6880 /// Specifies that the embeddings will be used for code retrieval.
6881 CodeRetrievalQuery,
6882 /// If set, the enum was initialized with an unknown value.
6883 ///
6884 /// Applications can examine the value using [EmbeddingTaskType::value] or
6885 /// [EmbeddingTaskType::name].
6886 UnknownValue(embedding_task_type::UnknownValue),
6887}
6888
6889#[doc(hidden)]
6890pub mod embedding_task_type {
6891 #[allow(unused_imports)]
6892 use super::*;
6893 #[derive(Clone, Debug, PartialEq)]
6894 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6895}
6896
6897impl EmbeddingTaskType {
6898 /// Gets the enum value.
6899 ///
6900 /// Returns `None` if the enum contains an unknown value deserialized from
6901 /// the string representation of enums.
6902 pub fn value(&self) -> std::option::Option<i32> {
6903 match self {
6904 Self::Unspecified => std::option::Option::Some(0),
6905 Self::RetrievalQuery => std::option::Option::Some(1),
6906 Self::RetrievalDocument => std::option::Option::Some(2),
6907 Self::SemanticSimilarity => std::option::Option::Some(3),
6908 Self::Classification => std::option::Option::Some(4),
6909 Self::Clustering => std::option::Option::Some(5),
6910 Self::QuestionAnswering => std::option::Option::Some(6),
6911 Self::FactVerification => std::option::Option::Some(7),
6912 Self::CodeRetrievalQuery => std::option::Option::Some(8),
6913 Self::UnknownValue(u) => u.0.value(),
6914 }
6915 }
6916
6917 /// Gets the enum value as a string.
6918 ///
6919 /// Returns `None` if the enum contains an unknown value deserialized from
6920 /// the integer representation of enums.
6921 pub fn name(&self) -> std::option::Option<&str> {
6922 match self {
6923 Self::Unspecified => std::option::Option::Some("EMBEDDING_TASK_TYPE_UNSPECIFIED"),
6924 Self::RetrievalQuery => std::option::Option::Some("RETRIEVAL_QUERY"),
6925 Self::RetrievalDocument => std::option::Option::Some("RETRIEVAL_DOCUMENT"),
6926 Self::SemanticSimilarity => std::option::Option::Some("SEMANTIC_SIMILARITY"),
6927 Self::Classification => std::option::Option::Some("CLASSIFICATION"),
6928 Self::Clustering => std::option::Option::Some("CLUSTERING"),
6929 Self::QuestionAnswering => std::option::Option::Some("QUESTION_ANSWERING"),
6930 Self::FactVerification => std::option::Option::Some("FACT_VERIFICATION"),
6931 Self::CodeRetrievalQuery => std::option::Option::Some("CODE_RETRIEVAL_QUERY"),
6932 Self::UnknownValue(u) => u.0.name(),
6933 }
6934 }
6935}
6936
6937impl std::default::Default for EmbeddingTaskType {
6938 fn default() -> Self {
6939 use std::convert::From;
6940 Self::from(0)
6941 }
6942}
6943
6944impl std::fmt::Display for EmbeddingTaskType {
6945 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6946 wkt::internal::display_enum(f, self.name(), self.value())
6947 }
6948}
6949
6950impl std::convert::From<i32> for EmbeddingTaskType {
6951 fn from(value: i32) -> Self {
6952 match value {
6953 0 => Self::Unspecified,
6954 1 => Self::RetrievalQuery,
6955 2 => Self::RetrievalDocument,
6956 3 => Self::SemanticSimilarity,
6957 4 => Self::Classification,
6958 5 => Self::Clustering,
6959 6 => Self::QuestionAnswering,
6960 7 => Self::FactVerification,
6961 8 => Self::CodeRetrievalQuery,
6962 _ => Self::UnknownValue(embedding_task_type::UnknownValue(
6963 wkt::internal::UnknownEnumValue::Integer(value),
6964 )),
6965 }
6966 }
6967}
6968
6969impl std::convert::From<&str> for EmbeddingTaskType {
6970 fn from(value: &str) -> Self {
6971 use std::string::ToString;
6972 match value {
6973 "EMBEDDING_TASK_TYPE_UNSPECIFIED" => Self::Unspecified,
6974 "RETRIEVAL_QUERY" => Self::RetrievalQuery,
6975 "RETRIEVAL_DOCUMENT" => Self::RetrievalDocument,
6976 "SEMANTIC_SIMILARITY" => Self::SemanticSimilarity,
6977 "CLASSIFICATION" => Self::Classification,
6978 "CLUSTERING" => Self::Clustering,
6979 "QUESTION_ANSWERING" => Self::QuestionAnswering,
6980 "FACT_VERIFICATION" => Self::FactVerification,
6981 "CODE_RETRIEVAL_QUERY" => Self::CodeRetrievalQuery,
6982 _ => Self::UnknownValue(embedding_task_type::UnknownValue(
6983 wkt::internal::UnknownEnumValue::String(value.to_string()),
6984 )),
6985 }
6986 }
6987}
6988
6989impl serde::ser::Serialize for EmbeddingTaskType {
6990 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6991 where
6992 S: serde::Serializer,
6993 {
6994 match self {
6995 Self::Unspecified => serializer.serialize_i32(0),
6996 Self::RetrievalQuery => serializer.serialize_i32(1),
6997 Self::RetrievalDocument => serializer.serialize_i32(2),
6998 Self::SemanticSimilarity => serializer.serialize_i32(3),
6999 Self::Classification => serializer.serialize_i32(4),
7000 Self::Clustering => serializer.serialize_i32(5),
7001 Self::QuestionAnswering => serializer.serialize_i32(6),
7002 Self::FactVerification => serializer.serialize_i32(7),
7003 Self::CodeRetrievalQuery => serializer.serialize_i32(8),
7004 Self::UnknownValue(u) => u.0.serialize(serializer),
7005 }
7006 }
7007}
7008
7009impl<'de> serde::de::Deserialize<'de> for EmbeddingTaskType {
7010 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7011 where
7012 D: serde::Deserializer<'de>,
7013 {
7014 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EmbeddingTaskType>::new(
7015 ".google.cloud.vectorsearch.v1.EmbeddingTaskType",
7016 ))
7017 }
7018}