From 127ec06fc619ff5d70dc3e93093f46a45fdcadcf Mon Sep 17 00:00:00 2001 From: Florent Gluck <florent.gluck@hesge.ch> Date: Wed, 26 Mar 2025 17:59:14 +0100 Subject: [PATCH] added minor comments --- libclient/nexusclient/client.go | 9 ++++++--- libclient/nexusclient/user.go | 4 ++++ libclient/nexusclient/vm.go | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libclient/nexusclient/client.go b/libclient/nexusclient/client.go index 39d90f1..a00be1a 100644 --- a/libclient/nexusclient/client.go +++ b/libclient/nexusclient/client.go @@ -45,7 +45,7 @@ func New(host string) (*NexusClient, error) { } // Authenticate a user. -// curl --cacert ca-cert.pem -X POST https://localhost:8000/login -H 'Content-Type: application/json' -d '{"email": "johndoe@nexus.org", "pwd":"pipomolo"}' +// curl -X POST https://localhost:8000/login -H 'Content-Type: application/json' -d '{"email": "janedoe@nexus.org", "pwd":"pipomolo"}' // Returns an JWT token if authentication succeeded or an error if it failed. // IMPORTANT: caller MUST call the Cleanup() function before exiting! func (nc *NexusClient) Authenticate(user, pwd string) (string, error) { @@ -73,8 +73,7 @@ func (nc *NexusClient) Authenticate(user, pwd string) (string, error) { } } -// "Authenticate" by using an already established connection using a previously received token. -// Useful when wanting to access the API without authenticating. +// "Authenticate" by using an already established connection using a previously received token (typically with the Authenticate method). // IMPORTANT: caller MUST call the Cleanup() function before exiting! func (nc *NexusClient) AuthenticateWithToken(token string) error { nc.client.SetAuthToken(token) @@ -125,6 +124,10 @@ func (nc *NexusClient) RefreshToken() error { } } +//======================================================================================== +// Private methods +//======================================================================================== + func (nc *NexusClient) getVMAttachCertFile() string { return nc.certFile } diff --git a/libclient/nexusclient/user.go b/libclient/nexusclient/user.go index 81d18dd..cf12975 100644 --- a/libclient/nexusclient/user.go +++ b/libclient/nexusclient/user.go @@ -139,6 +139,10 @@ func (nc *NexusClient) GetUsers() ([]params.UserWithoutPwd, error) { } } +//======================================================================================== +// Private methods +//======================================================================================== + // Deserialize a list of users from an http response (no filtering). func deserializeUsers(resp *resty.Response) ([]params.UserWithoutPwd, error) { users := []params.UserWithoutPwd{} diff --git a/libclient/nexusclient/vm.go b/libclient/nexusclient/vm.go index 91c8b5d..abca0f0 100644 --- a/libclient/nexusclient/vm.go +++ b/libclient/nexusclient/vm.go @@ -25,7 +25,7 @@ const ( ) //======================================================================================== -// Public functions +// Public methods //======================================================================================== func (nc *NexusClient) VMCreate(p params.VMCreate) (*vm.VMNetworkSerialized, error) { @@ -313,7 +313,7 @@ func (nc *NexusClient) GetListVM(vmID string) (*vm.VMNetworkSerialized, error) { } //======================================================================================== -// Private functions +// Private methods //======================================================================================== func (nc *NexusClient) vmGetSpiceCreds(vmID string, p params.VMAttachCreds) (*vm.VMSpiceCredentialsSerialized, error) { -- GitLab