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};

/// BulkCreateDatabasesRequest : Request body for POST /databases/bulk.  One template plus a count, so the body stays small whatever `count` is. Any schemas and tables declared here are applied to every database in the batch; load data into them afterwards exactly as you would for a database created one at a time.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BulkCreateDatabasesRequest {
    /// How many databases to create.
    #[serde(rename = "count")]
    pub count: i64,
    /// Name the default catalog answers to inside each database, as on a single create. Defaults to `default`.
    #[serde(
        rename = "default_catalog",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub default_catalog: Option<Option<String>>,
    /// Schema that unqualified table names resolve to inside each database.
    #[serde(
        rename = "default_schema",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub default_schema: Option<Option<String>>,
    /// When the created databases expire. Accepts an RFC 3339 timestamp or a relative duration such as `24h`, `90m`, or `7d`.
    #[serde(
        rename = "expires_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires_at: Option<Option<String>>,
    /// Repeat this value to retry a request safely. A retry carrying a key that was already used returns the original batch — the same `batch_id` and the same databases — instead of creating a second set.  The key identifies the request, not its contents: reusing a key with a different `count` or template returns the original batch unchanged rather than reporting a mismatch. Use a fresh key per distinct request.
    #[serde(
        rename = "idempotency_key",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub idempotency_key: Option<Option<String>>,
    /// Optional display-label pattern for each database. `{index}` is replaced with the database's zero-based position — for example `tenant-{index}` produces `tenant-0`, `tenant-1`, and so on. Labels are not identifiers and are not required to be unique.
    #[serde(
        rename = "name_template",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name_template: Option<Option<String>>,
    /// Schemas and tables to declare on every database in the batch, in the same shape a single create accepts. The declaration applies identically to each database, so a batch of 10,000 declaring one table yields 10,000 databases that each hold that table and are ready to load — with no follow-up call per database. Omitted or empty means each database starts with no tables.
    #[serde(rename = "schemas", skip_serializing_if = "Option::is_none")]
    pub schemas: Option<Vec<models::DatabaseDefaultSchemaDecl>>,
}

impl BulkCreateDatabasesRequest {
    /// Request body for POST /databases/bulk.  One template plus a count, so the body stays small whatever `count` is. Any schemas and tables declared here are applied to every database in the batch; load data into them afterwards exactly as you would for a database created one at a time.
    pub fn new(count: i64) -> BulkCreateDatabasesRequest {
        BulkCreateDatabasesRequest {
            count,
            default_catalog: None,
            default_schema: None,
            expires_at: None,
            idempotency_key: None,
            name_template: None,
            schemas: None,
        }
    }
}