Cloud Native 15 min read

How UCloud Automated API/SDK Engineering to Boost Cloud Service Reliability

This article details UCloud's engineering of API and SDK management—including unified modeling, code generation, automated testing, and CI/CD pipelines—to dramatically improve the stability, reliability, and release efficiency of its public cloud services.

UCloud Tech
UCloud Tech
UCloud Tech
How UCloud Automated API/SDK Engineering to Boost Cloud Service Reliability

Abstract

For public cloud services, APIs are a main access path, and their quality and stability are crucial. Managing APIs and SDKs while ensuring continuous reliability is a major challenge.

Overview

UCloud's Access Product Development team integrated API management, test management, gateway logs, and GitLab CI in 2019, creating a contract‑centered toolchain that performs closed‑loop validation of APIs and SDKs, supporting 16 products and over 300 APIs/SDKs with daily regression testing.

The engineering effort reduced manual effort from one person‑day per product to generating SDK code in five minutes.

Why Build an API/SDK Engineering System

UCloud’s access tools (Terraform, Packer, CLI, mobile network detection) are open‑source and serve as the primary DevOps entry point for customers. These tools abstract low‑level API actions into higher‑level constructs, embodying the Infrastructure‑as‑Code principle.

Because the tools must be strictly versioned and stable, the underlying APIs also need to be immutable and reliable, requiring engineering methods to guarantee the whole lifecycle.

Problems Faced

Frequent, cumbersome changes across many IaaS products demand automated modifications.

Open‑source tools must maintain >90% coverage and high code‑style ratings, needing automated verification.

Small team size forces reuse of existing infrastructure and automation of the most change‑prone parts.

API Modeling

UCloud built a unified API registry “Youxiao” in 2017, adding test management and a DSL‑based behavior‑driven testing model. By 2018 the team generated the first Go SDK automatically from this platform.

SDK Code Generation

Code generation leverages compiler techniques. For Python 2/3 SDKs, UCloud generates Python 3 code, converts it to an abstract syntax tree, removes Python 3‑only nodes, adds compatibility nodes, and reconstructs Python 2 code.

Test code generation uses a DSL that is parsed into a JSON abstract syntax tree, then rendered into target language code via templates.

${u_eval(${u_get_timestamp(10)} - 3600)}

Runtime Abstraction

A common “onion model” abstracts request serialization, retries, logging, and error handling, keeping business logic orthogonal to request lifecycle.

Continuous Release

SDK releases are fully automated using GitLab CI and a GitHub bot. Daily releases handle code generation and testing, while window releases freeze versions and publish SDKs to language package repositories.

Version numbers are calculated automatically based on PR descriptions, following major/minor/patch rules.

Service‑Oriented Publishing

A proxy service triggers CI jobs, enabling other teams to request preview builds of SDKs on demand.

Summary and Outlook

In six months UCloud rebuilt its API model, introduced a generic SDK abstraction, unified code generation with compiler front‑ends and templates, and automated the release pipeline, completing the first phase of API/SDK engineering.

The next phase will embed the engineering capabilities into Git workflows, allowing self‑service publishing without dedicated team involvement.

SDKcloud-nativecode generationCI/CDAPI
UCloud Tech
Written by

UCloud Tech

UCloud is a leading neutral cloud provider in China, developing its own IaaS, PaaS, AI service platform, and big data exchange platform, and delivering comprehensive industry solutions for public, private, hybrid, and dedicated clouds.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.