Metadata-Version: 2.4
Name: ic-code
Version: 1.5.2
Summary: Infrastructure CLI tool for managing AWS, GCP, OCI, CloudFlare, SSH, and more
Home-page: https://github.com/dgr009/ic
Author: SangYun Kim
Author-email: sykim <cruiser594@gmail.com>
Project-URL: Homepage, https://github.com/dgr009/ic
Project-URL: Bug Reports, https://github.com/dgr009/ic/issues
Project-URL: Source, https://github.com/dgr009/ic
Project-URL: Documentation, https://github.com/dgr009/ic#readme
Keywords: cli,infrastructure,aws,oci,gcp,cloudflare,ssh,devops,multi-cloud
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Environment :: Console
Requires-Python: >=3.9,<3.15
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests<3.0.0,>=2.31.0
Requires-Dist: cryptography<50.0.0,>=42.0.0
Requires-Dist: rich<15.0.0,>=13.0.0
Requires-Dist: InquirerPy<1.0.0,>=0.3.4
Requires-Dist: tqdm<5.0.0,>=4.67.0
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
Requires-Dist: python-dateutil<3.0.0,>=2.9.0
Requires-Dist: PyYAML<7.0.0,>=6.0.1
Requires-Dist: click<9.0.0,>=8.1.0
Requires-Dist: docutils<1.0.0,>=0.19
Requires-Dist: invoke<3.0.0,>=2.2.0
Requires-Dist: jsonschema<5.0.0,>=4.23.0
Requires-Dist: watchdog<6.0.0,>=4.0.0
Requires-Dist: cerberus<2.0.0,>=1.3.5
Requires-Dist: pydantic<3.0.0,>=2.7.0
Requires-Dist: packaging<25.0,>=24.0
Requires-Dist: setuptools<76.0.0,>=69.0.0
Provides-Extra: aws
Requires-Dist: boto3<2.0.0,>=1.34.0; extra == "aws"
Requires-Dist: botocore<2.0.0,>=1.34.0; extra == "aws"
Requires-Dist: awscli<2.0.0,>=1.32.0; extra == "aws"
Provides-Extra: tencent
Requires-Dist: tencentcloud-sdk-python<4.0.0,>=3.0.0; extra == "tencent"
Provides-Extra: oci
Requires-Dist: oci<3.0.0,>=2.149.0; extra == "oci"
Provides-Extra: gcp
Requires-Dist: google-cloud-compute<2.0.0,>=1.36.0; extra == "gcp"
Requires-Dist: google-cloud-container<3.0.0,>=2.44.0; extra == "gcp"
Requires-Dist: google-cloud-storage<3.0.0,>=2.18.0; extra == "gcp"
Requires-Dist: google-cloud-functions<2.0.0,>=1.16.0; extra == "gcp"
Requires-Dist: google-cloud-run<1.0.0,>=0.11.0; extra == "gcp"
Requires-Dist: google-cloud-billing<2.0.0,>=1.13.0; extra == "gcp"
Requires-Dist: google-cloud-dns<1.0.0,>=0.34.0; extra == "gcp"
Requires-Dist: google-cloud-resource-manager<2.0.0,>=1.12.0; extra == "gcp"
Requires-Dist: google-auth<3.0.0,>=2.29.0; extra == "gcp"
Requires-Dist: google-auth-oauthlib<2.0.0,>=1.2.0; extra == "gcp"
Requires-Dist: google-auth-httplib2<1.0.0,>=0.2.0; extra == "gcp"
Provides-Extra: ssh
Requires-Dist: paramiko<5.0.0,>=3.4.0; extra == "ssh"
Requires-Dist: netifaces<1.0.0,>=0.11.0; extra == "ssh"
Provides-Extra: k8s
Requires-Dist: kubernetes<32.0.0,>=29.0.0; extra == "k8s"
Provides-Extra: all
Requires-Dist: boto3<2.0.0,>=1.34.0; extra == "all"
Requires-Dist: botocore<2.0.0,>=1.34.0; extra == "all"
Requires-Dist: awscli<2.0.0,>=1.32.0; extra == "all"
Requires-Dist: tencentcloud-sdk-python<4.0.0,>=3.0.0; extra == "all"
Requires-Dist: oci<3.0.0,>=2.149.0; extra == "all"
Requires-Dist: google-cloud-compute<2.0.0,>=1.36.0; extra == "all"
Requires-Dist: google-cloud-container<3.0.0,>=2.44.0; extra == "all"
Requires-Dist: google-cloud-storage<3.0.0,>=2.18.0; extra == "all"
Requires-Dist: google-cloud-functions<2.0.0,>=1.16.0; extra == "all"
Requires-Dist: google-cloud-run<1.0.0,>=0.11.0; extra == "all"
Requires-Dist: google-cloud-billing<2.0.0,>=1.13.0; extra == "all"
Requires-Dist: google-cloud-dns<1.0.0,>=0.34.0; extra == "all"
Requires-Dist: google-cloud-resource-manager<2.0.0,>=1.12.0; extra == "all"
Requires-Dist: google-auth<3.0.0,>=2.29.0; extra == "all"
Requires-Dist: google-auth-oauthlib<2.0.0,>=1.2.0; extra == "all"
Requires-Dist: google-auth-httplib2<1.0.0,>=0.2.0; extra == "all"
Requires-Dist: paramiko<5.0.0,>=3.4.0; extra == "all"
Requires-Dist: netifaces<1.0.0,>=0.11.0; extra == "all"
Requires-Dist: kubernetes<32.0.0,>=29.0.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest<9.0.0,>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == "dev"
Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
Requires-Dist: black<25.0.0,>=24.0.0; extra == "dev"
Requires-Dist: flake8<8.0.0,>=7.0.0; extra == "dev"
Requires-Dist: mypy<2.0.0,>=1.10.0; extra == "dev"
Requires-Dist: pyrefly>=1.2.0; extra == "dev"
Requires-Dist: pre-commit<4.0.0,>=3.7.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# IC CLI Tool (Infrastructure Commander)

[![PyPI version](https://badge.fury.io/py/ic-code.svg)](https://badge.fury.io/py/ic-code)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A comprehensive, production-grade Infrastructure Command Line Interface tool for managing multi-cloud infrastructure and server components across multiple platforms. IC CLI provides unified access to **AWS**, **Tencent Cloud**, **GCP**, **Oracle Cloud Infrastructure (OCI)**, **CloudFlare**, and **SSH** server management with rich progress indicators and secure configuration management.

---

## ✨ Key Features

- **🚀 Multi-Cloud Support**: AWS, Tencent Cloud, GCP, OCI, CloudFlare, and SSH server management
- **📊 Rich Progress Bars**: Real-time progress indicators for all long-running operations across accounts and regions
- **🔒 Secure Configuration**: Modern YAML-based configuration (`~/.ic/config/`) and native credential files (`~/.aws/config`, `~/.tencent/credentials`)
- **🌍 Multi-Account / Multi-Region**: Concurrent querying across multiple cloud accounts and regions with STS / CAM AssumeRole support
- **🎨 Beautiful Terminal UI**: Rich terminal output with tables, colors, JSON formatting, and tree diagrams
- **⚡ High Performance**: Optimized async and concurrent execution for fast resource discovery
- **🛡️ Security First**: Built-in credential masking, secret scanning, and pre-commit hook support

---

## 🖥️ Terminal UI Preview

![Tencent CVM Info Terminal UI](docs/tencent/use_sample.png)

---

## 📦 Supported Platforms & Services

### 1. 🟧 AWS Services (Production Ready)
- **Compute**: EC2 instances, ECS services/tasks, EKS clusters/nodes/pods, Fargate profiles
- **Storage & DB**: S3 buckets (with tagging compliance checks), RDS instances & clusters
- **Networking**: VPC, Subnets, Gateways, Load Balancers (ALB/NLB with listener rules, health check path & target health analysis), Security Groups (with Ingress & Egress rule analysis & tree view), VPN connections
- **Health & Maintenance**: AWS Health Dashboard EC2 scheduled reboot maintenance check (`ic aws healthdashboard reboot`)
- **Integrations**: CloudFront distributions, MSK Kafka brokers, CodePipeline build/deploy status, Profile management

### 2. 🟦 Tencent Cloud Services (Production Ready)
- **Compute**: CVM instances (with CPU, Mem, Disk, IP, SGs), Lighthouse lightweight application servers
- **Containers**: TKE (Tencent Kubernetes Engine) clusters & node details
- **Networking**: VPC, Subnets, NAT Gateways, CLB (Load Balancers - listener rules, health check, target health analysis & network traffic bandwidth statistics), Security Groups (with Ingress/Egress rules & tree view)
- **Authentication**: Multi-account STS AssumeRole support, Profile management (`ic tencent profile info` via `~/.tencent/credentials`)

### 3. 🟩 GCP Services (Production Ready - v1.5.2)
- **Compute Engine**: VM instances with status, zone, machine type (custom parsing), vCPU, memory, disks, IPs, tags, and verbose 15-column output (`ic gcp compute info -v`)
- **Compute Detailed Inspection (`desc`)**: Full attribute discovery, dot-notation key filtering (`-k / --keys`), schema discovery (`-l / --list-keys`) for instances
- **Load Balancing (LB)**: Forwarding rules, Target proxies, URL maps, Backend services, Health checks, and SSL certificates (`ic gcp lb info`)
- **LB Detailed Inspection (`desc`)**: Deep hierarchical inspection of proxies, rules, backends, and health checks with dot-notation key filtering (`ic gcp lb desc`)
- **GKE**: Kubernetes Engine clusters and node pool configurations (`ic gcp gke info`)
- **Cloud Run**: Serverless container services, ready status, CPU/Mem, and revisions (`ic gcp run info`)
- **Cloud Functions**: Serverless functions, triggers, runtime, and memory (`ic gcp functions info`)
- **Cloud SQL**: Managed database instances, engine versions, HA, and status (`ic gcp sql info`)
- **Cloud Storage**: Buckets, locations, storage classes, and lifecycle (`ic gcp storage info`)
- **VPC & Firewall**: Virtual networks, subnets, and ingress/egress firewall rules (`ic gcp vpc info`, `ic gcp firewall info`)
- **Cloud DNS**: Managed public and private DNS zones and record sets (`ic gcp dns info`)
- **Resource Hierarchy & Projects**: Multi-level folder tree, project status, and active project indicators (`ic gcp project info`)
- **Billing**: Cost by service, budgets, and alerts (`ic gcp billing info`)
- **Profile**: gcloud CLI configurations and active account verification (`ic gcp profile info`)

### 4. 🟥 Oracle Cloud Infrastructure (OCI) (Production Ready)
- **Compute & Containers**: VM instances, Container instances (ACI)
- **Networking**: VCN, Subnets, Load Balancers, Network Security Groups (NSG)
- **Storage**: Block Volumes, Object Storage buckets
- **IAM & Cost**: Compartment hierarchy, IAM Policy search/validation, Cost usage & billing credits

### 5. 🟧 CloudFlare (Production Ready)
- **DNS & Zones**: Zone listings, DNS record management, and account filtering

### 6. 🟦 SSH Server Management (Production Ready)
- **Discovery**: Automatic server registration, connection verification, and security filtering

---

## 📦 Installation

### From PyPI (Recommended)

```bash
# Install the latest stable version (v1.3.1+)
pip install ic-code

# Verify installation
ic --version
ic --help
```

### From Source (Development)

```bash
# Clone the repository
git clone https://github.com/dgr009/ic.git
cd ic

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies and local editable package
pip install -e .

# Verify installation
ic --version
```

---

## ⚙️ Configuration Setup

IC CLI uses a modern two-file configuration system located in `~/.ic/config/` for security:

```
~/.ic/config/
├── default.yaml        # Non-sensitive default settings
└── secrets.yaml        # Sensitive API keys, tokens, and profiles
```

### 1. Initialize Configuration

```bash
# Guided interactive configuration setup
ic config init

# Or generate template for specific clouds
ic config init --template aws
ic config init --template multi-cloud
```

### 2. Configure Credentials (`~/.ic/config/secrets.yaml`)

```yaml
# AWS Configuration
aws:
  accounts:
    - "123456789012"
  profiles:
    default: "my-aws-profile"
  regions:
    - "ap-northeast-2"
    - "us-east-1"

# GCP Configuration
gcp:
  project_id: "my-gcp-project-id"
  credentials_file: "~/.config/gcloud/application_default_credentials.json"
  regions:
    - "asia-northeast3"
    - "us-central1"

# Oracle Cloud Infrastructure (OCI)
oci:
  config_file: "~/.oci/config"
  profile: "DEFAULT"
  compartments:
    - "ocid1.compartment.oc1..example"

# CloudFlare Configuration
cloudflare:
  api_token: "your-cloudflare-api-token"

# SSH Configuration
ssh:
  key_dir: "~/.ssh"
  skip_prefixes:
    - "bastion"
    - "jump"
```

### 3. Manage & Validate Config

```bash
# Show configuration (sensitive fields masked automatically)
ic config show

# Validate configuration structure and paths
ic config validate
```

---

## 🚀 Command Usage Examples

### AWS Commands

```bash
# List EC2 instances across configured regions
ic aws ec2 info

# Security Group Info (Shows Ingress & Egress rules by default)
ic aws sg info

# Filter Security Groups for Ingress or Egress rules only
ic aws sg info --ingress    # Show Ingress rules only
ic aws sg info --egress     # Show Egress rules only

# Render Security Groups in visual tree structure with direction arrows (← Ingress, → Egress)
ic aws sg info -o tree

# S3 Bucket details and tag validation
ic aws s3 info
ic aws s3 tag_check

# EKS & ECS Cluster info
ic aws eks info
ic aws ecs info
```

### Tencent Cloud Commands

```bash
# List CVM instances across accounts and regions
ic tencent cvm info
ic tencent cvm info -a my-account

# List Lighthouse lightweight instances
ic tencent lighthouse info

# Security Group Info (Tables and Tree view)
ic tencent sg info
ic tencent sg info -o tree

# Load Balancer (CLB) with listeners, health check path & target health
ic tencent clb info

# VPC, Subnets, NAT Gateways & TKE Clusters
ic tencent vpc info
ic tencent nat info
ic tencent tke info

# Check credentials and profiles (~/.tencent/credentials)
ic tencent profile info
```

### GCP Commands (v1.5.2)

```bash
# Compute Engine VM instances (summary & verbose 15-column output)
ic gcp compute info
ic gcp compute info -v

# Compute Engine detailed resource inspection (desc)
ic gcp compute desc                                          # Full YAML dump
ic gcp compute desc -l                                       # Discover queryable dot-notation keys
ic gcp compute desc -k status,machine_type,internal_ip       # Filter attributes into table

# Load Balancers (ALB / NLB)
ic gcp lb info
ic gcp lb desc -l                                            # Discover LB schema keys
ic gcp lb desc -k type,ip_address,backend_services.0.name    # Inspect LB backend services

# Container & Serverless
ic gcp gke info                                              # GKE clusters & node pools
ic gcp run info                                              # Cloud Run services & revisions
ic gcp functions info                                        # Cloud Functions & triggers

# Databases, Storage & Networking
ic gcp sql info                                              # Cloud SQL instances
ic gcp storage info                                          # Cloud Storage buckets
ic gcp vpc info                                              # VPC networks & subnets
ic gcp firewall info                                         # Firewall ingress/egress rules
ic gcp dns info                                              # Cloud DNS managed zones

# Resource Hierarchy & Project Management
ic gcp project info                                          # Active project & folder tree view
ic gcp billing info                                          # Monthly billing costs by service
ic gcp profile info                                          # gcloud active configurations
```

### OCI Commands

```bash
# Compute VM instances
ic oci vm info

# Virtual Cloud Networks
ic oci vcn info

# Load Balancers & Network Security Groups
ic oci lb info
ic oci nsg info

# Storage & Cost usage
ic oci volume info
ic oci cost usage
```

### CloudFlare & SSH Commands

```bash
# CloudFlare Zones and DNS
ic cf zone info
ic cf dns info

# SSH Server discovery
ic ssh info
```

### Security & Hook Commands

```bash
# Scan codebase for hardcoded secrets
ic security scan

# Install pre-commit security hooks
ic security install-hooks
```

---

## 🧪 Testing & Validation

```bash
# Run unit & integration test suites
pytest tests/unit tests/integration

# Run End-to-End CLI validation
python tests/validation/end_to_end_cli_validation.py
```

---

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
