/*
* Hotdata API
*
* Powerful data platform API for instant databases, queries, and analytics.
*
* The version of the OpenAPI document: 1.0.0
* Contact: developers@hotdata.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// WorkspaceUsageResponse : Response for GET /v1/usage
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WorkspaceUsageResponse {
/// Sum of `bytes_scanned` across all completed/failed query runs since `since`. Null bytes (queries that touched no row data) contribute 0. This is the storage read the workspace's queries caused, not how much data they covered: a query whose data was already cached contributes little or nothing (see `bytes_scanned` on a query run). Two periods with identical query histories can therefore report different totals, and this figure will not reconcile against a per-query estimate of rows or bytes touched.
#[serde(rename = "bytes_scanned")]
pub bytes_scanned: i64,
/// Number of query runs (succeeded + failed) since `since`.
#[serde(rename = "query_count")]
pub query_count: i64,
/// The period start used for this response (echoed back for the caller to verify).
#[serde(rename = "since")]
pub since: String,
/// The workspace's current stored-data footprint in bytes, measured at request time: instant-database data, plus un-consumed uploads, connection caches, and search-index artifacts.
#[serde(rename = "storage_bytes")]
pub storage_bytes: i64,
/// When `storage_bytes` was measured (the time this response was produced).
#[serde(
rename = "storage_captured_at",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub storage_captured_at: Option<Option<String>>,
}
impl WorkspaceUsageResponse {
/// Response for GET /v1/usage
pub fn new(
bytes_scanned: i64,
query_count: i64,
since: String,
storage_bytes: i64,
) -> WorkspaceUsageResponse {
WorkspaceUsageResponse {
bytes_scanned,
query_count,
since,
storage_bytes,
storage_captured_at: None,
}
}
}