hotdata 0.5.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};

/// CreateUploadRequest : Request body for `POST /v1/uploads` and for each entry of `POST /v1/uploads/batch`.  Describes a single file you intend to upload directly to storage. The service chooses where the bytes are stored and returns a short-lived URL to `PUT` them to; you do not pick the storage location. The declared size is validated against the bytes you actually upload when you finalize.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateUploadRequest {
    /// Integrity checksum algorithm you are volunteering for this file. Currently only `sha256` is accepted. Optional; pair with `checksum_value`.
    #[serde(
        rename = "checksum_algo",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub checksum_algo: Option<Option<String>>,
    /// Integrity checksum value, paired with `checksum_algo`. Optional.
    #[serde(
        rename = "checksum_value",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub checksum_value: Option<Option<String>>,
    /// Content encoding to record for the uploaded file (for example `gzip`). Optional.
    #[serde(
        rename = "content_encoding",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub content_encoding: Option<Option<String>>,
    /// Content type to record for the uploaded file (for example the Parquet, CSV, or JSON MIME type). Optional.
    #[serde(
        rename = "content_type",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub content_type: Option<Option<String>>,
    /// The exact size, in bytes, of the file you will upload. Validated at create time against the maximum allowed size, and again at finalize against the bytes actually stored — a mismatch fails the finalize.
    #[serde(rename = "declared_size_bytes")]
    pub declared_size_bytes: i64,
    /// Original file name, recorded with the upload for your own bookkeeping. Optional and advisory — it does not affect where the bytes are stored or how they are loaded.
    #[serde(
        rename = "filename",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub filename: Option<Option<String>>,
    /// Preferred size, in bytes, of each part for a large (multi-part) upload. Optional hint — the service clamps it to the allowed part-size range and to the maximum number of parts, and ignores it for small files uploaded with a single `PUT`. Omit to let the service choose.
    #[serde(
        rename = "part_size",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub part_size: Option<Option<i64>>,
}

impl CreateUploadRequest {
    /// Request body for `POST /v1/uploads` and for each entry of `POST /v1/uploads/batch`.  Describes a single file you intend to upload directly to storage. The service chooses where the bytes are stored and returns a short-lived URL to `PUT` them to; you do not pick the storage location. The declared size is validated against the bytes you actually upload when you finalize.
    pub fn new(declared_size_bytes: i64) -> CreateUploadRequest {
        CreateUploadRequest {
            checksum_algo: None,
            checksum_value: None,
            content_encoding: None,
            content_type: None,
            declared_size_bytes,
            filename: None,
            part_size: None,
        }
    }
}