pub mod auth;
pub mod commands;
pub mod config;
pub mod url;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "otlp2pipeline")]
#[command(about = "Manage otlp2pipeline infrastructure on Cloudflare")]
#[command(version)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Init(InitArgs),
Create(CreateArgs),
Destroy(DestroyArgs),
Status(StatusArgs),
Plan(PlanArgs),
Query(QueryArgs),
#[command(alias = "cf")]
Cloudflare(CloudflareArgs),
Aws(AwsArgs),
Azure(AzureArgs),
Services(ServicesArgs),
Tail(TailArgs),
Connect(ConnectArgs),
}
#[derive(clap::Args)]
pub struct InitArgs {
#[arg(long, short)]
pub provider: String,
#[arg(long, short)]
pub env: String,
#[arg(long)]
pub worker_url: Option<String>,
#[arg(long)]
pub region: Option<String>,
#[arg(long)]
pub force: bool,
}
#[derive(clap::Args)]
pub struct CloudflareArgs {
#[command(subcommand)]
pub command: CloudflareCommands,
}
#[derive(Subcommand)]
pub enum CloudflareCommands {
Create(CreateArgs),
Destroy(DestroyArgs),
Status(StatusArgs),
Plan(PlanArgs),
Query(QueryArgs),
Catalog(CatalogArgs),
Bucket(BucketArgs),
}
#[derive(clap::Args)]
pub struct AwsArgs {
#[command(subcommand)]
pub command: AwsCommands,
}
#[derive(Subcommand)]
pub enum AwsCommands {
Create(CreateArgs),
Status(StatusArgs),
Destroy(DestroyArgs),
Plan(PlanArgs),
Query(QueryArgs),
Catalog(AwsCatalogArgs),
}
#[derive(clap::Args)]
pub struct AzureArgs {
#[command(subcommand)]
pub command: AzureCommands,
}
#[derive(Subcommand)]
pub enum AzureCommands {
Create(CreateArgs),
Status(StatusArgs),
Destroy(DestroyArgs),
Plan(PlanArgs),
}
#[derive(clap::Args)]
pub struct AwsCatalogArgs {
#[command(subcommand)]
pub command: AwsCatalogCommands,
}
#[derive(Subcommand)]
pub enum AwsCatalogCommands {
List(AwsCatalogListArgs),
}
#[derive(clap::Args)]
pub struct AwsCatalogListArgs {
#[arg(long)]
pub env: Option<String>,
#[arg(long)]
pub region: Option<String>,
}
#[derive(clap::Args)]
pub struct CatalogArgs {
#[command(subcommand)]
pub command: CatalogCommands,
}
#[derive(clap::Args)]
pub struct BucketArgs {
#[command(subcommand)]
pub command: BucketCommands,
}
#[derive(Subcommand)]
pub enum BucketCommands {
Delete(BucketDeleteArgs),
}
#[derive(clap::Args)]
pub struct BucketDeleteArgs {
pub name: String,
#[arg(long)]
pub bucket: Option<String>,
#[arg(long, env = "AWS_ACCESS_KEY_ID")]
pub access_key_id: String,
#[arg(long, env = "AWS_SECRET_ACCESS_KEY")]
pub secret_access_key: String,
#[arg(long)]
pub force: bool,
}
#[derive(Subcommand)]
pub enum CatalogCommands {
List(CatalogListArgs),
Partition(CatalogPartitionArgs),
}
#[derive(clap::Args)]
pub struct CatalogListArgs {
#[arg(long = "r2-token", env = "R2_API_TOKEN")]
pub r2_token: String,
#[arg(long, default_value = "wrangler.toml")]
pub config: String,
}
#[derive(clap::Args)]
pub struct CatalogPartitionArgs {
#[arg(long = "r2-token", env = "R2_API_TOKEN")]
pub r2_token: String,
#[arg(long, default_value = "wrangler.toml")]
pub config: String,
#[arg(long)]
pub dry_run: bool,
}
#[derive(clap::Args)]
pub struct CreateArgs {
#[arg(long)]
pub env: Option<String>,
#[arg(long, short)]
pub output: Option<String>,
#[arg(long = "r2-token", env = "R2_API_TOKEN")]
pub r2_token: Option<String>,
#[arg(long, default_value = "true")]
pub logs: bool,
#[arg(long, default_value = "true")]
pub traces: bool,
#[arg(long, default_value = "true")]
pub metrics: bool,
#[arg(long, default_value = "true")]
pub aggregator: bool,
#[arg(long, default_value = "true")]
pub livetail: bool,
#[arg(long, default_value = "60")]
pub retention: u32,
#[arg(long, default_value = "300")]
pub rolling_interval: u32,
#[arg(long)]
pub use_local: bool,
#[arg(long)]
pub region: Option<String>,
#[arg(long, default_value = "otlp2pipeline")]
pub table_bucket_name: String,
#[arg(long, default_value = "default")]
pub namespace: String,
#[arg(long)]
pub local: bool,
#[arg(
long,
default_value = "ghcr.io/smithclay/otlp2pipeline:v0.3.0-rc1-amd64"
)]
pub image: String,
#[arg(long)]
pub no_auth: bool,
}
#[derive(clap::Args)]
pub struct DestroyArgs {
#[arg(long)]
pub env: Option<String>,
#[arg(long)]
pub force: bool,
#[arg(long)]
pub include_worker: bool,
#[arg(long)]
pub region: Option<String>,
}
#[derive(clap::Args)]
pub struct StatusArgs {
#[arg(long)]
pub env: Option<String>,
#[arg(long)]
pub region: Option<String>,
}
#[derive(clap::Args)]
pub struct PlanArgs {
#[arg(long)]
pub env: Option<String>,
#[arg(long)]
pub region: Option<String>,
}
#[derive(clap::Args)]
pub struct QueryArgs {
#[arg(long)]
pub env: Option<String>,
}
#[derive(clap::Args)]
pub struct ServicesArgs {
#[arg(long)]
pub url: Option<String>,
}
#[derive(clap::Args)]
pub struct TailArgs {
pub service: String,
pub signal: String,
#[arg(long)]
pub url: Option<String>,
}
#[derive(clap::Args)]
pub struct ConnectArgs {
#[command(subcommand)]
pub command: ConnectCommands,
}
#[derive(Subcommand)]
pub enum ConnectCommands {
OtelCollector(ConnectOtelCollectorArgs),
ClaudeCode(ConnectClaudeCodeArgs),
Codex(ConnectCodexArgs),
}
#[derive(clap::Args)]
pub struct ConnectOtelCollectorArgs {
#[arg(long)]
pub url: Option<String>,
}
#[derive(clap::Args)]
pub struct ConnectClaudeCodeArgs {
#[arg(long)]
pub url: Option<String>,
#[arg(long, default_value = "shell")]
pub format: String,
}
#[derive(clap::Args)]
pub struct ConnectCodexArgs {
#[arg(long)]
pub url: Option<String>,
}