Skip to main content

windmill_api/models/
data_table_tables.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.835.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct DataTableTables {
16    #[serde(rename = "datatable_name")]
17    pub datatable_name: String,
18    /// Hierarchical metadata: schema_name -> table_names
19    #[serde(rename = "schemas")]
20    pub schemas: std::collections::HashMap<String, Vec<String>>,
21    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
22    pub error: Option<String>,
23    /// on the instance database, the only kind that can be under roles or have its access edited
24    #[serde(rename = "instance")]
25    pub instance: bool,
26    #[serde(rename = "permissioned")]
27    pub permissioned: bool,
28    /// the roles the caller may connect as, by name; empty when not under roles
29    #[serde(rename = "usable_roles")]
30    pub usable_roles: Vec<String>,
31    #[serde(rename = "default_role")]
32    pub default_role: String,
33    /// whether the role the listing connected as may create schemas
34    #[serde(rename = "can_create_schema")]
35    pub can_create_schema: bool,
36    /// the schemas the role the listing connected as may create in
37    #[serde(rename = "creatable_schemas")]
38    pub creatable_schemas: Vec<String>,
39    /// whether its schema is kept as versioned migrations, which a change made with plain SQL would bypass
40    #[serde(rename = "migrations_enabled")]
41    pub migrations_enabled: bool,
42}
43
44impl DataTableTables {
45    pub fn new(datatable_name: String, schemas: std::collections::HashMap<String, Vec<String>>, instance: bool, permissioned: bool, usable_roles: Vec<String>, default_role: String, can_create_schema: bool, creatable_schemas: Vec<String>, migrations_enabled: bool) -> DataTableTables {
46        DataTableTables {
47            datatable_name,
48            schemas,
49            error: None,
50            instance,
51            permissioned,
52            usable_roles,
53            default_role,
54            can_create_schema,
55            creatable_schemas,
56            migrations_enabled,
57        }
58    }
59}
60