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