Skip to main content

pinecone_sdk/openapi/models/
collection_model.rs

1/*
2 * Pinecone Control Plane API
3 *
4 * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
5 *
6 * The version of the OpenAPI document: 2024-07
7 * Contact: support@pinecone.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::openapi::models;
12use serde::{Deserialize, Serialize};
13
14/// CollectionModel : The CollectionModel describes the configuration and status of a Pinecone collection.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CollectionModel {
17    /// The name of the collection.
18    #[serde(rename = "name")]
19    pub name: String,
20    /// The size of the collection in bytes.
21    #[serde(rename = "size", skip_serializing_if = "Option::is_none")]
22    pub size: Option<i64>,
23    /// The status of the collection.
24    #[serde(rename = "status")]
25    pub status: Status,
26    /// The dimension of the vectors stored in each record held in the collection.
27    #[serde(rename = "dimension", skip_serializing_if = "Option::is_none")]
28    pub dimension: Option<i32>,
29    /// The number of records stored in the collection.
30    #[serde(rename = "vector_count", skip_serializing_if = "Option::is_none")]
31    pub vector_count: Option<i32>,
32    /// The environment where the collection is hosted.
33    #[serde(rename = "environment")]
34    pub environment: String,
35}
36
37impl CollectionModel {
38    /// The CollectionModel describes the configuration and status of a Pinecone collection.
39    pub fn new(name: String, status: Status, environment: String) -> CollectionModel {
40        CollectionModel {
41            name,
42            size: None,
43            status,
44            dimension: None,
45            vector_count: None,
46            environment,
47        }
48    }
49}
50/// The status of the collection.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum Status {
53    #[serde(rename = "Initializing")]
54    Initializing,
55    #[serde(rename = "Ready")]
56    Ready,
57    #[serde(rename = "Terminating")]
58    Terminating,
59}
60
61impl Default for Status {
62    fn default() -> Status {
63        Self::Initializing
64    }
65}
66