feat(apic): add Azure API Center extract/publish provider - #232
Merged
Conversation
Adds an additive, self-contained Azure API Center (Microsoft.ApiCenter) provider module enabling disaster-recovery style backup/restore via two new commands: apiops apic extract --resource-group <rg> --service-name <svc> [--workspace <ws>] [--output <dir>] apiops apic publish --resource-group <rg> --service-name <svc> [--source <dir>] [--dry-run] The APIM command path is untouched (zero regression risk). The module walks the Microsoft.ApiCenter/services control-plane tree (metadata schemas, workspaces, environments, APIs/versions/definitions/deployments, sources, analyzer/auth configs, links, plugins, models, agents, skills, eval configs, MCP registries), writes one artifact directory per resource, exports API definition specification bodies, and restores everything in dependency-tier order (re-importing specifications). Includes an ARM REST client with pagination, retry/back-off, and Azure-AsyncOperation/Location long-running-operation polling, plus 29 unit tests (metadata invariants, URI/path mapping, artifact-store round trip, and a mocked extract -> publish round trip).
rkolesnikovDX
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Azure API Center (
apic) extract/publish providerSummary
This PR adds an additive, self-contained Azure API Center (
Microsoft.ApiCenter) provider module to apiops-cli, enabling disaster-recovery style backup and restore of API Center services via two new commands:Both commands honor the existing global options (
--subscription-id,--cloud,--format json,--log-level, service-principal auth flags).Design: zero impact on the APIM path
The existing Azure API Management command path is completely untouched — no shared APIM types, clients, or services were modified, so there is no regression risk. The new module only reuses pure/generic helpers (
logger,user-agent,cloud-configauth scope,resource-pathtemplate helpers,@azure/identity).A lightweight provider abstraction (
src/models/provider.ts) documents the two providers; the API Center module owns its own metadata model, ARM client, artifact store, and extract/publish services.What it covers
Walks the
Microsoft.ApiCenter/servicescontrol-plane tree and round-trips:exportSpecificationand re-imported viaimportSpecificationRestore applies resources in dependency-tier order so references always exist before dependents are created.
The ARM REST client handles pagination (
nextLink), retry/back-off (429/5xx), and long-running operations (Azure-AsyncOperation/Locationpolling).Tests
29 new unit tests (all green; full suite 1109 tests pass):
tests/unit/models/apic-resource-types.test.ts— metadata invariants, root/child resolution, dependency-tier ordering (every child after its parent, full coverage, no duplicates)tests/unit/lib/apic-uri.test.ts— ARM URI, collection (list) URI, workspace scoping, labelstests/unit/services/apic-artifact-store.test.ts— resource/spec round trip, descriptor reconstruction from the artifact tree, positional-template parsingtests/unit/services/apic-extract-publish.test.ts— mocked extract → publish round trip incl. dependency ordering, spec import, and dry-runNew files
Deferred to follow-up PRs
Intentionally out of scope for this first PR, to keep it reviewable:
securityRequirements, extract filters / publish overridesinitscaffolding and CI pipeline templates for API CenterValidation