Skip to content

refactor(cloud): unify cloud and serverless under single cloud namespace#199

Merged
MattDevy merged 4 commits into
mainfrom
claude/gallant-hofstadter-94d7c6
Apr 17, 2026
Merged

refactor(cloud): unify cloud and serverless under single cloud namespace#199
MattDevy merged 4 commits into
mainfrom
claude/gallant-hofstadter-94d7c6

Conversation

@MattDevy

Copy link
Copy Markdown
Contributor

Closes #193. Partial revert of #131.

Summary

Unifies elastic cloud and elastic serverless under a single top-level cloud namespace to match how customers actually think about the product (Elastic Cloud at cloud.elastic.co, with two offerings: Hosted Deployments and Serverless Projects).

New tree:

elastic cloud
├── accounts                       promoted — current-user account
├── authentication                 promoted — Cloud API keys
├── organizations                  promoted — org management
├── user-role-assignments          promoted — user role assignments
├── hosted
│   ├── deployments
│   ├── deployment-templates
│   ├── deployments-traffic-filter
│   ├── extensions
│   ├── stack                      stack versions
│   ├── trusted-environments
│   └── billing-costs-analysis
└── serverless
    ├── es/projects { list, create, get, delete, patch, resume, get-status, get-roles, reset-credentials }
    ├── observability/projects { … }
    ├── security/projects { … }
    ├── regions
    ├── traffic-filters
    ├── linked-projects
    └── linked-candidate-projects

Design notes

  • Promoted to direct cloud children because they apply to both Hosted and Serverless: accounts (current-user account), authentication (Cloud API keys), organizations (org/IdP/domain-claims/invitations), user-role-assignments.
  • Kept under cloud hosted: billing-costs-analysis (today's endpoints are deployment-indexed), trusted-environments (ECE/ESS-only concept).
  • Codegen unchanged. src/cloud/apis/*.ts, src/cloud/apis.ts, and src/cloud/serverless-apis.ts are untouched. The restructure happens at tree-assembly time in src/cloud/register.ts.
  • Clean break, no aliases. Project is 0.1.0-alpha.1 and the misleading split landed recently in fix: update readme, cloud bugs #131. Partitioning in register.ts uses two hardcoded namespace sets (PROMOTED_NAMESPACES, SERVERLESS_NAMESPACES) so synthetic-def tests partition deterministically.
  • elastic eselastic stack rename is deferred to a follow-up (orthogonal change, different codepath).

Migration

Before After
elastic serverless es projects list elastic cloud serverless es projects list
elastic cloud deployments list-deployments elastic cloud hosted deployments list-deployments
elastic cloud stack get-version-stacks elastic cloud hosted stack get-version-stacks
elastic cloud accounts get-current-account unchanged (promoted)
elastic cloud organizations list-organizations unchanged (promoted)

Files changed

  • src/cli.ts — dropped the top-level serverless branch; updated cloud description.
  • src/cloud/register.ts — single public registerCloudCommands that partitions defs into promoted / hosted / serverless and composes the tree. registerServerlessCommands removed from the public API.
  • test/cloud/register.test.ts — rewritten for the unified tree; simplifyProjectCommandName unit tests retained.
  • README.mdcloud and serverless sections collapsed into one cloud section.
  • test/functional/cloud/smoke.sh — paths updated to new tree (the file was also out of sync with post-fix: update readme, cloud bugs #131 paths).

Test plan

  • npx tsc --noEmit passes.
  • npm run test:unit — 797/797 passing (24 register-specific tests cover top-level tree, promoted namespaces, hosted subgroup, serverless subgroup, synthetic-def partitioning, validation, duplicate detection, --wait on create-project, absence of aliases).
  • npm run test:lint clean.
  • elastic cloud --help lists accounts, authentication, organizations, user-role-assignments, hosted, serverless and nothing else.
  • elastic cloud serverless es projects --help shows short-name leaves (list, create, get, delete, patch, resume, get-status, get-roles, reset-credentials).
  • Top-level help no longer shows serverless.
  • Functional smoke (npm run test:functional:cloud) against a real Cloud context — reviewer with creds to verify.

MattDevy and others added 2 commits April 17, 2026 17:15
…space

Partial revert of #131. Merges the top-level `serverless` command
back under `cloud` to match customer mental model where both Hosted
Deployments and Serverless Projects are offerings of the same
product (Elastic Cloud).

New command tree:
- `elastic cloud {account,authentication,organizations,user-role-assignments}`
  — cross-cutting APIs promoted to direct children.
- `elastic cloud hosted <namespace>` — Hosted deployments, templates,
  extensions, stack versions, trusted envs, billing.
- `elastic cloud serverless <...>` — Serverless projects (es, observability,
  security) plus regions, traffic-filters, linked-projects, etc.

Top-level `serverless` command is removed. Clean break, no aliases
(project is 0.1.0-alpha.1 and the old split landed in a recent PR).

Closes #193
@github-actions

github-actions Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 2.94s
✅ REPOSITORY gitleaks yes no no 8.2s
✅ REPOSITORY git_diff yes no no 0.02s
✅ REPOSITORY secretlint yes no no 2.16s
✅ REPOSITORY trivy yes no no 14.33s
✅ TYPESCRIPT eslint 3 0 0 2.04s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

…dter-94d7c6

# Conflicts:
#	test/functional/cloud/smoke.sh
Replaces the inline `any[]` on the recursive visit helper with a local
CommandNode interface, so the test conforms to the repo's
@typescript-eslint/no-explicit-any rule.
@MattDevy MattDevy marked this pull request as ready for review April 17, 2026 16:34
@MattDevy MattDevy requested a review from ssh-esh April 17, 2026 16:40

@JoshMock JoshMock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just double-checked that register.ts is not part of code generation, so no changes needed on that side.

@MattDevy MattDevy merged commit 86fe2fd into main Apr 17, 2026
16 of 17 checks passed
@MattDevy MattDevy deleted the claude/gallant-hofstadter-94d7c6 branch April 17, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The cli distinguishes between elastic "cloud" and "serverless" - and it shouldn't

2 participants