Hemmer Provider Generator
Automatically generate Hemmer infrastructure providers from cloud SDK specifications.
Transform any cloud provider's official SDK specification into a complete, working Hemmer provider packageโno manual coding required.
โจ Features
- Universal Spec Support: Parse Smithy, OpenAPI, Discovery, and Protobuf specifications
- Multi-Cloud: Support for AWS, GCP, Azure, Kubernetes, and gRPC services
- Unified Providers: Generate single providers with multiple services (Phase 6 complete)
- Auto-Detection: Automatically detects spec format from file extension and content
- Complete Generation: Generates provider.k manifest, Rust code, tests, and documentation
- Production Ready: Fully tested (57 tests), clippy-clean, formatted code
- Zero Manual Coding: End-to-end automation from spec to provider package
๐ Quick Start
Installation
Option 1: Install from crates.io (Recommended)
All Platforms:
Option 2: Quick Install Script
Linux/macOS:
|
Windows (PowerShell):
irm https://raw.githubusercontent.com/hemmer-io/hemmer-provider-generator/main/install.ps1 | iex
Option 3: Install from GitHub
All Platforms:
Option 4: Build from source
Linux/macOS:
# Clone the repository
# Build and install
# Or just build
Windows (PowerShell):
# Clone the repository
git clone https://github.com/hemmer-io/hemmer-provider-generator.git
cd hemmer-provider-generator
# Build and install
cargo install --path crates/cli
# Or just build
cargo build --release
.\target\release\hemmer-provider-generator.exe --help
Usage
1. Parse a Spec File (Inspect Without Generating)
# Auto-detect format
# Explicit format
Output: Service definition summary with resource count and CRUD operations
2. Generate a Single Service Provider
# Generate from GCP Discovery document
# Generate from AWS Smithy spec
# Generate from Kubernetes OpenAPI spec
Output: Complete provider package with provider.k, Cargo.toml, and Rust code
3. Generate Unified Multi-Service Provider
Generate a single provider package with multiple cloud services:
Option A: Explicit Spec List
Option B: Directory Scanning (Recommended)
# Recursively scans directory for all spec files
Key Features:
- ๐ Recursive Discovery: Automatically finds all spec files in directory tree
- ๐ฏ Smart Filtering:
--filterflag to select specific services by name - ๐ฆ Unified Output: Single provider with multiple services
- ๐ Large-Scale: Tested with 400+ AWS services, 18 GCP services, K8s specs
Real-World Examples:
# Generate complete AWS provider (all services)
# Generate filtered GCP provider (compute + storage + bigquery)
# Generate Kubernetes provider (apps + core APIs)
๐ Supported Spec Formats
| Format | Cloud Provider(s) | Source Repositories | Status |
|---|---|---|---|
| Smithy | AWS | aws/api-models-aws (406 services) | โ Tested |
| OpenAPI 3.0 | Kubernetes, Azure | kubernetes/kubernetes | โ Tested |
| Discovery | Google Cloud | googleapis/google-api-go-client (436 resources) | โ Tested |
| Protobuf | gRPC Services | Compiled .proto files (FileDescriptorSet) | โ Supported |
Getting Spec Files
AWS (Smithy)
# Contains 406 service specs (S3, DynamoDB, Lambda, etc.)
Google Cloud (Discovery)
# Contains 436 resources across all GCP services
Kubernetes (OpenAPI)
# Contains OpenAPI specs for all K8s APIs
Protobuf (gRPC)
# Compile .proto files to FileDescriptorSet
๐๏ธ Architecture
Spec File โ Auto-Detect Format โ Parse โ ServiceDefinition IR โ Generate โ Provider Package
Cloud-Agnostic Design: All parsers output the same intermediate representation (ServiceDefinition), making the generator completely cloud-agnostic.
๐ฆ Generated Provider Structure
provider-{service}/
โโโ Cargo.toml # Package manifest with SDK dependencies
โโโ README.md # Auto-generated documentation
โโโ provider.k # KCL manifest with resource schemas
โโโ src/
โโโ lib.rs # Provider struct and resource accessors
โโโ resources/
โโโ mod.rs # Resource exports
โโโ {resource}.rs # Individual resource implementations
Example Generated Output
provider.k:
schema StorageProvider:
schema Bucket:
name: str
location: str?
storage_class: str?
src/resources/bucket.rs:
๐ฏ Real-World Examples
Example 1: Complete AWS Provider (406 Services)
# Clone AWS SDK specs
# Generate unified AWS provider with specific services
# Result: Single provider-aws package with 7 services
Example 2: Google Cloud Provider (Storage, Compute, BigQuery)
# Clone Google API specs
# Generate unified GCP provider
# Result: 18 services matched, 436 resources parsed
Example 3: Kubernetes Provider (Core + Apps APIs)
# Clone Kubernetes specs
# Generate unified Kubernetes provider
# Result: 2 services, 9 resources
Example 4: Single Service Provider (AWS S3 Only)
# Download single Smithy spec
# Generate single-service provider
# Result: provider-s3 package with 38 resources
๐ง Development
Building
# Build all crates
# Run tests
# Run clippy
# Format code
Running Tests
# All tests
# Specific parser
# With output
๐ Project Structure
This is a Cargo workspace with 4 crates:
common/- Shared types (ServiceDefinition IR, FieldType, errors)parser/- Spec format parsers (Smithy, OpenAPI, Discovery, Protobuf)generator/- Code generation engine (Tera templates)cli/- Command-line interface
๐ How It Works
Single Service Generation
- Parse: Load and parse spec file using appropriate parser
- Transform: Convert to cloud-agnostic ServiceDefinition IR
- Generate: Apply Tera templates to create provider files
- Output: Complete provider package ready to use
Multi-Service Generation (Unified Provider)
- Discover: Recursively scan directory for
.jsonand.pbfiles - Filter: Match service names against
--filterpatterns - Parse: Parse all discovered specs into ServiceDefinitions
- Aggregate: Combine services into single ProviderDefinition
- Generate: Create unified provider package with all services (๐ง in progress)
Auto-Detection Logic
The CLI automatically detects spec format from:
- File extension:
.pbโ Protobuf,.jsonโ Parse content - Filename patterns:
smithy-model.json,storage-discovery.json,*openapi*.json - Content markers:
"smithy"+"shapes"โ Smithy"openapi"+"paths"โ OpenAPI"discoveryVersion"+"resources"โ Discovery
Service Name Filtering
When using --filter, service names are matched against spec filenames:
--filter s3matches:s3.json,s3-2006-03-01.json,s3control.json--filter storagematches:storage.json,storage-v1-api.json,storagetransfer.json- Multiple filters:
--filter s3,dynamodb,lambdamatches any of the three
๐งช Testing
- 57 total tests across workspace
- 4 integration tests (one per spec format)
- 3 unified generation tests
- Multi-platform CI (Ubuntu, macOS, Windows)
- All tests passing โ
๐ Related Projects
- Hemmer - Infrastructure-as-Code tool that uses these providers
- KCL - Configuration language used for provider manifests
๐ License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
๐ค Contributing
See CONTRIBUTING.md for contribution guidelines.
For development context and architecture details, see CLAUDE.md.
๐ฏ Status
Production Ready โ
All 6 planned phases are complete:
- โ Phase 1: Foundation & Planning
- โ Phase 2: AWS SDK Parser (Smithy)
- โ Phase 3: Generator Core
- โ Phase 4: Multi-Cloud Parsers (OpenAPI, Discovery, Protobuf)
- โ Phase 5: CLI Interface & Production Readiness
- โ Phase 6: Unified Multi-Service Providers (#16, #22, PR #19, PR #23)
Feature Status
| Feature | Status | Notes |
|---|---|---|
| Single-service generation | โ Complete | Fully tested |
| Smithy parser | โ Complete | 406 AWS services |
| OpenAPI parser | โ Complete | Kubernetes, Azure |
| Discovery parser | โ Complete | 436 GCP resources |
| Protobuf parser | โ Complete | gRPC services |
| Directory scanning | โ Complete | Recursive discovery |
| Service filtering | โ Complete | Pattern matching |
| Multi-service parsing | โ Complete | Parse & aggregate multiple services |
| Multi-service generation | โ Complete | Full code generation for unified providers |
| Cross-platform install | โ Complete | Linux, macOS, Windows |
๐ Test Results
Tested with real SDK repositories:
- AWS: 406 services scanned, 91 resources parsed (S3, DynamoDB, Lambda)
- GCP: 18 services matched, 436 resources parsed (Storage, Compute, BigQuery)
- Kubernetes: 2 services, 9 resources parsed (Apps, Core APIs)
Version: 0.3.2 Last Updated: 2025-11-01