cipherstash-client 0.28.0

The official CipherStash SDK
Documentation
//! Module for the client library for managing customer hosted resources

use serde::Deserialize;

use uuid::Uuid;

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Workspace {
    pub id: String,
    pub name: Option<String>,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Host {
    pub id: Uuid,
    pub fqdn: String,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Membership {
    pub id: Uuid,
    pub member_id: Uuid,
    pub workspace_id: String,
}

impl Workspace {
    pub fn name(&self) -> String {
        if let Some(name) = &self.name {
            name.to_string()
        } else {
            "(empty)".to_string()
        }
    }

    pub fn id(&self) -> String {
        self.id.to_string()
    }
}