Skip to main content

iceberg_rest_catalog/models/
create_table_request.rs

1/*
2 * Apache Iceberg REST Catalog API
3 *
4 * Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.
5 *
6 * The version of the OpenAPI document: 0.0.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use iceberg_rust::spec::{partition::PartitionSpec, schema::Schema, sort::SortOrder};
13use serde::{Deserialize, Serialize};
14
15#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateTableRequest {
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
20    pub location: Option<String>,
21    #[serde(rename = "schema")]
22    pub schema: Schema,
23    #[serde(rename = "partition-spec", skip_serializing_if = "Option::is_none")]
24    pub partition_spec: Option<PartitionSpec>,
25    #[serde(rename = "write-order", skip_serializing_if = "Option::is_none")]
26    pub write_order: Option<SortOrder>,
27    #[serde(rename = "stage-create", skip_serializing_if = "Option::is_none")]
28    pub stage_create: Option<bool>,
29    #[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
30    pub properties: Option<std::collections::HashMap<String, String>>,
31}
32
33impl CreateTableRequest {
34    pub fn new(name: String, schema: Schema) -> CreateTableRequest {
35        CreateTableRequest {
36            name,
37            location: None,
38            schema,
39            partition_spec: None,
40            write_order: None,
41            stage_create: None,
42            properties: None,
43        }
44    }
45}