[PR #691] [MERGED] Add Account HTTP API #12874

Closed
opened 2026-08-05 02:06:53 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/691
Author: @braginini
Created: 2/15/2023
Status: Merged
Merged: 2/16/2023
Merged by: @braginini

Base: mainHead: feature/account_http_api


📝 Commits (8)

  • 15a81f3 Add Account HTTP OpenAPI definition
  • ce0c386 Fix OpenAPI account definition
  • b0a2ebd Add Account HTTP API endpoints
  • 115bd0c Fix test
  • 46388d4 Add account settings update test
  • 6d10743 Fix lint issues
  • 8101ba2 Add Account HTTP API tests
  • 4968176 Change peer login expiration duration from float to int

📊 Changes

9 files changed (+527 additions, -0 deletions)

View changed files

📝 management/server/account.go (+62 -0)
📝 management/server/account_test.go (+42 -0)
📝 management/server/activity/codes.go (+24 -0)
management/server/http/accounts.go (+96 -0)
management/server/http/accounts_test.go (+181 -0)
📝 management/server/http/api/openapi.yml (+85 -0)
📝 management/server/http/api/types.gen.go (+24 -0)
📝 management/server/http/handler.go (+4 -0)
📝 management/server/mock_server/account_mock.go (+9 -0)

📄 Description

Describe your changes

Extend HTTP API with Account endpoints to configure global peer login expiration.
GET /api/accounts
PUT /api/account/{id}/

The GET endpoint returns an array of accounts with
always one account in the list. No exceptions.

The PUT endpoint updates account settings:
PeerLoginExpiration and PeerLoginExpirationEnabled.

PeerLoginExpiration is a duration in seconds after which peers' logins will expire.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README/documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/691 **Author:** [@braginini](https://github.com/braginini) **Created:** 2/15/2023 **Status:** ✅ Merged **Merged:** 2/16/2023 **Merged by:** [@braginini](https://github.com/braginini) **Base:** `main` ← **Head:** `feature/account_http_api` --- ### 📝 Commits (8) - [`15a81f3`](https://github.com/netbirdio/netbird/commit/15a81f3c505ff09dc5f09bcedd38003636ae3801) Add Account HTTP OpenAPI definition - [`ce0c386`](https://github.com/netbirdio/netbird/commit/ce0c38670aec2840901329ff33c2ed10b0d72d4d) Fix OpenAPI account definition - [`b0a2ebd`](https://github.com/netbirdio/netbird/commit/b0a2ebd001de8fe1c04d6c773ee6307e3ecf344b) Add Account HTTP API endpoints - [`115bd0c`](https://github.com/netbirdio/netbird/commit/115bd0cd40badd9c1a0c68305582d27618fab00b) Fix test - [`46388d4`](https://github.com/netbirdio/netbird/commit/46388d44301818df894940cf18d2b5dd55ecfdba) Add account settings update test - [`6d10743`](https://github.com/netbirdio/netbird/commit/6d107431ddafbf4590ee3066288ff1b4f00a8073) Fix lint issues - [`8101ba2`](https://github.com/netbirdio/netbird/commit/8101ba2710b215daa26bff887632b6caa597804f) Add Account HTTP API tests - [`4968176`](https://github.com/netbirdio/netbird/commit/49681760995722afa97d3bda0642b7935580eb6c) Change peer login expiration duration from float to int ### 📊 Changes **9 files changed** (+527 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `management/server/account.go` (+62 -0) 📝 `management/server/account_test.go` (+42 -0) 📝 `management/server/activity/codes.go` (+24 -0) ➕ `management/server/http/accounts.go` (+96 -0) ➕ `management/server/http/accounts_test.go` (+181 -0) 📝 `management/server/http/api/openapi.yml` (+85 -0) 📝 `management/server/http/api/types.gen.go` (+24 -0) 📝 `management/server/http/handler.go` (+4 -0) 📝 `management/server/mock_server/account_mock.go` (+9 -0) </details> ### 📄 Description ## Describe your changes Extend HTTP API with Account endpoints to configure global peer login expiration. GET /api/accounts PUT /api/account/{id}/ The GET endpoint returns an array of accounts with always one account in the list. No exceptions. The PUT endpoint updates account settings: PeerLoginExpiration and PeerLoginExpirationEnabled. PeerLoginExpiration is a duration in seconds after which peers' logins will expire. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README/documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 02:06:53 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#12874