Skip to main content

iceberg_rest_catalog/models/
create_view_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 std::collections::HashMap;
12
13use iceberg_rust::spec::{
14    schema::Schema,
15    view_metadata::{Materialization, Version},
16};
17
18use crate::models;
19
20#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
21pub struct CreateViewRequest<T: Materialization> {
22    #[serde(rename = "name")]
23    pub name: String,
24    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
25    pub location: Option<String>,
26    #[serde(rename = "schema")]
27    pub schema: Schema,
28    #[serde(rename = "view-version")]
29    pub view_version: Version<T>,
30    #[serde(rename = "properties")]
31    pub properties: HashMap<String, String>,
32}
33
34impl<T: Materialization> CreateViewRequest<T> {
35    pub fn new(
36        name: String,
37        schema: Schema,
38        view_version: Version<T>,
39        properties: HashMap<String, String>,
40    ) -> CreateViewRequest<T> {
41        CreateViewRequest {
42            name,
43            location: None,
44            schema,
45            view_version,
46            properties,
47        }
48    }
49}