/*
* server
*
* ## Real-time data The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion). ## Authentication Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings: - username: Langfuse Public Key - password: Langfuse Secret Key ## Exports - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
*
* The version of the OpenAPI document:
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateBlobStorageIntegrationRequest {
/// ID of the project in which to configure the blob storage integration
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "type")]
pub r#type: models::BlobStorageIntegrationType,
/// Name of the storage bucket. For AZURE_BLOB_STORAGE, must be a valid Azure container name (3-63 chars, lowercase letters, numbers, and hyphens only, must start and end with a letter or number, no consecutive hyphens). For GOOGLE_CLOUD_STORAGE with default credentials, the bucket must be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`.
#[serde(rename = "bucketName")]
pub bucket_name: String,
/// Custom endpoint URL (required for S3_COMPATIBLE type). Ignored for GOOGLE_CLOUD_STORAGE.
#[serde(
rename = "endpoint",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub endpoint: Option<Option<String>>,
/// Storage region used by S3-compatible clients (AWS, GCS, Cloudflare R2, MinIO, Azure location IDs such as eastus, OCI). Leading and trailing whitespace is removed. The remaining value must be 1-63 letters, numbers, or hyphens, and cannot start or end with a hyphen. Examples: us-east-1, europe-west1, eastus, auto. Not used by GOOGLE_CLOUD_STORAGE; pass auto.
#[serde(rename = "region")]
pub region: String,
/// Access key ID for authentication. Not used for GOOGLE_CLOUD_STORAGE.
#[serde(
rename = "accessKeyId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub access_key_id: Option<Option<String>>,
/// Secret access key for authentication (will be encrypted when stored). When omitted on update, the stored secret is kept, unless the type changes between GOOGLE_CLOUD_STORAGE and another type. For GOOGLE_CLOUD_STORAGE, a GCP service account JSON key. On self-hosted deployments, pass `__GCS_DEFAULT_CREDENTIALS__` instead to use the deployment's Application Default Credentials; the bucket must then be listed in `LANGFUSE_BLOB_STORAGE_GCS_ALLOWED_BUCKETS`. Default credentials are not available on Langfuse Cloud.
#[serde(
rename = "secretAccessKey",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub secret_access_key: Option<Option<String>>,
/// Path prefix for exported files (must end with forward slash if provided)
#[serde(
rename = "prefix",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub prefix: Option<Option<String>>,
#[serde(rename = "exportFrequency")]
pub export_frequency: models::BlobStorageExportFrequency,
/// Whether the integration is active
#[serde(rename = "enabled")]
pub enabled: bool,
/// Use path-style URLs for S3 requests
#[serde(rename = "forcePathStyle")]
pub force_path_style: bool,
#[serde(rename = "fileType")]
pub file_type: models::BlobStorageIntegrationFileType,
#[serde(rename = "exportMode")]
pub export_mode: models::BlobStorageExportMode,
/// Custom start date for exports (required when exportMode is FROM_CUSTOM_DATE). Must not be in the future (27 h tolerance for timezone differences).
#[serde(
rename = "exportStartDate",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub export_start_date: Option<Option<chrono::DateTime<chrono::FixedOffset>>>,
/// Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.
#[serde(
rename = "compressed",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub compressed: Option<Option<bool>>,
#[serde(rename = "exportSource", skip_serializing_if = "Option::is_none")]
pub export_source: Option<models::BlobStorageExportSource>,
/// Field groups to include in each exported observation row. Applies to all export sources; must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved. `exportFieldGroups` requires `exportSource` to be provided in the same request.
#[serde(
rename = "exportFieldGroups",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub export_field_groups: Option<Option<Vec<models::BlobStorageExportFieldGroup>>>,
}
impl CreateBlobStorageIntegrationRequest {
pub fn new(
project_id: String,
r#type: models::BlobStorageIntegrationType,
bucket_name: String,
region: String,
export_frequency: models::BlobStorageExportFrequency,
enabled: bool,
force_path_style: bool,
file_type: models::BlobStorageIntegrationFileType,
export_mode: models::BlobStorageExportMode,
) -> CreateBlobStorageIntegrationRequest {
CreateBlobStorageIntegrationRequest {
project_id,
r#type,
bucket_name,
endpoint: None,
region,
access_key_id: None,
secret_access_key: None,
prefix: None,
export_frequency,
enabled,
force_path_style,
file_type,
export_mode,
export_start_date: None,
compressed: None,
export_source: None,
export_field_groups: None,
}
}
}