kube-sql 0.0.1

Query Kubernetes resources through SQL.
Documentation
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_dummy_sqlparser() {
        use sqlparser::ast::SetExpr;
        use sqlparser::ast::{Query, Select, Statement};
        use sqlparser::dialect::GenericDialect;
        use sqlparser::parser::Parser;

        let sql = "SELECT a, b, 123, myfunc(b) \
                FROM table_1 \
                WHERE a > b AND b < 100 \
                ORDER BY a DESC, b";

        let dialect = GenericDialect {}; // or AnsiDialect, or your own dialect ...

        let mut ast = Parser::parse_sql(&dialect, sql).unwrap();
        let mut stmt = ast.pop().unwrap();

        match stmt {
            Statement::Query(ref mut query) => {
                match *query.body {
                    SetExpr::Select(ref mut select) => {
                        println!("{:?}", select.projection);
                    }
                    _ => {}
                }
                println!("{:?}", query.body);
            }
            _ => {}
        }
        println!("AST: {:?}", ast);
    }

    #[tokio::test]
    async fn test_dummy_kube() -> Result<(), Box<dyn std::error::Error>> {
        use futures::{StreamExt, TryStreamExt};
        use k8s_openapi::api::core::v1::Pod;
        use kube::{
            api::{Api, ListParams, PostParams, ResourceExt},
            Client,
        };

        // Infer the runtime environment and try to create a Kubernetes Client
        let client = Client::try_default().await?;

        // Read pods in the configured namespace into the typed interface from k8s-openapi
        let pods: Api<Pod> = Api::default_namespaced(client);
        for p in pods.list(&ListParams::default()).await? {
            println!("found pod {}", p.name_any());
        }
        Ok(())
    }
}