Skip to content

Refactor authentication mechanism to use Bearer Token#1

Merged
ditahkk merged 2 commits into
mainfrom
issues/207-stack-console
Apr 8, 2026
Merged

Refactor authentication mechanism to use Bearer Token#1
ditahkk merged 2 commits into
mainfrom
issues/207-stack-console

Conversation

@ditahkk
Copy link
Copy Markdown
Contributor

@ditahkk ditahkk commented Apr 8, 2026

  • Updated the default API URL in config to point to the new backend.
  • Replaced APIKey and SecretKey fields in Profile struct with BearerToken.
  • Modified profile resolution logic to check for BearerToken instead of APIKey and SecretKey.
  • Adjusted HTTP client options to use BearerToken for authentication.
  • Updated all relevant tests to reflect changes in authentication method.
  • Implemented new envelope handling methods for GET, POST, PUT, and DELETE requests.
  • Refactored integration tests to utilize BearerToken for client setup.

Summary by CodeRabbit

  • New Features
    • Added many new CLI groups (DNS, Project, Monitoring, Billing, Support, Autoscale, Dashboard, Plan, Store, Marketplace, Product, ISO, Affinity Group, Backup, Region) and global --auto-approve/-y flag.
  • Breaking Changes
    • Switched authentication to Bearer token; resource identifiers and CLI commands now use slug-based RESTful paths.
  • Chores
    • Added Prettier formatting config and Makefile formatting/check targets.
  • Documentation
    • Major docs and guides updated (README, changelog, CLI docs, usage examples, release notes).

- Updated the default API URL in config to point to the new backend.
- Replaced APIKey and SecretKey fields in Profile struct with BearerToken.
- Modified profile resolution logic to check for BearerToken instead of APIKey and SecretKey.
- Adjusted HTTP client options to use BearerToken for authentication.
- Updated all relevant tests to reflect changes in authentication method.
- Implemented new envelope handling methods for GET, POST, PUT, and DELETE requests.
- Refactored integration tests to utilize BearerToken for client setup.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7376a220-f4df-4755-a016-b4019713c938

📥 Commits

Reviewing files that changed from the base of the PR and between 1ef70c6 and 2b7ec9f.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod

📝 Walkthrough

Walkthrough

Migrates the CLI and internal API clients from STKBILL to STKCNSL: switches authentication to bearer tokens, moves from UUID/zone query APIs to slug-based REST endpoints with standardized {status,message,data} envelopes, adds many new STKCNSL client packages and CLI commands, and updates docs, formatting, and tests.

Changes

Cohort / File(s) Summary
Docs & Changelog
README.md, CHANGELOG.md, RELEASE_NOTES.md, docs/...
Rewrite docs to reflect STKCNSL backend, bearer-token auth, slug identifiers, RESTful endpoints, pagination/envelope format, and expanded CLI surface.
Formatting & Tooling
.prettierrc, .prettierignore, Makefile
Add Prettier config/ignore, format Markdown via make fmt, and add fmt-check target.
CLI Root / Flags
cmd/zcp/root/root.go
Add global --auto-approve/-y flag and register many new top-level command groups.
API Response Handling
internal/api/response/response.go, internal/api/apierrors/*
Introduce generic response envelopes and extend error parsing to support STKCNSL envelopes (status/message/errors) alongside legacy formats.
Mass API Client Additions
internal/api/* (affinitygroup, autoscale, backup, billing, billingcycle, cloudprovider, currency, dashboard, dns, iso, marketplace, monitoring, plan, product, project, region, server, store, support, template, userprofile, vmbackup, virtualrouter, storagecategory, marketplace...)
Add ~20+ new STKCNSL client packages implementing slug-based endpoints and STKCNSL envelope parsing (list/create/update/delete flows).
Core API Migrations
internal/api/{instance,volume,vpc,network,ipaddress,snapshot,vmsnapshot,loadbalancer,kubernetes,loadbalancer,backup,...}
Refactor many existing packages from UUID/zone/query-param contracts to slug-based REST paths, new request/response DTOs, renamed/added exported types and methods, and standardized envelope decoding.
Network & Security
internal/api/{acl,egress,firewall,portforward,sshkey,securitygroup,...}
Replace query-param/UUI-based flows with slug-based endpoints, introduce new ACL/rule types, update create/delete/list signatures, and adapt tests to new envelopes.
Commands
internal/commands/* (acl, affinitygroup, autoscale, backup, auth, ...)
Add new command implementations (affinity-group, autoscale, backup), adapt ACL commands to rule-centric interface, and switch auth usage to bearer tokens.
Tests & Test Helpers
many internal/api/*/*_test.go
Update numerous tests to use BearerToken in httpclient options, adapt mocks to STKCNSL envelopes and new paths, and add tests for new packages.
Misc
.github/ISSUE_TEMPLATE/*, CONTRIBUTING.md, Makefile, go.mod
Minor template/formatting tweaks, update Go toolchain (go1.26.2) and make golang.org/x/crypto a direct requirement.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Poem

🐰
Hopping through code, token in paw,
From UUID burrows to slugs I saw,
Envelopes of JSON, tidy and neat,
New commands sprout on nimble feet,
I celebrate this RESTful spring — carrot treats! 🥕

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issues/207-stack-console

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.

1 participant