hotdata 0.14.0

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for managed 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};

/// DatabaseBatchResponse : A bulk-creation batch: the handle for progress, listing, and cancellation.  The databases themselves are listed with `GET /databases?batch=<batch_id>`; this carries the batch's own state rather than its members.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatabaseBatchResponse {
    #[serde(rename = "batch_id")]
    pub batch_id: String,
    /// True once stopping has been requested. Databases already created are kept; only further creation stops.
    #[serde(rename = "cancel_requested")]
    pub cancel_requested: bool,
    /// How many databases the batch was asked to create.
    #[serde(rename = "count")]
    pub count: i64,
    /// How many exist so far. Advances as the batch fills.
    #[serde(rename = "created_count")]
    pub created_count: i64,
    #[serde(
        rename = "expires_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires_at: Option<Option<String>>,
    /// Job filling this batch. Poll it for status.
    #[serde(
        rename = "job_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub job_id: Option<Option<String>>,
    #[serde(
        rename = "status_url",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub status_url: Option<Option<String>>,
}

impl DatabaseBatchResponse {
    /// A bulk-creation batch: the handle for progress, listing, and cancellation.  The databases themselves are listed with `GET /databases?batch=<batch_id>`; this carries the batch's own state rather than its members.
    pub fn new(
        batch_id: String,
        cancel_requested: bool,
        count: i64,
        created_count: i64,
    ) -> DatabaseBatchResponse {
        DatabaseBatchResponse {
            batch_id,
            cancel_requested,
            count,
            created_count,
            expires_at: None,
            job_id: None,
            status_url: None,
        }
    }
}