[PR #228] [MERGED] Refactor: user config #323

Closed
opened 2026-02-28 00:41:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Telmate/proxmox-api-go/pull/228
Author: @Tinyblargon
Created: 1/12/2023
Status: Merged
Merged: 1/12/2023
Merged by: @mleone87

Base: masterHead: Refactor-User


📝 Commits (10+)

  • feed183 refactor: rename func and make func private
  • 3968565 refactor: make variables CamelCase
  • 59eb3eb refactor: put functions in alphabetical order
  • 2016164 refactor: remove redundant error handeling
  • 3568dd1 refactor: add Password value to ConfigUser struct
  • 219b02a refactor: remove func UpdateUserPassword from Client
  • 47011f1 refactor: remove func GetUserConfig from Client
  • 58a20ba refactor: Extract struct mapping to func.
  • aae63bf refactor: remove func CreateUser from Client
  • 0a3d4d6 refactor: remove func CheckUserExistance from Client

📊 Changes

10 files changed (+540 additions, -156 deletions)

View changed files

📝 cli/command/delete/delete.go (+7 -1)
📝 cli/command/get/get.go (+6 -1)
📝 cli/command/list/list.go (+3 -2)
📝 cli/command/set/set-user.go (+7 -3)
📝 main.go (+27 -19)
📝 proxmox/client.go (+4 -54)
📝 proxmox/config_user.go (+170 -72)
proxmox/config_user_test.go (+300 -0)
📝 test/cli/Users/User_0_test.go (+8 -2)
📝 test/cli/Users/User_1_test.go (+8 -2)

📄 Description

Word done in this pull request.

  • renamed functions in the ConfigUser class for more clarity.
  • moved user related functions out of the Client Class.
  • Added comments, fixed typos, make variables Camel Case, put things in alphabetical order.
  • Introduced the UserID type abstract the "username@realm" convention. This type should get a Validate function but the Proxmox documentation is currently unclear what are the legal characters for the user and realm name.
  • Introduced the UserPassword type making it clear to developers using this library that this type has some special rules attached to it.
  • Split Logic into it's own functions to allow for better testing.
  • Added unit test.

I haven't checked yet if it is compatible with the Terraform provider. I'll do that asap and put my findings here.


🔄 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/Telmate/proxmox-api-go/pull/228 **Author:** [@Tinyblargon](https://github.com/Tinyblargon) **Created:** 1/12/2023 **Status:** ✅ Merged **Merged:** 1/12/2023 **Merged by:** [@mleone87](https://github.com/mleone87) **Base:** `master` ← **Head:** `Refactor-User` --- ### 📝 Commits (10+) - [`feed183`](https://github.com/Telmate/proxmox-api-go/commit/feed18331e443264231f4cd9e439c058414e2e59) refactor: rename func and make func private - [`3968565`](https://github.com/Telmate/proxmox-api-go/commit/39685653dd6a679385e515a409014dcccb982a27) refactor: make variables CamelCase - [`59eb3eb`](https://github.com/Telmate/proxmox-api-go/commit/59eb3eb48d937f82c18c454722c86dd5e17a2297) refactor: put functions in alphabetical order - [`2016164`](https://github.com/Telmate/proxmox-api-go/commit/20161647d3c187bd45539311ddd3ba8e5e513162) refactor: remove redundant error handeling - [`3568dd1`](https://github.com/Telmate/proxmox-api-go/commit/3568dd1a83961291ebe466617fecb6e147272db2) refactor: add Password value to ConfigUser struct - [`219b02a`](https://github.com/Telmate/proxmox-api-go/commit/219b02a77b0237bdc2a34c4163fb5b8293299eb4) refactor: remove func UpdateUserPassword from Client - [`47011f1`](https://github.com/Telmate/proxmox-api-go/commit/47011f1fe3032ff2025220a371c95625a067a18e) refactor: remove func GetUserConfig from Client - [`58a20ba`](https://github.com/Telmate/proxmox-api-go/commit/58a20bae44214724dc5c3c6ba5e386aa2393209b) refactor: Extract struct mapping to func. - [`aae63bf`](https://github.com/Telmate/proxmox-api-go/commit/aae63bf7c0118457e41a6a84727fdcdf2216bdc7) refactor: remove func CreateUser from Client - [`0a3d4d6`](https://github.com/Telmate/proxmox-api-go/commit/0a3d4d68487317aff3f07f663e9dc1d3582c7892) refactor: remove func CheckUserExistance from Client ### 📊 Changes **10 files changed** (+540 additions, -156 deletions) <details> <summary>View changed files</summary> 📝 `cli/command/delete/delete.go` (+7 -1) 📝 `cli/command/get/get.go` (+6 -1) 📝 `cli/command/list/list.go` (+3 -2) 📝 `cli/command/set/set-user.go` (+7 -3) 📝 `main.go` (+27 -19) 📝 `proxmox/client.go` (+4 -54) 📝 `proxmox/config_user.go` (+170 -72) ➕ `proxmox/config_user_test.go` (+300 -0) 📝 `test/cli/Users/User_0_test.go` (+8 -2) 📝 `test/cli/Users/User_1_test.go` (+8 -2) </details> ### 📄 Description Word done in this pull request. - renamed functions in the `ConfigUser` class for more clarity. - moved user related functions out of the `Client` Class. - Added comments, fixed typos, make variables Camel Case, put things in alphabetical order. - Introduced the `UserID` type abstract the "username@realm" convention. This type should get a `Validate` function but the Proxmox documentation is currently unclear what are the legal characters for the user and realm name. - Introduced the `UserPassword` type making it clear to developers using this library that this type has some special rules attached to it. - Split Logic into it's own functions to allow for better testing. - Added unit test. I haven't checked yet if it is compatible with the Terraform provider. I'll do that asap and put my findings here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:41:45 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#323
No description provided.