cloudres

module
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0

README

cloudres

Cloud resource query and display tool with a TUI.

cloudres queries cloud provider CLIs (Aliyun, Huawei Cloud, etc.) and caches resources in a local SQLite database. It provides both a CLI interface for scripting and an interactive terminal UI for browsing resources across regions.

Features

  • Interactive TUI — Browse providers, regions, and resources with vim-style keyboard navigation (j/k, / filter, : command)
  • CLI mode — Tabulated output for use in scripts and pipelines
  • Local SQLite cache — Resources are synced once and cached, with on-demand refresh (--sync flag)
  • Extensible provider model — New cloud providers plug into the ProviderDetector + ResourceFetcher interface
  • Cross-platform — Linux, macOS, Windows (amd64 + arm64)

Supported Providers

Provider Detection Status
Aliyun (阿里云) aliyun CLI + ~/.aliyun/config.json ✅ Implemented
Huawei Cloud (华为云) hcloud CLI + ~/.hcloud/config.json ✅ Implemented
Resource Types (Aliyun)
Code Resource Detail Fields
ecs Elastic Compute Service CPU, memory, OS, private/public IP, VPC, zone, auto-renewal (PrePaid)
vpc Virtual Private Cloud CIDR, IPv6 CIDR
vsw VSwitch (Subnet) CIDR, zone, VPC
rds Relational Database Service Engine, class, storage, disk/backup size, endpoint
tair Tair (Redis-compatible) Type, edition, version, memory usage, quota
pdb PolarDB Engine, node specs (per-node role/CPU/memory), endpoints, storage
oss Object Storage Service Storage class
slb Server Load Balancer (CLB) Address type, IP, network type, bandwidth, VPC, zone
alb Application Load Balancer Address type, edition, DNS, VPC
nlb Network Load Balancer Address type, DNS, VPC
ess Auto Scaling (ESS) Group type, active/max/min capacity
ram RAM User Display name, comments, created/updated time
cms-ct CloudMonitor Alert Contact Mail, SMS, channel verification state, groups
cms-cg CloudMonitor Contact Group Members, subscription, weekly report
cms-alert CloudMonitor Alert Rule Namespace, metric, thresholds (Critical/Warn/Info), instances, contact groups
Resource Types (Huawei Cloud)
Code Resource Detail Fields
ecs 弹性云服务器 (ECS) vCPUs, RAM, OS, private/public IP, VPC, zone, flavor
vpc 虚拟私有云 (VPC) CIDR, description, created/updated time
subnet 子网 (Subnet) CIDR, VPC, gateway, zone, DHCP
rds 云数据库 (RDS) Engine, type, flavor, CPU, memory, volume, private/public IP, nodes
dcs 分布式缓存服务 (DCS/Redis) Engine, capacity, max/used memory, IP, port, VPC, zone
evs 云硬盘 (EVS) Size, type, bootable, encrypted, attachments
eip 弹性公网IP (EIP) Public IP, type, bandwidth, private IP, bound instance

Prerequisites

  • Provider-specific CLI tools (e.g. aliyun CLI for Alibaba Cloud, hcloud CLI for Huawei Cloud)
  • A valid provider config (e.g. ~/.aliyun/config.json, ~/.hcloud/config.json)

Installation

Install from GitHub releases (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/mars-base/cloudres/main/scripts/install.sh | bash

Custom install directory:

curl -fsSL https://raw.githubusercontent.com/mars-base/cloudres/main/scripts/install.sh | INSTALL_DIR=~/bin bash
Install from GitHub releases (Windows PowerShell)
Invoke-WebRequest -Uri https://raw.githubusercontent.com/mars-base/cloudres/main/scripts/install.ps1 -OutFile install.ps1
.\install.ps1

# Custom directory
.\install.ps1 -InstallDir C:\tools

CLI Usage

Enter TUI (default)
cloudres
List detected providers
cloudres list

Output:

  Provider  Profile         Regions
  ──────────────────────────────────────────
  aliyun    default         cn-hangzhou, cn-shanghai
  huawei    default          cn-east-3
Query resources from CLI
# List ECS instances (uses current profile from config)
cloudres aliyun ecs

# Use a specific profile
cloudres aliyun ecs --profile production

# List resources in a specific region
cloudres aliyun ecs --region cn-hangzhou

# Force re-sync before listing
cloudres aliyun pdb --sync

# CloudMonitor: alert rules with thresholds, contacts and contact groups
cloudres aliyun cms-alert
cloudres aliyun cms-ct --profile production
cloudres aliyun cms-cg --sync

# Huawei Cloud
cloudres huawei ecs --sync
cloudres huawei eip
cloudres huawei dcs --profile myproject --sync
Show version
cloudres version

TUI Key Bindings

Provider Selection (StateProviderSelect)
Key Action
/ / j / k Navigate
Enter Select provider & profile
: Enter command mode
q Quit
Main View (StateMain)
Key Action
/ / j / k Navigate resources
19 Select region by index
: Command mode — type a resource type (e.g. ecs, subnet)
/ Filter resources (case-insensitive substring search across all columns)
d View resource detail
Esc Go back (clear filter → clear resource type → provider select)
q Quit
Detail View (StateDetail)
Key Action
Esc / d Back to main view
q Quit
Command Mode

Press : to enter command mode, then type a resource type name to load and display it:

Input Example Action
<resource-type> ecs Load ECS resources
<resource-type> subnet Load Subnet resources, hint shows 子网 (Subnet)
<resource-type> dcs Load DCS (Redis) resources

License

Apache License 2.0

Directories

Path Synopsis
cmd
cloudres command
internal
cli
Package cli implements the cobra command tree for cloudres.
Package cli implements the cobra command tree for cloudres.
core
Package core/migrate.go defines schema migrations applied in order.
Package core/migrate.go defines schema migrations applied in order.
provider
Package provider implements the provider registry and cloud provider detectors.
Package provider implements the provider registry and cloud provider detectors.
tui
Package tui — k9s-inspired styles for cloudres TUI.
Package tui — k9s-inspired styles for cloudres TUI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL